/* Tokens per docs/design/DESIGN_SPEC.md: light = away jersey, dark = home jersey. Token names and
   their fixed meanings are unchanged; only values, fonts and the chart series (--s1..--s5) are new. */
:root {
  --font-display: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-body: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f4f6fa;  --bg2: #ffffff;  --bg3: #e9eef7;  --bd: #cfd8e8;
  --tx: #0b0e14;  --mu: #5a6579;
  --ac: #1f5fd6;  --ac-ink: #ffffff;
  --bl: #1f5fd6;  --gn: #1a7f45;  --rd: #b5121b;  --or: #a85c08;  --pu: #7a4fd6;
  --team: #c8102e;  --plate-ink: #ffffff;  --plate-edge: #0b0e14;  --plate-ice: #4a90d9;
  --s1: #1f5fd6; --s2: #c8102e; --s3: #2a8fc9; --s4: #d97b06; --s5: #7a4fd6;
  --shadow: 0 1px 2px rgba(11, 14, 20, 0.06), 0 4px 12px rgba(11, 14, 20, 0.06);
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0e14;  --bg2: #141924;  --bg3: #1e2533;  --bd: #2b3446;
    --tx: #f4f6fa;  --mu: #8d97a8;
    --ac: #6f9ff0;  --ac-ink: #0b0e14;
    --bl: #6f9ff0;  --gn: #3fb950;  --rd: #f0625a;  --or: #eb910d;  --pu: #a892e6;
    --team: #e03a3e;  --plate-edge: #000000;  --plate-ice: #8fc6f0;  --plate-ice: #8fc6f0;
    --s1: #4a86e8; --s2: #e0483f; --s3: #2d9bd6; --s4: #c4841a; --s5: #8f6fe0;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.4);
  }
}
:root[data-theme="dark"] {
  --bg: #0b0e14;  --bg2: #141924;  --bg3: #1e2533;  --bd: #2b3446;
  --tx: #f4f6fa;  --mu: #8d97a8;
  --ac: #6f9ff0;  --ac-ink: #0b0e14;
  --bl: #6f9ff0;  --gn: #3fb950;  --rd: #f0625a;  --or: #eb910d;  --pu: #a892e6;
  --team: #e03a3e;  --plate-edge: #000000;  --plate-ice: #8fc6f0;
  --s1: #4a86e8; --s2: #e0483f; --s3: #2d9bd6; --s4: #c4841a; --s5: #8f6fe0;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Semantic color assignment is fixed and never varies across views:
   --gn improving/good, --rd declining/bad, --bl elite/neutral-positive,
   --or caution/cooling, --ac interactive-only (active state, hover border, selection), --mu no-signal. */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--tx);
  font-family: var(--font-body);
  font-feature-settings: "tnum";
  font-size: 15px;
  padding-bottom: 3rem;
}

/* ---------------------------------------------------------------------- */
/* Layout primitives -- four, and only four                               */
/* ---------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  background: var(--bg2);
  border-bottom: 1px solid var(--bd);
  padding: 0.5rem 1rem;
}


.topbar h1 {
  margin: 0;
  font-size: 1.15rem;
  font-family: var(--font-display);  /* same face and setting as the tabs and section headers */
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.topbar .brand { display: inline-flex; line-height: 0; }
.topbar .brand img { width: 40px; height: 40px; border-radius: 50%; }

.topbar .sub {
  color: var(--mu);
  font-size: 0.8em;
}

.topbar .share-link {
  margin-left: auto;
  background: transparent;
  color: var(--mu);
  border: 1px solid var(--bd);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.75em;
  cursor: pointer;
}
.topbar .share-link:hover { color: var(--tx); border-color: var(--tx); }
.topbar .share-link.done { color: var(--ac-ink); background: var(--ac); border-color: var(--ac); }

.topbar .stamp {
  color: var(--mu);
  font-size: 0.72em;
  white-space: nowrap;
}

nav.tabs {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.75rem 1rem 0;
  max-width: 1200px;
  margin: 0 auto;
  -webkit-overflow-scrolling: touch;
}

nav.tabs button {
  flex: 0 0 auto;
  background: var(--bg2);
  border: 1px solid var(--bd);
  color: var(--tx);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.86em;
  cursor: pointer;
  transition: border-color 0.15s;
}
nav.tabs button:hover { border-color: var(--ac); }
nav.tabs button.active { background: var(--ac); color: var(--ac-ink); border-color: var(--ac); }

.fbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.86em;
}
.fbar label { color: var(--mu); font-size: 0.82em; }
.scope-toggle {
  display: inline-flex;
  border: 1px solid var(--bd);
  border-radius: 999px;
  overflow: hidden;
}
.scope-toggle button {
  border: none;
  background: var(--bg2);
  color: var(--tx);
  padding: 0.3rem 0.8rem;
  font-size: 0.82em;
  cursor: pointer;
}
.scope-toggle button.active { background: var(--ac); color: var(--ac-ink); }

.fbar select, .fbar input {
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--bd);
  background: var(--bg2);
  color: var(--tx);
  font-size: 0.86em;
  accent-color: var(--ac);
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

@media (min-width: 720px) {
  main { padding: 1.5rem; }
}

section.view { display: none; }
section.view.active { display: block; }

.card {
  background: var(--bg2);
  border: 1px solid var(--bd);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  transition: border-color 0.15s;
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}
.card h3 {
  margin: 0 0 0.4rem;
  font-size: 0.86rem;
}

/* Section micro-header: the highest-leverage single class in the system */
.sec {
  font-size: 0.68em;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--mu);
  font-weight: 700;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

/* Horizontal-scroll strip of fixed-width cards -- the "Rising Now" / movers pattern */
.rstrip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  -webkit-overflow-scrolling: touch;
}
.rstrip .rcard {
  min-width: 175px;
  flex-shrink: 0;
}

/* Division upcoming strip. --team is brand-only chrome per the design spec, same as the .row-us
   left edge, so our own game is marked without spending a data color on it. */
.rcard-us {
  border-left: 3px solid var(--team);
}
.du-match {
  margin-top: 0.25rem;
}
.du-team {
  font-weight: 600;
}

/* ---------------------------------------------------------------------- */
/* KPI / stat cards                                                       */
/* ---------------------------------------------------------------------- */

.stat-tile, .kpi-card, .rcard {
  background: var(--bg3);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.8rem 1rem;
  transition: border-color 0.15s, transform 0.1s;
}

.stat-tile .value, .kpi-card .value {
  font-size: 1.15em;
  font-weight: 700;
  line-height: 1.15;
}

.stat-tile .label, .kpi-card .label, .rcard .label {
  color: var(--mu);
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kpi-card { display: flex; flex-direction: column; gap: 0.3rem; }
.kpi-card .value-row { display: flex; align-items: baseline; gap: 0.4rem; }
.kpi-card .spark-wrap { margin-top: 0.1rem; }

.rcard {
  cursor: default;
}
.rcard .anchor {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}
.rcard .name { font-size: 0.86em; margin-top: 0.15rem; }
.rcard .team { font-size: 0.76em; color: var(--mu); }
.film-card { display: block; text-decoration: none; color: inherit; cursor: pointer; }
.film-card:hover { border-color: var(--ac); }

/* ---------------------------------------------------------------------- */
/* Interaction feedback -- one consistent vocabulary                      */
/* ---------------------------------------------------------------------- */

.scard { transition: border-color 0.15s; }
.scard:hover { border-color: var(--ac); }
.scard-up { border-color: color-mix(in srgb, var(--gn) 55%, transparent); }
.scard-dn { border-color: color-mix(in srgb, var(--rd) 55%, transparent); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82em;
}

th, td {
  text-align: left;
  padding: 3px 6px;
  border-bottom: 1px solid var(--bd);
  white-space: nowrap;
}

th {
  color: var(--mu);
  font-weight: 600;
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  user-select: none;
}
th:hover { color: var(--tx); }
th.sort-active { color: var(--ac); }
th .sort-arrow { font-size: 0.8em; margin-left: 2px; }

tbody tr { cursor: default; transition: background 0.15s; }
tbody tr:hover { background: var(--bg3); }
tr.row-clickable { cursor: pointer; }
tr.sel { background: color-mix(in srgb, var(--ac) 12%, transparent); outline: 1px solid var(--ac); }

.table-scroll { overflow-x: auto; }

.pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78em;
  font-weight: 600;
}
.pill.win { background: color-mix(in srgb, var(--gn) 20%, transparent); color: var(--gn); }
.pill.loss { background: color-mix(in srgb, var(--rd) 20%, transparent); color: var(--rd); }
.pill.tie { background: color-mix(in srgb, var(--or) 20%, transparent); color: var(--or); }

.is-us { color: var(--ac); font-weight: 700; }

.corrected-badge {
  cursor: help;
  color: var(--ac);
  font-size: 0.75em;
  border-bottom: 1px dotted var(--ac);
}

/* ---------------------------------------------------------------------- */
/* Momentum badges -- the composite score's 3 visual bands                */
/* ---------------------------------------------------------------------- */

.mb {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.72em;
  font-weight: 700;
  white-space: nowrap;
}
.mb-hi { background: color-mix(in srgb, var(--gn) 18%, transparent); color: var(--gn); }
.mb-lo { background: color-mix(in srgb, var(--rd) 18%, transparent); color: var(--rd); }
.mb-md { background: var(--bg3); color: var(--mu); }

/* ---------------------------------------------------------------------- */
/* Bar charts (simple, all-positive) + diverging bar chart (+/-)          */
/* ---------------------------------------------------------------------- */

.bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 2.5rem;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85em;
  margin: 0.3rem 0;
}
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--bg3); border-radius: 6px; height: 10px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--ac); border-radius: 6px; }

.diverging-row {
  display: grid;
  grid-template-columns: 150px 1fr 3rem;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85em;
  margin: 0.3rem 0;
}
.diverging-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diverging-track { position: relative; height: 10px; background: var(--bg3); border-radius: 6px; }
.diverging-center { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--bd); }
.diverging-fill { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.diverging-fill.pos { left: 50%; background: var(--gn); }
.diverging-fill.neg { right: 50%; background: var(--rd); }

.heatmap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 0.4rem; }
.heatmap-cell { border-radius: 8px; padding: 0.5rem; text-align: center; background: var(--bg3); font-size: 0.8em; }

/* ---------------------------------------------------------------------- */
/* Games / box scores                                                     */
/* ---------------------------------------------------------------------- */

.game-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--bd);
  cursor: pointer;
}
.game-list-item:hover { color: var(--ac); }
.game-list-item:last-child { border-bottom: none; }

.box-score-goal {
  display: grid;
  grid-template-columns: 3rem 4rem 1fr;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--bd);
  font-size: 0.88em;
  align-items: start;
}

.correction-form {
  display: none;
  margin-top: 0.4rem;
  padding: 0.6rem;
  background: var(--bg3);
  border-radius: 8px;
  font-size: 0.85em;
}
.correction-form.open { display: block; }
.correction-form label { display: block; margin: 0.3rem 0 0.1rem; color: var(--mu); font-size: 0.75em; }
.correction-form input, .correction-form select, .correction-form textarea {
  display: block;
  box-sizing: border-box;
  width: 100%;
  padding: 0.35rem;
  border-radius: 6px;
  border: 1px solid var(--bd);
  background: var(--bg2);
  color: var(--tx);
  font-size: 0.85em;
}
.correction-form textarea { resize: vertical; }
.correction-form button {
  display: block;
  margin-top: 0.5rem;
  background: var(--ac);
  color: var(--ac-ink);
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}
.bench-sync-row {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0;
}
.bench-sync-row input {
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--bd);
  background: var(--bg3);
  color: var(--tx);
  font-family: monospace;
  font-size: 0.8em;
}
.copy-ics-btn {
  background: var(--ac);
  color: var(--ac-ink);
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

/* Chart.js wrappers -- explicit height, maintainAspectRatio:false relies on this */
.cw {
  position: relative;
  height: 180px;
}

.season-games summary {
  cursor: pointer;
  list-style-position: outside;
}
.season-games summary::marker { color: var(--mu); }
.season-games[open] summary { margin-bottom: 0.2rem; }
p.muted { color: var(--mu); margin: 0.3rem 0; }
p.muted.small { font-size: 0.8em; }
p.muted a { color: var(--ac); }

.suggest-fix-link {
  font-size: 0.75em;
  color: var(--ac);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.empty-state { color: var(--mu); font-style: italic; padding: 1rem 0; }

/* ---------------------------------------------------------------------- */
/* Page intros + metrics appendix                                         */
/* ---------------------------------------------------------------------- */

.page-intro {
  border-left: 3px solid var(--ac);
  background: var(--bg2);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.65rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.85em;
  line-height: 1.55;
  color: var(--mu);
}
.page-intro strong { color: var(--tx); font-weight: 600; }

.metric-row {
  display: grid;
  grid-template-columns: 6rem 1.15fr 1.15fr 1fr;
  gap: 0.8rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--bd);
  font-size: 0.85em;
  line-height: 1.45;
}
.metric-row:last-child { border-bottom: none; }
.metric-row .m-name { font-weight: 700; color: var(--tx); }
.metric-row .m-formula {
  color: var(--bl);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.94em;
}
.metric-row .ml { display: none; }

.metric-head {
  font-size: 0.68em;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--mu);
  font-weight: 700;
  border-bottom-color: var(--bd);
  margin-top: 0.4rem;
}

@media (max-width: 720px) {
  .metric-row { grid-template-columns: 1fr; gap: 0.1rem; padding: 0.75rem 0; }
  .metric-row .m-name { font-size: 1.05em; }
  .metric-row .ml {
    display: block;
    font-size: 0.68em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mu);
    font-weight: 700;
    margin-top: 0.35rem;
  }
  .metric-head { display: none; }
}

/* ---------------------------------------------------------------------- */
/* Calendar (true month grid: games + public rink events overlay)         */
/* ---------------------------------------------------------------------- */

.cal-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.cal-nav { display: flex; align-items: center; gap: 0.5rem; }
.cal-month-label { font-weight: 700; min-width: 8.5rem; text-align: center; }
.cal-nav-btn {
  background: var(--bg3);
  border: 1px solid var(--bd);
  color: var(--tx);
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  font-size: 0.82em;
  cursor: pointer;
}
.cal-nav-btn:hover { border-color: var(--ac); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-dow {
  text-align: center;
  font-size: 0.68em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--mu);
  padding-bottom: 0.3rem;
}
.cal-day {
  min-height: 4.6rem;
  background: var(--bg3);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.25rem;
  font-size: 0.76em;
}
.cal-day.other-month { background: none; }
.cal-day.today { border-color: var(--ac); }
.cal-daynum { color: var(--mu); font-size: 0.9em; margin-bottom: 0.15rem; }
.cal-day.today .cal-daynum { color: var(--ac); font-weight: 700; }

.cal-entry {
  display: block;
  border-radius: 4px;
  padding: 0.1rem 0.3rem;
  margin-bottom: 2px;
  font-size: 0.92em;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}
.cal-entry.game.win { background: color-mix(in srgb, var(--gn) 20%, transparent); color: var(--gn); }
.cal-entry.game.loss { background: color-mix(in srgb, var(--rd) 20%, transparent); color: var(--rd); }
.cal-entry.game.tie { background: color-mix(in srgb, var(--or) 20%, transparent); color: var(--or); }
.cal-entry.game.upcoming { background: color-mix(in srgb, var(--bl) 20%, transparent); color: var(--bl); }
.cal-entry.event {
  background: color-mix(in srgb, var(--pu) 18%, transparent);
  color: var(--pu);
  cursor: pointer;
}
.cal-entry.event:hover { background: color-mix(in srgb, var(--pu) 32%, transparent); }

@media (max-width: 640px) {
  .cal-day { min-height: 3.4rem; font-size: 0.68em; padding: 0.15rem; }
  .cal-dow { font-size: 0.6em; }
  .cal-month-label { min-width: 7rem; }
}

/* ---------------------------------------------------------------------- */
/* Scouting report                                                        */
/* ---------------------------------------------------------------------- */

.scout-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
}
.scout-header .opp-name { font-size: 1.3rem; font-weight: 800; }
.scout-header .meta { color: var(--mu); font-size: 0.86em; }

.keys-list { margin: 0; padding-left: 1.1rem; }
.keys-list li { margin-bottom: 0.4rem; font-size: 0.92em; }

.threat-row {
  display: grid;
  grid-template-columns: 1.6rem 1fr 4.5rem 4rem;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--bd);
  font-size: 0.88em;
}
.threat-row:last-child { border-bottom: none; }
.threat-row .rank { color: var(--mu); text-align: right; }

/* ---------------------------------------------------------------------- */
/* Tooltip system -- one delegated listener, works with any dynamic DOM   */
/* ---------------------------------------------------------------------- */

#gTip {
  position: fixed;
  background: var(--bg3);
  color: var(--tx);
  border: 1px solid var(--bd);
  border-radius: 7px;
  padding: 7px 11px;
  font-size: 0.76em;
  line-height: 1.55;
  max-width: 260px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
[data-tip] { cursor: help; }
th[data-tip] {
  text-decoration: underline dotted color-mix(in srgb, var(--mu) 60%, transparent);
  text-underline-offset: 3px;
}
th[data-tip]:hover { text-decoration-color: var(--ac); }

/* ---------------------------------------------------------------------- */
/* Players grid + Player Spotlight                                        */
/* ---------------------------------------------------------------------- */

.pgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.75rem;
}
.pcard {
  background: var(--bg3);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.pcard-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.pcard .name { font-weight: 700; font-size: 0.95em; }
.pcard .team { color: var(--mu); font-size: 0.76em; }
.pcard-stats { display: flex; justify-content: space-between; font-size: 0.82em; }
.rcard-link { cursor: pointer; }

/* Caliber badge: the tier's color is the badge's only variable (--tier), set inline per tier */
.cal-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78em;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid var(--tier, var(--bd));
  color: var(--tier, var(--mu));
  background: color-mix(in srgb, var(--tier, var(--mu)) 12%, transparent);
}
.cal-badge.cal-none { --tier: var(--mu); font-weight: 600; }
.cal-conf {
  font-size: 0.72em;
  font-weight: 800;
  opacity: 0.75;
  border-left: 1px solid color-mix(in srgb, var(--tier, var(--mu)) 45%, transparent);
  padding-left: 0.35rem;
  cursor: help;
}
.sp-grade .cal-badge { font-size: 1em; padding: 0.3rem 0.8rem; margin: 0.25rem 0; }

.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.35rem; }
.chip {
  font-size: 0.76em;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--bd);
  background: var(--bg3);
  white-space: nowrap;
}
.chip-us { border-color: var(--ac); color: var(--ac); font-weight: 600; }
.chip-mu { color: var(--mu); font-weight: 400; }

.bc { font-size: 0.82em; margin-bottom: 0.6rem; }
.bc a { color: var(--ac); text-decoration: none; font-weight: 600; }
.bc a:hover { text-decoration: underline; }
.sp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.sp-name { font-size: 1.35rem; font-weight: 800; line-height: 1.1; }
.sp-grade { text-align: right; }
.verdict { margin: 0.75rem 0 0; font-size: 0.92em; line-height: 1.45; }

.cw-tall { height: 240px; }
.legend { display: flex; gap: 0.75rem; flex-wrap: wrap; font-size: 0.74em; color: var(--mu); margin-bottom: 0.3rem; }
.legend-item { display: inline-flex; align-items: center; gap: 0.3rem; }
.legend-swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.tier-dot::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--tier, var(--mu));
  margin-right: 0.35rem;
  vertical-align: middle;
}
.pct { font-variant-numeric: tabular-nums; }
.pct-hi { color: var(--gn); font-weight: 600; }
.pct-lo { color: var(--rd); }
tr.row-hot td { background: color-mix(in srgb, var(--gn) 10%, transparent); }
tr.row-warm td { background: color-mix(in srgb, var(--gn) 4%, transparent); }

.plink { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--ac); }
.plink:hover { color: var(--ac); }
.muted { color: var(--mu); }
.small { font-size: 0.8em; }
.pcard-ours { border-left: 3px solid var(--ac); }
#player-search {
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--bd);
  background: var(--bg2);
  color: var(--tx);
  font-size: 0.86em;
  min-width: 160px;
}
.pcard .rank { color: var(--mu); font-weight: 600; font-size: 0.85em; }
.pos-chip {
  display: inline-block;
  font-size: 0.68em;
  font-weight: 800;
  padding: 0 0.4rem;
  border-radius: 4px;
  vertical-align: middle;
  letter-spacing: 0.05em;
  background: var(--bg2);
  border: 1px solid var(--bd);
  color: var(--mu);
}
.pos-chip.pos-D { color: var(--pu); border-color: color-mix(in srgb, var(--pu) 50%, transparent); }
.pos-chip.pos-F { color: var(--or); border-color: color-mix(in srgb, var(--or) 50%, transparent); }
#player-pos, #player-team { max-width: 220px; }
.tenure { color: var(--mu); font-size: 0.74em; line-height: 1.5; }
.tenure .mix-bar {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: var(--bd);
  overflow: hidden;
  margin-top: 0.2rem;
}
.tenure .mix-ours { display: block; height: 100%; background: var(--ac); border-radius: 2px; }
.sp-head .tenure { margin-top: 0.4rem; font-size: 0.82em; max-width: 420px; }
.vsus { font-size: 0.76em; color: var(--mu); margin-top: 0.1rem; }
.vsus-hot { color: var(--rd); }
.cb { display: grid; grid-template-columns: 1fr auto; gap: 0.15rem 1rem; font-size: 0.8em; margin-top: 0.6rem; max-width: 560px; }
.cb-row { display: contents; }
.cb-val { text-align: right; font-variant-numeric: tabular-nums; }
.period-row { display: grid; grid-template-columns: 70px 1fr 4.5rem; align-items: center; gap: 0.5rem; font-size: 0.85em; margin: 0.3rem 0; }
.period-bars { display: flex; flex-direction: column; gap: 3px; }
.period-bars .bar-track { height: 7px; }
.bar-fill.gf { background: var(--gn); }
.bar-fill.ga { background: var(--rd); }
.period-nums { font-variant-numeric: tabular-nums; text-align: right; color: var(--mu); }
.gf-n { color: var(--gn); font-weight: 600; }
.ga-n { color: var(--rd); font-weight: 600; }
.film-link { color: var(--ac); text-decoration: none; font-weight: 600; font-size: 0.85em; white-space: nowrap; }
.film-link:hover { text-decoration: underline; }
.goal-dots { margin-left: 0.35rem; white-space: nowrap; }
.goal-dot { text-decoration: none; font-size: 0.7em; margin-right: 1px; }
.goal-dot.ours { color: var(--gn); }
.goal-dot.theirs { color: var(--rd); }
.goal-dot:hover { text-decoration: none; filter: brightness(1.3); }
.onice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0.15rem 0.6rem; margin: 0.3rem 0; }
.onice-player { display: flex; align-items: center; gap: 0.35rem; font-size: 0.9em; cursor: pointer; margin: 0 !important; color: var(--tx) !important; }
.onice-player input { width: auto !important; margin: 0; }
.onice-player .num { color: var(--mu); font-variant-numeric: tabular-nums; min-width: 2.2rem; }
.onice-form .scope-toggle { margin: 0.2rem 0 0.4rem; }
.onice-summary { margin: 0.2rem 0; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.onice-tag { font-size: 0.74em; padding: 0.05rem 0.45rem; border-radius: 999px; background: var(--bg3); color: var(--mu); }
.onice-tag.plus { color: var(--gn); background: color-mix(in srgb, var(--gn) 12%, transparent); }
.onice-tag.minus { color: var(--rd); background: color-mix(in srgb, var(--rd) 12%, transparent); }
.onice-form .scope-toggle button { background: var(--bg2); color: var(--tx); margin: 0; padding: 0.3rem 0.8rem; border-radius: 0; font-weight: 500; }
.onice-form .scope-toggle button.active { background: var(--ac); color: var(--ac-ink); }
.onice-form { font-size: 0.95em; }
.film-approx, .goal-dot.approx { opacity: 0.6; }
.onice-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0.75rem; margin: 0.3rem 0; }
.onice-col { background: var(--bg2); border: 1px solid var(--bd); border-radius: 6px; padding: 0.4rem 0.6rem; }
.onice-head { display: flex; justify-content: space-between; font-weight: 600; font-size: 0.9em; margin-bottom: 0.2rem; }
.onice-form input[type="text"] { display: inline-block; width: 8rem; vertical-align: middle; }
.onice-form > div > button { display: inline-block; margin-top: 0; }

/* ---------------------------------------------------------------------- */
/* Brand (docs/design/DESIGN_SPEC.md): chrome face, jersey stripe.         */
/* jersey stripe. Brand red (--team) is chrome only, never a data color.   */
/* ---------------------------------------------------------------------- */
nav.tabs button, .card h2, .sec, .stat-tile .value, .kpi-card .value, .cal-badge {
  font-family: var(--font-display); font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.08em;
}
nav.tabs button { font-size: 0.82em; }
nav.tabs .q { text-transform: none; letter-spacing: 0; font-weight: 500; }
.topbar { border-bottom: 3px solid var(--team); }
.stat-tile, .kpi-card { border-left: 2px solid var(--ac); }
.stat-tile .value, .kpi-card .value { font-size: 1.5em; letter-spacing: 0.02em; }
tr.row-us td { background: color-mix(in srgb, var(--ac) 10%, transparent); font-weight: 600; }
tr.row-us td:first-child { border-left: 3px solid var(--team); }
.sp-head { background: var(--bg3); border-bottom: 3px solid var(--team); border-radius: 6px 6px 0 0; padding: 0.6rem 0.8rem; margin: 0 -0.2rem 0.6rem; }
.m-formula, .formula { font-family: var(--font-mono); }

/* Four-tab layout: tab sublabels, help button, standings, outlook, leaderboard, recaps. */
nav.tabs .q { display: block; font-size: 0.68em; font-weight: 500; opacity: 0.7; line-height: 1.1; }
nav.tabs .help-btn { margin-left: auto; align-self: center; width: 1.8rem; height: 1.8rem; border-radius: 50%; border: 1px solid var(--bd); background: var(--bg3); color: var(--mu); font-weight: 700; cursor: pointer; }
nav.tabs .help-btn:hover { color: var(--tx); border-color: var(--tx); }
.dots span { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 2px; }
.dots .w { background: var(--gn); } .dots .l { background: var(--rd); } .dots .o { background: var(--or); }
table.standings td:first-child { color: var(--mu); }
.cb-details { margin-top: 0.4rem; } .cb-details summary { cursor: pointer; }
dialog#help { border: 1px solid var(--bd); border-radius: var(--radius); background: var(--bg2); color: var(--tx); max-width: 980px; width: calc(100% - 32px); padding: 1rem 1.1rem; box-shadow: var(--shadow); max-height: 85vh; overflow: auto; }
dialog#help::backdrop { background: rgba(0, 0, 0, 0.4); }
dialog#help .help-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
dialog#help .card { box-shadow: none; }
#view-overview .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
table.outlook td:first-child { font-weight: 700; }
table.outlook tr.muted td { color: var(--mu); }
.rank-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.rank-list h3 { margin: 0.2rem 0 0.3rem; font-size: 0.8em; color: var(--mu); text-transform: uppercase; letter-spacing: 0.06em; }
.rank-ol { list-style: none; margin: 0; padding: 0; font-size: 0.88em; }
.rank-ol li { display: grid; grid-template-columns: 1.6rem 1fr auto; gap: 0.4rem; padding: 0.22rem 0; border-bottom: 1px solid color-mix(in srgb, var(--bd) 60%, transparent); align-items: baseline; }
.rank-ol .rank-n { color: var(--mu); font-variant-numeric: tabular-nums; }
.rank-ol .rank-v { font-weight: 700; font-variant-numeric: tabular-nums; }
.rank-line { display: flex; flex-wrap: wrap; gap: 0.35rem 0.6rem; margin: 0.4rem 0 0.2rem; font-size: 0.85em; }
.rank-chip { background: var(--bg3); border-radius: 999px; padding: 0.1rem 0.55rem; }
.recap { background: var(--bg3); border-left: 3px solid var(--team); border-radius: 6px; padding: 0.6rem 0.9rem; margin-bottom: 0.7rem; }
.recap-head { font-family: var(--font-display); font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.95em; margin-bottom: 0.3rem; }
.recap, .recap p, .recap div { white-space: normal; }
.recap p { margin: 0.3rem 0; max-width: 78ch; line-height: 1.5; }
.recap-mini { margin: 0.3rem 0 0.4rem; font-size: 0.92em; }
.recap-mini .recap-head { font-size: 0.85em; }
