/* Rip a Pack — pack-opening simulator. Builds on styles.css tokens and the
   body[data-game] accent system; new properties are namespaced --rip-*. */

:root {
  --rip-r-rare: #6fd6c3;
  --rip-r-ultra: #82aaff;
  --rip-r-special: #c792ea;
  --rip-r-secret: #ffd35c;
  --e-out: cubic-bezier(.16,1,.3,1);
  --e-in: cubic-bezier(.5,0,.75,0);
  --e-move: cubic-bezier(.5,0,.2,1);
  --e-back: cubic-bezier(.34,1.56,.64,1);
  --e-spring: cubic-bezier(.2,.7,.3,1.1);
}

html, body { height: 100%; overflow-x: clip; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--panel-2); padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { left: 8px; }
.skip-link[hidden] { display: none; }

/* ── Nav chrome ─────────────────────────────────────────────────────── */
.blog-nav { position: sticky; top: 0; z-index: 80; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px;
  padding: 12px max(18px, env(safe-area-inset-left)); background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.blog-nav a { text-decoration: none; color: inherit; }
.blog-nav .brand { font-weight: 800; letter-spacing: .02em; white-space: nowrap; color: var(--text); }
.blog-nav .links { display: flex; gap: 14px; font-size: 13.5px; color: var(--muted); }
.blog-nav .links a:hover { color: var(--text); }
.nav-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel-2); font-size: 17px; cursor: pointer; }
.icon-btn[aria-pressed="true"] { opacity: .55; }
.session-chip { font-family: var(--mono); font-size: 12px; padding: 5px 10px; border: 1px solid var(--border);
  border-radius: 999px; color: var(--muted); white-space: nowrap;
  min-width: 0; flex-shrink: 1; overflow: hidden; text-overflow: ellipsis; }
.session-chip.pos { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, var(--border)); }
.session-chip.neg { color: var(--bad); }
.lifetime-strip { opacity: .85; font-size: 12.5px; }
.refresh-note { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
[data-state="ready"] ~ nav .links, .compact-nav .links { display: none; }

/* ── Stage & screens ────────────────────────────────────────────────── */
#stage { position: relative; min-height: calc(100dvh - var(--nav-h, 69px)); }
.screen { position: absolute; inset: 0; opacity: 0; pointer-events: none; transform: translateY(10px);
  transition: opacity .28s var(--e-out), transform .28s var(--e-out); overflow-y: auto; }
[data-state="boot"] #scr-picker,
[data-state="picker"] #scr-picker,
[data-state="loading"] #scr-loading, [data-state="load_failed"] #scr-loading,
[data-state="ready"] #scr-table, [data-state="armed"] #scr-table, [data-state="torn"] #scr-table,
[data-state="reveal"] #scr-table, [data-state="anticipate"] #scr-table, [data-state="intermission"] #scr-table,
[data-state="results"] #scr-results
  { opacity: 1; pointer-events: auto; transform: none; position: relative; }
[data-state="ready"] #scr-table, [data-state="armed"] #scr-table, [data-state="torn"] #scr-table,
[data-state="reveal"] #scr-table, [data-state="anticipate"] #scr-table, [data-state="intermission"] #scr-table
  { touch-action: none; overscroll-behavior: none; overflow: hidden; }

/* ── Veil / flash / fx ──────────────────────────────────────────────── */
.veil { position: fixed; inset: 0; background: #0a0d13; opacity: 0; pointer-events: none;
  transition: opacity .35s var(--e-out); z-index: 40; }
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 65; }
.flash.on { animation: flashPop .3s ease-out; }
@keyframes flashPop { 0% { opacity: 0; } 20% { opacity: .45; } 100% { opacity: 0; } }
#stage.shake { animation: shake .42s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake {
  10%, 90% { transform: translate3d(-3px, 0, 0); } 20%, 80% { transform: translate3d(5px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); } 40%, 60% { transform: translate3d(6px, 0, 0); }
}
.god-rays { position: fixed; inset: -30%; z-index: 45; pointer-events: none; opacity: 0;
  transition: opacity .4s ease; }
.god-rays::before, .god-rays::after { content: ""; position: absolute; inset: 0;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--accent) 14%, transparent) 0deg 8deg, transparent 8deg 24deg);
  mask: radial-gradient(circle at 50% 46%, #000 0%, transparent 62%);
  animation: raySpin 9s linear infinite; }
.god-rays::after { animation-direction: reverse; animation-duration: 14s; opacity: .6; }
.god-rays.gold::before, .god-rays.gold::after {
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--rip-r-secret) 18%, transparent) 0deg 8deg, transparent 8deg 24deg); }
.god-rays.on { opacity: 1; }
@keyframes raySpin { to { transform: rotate(360deg); } }

/* ── Counter ────────────────────────────────────────────────────────── */
.counter[hidden] { display: none; }
.counter { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); z-index: 70;
  display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(8px);
  border: 1px solid var(--border-strong); border-radius: 999px; padding: 8px 16px 10px; font-size: 14px;
  transition: transform .26s var(--e-back), border-color .3s, translate .32s var(--e-out); }
.counter.enter { animation: counterDrop .32s var(--e-out); }
@keyframes counterDrop { from { translate: 0 -120%; opacity: 0; } to { translate: 0 0; opacity: 1; } }
.counter .c-pulled { font-weight: 800; font-size: 17px; }
.counter .c-sep, .counter .c-pack { color: var(--muted); font-size: 12px; }
.counter .c-pack b { color: var(--text); }
.counter .c-bar { position: absolute; left: 10px; right: 10px; bottom: 3px; height: 3px; border-radius: 2px;
  background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform .38s var(--e-move); }
.counter.profit { border-color: var(--good); }
.counter.profit .c-pulled { color: var(--good); }
.counter.profit .c-bar { background: var(--good); box-shadow: 0 0 10px color-mix(in srgb, var(--good) 60%, transparent); }
.counter.bump { transform: translateX(-50%) scale(1.12); }
.profit-caption { position: fixed; top: 118px; left: 50%; transform: translateX(-50%); z-index: 70;
  font-size: 12px; font-weight: 800; letter-spacing: .22em; color: var(--good); opacity: 0;
  animation: captionThrough 1.4s var(--e-out); }
@keyframes captionThrough { 15% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }

/* ── Picker ─────────────────────────────────────────────────────────── */
.picker { padding: 34px max(18px, env(safe-area-inset-left)) 60px; max-width: 900px; margin: 0 auto; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .22em; color: var(--muted); margin: 0 0 8px; }
.rip-title { font-size: clamp(34px, 7vw, 52px); margin: 0 0 18px; font-weight: 800; letter-spacing: -.02em;
  background: linear-gradient(120deg, var(--text), color-mix(in srgb, var(--accent) 70%, var(--text)));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.picker-note { color: var(--bad); font-size: 13.5px; }
.game-rail { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 12px; scroll-snap-type: x proximity;
  scrollbar-width: none;
  /* stays reachable while scrolling a 19,000px set list */
  position: sticky; top: var(--nav-h, 69px); z-index: 20; background: var(--bg); }
.game-rail::-webkit-scrollbar { display: none; }
.game-chip { flex: 0 0 auto; scroll-snap-align: start; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); font-size: 13px;
  cursor: pointer; transition: transform .09s ease, border-color .2s, color .2s; }
.game-chip:active { transform: scale(.97); }
.game-chip.active { border-color: var(--accent); color: var(--accent); }
.set-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 10px; }
@media (min-width: 700px) { .set-grid { grid-template-columns: repeat(3, 1fr); } }
.set-tile { position: relative; text-align: left; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; cursor: pointer; transition: transform .09s ease, border-color .2s; animation: tileIn .26s var(--e-out) both; }
.set-tile:active { transform: scale(.97); }
.set-tile:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.set-tile img { width: 100%; height: 120px; object-fit: contain; margin-bottom: 8px; }
.set-tile.potd { border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0 18px -8px color-mix(in srgb, var(--accent) 60%, transparent); }
.t-potd { display: inline-block; margin-bottom: 6px; padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.set-tile .t-name { font-size: 13px; font-weight: 700; }
.set-tile .t-series { font-size: 10.5px; color: var(--muted); margin: 2px 0 6px; }
.set-tile .t-price { display: inline-block; font-family: var(--mono); font-size: 11.5px; padding: 3px 8px;
  border: 1px solid var(--border); border-radius: 999px; color: var(--muted); min-width: 52px; text-align: center; }
.set-tile .t-price.skeleton { color: transparent; background: linear-gradient(90deg, var(--panel-2), var(--panel-3), var(--panel-2));
  background-size: 200% 100%; animation: shimmerBg 1.2s linear infinite; }
@keyframes shimmerBg { to { background-position: -200% 0; } }
@keyframes tileIn { from { opacity: 0; transform: translateY(14px); } }

/* ── Table: pack presentation ───────────────────────────────────────── */
.table { display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px max(16px, env(safe-area-inset-left)) 90px; }
/* The active screen is only content-height, so justify-content never
   actually centered — give it the viewport to center in. Pulls the tear
   crimp out of the worst one-handed reach zone on phones. */
@media (max-width: 720px) {
  .table { min-height: calc(100dvh - var(--nav-h, 69px)); }
}
.spotlight { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(420px 520px at 50% 42%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 72%); }
.pack-zone { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.pack { position: relative; width: min(62vw, 300px); aspect-ratio: 63/88; border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border));
  background: linear-gradient(115deg, color-mix(in srgb, var(--accent) 22%, var(--panel-3)), var(--panel-2) 40%, color-mix(in srgb, var(--accent) 10%, var(--panel-3)) 75%);
  max-height: 52vh; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  animation: packIn .28s var(--e-spring); }
.pack.float { animation: packIn .28s var(--e-spring), packFloat 3s ease-in-out .3s infinite; }
@keyframes packIn { from { opacity: 0; transform: translateY(40px); } }
@keyframes packFloat { 0%, 100% { translate: 0 0; } 50% { translate: 0 -3px; } }
.pack:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.pack-crimp { position: absolute; inset: 0 0 78% 0; z-index: 2; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 26%, var(--panel-2)), color-mix(in srgb, var(--accent) 12%, var(--panel-3)));
  clip-path: polygon(0 0, 100% 0, 100% 88%, 96% 100%, 92% 88%, 88% 100%, 84% 88%, 80% 100%, 76% 88%, 72% 100%, 68% 88%, 64% 100%, 60% 88%, 56% 100%, 52% 88%, 48% 100%, 44% 88%, 40% 100%, 36% 88%, 32% 100%, 28% 88%, 24% 100%, 20% 88%, 16% 100%, 12% 88%, 8% 100%, 4% 88%, 0 100%);
  display: grid; place-items: center; border-bottom: 1px dashed var(--border-strong); }
.crimp-label { font-size: 10px; font-weight: 600; letter-spacing: .22em; color: color-mix(in srgb, var(--text) 70%, transparent); }
.tear-edge { position: absolute; left: 0; bottom: -2px; height: 3px; width: 100%;
  background: linear-gradient(90deg, #fff, color-mix(in srgb, var(--accent) 60%, #fff));
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 80%, #fff);
  transform: scaleX(0); transform-origin: left;
  mask: repeating-linear-gradient(90deg, #000 0 7px, transparent 7px 9px); }
.pack-body { position: absolute; inset: 22% 0 0 0; display: grid; place-items: center; padding: 10px; overflow: hidden; }
/* Absolutely positioned + centered: percentage sizes resolve against the
   pack body itself, so tall art scales down instead of escaping the frame. */
.pack-body img { position: absolute; inset: 0; margin: auto;
  max-width: 88%; max-height: 88%; width: auto; height: auto; object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(0,0,0,.5)); }
.pack-name { font-weight: 800; font-size: clamp(18px, 5vw, 26px); text-align: center; padding: 0 14px;
  background: linear-gradient(120deg, var(--text), color-mix(in srgb, var(--accent) 70%, var(--text)));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.pack.torn-nick .tear-edge { transform: scaleX(var(--nick, .08)); }
.pack-meta { text-align: center; }
.set-title { font-size: clamp(22px, 5vw, 32px); margin: 0; font-weight: 800; letter-spacing: -.01em;
  background: linear-gradient(120deg, var(--text), color-mix(in srgb, var(--accent) 70%, var(--text)));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.set-sub { font-size: 11px; letter-spacing: .2em; color: var(--muted); text-transform: uppercase; margin: 4px 0 10px; }
.price-chip { display: inline-block; font-family: var(--mono); font-size: 13px; border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 14px; margin: 0; }
.streak-copy { font-size: 12.5px; color: var(--muted); min-height: 18px; margin: 10px 0 0; font-style: italic; }
.ghost-finger { position: absolute; top: 8%; left: 12%; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--text) 60%, transparent); pointer-events: none; opacity: 0;
  animation: ghostTrace 2.6s ease-in-out infinite; }
@keyframes ghostTrace { 0% { opacity: 0; transform: translateX(0); } 15% { opacity: .8; }
  70% { opacity: .8; transform: translateX(220%); } 100% { opacity: 0; transform: translateX(260%); } }

.control-strip { position: fixed; bottom: max(14px, env(safe-area-inset-bottom)); left: 0; right: 0;
  display: flex; justify-content: center; align-items: center; gap: 14px; z-index: 70; }
/* the tear fallback belongs to the approach, not the reveal ritual */
[data-state="torn"] #open-fallback, [data-state="reveal"] #open-fallback,
[data-state="anticipate"] #open-fallback, [data-state="intermission"] #open-fallback,
[data-state="results"] #open-fallback { display: none; }
/* non-gesture path deserves a real thumb-sized button, not a text link */
.fallback-btn { min-height: 44px; padding: 10px 22px; text-decoration: none;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--panel-2); color: var(--text); font-size: 14px; font-weight: 600; }
.fallback-btn:hover { border-color: var(--accent); color: var(--text); }
/* escape hatch from the ready screen — only there; mid-rip it's noise */
#change-set-ready { display: none; }
[data-state="ready"] #change-set-ready { display: inline-block; }
.sr-focusable { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.sr-focusable:focus { position: fixed; width: auto; height: auto; clip: auto; left: 50%; bottom: 90px;
  transform: translateX(-50%); z-index: 96; }
.link-button { background: none; border: none; color: var(--muted); font-size: 13.5px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; padding: 10px 14px; }
.link-button:hover { color: var(--text); }
.stage-action, .rip-again { background: var(--accent); color: #0a0d13; font-weight: 800; font-size: 15px;
  border: none; border-radius: 12px; padding: 15px 28px; min-height: 52px; cursor: pointer; letter-spacing: .04em;
  transition: transform .1s ease, filter .2s; }
.stage-action:active, .rip-again:active { transform: scale(.97); }
.rip-again:disabled { opacity: .5; cursor: default; }
.skip-btn { position: fixed; top: 76px; right: max(12px, env(safe-area-inset-right)); z-index: 72; }

/* ── Cards ──────────────────────────────────────────────────────────── */
/* z-index 50 lifts the active card above the veil (40) but below fx (60) —
   the veil frames the celebration, it must never dim the card itself. */
.card-zone { position: relative; z-index: 50; width: 100%; display: flex; flex-direction: column; align-items: center; }
/* display:flex would otherwise defeat the hidden attribute, leaving an
   invisible ~450px block that pushes the pack out of center on phones */
.card-zone[hidden] { display: none; }
.pip-row { display: flex; gap: 6px; margin: 4px 0 14px; }
.pip-row span { width: 7px; height: 7px; border-radius: 50%; background: var(--panel-3); border: 1px solid var(--border); }
.pip-row span.done { background: var(--accent); border-color: var(--accent); }
/* width also capped by available height so landscape phones keep the whole
   card + plate on screen (63/88 aspect → width = height × .716) */
.card-stack { position: relative;
  width: min(78vw, 340px, calc((100dvh - 250px) * .716)); aspect-ratio: 63/88; }
.card-stack.ygo { aspect-ratio: 59/86; }
.cardx { position: absolute; inset: 0; border-radius: 4.5%/3.2%; perspective: 1100px; cursor: pointer;
  touch-action: none; }
.cardx .inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .32s cubic-bezier(.3,.1,.3,1); }
.cardx.t3 .inner { transition-duration: .56s; transition-timing-function: cubic-bezier(.22,1,.36,1); }
.cardx .face, .cardx .back { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 4.5%/3.2%; overflow: hidden; border: 1px solid var(--border-strong); }
.cardx .face { transform: rotateY(180deg); background: var(--panel-3); }
.cardx .face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cardx .face img.contain { object-fit: contain; background: var(--panel-3); }
.cardx.flipped .inner { transform: rotateY(180deg); }
.cardx .back { background: linear-gradient(160deg, var(--panel-2), var(--panel));
  display: grid; place-items: center; }
.cardx .back::before { content: ""; position: absolute; inset: 0;
  background: radial-gradient(color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 1.4px);
  background-size: 22px 22px; }
.cardx .back::after { content: ""; position: absolute; inset: 6px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: inherit; }
.cardx .back .emblem { font-weight: 800; font-size: 28px; opacity: .3; letter-spacing: .05em;
  background: linear-gradient(120deg, var(--text), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cardx .back img.symbol { width: 34%; opacity: .3; }
/* tells */
.cardx .back .shimmer-ring { position: absolute; inset: -2px; border-radius: inherit; opacity: 0; pointer-events: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent), 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent); }
.cardx.tell-1 .back .shimmer-ring { opacity: .35; animation: tellPulse 2.4s ease-in-out infinite; }
.cardx.tell-2 .back .shimmer-ring { opacity: .6; animation: tellPulse 1.8s ease-in-out infinite; }
.cardx.tell-3 .back .shimmer-ring { opacity: .85; animation: tellPulse 1.2s ease-in-out infinite;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--rip-r-special) 70%, transparent), 0 0 26px color-mix(in srgb, var(--rip-r-special) 55%, transparent); }
@keyframes tellPulse { 50% { transform: scale(1.015); opacity: .9; } }
.cardx.charged .back { animation: charged .8s ease-in-out infinite alternate; }
@keyframes charged { from { box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 60%, transparent); }
  to { box-shadow: 0 0 42px color-mix(in srgb, var(--accent) 90%, transparent); transform: scale(1.015); } }
.cardx.charged.gold .back { animation-name: chargedGold; }
@keyframes chargedGold { from { box-shadow: 0 0 18px color-mix(in srgb, var(--rip-r-secret) 70%, transparent); }
  to { box-shadow: 0 0 48px color-mix(in srgb, var(--rip-r-secret) 95%, transparent); transform: scale(1.015); } }
/* holo overlay */
.holo { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; mix-blend-mode: color-dodge;
  opacity: var(--holo-op, 0);
  background: linear-gradient(calc(100deg + var(--hx, 0) * 40deg),
    transparent 30%, rgba(255, 0, 255, .55) 42%, rgba(0, 255, 255, .5) 50%, rgba(255, 255, 0, .45) 58%, transparent 70%);
  background-position: calc(var(--hp, 50) * 1%) 0; background-size: 220% 100%; }
.holo.rainbow::after { content: ""; position: absolute; inset: -20%;
  background: conic-gradient(from 0deg, rgba(255,0,128,.35), rgba(255,200,0,.35), rgba(0,255,140,.35), rgba(0,140,255,.35), rgba(180,0,255,.35), rgba(255,0,128,.35));
  mix-blend-mode: overlay; mask: radial-gradient(circle, #000 30%, transparent 72%);
  animation: raySpin 8s linear infinite; }
.holo.reverse { mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
  mask-composite: exclude; padding: 8%; }
/* sheen pass (T1) */
.cardx .face::after { content: ""; position: absolute; inset: 0; opacity: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.35) 50%, transparent 65%);
  background-size: 240% 100%; background-position: 120% 0; }
.cardx.sheen .face::after { animation: sheenPass .5s ease-out; }
@keyframes sheenPass { from { opacity: 1; background-position: 120% 0; } to { opacity: 0; background-position: -120% 0; } }
/* plate */
.plate { position: absolute; left: 50%; bottom: -74px; transform: translate(-50%, 8px); opacity: 0; width: max-content;
  max-width: 92vw; text-align: center; transition: opacity .2s ease, transform .24s var(--e-out); pointer-events: none; }
.plate.on { opacity: 1; transform: translate(-50%, 0); }
.plate .p-name { font-size: 15px; font-weight: 700; }
.plate .p-rarity { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; margin: 1px 0 3px; }
.plate .p-price { font-family: var(--mono); font-size: 20px; font-weight: 800; }
.plate .p-price.good { color: var(--good); }
.plate.slam { animation: plateSlam .3s var(--e-back); }
@keyframes plateSlam { from { transform: translate(-50%, 0) scale(1.3); } }
.r-tint-rare { color: var(--rip-r-rare); } .r-tint-ultra { color: var(--rip-r-ultra); }
.r-tint-special { color: var(--rip-r-special); } .r-tint-secret { color: var(--rip-r-secret); }
.r-tint-bulk { color: var(--muted); }
/* ghost card */
.ghost-face { display: grid; place-items: center; gap: 4px; padding: 14px; text-align: center; height: 100%;
  background: var(--panel-2); }
.ghost-face::before { content: ""; position: absolute; inset: 0;
  background: radial-gradient(color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 1.4px); background-size: 22px 22px; }
.ghost-face .g-name { font-weight: 700; font-size: 14px; position: relative; }
.ghost-face .g-rarity { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; position: relative; }
.ghost-face .g-price { font-family: var(--mono); font-weight: 800; position: relative; }
/* rail */
.rail { position: fixed; bottom: max(10px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  display: flex; z-index: 30; pointer-events: none; }
.rail .thumb { width: 48px; aspect-ratio: 63/88; border-radius: 4px; border: 1.5px solid var(--border-strong);
  margin-left: -32px; background: var(--panel-3) center/cover; box-shadow: 0 3px 8px rgba(0,0,0,.4); }
.rail .thumb:first-child { margin-left: 0; }
.rail .thumb.t2 { border-color: var(--rip-r-ultra); } .rail .thumb.t3 { border-color: var(--rip-r-special); }
.rail .thumb.t4 { border-color: var(--rip-r-secret); }
.rail .count-chip { font-family: var(--mono); font-size: 12px; color: var(--muted); align-self: center; margin-left: 8px; }
.anticipate-caption { position: fixed; top: 30%; left: 50%; transform: translateX(-50%); z-index: 55;
  font-size: 13px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; opacity: 0; white-space: nowrap; }
.anticipate-caption.on { animation: capPulse 1.2s ease-in-out infinite; opacity: 1; }
.anticipate-caption.t3 { color: var(--rip-r-special); } .anticipate-caption.t4 { color: var(--rip-r-secret); }
@keyframes capPulse { 50% { opacity: .55; } }
.reveal-hint { position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%); z-index: 55;
  font-size: 11px; letter-spacing: .22em; color: var(--muted); opacity: 0; transition: opacity .3s; }
.reveal-hint.on { opacity: 1; }

/* ── Loading ────────────────────────────────────────────────────────── */
.loading { display: grid; place-items: center; align-content: center; gap: 18px; padding: 40px 20px; }
.pack-skeleton { width: min(52vw, 240px); aspect-ratio: 63/88; border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--panel-2), var(--panel-3), var(--panel-2)); background-size: 200% 100%;
  animation: shimmerBg 1.2s linear infinite; border: 1px solid var(--border); }
.loading-note { color: var(--muted); font-size: 13.5px; }

/* ── Results: the Rip Receipt ───────────────────────────────────────── */
.results { padding: 26px max(16px, env(safe-area-inset-left)) 60px; overflow-x: clip; }
.receipt { max-width: 640px; margin: 0 auto; }
.receipt-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.receipt-src { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0; text-transform: none; }
.verdict { text-align: center; margin: 22px 0; }
.stamp { display: inline-block; font-size: clamp(20px, 5.4vw, 30px); font-weight: 800; letter-spacing: .18em;
  padding: 10px 18px; border: 2px solid currentColor; border-radius: 6px; rotate: -4deg;
  animation: stampIn .32s var(--e-back); }
/* 1.25 max — a 1.7-scaled stamp overflowed the layout viewport on phones,
   permanently widening it (28% shrink + dead band on every receipt) */
@keyframes stampIn { from { transform: scale(1.25); opacity: 0; } }
.stamp.good { color: var(--good); } .stamp.bad { color: var(--bad); } .stamp.wash { color: var(--muted); }
.verdict-sub { display: block; margin-top: 10px; color: var(--muted); font-size: 13.5px; }
.best-card { display: grid; place-items: center; margin: 18px 0; }
.best-card .cardx { position: relative; width: min(55vw, 260px); aspect-ratio: 63/88; }
.best-card .badge-tier { margin-top: 10px; font-size: 11px; letter-spacing: .18em; font-weight: 700; }
.stat-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 18px 0; }
@media (max-width: 560px) { .stat-tiles { grid-template-columns: repeat(2, 1fr); } }
.stat-tiles .tile { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; }
.stat-tiles .k { font-size: 10px; letter-spacing: .18em; color: var(--muted); text-transform: uppercase; }
.stat-tiles .v { font-family: var(--mono); font-size: 17px; font-weight: 800; margin-top: 3px; }
.stat-tiles .v.pos { color: var(--good); } .stat-tiles .v.neg { color: var(--bad); }
.ledger { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin: 14px 0; }
.led-row { position: relative; display: grid; grid-template-columns: 34px 44px 1fr auto 90px; align-items: center;
  gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--panel); cursor: pointer;
  width: 100%; border-left: none; border-right: none; border-top: none; color: inherit; font: inherit; text-align: left; }
.led-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.led-row:last-child { border-bottom: none; }
.led-row::after { content: ""; position: absolute; left: 0; bottom: 0; top: auto; height: 2px;
  width: calc(var(--share, 0) * 100%); background: color-mix(in srgb, var(--accent) 55%, transparent); }
.led-row .rank { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: center;
  border: 1px solid var(--border); border-radius: 8px; padding: 3px 0; }
.led-row .rank.m1 { border-color: var(--rip-r-secret); color: var(--rip-r-secret); }
.led-row .rank.m2 { border-color: #cfd8e3; color: #cfd8e3; }
.led-row .rank.m3 { border-color: #d8a47f; color: #d8a47f; }
.led-row img { width: 44px; aspect-ratio: 63/88; object-fit: cover; border-radius: 3px; background: var(--panel-3); }
.led-row .l-name { font-size: 13px; font-weight: 600; min-width: 0; }
.led-row .l-name small { display: block; font-weight: 400; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; }
.led-row .l-link { font-size: 12px; color: var(--muted); }
.led-row .l-price { font-family: var(--mono); font-weight: 700; text-align: right; }
.led-row.bulk-row { color: var(--muted); font-size: 12.5px; grid-template-columns: 34px 1fr auto; }
.ev-note { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.ev-note button { background: none; border: none; color: var(--accent); cursor: pointer; text-decoration: underline;
  font-size: inherit; padding: 0; }
.action-row { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }
.rip-again { width: 100%; }
.share-btn { background: none; border: 1px solid color-mix(in srgb, var(--accent) 60%, var(--border));
  color: var(--accent); font-weight: 700; border-radius: 12px; padding: 13px; min-height: 48px; cursor: pointer; }
.session-strip { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: center; }
.rip-footer { margin-top: 34px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--muted);
  font-size: 12px; line-height: 1.6; }

/* ── Trophy case ────────────────────────────────────────────────────── */
.trophy-panel { margin-top: 30px; }
.trophy-panel h2 { font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 8px; }
.trophy-panel h2 .count { font-family: var(--mono); border: 1px solid var(--border); border-radius: 999px;
  padding: 1px 8px; font-size: 11px; }
.trophy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 10px; margin-top: 12px; }
.trophy { position: relative; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px; text-align: center; cursor: pointer; }
.trophy.new { animation: trophyIn .32s var(--e-back); }
@keyframes trophyIn { from { transform: scale(0); } }
.trophy img { width: 100%; aspect-ratio: 63/88; object-fit: cover; border-radius: 4px; background: var(--panel-3); }
.trophy .tr-name { font-size: 11.5px; font-weight: 700; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trophy .tr-meta { font-size: 10px; color: var(--muted); }
.trophy .tr-price { font-family: var(--mono); font-size: 12px; font-weight: 700; margin-top: 2px; }
.trophy .tr-x { position: absolute; top: 4px; right: 4px; background: var(--panel-3); border: 1px solid var(--border);
  border-radius: 50%; width: 22px; height: 22px; font-size: 11px; color: var(--muted); cursor: pointer; opacity: 0; }
.trophy:hover .tr-x, .trophy:focus-within .tr-x { opacity: 1; }
.trophy-empty { color: var(--muted); font-size: 12.5px; }

/* ── Dialogs / toast ────────────────────────────────────────────────── */
.share-dialog, .lightbox { background: var(--panel); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 18px; max-width: min(92vw, 380px); }
.share-dialog::backdrop, .lightbox::backdrop { background: rgba(5, 7, 10, .8); }
.share-dialog img { width: 100%; border-radius: 8px; border: 1px solid var(--border); }
.lightbox img { width: 100%; border-radius: 10px; }
.lightbox p { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.dialog-actions { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(20px); z-index: 95;
  background: var(--panel-2); border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 16px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Small / short viewports ────────────────────────────────────────── */
@media (max-width: 340px) {
  .picker, .results { padding-left: 12px; padding-right: 12px; }
  .card-stack { width: min(72vw, 240px); }
  .counter .c-sep, .counter .c-pack { display: none; }
}
@media (max-height: 560px) and (orientation: landscape) {
  .counter { left: 12px; right: auto; transform: none; }
  .counter.bump { transform: scale(1.12); }
  .pack { max-height: 62vh; width: auto; height: 62vh; }
  .rail { left: auto; right: 10px; top: 70px; bottom: auto; flex-direction: column; }
  .rail .thumb { margin-left: 0; margin-top: -46px; }
  .rail .thumb:first-child { margin-top: 0; }
  .card-stack { width: calc((100dvh - 150px) * .716); }
  .plate { bottom: -58px; }
  .plate .p-price { font-size: 16px; }
}

/* ── Reduced motion: designed, not disabled ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .pack.float, .ghost-finger, .god-rays::before, .god-rays::after, .holo.rainbow::after,
  .cardx.charged .back, .anticipate-caption.on { animation: none; }
  .god-rays { display: none; }
  #stage.shake { animation: none; }
  .cardx .inner { transition: none; }
  .cardx.flipped .inner { transform: rotateY(180deg); }
  .cardx.tell-1 .back .shimmer-ring, .cardx.tell-2 .back .shimmer-ring, .cardx.tell-3 .back .shimmer-ring
    { animation: none; opacity: .5; }
  .static-burst { position: absolute; inset: -18%; z-index: -1; opacity: .25;
    background: repeating-conic-gradient(from 0deg, currentColor 0deg 4deg, transparent 4deg 45deg); border-radius: 50%; }
}
body.reduce-fx .pack.float, body.reduce-fx .ghost-finger, body.reduce-fx .god-rays::before,
body.reduce-fx .god-rays::after, body.reduce-fx .holo.rainbow::after, body.reduce-fx .cardx.charged .back,
body.reduce-fx .anticipate-caption.on { animation: none; }
body.reduce-fx .god-rays { display: none; }
body.reduce-fx #stage.shake { animation: none; }
body.reduce-fx .cardx .inner { transition: none; }
