/* =====================================================================
   iskorBoard — Premium Design System
   Dark "broadcast" aesthetic · mobile-first · fully self-contained
   ===================================================================== */

/* ---- Design tokens ------------------------------------------------- */
:root {
  /* Brand */
  --brand: #f97316;
  --brand-600: #ea6a0d;
  --brand-400: #fb923c;
  --brand-300: #fdba74;
  --brand-soft: rgba(249, 115, 22, 0.14);
  --accent: #38bdf8;          /* cool secondary */
  --accent-soft: rgba(56, 189, 248, 0.14);

  /* Surfaces (deep navy) */
  --bg: #0a0f1c;
  --bg-grad-1: #0c1324;
  --bg-grad-2: #0a0f1c;
  --surface: #111a2e;
  --surface-2: #16223b;
  --surface-3: #1d2c49;
  --elevate: rgba(255, 255, 255, 0.03);
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.28);

  /* Text */
  --text: #eef2fb;
  --text-muted: #9fb0cc;
  --text-dim: #6b7c9c;

  /* Status */
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.14);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.15);
  --live: #f43f5e;

  /* Radii */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-full: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 10px 30px -12px rgba(0,0,0,.6);
  --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.7);
  --shadow-glow: 0 0 0 1px rgba(249,115,22,.25), 0 12px 40px -12px rgba(249,115,22,.35);

  /* Layout */
  --appbar-h: 64px;
  --maxw: 1160px;
  --space: 16px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "Segoe UI Mono", "Roboto Mono", ui-monospace, Menlo, Consolas, monospace;
}

/* ---- Reset / base -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 80% -10%, rgba(249,115,22,.10), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, rgba(56,189,248,.08), transparent 55%),
    linear-gradient(180deg, var(--bg-grad-1), var(--bg-grad-2));
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1,h2,h3,h4 { margin: 0 0 .4em; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; color: var(--text-muted); }
a { color: var(--brand-300); text-decoration: none; }
a:hover { color: var(--brand-400); }
small { font-size: .8rem; }
.icon { display: inline-block; vertical-align: middle; flex: none; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 2px; border-radius: 6px; }

/* ---- App bar ------------------------------------------------------- */
.appbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(10, 15, 28, 0.72);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid var(--line);
}
.appbar-inner {
  max-width: var(--maxw); margin: 0 auto; height: var(--appbar-h);
  display: flex; align-items: center; gap: 20px; padding: 0 20px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; letter-spacing: -.02em; }
.brand:hover { color: var(--text); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  color: #fff; background: linear-gradient(140deg, var(--brand), var(--brand-600));
  box-shadow: var(--shadow-glow);
}
.brand-name { font-size: 1.12rem; }
/* The logo is a full wordmark, so it replaces the mark + name lockup. */
.brand-logo { height: 30px; width: auto; display: block; }
.topnav { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.topnav-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: var(--r-full);
  color: var(--text-muted); font-weight: 600; font-size: .92rem; transition: all .18s ease;
}
.topnav-link:hover { color: var(--text); background: var(--elevate); }
.topnav-link.is-active { color: var(--brand-300); background: var(--brand-soft); }
.usermenu { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 5px 6px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: var(--r-full); display: grid; place-items: center;
  font-weight: 800; color: #fff; background: linear-gradient(140deg, #0ea5e9, #4f46e5);
}
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-name { font-weight: 700; font-size: .9rem; }
.user-role { font-size: .72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; }

/* ---- Layout containers -------------------------------------------- */
.main { max-width: var(--maxw); margin: 0 auto; padding: 28px 20px 96px; }
.main.is-wide { max-width: 1400px; }
.main-bare { min-height: 100vh; }
@media (min-width: 860px){ .main { padding-bottom: 40px; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .eyebrow { color: var(--brand-300); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; margin-bottom: 6px; }
.page-head p { margin: 4px 0 0; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
/* 200px (not 220) is what lets all five league-leader cards share one row on
   the 1160px page; below ~1080px they wrap 4-up, 3-up, then stack. */
.grid-5 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---- Cards --------------------------------------------------------- */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,0)) , var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
}
.card-pad { padding: 20px; }
.card-lg { border-radius: var(--r-lg); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 20px; }
.card-hover { transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.card-hover:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow-lg); }

/* ---- Buttons ------------------------------------------------------- */
.btn {
  --btn-bg: var(--surface-2); --btn-fg: var(--text); --btn-bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; min-height: 44px; border-radius: var(--r-full);
  font: inherit; font-weight: 700; font-size: .93rem; cursor: pointer;
  color: var(--btn-fg); background: var(--btn-bg); border: 1px solid var(--btn-bd);
  transition: transform .12s ease, filter .18s ease, background .18s ease, box-shadow .18s ease;
  -webkit-tap-highlight-color: transparent; user-select: none; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); color: var(--btn-fg); }
.btn:active { transform: scale(.97); }
.btn:disabled, .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn-primary { --btn-bg: linear-gradient(140deg, var(--brand), var(--brand-600)); --btn-fg: #fff; --btn-bd: transparent; box-shadow: var(--shadow-glow); text-shadow: 0 1px 1.5px rgba(90, 30, 0, .3); }
.btn-accent  { --btn-bg: linear-gradient(140deg, #0ea5e9, #4f46e5); --btn-fg: #fff; --btn-bd: transparent; text-shadow: 0 1px 1.5px rgba(0, 20, 60, .32); }
.btn-success { --btn-bg: linear-gradient(140deg, #22c55e, #16a34a); --btn-fg: #fff; --btn-bd: transparent; text-shadow: 0 1px 1.5px rgba(0, 40, 15, .35); }
.btn-danger  { --btn-bg: var(--danger-soft); --btn-fg: #fecaca; --btn-bd: rgba(239,68,68,.4); }
.btn-ghost   { --btn-bg: transparent; --btn-fg: var(--text-muted); --btn-bd: transparent; }
.btn-ghost:hover { --btn-fg: var(--text); background: var(--elevate); }
.btn-outline { --btn-bg: transparent; --btn-fg: var(--text); --btn-bd: var(--line-strong); }
.btn-sm { padding: 7px 13px; min-height: 36px; font-size: .84rem; }
.btn-lg { padding: 15px 26px; min-height: 54px; font-size: 1rem; }
.btn-icon { padding: 0; width: 44px; min-height: 44px; }
.btn-block { display: flex; width: 100%; }
.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* ---- Badges / pills ------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: var(--r-full);
  font-size: .74rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--line);
}
.badge-brand { background: var(--brand-soft); color: var(--brand-300); border-color: transparent; }
.badge-success { background: var(--success-soft); color: #86efac; border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: #fca5a5; border-color: transparent; }
.badge-warning { background: var(--warning-soft); color: #fcd34d; border-color: transparent; }
.badge-live {
  background: rgba(244,63,94,.15); color: #fda4af; border-color: transparent;
}
.badge-live::before { content:""; width:7px; height:7px; border-radius:50%; background: var(--live); box-shadow: 0 0 0 0 rgba(244,63,94,.6); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(244,63,94,.55);} 70%{box-shadow:0 0 0 8px rgba(244,63,94,0);} 100%{box-shadow:0 0 0 0 rgba(244,63,94,0);} }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

/* ---- Forms --------------------------------------------------------- */
.field { display: block; margin-bottom: 16px; }
.field > label, .label { display: block; font-weight: 600; font-size: .85rem; color: var(--text-muted); margin-bottom: 7px; }
.field .hint { font-size: .78rem; color: var(--text-dim); margin-top: 6px; }
.input, .select, .textarea {
  width: 100%; padding: 12px 14px; font: inherit; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
  appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--text-dim); }
/* Use background-COLOR only — the `background` shorthand would reset the select
   arrow's image/repeat/position and make it tile across the field on focus. */
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--brand-soft); background-color: var(--surface-3); }
.textarea { min-height: 96px; resize: vertical; }
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239fb0cc' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 38px;
}
.input-color { padding: 6px; height: 46px; cursor: pointer; }
.form-grid { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form-actions { display: flex; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; color: var(--text); }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }

/* "Save as" file-format picker, sized to sit inline with .btn (44px tall) */
.export-format { display: inline-flex; align-items: center; gap: 8px; }
.export-format > span {
  font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-dim); white-space: nowrap;
}
.export-format .select {
  width: auto; min-height: 44px; padding: 11px 36px 11px 14px;
  font-size: .88rem; font-weight: 700; border-radius: var(--r-full); cursor: pointer;
}

/* Segmented control */
.segment { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-full); }
.segment button, .segment a {
  border: 0; background: transparent; color: var(--text-muted); font: inherit; font-weight: 700; font-size: .85rem;
  padding: 8px 16px; border-radius: var(--r-full); cursor: pointer; transition: all .16s ease;
}
.segment .is-active { background: linear-gradient(140deg, var(--brand), var(--brand-600)); color: #fff; text-shadow: 0 1px 1.5px rgba(90, 30, 0, .3); }

/* ---- Tables -------------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 520px; }
table.data th, table.data td { padding: 12px 14px; text-align: right; white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; position: sticky; left: 0; z-index: 1; background: var(--surface); }
table.data thead th { color: var(--text-dim); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; border-bottom: 1px solid var(--line); background: var(--surface-2); }
table.data thead th:first-child, table.data tfoot td:first-child { background: var(--surface-2); z-index: 2; }
table.data tbody tr { border-bottom: 1px solid var(--line); }
table.data tbody tr:last-child { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--elevate); }
/* Keep the sticky name column OPAQUE on hover so scrolled stats never bleed through it. */
table.data tbody tr:hover td:first-child { background: var(--surface-2); }
table.data tfoot td { font-weight: 800; border-top: 1px solid var(--line-strong); background: var(--surface-2); }
.jersey { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--surface-3); font-size: .75rem; font-weight: 800; margin-right: 8px; color: var(--text-muted); }
.stat-pct { display: block; font-size: .64rem; font-weight: 500; color: var(--text-dim); line-height: 1.15; margin-top: 1px; }

/* ---- Stat tiles ---------------------------------------------------- */
.stat-tile { padding: 18px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.stat-tile .k { color: var(--text-dim); font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.stat-tile .v { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; margin-top: 4px; }
.stat-tile .sub { color: var(--text-muted); font-size: .82rem; }

/* ---- Scoreboard (broadcast) --------------------------------------- */
.scoreboard {
  position: relative; overflow: hidden; border-radius: var(--r-lg);
  background:
    radial-gradient(120% 120% at 50% -20%, rgba(249,115,22,.12), transparent 60%),
    linear-gradient(180deg, #0e1730, #0a1122);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg);
}
.scoreboard-grid { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 26px 20px; }
.sb-team { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.sb-logo { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-weight: 900; font-size: 1.5rem; color: #fff; box-shadow: var(--shadow-md); overflow: hidden; }
.sb-logo img, .avatar-square img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.sb-team-name { font-weight: 800; font-size: 1rem; letter-spacing: -.01em; }
.sb-score { font-size: clamp(3.2rem, 14vw, 5.5rem); font-weight: 900; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.sb-center { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 112px; }
.sb-clock { font-size: 2.2rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.sb-period { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--brand-300); }
.sb-vs { color: var(--text-dim); font-weight: 800; }
.sb-meta { display: flex; justify-content: center; gap: 16px; padding: 0 20px 18px; color: var(--text-dim); font-size: .8rem; flex-wrap: wrap; }
.sb-bonus { color: var(--warning); }

/* Score-change flourish: a floating "🏀 +N" rises + fades, the number pops. */
.score-float {
  position: absolute; left: 50%; top: 46%;
  transform: translate(-50%, 0);
  font-weight: 900; font-size: 1.9rem; white-space: nowrap;
  color: var(--brand-300); text-shadow: 0 2px 16px rgba(0, 0, 0, .5);
  pointer-events: none; z-index: 5;
  animation: scoreFloat 1s cubic-bezier(.2, .8, .2, 1) forwards;
}
@keyframes scoreFloat {
  0%   { opacity: 0; transform: translate(-50%, 20px) scale(.5); }
  22%  { opacity: 1; transform: translate(-50%, -2px) scale(1.18); }
  100% { opacity: 0; transform: translate(-50%, -82px) scale(1); }
}
.sb-score.pop { animation: scorePop .5s ease; }
@keyframes scorePop {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.22); color: var(--brand-300); }
  60%  { transform: scale(.96); }
  100% { transform: scale(1); }
}

/* ---- Play-by-play -------------------------------------------------- */
.pbp { display: flex; flex-direction: column; gap: 2px; max-height: 420px; overflow-y: auto; }
.pbp-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm); }
.pbp-item:hover { background: var(--elevate); }
.pbp-time { font-variant-numeric: tabular-nums; color: var(--text-dim); font-size: .78rem; min-width: 62px; }
.pbp-text { flex: 1; font-size: .9rem; }
.pbp-pts { font-weight: 800; color: var(--brand-300); }

/* ---- Flash / toast ------------------------------------------------- */
.flash-stack { position: fixed; top: calc(var(--appbar-h) + 12px); left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 10px; width: min(440px, calc(100vw - 24px)); }
.toast-stack { position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 10px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
@media (min-width:860px){ .toast-stack { bottom: 24px; } }
.flash, .toast {
  display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-radius: var(--r-sm);
  background: var(--surface-3); border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg);
  font-size: .9rem; font-weight: 600; animation: slideIn .3s cubic-bezier(.2,.8,.2,1); pointer-events: auto;
}
.flash span, .toast span { flex: 1; }
.flash-x { background: none; border: 0; color: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer; opacity: .7; }
.flash-success, .toast-success { border-left: 4px solid var(--success); }
.flash-error, .toast-error { border-left: 4px solid var(--danger); }
.flash-info, .toast-info { border-left: 4px solid var(--accent); }
.flash-warning, .toast-warning { border-left: 4px solid var(--warning); }
@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Empty state --------------------------------------------------- */
.empty { text-align: center; padding: 56px 20px; color: var(--text-muted); }
.empty .empty-icon { width: 72px; height: 72px; border-radius: 20px; display: grid; place-items: center; margin: 0 auto 18px; background: var(--surface-2); color: var(--text-dim); }
.empty h3 { color: var(--text); }

/* ---- Auth pages ---------------------------------------------------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(420px, 100%); }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 26px; }
.auth-brand .brand-mark { width: 56px; height: 56px; border-radius: 18px; }
/* Wordmark: size by width (predictable for a wide logo), height follows. */
.auth-logo { display: block; width: 220px; max-width: 80%; height: auto; margin: 0 auto; }
.auth-brand h1 { margin: 0; }
.auth-brand p { margin: 0; }

/* ---- List rows ----------------------------------------------------- */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); transition: background .15s ease; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--elevate); }
.list-title { font-weight: 700; }
.list-sub { color: var(--text-dim); font-size: .82rem; }

/* ---- League leader cards ------------------------------------------- */
/* Five cards across leaves ~210px each, so these rows are deliberately
   tighter than the shared .list-row: the per-game average is the headline
   and the season total sits under it. */
.lb-card .card-head { padding: 14px 12px; }
.lb-card .card-head h3 { display: flex; align-items: center; gap: 7px; font-size: .92rem; }
.lb-unit { flex: none; font-size: .68rem; font-weight: 700; letter-spacing: .06em; color: var(--text-dim); }
.lb-list { display: flex; flex-direction: column; }
.lb-row { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-bottom: 1px solid var(--line); transition: background .15s ease; }
.lb-row:last-child { border-bottom: 0; }
.lb-row:hover { background: var(--elevate); }
.lb-rank { flex: none; min-width: 13px; text-align: right; font-size: .78rem; font-weight: 700; color: var(--text-dim); }
.lb-who { flex: 1; min-width: 0; }
.lb-name, .lb-team { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-name { font-weight: 700; font-size: .85rem; line-height: 1.25; }
.lb-team { color: var(--text-dim); font-size: .72rem; line-height: 1.25; }
.lb-stat { flex: none; text-align: right; }
.lb-avg { font-weight: 800; font-size: 1.05rem; line-height: 1.15; }
.lb-total { color: var(--text-dim); font-size: .7rem; line-height: 1.3; white-space: nowrap; }
.avatar-square { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; }

/* Team vs team mini */
.matchup { display: flex; align-items: center; gap: 10px; }
.matchup .mt { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.matchup .mvs { color: var(--text-dim); font-size: .8rem; font-weight: 700; }

/* ---- Utilities ----------------------------------------------------- */
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}
.hide { display: none !important; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; } .gap-1{gap:8px}.gap-2{gap:16px}
.w-full { width: 100%; }
.divider { height: 1px; background: var(--line); margin: 18px 0; border: 0; }
.kbd { font-family: var(--mono); font-size: .78rem; padding: 2px 7px; border-radius: 6px; background: var(--surface-3); border: 1px solid var(--line); }

/* ---- Mobile bottom nav -------------------------------------------- */
.bottomnav { display: none; }
@media (max-width: 780px) {
  .topnav { display: none; }
  .user-meta { display: none; }
  .bottomnav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    display: flex; justify-content: space-around; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: rgba(10,15,28,.85); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid var(--line);
  }
  .bottomnav-link { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 12px; border-radius: 12px; color: var(--text-dim); font-size: .68rem; font-weight: 700; }
  .bottomnav-link.is-active { color: var(--brand-300); }
  .bottomnav-link.is-active .icon { transform: translateY(-1px); }
}

/* ---- Light theme --------------------------------------------------- */
/* Applied when <html data-theme="light">. The broadcast scoreboard keeps its
   dark treatment on purpose; everything else adapts via these tokens. */
:root[data-theme="light"] {
  --bg: #eef2f8;
  --bg-grad-1: #f5f8fd;
  --bg-grad-2: #e8eef7;
  --surface: #ffffff;
  --surface-2: #f4f7fc;
  --surface-3: #e9f0fa;
  --elevate: rgba(15, 23, 42, 0.04);
  --line: rgba(15, 23, 42, 0.10);
  --line-strong: rgba(15, 23, 42, 0.17);
  --text: #101a2e;
  --text-muted: #46566f;
  --text-dim: #7d8ba2;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .08);
  --shadow-md: 0 12px 30px -16px rgba(15, 23, 42, .22);
  --shadow-lg: 0 24px 60px -24px rgba(15, 23, 42, .26);
  --shadow-glow: 0 0 0 1px rgba(249, 115, 22, .2), 0 12px 34px -14px rgba(249, 115, 22, .38);
  --brand-soft: rgba(249, 115, 22, 0.12);
  --accent-soft: rgba(56, 189, 248, 0.12);
}
/* Light mode: the app bar goes brand orange, so everything inside it flips to
   white for contrast (nav links, user meta, and the ghost icon buttons). */
:root[data-theme="light"] .appbar {
  background: linear-gradient(140deg, var(--brand), var(--brand-600));
  border-bottom-color: rgba(124, 45, 18, 0.35);
}
:root[data-theme="light"] .appbar .topnav-link { color: rgba(255, 255, 255, 0.88); }
:root[data-theme="light"] .appbar .topnav-link:hover { color: #fff; background: rgba(255, 255, 255, 0.16); }
:root[data-theme="light"] .appbar .topnav-link.is-active { color: #fff; background: rgba(255, 255, 255, 0.24); }
:root[data-theme="light"] .appbar .user-name { color: #fff; }
:root[data-theme="light"] .appbar .user-role { color: rgba(255, 255, 255, 0.82); }
:root[data-theme="light"] .appbar .btn-ghost { --btn-fg: #fff; }
:root[data-theme="light"] .appbar .btn-ghost:hover { background: rgba(255, 255, 255, 0.16); }
:root[data-theme="light"] .appbar .user-avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55); }
:root[data-theme="light"] .bottomnav { background: rgba(255, 255, 255, 0.88); }
/* Scoreboard adapts to light mode too (its team names/scores inherit --text). */
:root[data-theme="light"] .scoreboard {
  background:
    radial-gradient(120% 120% at 50% -20%, rgba(249, 115, 22, 0.10), transparent 60%),
    linear-gradient(180deg, #ffffff, #e9eff8);
}
:root[data-theme="light"] .sb-vs { color: var(--text-dim); }
:root[data-theme="light"] .btn-danger { --btn-fg: #b91c1c; }
:root[data-theme="light"] .badge { color: var(--text-muted); }
:root[data-theme="light"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2346566f' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

/* ---- Theme toggle -------------------------------------------------- */
.theme-toggle .icon-sun, .theme-toggle .icon-moon { display: none; align-items: center; }
.theme-toggle .icon-sun { display: inline-flex; }               /* dark mode → offer sun */
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: inline-flex; } /* light → offer moon */
.bare-toolbar { position: fixed; top: 14px; right: 14px; z-index: 60; }
.theme-toggle.floating { background: var(--surface-2); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }

/* ---- Scoring console: player chips --------------------------------- */
.pa-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 0 8px; }
.pa-head .label { margin: 0; }
/* auto-fit lands 5 across at full roster and lets chips fill the row when fewer. */
.pa-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(54px, 1fr)); gap: 8px; margin-bottom: 14px; }
.pa-grid .text-dim { grid-column: 1 / -1; }
.player-chip {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 9px 5px; min-height: 66px; border-radius: 12px; min-width: 0; text-align: center;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
  font: inherit; cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease;
}
.player-chip:active { transform: scale(.97); }
.player-chip .jersey { margin: 0; }
.player-chip .pl-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: .82rem; line-height: 1.1; }
.player-chip .pl-pts { font-size: .74rem; color: var(--text-dim); font-weight: 800; }
.player-chip .pl-meta { font-size: .58rem; color: var(--text-dim); font-weight: 600; line-height: 1; }
.player-chip .pl-foul-trouble { color: #ef4444; font-weight: 800; }
.player-chip.is-bench { border-style: dashed; background: transparent; color: var(--text-dim); }
.player-chip.is-bench .pl-name { color: var(--text-muted); } /* keep bench names readable (AA) */
.player-chip.is-sel-score {
  border: 2px solid var(--brand); background: rgba(249,115,22,.16);
  box-shadow: 0 0 0 3px var(--brand-soft), 0 10px 22px -10px rgba(249,115,22,.5);
  transform: translateY(-2px); color: var(--text);
}
.player-chip.is-sel-score .jersey { background: var(--brand); color: #fff; }
.player-chip.is-sel-score .pl-pts { color: var(--brand-300); }
.player-chip.is-sel-sub {
  border: 2px solid var(--accent); background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 10px 22px -10px rgba(56,189,248,.5);
  transform: translateY(-2px); color: var(--text);
}
.player-chip.is-sel-sub .jersey { background: var(--accent); color: #06121f; }
.pa-sub { flex: none; }

/* ---- Public live view --------------------------------------------- */
.live-shell {
  max-width: 1060px; margin: 0 auto; padding: 8px 20px 64px;
  display: flex; flex-direction: column; gap: 18px;
}
.live-topbar { display: flex; align-items: center; gap: 10px; padding-top: 4px; }
.live-topbar .brand-name { font-size: 1.08rem; }
.live-topbar .brand-logo { height: 26px; }
.live-meta { text-align: center; font-size: .9rem; margin-top: -8px; }
.sb-team-sub { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: .82rem; font-weight: 700; min-height: 20px; margin-top: 2px; }
.sb-team-sub .num { color: var(--text-muted); }
.sb-team-sub .js-home-bonus, .sb-team-sub .js-away-bonus { color: var(--warning); }
.live-actions { justify-content: center; flex-wrap: wrap; }
.live-boxscore { gap: 16px; }
@media (max-width: 640px) {
  .live-shell { gap: 14px; padding: 6px 14px 52px; }
  .live-topbar .brand-name { font-size: 1rem; }
}

/* ---- Motion preferences -------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
