/* App dashboard + pack opening */
.app { padding: 28px 0 80px; display: grid; gap: 16px; }
.app-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 980px) { .app-grid { grid-template-columns: 1fr; } }
.side { display: grid; gap: 16px; }
.shelf { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 640px) { .shelf { grid-template-columns: 1fr; } }
.shelf__item { background: var(--panel-2); border: 1px solid var(--line); border-radius: 16px; padding: 18px 14px 14px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; transition: border-color .2s; }
.shelf__item.is-hl { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(245, 197, 66, .15); }
.shelf__item .pack { --k: .714; }
.shelf__item .name { font: 800 24px/1 var(--display); text-transform: uppercase; }
.shelf__item .price { font: 600 14px/1.3 var(--mono); }
.shelf__item .price b { font-size: 18px; }
.shelf__item .btn { width: 100%; }
.hint { margin: 14px 0 0; font-size: 13px; color: var(--dim); }
.hint b { color: var(--gold); }
.you-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.you-stats .k { font: 600 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.you-stats .v { font: 800 28px/1 var(--display); margin-top: 8px; }
.kv { display: grid; gap: 6px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.kv code { font-size: 12px; color: #fff; word-break: break-all; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.input { height: 36px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); color: #fff; padding: 0 10px; font: 14px var(--body); }
input.input { width: 100%; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) { #collection .panel__head { flex-direction: column; align-items: stretch; } .toolbar { justify-content: flex-start; } }

/* collection grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.grid .empty { grid-column: 1 / -1; margin: 10px 0; }
.owned { position: relative; cursor: pointer; transition: transform .15s; }
.owned:hover { transform: translateY(-3px); }
.owned .sel { position: absolute; top: 8px; right: 8px; z-index: 3; width: 24px; height: 24px; border-radius: 7px; border: 2px solid rgba(255, 255, 255, .7);
  background: rgba(8, 9, 12, .6); display: grid; place-items: center; font-size: 14px; font-weight: 800; }
.owned.is-sel .sel { background: var(--gold); border-color: var(--gold); color: #1b1300; }
.owned.is-sel .tcard { box-shadow: 0 0 0 3px var(--gold), 0 18px 40px rgba(0, 0, 0, .5); }
.owned .name { font-size: 13px; color: var(--muted); margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.owned .sell1 { margin-top: 6px; width: 100%; }
.owned.is-selling { pointer-events: none; opacity: .55; }
.owned.is-selling::after { content: "Paying…"; position: absolute; inset: 0 0 auto 0; aspect-ratio: 5 / 7; display: grid; place-items: center;
  font: 800 20px var(--display); text-transform: uppercase; background: rgba(0, 0, 0, .55); border-radius: 10px; }

/* live feed */
.feed { display: grid; gap: 2px; }
.feed__row { display: grid; grid-template-columns: 38px 1fr auto; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.feed__row:first-child { border-top: 0; }
.feed__row img { width: 38px; border-radius: 4px; aspect-ratio: 5 / 7; object-fit: cover; }
.feed__row .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed__row .m { color: var(--dim); font-size: 12px; }
.feed__row .val { font-family: var(--mono); font-weight: 600; color: var(--tier); text-align: right; }

/* opener overlay */
.opener { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; overflow-y: auto;
  background: radial-gradient(70% 60% at 50% 40%, rgba(30, 90, 140, .35), transparent 70%), rgba(5, 6, 8, .95);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.opener__stage { width: min(1100px, 100%); padding: 40px 16px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.opener__status { font: 800 30px/1 var(--display); text-transform: uppercase; min-height: 34px; margin-bottom: 26px; }
.opener__close { position: absolute; top: 16px; right: 16px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line-2);
  background: var(--panel); color: #fff; font-size: 24px; cursor: pointer; }
/* the pack is drawn twice (strip + body, clipped along a zigzag in motion.css) so the top can tear off */
.tear { position: relative; width: 230px; aspect-ratio: 5 / 8; filter: drop-shadow(0 26px 40px rgba(0, 0, 0, .55)); }
.tear__p { position: absolute; inset: 0; }
.tear .pack { --k: 1.0953; filter: none; cursor: default; }
.opener__pack.is-waiting .tear { animation: wobble 1.1s ease-in-out infinite; }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-3deg) scale(1.02); } 75% { transform: rotate(3deg) scale(1.02); } }
.opener__pack.is-torn .tear__p--top { animation: tearTop .75s cubic-bezier(.3, .6, .4, 1) forwards; }
.opener__pack.is-torn .tear__p--body { animation: tearBody .75s cubic-bezier(.5, 0, .7, .4) forwards; }
@keyframes tearTop { 22% { transform: translate(8px, -12px) rotate(5deg); filter: brightness(1.9); } 100% { transform: translate(170px, -230px) rotate(64deg); opacity: 0; } }
@keyframes tearBody { 22% { transform: scale(1.06) rotate(-2deg); filter: brightness(1.5); } 100% { transform: translateY(150px) scale(.66); opacity: 0; } }
.opener.is-big::after { content: ""; position: fixed; inset: 0; z-index: 155; pointer-events: none;
  background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0) 70%); animation: bigflash .9s ease-out forwards; }
@keyframes bigflash { from { opacity: 1; } to { opacity: 0; } }
.opener__cards { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 16px; perspective: 1200px; }
.flip { width: 170px; cursor: pointer; opacity: 0; transform: translateY(80px) scale(.6); transition: opacity .4s, transform .5s cubic-bezier(.2, .9, .3, 1.2); }
.flip.in { opacity: 1; transform: none; }
.flip__inner { position: relative; width: 100%; aspect-ratio: 5 / 7; transition: transform .7s cubic-bezier(.3, .7, .2, 1); transform-style: preserve-3d; }
.flip--hit:not(.is-open) .flip__inner { animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.flip.is-open .flip__inner { transform: rotateY(180deg); }
.flip__back, .flip__front { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flip__front { transform: rotateY(180deg); }
.flip__front .tcard { width: 100%; height: 100%; }
.flip__back { border-radius: 10px; border: 2px solid rgba(255, 255, 255, .22); display: grid; place-items: center; overflow: hidden; background: #000; }
.flip__back::after { content: ""; position: absolute; inset: 7px; border-radius: 6px; border: 1px solid rgba(245, 197, 66, .45); }
.flip__back .flag { width: 92%; }
.flip--hit { width: 200px; }
.flip.is-open.is-glow .tcard { animation: glow 1.6s ease-in-out infinite alternate; }
@keyframes glow { from { box-shadow: 0 0 0 2px var(--tier), 0 0 26px color-mix(in srgb, var(--tier) 60%, transparent); } to { box-shadow: 0 0 0 2px var(--tier), 0 0 60px var(--tier); } }
.flip .meta { margin-top: 8px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .4s .4s; }
.flip.is-open .meta { opacity: 1; }
@media (max-width: 640px) { .flip { width: 104px; } .flip--hit { width: 150px; } .opener__status { font-size: 24px; } }
.opener__summary { margin-top: 30px; display: grid; gap: 10px; justify-items: center; }
.opener__total { font-size: 44px; }
.opener__total span { color: var(--gold); }
.opener__summary .row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.burst { position: fixed; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; z-index: 160; }
.burst i { position: absolute; width: 8px; height: 14px; border-radius: 2px; background: var(--c); animation: burst 1.4s cubic-bezier(.1, .8, .3, 1) forwards; }
@keyframes burst { to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; } }
