/* League Hub: Saturday Broadcast Package.
   Cobalt shell and score columns, ink tabs, white panels on a cool grey-blue ground.
   Signal orange means a human coach and nothing else. Archivo on its width axis:
   condensed heavy caps for teams, numbers and navigation; normal width for reading. */
:root {
  --ground: #e9edf5;      /* page */
  --panel: #ffffff;       /* tables, cards, bugs */
  --sunk: #f1f4f9;        /* quiet fills, hover */
  --line: #d3d9e6;        /* hairline rules */
  --ink: #0e1526;         /* text, tabs, running head */
  --muted: #535e75;       /* secondary text (6.3:1 on white) */
  --cobalt: #0b2d8c;      /* the shell and the score column */
  --cobalt-2: #24409a;    /* a losing score cell */
  --on-cobalt: #ffffff;
  --on-cobalt-muted: #b9c7ef;
  --coach: #ff5a1f;       /* fills that mean "human coach" */
  --coach-ink: #c03d0b;   /* the same orange, deepened for text on white (5.1:1) */
  --coach-wash: #fff0e8;  /* a coach's row in a table */
  --win: #12703a;
  --loss: #b42318;
  --bar: #0b2d8c;
  --focus: #1d4ed8;
  /* Charts: blue and gold separate under every common colour-vision deficiency */
  --ch-up: #1d4ed8;       /* scored, gained */
  --ch-down: #c28f00;     /* allowed, lost */
  --ch-coach: #ff5a1f;    /* a coach team */
  --ch-other: #c3cad8;    /* every other team, recessive */
  /* One spacing scale */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;
  --text: "Archivo", "Segoe UI", system-ui, sans-serif;
  --cond: 75%;            /* font-stretch for broadcast caps */
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { scrollbar-color: #9aa6bf var(--ground); }
body {
  background: var(--ground);
  color: var(--ink);
  font: 400 15px/1.5 var(--text);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
::selection { background: #c7d4fa; color: var(--ink); }
a { color: var(--cobalt); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.masthead :focus-visible, .box-head :focus-visible { outline-color: #fff; }

/* Headings: broadcast caps */
h1, h2, h3 {
  font-family: var(--text); font-stretch: var(--cond); text-transform: uppercase;
  line-height: 1; margin: 0 0 var(--sp-3); letter-spacing: .005em; text-wrap: balance;
}
h1 { font-weight: 900; font-size: clamp(2.4rem, 7vw, 3.6rem); line-height: .92; }
h2 { font-weight: 800; font-size: 1.4rem; }
h3 { font-weight: 800; font-size: 1.1rem; }
.head-num { font-weight: inherit; }
code { font-size: .9em; background: var(--sunk); padding: 1px 5px; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ---------- Shell: cobalt header, white page strip, ink running head ---------- */
.masthead { background: var(--cobalt); color: var(--on-cobalt); }
.mast-row { display: flex; align-items: center; gap: var(--sp-4); padding-top: var(--sp-3); }
.wordmark { margin-right: auto; color: var(--on-cobalt); line-height: 1; min-width: 0; }
.wordmark:hover { text-decoration: none; }
#league-name {
  display: block; font-stretch: var(--cond); font-weight: 800; font-size: 1.6rem;
  text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#league-sub { display: block; margin-top: 4px; font-size: .72rem; font-weight: 500; letter-spacing: .08em; color: var(--on-cobalt-muted); text-transform: uppercase; }
.search-open {
  display: inline-flex; align-items: center; gap: var(--sp-2); font: inherit; font-size: .85rem; font-weight: 600;
  color: var(--on-cobalt); background: rgba(255, 255, 255, .12); border: 0; padding: 0 var(--sp-3);
  height: 38px; min-width: 38px; justify-content: center; cursor: pointer;
}
.search-open:hover { background: rgba(255, 255, 255, .22); }
.search-open kbd { font: inherit; font-size: .7rem; color: var(--on-cobalt-muted); border: 1px solid rgba(255, 255, 255, .3); padding: 0 5px; }

.tabs { display: flex; gap: var(--sp-5); overflow-x: auto; scrollbar-width: none; padding-top: var(--sp-3); }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  font-stretch: 80%; font-weight: 700; font-size: .95rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--on-cobalt-muted); padding: var(--sp-2) 0 10px; white-space: nowrap; border-bottom: 3px solid transparent;
}
.tabs a:hover { color: var(--on-cobalt); text-decoration: none; }
.tabs a.active { color: var(--on-cobalt); border-bottom-color: var(--on-cobalt); }

.subnav { background: var(--panel); border-bottom: 1px solid var(--line); }
.subnav .wrap { display: flex; gap: var(--sp-5); overflow-x: auto; scrollbar-width: none; }
.subnav .wrap::-webkit-scrollbar { display: none; }
.subnav a { color: var(--muted); font-weight: 600; font-size: .88rem; padding: 10px 0 8px; white-space: nowrap; border-bottom: 3px solid transparent; }
.subnav a:hover { color: var(--ink); text-decoration: none; }
.subnav a.active { color: var(--ink); border-bottom-color: var(--cobalt); }

/* The running head stays pinned and names what you're looking at */
.runhead { position: sticky; top: 0; z-index: 10; background: var(--ink); color: var(--on-cobalt); box-shadow: 0 2px 8px rgba(14, 21, 38, .18); }
.runhead .wrap {
  display: flex; justify-content: space-between; gap: var(--sp-4); padding-top: 7px; padding-bottom: 7px;
  font-stretch: 80%; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .09em;
}
.runhead span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#run-right { color: #aab4c8; }

/* ---------- Search ---------- */
dialog.search {
  width: min(560px, calc(100vw - 32px)); margin: 12vh auto auto; padding: 0; border: 0; border-top: 4px solid var(--cobalt);
  background: var(--panel); color: var(--ink); box-shadow: 0 24px 60px rgba(14, 21, 38, .35);
}
dialog.search::backdrop { background: rgba(14, 21, 38, .6); }
dialog.search input { width: 100%; max-width: none; border: 0; border-bottom: 1px solid var(--line); padding: 14px 16px; font-size: 1rem; outline: none; }
#search-results { list-style: none; margin: 0; padding: 6px; max-height: 55vh; overflow-y: auto; }
#search-results:empty { display: none; }
#search-results a { display: flex; justify-content: space-between; gap: 12px; padding: 9px 10px; color: var(--ink); }
#search-results a.on, #search-results a:hover { background: #e3e9f6; text-decoration: none; }
.sr-sub { color: var(--muted); font-weight: 500; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-coach { display: inline-block; width: 8px; height: 8px; background: var(--coach); margin-left: 7px; vertical-align: 1px; }
.sr-empty { color: var(--muted); padding: 10px; }

/* ---------- Home hero: the week's slate ---------- */
.hero { padding: var(--sp-5) 0 0; }
.hero-week { font-weight: 900; font-size: clamp(3.4rem, 13vw, 6rem); line-height: .85; margin: 0; text-box: trim-both cap alphabetic; }
.hero-week + .bugs, .hero-week + .empty { margin-top: var(--sp-5); }

/* ---------- The score bug ---------- */
.bugs, .games { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.bug { background: var(--panel); display: grid; min-width: 0; border: 1px solid var(--line); }
.bug-row { display: grid; grid-template-columns: 28px 36px minmax(0, 1fr) 68px; align-items: stretch; min-height: 52px; border-bottom: 1px solid var(--line); }
.bug-rk { align-self: center; text-align: center; font-stretch: var(--cond); font-weight: 700; font-size: .85rem; color: var(--muted); }
.bug-lg { align-self: center; display: grid; place-items: center start; }
.bug-logo { display: block; width: 26px; height: 26px; object-fit: contain; }
.bug-row.lost .bug-logo { opacity: .5; }
.bug-who { align-self: center; min-width: 0; padding: 6px var(--sp-2) 6px 0; }
.bug-team {
  display: block; font-stretch: var(--cond); font-weight: 800; font-size: 1.2rem; line-height: 1.05; text-transform: uppercase;
  color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bug-sc {
  display: grid; place-items: center; background: var(--cobalt); color: var(--on-cobalt);
  font-stretch: 70%; font-weight: 900; font-size: 2rem; line-height: 1;
}
.bug-row.lost .bug-team { color: var(--muted); }
.bug-row.lost .bug-sc { background: var(--cobalt-2); color: var(--on-cobalt-muted); }
.bug.next .bug-sc { color: var(--on-cobalt-muted); font-size: 1.4rem; font-weight: 700; }
.bug.quiet.next .bug-sc { color: var(--muted); }
.bug.quiet .bug-sc { background: #dde3ee; color: var(--ink); }
.bug.quiet .bug-row.lost .bug-sc { background: var(--sunk); color: var(--muted); }
.bug-tab {
  display: flex; justify-content: space-between; gap: var(--sp-3); background: var(--ink); color: #aab4c8;
  padding: 5px 10px; font-stretch: 80%; font-weight: 700; font-size: .74rem; letter-spacing: .09em; text-transform: uppercase;
}
.bug-tab > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bug-final { color: var(--on-cobalt); }
.bug-tab a { color: var(--on-cobalt); text-decoration: underline; text-underline-offset: 2px; }
.bug-tab a:focus-visible { outline-color: #fff; }

/* Record under a coach team in a score bug */
.plate { display: block; margin-top: 3px; font-size: .78rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate b { color: var(--muted); font-weight: 500; }

/* The wipe-in: bugs arrive the way a score bug comes on screen */
@media (prefers-reduced-motion: no-preference) {
  .hero .bug { animation: bug-in 560ms cubic-bezier(.16, 1, .3, 1) both; }
  .hero .bug:nth-child(2) { animation-delay: 70ms; }
  .hero .bug:nth-child(3) { animation-delay: 140ms; }
  .hero .bug:nth-child(4) { animation-delay: 210ms; }
  .hero .bug:nth-child(n+5) { animation-delay: 280ms; }
  @keyframes bug-in { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
}

/* ---------- Page structure ---------- */
#app { padding-top: var(--sp-6); padding-bottom: var(--sp-7); min-height: 60vh; }
.site-footer { color: var(--muted); font-size: .8rem; padding-bottom: var(--sp-6); }
#app > * { margin-top: 0; margin-bottom: var(--sp-5); }
#app > :last-child { margin-bottom: 0; }
#app > .controls, #app > .crumb { margin-bottom: var(--sp-4); }
#app > h2 { margin: var(--sp-6) 0 var(--sp-3); }
.page-head { display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-5); align-items: end; justify-content: space-between; }
#app > .page-head { margin-bottom: var(--sp-6); }
.page-head h1 { margin: 0; text-box: trim-both cap alphabetic; }
.page-head .controls { margin-bottom: 0; }
.grid { display: grid; gap: var(--sp-4); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid.align-start { align-items: start; }
.section { margin-bottom: var(--sp-5); }
.card { background: var(--panel); border: 1px solid var(--line); padding: var(--sp-4); min-width: 0; }
.card > h2, .card > h3 { margin-bottom: var(--sp-3); }
.card > h2 > .card-sub, .card > h3 > .card-sub { float: right; margin: .2em 0 0 var(--sp-3); }
.card > :last-child { margin-bottom: 0; }
.card-sub { font-stretch: 100%; font-weight: 600; font-size: .8rem; color: var(--muted); letter-spacing: 0; text-transform: none; }
a.card-sub { color: var(--cobalt); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.empty { color: var(--muted); padding: var(--sp-2) 0; margin: 0; }
.crumb { color: var(--muted); font-size: .85rem; margin: 0 0 var(--sp-4); }

/* ---------- Controls ---------- */
.controls { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin-bottom: var(--sp-4); }
select, input[type="search"], input[type="text"] {
  font: inherit; font-size: .9rem; color: var(--ink); background: var(--panel);
  border: 1px solid #b7c0d3; border-radius: 0; padding: 8px 10px; min-height: 38px; min-width: 0;
}
select:hover, input[type="search"]:hover, input[type="text"]:hover { border-color: var(--muted); }
input::placeholder { color: #6b7590; }
input[type="search"] { width: 230px; max-width: 100%; }
input[type="checkbox"] { accent-color: var(--cobalt); width: 16px; height: 16px; }
label.check { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: .9rem; min-height: 38px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 0; border: 1px solid #b7c0d3; background: var(--panel); }
.seg button + button { border-left: 1px solid #b7c0d3; }
.seg button, .btn {
  font: inherit; font-stretch: 85%; font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); background: transparent; border: 0; padding: 0 12px; min-height: 36px; cursor: pointer;
}
.btn { border: 1px solid #b7c0d3; background: var(--panel); }
.seg button:hover, .btn:hover:not(:disabled) { color: var(--ink); background: var(--sunk); }
.seg button.on { background: var(--cobalt); color: var(--on-cobalt); }
/* Each .seg carries a dropdown twin; on a phone, rows that would wrap show the dropdown (fitSegs in app.js) */
.seg-wrap { display: inline-flex; max-width: 100%; }
.seg-select { display: none; }
.seg-wrap.as-select .seg { display: none; }
.seg-wrap.as-select .seg-select { display: block; max-width: 100%; min-width: 12em; }
.btn:disabled { opacity: .45; cursor: default; }

/* ---------- Tables: full density, tabular numerals ---------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { padding: 7px 8px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { padding-left: 0; }
th {
  font-stretch: 80%; font-size: .74rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); border-bottom: 2px solid var(--ink);
}
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover, th.sorted { color: var(--ink); }
/* Sort caret: drawn, not a glyph. Every sortable header keeps an invisible caret, so sorting
   never changes a column's width. Number columns put it before the label, so the label stays
   right-aligned with the numbers under it. */
th.sortable::after {
  content: ""; display: inline-block; margin-left: 5px; vertical-align: 2px;
  border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid transparent;
}
th.sortable.num::after { content: none; }
th.sortable.num::before {
  content: ""; display: inline-block; margin-right: 5px; vertical-align: 2px;
  border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid transparent;
}
th.sorted::after, th.sorted.num::before { border-top-color: currentColor; }
th.sorted.asc::after, th.sorted.asc.num::before { border-top: 0; border-bottom: 5px solid currentColor; }
td.num, th.num { text-align: right; }
/* Rank (#) columns: the same width and margins in every table, sorted or not */
th.rk-col, td.rk-col { width: 2.2em; padding-left: 8px; padding-right: 8px; text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
/* Paged tables: an invisible row that holds each column at its widest (see tableInner) */
tr.sizer td { padding-top: 0; padding-bottom: 0; border: 0; }
tr.sizer div { height: 0; overflow: hidden; visibility: hidden; }
tbody tr.sizer:hover { background: none; }
tbody tr:hover { background: var(--sunk); }
tr.user-row { background: var(--coach-wash); }
tr.user-row:hover { background: #ffe6d8; }
.pager { display: flex; gap: var(--sp-2); align-items: center; justify-content: flex-end; margin-top: var(--sp-3); color: var(--muted); font-size: .85rem; }

/* ---------- Small parts ---------- */
.rk { display: inline-block; min-width: 1.6em; font-stretch: var(--cond); font-weight: 700; color: var(--muted); }
.team { font-weight: 600; }
/* A human coach's team: the team name itself goes orange (no gamertag beside it) */
.team.user, .bug-team.user { color: var(--coach-ink); }
.bug-row.lost .bug-team.user { color: var(--coach-ink); }
.tag {
  display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 6px;
  background: var(--sunk); color: var(--muted); vertical-align: 1px;
}
/* A coach's tag in a table: an orange square, then the gamertag in deep orange */
.tag.user { background: transparent; color: var(--coach-ink); padding: 0 0 0 2px; font-size: .78rem; }
.tag.user::before { content: ""; display: inline-block; width: 7px; height: 7px; background: var(--coach); margin-right: 5px; vertical-align: 1px; }
.tag.gold { background: transparent; border: 1px solid var(--ink); color: var(--ink); padding: 0 5px; }
a.coach-link { color: var(--coach-ink); font-weight: 700; }
.cell-sub { display: block; margin-top: 2px; font-size: .78rem; font-weight: 500; color: var(--muted); }
.cell-sub a { font-weight: 500; }
/* Home's coaches table: two-line cells that wrap, so it fits a phone */
[data-table="home-coaches"] td { white-space: normal; vertical-align: top; }
[data-table="home-coaches"] td:first-child { min-width: 8em; }
.opp-inline { font-size: .78rem; color: var(--muted); white-space: nowrap; }
/* Columns marked .wide show above the phone breakpoint; .phone lines show only on phones */
.cell-sub.phone { display: none; }
@media (max-width: 600px) {
  th.wide, td.wide { display: none; }
  [data-table="home-top25"] td { white-space: normal; }
  .cell-sub.phone { display: block; }
}
.w { color: var(--win); font-weight: 700; }
.l { color: var(--loss); font-weight: 700; }
.stars { color: #c28f00; letter-spacing: 1px; }

/* Rows that reuse the old game-row layout (team history lists) */
.game-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.game-row:last-child { border-bottom: 0; }
.game-row .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Stat tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0; border: 1px solid var(--line); background: var(--panel); }
.tile { padding: 12px 16px; border-right: 1px solid var(--line); }
.tile:last-child { border-right: 0; }
.tile .k { color: var(--muted); font-stretch: 85%; font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.tile .v { font-stretch: 70%; font-weight: 900; font-size: 2.2rem; line-height: 1.05; }
.tile .s { color: var(--muted); font-size: .78rem; }
.card .tiles { border: 0; }
.card .tile { padding-left: 0; }

/* ---------- Position group bars ---------- */
.pg { display: grid; grid-template-columns: 36px 1fr 34px 44px; gap: 10px; align-items: center; padding: 4px 0; }
.pg .g { font-stretch: 85%; font-weight: 800; font-size: .85rem; text-transform: uppercase; }
.pg .track, .pg .fill { display: block; }
.pg .track { height: 10px; background: var(--sunk); overflow: hidden; }
.pg .fill { height: 100%; background: var(--bar); }
.pg .v { text-align: right; font-stretch: 70%; font-weight: 900; font-size: 1.3rem; }
.pg .r { color: var(--muted); font-size: .78rem; text-align: right; }

/* ---------- Team page ---------- */
.team-head { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); align-items: end; justify-content: space-between; }
.team-head h1 { margin: 0; }
.team-logo { width: 72px; height: 72px; object-fit: contain; align-self: center; flex: none; }
.team-id { flex: 1 1 240px; min-width: 0; }
@media (max-width: 600px) { .team-logo { width: 48px; height: 48px; } }
.team-head .sub { color: var(--muted); margin-top: var(--sp-2); }
.team-head .big { font-stretch: 70%; font-weight: 900; font-size: clamp(3rem, 8vw, 4.5rem); line-height: .85; }
.team-head .big small { font-stretch: 100%; font-weight: 500; font-size: .85rem; color: var(--muted); margin-left: 6px; }

/* ---------- Teams index ---------- */
.team-list { columns: 3 230px; column-gap: 28px; }
.conf-block { break-inside: avoid; margin-bottom: 20px; }
.conf-block h3 { border-bottom: 2px solid var(--ink); padding-bottom: 6px; margin-bottom: 0; }
.conf-block a { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; color: var(--ink); font-weight: 500; border-bottom: 1px solid var(--line); }
.conf-block a span:last-child { color: var(--muted); }

/* ---------- Leader lists ---------- */
.leader-list { list-style: none; margin: 0; padding: 0; }
.leader-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.leader-list li:last-child { border-bottom: 0; }
.leader-list .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leader-list .v { font-stretch: 70%; font-weight: 900; font-size: 1.45rem; line-height: 1; }
.stat-line { white-space: pre-line; color: var(--muted); font-size: .82rem; }

/* ---------- Box score and rivalry header: the full-size bug ---------- */
.card.box-head {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; text-align: center; gap: var(--sp-3);
  background: var(--cobalt); color: var(--on-cobalt); border: 0; padding: var(--sp-5) var(--sp-4);
}
.box-team a { color: var(--on-cobalt); font-stretch: var(--cond); font-weight: 800; font-size: 1.15rem; text-transform: uppercase; }
.box-team a.team.user { color: var(--coach); } /* bright orange: deep orange is too dark on cobalt */
.box-team .rk { color: var(--on-cobalt-muted); }
.box-team .muted { color: var(--on-cobalt-muted); }
.box-team .muted a { font-stretch: 100%; font-size: .82rem; font-weight: 600; text-transform: none; }
.box-team .box-score { font-stretch: 65%; font-weight: 900; font-size: clamp(3.6rem, 12vw, 6rem); line-height: .9; }
.box-team.lost .box-score { color: var(--on-cobalt-muted); }
.box-at {
  background: var(--ink); color: var(--on-cobalt); padding: 4px 10px;
  font-stretch: 80%; font-weight: 700; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase;
}

/* ---------- Charts ---------- */
.chart-box { width: 100%; min-height: 120px; }
.chart { display: block; overflow: visible; font-family: var(--text); }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-zero { stroke: var(--muted); stroke-width: 1; }
.ch-avg { stroke: var(--muted); stroke-width: 1; opacity: .45; }
.ch-tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.ch-axis { fill: var(--muted); font-size: 12px; font-weight: 600; }
.ch-note { fill: var(--muted); font-size: 11px; }
.ch-label, .ch-cat { fill: var(--ink); font-size: 11px; font-weight: 600; }
.ch-cat { font-weight: 500; font-size: 12px; }
.ch-val { fill: var(--ink); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ch-dot-base { fill: var(--ch-other); stroke: var(--panel); stroke-width: 1; }
.ch-dot-hl { fill: var(--ch-coach); stroke: var(--panel); stroke-width: 2; }
/* Team logos as chart marks: others faded so coach teams lead; coach teams sit on a white disc ringed in coach orange */
.ch-logo-base { opacity: .55; }
.ch-logo-ring { fill: var(--panel); stroke: var(--ch-coach); stroke-width: 2.5; }
.ch-bar-pos { fill: var(--ch-up); }
.ch-bar-neg { fill: var(--ch-down); }
.ch-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-line.s-for { stroke: var(--ch-up); }
.ch-line.s-against { stroke: var(--ch-down); }
.ch-pt { stroke: var(--panel); stroke-width: 2; }
.ch-pt.s-for { fill: var(--ch-up); }
.ch-pt.s-against { fill: var(--ch-down); }
.ch-hit { fill: transparent; }
.ch-pop { pointer-events: none; }
.ch-pop circle { fill: var(--panel); stroke: var(--line); stroke-width: 2; }
.ch-pop.hl circle { stroke: var(--ch-coach); stroke-width: 2.5; }
.ch-hit.link { cursor: pointer; }
.ch-hit:hover { fill: var(--ink); fill-opacity: .06; }
.ch-hit[data-pop]:hover { fill: transparent; }
.ch-hit:focus-visible { outline: none; fill: var(--focus); fill-opacity: .18; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 14px; height: 4px; }
.sw-for { background: var(--ch-up); }
.sw-against { background: var(--ch-down); }
.tip {
  position: fixed; z-index: 50; pointer-events: none; max-width: 280px; white-space: pre-line;
  background: var(--ink); color: #fff; font-size: .8rem; line-height: 1.4; padding: 6px 9px;
}
.tip::first-line { font-weight: 700; }

/* ---------- Coaches and rivals ---------- */
.name-list { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; }
details.how summary { cursor: pointer; font-weight: 600; }
details.how p { max-width: 70ch; color: var(--muted); }
details.how p b { color: var(--ink); }

@media (max-width: 600px) {
  :root { --sp-5: 16px; --sp-6: 24px; --sp-7: 32px; }
  .search-open .search-label, .search-open kbd { display: none; }
  .search-open { padding: 0; width: 40px; height: 40px; }
  /* All five sections fit at 375px */
  .tabs { gap: 0; justify-content: space-between; }
  .tabs a { font-size: .86rem; font-stretch: 70%; letter-spacing: .03em; }
  .subnav .wrap { gap: var(--sp-4); }
  input[type="search"] { width: 100%; }
  .tile { border-right: 0; border-bottom: 1px solid var(--line); }
  .card.box-head { padding: var(--sp-4) var(--sp-2); }
  .card { padding: var(--sp-3); }
}

.rc-more { margin: 10px 0 4px; }

/* Philosophy tags: identity filled ink, traits outlined */
.ptag { display: inline-block; border: 1px solid #b7c0d3; color: var(--ink); font-stretch: 80%; font-weight: 700; font-size: .72rem;
  letter-spacing: .05em; text-transform: uppercase; padding: 2px 6px; line-height: 1.3; white-space: nowrap; margin: 2px 0; }
.ptag.id { background: var(--ink); border-color: var(--ink); color: #fff; }
.ptag.lead { border-color: var(--coach-ink); color: var(--coach-ink); background: var(--coach-wash); }
.ptag.id.lead { background: var(--coach-ink); border-color: var(--coach-ink); color: #fff; }
.ptag { cursor: help; -webkit-tap-highlight-color: transparent; }
.ptag:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 1px; }
.philo h3 { margin: 0 0 6px; }
.philo-chips { margin-bottom: 8px; }
.philo-why { list-style: none; margin: 0; padding: 0; font-size: .85rem; color: var(--muted); }
.philo-why li { padding: 3px 0; border-top: 1px solid var(--line); }
.philo-why b { color: var(--ink); font-weight: 600; margin-right: 4px; }
td.philo-cell { white-space: normal; min-width: 11em; }

/* Philosophies on a phone: team name on its own line, offense and defense side by side under it */
@media (max-width: 640px) {
  [data-table="adv-philo"] table, [data-table="adv-philo"] thead, [data-table="adv-philo"] tbody { display: block; width: 100%; }
  [data-table="adv-philo"] tr { display: grid; grid-template-columns: 1fr 1fr; column-gap: 10px; }
  [data-table="adv-philo"] th:first-child, [data-table="adv-philo"] td:first-child { grid-column: 1 / -1; }
  [data-table="adv-philo"] td { border-bottom: 0; }
  [data-table="adv-philo"] tbody tr { border-bottom: 1px solid var(--line); }
  [data-table="adv-philo"] tbody tr:last-child { border-bottom: 0; }
  [data-table="adv-philo"] th:first-child { border-bottom: 0; padding-bottom: 0; }
  [data-table="adv-philo"] td:first-child { padding-bottom: 2px; }
  [data-table="adv-philo"] td.philo-cell { min-width: 0; padding-top: 4px; }
  [data-table="adv-philo"] td.philo-cell:empty { display: none; }
  [data-table="adv-philo"] .ptag { margin-bottom: 4px; }
}

/* "New data is available" bar, pinned to the bottom of the screen */
.refresh-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 50;
  display: flex; align-items: center; gap: var(--sp-3); max-width: calc(100% - 32px);
  background: var(--ink); color: #fff; padding: 8px 8px 8px 16px; font-weight: 600; font-size: .9rem;
  box-shadow: 0 6px 20px rgba(14, 21, 38, .25);
}
.refresh-bar span { white-space: nowrap; }
.refresh-bar .btn { background: var(--coach); color: #fff; border: 0; white-space: nowrap; }
