/* 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); }
.top-in { max-width: var(--maxw); margin: 0 auto; padding: 14px 22px; display: flex; align-items: center; gap: 12px; }
.mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(150deg, var(--brand), #16224a);
  display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #fff;
  box-shadow: 0 2px 10px -2px rgba(47,109,246,0.5);
}
.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; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--dim); font-size: 13px; font-weight: 500; transition: color .15s; }
.back:hover { color: var(--text); }
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; }
.section-label { font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim-2); margin: 0 0 14px; }
.muted { color: var(--dim); }

/* ---- hero (home) ---- */
.hero { padding: 20px 0 30px; }
.hero h1 { font-size: 40px; max-width: 14ch; }
.hero p { color: var(--dim); margin: 0; max-width: 60ch; font-size: 16px; }
@media (max-width: 640px) { .hero h1 { font-size: 30px; } 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)); }
.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 */
@media (max-width: 480px) { .org-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---- breadcrumb ---- */
.crumbs { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin: 20px 0 24px; font-size: 13px; }
.crumbs button { background: none; border: none; color: var(--brand-soft); cursor: pointer; font: inherit; padding: 0; font-weight: 500; }
.crumbs button:hover { color: var(--brand); }
.crumbs .sep { color: var(--dim-2); }
.crumbs .cur { color: var(--dim); }

/* ---- 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); }

/* ---- 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); }
/* 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); }
/* ---- box score: Three Stars + scoring summary (NHL/Sportsnet pattern) ---- */
.three-stars { display: flex; gap: 10px; flex-wrap: wrap; margin: 2px 0 16px; }
.tstar { display: flex; align-items: center; gap: 9px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 13px 8px 10px; }
.tstar .medal { font-weight: 800; font-size: 15px; width: 20px; text-align: center; }
.tstar.s1 .medal { color: #f5c542; } .tstar.s2 .medal { color: #cfd4dc; } .tstar.s3 .medal { color: #d08b52; }
.tstar .tname { font-weight: 600; font-size: 13.5px; line-height: 1.15; }
.tstar .tsub { color: var(--dim); font-size: 11.5px; margin-top: 1px; }
.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); }
.match-head { display: flex; align-items: center; gap: 13px; padding: 13px 15px; cursor: pointer; transition: background .12s; }
.match-head:hover { background: var(--surface-2); }
.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; }
.pbp { display: flex; gap: 11px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pbp:last-child { border-bottom: none; }
.pbp-time { width: 56px; flex: none; text-align: right; color: var(--dim-2); font-variant-numeric: tabular-nums; font-size: 13px; }
.pbp-main { min-width: 0; }
.pbp-type { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.pbp-who { font-size: 13.5px; margin-top: 1px; }
.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; }

/* ---- 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); }
