/* dnode Stats — shared design system.
 *
 * ONE stylesheet for every page so the homepage and competition pages can never
 * drift apart in color or feel. Premium / Apple-like, but ZERO runtime cost:
 *  - System font stack (San Francisco on Apple devices) — no web-font download.
 *  - Static gradient glow + layered surfaces for depth — no animation loops.
 *  - No backdrop-blur and no infinite animations (both are GPU-costly).
 *  - The CHROME accent (--brand) is constant everywhere; a tenant's brand color
 *    is only ever used as a small IDENTITY marker (an org swatch), never to
 *    repaint the whole UI — that was what made the pages clash.
 */

:root {
  --brand: #2f6df6;          /* constant system-blue accent for chrome */
  --brand-soft: #5b8bff;
  --bg: #07090d;             /* near-black with a faint cool cast */
  --surface: #10131a;        /* card */
  --surface-2: #161a23;      /* raised card / hover */
  --line: rgba(255,255,255,0.07);
  --line-2: rgba(255,255,255,0.12);
  --text: #f4f6fb;
  --dim: #98a0b0;            /* secondary text */
  --dim-2: #6b7384;          /* tertiary */
  --ok: #34d399;
  --bad: #f87171;
  --radius: 16px;
  --radius-sm: 11px;
  --maxw: 1080px;
}

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; -webkit-text-size-adjust: 100%; }
html, body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, system-ui, sans-serif;
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.011em;
}
a { color: inherit; text-decoration: none; }

/* Static ambient glow — one fixed layer, composited once, no per-frame paint. */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 42% at 50% -8%, rgba(47,109,246,0.16), transparent 60%),
    radial-gradient(48% 38% at 100% 0%, rgba(120,90,255,0.07), transparent 55%);
}

/* ---- top bar (not sticky — scrolls away with the page) ---- */
.top { background: var(--bg); border-bottom: 1px solid var(--line); }
/* Centered, logo-less brand header. */
.top-in { max-width: var(--maxw); margin: 0 auto; padding: 14px 22px; display: flex; justify-content: center; align-items: center; }
.mark { display: none; }
.brand { text-align: center; }
.brand b { font-weight: 650; letter-spacing: -0.02em; font-size: 15px; }
.brand small { display: block; font-size: 9.5px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim-2); margin-top: 1px; }

/* ---- page shell ---- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 30px 22px 96px; }
/* Premium back affordance — a real, tappable pill, not bare text. */
.back { display: inline-flex; align-items: center; gap: 7px; padding: 8px 15px 8px 12px; margin-bottom: 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
  color: var(--dim); font-size: 13px; font-weight: 600; letter-spacing: -0.01em;
  transition: background .15s, border-color .15s, color .15s, transform .1s; }
.back:hover { background: var(--surface-2); border-color: var(--line-2); color: var(--text); }
.back:active { transform: scale(0.97); }
button.back { font-family: inherit; cursor: pointer; }
/* Match page: Back (left) + Share (right) on one row, same pill styling. */
.match-topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 20px; }
.match-topbar .back { margin-bottom: 0; }
.topbar-actions { display: inline-flex; align-items: center; gap: 8px; }
h1 { font-size: 32px; line-height: 1.08; letter-spacing: -0.03em; font-weight: 680; margin: 16px 0 4px; }
.sub { color: var(--dim); margin: 0 0 22px; }
/* Consistent section rhythm app-wide: clear top gap before every section label,
   so a table/cards never sit flush against the next section's heading. */
.section-label { font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim-2); margin: 30px 0 14px; }
.section-label:first-child { margin-top: 0; }
.muted { color: var(--dim); }

/* ---- hero (home) ---- */
/* Compact, premium header — tight on vertical space so the pickers lead. */
.hero { padding: 6px 0 16px; }
.hero h1 { font-size: 27px; letter-spacing: -0.025em; max-width: 22ch; line-height: 1.12; }
.hero p { color: var(--dim); margin: 7px 0 0; max-width: 56ch; font-size: 13.5px; line-height: 1.5; }
@media (max-width: 640px) { .hero h1 { font-size: 22px; } h1 { font-size: 25px; } }

/* ---- cards / pick grid ---- */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.card {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent 60%), var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; cursor: pointer; color: inherit; font: inherit;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--line-2); background: var(--surface-2); }
.card .ic {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 21px; flex: none;
  background: rgba(255,255,255,0.04); border: 1px solid var(--line);
}
.card .swatch {
  width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center;
  font-weight: 800; font-size: 16px; color: #fff; border: 1px solid var(--line-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}
.card .meta { min-width: 0; flex: 1; overflow: hidden; }
/* display:block is REQUIRED for text-overflow:ellipsis to apply — inline spans
   ignore it, which is what let a long org name overflow the card. */
.card .meta .t { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta .s { display: block; font-size: 12.5px; color: var(--dim); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .chev { margin-left: 6px; color: var(--dim-2); flex: none; font-size: 20px; transition: transform .16s, color .16s; }
.card:hover .chev { transform: translateX(2px); color: var(--brand-soft); }

/* ---- organization tile grid (square cards w/ logo + full name) ---- */
.org-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
/* Homepage: organizations sit on top, so give the block clear separation from
   the filter chips / live scores below it (only once it has content). */
#leagues:not(:empty) { display: block; margin-bottom: 28px; padding-bottom: 26px; border-bottom: 1px solid var(--line); }
.org-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  aspect-ratio: 1 / 1; padding: 18px 16px; text-align: center; cursor: pointer; color: inherit; font: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.025), transparent 55%), var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.org-tile:hover { transform: translateY(-3px); border-color: var(--line-2); background: var(--surface-2); }
.org-logo-wrap { width: 64px; height: 64px; display: grid; place-items: center; flex: none; }
.org-logo { max-width: 100%; max-height: 100%; object-fit: contain; }
.org-initial {
  width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center;
  font-weight: 800; font-size: 26px; color: #fff; border: 1px solid var(--line-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}
.org-name { font-weight: 600; font-size: 14px; line-height: 1.3; } /* full name, wraps — no truncation */
/* Mobile: compact org tiles so a small org list (e.g. 3) sits on ONE row
   instead of one card stranded on its own line. Desktop keeps the big tiles. */
@media (max-width: 640px) {
  .org-grid { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 9px; }
  .org-tile { aspect-ratio: auto; min-height: 104px; padding: 14px 8px; gap: 9px; border-radius: 13px; }
  .org-logo-wrap { width: 42px; height: 42px; }
  .org-initial { width: 42px; height: 42px; border-radius: 11px; font-size: 18px; }
  .org-name { font-size: 11.5px; line-height: 1.22; }
}
@media (max-width: 480px) { .org-grid { grid-template-columns: repeat(3, 1fr); } }

/* ---- breadcrumb ---- */
/* Premium breadcrumb — clickable ancestors are real pill buttons; the current
   location is plain bold text. Reads like an Apple/Netflix path, not bare links. */
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 2px 0 22px; font-size: 13px; }
.crumbs button { background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  color: var(--dim); cursor: pointer; font: inherit; font-weight: 600; padding: 7px 12px;
  transition: background .15s, color .15s, border-color .15s, transform .1s; }
.crumbs button:hover { background: var(--surface-2); border-color: var(--line-2); color: var(--text); }
.crumbs button:active { transform: scale(0.97); }
.crumbs .sep { color: var(--dim-2); font-size: 12px; }
.crumbs .cur { color: var(--text); font-weight: 700; padding: 7px 2px; }

/* ---- tabs ---- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; }
.tabs::-webkit-scrollbar { display: none; }
.tab { background: none; border: none; color: var(--dim); cursor: pointer; font: inherit; font-weight: 600; padding: 11px 16px; border-bottom: 2px solid transparent; white-space: nowrap; transition: color .15s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--brand); }
/* Mobile: run the competition tab bar FULL-BLEED — escape the .wrap's 22px
   padding so the row spans edge-to-edge and the last tab ("Schedule") scrolls
   fully into view (with a soft fade on the right) instead of being clipped at
   the content boundary. Tighter tab padding helps all four fit. */
@media (max-width: 640px) {
  #tabs { margin-left: -22px; margin-right: -22px; padding: 0 22px;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent); }
  #tabs .tab { padding-left: 13px; padding-right: 13px; }
}

/* ---- panel + tables ---- */
.panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent 50%), var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px;
  box-shadow: 0 12px 40px -24px rgba(0,0,0,0.9);
  /* Safety net: if a table still can't fit (e.g. one absurdly long token),
     it scrolls WITHIN the card instead of pushing the whole page sideways. */
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 11px 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
/* Text columns (names, opponents) may wrap to a 2nd line so a long surname can't
   force the table wider than the screen. Numeric columns stay nowrap (above). */
td.pname, td.opp { white-space: normal; line-height: 1.25; word-break: break-word; }
/* Keep the rank flush with the first line of a wrapped name. */
.pname .rank { vertical-align: top; }
th { font-size: 10px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--dim-2); border-bottom: 1px solid var(--line-2); }
td { border-bottom: 1px solid var(--line); font-size: 14.5px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: rgba(255,255,255,0.02); }
.rank { color: var(--dim-2); width: 1.7em; display: inline-block; font-variant-numeric: tabular-nums; }
.team, .pname { font-weight: 600; }
.pts { font-weight: 800; color: var(--brand-soft); }
/* standings momentum: streak chip, colored by result */
.strk { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 13px; }
.strk-W { color: var(--ok); }
.strk-L { color: var(--bad); }
.strk-T { color: var(--dim); }

/* ---- Scoring Leaders front door (top of the Standings tab) ---- */
.fd-head { display: flex; align-items: baseline; justify-content: space-between; margin: 30px 0 9px; }
.fd-all { background: none; border: none; color: var(--brand-soft); font: inherit; font-weight: 600; font-size: 12.5px; cursor: pointer; padding: 0; }
.fd-all:hover { text-decoration: underline; }
.leaders-fd { display: flex; gap: 10px; overflow-x: auto; margin: 0 0 24px; padding-bottom: 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.leaders-fd::-webkit-scrollbar { display: none; }
.lead-card { flex: none; min-width: 186px; display: flex; align-items: center; gap: 11px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; cursor: pointer; transition: border-color .15s, transform .1s; }
.lead-card:hover { border-color: var(--brand); }
.lead-card:active { transform: scale(0.98); }
.lead-rk { flex: none; width: 23px; height: 23px; border-radius: 7px; display: grid; place-items: center; font-weight: 800; font-size: 12px; font-variant-numeric: tabular-nums; }
.lead-rk.r1 { background: rgba(245,197,66,0.16); color: #f5c542; }
.lead-rk.r2 { background: rgba(207,212,220,0.14); color: #cfd4dc; }
.lead-rk.r3 { background: rgba(208,139,82,0.16); color: #d08b52; }
.lead-info { min-width: 0; flex: 1; }
.lead-nm { display: block; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-tm { display: block; color: var(--dim); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.lead-g { flex: none; text-align: center; }
.lead-g b { display: block; font-weight: 800; font-size: 22px; font-variant-numeric: tabular-nums; color: var(--brand-soft); line-height: 1; }
.lead-g small { font-size: 8.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim-2); }

/* Horizontal rails (scorebar + leaders on desktop): fade the right edge so a
   clipped card reads as "swipe for more" — the Netflix/Apple rail treatment —
   instead of an ugly hard cut. */
.scorebar { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent); }
@media (min-width: 561px) {
  .leaders-fd { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent); }
}
/* On phones the 3 scoring-leader cards STACK into a clean, fully-padded list
   (matches the standings table) — no horizontal clip at all. */
@media (max-width: 560px) {
  .leaders-fd { flex-direction: column; overflow-x: visible; gap: 8px; }
  .leaders-fd .lead-card { min-width: 0; }
}
/* clickable player rows */
.prow { cursor: pointer; }
.prow .go { color: var(--dim-2); font-size: 18px; transition: transform .15s, color .15s; }
.prow:hover .go { transform: translateX(2px); color: var(--brand-soft); }

/* player page header */
.player-hd { display: flex; align-items: center; gap: 16px; margin: 8px 0 22px; }
.player-avatar { width: 60px; height: 60px; border-radius: 16px; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 24px; color: #fff; background: linear-gradient(150deg, var(--brand), #16224a); border: 1px solid var(--line-2); }
.player-id { display: flex; align-items: baseline; gap: 10px; }
.player-id h1 { margin: 0; }
.player-id .jersey { font-weight: 800; color: var(--dim); font-size: 20px; }
.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 26px; }
@media (max-width: 480px) { .stat-cards { grid-template-columns: repeat(3, 1fr); } }
/* team page uses a 4-up summary (Games/Points/Diff/Streak) */
.stat-cards-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 480px) { .stat-cards-4 { grid-template-columns: repeat(2, 1fr); } }
/* team logo inside the hero avatar */
.player-avatar.logo { background: var(--surface); padding: 8px; }
.player-avatar.logo img { width: 100%; height: 100%; object-fit: contain; }
/* in-table links (opponent team names) — keep row legible, hint on hover */
.lnk { color: inherit; text-decoration: none; }
.lnk:hover { color: var(--brand-soft); text-decoration: underline; }
/* team logos (from matrix) — small, contained, never distort */
.team-logo { width: 22px; height: 22px; object-fit: contain; flex: none; }
.team-logo.sm { width: 20px; height: 20px; }
.team-logo.inl { display: inline-block; vertical-align: middle; margin-right: 8px; }
/* logo + name group inside a schedule tile line (keeps score right-aligned) */
.mh-side { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mh-side .mh-team { min-width: 0; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-align: center; }
.stat-card .v { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.stat-card .v.accent { color: var(--brand-soft); }
.stat-card .k { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim-2); margin-top: 7px; }
.res { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-weight: 800; font-size: 11px; }
.res-W { background: rgba(52,211,153,0.16); color: var(--ok); }
.res-L { background: rgba(248,113,113,0.16); color: var(--bad); }
.res-T { background: rgba(255,255,255,0.08); color: var(--dim); }
/* ---- live scorebar: always-on game strip on the competition page ---- */
/* top+bottom padding so a tile's hover border/ring is never clipped by the
   horizontal-scroll container (overflow-x:auto also clips the y-axis). */
.scorebar { display: flex; gap: 9px; overflow-x: auto; margin: 0 0 20px; padding: 5px 2px 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
/* Mobile: run the rail FULL-BLEED (escape the .wrap's 22px padding) so it spans
   edge-to-edge and reads as an intentional ticker. First tile still aligns with
   the page content (padding-left), and the right fade lands at the browser edge. */
@media (max-width: 640px) {
  .scorebar { margin-left: -22px; margin-right: -22px; padding-left: 22px; padding-right: 18px; }
}
.scorebar::-webkit-scrollbar { display: none; }
.sb-tile { flex: none; width: 172px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 9px 11px; cursor: pointer; transition: border-color .15s; -webkit-tap-highlight-color: transparent; color: inherit; text-decoration: none; }
.sb-tile:hover, .sb-tile:focus-visible { border-color: var(--brand); outline: none; }
.sb-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; min-height: 13px; }
.sb-state { font-size: 9px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.sb-live { color: var(--bad); display: inline-flex; align-items: center; gap: 5px; }
.sb-live .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--bad); animation: pulse 1.4s ease-in-out infinite; }
.sb-final, .sb-soon { color: var(--dim-2); }
.sb-clock { font-size: 10px; color: var(--dim); font-variant-numeric: tabular-nums; }
.sb-row { display: flex; align-items: center; gap: 8px; padding: 1.5px 0; }
.sb-row img { width: 19px; height: 19px; object-fit: contain; flex: none; }
.sb-code { font-weight: 600; font-size: 12.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-num { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 13.5px; }
.sb-row.lose .sb-code, .sb-row.lose .sb-num { color: var(--dim-2); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ---- box-score scorebug header (broadcast-style; live pill or Final) ---- */
.bxbug { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 12px 4px 18px; }
.bxbug-team { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bxbug-team.home { flex-direction: row-reverse; }
.bxbug-team img { width: 40px; height: 40px; object-fit: contain; flex: none; }
.bxbug-tn { font-weight: 700; font-size: 14px; line-height: 1.15; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bxbug-team.home .bxbug-tn { text-align: right; }
.bxbug-score { font-weight: 800; font-size: 30px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; flex: none; }
.bxbug-center { text-align: center; min-width: 70px; }
.bxbug-pill { display: inline-flex; align-items: center; gap: 5px; background: var(--bad); color: #fff; font-size: 9.5px; font-weight: 800; letter-spacing: 0.08em; padding: 3px 9px; border-radius: 999px; }
.bxbug-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.4s ease-in-out infinite; }
.bxbug-final { font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim-2); }
.bxbug-per { font-size: 11px; color: var(--dim); margin-top: 5px; text-transform: uppercase; letter-spacing: 0.06em; }
/* Narrow phones: shrink logo/score/gaps so the team CODE (e.g. "QUIN") fits
   without truncating to "Q…". */
@media (max-width: 480px) {
  .bxbug { gap: 8px; padding: 10px 2px 16px; }
  .bxbug-team { gap: 7px; }
  .bxbug-team img { width: 32px; height: 32px; }
  .bxbug-score { font-size: 26px; }
  .bxbug-center { min-width: 58px; }
}

/* ---- dedicated match page: big broadcast scorebug header ---- */
/* The full scorebug is plain IN-FLOW content — it scrolls away normally and
   NEVER changes position or size. (The old sticky+shrink toggle changed the
   document height mid-scroll, which moved the scroll position and re-triggered
   the toggle → the multi-flicker.) Once it's scrolled out of view, a SEPARATE
   fixed compact bar (.matchbug-mini) fades in: pure opacity/transform, no
   reflow, no feedback loop — durable, reliable, GPU-cheap. */
.matchbug { position: relative; border: 1px solid var(--line-2); border-radius: 16px; overflow: hidden; background: var(--surface); margin-bottom: 22px; }

/* Fixed compact scoreboard — fades/slides in when the full one is scrolled off. */
.matchbug-mini { position: fixed; top: 0; left: 0; right: 0; z-index: 50; background: var(--surface); border-bottom: 1px solid var(--line-2); box-shadow: 0 6px 20px rgba(0,0,0,0.28); transform: translateY(-101%); opacity: 0; transition: transform .22s ease, opacity .2s ease; pointer-events: none; will-change: transform, opacity; }
.matchbug-mini.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
.mbm-in { max-width: var(--maxw); margin: 0 auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 7px 16px; }
.mbm-side { display: flex; flex-direction: row; align-items: center; gap: 9px; min-width: 0; }
.mbm-side.home { flex-direction: row-reverse; }
.mbm-side img, .mbm-ph { width: 24px; height: 24px; object-fit: contain; flex: none; }
.mbm-ph { display: grid; place-items: center; border-radius: 7px; background: rgba(255,255,255,0.07); font-weight: 800; font-size: 11px; color: var(--text); }
.mbm-sc { font-weight: 800; font-size: 21px; font-variant-numeric: tabular-nums; color: var(--text); }
.mbm-c { text-align: center; min-width: 54px; }
.mbm-live { display: inline-flex; align-items: center; gap: 5px; background: var(--bad); color: #fff; font-size: 9px; font-weight: 800; letter-spacing: 0.06em; padding: 3px 8px; border-radius: 999px; }
.mbm-live .dot { width: 5px; height: 5px; border-radius: 50%; background: #fff; animation: pulse 1.4s ease-in-out infinite; }
.mbm-st { font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim-2); }
.matchbug-glow { position: absolute; inset: 0; opacity: 0.42; pointer-events: none; }
/* Each side is a HORIZONTAL row (crest + code/score), with the HOME side mirrored
   (row-reverse) so both crests sit on the OUTER edges and both scores sit toward
   the CENTER. Halves the header height vs the old stacked layout. */
.matchbug-in { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 11px 16px; }
.matchbug-side { display: flex; flex-direction: row; align-items: center; gap: 11px; min-width: 0; }
.matchbug-side.home { flex-direction: row-reverse; }
.matchbug-meta { display: flex; flex-direction: column; align-items: center; gap: 0; min-width: 0; }
.matchbug-side img { width: 40px; height: 40px; object-fit: contain; }
.matchbug-fallback { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: 17px; color: #fff; background: linear-gradient(150deg, var(--brand), #16224a); border: 1px solid var(--line-2); }
.matchbug-code { font-weight: 700; font-size: 12.5px; letter-spacing: 0.02em; text-align: center; max-width: 11ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); }
.matchbug-score { font-weight: 800; font-size: 33px; font-variant-numeric: tabular-nums; line-height: 1.05; letter-spacing: -0.02em; }
.matchbug-center { text-align: center; min-width: 78px; }
.matchbug-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; padding: 4px 11px; border-radius: 999px; }
.matchbug-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse 1.4s ease-in-out infinite; }
.matchbug-final { font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim-2); }
.matchbug-per { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 7px; }
.matchbug-foot { position: relative; border-top: 1px solid var(--line); padding: 7px 16px; font-size: 11.5px; color: var(--dim-2); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* lineups (rosters) on the match page */
.lineups { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
/* Lineup team tabs: hidden on desktop (both columns show side-by-side). */
.lineups-tabs { display: none; }
.ltab { background: var(--surface); border: 1px solid var(--line); color: var(--dim); font: inherit; font-weight: 700; font-size: 13px; padding: 8px 16px; border-radius: 9px; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background .15s, color .15s, border-color .15s; }
/* Active tab takes the team's brand colour (--tc set inline per tab); falls back
   to the system brand when a team has no colour. Outlined + tinted (no solid fill
   with white text → readable for any brand hue, even bright yellows). */
.ltab.active { background: color-mix(in srgb, var(--tc, var(--brand)) 16%, transparent); border-color: var(--tc, var(--brand)); color: var(--tc, var(--brand)); }
@media (max-width: 600px) {
  /* On phones the two lineups go behind tabs — only the active team shows, so
     no long scroll. */
  .lineups-tabs { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
  .lineups { grid-template-columns: 1fr; }
  .lineups[data-lt="0"] .lineup-col[data-team="1"] { display: none; }
  .lineups[data-lt="1"] .lineup-col[data-team="0"] { display: none; }
  .lineup-col h4 { display: none; }   /* the active tab already names the team */
}
.lineup-col h4 { margin: 0 0 9px; }
.lineup-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lineup-row { display: flex; align-items: center; gap: 10px; padding: 8px 13px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.lineup-row:last-child { border-bottom: none; }
.lineup-num { width: 26px; flex: none; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--dim); }
.lineup-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lineup-pos { color: var(--dim-2); font-size: 11px; flex: none; }
.lineup-onice { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; box-shadow: 0 0 6px var(--ok); }

/* ---- box score: Three Stars (ranked medallion cards) + scoring summary ---- */
.three-stars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; margin: 2px 0 18px; }
.tstar {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 13px 14px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.045), transparent 72%), var(--surface);
  border: 1px solid var(--line); border-left: 3px solid var(--tc, var(--line-2));
}
/* gold / silver / bronze numbered medallion */
.tstar-rank {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; color: #14110a;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.3), 0 2px 8px rgba(0,0,0,0.35);
}
.tstar.s1 .tstar-rank { background: linear-gradient(160deg, #ffe27a, #f2b007); }
.tstar.s2 .tstar-rank { background: linear-gradient(160deg, #eef2f7, #b4bdca); }
.tstar.s3 .tstar-rank { background: linear-gradient(160deg, #e9ad6f, #c87a39); }
.tstar.s1 { border-top-color: rgba(242,176,7,0.4); }
.tstar-info { min-width: 0; flex: 1; }
.tstar-name { font-weight: 700; font-size: 14px; line-height: 1.2; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tstar-stat { margin-top: 2px; font-size: 12px; color: var(--dim); }
.tstar-stat b { color: var(--text); font-weight: 800; font-variant-numeric: tabular-nums; }
.tstar-team { flex: none; font-size: 11px; font-weight: 800; letter-spacing: 0.05em; align-self: flex-start; }
@media (max-width: 640px) { .three-stars { grid-template-columns: 1fr; gap: 8px; } }
.score-list { margin: 2px 0 16px; }
.score-row { display: flex; align-items: center; gap: 11px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.score-row:last-child { border-bottom: none; }
.score-row .sr-time { width: 64px; flex: none; color: var(--dim-2); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.score-row .sr-main { flex: 1; min-width: 0; font-size: 13.5px; }
.score-row .sr-main .sr-assist { color: var(--dim); font-size: 12px; }
.score-row .sr-score { font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }

@media (max-width: 640px) {
  th.hide-sm, td.hide-sm { display: none; }
  /* Reclaim horizontal room on phones so dense tables (e.g. the 6-column game
     log) fit without scrolling. */
  th, td { padding: 11px 6px; }
  td, .pname .rank { font-size: 14px; }
  .panel { padding: 4px 12px; }
}

/* ---- leaders ---- */
.lead-grid { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .lead-grid { grid-template-columns: 1fr; } }
.lead-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.lead-row { display: flex; align-items: center; gap: 11px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.lead-row:last-child { border-bottom: none; }
.lead-rank { width: 1.6em; color: var(--dim-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.lead-name { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-val { font-weight: 800; color: var(--brand-soft); font-variant-numeric: tabular-nums; }

/* ---- schedule + box score ---- */
.match { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 11px; overflow: hidden; background: var(--surface); }
/* schedule tiles now link to the dedicated match page */
.match-link { display: block; text-decoration: none; color: inherit; }
.match-head { display: flex; align-items: center; gap: 13px; padding: 13px 15px; cursor: pointer; transition: background .12s; }
.match-head:hover { background: var(--surface-2); }
/* Left column: status chip + (optional) gender badge stacked. */
.mh-statuscol { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; flex: none; }
.mh-status { font-size: 9.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; flex: none; }
.st-final { background: rgba(255,255,255,0.06); color: var(--dim); }
.st-live { background: rgba(248,113,113,0.16); color: var(--bad); }
.st-upcoming { background: rgba(47,109,246,0.14); color: var(--brand-soft); }
.mh-teams { flex: 1; min-width: 0; }
.mh-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mh-team { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mh-score { font-weight: 800; font-variant-numeric: tabular-nums; }
.mh-meta { font-size: 11.5px; color: var(--dim-2); margin-top: 3px; }
.mh-chev { color: var(--dim-2); flex: none; font-size: 18px; transition: transform .16s; }
.match.open .mh-chev { transform: rotate(90deg); }
.box { border-top: 1px solid var(--line); padding: 16px; display: none; background: rgba(0,0,0,0.18); }
.match.open .box { display: block; }
.box-cols { display: grid; gap: 20px; grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .box-cols { grid-template-columns: 1fr; } }
.box h4 { font-size: 10.5px; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; color: var(--dim-2); margin: 0 0 10px; }
/* play-by-play: grouped by period so it stays organized as events pile up */
.pbp-period { font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim-2);
  padding: 13px 0 7px; border-bottom: 1px solid var(--line-2); margin-bottom: 2px; }
.pbp-period:first-child { padding-top: 2px; }
.pbp { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.pbp:last-child { border-bottom: none; }
.pbp-time { width: 46px; flex: none; text-align: right; color: var(--dim-2); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.pbp-main { min-width: 0; flex: 1; }
.pbp-type { font-size: 10px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--dim-2); display: inline-flex; align-items: center; gap: 7px; }
.pbp-type.t-goal { color: var(--brand-soft); }
.pbp-type.t-penalty { color: var(--bad); }
.pbp-type.t-sub { color: var(--text); } /* subs/goalie changes: lit, but neutral (not a good/bad outcome) */
.pbp-who { font-size: 13.5px; margin-top: 2px; }
/* Goal strength pill (PP/SH/EN/PS) — small accent chip after the scorer (Summary + Feed). */
.strength-badge { display: inline-block; margin-left: 5px; padding: 1px 5px; border-radius: 5px; font-size: 9.5px; font-weight: 800; letter-spacing: 0.06em; color: var(--brand-soft); background: rgba(91,139,255,0.12); vertical-align: middle; }
/* Team shot rows (player-less) render muted/compact so goals stand out — the
   Feed shows every detail; the Summary tab is the highlights view. */
.pbp-shot { opacity: 0.6; }
.pbp-shot .pbp-type { color: var(--dim-2); }
/* Per-match goaltending line (hockey), under the Stats-tab comparison bars. */
.gtend { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.gtend-h { font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim-2); margin-bottom: 8px; }
.gtend-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 5px 0; }
.gtend-name { font-size: 13.5px; font-weight: 600; }
.gtend-stat { font-size: 12.5px; color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Scoring by period (hockey) — compact 3-col table: Period · Away · Home */
.psc { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.psc-h { font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim-2); margin-bottom: 8px; }
.psc-row { display: grid; grid-template-columns: 1fr 44px 44px; align-items: baseline; gap: 8px; padding: 5px 0; }
.psc-per { font-size: 13px; font-weight: 600; }
.psc-num { font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.psc-head { border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.psc-head .psc-per, .psc-head .psc-num { font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim-2); }
.psc-foot { border-top: 1px solid var(--line); margin-top: 2px; padding-top: 8px; }
.psc-foot .psc-per, .psc-foot .psc-num { font-weight: 800; }
/* Per-period scoring detail: the period tally row + the goals beneath it. */
.psc-sec { padding: 2px 0 4px; }
.psc-perhead { padding-bottom: 2px; }
.psc-perhead .psc-per { font-weight: 700; }
.psc-perhead .psc-num { font-weight: 700; color: var(--dim); }
.psc-goal { display: flex; align-items: baseline; gap: 9px; padding: 3px 0 3px 2px; font-size: 12.5px; }
.psc-team { flex: none; width: 40px; font-weight: 800; font-size: 11px; letter-spacing: 0.02em; }
.psc-scorer { flex: 1; min-width: 0; color: var(--text); }
.psc-assist { color: var(--dim); }
.psc-str { font-size: 9.5px; font-weight: 800; letter-spacing: 0.04em; color: var(--brand); }
.psc-time { flex: none; color: var(--dim); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.psc-empty { color: var(--dim); font-style: italic; }
/* Match Stats: title lives INSIDE the table header (top-left cell) */
.ms-panel { margin-top: 30px; }
.ms-title { color: var(--dim) !important; letter-spacing: 0.06em !important; }
.chip { font-size: 9.5px; font-weight: 700; padding: 1px 6px; border-radius: 5px; background: rgba(255,255,255,0.08); margin-left: 7px; vertical-align: middle; }

/* ---- match page: tabs (Summary / Stats / Lineup / Feed) ---- */
/* Reuses the global .tabs/.tab underline style; panels are toggled inline.
   Center the match-page tabs (Summary/Stats/Lineup/Feed) on every width — they
   fit comfortably, so centering reads more balanced than left-aligned. */
.mtabs { margin-top: 2px; justify-content: center; }
.mtab-panel { animation: fadein .18s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ---- match summary: key-events timeline (goals/cards/subs) ---- */
.te-list { margin: 2px 0 8px; }
.te { display: flex; gap: 12px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); }
.te:last-child { border-bottom: none; }
.te-min { width: 70px; flex: none; color: var(--dim-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.te-body { flex: 1; min-width: 0; font-size: 13.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.te-ic { width: 18px; flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--dim); }
.te-ic svg { display: block; }
.te-ic.te-dim { color: var(--dim-2); }
.te-who { color: var(--text); font-weight: 600; }
.te-in { color: var(--ok); font-weight: 600; }
.te-out { color: var(--dim); }
.te-note { color: var(--dim-2); font-size: 11px; }
.te-score { font-weight: 800; font-variant-numeric: tabular-nums; margin-left: auto; padding-left: 8px; }
.te-card { width: 10px; height: 14px; border-radius: 2px; display: inline-block; vertical-align: middle; }
/* feed event icons — inherit the .pbp-type colour (goal=team, card/pen=red, else dim) */
.pbp-ic { display: inline-flex; align-items: center; flex: none; }
.pbp-ic svg { display: block; }
.pbp-ic .te-card { width: 9px; height: 13px; }
/* period-boundary marker row (kick-off / half-time / period start-end / full-time) */
.tl-marker { display: flex; align-items: center; gap: 10px; margin: 12px 0 8px; }
.tl-marker:first-child { margin-top: 2px; }
.tl-marker-line { flex: 1; height: 1px; background: var(--line); }
.tl-marker-label { font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim-2); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tl-marker-label svg { display: block; opacity: 0.85; }
.te-card.te-yellow { background: #f5c542; }
.te-card.te-red { background: var(--bad); }

/* Centered "match centre" timeline (Summary tab) — a spine with the minute +
   node (score chip for goals/tries, icon disc for cards/subs) on it, and the
   player on their team's side (away left, home right). Keeps the dark theme. */
.ctl { position: relative; margin: 16px 0 10px; }
.ctl::before { content: ''; position: absolute; left: 50%; top: 10px; bottom: 10px; width: 2px; background: var(--line); transform: translateX(-50%); }
.ctl-row { position: relative; display: grid; grid-template-columns: 1fr 64px 1fr; align-items: center; column-gap: 12px; padding: 13px 0; }
.ctl-side { min-width: 0; }
.ctl-side.l { text-align: right; }
.ctl-side.r { text-align: left; }
.ctl-mid { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ctl-min { font-size: 11px; font-weight: 600; color: var(--dim-2); font-variant-numeric: tabular-nums; background: var(--bg); padding: 1px 6px; border-radius: 6px; line-height: 1.3; }
.ctl-node { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--tc, var(--line-2)); color: var(--text); }
.ctl-node svg { display: block; width: 16px; height: 16px; }
.ctl-node.ctl-dim { color: var(--dim-2); }
.ctl-chip { min-width: 46px; height: 32px; padding: 0 10px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; background: var(--text); color: var(--bg); }
.ctl-name { font-weight: 700; font-size: 14px; color: var(--text); line-height: 1.25; overflow-wrap: anywhere; }
.ctl-sub { font-size: 11.5px; color: var(--dim-2); margin-top: 2px; }
.ctl .tl-marker { margin: 16px 0; }
.ctl .tl-marker-label { background: var(--bg); padding: 0 8px; }

/* ---- match facts ---- */
.facts { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.fact { display: flex; justify-content: space-between; gap: 14px; padding: 11px 15px; border-bottom: 1px solid var(--line); }
.fact:last-child { border-bottom: none; }
.fact-k { color: var(--dim-2); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.fact-v { color: var(--text); font-weight: 600; font-size: 13.5px; text-align: right; }

/* ---- stats: team comparison bars (sport-aware) ---- */
.cmp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 18px; }
.cmp-team { display: flex; align-items: center; gap: 9px; min-width: 0; }
.cmp-head .cmp-team:last-of-type { flex-direction: row-reverse; } /* home mirrors to the right */
.cmp-team img { width: 30px; height: 30px; object-fit: contain; flex: none; }
.cmp-team-fb { width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; background: linear-gradient(150deg, var(--brand), #16224a); }
.cmp-team-name { font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-head-vs { color: var(--dim-2); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; flex: none; }
.cmp-list { display: flex; flex-direction: column; gap: 14px; }
.cmp-label { text-align: center; font-size: 12px; font-weight: 600; color: var(--dim); margin-bottom: 6px; }
.cmp-row { display: flex; align-items: center; gap: 12px; }
.cmp-num { width: 40px; flex: none; font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.cmp-row .cmp-num:first-child { text-align: left; }
.cmp-row .cmp-num:last-child { text-align: right; }
.cmp-track { flex: 1; min-width: 0; display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.cmp-fill { height: 100%; transition: width .4s ease; }
.cmp-fill:first-child { border-radius: 999px 0 0 999px; }
.cmp-fill:last-child { border-radius: 0 999px 999px 0; }

/* ---- skeleton + footer ---- */
.skel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); opacity: 0.6; }
.skel.h64 { height: 64px; margin-bottom: 12px; }
.foot { margin-top: 52px; padding-top: 22px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--dim-2); text-align: center; }
.foot a { color: var(--brand-soft); }
.skel.h96 { height: 96px; margin-bottom: 13px; }

/* ====== HOME (scores hub) — live/recent match cards across every org ====== */

/* org filter chips */
/* Full-bleed: escape the .wrap's 22px padding so the chip rail spans edge-to-edge
   and the overflow scroll fades off the screen edge (intentional), instead of a
   chip getting clipped mid-pill at the content boundary (looks like a bug). */
.org-chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -22px 16px; padding: 0 22px 4px; -ms-overflow-style: none; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 30px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 30px), transparent); }
.org-chips::-webkit-scrollbar { display: none; }
.chip-org { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--dim); font-weight: 600; font-size: 13px; white-space: nowrap; cursor: pointer; flex: none; transition: color .12s, background .12s, border-color .12s; }
.chip-org img { width: 18px; height: 18px; object-fit: contain; border-radius: 4px; }
.chip-org:hover { color: var(--text); border-color: var(--text); }
.chip-org.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* match-card grid */
.scores { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 13px; margin: 6px 0 14px; }
.mc { display: block; border: 1px solid var(--line); border-left: 3px solid var(--oc, var(--brand)); border-radius: 14px; background: var(--surface); padding: 13px 15px 14px; text-decoration: none; transition: border-color .15s ease, transform .15s ease; }
.mc:hover { border-color: var(--line-2); transform: translateY(-2px); }
.mc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.mc-badge { display: inline-flex; align-items: center; gap: 7px; min-width: 0; color: var(--dim); font-size: 11.5px; font-weight: 600; }
.mc-badge img { width: 18px; height: 18px; object-fit: contain; border-radius: 4px; flex: none; }
.mc-badge span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-st { font-size: 10px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; white-space: nowrap; flex: none; }
.mc-st.live { background: var(--bad); color: #fff; display: inline-flex; align-items: center; gap: 5px; }
.mc-st.live .dot { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.4s ease-in-out infinite; }
.mc-st.final { background: rgba(255,255,255,0.07); color: var(--dim-2); }
.mc-st.soon { background: transparent; color: var(--dim-2); padding-right: 0; }
.mc-teams { display: flex; flex-direction: column; gap: 9px; }
.mc-team { display: flex; align-items: center; gap: 11px; }
.mc-team img, .mc-ph { width: 27px; height: 27px; flex: none; object-fit: contain; }
.mc-ph { display: grid; place-items: center; border-radius: 7px; background: rgba(255,255,255,0.06); font-weight: 800; font-size: 12px; color: var(--text); }
.mc-tn { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-sc { font-weight: 800; font-size: 19px; font-variant-numeric: tabular-nums; color: var(--text); }
.mc-team.lose .mc-tn, .mc-team.lose .mc-sc { color: var(--dim); font-weight: 600; }
.mc-team.lose img { opacity: 0.65; }
/* Match-card right cluster: gender badge + status, grouped so the competition
   badge on the left keeps its ellipsis. Gender colours mirror matrix's pills. */
.mc-top-right { display: flex; align-items: center; gap: 7px; flex: none; }
.mc-gender { flex: none; font-size: 9.5px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,0.08); color: var(--dim); white-space: nowrap; }
.mc-gender.g-boys, .mc-gender.g-men { background: rgba(59,130,246,0.16); color: #bfdbfe; }
.mc-gender.g-girls, .mc-gender.g-women { background: rgba(236,72,153,0.16); color: #fbcfe8; }

/* =========================================================================
   ORGANIZATION HUB (organization.html) — premium, shareable org landing.
   --oc / --oc2 = the org's brand primary / secondary, set inline on .org-hero.
   ========================================================================= */
.org-hero { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); padding: 26px 24px; margin-bottom: 8px; }
.org-hero-grad { position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--oc, #2f6df6) 32%, transparent), transparent 55%),
    radial-gradient(120% 160% at 100% 0%, color-mix(in srgb, var(--oc2, #2f6df6) 22%, transparent), transparent 60%);
  opacity: 0.9; }
.org-hero-in { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 26px; flex-wrap: wrap; }
.org-id { display: flex; align-items: center; gap: 17px; min-width: 0; }
.org-crest { flex: none; }
.org-crest-img { width: 66px; height: 66px; object-fit: contain; border-radius: 15px; background: rgba(255,255,255,0.92); padding: 7px; box-shadow: 0 6px 22px rgba(2,6,23,0.4); }
.org-crest-fb { width: 66px; height: 66px; display: grid; place-items: center; border-radius: 15px; font-weight: 800; font-size: 30px; color: #fff; box-shadow: 0 6px 22px rgba(2,6,23,0.4); }
.org-id-meta { min-width: 0; }
.org-h-sport { display: flex; align-items: center; gap: 9px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); }
.org-live { display: inline-flex; align-items: center; gap: 5px; color: var(--bad); font-weight: 800; }
.org-live .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--bad); animation: pulse 1.4s ease-in-out infinite; }
.org-h-name { font-size: 30px; font-weight: 720; letter-spacing: -0.02em; line-height: 1.08; margin: 5px 0 13px; color: var(--text); }
.org-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.org-btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 999px; border: 1px solid transparent; background: var(--text); color: var(--bg); font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; text-decoration: none; transition: transform .12s ease, background .15s ease, border-color .15s ease, color .15s ease; }
.org-btn:hover { transform: translateY(-1px); }
.org-btn:active { transform: scale(0.97); }
.org-btn.ghost { background: transparent; border-color: var(--line-2); color: var(--text); }
.org-btn.ghost:hover { border-color: var(--text); }
.org-kpis { display: grid; grid-template-columns: repeat(4, minmax(72px, 1fr)); gap: 10px; }
.kpi { border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,0.03); padding: 12px 14px; text-align: center; min-width: 72px; }
.kpi-n { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.kpi-l { margin-top: 3px; font-size: 10px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--dim-2); }

/* Sticky filter bar */
.org-filters { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 12px 0 6px; margin: 6px 0 2px; }
.org-years { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 9px; -ms-overflow-style: none; scrollbar-width: none; }
.org-years::-webkit-scrollbar { display: none; }
.year-btn { flex: none; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--dim); font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; font-variant-numeric: tabular-nums; transition: color .12s, background .12s, border-color .12s; }
.year-btn:hover { color: var(--text); border-color: var(--text); }
.year-btn.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.comp-chips { margin-bottom: 0; }

/* Competitions directory */
.comp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 13px; margin: 6px 0 10px; }
.comp-card { display: block; border: 1px solid var(--line); border-left: 3px solid var(--oc, var(--brand)); border-radius: 14px; background: var(--surface); padding: 15px 16px; text-decoration: none; transition: border-color .15s ease, transform .15s ease; }
.comp-card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.comp-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.comp-card-name { font-weight: 700; font-size: 15.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-card-tags { display: flex; align-items: center; gap: 6px; flex: none; }
.comp-tag { flex: none; font-size: 10px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,0.07); color: var(--dim-2); white-space: nowrap; }
.comp-tag.done { color: var(--dim-2); }
.comp-live { flex: none; display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; background: var(--bad); color: #fff; }
.comp-live .dot { width: 5px; height: 5px; border-radius: 50%; background: #fff; animation: pulse 1.4s ease-in-out infinite; }
.comp-card-meta { margin-top: 7px; font-size: 12.5px; color: var(--dim); font-variant-numeric: tabular-nums; }
.comp-card-go { margin-top: 11px; font-size: 12px; font-weight: 700; color: var(--brand-soft); }
/* Current standings leader chip on a competition card */
.comp-leader { display: flex; align-items: center; gap: 7px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12.5px; }
.comp-leader-ic { flex: none; font-size: 12px; line-height: 1; }
.comp-leader-logo { width: 18px; height: 18px; object-fit: contain; border-radius: 4px; flex: none; }
.comp-leader-tm { font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-leader-pts { margin-left: auto; flex: none; color: var(--dim); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Org search box (team / competition filter) */
.org-search-wrap { position: relative; margin-bottom: 11px; }
.org-search-ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--dim-2); pointer-events: none; }
/* font-size:16px is deliberate — iOS Safari auto-zooms when focusing an input
   smaller than 16px; 16px keeps the page from zooming in on tap. */
.org-search { width: 100%; box-sizing: border-box; padding: 11px 14px 11px 36px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: inherit; font-size: 16px; }
.org-search::placeholder { color: var(--dim-2); }
.org-search:focus { outline: none; border-color: var(--brand-soft); }
.org-search::-webkit-search-cancel-button { -webkit-appearance: none; }

/* Filter bar: search + a single Filters button (options live in a popup). */
.org-filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.org-filter-bar .org-search-wrap { flex: 1; margin-bottom: 0; }
.org-filter-spacer { flex: 1; }
.org-filter-btn { flex: none; display: inline-flex; align-items: center; gap: 7px; padding: 11px 15px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; transition: border-color .12s, background .12s; }
.org-filter-btn svg { color: var(--dim); }
.org-filter-btn:hover { border-color: var(--text); }
.org-filter-btn.has { border-color: var(--brand-soft); }
.org-filter-btn.has svg { color: var(--brand-soft); }
.org-filter-count { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Filters popup — a bottom sheet on phones, a centered card on desktop. */
.filter-sheet { position: fixed; inset: 0; z-index: 60; display: grid; align-items: end; justify-items: stretch; background: rgba(3,5,9,0.72); backdrop-filter: blur(3px); }
.filter-sheet[hidden] { display: none; }
.filter-card { width: 100%; max-height: 82vh; overflow-y: auto; background: var(--surface-2); border: 1px solid var(--line-2); border-bottom: none; border-radius: 20px 20px 0 0; padding: 18px 18px 20px; }
@media (min-width: 560px) {
  .filter-sheet { align-items: center; justify-items: center; }
  .filter-card { width: 460px; max-width: calc(100% - 32px); border-bottom: 1px solid var(--line-2); border-radius: 18px; }
}
.filter-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.filter-head h3 { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; color: var(--text); }
.filter-head-actions { display: flex; align-items: center; gap: 4px; }
.filter-reset { background: none; border: none; color: var(--brand-soft); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; padding: 6px 8px; }
.filter-close { background: none; border: none; color: var(--dim); font-size: 24px; line-height: 1; cursor: pointer; width: 32px; height: 32px; border-radius: 8px; }
.filter-close:hover { color: var(--text); background: var(--surface); }
.filter-group { margin-bottom: 16px; }
.filter-group-h { font-size: 10px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim-2); margin-bottom: 9px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--dim); font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; transition: color .12s, background .12s, border-color .12s; }
.filter-chip:hover { color: var(--text); border-color: var(--text); }
.filter-chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.filter-done { width: 100%; justify-content: center; margin-top: 6px; }

/* QR + share modal */
.qr-modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; background: rgba(3,5,9,0.72); backdrop-filter: blur(3px); }
.qr-modal[hidden] { display: none; }
.qr-card { position: relative; width: 100%; max-width: 320px; border: 1px solid var(--line-2); border-radius: 20px; background: var(--surface-2); padding: 22px 22px 20px; text-align: center; }
.qr-close { position: absolute; top: 10px; right: 12px; width: 32px; height: 32px; border: none; background: none; color: var(--dim); font-size: 24px; line-height: 1; cursor: pointer; border-radius: 8px; }
.qr-close:hover { color: var(--text); background: var(--surface); }
.qr-h { font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim-2); margin-bottom: 14px; }
.qr-svg { background: #fff; border-radius: 14px; padding: 14px; display: grid; place-items: center; margin: 0 auto 13px; }
.qr-svg svg { width: 100%; height: auto; max-width: 230px; display: block; }
.qr-url { font-size: 12.5px; color: var(--dim); word-break: break-all; margin-bottom: 15px; }

@media (max-width: 640px) {
  .org-hero { padding: 20px 17px; border-radius: 17px; }
  .org-hero-in { gap: 18px; }
  .org-h-name { font-size: 25px; }
  .org-crest-img, .org-crest-fb { width: 56px; height: 56px; }
  /* 2×2 on phones — 4-across cramped the long labels ("COMPETITIONS" /
     "MATCHES PLAYED") against the box edge; two columns give them room. */
  .org-kpis { width: 100%; grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .kpi { padding: 12px 13px; min-width: 0; }
  .kpi-n { font-size: 22px; }
  .kpi-l { font-size: 9.5px; letter-spacing: 0.05em; }
  /* Full-bleed the competition chips (escape the .wrap 22px padding), like .org-chips. */
  .org-filters { margin-left: -22px; margin-right: -22px; padding-left: 22px; padding-right: 22px; }
  .org-years { padding-left: 0; }
}
