/* CrestArena design system — dark theme, CrestArena green. */
:root {
  --bg: #070b12;
  --surface: #0d1320;
  --surface-2: #121a2b;
  --surface-3: #1a2438;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);

  --brand: #00e575;
  --brand-600: #00c963;
  --brand-ink: #02150b;
  --brand-soft: rgba(0, 229, 117, 0.12);
  --brand-line: rgba(0, 229, 117, 0.28);

  --danger: #ff4d6a;
  --danger-soft: rgba(255, 77, 106, 0.12);
  --warn: #ffb020;
  --warn-soft: rgba(255, 176, 32, 0.12);
  --info: #3db2ff;
  --info-soft: rgba(61, 178, 255, 0.12);
  --gold: #f5c542;
  --gold-soft: rgba(245, 197, 66, 0.14);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.14);

  --text: #f2f5fa;
  --text-2: #a3aec2;
  --text-3: #6b778e;

  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-pill: 999px;

  --font: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Barlow Condensed', 'Barlow', system-ui, sans-serif;

  --appbar-h: 60px;
  --tabbar-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); color-scheme: dark; }
body {
  min-height: 100dvh;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(0, 229, 117, 0.08), transparent 60%),
    radial-gradient(700px 400px at -10% 10%, rgba(61, 178, 255, 0.05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
img, svg { display: block; max-width: 100%; }
/* Default icon size; components below set their own. */
svg:not([width]) { width: 18px; height: 18px; flex: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: var(--brand); text-decoration: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ── Layout ─────────────────────────────────────────────── */
.app { max-width: 640px; margin: 0 auto; min-height: 100dvh; position: relative; }
.appbar {
  position: sticky; top: 0; z-index: 30;
  height: calc(var(--appbar-h) + var(--safe-top)); padding: var(--safe-top) 16px 0;
  display: flex; align-items: center; gap: 12px;
  background: rgba(7, 11, 18, 0.82); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.appbar .brand { height: 22px; width: auto; }
.appbar .spacer { flex: 1; }
.appbar-title { font: 700 20px/1 var(--font-display); letter-spacing: 0.02em; }
.page { padding: 16px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 28px); animation: page-in 0.25s var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 30;
  width: 100%; max-width: 640px;
  height: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(10, 15, 25, 0.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--text-3); font: 600 11px/1 var(--font); letter-spacing: 0.02em; position: relative;
  transition: color 0.2s;
}
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--brand); }
.tab.active::before {
  content: ''; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand);
  box-shadow: 0 0 12px var(--brand);
}
.tab .dot { position: absolute; top: 10px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }

/* ── Type ───────────────────────────────────────────────── */
.h1 { font: 700 28px/1.1 var(--font-display); letter-spacing: 0.01em; }
.h2 { font: 700 21px/1.15 var(--font-display); letter-spacing: 0.01em; }
.h3 { font: 600 17px/1.25 var(--font); }
.eyebrow { font: 700 12px/1 var(--font); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.brand-text { color: var(--brand); }
.danger-text { color: var(--danger); }

.section { margin-top: 24px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head a, .link-btn { font-weight: 600; font-size: 14px; color: var(--brand); }
.stack > * + * { margin-top: 12px; }
.stack-sm > * + * { margin-top: 8px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Surfaces ───────────────────────────────────────────── */
.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px;
}
.card.pad-lg { padding: 20px; }
.card.flat { background: var(--surface); }
.card.highlight { border-color: var(--brand-line); box-shadow: 0 0 0 1px var(--brand-line) inset, 0 12px 40px rgba(0, 229, 117, 0.08); }
.card.tap { transition: transform 0.15s var(--ease), border-color 0.2s; cursor: pointer; }
.card.tap:active { transform: scale(0.985); }
.divider { height: 1px; background: var(--line); margin: 14px 0; }

.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 56px; width: 100%; text-align: left; }
.list-row + .list-row { border-top: 1px solid var(--line); }
.list-row .icon-tile { flex: none; }
.list-row .chev { color: var(--text-3); width: 18px; height: 18px; flex: none; }
button.list-row:active { background: var(--surface-2); }

.icon-tile {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2);
}
.icon-tile svg { width: 20px; height: 20px; }
.icon-tile.brand { background: var(--brand-soft); color: var(--brand); }
.icon-tile.danger { background: var(--danger-soft); color: var(--danger); }
.icon-tile.warn { background: var(--warn-soft); color: var(--warn); }
.icon-tile.info { background: var(--info-soft); color: var(--info); }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: var(--r);
  font: 700 15px/1 var(--font); letter-spacing: 0.01em;
  transition: transform 0.12s var(--ease), background 0.2s, opacity 0.2s, box-shadow 0.2s;
  user-select: none; white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(0.97); }
.btn[disabled], .btn.loading { opacity: 0.55; pointer-events: none; }
.btn.block { width: 100%; }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn.primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 8px 24px rgba(0, 229, 117, 0.25); }
.btn.primary:hover { background: #12f084; }
.btn.secondary { background: var(--surface-3); color: var(--text); border: 1px solid var(--line-2); }
.btn.ghost { color: var(--text-2); }
.btn.outline { border: 1px solid var(--brand-line); color: var(--brand); }
.btn.danger { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(255, 77, 106, 0.3); }
.btn.loading::after {
  content: ''; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--text); position: relative;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:active { background: var(--surface-2); }
.icon-btn .count {
  position: absolute; top: 6px; right: 5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font: 700 11px/18px var(--font); text-align: center;
}

/* ── Balance pill ───────────────────────────────────────── */
.balance-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 6px 0 14px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--line-2); font: 700 15px/1 var(--font-display); letter-spacing: 0.02em;
}
.balance-pill .plus { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); }
.balance-pill .plus svg { width: 16px; height: 16px; }

/* ── Chips, badges, segmented ───────────────────────────── */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 38px; white-space: nowrap; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--line-2);
  background: var(--surface); color: var(--text-2); font: 600 14px/1 var(--font); display: inline-flex; align-items: center; gap: 6px;
}
.chip.active { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); }
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: var(--r-pill);
  font: 700 11px/1 var(--font); letter-spacing: 0.06em; text-transform: uppercase; background: var(--surface-3); color: var(--text-2);
}
.badge svg { width: 12px; height: 12px; }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.tier-pro { background: var(--brand-soft); color: var(--brand); }
.badge.tier-pro_plus { background: var(--violet-soft); color: var(--violet); }
.badge.tier-elite { background: var(--gold-soft); color: var(--gold); }
.badge.live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.seg button { height: 40px; border-radius: 10px; font: 600 14px/1 var(--font); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button[disabled] { opacity: 0.4; cursor: not-allowed; }
.seg button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 var(--line-2) inset; }

/* ── Forms ──────────────────────────────────────────────── */
.field { display: block; }
.field + .field { margin-top: 14px; }
.label { display: block; font: 600 13px/1.2 var(--font); color: var(--text-2); margin-bottom: 8px; }
.hint { font-size: 13px; color: var(--text-3); margin-top: 6px; }
.input, .select, .textarea {
  width: 100%; min-height: 50px; padding: 0 14px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line-2); color: var(--text); font-size: 16px; /* 16px stops iOS zoom */
  transition: border-color 0.2s, box-shadow 0.2s;
}
.textarea { padding: 12px 14px; min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input-money { position: relative; }
.input-money .cur { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-weight: 700; }
.input-money .input { padding-left: 34px; font: 700 20px/1 var(--font-display); letter-spacing: 0.02em; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input { width: 22px; height: 22px; flex: none; accent-color: var(--brand); margin-top: 1px; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 15px; background: var(--surface-3); transition: background 0.2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform 0.2s var(--ease); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(20px); }
.form-error { color: var(--danger); font-size: 14px; margin-top: 10px; }

/* ── Avatars & players ──────────────────────────────────── */
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(135deg, #1d2b45, #142036); color: var(--text); font: 700 16px/1 var(--font-display); letter-spacing: 0.04em;
  border: 2px solid var(--line-2);
}
.avatar { position: relative; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-edit { position: relative; flex: none; border-radius: 50%; }
.avatar-edit .cam {
  position: absolute; right: -2px; bottom: -2px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand); color: var(--brand-ink); border: 3px solid var(--bg);
}
.avatar-edit .cam svg { width: 14px; height: 14px; }
.avatar.xl { width: 120px; height: 120px; font-size: 40px; margin: 0 auto; }
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
.avatar.me { border-color: var(--brand); }

/* ── Match card / scoreboard ────────────────────────────── */
.versus { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.versus .side { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; min-width: 0; }
.versus .side .name { font: 600 15px/1.2 var(--font); max-width: 100%; }
.versus .side .tag { font-size: 12px; color: var(--text-3); max-width: 100%; }
.versus .mid { text-align: center; }
.score { font: 700 40px/1 var(--font-display); letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.score .sep { color: var(--text-3); margin: 0 6px; }
.vs { font: 700 18px/1 var(--font-display); color: var(--text-3); letter-spacing: 0.1em; }
.pens { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.winner .name { color: var(--brand); }

.match-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; width: 100%; text-align: left; }
.match-row + .match-row { border-top: 1px solid var(--line); }
.match-row .teams { flex: 1; min-width: 0; }
.match-row .teams div { display: flex; justify-content: space-between; gap: 8px; }
.match-row .teams div + div { margin-top: 4px; }
.match-row .teams b { font: 700 16px/1.2 var(--font-display); font-variant-numeric: tabular-nums; }

/* ── Stats ──────────────────────────────────────────────── */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.stat .v { font: 700 24px/1 var(--font-display); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 12px; color: var(--text-3); margin-top: 6px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }

.wallet-card {
  border-radius: var(--r-lg); padding: 22px 20px; position: relative; overflow: hidden;
  background:
    radial-gradient(400px 200px at 100% 0%, rgba(0, 229, 117, 0.35), transparent 70%),
    linear-gradient(135deg, #0f2a1f, #0b1a1a 45%, #0d1320);
  border: 1px solid var(--brand-line);
}
.wallet-card .amount { font: 700 42px/1 var(--font-display); letter-spacing: 0.02em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.wallet-card .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }

/* ── Progress & steps ───────────────────────────────────── */
.progress { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 3px; transition: width 0.4s var(--ease); }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.steps .step { text-align: center; font-size: 11px; color: var(--text-3); font-weight: 600; }
.steps .step::before { content: ''; display: block; height: 4px; border-radius: 2px; background: var(--surface-3); margin-bottom: 8px; }
.steps .step.done { color: var(--text-2); }
.steps .step.done::before { background: var(--brand); }
.steps .step.now { color: var(--brand); }
.steps .step.now::before { background: linear-gradient(90deg, var(--brand), var(--surface-3)); }

.notice { display: flex; gap: 12px; padding: 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); font-size: 14px; color: var(--text-2); }
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.notice.brand { background: var(--brand-soft); border-color: var(--brand-line); color: var(--text); }
.notice.brand svg { color: var(--brand); }
.notice.warn { background: var(--warn-soft); border-color: rgba(255, 176, 32, 0.3); color: var(--text); }
.notice.warn svg { color: var(--warn); }
.notice.danger { background: var(--danger-soft); border-color: rgba(255, 77, 106, 0.3); color: var(--text); }
.notice.danger svg { color: var(--danger); }
.notice b { color: var(--text); }
.checklist { list-style: none; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text-2); }
.checklist li + li { margin-top: 8px; }
.checklist li svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.checklist .ok svg { color: var(--brand); }
.checklist .no svg { color: var(--danger); }

/* ── Upload ─────────────────────────────────────────────── */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center;
  min-height: 180px; padding: 20px; border-radius: var(--r-lg); border: 2px dashed var(--line-2); background: var(--surface);
  color: var(--text-2); cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone svg { width: 32px; height: 32px; color: var(--brand); }
.dropzone > span { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.dropzone img { max-height: 240px; border-radius: 12px; }

/* ── Empty / skeleton ───────────────────────────────────── */
.empty { text-align: center; padding: 36px 20px; color: var(--text-2); }
.empty .icon-tile { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px; }
.empty .icon-tile svg { width: 26px; height: 26px; }
.empty .h3 { color: var(--text); margin-bottom: 6px; }
.skeleton { border-radius: var(--r-lg); background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Sheets (modals) ────────────────────────────────────── */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60; background: rgba(2, 5, 10, 0.6); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center; animation: fade 0.2s;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 640px; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--line-2); border-bottom: 0; border-radius: 24px 24px 0 0;
  padding: 10px 20px calc(24px + var(--safe-bottom)); animation: sheet-up 0.3s var(--ease);
}
.sheet::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 0 auto 14px; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sheet-actions { display: grid; gap: 10px; margin-top: 20px; }
@media (min-width: 700px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 24px; border-bottom: 1px solid var(--line-2); max-height: 86dvh; }
}

/* ── Toasts & banners ───────────────────────────────────── */
.toasts { position: fixed; z-index: 80; top: calc(var(--safe-top) + 12px); left: 50%; transform: translateX(-50%); width: min(92vw, 480px); display: grid; gap: 8px; pointer-events: none; }
.toast {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r);
  background: rgba(22, 31, 49, 0.96); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  font-size: 14px; pointer-events: auto; animation: toast-in 0.3s var(--ease);
}
.toast svg { width: 20px; height: 20px; flex: none; }
.toast.ok svg { color: var(--brand); }
.toast.err svg { color: var(--danger); }
.toast.info svg { color: var(--info); }
.toast b { display: block; margin-bottom: 2px; }
.toast.out { animation: toast-out 0.25s forwards; }
@keyframes toast-in { from { transform: translateY(-12px); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(-12px); opacity: 0; } }

.banner {
  position: fixed; z-index: 70; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px); width: min(94vw, 600px);
  display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: var(--r-lg);
  background: rgba(18, 26, 43, 0.97); border: 1px solid var(--brand-line); box-shadow: var(--shadow); animation: toast-in 0.3s var(--ease);
}
.banner .grow b { display: block; font-size: 15px; }
.banner .grow span { font-size: 13px; color: var(--text-2); }
.banner.cookie { border-color: var(--line-2); z-index: 55; }
.banner.cookie.standalone { bottom: calc(var(--safe-bottom) + 12px); }
.connection {
  position: fixed; z-index: 40; top: calc(var(--appbar-h) + var(--safe-top)); left: 0; right: 0; text-align: center;
  font: 600 12px/28px var(--font); background: var(--warn-soft); color: var(--warn);
}

/* ── Auth & full-screen flows ───────────────────────────── */
.auth { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: calc(var(--safe-top) + 24px) 20px calc(var(--safe-bottom) + 120px); max-width: 440px; margin: 0 auto; }
.auth .logo { width: 72px; margin: 0 auto 12px; }
.auth .wordmark { height: 34px; width: auto; margin: 0 auto 6px; }
.auth .tagline { text-align: center; color: var(--text-2); margin-bottom: 28px; }
.oauth { display: flex; align-items: center; justify-content: center; gap: 10px; }
.oauth svg { width: 20px; height: 20px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 13px; margin: 18px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.legal-foot { text-align: center; font-size: 12px; color: var(--text-3); margin-top: 20px; }
.legal-foot a { color: var(--text-2); text-decoration: underline; }

/* ── Tables (standings) ─────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { font: 700 11px/1 var(--font); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); text-align: center; padding: 10px 6px; }
.table th:nth-child(2), .table td:nth-child(2) { text-align: left; }
.table td { padding: 12px 6px; text-align: center; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.table tr.me td { background: var(--brand-soft); }
.table .pos { width: 32px; color: var(--text-3); font-weight: 700; }
.table .pts { font-weight: 700; color: var(--text); }
.table tr.prize .pos { color: var(--brand); }

/* ── Bracket (knockout) ─────────────────────────────────── */
.bracket { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.bracket .round { flex: none; width: 220px; display: flex; flex-direction: column; justify-content: space-around; gap: 12px; scroll-snap-align: start; }
.bracket .round-title { font: 700 12px/1 var(--font); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); text-align: center; margin-bottom: 4px; }
.bracket .tie { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.bracket .tie > div { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; font-size: 14px; }
.bracket .tie > div + div { border-top: 1px solid var(--line); }
.bracket .tie .won { color: var(--brand); font-weight: 700; }

/* ── Live video ─────────────────────────────────────────── */
.video-wrap { position: relative; border-radius: var(--r-lg); overflow: hidden; background: #000; aspect-ratio: 16 / 9; }
.video-wrap video { width: 100%; height: 100%; object-fit: contain; }
.chat { height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.chat .msg { font-size: 14px; }
.chat .msg b { color: var(--brand); margin-right: 6px; }

/* ── Legal pages ────────────────────────────────────────── */
.legal { max-width: 760px; margin: 0 auto; padding: calc(var(--safe-top) + 24px) 20px 64px; }
.legal h1 { font: 700 34px/1.1 var(--font-display); margin: 18px 0 6px; }
.legal h2 { font: 700 22px/1.2 var(--font-display); margin: 32px 0 10px; }
.legal h3 { font: 600 17px/1.3 var(--font); margin: 20px 0 8px; }
.legal p, .legal li { color: var(--text-2); font-size: 15.5px; line-height: 1.7; }
.legal p + p { margin-top: 12px; }
.legal ul, .legal ol { padding-left: 22px; margin: 10px 0; }
.legal li + li { margin-top: 6px; }
.legal strong { color: var(--text); }
.legal table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 14px; }
.legal th, .legal td { border: 1px solid var(--line-2); padding: 10px; text-align: left; vertical-align: top; color: var(--text-2); }
.legal th { color: var(--text); background: var(--surface); }
.legal .meta { color: var(--text-3); font-size: 14px; }
.legal .toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 18px; margin: 20px 0; }
.legal .fill { background: var(--warn-soft); color: var(--warn); padding: 0 4px; border-radius: 4px; }
.legal nav.top { display: flex; align-items: center; justify-content: space-between; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── Screenshot evidence ─────────────────────────────────── */
.evidence { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.evidence-item { display: flex; flex-direction: column; gap: 6px; text-align: left; color: var(--text-2); }
.evidence-item img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; border: 1px solid var(--line-2); background: #000; }

/* ── Skeleton screens ────────────────────────────────────── */
.sk {
  display: block; flex: none; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 40%, var(--surface-2) 80%);
  background-size: 300% 100%; animation: sk-shimmer 1.4s ease-in-out infinite;
}
.sk-circle { border-radius: 50%; }
.sk-pill { border-radius: var(--r-pill); }
.sk-stack { display: flex; flex-direction: column; gap: 8px; }
.sk-head { margin-bottom: 12px; }
.sk-chips { display: flex; gap: 8px; margin-top: 18px; overflow: hidden; }
.sk-versus { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 20px 0 16px; }
.sk-side { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.sk-wallet { border-color: var(--line-2); background: var(--surface); }
.sk-wallet .sk { background-color: rgba(255, 255, 255, 0.06); }
.sk-wake { margin-top: 24px; animation: fade 0.4s; }
@keyframes sk-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* Thin progress bar at the top while pages or data load. */
.topbar {
  position: fixed; top: 0; left: 0; z-index: 90; height: 3px; width: 0; opacity: 0;
  background: var(--brand); box-shadow: 0 0 10px var(--brand); pointer-events: none;
  transition: width 0.4s var(--ease), opacity 0.3s;
}
.topbar.on { opacity: 1; width: 70%; transition: width 8s cubic-bezier(0.1, 0.6, 0.2, 1), opacity 0.2s; }
.topbar.done { opacity: 0; width: 100%; transition: width 0.25s, opacity 0.4s 0.2s; }

/* Pull-to-refresh indicator. */
.ptr {
  position: fixed; left: 50%; top: calc(var(--appbar-h) + var(--safe-top) + 8px); z-index: 35;
  width: 40px; height: 40px; margin-left: -20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line-2); box-shadow: var(--shadow); color: var(--brand);
  transform: translateY(-80px); opacity: 0; transition: opacity 0.2s;
}
.ptr svg { width: 20px; height: 20px; }
.ptr.ready svg { transform: rotate(180deg); transition: transform 0.2s; }
.ptr.loading svg { animation: spin 0.8s linear infinite; }

/* Error state with retry. */
.page-error { text-align: center; padding: 48px 20px; }
.page-error .icon-tile { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px; }

@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* ── Membership ─────────────────────────────────────────────── */
.plans { display: grid; gap: 12px; }
.plan.current { border-color: var(--brand-line); box-shadow: 0 0 0 1px var(--brand-line) inset; }
.plan-name { font: 700 20px/1.1 var(--font-display); letter-spacing: 0.02em; }
.plan.tier-pro .plan-name { color: var(--brand); }
.plan.tier-pro_plus .plan-name { color: var(--violet); }
.plan.tier-elite .plan-name { color: var(--gold); }
.plan-price { font: 700 30px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.plan-price small { font: 500 13px var(--font); color: var(--text-3); margin-left: 4px; }
.plan-entries { font-weight: 700; color: var(--text); }
.usage-dots { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.usage-dots span { width: 22px; height: 8px; border-radius: var(--r-pill); background: var(--surface-3); }
.usage-dots span.used { background: var(--brand); }
@media (min-width: 720px) { .plans { grid-template-columns: repeat(2, 1fr); } }
