/* CrickMatch design system — minimal, professional, light + dark.
 * Colours are tokens on :root; the light theme swaps the tokens only. */
:root {
  color-scheme: dark;
  --bg: #0b0d12; --bg-2: #0f1218; --surface: #14171f; --surface-2: #1a1e28; --hover: #1e2330;
  --line: #262b37; --line-2: #333a4a;
  --text: #e9ebf1; --muted: #9aa2b4; --dim: #6c7487;
  --accent: #5b82ff; --accent-ink: #ffffff; --accent-soft: rgba(91, 130, 255, .14);
  --gold: #f2b544; --gold-soft: rgba(242, 181, 68, .14);
  --live: #ef4444; --live-soft: rgba(239, 68, 68, .14);
  --win: #22c55e; --win-soft: rgba(34, 197, 94, .14); --loss: #ef4444;
  --four: #3b82f6; --six: #8b5cf6;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .45);
  --radius: 12px; --radius-sm: 8px;
  --side-w: 244px;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Inter Tight', 'Inter', system-ui, sans-serif;
  /* legacy aliases used by inline styles */
  --gold2: var(--gold); --accent2: var(--accent); --panel: var(--surface); --panel2: var(--surface-2);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f4f5f7; --bg-2: #eceef2; --surface: #ffffff; --surface-2: #f7f8fa; --hover: #f0f2f5;
    --line: #e3e6eb; --line-2: #d3d8e0;
    --text: #0f172a; --muted: #5a6478; --dim: #8b94a6;
    --accent: #2f5bea; --accent-soft: rgba(47, 91, 234, .09);
    --gold: #b7791f; --gold-soft: rgba(183, 121, 31, .1);
    --live: #dc2626; --live-soft: rgba(220, 38, 38, .08);
    --win: #15803d; --win-soft: rgba(21, 128, 61, .09); --loss: #dc2626;
    --four: #2563eb; --six: #7c3aed;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06); --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5f7; --bg-2: #eceef2; --surface: #ffffff; --surface-2: #f7f8fa; --hover: #f0f2f5;
  --line: #e3e6eb; --line-2: #d3d8e0;
  --text: #0f172a; --muted: #5a6478; --dim: #8b94a6;
  --accent: #2f5bea; --accent-soft: rgba(47, 91, 234, .09);
  --gold: #b7791f; --gold-soft: rgba(183, 121, 31, .1);
  --live: #dc2626; --live-soft: rgba(220, 38, 38, .08);
  --win: #15803d; --win-soft: rgba(21, 128, 61, .09); --loss: #dc2626;
  --four: #2563eb; --six: #7c3aed;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06); --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.55 var(--body); min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--display); margin: 0; font-weight: 700; letter-spacing: -.01em; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .gold { color: var(--gold); }
.num { font-variant-numeric: tabular-nums; }
.ic { flex-shrink: 0; display: block; }
.loading { padding: 80px 0; text-align: center; color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); }

/* ---------- app shell: sidebar + main ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); padding: 16px 12px; overflow-y: auto; z-index: 40; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-ball { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; position: relative; background: radial-gradient(circle at 35% 30%, #f87171, #b91c1c 65%, #7f1d1d); }
.brand-ball::after { content: ''; position: absolute; inset: 4px 12px; border-left: 1.5px dashed rgba(255,255,255,.8); border-right: 1.5px dashed rgba(255,255,255,.8); border-radius: 50%; transform: rotate(35deg); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text b { font-family: var(--display); font-size: 16px; font-weight: 800; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { font-size: 11px; color: var(--muted); }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; font-size: 13.5px; transition: background .12s, color .12s; }
.side-nav a:hover { background: var(--hover); color: var(--text); }
.side-nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-nav a.nav-live .ic { color: var(--live); }
.side-nav hr { margin: 10px 4px; }
.side-foot { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); margin-top: 12px; }
.side-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--muted); font: 500 13px var(--body); cursor: pointer; text-align: left; }
.side-btn:hover { background: var(--hover); color: var(--text); }
.side-btn.live { color: var(--live); }
.side-meta { padding: 4px 10px; font-size: 11.5px; color: var(--dim); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 28px; }
#app { flex: 1; padding-bottom: 40px; }
.mobile-bar { display: none; }
.side-scrim { display: none; }

/* live strip (ticker) at the top of the main column */
.ticker { display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); background: var(--surface); scrollbar-width: none; }
.ticker:empty { display: none; }
.ticker::-webkit-scrollbar { display: none; }
.tick { display: flex; align-items: center; gap: 8px; padding: 9px 18px; border-right: 1px solid var(--line); white-space: nowrap; font-size: 12.5px; }
.tick b { font-weight: 700; }
.tick:hover { background: var(--hover); }

/* ---------- typography & layout primitives ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 32px 0 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; line-height: 1.15; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 720px; }
.eyebrow { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.section { margin: 28px 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 12px; }
.section-title h2 { font-size: 17px; font-weight: 650; }
.link { color: var(--accent); font-weight: 500; font-size: 13px; }
.link:hover { text-decoration: underline; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card h3 { font-size: 15px; font-weight: 650; margin-bottom: 12px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.auto { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap-row { flex-wrap: wrap; }
.empty { padding: 32px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--surface-2); }
.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.slot { color: var(--muted); font-style: italic; font-weight: 500; }
.warn-txt { color: var(--gold); }
.c-w { color: var(--live); } .c-4 { color: var(--four); } .c-6 { color: var(--six); }

/* ---------- crests & player avatars ---------- */
.crest { flex-shrink: 0; }
.crest.tbd { display: inline-grid; place-items: center; border-radius: 8px; background: var(--surface-2); border: 1px dashed var(--line-2); color: var(--dim); font-weight: 700; }
.crest-img { display: inline-grid; place-items: center; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); flex-shrink: 0; }
.crest-img img { width: 100%; height: 100%; object-fit: contain; }
.avatar { display: inline-grid; place-items: end center; border-radius: 50%; overflow: hidden; flex-shrink: 0; box-shadow: 0 0 0 1.5px var(--surface), 0 0 0 2.5px var(--line-2); }
.avatar svg { width: 100%; height: 100%; display: block; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.who { display: inline-flex; align-items: center; gap: 9px; min-width: 0; vertical-align: middle; }
.who-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.who-n { font-weight: 550; white-space: nowrap; }
.who-n a:hover { color: var(--accent); }
.who small { color: var(--muted); font-size: 11.5px; }

/* ---------- chips, roles, buttons ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.chip.live { background: var(--live-soft); color: var(--live); border-color: transparent; }
.chip.live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--live); animation: pulse 1.6s infinite; }
.chip.done { background: var(--win-soft); color: var(--win); border-color: transparent; }
.chip.soon { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.gold { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.chip.fh { background: var(--live); color: #fff; border: 0; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.role { display: inline-block; min-width: 34px; text-align: center; padding: 1px 6px; border-radius: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .03em; border: 1px solid var(--line); color: var(--muted); background: var(--surface-2); }
.role.Batter { color: #ea580c; border-color: rgba(234, 88, 12, .3); background: rgba(234, 88, 12, .08); }
.role.Bowler { color: #7c3aed; border-color: rgba(124, 58, 237, .3); background: rgba(124, 58, 237, .08); }
.role.All-Rounder { color: #0891b2; border-color: rgba(8, 145, 178, .3); background: rgba(8, 145, 178, .08); }
.role.WK { color: var(--win); border-color: rgba(21, 128, 61, .3); background: var(--win-soft); min-width: 28px; }
.tag { font-size: 10.5px; font-weight: 700; color: var(--gold); margin-left: 4px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: 550 13px var(--body); cursor: pointer; transition: background .12s, border-color .12s; white-space: nowrap; box-shadow: var(--shadow); }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #1c1300; }
.btn.danger { color: var(--live); border-color: color-mix(in srgb, var(--live) 40%, var(--line)); }
.btn.danger:hover { background: var(--live-soft); }
.btn.danger.solid { background: var(--live); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.live-btn { color: var(--live); border-color: color-mix(in srgb, var(--live) 35%, var(--line)); }
.live-btn:hover { background: var(--live-soft); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 20px 0; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; color: var(--muted); font: 550 13px var(--body); border: 0; background: none; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs .active { color: var(--text); border-color: var(--accent); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--muted); font: 550 12.5px var(--body); cursor: pointer; }
.pill:hover { color: var(--text); }
.pill.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- tables ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: right; font-size: 11.5px; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.tbl td { text-align: right; padding: 9px 14px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.tbl th:first-child, .tbl td:first-child, .tbl .l { text-align: left; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--hover); }
.tbl .b { font-weight: 700; }
.tbl .how { color: var(--muted); font-size: 12.5px; text-align: left; }
.tbl tr.hl td { background: var(--gold-soft); }
.tbl tr.q td:first-child { box-shadow: inset 3px 0 0 var(--win); }
.tbl tr.striker .who-n::after { content: ' *'; color: var(--accent); font-weight: 800; }
.tbl-wrap { overflow-x: auto; }
.form-dots { display: inline-flex; gap: 3px; }
.form-dots i { width: 18px; height: 18px; border-radius: 4px; display: grid; place-items: center; font-style: normal; font-size: 10px; font-weight: 700; }
.form-dots .W { background: var(--win); color: #fff; } .form-dots .L { background: var(--loss); color: #fff; }
.form-dots .T, .form-dots .N { background: var(--dim); color: #fff; }

/* ---------- home hero ---------- */
.hero { margin: 28px 0; border-radius: 16px; padding: 34px 32px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, var(--accent-soft), transparent 70%); }
.hero h1 { font-size: clamp(28px, 4vw, 44px); line-height: 1.08; max-width: 760px; position: relative; letter-spacing: -.02em; }
.hero h1 span { color: var(--accent); }
.hero p { color: var(--muted); font-size: 15px; margin: 10px 0 0; position: relative; }
.hero-stats { display: flex; gap: 32px; margin-top: 26px; flex-wrap: wrap; position: relative; }
.hero-stats div b { display: block; font-family: var(--display); font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-stats div span { font-size: 12px; color: var(--muted); }
.champ-hero { margin-top: 24px; border-radius: 16px; padding: 24px; display: flex; gap: 20px; align-items: center; flex-wrap: wrap; border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--line)); background: linear-gradient(120deg, var(--gold-soft), var(--surface) 60%); }
.champ-hero h1 { font-size: clamp(24px, 3.4vw, 36px); line-height: 1.1; }
.champ-hero .trophy-sm { font-size: 48px; }

/* ---------- match cards ---------- */
.mcard { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; transition: border-color .15s, box-shadow .15s; box-shadow: var(--shadow); }
.mcard:hover { border-color: var(--line-2); box-shadow: var(--shadow-lg); }
.mcard.is-live { border-color: color-mix(in srgb, var(--live) 45%, var(--line)); }
.mcard-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 10px; gap: 8px; }
.mteam { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.mteam .nm { flex: 1; font-weight: 550; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mteam .sc { font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.mteam .ov { font-size: 12px; color: var(--muted); margin-left: 4px; font-weight: 500; }
.mteam.lose { opacity: .55; }
.mteam.bat .nm::after { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--live); margin-left: 8px; vertical-align: 2px; }
.mcard-foot { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text); font-weight: 550; }
.mcard-foot.plain { color: var(--muted); font-weight: 500; }

/* ---------- match centre ---------- */
.mc-head { margin-top: 26px; border-radius: 16px; padding: 22px 24px; border: 1px solid var(--line); position: relative; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.mc-head .bgA, .mc-head .bgB { position: absolute; top: 0; height: 3px; width: 50%; opacity: 1 !important; background: var(--tc, transparent) !important; }
.mc-head .bgA { left: 0; } .mc-head .bgB { right: 0; }
.mc-meta { position: relative; display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; align-items: center; }
.mc-teams { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; margin: 20px 0 12px; }
.mc-team { display: flex; align-items: center; gap: 16px; }
.mc-team.r { flex-direction: row-reverse; text-align: right; }
.mc-team h2 { font-size: 19px; line-height: 1.2; }
.mc-score { font-family: var(--display); font-size: 40px; font-weight: 800; line-height: 1; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.mc-score small { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 6px; letter-spacing: 0; }
.mc-vs { font-size: 12px; font-weight: 700; color: var(--dim); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); }
.mc-status { position: relative; text-align: center; font-size: 15px; font-weight: 650; }
.mc-sub { position: relative; text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.winbar { position: relative; margin: 16px auto 0; max-width: 520px; }
.winbar .bar { display: flex; height: 6px; border-radius: 99px; overflow: hidden; background: var(--line); }
.winbar .lbl { display: flex; justify-content: space-between; font-size: 12px; margin-top: 6px; color: var(--muted); }
.scorebug { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.balls { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ball { min-width: 30px; height: 30px; padding: 0 6px; border-radius: 99px; display: inline-grid; place-items: center; font-weight: 700; font-size: 12px; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text); font-variant-numeric: tabular-nums; }
.ball.b4 { background: var(--four); border-color: var(--four); color: #fff; }
.ball.b6 { background: var(--six); border-color: var(--six); color: #fff; }
.ball.bw { background: var(--live); border-color: var(--live); color: #fff; }
.ball.bx { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 50%, var(--line)); background: var(--gold-soft); }
.ball.b0 { color: var(--dim); }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.kv div { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.kv span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 550; }
.kv b { font-family: var(--display); font-size: 20px; font-variant-numeric: tabular-nums; }
.recent-over { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.recent-over:last-child { border: 0; }
.recent-over .on { width: 48px; color: var(--muted); font-weight: 550; }
.recent-over .ball { min-width: 24px; height: 24px; font-size: 10.5px; }
.comm { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.comm .ov { font-weight: 700; font-size: 13px; width: 38px; color: var(--muted); padding-top: 5px; font-variant-numeric: tabular-nums; }
.comm .ball, .comm .avatar { flex-shrink: 0; }
.comm > div { padding-top: 4px; }
.comm-end { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; margin: 10px 0; font-size: 12.5px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ---------- awards ---------- */
.potm-hero { display: flex; gap: 16px; align-items: center; padding: 18px; border-radius: var(--radius); background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--line)); }
.potm-hero h2 { font-size: 22px !important; }
.medal { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; background: var(--gold-soft); flex-shrink: 0; }
.cand { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; background: var(--surface); }
.cand.top { border-color: color-mix(in srgb, var(--gold) 50%, var(--line)); background: var(--gold-soft); }
.cand .rank { font-weight: 700; font-size: 16px; color: var(--dim); text-align: center; }
.cand .pts { font-family: var(--display); font-size: 22px; font-weight: 800; color: var(--gold); text-align: right; line-height: 1; }
.cand .pts small { display: block; font-size: 10px; color: var(--dim); font-family: var(--body); font-weight: 600; }
.cand details { grid-column: 2 / -1; font-size: 12px; color: var(--muted); }
.cand details summary { cursor: pointer; color: var(--accent); }
.cand details ul { margin: 6px 0 0; padding-left: 18px; columns: 2; }
.note { font-size: 12.5px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; }
.note.warn { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 35%, var(--line)); color: var(--text); }
.potm-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }

/* ---------- teams & players ---------- */
.tcard { display: block; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface); transition: border-color .15s, box-shadow .15s; box-shadow: var(--shadow); }
.tcard:hover { border-color: var(--line-2); box-shadow: var(--shadow-lg); }
.tcard-band { height: 64px; position: relative; display: flex; align-items: flex-end; padding: 0 16px; }
.tcard-band .crest, .tcard-band .crest-img { transform: translateY(26px); }
.tcard-body { padding: 34px 16px 16px; }
.tcard-body h3 { font-size: 16px; }
.team-banner { margin-top: 26px; border-radius: 16px; padding: 24px; display: flex; gap: 22px; align-items: center; border: 1px solid var(--line); position: relative; overflow: hidden; flex-wrap: wrap; background: var(--surface) !important; box-shadow: var(--shadow); }
.team-banner::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--tc, var(--accent)); }
.team-banner h1 { font-size: clamp(26px, 3.6vw, 38px); line-height: 1.1; }
.team-banner .eyebrow { color: var(--muted) !important; }
.team-banner .bn-sub { margin-top: 8px; color: var(--muted); }
.squad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.pcard { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color .15s; }
.pcard:hover { border-color: var(--line-2); }
.pcard .nm { font-weight: 600; }
.pcard .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.team-tile { display: block; transition: border-color .15s; }
.team-tile:hover { border-color: var(--line-2); }
.squad-layout { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
.col-actions { display: flex; flex-direction: column; gap: 4px; }

/* ---------- stages / bracket ---------- */
.bracket2 { display: grid; grid-template-columns: repeat(var(--cols), minmax(240px, 1fr)); gap: 20px; align-items: center; overflow-x: auto; padding-bottom: 6px; }
.bracket-col h3 { font-size: 12px; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; text-transform: uppercase; font-weight: 650; }
.trophy { text-align: center; font-size: 48px; }
.progress { height: 5px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 8px; }
.progress div { height: 100%; background: var(--accent); border-radius: 99px; }

/* ---------- stats ---------- */
.lead { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.lead:last-child { border: 0; }
.lead .pos { width: 18px; font-weight: 700; color: var(--dim); font-size: 13px; }
.lead .who { flex: 1; min-width: 0; display: block; }
.lead .who a { font-weight: 600; }
.lead .who small { display: block; color: var(--muted); font-size: 11.5px; }
.lead .val { font-family: var(--display); font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; }
.lead.first .val { color: var(--accent); }
.cap { position: relative; overflow: hidden; }
.cap .cap-icon { position: absolute; left: 0; top: 0; right: 0; height: 3px; }
.cap.orange .cap-icon { background: #f97316; } .cap.purple .cap-icon { background: #8b5cf6; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field label.btn { color: var(--text); font-size: 12px; }
input, select, textarea { background: var(--surface); border: 1px solid var(--line-2); color: var(--text); border-radius: var(--radius-sm); padding: 8px 11px; font: 14px var(--body); width: 100%; }
input[type=color] { padding: 2px; height: 38px; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
details.more { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; margin-top: 4px; }
details.more summary { cursor: pointer; color: var(--accent); font-weight: 550; font-size: 13px; }
.seg { display: flex; gap: 6px; }
.seg label { flex: 1; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 9px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); font-weight: 600; color: var(--muted); background: var(--surface); }
.seg input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.seg-wide { flex-wrap: wrap; }
.seg-wide label { min-width: 200px; }
.img-pick { display: flex; align-items: center; gap: 14px; }
.img-prev { width: 72px; height: 72px; border-radius: 12px; border: 1px dashed var(--line-2); display: grid; place-items: center; overflow: hidden; background: var(--surface-2); flex-shrink: 0; font-size: 11px; color: var(--dim); }
.img-prev.round { border-radius: 50%; }
.img-prev img { width: 100%; height: 100%; object-fit: cover; }
#img-logo .img-prev img { object-fit: contain; }
.gen-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -4px 0 14px; }
.gen-row .muted { font-size: 12px; }

/* ---------- scorer pad ---------- */
.pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pad .run { height: 58px; font-family: var(--display); font-size: 24px; font-weight: 750; border-radius: 12px; }
.pad .run.r4 { color: var(--four); border-color: color-mix(in srgb, var(--four) 45%, var(--line)); }
.pad .run.r6 { color: var(--six); border-color: color-mix(in srgb, var(--six) 45%, var(--line)); }
.pad .run.wk { background: var(--live); border-color: var(--live); color: #fff; font-size: 16px; }
.extras { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 12px; }
.extras .btn.on { background: var(--gold); color: #1c1300; border-color: var(--gold); }
.xi-list { max-height: 440px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.xi-list label { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.xi-list label:hover { background: var(--hover); }
.xi-list label.on { background: var(--accent-soft); }
.xi-list input:disabled + .xi-no { opacity: .3; }
.xi-no { width: 18px; text-align: center; font-weight: 700; color: var(--accent); }
.kbd { font-size: 11.5px; color: var(--dim); }
.kbd kbd { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 5px; font-family: var(--body); }
.card.need { border-color: color-mix(in srgb, var(--live) 45%, var(--line)); }
.card.need.gold-b { border-color: color-mix(in srgb, var(--gold) 50%, var(--line)); }
.card.need select { flex: 1; }
.stepper { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 6px; flex-wrap: wrap; }
.stepper li { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); font-weight: 550; font-size: 12.5px; background: var(--surface); }
.stepper li span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 11.5px; }
.stepper li.done { color: var(--win); } .stepper li.done span { background: var(--win-soft); }
.stepper li.cur { color: var(--accent); border-color: var(--accent); } .stepper li.cur span { background: var(--accent); color: #fff; }

/* ---------- management: format, rules, setup ---------- */
.fmt-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color .15s; position: relative; }
.fmt-card input { position: absolute; opacity: 0; pointer-events: none; }
.fmt-card b { font-size: 15px; }
.fmt-card span { color: var(--muted); font-size: 13px; }
.fmt-card small { color: var(--accent); font-size: 12px; margin-top: auto; }
.fmt-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ff-teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.ff-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.ff-row span { flex: 1; font-weight: 550; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ff-row select { width: 70px; }
.ff-pairs { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 8px; }
.ff-pair { display: grid; grid-template-columns: 66px 1fr auto 1fr; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.rule-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
.rule-sug { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); }
.rule-sug span { flex: 1; min-width: 200px; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.checklist li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.checklist li .step-no { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.checklist li.done .step-no { background: var(--win); color: #fff; border-color: var(--win); }
.checklist li.next { border-color: var(--accent); background: var(--accent-soft); }
.checklist li small { display: block; color: var(--muted); font-size: 12px; }
.mode-banner { margin-top: 18px; padding: 11px 14px; border-radius: var(--radius-sm); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.mode-banner.demo { background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 40%, var(--line)); }
.mode-banner.live { background: var(--win-soft); border: 1px solid color-mix(in srgb, var(--win) 35%, var(--line)); }
.setup-back { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 18px; padding: 9px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); font-size: 13px; }
.setup-back a { font-weight: 650; color: var(--accent); }
.mode-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; flex-shrink: 0; }
.mode-badge.demo { background: #f59e0b; color: #1c1100; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; }
.mode-switch button { border: 0; background: transparent; color: var(--muted); font: 600 12px var(--body); padding: 7px 8px; cursor: pointer; }
.mode-switch button.on.demo { background: #f59e0b; color: #1c1100; }
.mode-switch button.on.live { background: var(--win); color: #fff; }
.mode-switch button:not(.on):hover { background: var(--hover); color: var(--text); }
.break-live { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 40%, var(--line)); }
.break-live b { font-size: 16px; }
.break-clock { font-family: var(--display); font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.sch-tbl input[type=datetime-local] { width: auto; padding: 5px 8px; font-size: 13px; }
.sch-tbl tr.sch-day td { background: var(--surface-2); font-weight: 650; font-size: 12.5px; color: var(--muted); text-align: left; }
.end-card { text-align: center; padding: 28px; border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); background: linear-gradient(180deg, var(--gold-soft), var(--surface) 70%); }
.end-title { font-family: var(--display); font-size: clamp(22px, 2.6vw, 30px); font-weight: 750; margin: 8px 0 12px; letter-spacing: -.01em; }
.end-confirm { text-align: center; padding: 6px 0; }
.onair { border-color: color-mix(in srgb, var(--live) 35%, var(--line)); background: linear-gradient(110deg, var(--live-soft), var(--surface) 55%); }
.onair-now { font-family: var(--display); font-size: 20px; font-weight: 700; margin: 8px 0 4px; }
.share-grid { display: grid; grid-template-columns: 170px 1fr; gap: 18px; align-items: start; }
.qr { width: 170px; height: 170px; border-radius: 12px; background: #fff; display: grid; place-items: center; padding: 6px; text-align: center; border: 1px solid var(--line); }
.qr svg { width: 100%; height: 100%; }

/* ---------- modal / toast / footer ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(8, 10, 16, .55); backdrop-filter: blur(3px); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.modal { width: min(560px, 100%); max-height: 90vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: var(--shadow-lg); }
.modal.wide { width: min(720px, 100%); }
.modal h3 { font-size: 18px; margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 400; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-weight: 550; font-size: 13px; animation: fade .2s; max-width: 380px; }
.toast.err { background: var(--live); color: #fff; }
.footer { display: flex; justify-content: space-between; gap: 12px; padding: 24px 28px; color: var(--dim); font-size: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.conn { font-size: 12px; }
.conn.on { color: var(--win); }

/* ---------- celebrations (always dark — they're a broadcast moment) ---------- */
.cel { position: fixed; inset: 0; z-index: 300; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; --c1: #5b82ff; --c2: #f2b544; color: #fff; font-family: var(--body);
  background: radial-gradient(ellipse at 50% 30%, color-mix(in srgb, var(--c1) 55%, transparent), transparent 62%), #05070d; transition: background .8s; animation: celIn .5s ease-out; }
.cel::before { content: ''; position: absolute; inset: -50%; background: repeating-conic-gradient(from 0deg, rgba(255,255,255,.035) 0 6deg, transparent 6deg 18deg); animation: celSpin 80s linear infinite; }
.cel-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.cel-fx-solo { position: fixed; z-index: 250; }
.cel-x { position: absolute; top: 18px; right: 18px; z-index: 5; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.3); background: rgba(0,0,0,.3); color: #fff; font-size: 18px; cursor: pointer; }
.cel-x:hover { background: rgba(255,255,255,.12); }
.cel-stage { position: relative; z-index: 3; width: min(1100px, 92vw); text-align: center; }
.cel-slide { animation: slideIn .7s cubic-bezier(.2,.9,.3,1.15); }
.cel-eyebrow { font-size: clamp(13px, 1.4vw, 20px); letter-spacing: .2em; text-transform: uppercase; color: var(--c2); font-weight: 700; margin: 14px 0 8px; }
.cel-title { font-family: var(--display); font-size: clamp(48px, 8vw, 128px); line-height: .95; font-weight: 850; letter-spacing: -.03em; color: #fff; }
.cel-sub { font-size: clamp(15px, 1.6vw, 22px); color: rgba(255,255,255,.82); margin-top: 12px; font-weight: 500; }
.cel-sub small { font-size: .75em; color: rgba(255,255,255,.6); }
.cel-lines { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.cel-lines span { font-size: clamp(15px, 1.6vw, 22px); font-weight: 650; padding: 6px 16px; border-radius: 99px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); font-variant-numeric: tabular-nums; }
.cel-hero .crest, .cel-hero .crest-img, .cel-logo { animation: pop 1s cubic-bezier(.2,.9,.3,1.3); object-fit: contain; }
.cel-hero .crest-img { background: transparent; border: 0; }
.cel-trophy { font-size: clamp(70px, 10vw, 140px); line-height: 1; animation: trophy 2.4s ease-in-out infinite; }
.cel-champ .cel-title { background: linear-gradient(180deg, #fff7d6, #f2b544 60%, #c08a12); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cel-award .cel-av { display: flex; justify-content: center; margin: 8px 0 16px; }
.cel-award .cel-av .avatar { box-shadow: 0 0 0 5px var(--c2), 0 20px 60px rgba(0,0,0,.5); animation: pop .9s cubic-bezier(.2,.9,.3,1.3); }
.cel-name { font-family: var(--display); font-size: clamp(36px, 5.5vw, 84px); line-height: 1; font-weight: 800; letter-spacing: -.02em; }
.cel-team { display: inline-flex; align-items: center; gap: 10px; margin-top: 10px; font-weight: 600; font-size: clamp(14px, 1.3vw, 18px); color: rgba(255,255,255,.85); }
.cel-team .crest-img { background: transparent; border: 0; }
.cel-stat { margin-top: 12px; display: flex; align-items: baseline; justify-content: center; gap: 12px; }
.cel-stat b { font-family: var(--display); font-size: clamp(64px, 9vw, 140px); line-height: .9; color: var(--c2); font-weight: 850; font-variant-numeric: tabular-nums; animation: countPop .8s .25s both cubic-bezier(.2,.9,.3,1.4); }
.cel-stat span { font-size: clamp(16px, 2vw, 28px); text-transform: uppercase; color: rgba(255,255,255,.8); font-weight: 600; letter-spacing: .04em; }
.cel-foot { position: absolute; bottom: 22px; left: 0; right: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 12px; color: rgba(255,255,255,.55); }
.cel-dots { display: flex; gap: 7px; }
.cel-dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.3); transition: .3s; }
.cel-dots i.on { background: var(--c2); width: 26px; border-radius: 6px; }
.cel-vs { display: flex; align-items: center; justify-content: center; gap: clamp(20px, 4vw, 70px); margin-bottom: 10px; }
.cel-vs > span { font-family: var(--display); font-size: clamp(22px, 2.6vw, 40px); font-weight: 800; color: rgba(255,255,255,.55); text-transform: uppercase; }
.cel-title-sm { font-size: clamp(34px, 5vw, 80px); }
.cel-title-sm small { font-size: .5em; color: rgba(255,255,255,.55); }
.cel-xi .cel-eyebrow { margin-bottom: 22px; }
.cel-xi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 44vw), 1fr)); gap: 10px 22px; text-align: left; }
.cel-xi-grid > div { display: flex; align-items: center; gap: 14px; padding: 8px 14px; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); animation: slideIn .5s both; }
.cel-xi-grid .n { width: 22px; color: rgba(255,255,255,.5); font-weight: 700; }
.cel-xi-grid b { font-size: clamp(15px, 1.3vw, 21px); font-weight: 650; }
.cel-xi-grid .avatar { box-shadow: 0 0 0 2px rgba(255,255,255,.3); }
@keyframes celIn { from { opacity: 0; } }
@keyframes celSpin { to { transform: rotate(360deg); } }
@keyframes slideIn { from { opacity: 0; transform: translateY(24px) scale(.97); } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.05); } 100% { transform: none; opacity: 1; } }
@keyframes countPop { from { transform: scale(.5); opacity: 0; } }
@keyframes trophy { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-12px) rotate(3deg); } }
@media (prefers-reduced-motion: reduce) { .cel::before, .cel-trophy, .chip.live::before { animation: none; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .scorebug, .potm-grid, .squad-layout { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .side { transform: none; }
  body.nav-open .side-scrim { display: block; position: fixed; inset: 0; background: rgba(8,10,16,.45); z-index: 35; }
  .mobile-bar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .mobile-bar .mb-title { flex: 1; font-weight: 700; font-family: var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mobile-bar button { border: 1px solid var(--line-2); background: var(--surface); color: var(--text); border-radius: var(--radius-sm); padding: 6px; cursor: pointer; display: grid; place-items: center; }
  .wrap { padding: 0 16px; }
}
@media (max-width: 640px) {
  .g2, .g4, .form-grid, .rule-fields { grid-template-columns: 1fr; }
  .hero { padding: 24px 20px; }
  .mc-teams { grid-template-columns: 1fr; }
  .mc-team.r { flex-direction: row; text-align: left; }
  .mc-vs { display: none; }
  .mc-score { font-size: 32px; }
  .page-head h1 { font-size: 24px; }
  .extras { grid-template-columns: repeat(3, 1fr); }
  .share-grid { grid-template-columns: 1fr; } .qr { margin: 0 auto; }
  .ff-pair { grid-template-columns: 1fr; }
  .footer { padding: 20px 16px; }
}
.pcard .nick { color: var(--gold); font-style: italic; font-weight: 600; font-size: 11.5px; }
