:root { --bg:#fff; --fg:#1b1f24; --muted:#6a737d; --line:#e1e4e8; --accent:#0b5cad; --up:#1a7f37; --down:#cf222e; --bg2:#f6f8fa;
        --fill:#9cc3ea; --whisk:#9aa4ae; --sel:#eaf2fb; color-scheme: light; }
:root[data-theme=dark] { --bg:#0d1117; --fg:#e6edf3; --muted:#8b949e; --line:#30363d; --accent:#4493f8; --up:#3fb950; --down:#f85149;
        --bg2:#161b22; --fill:#1f4f82; --whisk:#6e7681; --sel:#1b2a3d; color-scheme: dark; }
* { box-sizing: border-box; }
html { background: var(--bg); }
body { font: 14px/1.4 system-ui, sans-serif; color: var(--fg); background: var(--bg); margin: 0 auto; max-width: 1100px; padding: 16px; }
header { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
h1 { font-size: 22px; margin: 0; display: flex; align-items: center; gap: 8px; } h1 img { height: 22px; width: auto; }
.sub { margin: 4px 0 10px; color: var(--muted); }
.meta { color: var(--muted); font-size: 12px; margin-left: auto; }
/* Buttons: one style everywhere (theme, share, close, tabs). */
.btn, .seg button, .seg a.tab, .close { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px;
  padding: 0 12px; font: inherit; font-weight: 500; color: var(--fg); background: var(--bg2); text-decoration: none;
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer; transition: background .12s; }
.btn:hover, .seg button:hover, .seg a.tab:hover, .close:hover { background: var(--line); }
.btn.icon { width: 30px; padding: 0; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.btn svg.moon { fill: currentColor; stroke: none; }
:root[data-theme=dark] #theme .moon { display: none; }
:root:not([data-theme=dark]) #theme .sun { display: none; }
#share, .push { margin-left: auto; align-self: center; }
h1 a.home { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 8px; }
#theme { align-self: center; }
nav { margin: 12px 0; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; }
.seg button, .seg a.tab { border-color: transparent; background: transparent; height: 26px; border-radius: 7px; color: var(--muted); }
.seg button:hover, .seg a.tab:hover { color: var(--fg); }
.seg button.on, .seg a.tab.on { background: var(--bg); color: var(--fg); border-color: var(--line); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { position: relative; flex: none; width: 32px; height: 18px; border-radius: 9px; background: var(--line); transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(14px); }
.btn:focus-visible, .seg button:focus-visible, .close:focus-visible, .switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
select, input { background: var(--bg); color: var(--fg); }
select, input[type=search] { height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; background: var(--bg); cursor: pointer; user-select: none; font-weight: 600; }
/* Sort arrow (sortArrow in app.js): a fixed slot on every sortable header, shown only on the sorted one. */
.sa { display: inline-block; width: 1em; margin-left: .15em; text-align: center; }
.sa.off { visibility: hidden; }
.sa.faint { opacity: .35; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
/* A number under a sortable header: right padding of the header's arrow slot (.sa: 1em + .15em). */
td.num.sn { padding-right: calc(8px + 1.15em); }
/* Team list: set column widths (COL_EM in app.js), Team takes the rest; so no column follows its rows. */
#view table.list { table-layout: fixed; }
/* Fixed line height: every team row is the same height (a ▲/▼ from a fallback font would make its
 * row taller), so the place holders for rows still being added (setView) are exact. The row line
 * is an inset shadow, not a border: with a real device scale factor (fractional desktop scaling,
 * browser zoom) the browser snaps a border to whole device pixels (1px = .8px at 1.25), which made
 * the row pitch 30.8px instead of 31 and the place holders (31px a row) wrong. Padding and line
 * height aren't snapped, so a row is exactly 5 + 20 + 6px. */
#view .list > thead th, #view .list > tbody > tr.team > td, #view .list > tbody > tr.detail > td { border: 0; box-shadow: inset 0 -1px 0 var(--line); }
#view .list > thead th, #view .list > tbody > tr.team > td { padding: 5px 5px 6px; }
#view .list > tbody > tr.team > td { line-height: 20px; }
/* Clipping costs layout time on every cell, so only where it can happen: long team names and the header controls. */
#view .list > thead th, #view .list > tbody > tr.team > td.tname { overflow: hidden; text-overflow: ellipsis; }
/* Place holder for the rows still being added (setView in app.js). A block, not a table row: as a
 * row it shares a collapsed border with its neighbours and the rows move half a pixel when it goes. */
tr.fill { display: block; }
tr.fill td { padding: 0; border: 0; }
/* Div and Conference cells: the label on the left, the team's rank in that group on the right. */
td.lr > span { float: right; font-variant-numeric: tabular-nums; }
tr.team { cursor: pointer; }
tr.team:hover { background: var(--bg2); }
tr.team.open td { background: var(--sel); font-weight: 600; }
#view .list > tbody > tr.team.open > td { box-shadow: none; }
.up { color: var(--up); } .down { color: var(--down); } .muted { color: var(--muted); }
tr.detail > td { background: var(--sel); white-space: normal; position: relative; padding: 4px 12px 12px; }
.dgrid { display: grid; grid-template-columns: max-content minmax(240px, 1fr); gap: 12px 32px; align-items: start; }
.dgrid > div:first-child { overflow-x: auto; }
.games { width: 100%; margin-top: 4px; }
.games th { position: static; background: none; cursor: default; color: var(--muted); font-weight: 600; font-size: 12px;
            border-bottom: 1px solid var(--line); }
.games td, .games th { padding: 3px 10px 3px 0; }
.games td { border: 0; }
.games td.actual { font-weight: 700; }
.games tr.sum td { border-top: 1px solid var(--line); }
.games tr.prevtoggle { cursor: pointer; }
.cdhead { display: flex; gap: 8px; margin: 4px 0 6px; padding-right: 36px; }
.games tr.cgroup { cursor: pointer; }
.games td.cpair, .games th.cpair { border-left: 1px solid var(--line); padding-left: 10px; }
.games th[colspan].cpair { text-align: center; }
.games th[data-csort] { cursor: pointer; }
.cscroll { overflow-x: auto; }
.games td.copp, .games th.copp { opacity: .75; font-size: .92em; }
a.tlink { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--muted); }
a.tlink:hover { color: var(--accent); border-bottom-color: var(--accent); }
/* Team logos (logo() in app.js), in front of team names: the theme's version shows and the
 * other is display: none, so (lazy) it never loads. The negative margins keep the line as tall
 * as its text, so a row stays ROW_PX. */
.lg { display: inline-block; width: 18px; height: 18px; margin: -2px 6px -2px 0; vertical-align: middle; object-fit: contain; }
:root[data-theme=dark] img.lg:not(.dk), :root:not([data-theme=dark]) img.lg.dk { display: none; }
.games tr.prevgame td { font-size: 13px; }
.games tr.seasonend td { border-bottom: 1px solid var(--line); }
.games td.cf span { opacity: .55; }
.dsim { padding-top: 4px; }
.simhead { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; margin: 0 40px 6px 0; }
.simhead .ttl, .simhead b { color: var(--muted); font-weight: 600; font-size: 12px; }
.simhead .ttl { flex-basis: 100%; padding: 3px 0; border-bottom: 1px solid var(--line); }
.simhead.guidehead { margin-top: 14px; margin-bottom: 0; }
.games.guide { width: calc(100% - 40px); }
.guidenone { font-size: 13px; margin: 6px 40px 0 0; }
.games.guide tr.guidewk td { color: var(--muted); font-size: 12px; font-weight: 600; padding-top: 8px; }
.games.guide td.guidenone { margin: 0; }
.plot { width: 100%; height: auto; display: block; }
.plot text { fill: var(--muted); font-size: 11px; }
.plot .grid { stroke: var(--line); stroke-width: 1; }
.plot .area { fill: var(--fill); stroke: var(--accent); stroke-width: 1; }
.plot .area.in { fill: var(--accent); fill-opacity: .75; }
.plot .hit { fill: transparent; }
.plot .cross line { stroke: var(--fg); stroke-opacity: .5; stroke-width: 1; }
.plot .cross circle { fill: var(--accent); stroke: var(--bg); stroke-width: 1.5; }
.plot .cross .tipbg { fill: var(--fg); }
.plot text.tip { fill: var(--bg); font-size: 11px; font-weight: 600; }
.bar { position: relative; height: 14px; width: 100%; min-width: 120px; background: var(--bg2); border-radius: 3px; }
.bar .whisk { position: absolute; top: 6px; height: 2px; background: var(--whisk); }
.bar .box { position: absolute; top: 1px; height: 12px; background: var(--fill); border: 1px solid var(--accent); border-radius: 2px; }
.bar .med { position: absolute; top: 0; height: 14px; width: 2px; background: var(--fg); }
.close { position: absolute; top: 6px; right: 8px; width: 30px; padding: 0; font-size: 18px; line-height: 1; }
th select { font: inherit; font-weight: 600; padding: 1px 2px; border: 1px solid var(--line); border-radius: 4px; field-sizing: content; }
/* Top N (1–99): two digits plus the spinner buttons. */
th input#topN { width: 3.2em; font: inherit; padding: 1px 2px; border: 1px solid var(--line); border-radius: 4px; }
/* Team list: the division and conference pickers fill their column, less the sort arrow's slot. */
#view .list th select { field-sizing: fixed; width: calc(100% - 1.3em); }
th input#qHead { width: 9em; font: inherit; font-weight: normal; padding: 1px 4px; border: 1px solid var(--line); border-radius: 4px; margin-left: 4px; }
/* State holders, and the headers' phone-only labels; on wide screens the Teams tab's pickers live in the table header. */
#conf, #q, #div, .narrow { display: none; }
@media (max-width: 1100px) { .dgrid { grid-template-columns: minmax(0, 1fr); padding-top: 28px; } }
.dwrap { position: relative; }
/* Phones: every column stays; the table scrolls sideways in its own box with the name column
   pinned, and an open detail stays screen-wide (its own tables scroll inside it). */
@media (max-width: 700px) {
  body[data-tab=teams] #div, body[data-tab=teams] #conf { display: inline-block; }
  /* ...so the Teams list's headers show their labels, not a second copy of each picker */
  body[data-tab=teams] #divHead, body[data-tab=teams] #confHead { display: none; }
  body[data-tab=teams] .narrow { display: inline; }
  .tscroll { overflow-x: auto; }
  .tscroll th.tname, .tscroll td.tname { position: sticky; left: 0; z-index: 1; background: var(--bg); box-shadow: inset -1px 0 0 var(--line), inset 0 -1px 0 var(--line); }
  .tscroll tr.team:hover td.tname { background: var(--bg2); }
  .tscroll tr.team.open td.tname { background: var(--sel); box-shadow: inset -1px 0 0 var(--line); }
  .dwrap { position: sticky; left: 0; width: calc(100vw - 56px); }
  .dwrap .cscroll, .dgrid > div:first-child { overflow-x: auto; }
  th input#qHead { width: 84px; }
  .cdhead { flex-wrap: wrap; }
}
.about { max-width: 720px; line-height: 1.55; font-size: 15px; }
.about h2 { margin: 8px 0 4px; } .about h3 { margin: 22px 0 6px; }
.about li { margin: 6px 0; } .about a { color: var(--accent); }
footer { margin-top: 24px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; } footer a { color: inherit; }
/* Row names are links (crawlable team and conference pages) that look like plain text. */
a.rlink, .list td.tname a { color: inherit; text-decoration: none; }
/* Loading skeleton: table-height rows until the data arrives. */
.skel i { display: block; height: 31px; border-bottom: 1px solid var(--line); position: relative; }
.skel i::before { content: ""; position: absolute; left: 8px; top: 10px; height: 11px; width: 55%; border-radius: 4px; background: var(--bg2);
  animation: skel 1.2s ease-in-out infinite alternate; }
.skel i:nth-child(3n+2)::before { width: 45%; } .skel i:nth-child(3n)::before { width: 62%; }
@keyframes skel { to { opacity: .45; } }
/* A pre-rendered view for another address hides while it streams in (shell.html .elsewhere). */
.boot, html.elsewhere #view[data-path] { display: none; }
html.elsewhere .boot { display: block; }
.notfound { margin: 24px 0; }
