/* ==================================================================
   CardRush — "vault" theme. Tokens first; dark is the default look,
   light follows the OS or the Account → Appearance switch.
   ================================================================== */
:root {
  --bg: #0a0c11;
  --bg-2: #0e1118;
  --panel: #131721;
  --panel-2: #191e2a;
  --panel-3: #202634;
  --line: #252b39;
  --line-2: #323a4c;
  --ink: #eef1f7;
  --dim: #9ba3b4;
  --faint: #687084;
  --gold: #d6b25e;
  --gold-2: #f3d98f;
  --gold-ink: #231a05;
  --gold-soft: rgba(214, 178, 94, 0.12);
  --accent: #8b7bff;
  --accent-soft: rgba(139, 123, 255, 0.14);
  --success: #34c77b;
  --success-soft: rgba(52, 199, 123, 0.13);
  --danger: #f06262;
  --danger-soft: rgba(240, 98, 98, 0.13);
  --warn: #f2a93b;
  --warn-soft: rgba(242, 169, 59, 0.14);
  --rarity-common: #7f879a;
  --rarity-uncommon: #2fb36b;
  --rarity-rare: #4c8dff;
  --rarity-holo: #a071ff;
  --rarity-ultra: #e3a51c;
  --rarity-secret: #ff5fa8;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar: 236px;
  --topbar: 64px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Sora', 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f4f0; --bg-2: #efede7; --panel: #ffffff; --panel-2: #f6f5f1; --panel-3: #eeece6;
    --line: #e5e2da; --line-2: #d8d4c9; --ink: #15171d; --dim: #5b6271; --faint: #8a90a0;
    --gold: #a47f1f; --gold-2: #c69a2a; --gold-ink: #fffaf0; --gold-soft: rgba(164, 127, 31, 0.1);
    --accent: #5b47e0; --accent-soft: rgba(91, 71, 224, 0.1);
    --success: #178a50; --success-soft: rgba(23, 138, 80, 0.1);
    --danger: #c9372c; --danger-soft: rgba(201, 55, 44, 0.09);
    --warn: #b86e00; --warn-soft: rgba(184, 110, 0, 0.1);
    --shadow-sm: 0 1px 2px rgba(20, 20, 30, 0.06);
    --shadow: 0 8px 24px rgba(20, 20, 30, 0.08);
    --shadow-lg: 0 20px 50px rgba(20, 20, 30, 0.16);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f5f4f0; --bg-2: #efede7; --panel: #ffffff; --panel-2: #f6f5f1; --panel-3: #eeece6;
  --line: #e5e2da; --line-2: #d8d4c9; --ink: #15171d; --dim: #5b6271; --faint: #8a90a0;
  --gold: #a47f1f; --gold-2: #c69a2a; --gold-ink: #fffaf0; --gold-soft: rgba(164, 127, 31, 0.1);
  --accent: #5b47e0; --accent-soft: rgba(91, 71, 224, 0.1);
  --success: #178a50; --success-soft: rgba(23, 138, 80, 0.1);
  --danger: #c9372c; --danger-soft: rgba(201, 55, 44, 0.09);
  --warn: #b86e00; --warn-soft: rgba(184, 110, 0, 0.1);
  --shadow-sm: 0 1px 2px rgba(20, 20, 30, 0.06);
  --shadow: 0 8px 24px rgba(20, 20, 30, 0.08);
  --shadow-lg: 0 20px 50px rgba(20, 20, 30, 0.16);
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 14px; line-height: 1.5; min-height: 100vh; -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
/* Inline icons default to text size; components override (zero specificity). */
:where(svg) { width: 1.1em; height: 1.1em; flex-shrink: 0; vertical-align: -0.18em; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: var(--ink); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
::selection { background: var(--gold-soft); }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 700; }
h3 { font-size: 0.95rem; font-weight: 600; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.dim { color: var(--dim); }
.faint { color: var(--faint); }
.small { font-size: 0.8rem; }
.tiny { font-size: 0.72rem; }
.nowrap { white-space: nowrap; }
.sub { color: var(--dim); font-size: 0.86rem; margin: 0.25rem 0 0; }
.eyebrow { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }
.row { display: flex; align-items: center; gap: 0.6rem; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 0.6rem; }
.grow { flex: 1; min-width: 0; }
.spacer { height: 1rem; }
.coin { display: inline-block; width: 0.95em; height: 0.95em; border-radius: 50%; vertical-align: -0.12em;
  background: radial-gradient(circle at 35% 30%, #fff5cf, var(--gold-2) 35%, var(--gold) 70%, #7d5d10);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.15); flex-shrink: 0; margin-right: 0.28em; }
.price .coin, .stat .v .coin, .pkg .amt .coin, .balance-pill .coin { margin-right: 0; }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  height: 40px; padding: 0 1.05rem; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--ink); font-weight: 600; font-size: 0.88rem;
  cursor: pointer; white-space: nowrap; transition: background 0.15s, border-color 0.15s, transform 0.08s, opacity 0.15s;
  text-decoration: none;
}
.btn:hover { background: var(--panel-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.primary {
  background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-color: transparent; color: var(--gold-ink);
  box-shadow: 0 6px 18px rgba(214, 178, 94, 0.22), inset 0 1px 0 rgba(255,255,255,0.35);
}
.btn.primary:hover { filter: brightness(1.05); background: linear-gradient(180deg, var(--gold-2), var(--gold)); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: transparent; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.success { background: var(--success); border-color: transparent; color: #fff; }
.btn.sm { height: 32px; padding: 0 0.75rem; font-size: 0.8rem; border-radius: 8px; }
.btn.lg { height: 48px; padding: 0 1.5rem; font-size: 0.95rem; border-radius: 12px; }
.btn.block { width: 100%; }
.btn.icon { width: 40px; padding: 0; }
.btn.sm.icon { width: 32px; }
.link-btn { background: none; border: none; padding: 0; color: var(--gold); cursor: pointer; font-weight: 600; }
.link-btn:hover { text-decoration: underline; }

.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.8rem; }
.field label, .field > .lbl { font-size: 0.78rem; font-weight: 600; color: var(--dim); }
.input, .select, textarea.input {
  width: 100%; height: 42px; padding: 0 0.8rem; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--bg-2); transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input { height: auto; min-height: 72px; padding: 0.6rem 0.8rem; resize: vertical; }
.input:focus, .select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.input.sm, .select.sm { height: 34px; font-size: 0.82rem; border-radius: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.8rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-error { color: var(--danger); font-size: 0.82rem; min-height: 1.2em; margin: 0.2rem 0 0.6rem; }
.field .stepper { align-self: flex-start; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: var(--bg-2); }
.stepper button { width: 34px; height: 38px; border: none; background: transparent; cursor: pointer; font-size: 1.05rem; color: var(--dim); }
.stepper button:hover { background: var(--panel-3); color: var(--ink); }
.stepper input { width: 48px; height: 38px; border: none; background: transparent; text-align: center; font-family: var(--mono); -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper.sm button { width: 28px; height: 30px; }
.stepper.sm input { width: 34px; height: 30px; font-size: 0.8rem; }

.chips { display: flex; gap: 0.4rem; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; height: 32px; padding: 0 0.85rem; border-radius: 999px; border: 1px solid var(--line-2);
  background: transparent; color: var(--dim); font-size: 0.8rem; font-weight: 600; cursor: pointer;
}
.chip:hover { color: var(--ink); border-color: var(--faint); }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg { display: inline-flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex-shrink: 0; border: none; background: transparent; color: var(--dim); height: 32px; padding: 0 0.85rem; border-radius: 7px; font-weight: 600; font-size: 0.82rem; cursor: pointer; }
.seg button.active { background: var(--panel-3); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg button .count { margin-left: 0.35rem; font-family: var(--mono); font-size: 0.72rem; color: var(--gold); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem; height: 22px; padding: 0 0.55rem; border-radius: 999px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; white-space: nowrap;
  background: var(--panel-3); color: var(--dim); border: 1px solid var(--line-2);
}
.badge.gold { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.solid-danger { background: var(--danger); color: #fff; border-color: transparent; }
.rarity { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.75rem; font-weight: 600; color: var(--dim); }
.rarity::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--rc, var(--rarity-common)); }
.r-common { --rc: var(--rarity-common); } .r-uncommon { --rc: var(--rarity-uncommon); } .r-rare { --rc: var(--rarity-rare); }
.r-holo_rare { --rc: var(--rarity-holo); } .r-ultra_rare { --rc: var(--rarity-ultra); } .r-secret_rare { --rc: var(--rarity-secret); }
.grade-tag { display: inline-flex; align-items: center; height: 20px; border-radius: 5px; overflow: hidden; font-size: 0.68rem; font-weight: 800; border: 1px solid var(--gold); }
.grade-tag b { background: var(--gold); color: var(--gold-ink); padding: 0 0.35rem; height: 100%; display: flex; align-items: center; }
.grade-tag span { padding: 0 0.4rem; color: var(--gold); font-family: var(--mono); }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 0.25rem;
  padding: 1.1rem 0.85rem; background: var(--bg-2); border-right: 1px solid var(--line); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 0.6rem; padding: 0.2rem 0.5rem 1.2rem; color: var(--ink); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0;
  background: conic-gradient(from 210deg, var(--gold-2), var(--gold), #7d5d10, var(--gold-2));
  box-shadow: 0 6px 16px rgba(214,178,94,0.25);
}
.brand-mark::after { content: ''; width: 14px; height: 18px; border-radius: 3px; border: 2px solid var(--gold-ink); background: rgba(255,255,255,0.25); }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 1.08rem; letter-spacing: -0.02em; }
.brand-name span { color: var(--gold); }
.nav-label { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); padding: 0.9rem 0.65rem 0.35rem; }
.nav-link {
  display: flex; align-items: center; gap: 0.7rem; height: 40px; padding: 0 0.7rem; border-radius: 10px;
  color: var(--dim); font-weight: 600; font-size: 0.88rem; text-decoration: none; position: relative;
}
.nav-link:hover { background: var(--panel); color: var(--ink); text-decoration: none; }
.nav-link.active { background: var(--panel-2); color: var(--ink); }
.nav-link.active::before { content: ''; position: absolute; left: -0.85rem; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-link .pip { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--gold); color: var(--gold-ink); font-size: 0.66rem; font-weight: 800; display: grid; place-items: center; }
.sidebar-foot { margin-top: auto; padding: 0.8rem 0.5rem 0; font-size: 0.72rem; color: var(--faint); line-height: 1.5; }

.app-main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar); display: flex; align-items: center; gap: 0.6rem;
  padding: 0 1.5rem; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line);
}
.topbar .brand { display: none; padding: 0; }
.topbar-title { font-family: var(--display); font-weight: 700; font-size: 1rem; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.guest-actions { display: flex; gap: 0.4rem; }
body:not(.guest) .guest-actions, body.guest #notifBtn, body.guest #bonusBtn, body.guest #balancePill, body.guest #avatarBtn { display: none; }
.balance-pill {
  display: inline-flex; align-items: center; gap: 0.5rem; height: 40px; padding: 0 0.35rem 0 0.85rem; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line-2); font-family: var(--mono); font-weight: 700; font-size: 0.92rem; cursor: pointer;
}
.balance-pill:hover { border-color: var(--gold); }
.balance-pill .plus { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--gold-ink); font-family: var(--font); font-weight: 800; font-size: 1.05rem; }
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel); display: grid; place-items: center; cursor: pointer; color: var(--dim); }
.icon-btn:hover { color: var(--ink); border-color: var(--faint); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .count { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 0.68rem; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--panel); }
.icon-btn .dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px var(--panel); }
.avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-family: var(--display); font-weight: 700; color: var(--gold-ink); background: linear-gradient(135deg, var(--gold-2), var(--gold)); cursor: pointer; border: none; flex-shrink: 0; }
.avatar.sm { width: 30px; height: 30px; border-radius: 9px; font-size: 0.78rem; }
.avatar.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 1.5rem; }
.avatar.muted { background: var(--panel-3); color: var(--dim); }

.banner {
  display: flex; align-items: center; gap: 0.75rem; margin: 1rem 1.5rem 0; padding: 0.7rem 1rem; border-radius: 12px;
  background: var(--warn-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); font-size: 0.86rem;
}
.banner svg { width: 18px; height: 18px; color: var(--warn); flex-shrink: 0; }
.banner.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.banner.info svg { color: var(--accent); }
.banner.inline { margin: 0 0 1.25rem; }
.banner.success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.banner.success svg { color: var(--success); }
.banner.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.banner.danger svg { color: var(--danger); }
.verify-list { list-style: none; margin: 0.6rem 0 1rem; padding: 0; display: grid; gap: 0.45rem; }
.verify-list li { display: flex; align-items: center; gap: 0.5rem; min-width: 0; overflow-wrap: anywhere; }
.verify-list svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--warn); }
.verify-list li.done { color: var(--dim); text-decoration: line-through; }
.verify-list li.done svg { color: var(--success); }

main.views { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
.view { display: none; }
.view.active { display: block; animation: rise 0.22s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.55rem; }
.page-head > * { min-width: 0; max-width: 100%; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 2rem 0 0.85rem; flex-wrap: wrap; }
.section-head:first-child { margin-top: 0; }
.back { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--dim); font-weight: 600; font-size: 0.85rem; margin-bottom: 1rem; background: none; border: none; cursor: pointer; padding: 0; }
.back:hover { color: var(--ink); }
footer.legal { max-width: 1240px; margin: 0 auto; padding: 1.5rem; color: var(--faint); font-size: 0.72rem; line-height: 1.6; border-top: 1px solid var(--line); width: 100%; }

.bottom-nav { display: none; }

/* ---------- Panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.panel + .panel { margin-top: 1rem; }
.grid-2 > .panel + .panel, .grid-3 > .panel + .panel { margin-top: 0; }
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; margin-bottom: 1rem; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.split { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; margin-bottom: 1.25rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 0.85rem 1rem; }
.stat .k { font-size: 0.72rem; color: var(--dim); font-weight: 600; }
.stat .v { font-family: var(--mono); font-weight: 700; font-size: 1.2rem; margin-top: 0.15rem; display: flex; align-items: center; gap: 0.4rem; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--dim); }
.empty .icon { width: 48px; height: 48px; margin: 0 auto 0.75rem; border-radius: 14px; display: grid; place-items: center; background: var(--panel-2); color: var(--faint); }
.empty .icon svg { width: 22px; height: 22px; }
.empty h3 { color: var(--ink); margin-bottom: 0.3rem; }
.skeleton { background: linear-gradient(90deg, var(--panel-2), var(--panel-3), var(--panel-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.divider { height: 1px; background: var(--line); margin: 1rem 0; }
.pull-stats { margin-bottom: 1rem; }
.pull-breakdown { margin-bottom: 1rem; align-items: stretch; }
.best-pull { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.best-pull .thumb { width: 72px; flex-shrink: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; font-size: 0.86rem; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; text-align: right; font-family: var(--mono); }
.kv dd, .hash { min-width: 0; }
.hash { font-family: var(--mono); font-size: 0.78rem; overflow-wrap: anywhere; word-break: break-all; }
.fair-steps { margin: 0.75rem 0 0; padding-left: 1.2rem; display: grid; gap: 0.7rem; font-size: 0.88rem; color: var(--dim); }
.fair-steps b { color: var(--ink); }
.fair-steps .mono { font-size: 0.78rem; overflow-wrap: anywhere; }
.fair-link { color: var(--gold); font-weight: 600; text-decoration: none; }
.fair-link:hover { text-decoration: underline; }
.odds-note .hash { display: block; margin-top: 0.35rem; color: var(--ink); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.table th { text-align: left; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; }
.table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--panel-2); }
.table .r { text-align: right; }
.table .gone td { opacity: 0.38; }
.table .gone td:first-child .name { text-decoration: line-through; }
.table-scroll { max-height: 520px; overflow: auto; }
.cell-card { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.cell-card .thumb { width: 34px; flex-shrink: 0; }
.cell-card .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-card .meta { font-size: 0.74rem; color: var(--dim); }
.pos { color: var(--success); } .neg { color: var(--danger); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 20px; border: 1px solid var(--line); padding: 2.2rem;
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 1.5rem; align-items: center;
  background:
    radial-gradient(600px 300px at 85% 20%, rgba(214,178,94,0.16), transparent 60%),
    radial-gradient(500px 300px at 70% 100%, rgba(139,123,255,0.14), transparent 60%),
    linear-gradient(180deg, var(--panel), var(--bg-2));
}
.hero h1 { font-size: clamp(1.7rem, 3.2vw, 2.5rem); line-height: 1.08; font-weight: 800; letter-spacing: -0.03em; margin: 0.5rem 0 0.75rem; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--gold-2), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--dim); max-width: 460px; margin: 0 0 1.3rem; font-size: 0.95rem; }
.hero-stats { display: flex; gap: 1.6rem; margin-top: 1.6rem; flex-wrap: wrap; }
.hero-stats .v { font-family: var(--mono); font-weight: 700; font-size: 1.15rem; }
.hero-stats .k { font-size: 0.72rem; color: var(--dim); }
.hero-art { position: relative; height: 290px; display: flex; align-items: center; justify-content: center; }
.hero-art .fan { position: absolute; width: 150px; transition: transform 0.4s; }
.hero-art .fan:nth-child(1) { transform: translateX(-95px) rotate(-12deg) scale(0.88); opacity: 0.8; }
.hero-art .fan:nth-child(2) { transform: translateX(95px) rotate(12deg) scale(0.88); opacity: 0.8; }
.hero-art .fan:nth-child(3) { z-index: 2; transform: translateY(-6px); filter: drop-shadow(0 25px 35px rgba(0,0,0,0.5)); }
.hero:hover .hero-art .fan:nth-child(1) { transform: translateX(-110px) rotate(-15deg) scale(0.88); }
.hero:hover .hero-art .fan:nth-child(2) { transform: translateX(110px) rotate(15deg) scale(0.88); }

/* ---------- Live ticker ---------- */
.ticker { display: flex; align-items: center; gap: 0.75rem; margin: 1.25rem 0 0; padding: 0.55rem 0.75rem; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); overflow: hidden; }
.live-dot { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.1em; color: var(--danger); flex-shrink: 0; }
.live-dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(240,98,98,0.6); } 70% { box-shadow: 0 0 0 7px rgba(240,98,98,0); } 100% { box-shadow: 0 0 0 0 rgba(240,98,98,0); } }
.ticker-track { display: flex; gap: 0.5rem; overflow-x: auto; scrollbar-width: none; flex: 1; }
.ticker-track::-webkit-scrollbar { display: none; }
.ticker-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.7rem 0.25rem 0.3rem; border-radius: 9px; background: var(--panel-2); flex-shrink: 0; font-size: 0.78rem; cursor: pointer; border: 1px solid transparent; }
.ticker-item:hover { border-color: var(--line-2); }
.ticker-item .thumb { width: 22px; }
.ticker-item b { font-weight: 600; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar .chips { flex: 1; min-width: 0; }
.search { position: relative; min-width: 200px; }
.search svg { position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.search .input { padding-left: 2.1rem; }

/* ---------- Pack tiles ---------- */
.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.pack-tile {
  position: relative; display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.pack-tile:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: var(--shadow); }
.pack-tile.sold-out { opacity: 0.55; }
.pack-cover {
  position: relative; height: 200px; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: radial-gradient(circle at 50% 35%, var(--glow, rgba(214,178,94,0.22)), transparent 62%), linear-gradient(180deg, var(--panel-2), var(--panel));
}
.pack-cover::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, transparent 0 14px, rgba(255,255,255,0.018) 14px 15px); pointer-events: none; }
.pack-cover .cover-card { width: 100px; transform: rotate(-4deg); transition: transform 0.25s; filter: drop-shadow(0 14px 18px rgba(0,0,0,0.45)); z-index: 1; }
.pack-cover .cover-card.is-slab { width: 92px; }
.pack-tile:hover .cover-card { transform: rotate(0deg) scale(1.04); }
.pack-cover .corner { position: absolute; top: 0.7rem; left: 0.7rem; display: flex; gap: 0.35rem; z-index: 2; flex-wrap: wrap; }
.pack-cover .corner-r { position: absolute; top: 0.7rem; right: 0.7rem; z-index: 2; }
.pack-cover .badge { background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-color: var(--line-2); }
.pack-cover .badge.solid-danger { background: var(--danger); border-color: transparent; }
.pack-body { padding: 0.9rem 1rem 1rem; display: flex; flex-direction: column; gap: 0.55rem; border-top: 1px solid var(--line); }
.pack-name { font-family: var(--display); font-weight: 700; font-size: 0.98rem; line-height: 1.25; }
.pack-meta { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.price { display: inline-flex; align-items: center; gap: 0.35rem; font-family: var(--mono); font-weight: 700; font-size: 1rem; }
.price.lg { font-size: 1.5rem; }
.price .per { font-family: var(--font); font-weight: 500; font-size: 0.75rem; color: var(--dim); }
.progress { height: 6px; border-radius: 999px; background: var(--panel-3); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width 0.5s ease; }
.progress.low > i { background: linear-gradient(90deg, var(--danger), #ff9a7a); }
.progress-label { display: flex; justify-content: space-between; font-size: 0.74rem; color: var(--dim); }
.progress-label b { color: var(--ink); font-family: var(--mono); font-weight: 600; }

/* ---------- Pack detail ---------- */
.stage {
  position: relative; border-radius: 18px; border: 1px solid var(--line); overflow: hidden; min-height: 420px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2rem; padding: 2rem 1rem;
  background: radial-gradient(420px 260px at 50% 40%, rgba(214,178,94,0.14), transparent 70%), linear-gradient(180deg, var(--panel), var(--bg-2));
}
.stage .pack-slot { min-height: 230px; }
.first-pack { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; font-weight: 600; color: var(--gold); background: var(--gold-soft); border-radius: 999px; padding: 0.3rem 0.75rem; margin-top: -0.4rem; }
.first-pack svg { width: 15px; height: 15px; }
.skip-toggle { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--dim); cursor: pointer; margin-top: -0.6rem; }
.skip-toggle input { accent-color: var(--gold); width: 15px; height: 15px; }
.detail-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.top-hits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.top-hit { text-align: center; }
.top-hit .val { font-family: var(--mono); font-weight: 700; font-size: 0.82rem; margin-top: 0.4rem; }
.odds-note { display: flex; gap: 0.6rem; align-items: flex-start; font-size: 0.8rem; color: var(--dim); background: var(--panel-2); border-radius: 10px; padding: 0.7rem 0.85rem; }
.odds-note svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; color: var(--gold); }

/* ---------- Card frames (original CSS art — never real card images) ---------- */
.tcg-card {
  width: 100%; aspect-ratio: 5 / 7; border-radius: 7% / 5%; padding: 5%; display: flex; flex-direction: column;
  background: linear-gradient(160deg, #fbfaf6, #ecebe4); color: #16181f; position: relative; overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3), inset 0 0 0 1px rgba(255,255,255,0.5); container-type: inline-size;
}
.tcg-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4%; font-size: 8.5cqw; font-weight: 800; line-height: 1.05; font-family: var(--display); }
.tcg-card-head .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcg-card-head .hp { font-size: 6.5cqw; color: #444; flex-shrink: 0; }
.tcg-card-art { flex: 1; margin: 4% 0; border-radius: 4%; display: flex; align-items: center; justify-content: center; font-size: 26cqw; position: relative; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.15); }
.tcg-card-art.holo::after {
  content: ''; position: absolute; inset: 0; mix-blend-mode: overlay;
  background: linear-gradient(115deg, transparent 20%, rgba(255,255,255,0.75) 40%, rgba(160,113,255,0.5) 50%, transparent 65%);
  background-size: 250% 250%; animation: sheen 2.6s linear infinite;
}
@keyframes sheen { 0% { background-position: 0% 0%; } 100% { background-position: 220% 220%; } }
.tcg-card-attack { font-size: 5.8cqw; background: rgba(0,0,0,0.07); border-radius: 3cqw; padding: 1.5% 4%; display: flex; justify-content: space-between; font-weight: 700; }
.tcg-card-foot { display: flex; justify-content: space-between; font-size: 5cqw; opacity: 0.7; margin-top: 3%; font-weight: 700; }
.tcg-card--compact .tcg-card-attack { display: none; }
.tcg-card--compact .tcg-card-head { font-size: 10cqw; }
.tcg-card--compact .tcg-card-head .hp { display: none; }
.tcg-card--compact .tcg-card-art { font-size: 32cqw; }
.tcg-card--compact .tcg-card-foot { font-size: 7cqw; }

/* Graded slab: an original acrylic-case design with a neutral label. */
.slab {
  width: 100%; aspect-ratio: 5 / 8.4; border-radius: 6% / 3.6%; padding: 5% 6% 7%; position: relative; display: flex; flex-direction: column; gap: 4%;
  background: linear-gradient(155deg, rgba(255,255,255,0.34), rgba(255,255,255,0.08) 40%, rgba(255,255,255,0.18));
  border: 1px solid rgba(255,255,255,0.35); box-shadow: 0 6px 18px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,255,255,0.12);
  backdrop-filter: blur(2px); container-type: inline-size;
}
:root[data-theme="light"] .slab, .theme-light .slab { background: linear-gradient(155deg, #fdfdfb, #dcdad3 60%, #efeee9); border-color: #cfccc2; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .slab { background: linear-gradient(155deg, #fdfdfb, #dcdad3 60%, #efeee9); border-color: #cfccc2; } }
.slab::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.22) 42%, transparent 55%); }
.slab-label {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 5%; padding: 4% 5%; border-radius: 3cqw;
  background: linear-gradient(180deg, #16181f, #0c0d12); color: #f3f1ea; border: 1px solid rgba(214,178,94,0.55);
}
.slab-label .l1 { font-size: 7cqw; font-weight: 800; letter-spacing: 0.06em; color: var(--gold-2); font-family: var(--display); }
.slab-label .l2 { font-size: 6.4cqw; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slab-label .l3 { font-size: 5.4cqw; font-family: var(--mono); opacity: 0.7; }
.slab-label .g { grid-row: 1 / span 3; grid-column: 2; font-family: var(--display); font-weight: 800; font-size: 17cqw; line-height: 1; color: #fff; text-align: right; }
.slab-window { flex: 1; display: flex; align-items: center; justify-content: center; padding: 3%; border-radius: 3cqw; background: rgba(0,0,0,0.18); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18); }
.slab-window .tcg-card { width: 92%; }
.slab.compact .slab-label .l3 { display: none; }
/* Card photo (image_url): the seeded catalog is PSA slab photos in img/cards/. */
.card-photo { width: 100%; aspect-ratio: 5 / 7; position: relative; border-radius: 5% / 3.6%; overflow: hidden; background: var(--panel-2); }
.card-photo.is-slab { aspect-ratio: 5 / 8.4; border-radius: 4% / 2.4%; }
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; }
.card-photo.holo::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.18) 42%, transparent 55%); }

.card-tile { position: relative; cursor: pointer; transition: transform 0.15s; min-width: 0; }
.card-tile:hover { transform: translateY(-3px); }
.card-tile .qty { position: absolute; top: -7px; right: -7px; z-index: 3; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; display: grid; place-items: center; background: var(--ink); color: var(--bg); font-size: 0.72rem; font-weight: 800; font-family: var(--mono); box-shadow: var(--shadow-sm); }
.card-tile .cap { margin-top: 0.5rem; }
.card-tile .cap .n { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-tile .cap .v { font-size: 0.78rem; font-family: var(--mono); color: var(--dim); display: flex; align-items: center; flex-wrap: wrap; gap: 0 0.3rem; min-width: 0; overflow-wrap: anywhere; }
.card-tile.disabled { opacity: 0.35; cursor: not-allowed; }
.card-tile.disabled:hover { transform: none; }
.card-tile .check { position: absolute; top: 6px; left: 6px; z-index: 3; width: 24px; height: 24px; border-radius: 7px; border: 2px solid rgba(255,255,255,0.8); background: rgba(0,0,0,0.35); display: none; place-items: center; }
.selecting .card-tile .check { display: grid; }
.card-tile.selected .check { background: var(--gold); border-color: var(--gold); }
.card-tile.selected .check::after { content: ''; width: 10px; height: 5px; border: solid var(--gold-ink); border-width: 0 0 2.5px 2.5px; transform: rotate(-45deg) translate(1px, -1px); }
.card-tile.selected > .tcg-card, .card-tile.selected > .slab, .card-tile.selected > .card-photo { outline: 3px solid var(--gold); outline-offset: 3px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 1.25rem 1rem; }
.card-grid.sm { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 1rem 0.75rem; }
.mini-cards { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.mini-cards > * { width: 44px; }
.mini-cards .more { width: auto; align-self: center; font-size: 0.75rem; color: var(--dim); }

/* ---------- Foil pack & flip reveal ---------- */
.pack-slot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem; width: 100%; }
.foil-pack { position: relative; width: 120px; height: 168px; }
.foil-half {
  position: absolute; inset: 0; border-radius: 12px; transition: transform 0.55s ease-in, opacity 0.55s ease-in;
  background: linear-gradient(135deg, var(--gold-2), #6b4f0e 40%, #1a1d27 60%, var(--gold) 100%); background-size: 220% 220%;
  box-shadow: 0 16px 30px rgba(0,0,0,0.45), inset 0 0 0 1px rgba(255,255,255,0.18);
  animation: foil 5s ease-in-out infinite alternate;
}
@keyframes foil { to { background-position: 100% 100%; } }
.foil-half.top { clip-path: polygon(0 0, 100% 0, 100% 24%, 0 20%); z-index: 2; }
.foil-half.bottom { clip-path: polygon(0 20%, 100% 24%, 100% 100%, 0 100%); z-index: 1; }
.foil-logo { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.3rem; pointer-events: none; }
.foil-logo .mk { width: 40px; height: 40px; border-radius: 12px; border: 2px solid rgba(255,255,255,0.7); display: grid; place-items: center; }
.foil-logo .mk::after { content: ''; width: 14px; height: 18px; border-radius: 3px; border: 2px solid rgba(255,255,255,0.8); }
.foil-logo .t { font-family: var(--display); font-weight: 800; font-size: 0.72rem; letter-spacing: 0.2em; color: rgba(255,255,255,0.85); }
.foil-pack.sm { width: 76px; height: 106px; }
.foil-pack.sm .foil-logo .mk { width: 28px; height: 28px; border-radius: 8px; }
.foil-pack.sm .foil-logo .t { font-size: 0.55rem; }
.foil-pack.torn .foil-half.top { transform: translate(-30px, -70px) rotate(-18deg); opacity: 0; }
.foil-pack.torn .foil-half.bottom { transform: translateY(60px) scale(0.9); opacity: 0; }
.foil-pack.torn .foil-logo { opacity: 0; transition: opacity 0.25s; }
.foil-pack.shake { animation: shake 0.35s ease-in-out; }
@keyframes shake { 25% { transform: rotate(-3deg); } 75% { transform: rotate(3deg); } }
.reveal-row { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; min-height: 10px; }
.flip-card { width: 92px; aspect-ratio: 5 / 7; perspective: 800px; opacity: 0; transform: translateY(14px) scale(0.85); transition: opacity 0.25s, transform 0.25s; }
.flip-card.is-slab { aspect-ratio: 5 / 8.4; }
.reveal-row.sm .flip-card { width: 62px; }
.flip-card.show { opacity: 1; transform: none; }
.flip-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.flip-card.flipped .flip-inner { transform: rotateY(180deg); }
.flip-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 7% / 5%; }
.flip-face.back { background: radial-gradient(circle at 50% 50%, var(--gold-soft), transparent 60%), repeating-linear-gradient(45deg, #151923 0 7px, #10131b 7px 14px); border: 2px solid var(--gold); display: grid; place-items: center; }
.flip-face.back::after { content: ''; width: 30%; aspect-ratio: 1; border-radius: 30%; border: 2px solid var(--gold); opacity: 0.8; }
.flip-face.front { transform: rotateY(180deg); }
.flip-card.big-hit .flip-face.front { box-shadow: 0 0 0 2px var(--gold), 0 0 30px 6px rgba(214,178,94,0.55); border-radius: 7% / 5%; }
.sparkles { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.sparkles i { position: absolute; top: 50%; left: 50%; width: 6px; height: 6px; border-radius: 50%; background: var(--gold-2); box-shadow: 0 0 8px var(--gold); animation: burst 0.8s ease-out forwards; }
@keyframes burst { to { transform: translate(var(--sx), var(--sy)) scale(0.2); opacity: 0; } }

/* ---------- Battles ---------- */
.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.mode-card { position: relative; overflow: hidden; }
.mode-card .glyph { position: absolute; right: -20px; top: -20px; width: 140px; height: 140px; opacity: 0.07; color: var(--gold); }
.stake-preview { display: flex; align-items: center; justify-content: space-between; padding: 0.7rem 0.85rem; border-radius: 10px; background: var(--panel-2); margin: 0.2rem 0 0.9rem; font-size: 0.84rem; }
.lobby-list { display: flex; flex-direction: column; }
.lobby-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 1rem; align-items: center; padding: 0.85rem 1rem; border-top: 1px solid var(--line); }
.lobby-row:first-child { border-top: none; }
.lobby-row .who { display: flex; align-items: center; gap: 0.6rem; }
.arena { position: relative; }
.arena-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.arena-board { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 1rem; align-items: start; }
.side { border-radius: 16px; border: 1px solid var(--line); background: var(--bg-2); padding: 1rem; min-height: 320px; display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }
.side.winner { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 40px rgba(214,178,94,0.15); }
.side-head { display: flex; align-items: center; gap: 0.6rem; width: 100%; }
.side-head .nm { font-weight: 700; }
.side-total { font-family: var(--mono); font-weight: 700; font-size: 1.35rem; }
.vs { align-self: center; font-family: var(--display); font-weight: 800; font-size: 1.1rem; color: var(--gold); width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-2); background: var(--panel); }
.ready-state { font-size: 0.75rem; font-weight: 700; }
.ready-state.yes { color: var(--success); } .ready-state.no { color: var(--faint); }
.rounds { display: flex; gap: 0.35rem; flex-wrap: wrap; justify-content: center; margin: 0.9rem 0 0; }
.round { font-family: var(--mono); font-size: 0.72rem; font-weight: 700; padding: 0.2rem 0.55rem; border-radius: 7px; background: var(--panel-2); color: var(--dim); }
.round.me { background: var(--success-soft); color: var(--success); }
.round.opp { background: var(--danger-soft); color: var(--danger); }
.round-info { text-align: center; font-weight: 700; font-family: var(--display); min-height: 1.4em; }
.result-banner { text-align: center; padding: 1rem; border-radius: 14px; margin-top: 1rem; font-family: var(--display); font-weight: 700; font-size: 1.05rem; }
.result-banner.win { background: var(--success-soft); color: var(--success); border: 1px solid color-mix(in srgb, var(--success) 40%, transparent); }
.result-banner.lose { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); }
.result-banner.tie { background: var(--gold-soft); color: var(--gold); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); }

/* ---------- Raffles ---------- */
.raffle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.raffle-prizes { display: flex; gap: 0.6rem; overflow-x: auto; padding: 0.2rem 0 0.4rem; scrollbar-width: thin; }
.raffle-prize { width: 76px; flex-shrink: 0; text-align: center; font-size: 0.72rem; }
.raffle-prize .v { font-family: var(--mono); color: var(--dim); margin-top: 0.3rem; }
.countdown { font-family: var(--mono); font-weight: 600; }

/* ---------- Vault / history / ledger ---------- */
.select-bar {
  position: sticky; bottom: 1rem; z-index: 20; margin-top: 1.25rem; display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.75rem 0.9rem; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg);
}
.timeline { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: 40px 1fr; gap: 0.85rem; padding: 0.95rem 0; border-top: 1px solid var(--line); }
.tl-item:first-child { border-top: none; padding-top: 0.2rem; }
.tl-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--panel-2); color: var(--dim); }
.tl-icon svg { width: 18px; height: 18px; }
.tl-icon.won { background: var(--success-soft); color: var(--success); }
.tl-icon.lost { background: var(--danger-soft); color: var(--danger); }
.tl-icon.gold { background: var(--gold-soft); color: var(--gold); }
.tl-title { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-weight: 600; }
.tl-meta { font-size: 0.8rem; color: var(--dim); margin: 0.15rem 0 0.5rem; }
.steps { display: flex; align-items: center; gap: 0; margin: 0.6rem 0 0.2rem; min-width: 0; }
.step { display: flex; align-items: center; gap: 0.4rem; font-size: 0.74rem; font-weight: 600; color: var(--faint); flex: 1; min-width: 0; white-space: nowrap; }
.step::before { content: ''; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--panel); flex-shrink: 0; }
.step::after { content: ''; height: 2px; background: var(--line-2); flex: 1; margin-right: 0.4rem; }
.step:last-child { flex: 0; }
.step:last-child::after { display: none; }
.step.done { color: var(--ink); }
.step.done::before { background: var(--gold); border-color: var(--gold); }
.step.done::after { background: var(--gold); }
.sparkline { width: 100%; height: 70px; display: block; }

/* ---------- Trades / community ---------- */
.trade { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 1rem; align-items: start; }
.trade-side h4 { margin: 0 0 0.5rem; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.trade-arrow { align-self: center; color: var(--gold); }
.trade-arrow svg { width: 22px; height: 22px; }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 0.8rem; max-height: 340px; overflow-y: auto; padding: 0.3rem; }
.picker .card-tile .stepper { margin-top: 0.35rem; }
.lb-list { display: flex; flex-direction: column; }
.lb-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 0.75rem; align-items: center; padding: 0.6rem 0; border-top: 1px solid var(--line); }
.lb-row:first-child { border-top: none; }
.lb-rank { font-family: var(--mono); font-weight: 700; color: var(--faint); text-align: center; }
.lb-row:nth-child(1) .lb-rank { color: var(--gold); }
.profile-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* ---------- Top-up ---------- */
.pkg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0.85rem; }
.pkg { position: relative; text-align: left; padding: 1.1rem; border-radius: 14px; border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; transition: border-color 0.15s, transform 0.15s; }
.pkg:hover { transform: translateY(-2px); border-color: var(--faint); }
.pkg.active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 10px 30px rgba(214,178,94,0.12); }
.pkg .amt { font-family: var(--mono); font-weight: 700; font-size: 1.45rem; display: flex; align-items: center; gap: 0.45rem; }
.pkg .lbl { font-size: 0.78rem; color: var(--dim); margin-top: 0.2rem; }
.pkg .tag { position: absolute; top: 0.75rem; right: 0.75rem; }
.pay-methods { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.pay-method { height: 34px; padding: 0 0.8rem; border-radius: 8px; border: 1px dashed var(--line-2); display: inline-flex; align-items: center; font-size: 0.76rem; color: var(--faint); font-weight: 600; }

/* ---------- Auth ---------- */
.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-art {
  position: relative; overflow: hidden; padding: 2.5rem; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(700px 400px at 30% 20%, rgba(214,178,94,0.2), transparent 60%), radial-gradient(600px 400px at 80% 90%, rgba(139,123,255,0.18), transparent 60%), var(--bg-2);
  border-right: 1px solid var(--line);
}
.auth-art h1 { font-size: clamp(2rem, 3.4vw, 3rem); line-height: 1.05; font-weight: 800; letter-spacing: -0.035em; max-width: 520px; }
.auth-art h1 em { font-style: normal; background: linear-gradient(90deg, var(--gold-2), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-art p { color: var(--dim); max-width: 440px; font-size: 1rem; }
.auth-cards { position: relative; height: 300px; margin: 1rem 0; }
.auth-cards > * { position: absolute; width: 150px; top: 20px; }
.auth-cards > :nth-child(1) { left: 8%; transform: rotate(-14deg); }
.auth-cards > :nth-child(2) { left: 30%; top: 0; transform: rotate(-2deg); z-index: 2; filter: drop-shadow(0 25px 35px rgba(0,0,0,0.5)); }
.auth-cards > :nth-child(3) { left: 52%; transform: rotate(11deg); }
.auth-points { display: flex; gap: 1.5rem; flex-wrap: wrap; font-size: 0.82rem; color: var(--dim); }
.auth-points span { display: inline-flex; align-items: center; gap: 0.4rem; }
.auth-points svg { width: 16px; height: 16px; color: var(--gold); }
.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.auth-form { width: 100%; max-width: 380px; }
.auth-form h2 { font-size: 1.45rem; margin-bottom: 0.3rem; }
.auth-form .sub { margin-bottom: 1.4rem; }
.auth-switch { text-align: center; margin-top: 1.1rem; color: var(--dim); font-size: 0.86rem; }

/* ---------- Modal & toasts ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center; padding: 1rem; background: rgba(5, 6, 10, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal.open { display: flex; animation: fade 0.18s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-box { position: relative; width: 100%; max-width: 420px; max-height: calc(100vh - 2rem); overflow-y: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; padding: 1.5rem; box-shadow: var(--shadow-lg); animation: pop 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.modal-box.wide { max-width: 640px; }
.modal-box.xwide { max-width: 860px; }
@keyframes pop { from { transform: translateY(8px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-close { position: absolute; top: 0.8rem; right: 0.8rem; width: 34px; height: 34px; border-radius: 10px; border: none; background: transparent; color: var(--dim); cursor: pointer; display: grid; place-items: center; }
.modal-close:hover { background: var(--panel-2); color: var(--ink); }
.modal-close svg { width: 18px; height: 18px; }
.modal-title { padding-right: 2rem; margin-bottom: 0.3rem; }
.modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1.25rem; flex-wrap: wrap; }
.modal-actions.center { justify-content: center; }
.result-cards { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; margin: 1.1rem 0 0.5rem; }
.result-cards > * { width: 118px; }
.result-cards.single > * { width: 180px; }
.result-cards.many { gap: 0.5rem; }
.result-cards.many > * { width: 92px; }
.card-detail { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.toasts { position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 80; display: flex; flex-direction: column; gap: 0.5rem; pointer-events: none; }
.toast { pointer-events: auto; min-width: 240px; max-width: 360px; padding: 0.75rem 1rem; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); font-size: 0.86rem; display: flex; gap: 0.6rem; align-items: flex-start; animation: toastIn 0.25s ease; }
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; margin-top: 0.4rem; flex-shrink: 0; background: var(--gold); }
.toast.error::before { background: var(--danger); }
.toast.success::before { background: var(--success); }
.toast.out { animation: toastOut 0.25s ease forwards; }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateY(10px); opacity: 0; } }
.menu { position: absolute; top: calc(var(--topbar) - 6px); right: 1.5rem; z-index: 40; min-width: 220px; padding: 0.4rem; border-radius: 14px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); }
.menu a, .menu button { display: flex; align-items: center; gap: 0.6rem; width: 100%; height: 38px; padding: 0 0.7rem; border-radius: 9px; border: none; background: none; color: var(--ink); font-size: 0.86rem; font-weight: 500; cursor: pointer; text-decoration: none; }
.menu a:hover, .menu button:hover { background: var(--panel-2); text-decoration: none; }
.menu .who { padding: 0.55rem 0.7rem 0.6rem; border-bottom: 1px solid var(--line); margin-bottom: 0.3rem; }
.menu svg { width: 16px; height: 16px; color: var(--dim); }
.notif-menu { width: min(360px, calc(100vw - 2rem)); max-height: min(70vh, 520px); overflow-y: auto; }
.notif-menu .notif-head { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0.7rem 0.55rem; border-bottom: 1px solid var(--line); margin-bottom: 0.3rem; font-weight: 700; }
.menu .notif { height: auto; align-items: flex-start; padding: 0.6rem 0.7rem; text-align: left; flex-direction: column; gap: 0.15rem; }
.menu .notif.unread { background: var(--gold-soft); }
.menu .notif .t { font-weight: 600; }
.menu .notif .b { color: var(--dim); font-size: 0.8rem; overflow-wrap: anywhere; }
.menu .notif .w { color: var(--faint); font-size: 0.72rem; }
.notif-menu .empty { padding: 1.5rem 0.7rem; text-align: center; color: var(--dim); font-size: 0.86rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { padding: 0 1rem; }
  .topbar .brand { display: flex; }
  .topbar-title { display: none; }
  main.views { padding: 1.1rem 1rem calc(88px + env(safe-area-inset-bottom)); }
  .banner { margin: 0.8rem 1rem 0; }
  .menu { right: 1rem; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    padding: 0.35rem 0.35rem calc(0.35rem + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg-2) 92%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; padding: 0.4rem 0; border-radius: 10px; color: var(--faint); font-size: 0.66rem; font-weight: 600; text-decoration: none; }
  .bottom-nav a svg { width: 20px; height: 20px; }
  .bottom-nav a.active { color: var(--gold); }
  .hero { grid-template-columns: minmax(0, 1fr); padding: 1.5rem; }
  .hero-art { height: 220px; order: -1; }
  .hero .row .btn { flex: 1; }
  .hero-art .fan { width: 120px; }
  .split, .grid-2, .mode-cards { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { padding: 1.5rem 1.25rem 1rem; border-right: none; border-bottom: 1px solid var(--line); }
  .auth-cards { height: 180px; }
  .auth-cards > * { width: 96px; }
  .auth-points { display: none; }
  footer.legal { padding: 1.25rem 1rem calc(96px + env(safe-area-inset-bottom)); }
  .toasts { left: 1rem; right: 1rem; bottom: calc(80px + env(safe-area-inset-bottom)); align-items: stretch; }
  .toast { max-width: none; }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  .stats { gap: 0.5rem; }
  .stat { padding: 0.7rem 0.8rem; }
  .stat .v { font-size: 1.02rem; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .pack-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
  /* Phone tiles: badges get their own row above the picture instead of covering it. */
  .pack-cover { height: auto; flex-direction: column; justify-content: flex-start; gap: 0.6rem; padding: 0.55rem 0.5rem 0.9rem; }
  .pack-cover .corner { position: static; align-self: stretch; gap: 0.25rem; }
  .pack-cover .corner-r { top: auto; bottom: 0.5rem; right: 0.5rem; }
  .pack-cover .badge { height: 19px; padding: 0 0.45rem; font-size: 0.6rem; }
  .pack-cover .cover-card { width: 78px; }
  .pack-cover .cover-card.is-slab { width: 72px; }
  .toolbar .chips { flex-basis: 100%; }
  .toolbar .search { flex: 1; min-width: 0; }
  .pack-body { padding: 0.75rem; gap: 0.45rem; }
  .pack-name { font-size: 0.86rem; }
  .price { font-size: 0.88rem; }
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem 0.6rem; }
  .raffle-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .arena-board { grid-template-columns: minmax(0, 1fr); }
  .vs { justify-self: center; }
  .side { min-height: 0; }
  .flip-card { width: 70px; }
  .reveal-row.sm .flip-card { width: 52px; }
  .lobby-row { grid-template-columns: minmax(0, 1fr) auto; }
  .lobby-row .lobby-stake { grid-column: 1; }
  .card-detail { grid-template-columns: minmax(0, 1fr); }
  .card-detail > :first-child { max-width: 180px; margin: 0 auto; }
  .trade { grid-template-columns: minmax(0, 1fr); }
  .trade-arrow { justify-self: center; transform: rotate(90deg); }
  .result-cards > * { width: 96px; }
  .result-cards.many > * { width: 72px; }
  .modal { align-items: flex-end; padding: 0; }
  .modal-box { border-radius: 18px 18px 0 0; max-height: 92vh; padding: 1.25rem 1rem calc(1.25rem + env(safe-area-inset-bottom)); }
  .top-hits { gap: 0.5rem; }
  .table th, .table td { padding: 0.55rem 0.5rem; }
  .hide-sm { display: none !important; }
  .select-bar .grow { flex-basis: 100%; }
  .steps { flex-wrap: wrap; gap: 0.4rem 0.7rem; }
  .step { flex: 0 0 auto; }
  .step::after { display: none; }
  .select-bar .btn { flex: 1; }
}
@media (max-width: 420px) {
  .topbar { gap: 0.4rem; padding: 0 0.75rem; }
  .topbar-actions { gap: 0.35rem; }
  .icon-btn, .avatar { width: 36px; height: 36px; border-radius: 10px; }
  .balance-pill { height: 36px; padding: 0 0.3rem 0 0.6rem; font-size: 0.84rem; gap: 0.35rem; }
  .balance-pill .plus { width: 26px; height: 26px; }
  main.views { padding-left: 0.75rem; padding-right: 0.75rem; }
  .hero { padding: 1.25rem; }
  .hero-art .fan { width: 104px; }
  .hero-art .fan:nth-child(1) { transform: translateX(-70px) rotate(-12deg) scale(0.88); }
  .hero-art .fan:nth-child(2) { transform: translateX(70px) rotate(12deg) scale(0.88); }
  .auth-art h1 { font-size: 1.6rem; }
  .auth-art p { display: none; }
  .hero .row .btn { width: 100%; }
  .pack-meta .tiny, .price .per, .pack-tile .progress-label span + span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
