/* Layout and components for both pages. Colors and sizes come from tokens.css; do not add raw values here. */

/* Inter, self-hosted (no request to another site). One variable font file per character range covers every weight.
   font-display: swap shows text at once in the system font and swaps when Inter arrives. */
@font-face {
  font-family: Inter; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(../fonts/inter-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Inter; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(../fonts/inter-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

* { box-sizing: border-box; }
html { color-scheme: dark; overflow-y: scroll; }   /* always reserve the page scrollbar, so the table's measured width never changes when the page grows */
html[data-theme="light"] { color-scheme: light; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: var(--fs-body)/1.4 var(--font); }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a { color: var(--accent); }

/* ---------- header ---------- */
/* Hardwood: faint plank seams run across the header, and on wide screens a half-court drawing sits behind it. */
.top { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 10px var(--gutter); border-bottom: var(--header-rule) solid var(--line);
  background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--accent) var(--seam-strength), transparent) 0 1px, transparent 1px var(--seam-gap)); }
.top > *:not(.deco) { position: relative; z-index: 1; }
.deco { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.deco svg { position: absolute; left: var(--deco-left); top: 0; height: 100%; width: auto; }
.deco path, .deco rect, .deco line { fill: none; stroke: var(--accent); stroke-width: var(--deco-stroke); opacity: var(--deco-strength); vector-effect: non-scaling-stroke; }
.wordmark { font-size: var(--fs-wordmark); font-weight: var(--wordmark-weight); letter-spacing: var(--wordmark-tracking); text-transform: uppercase; color: var(--text); text-decoration: none; }
.wordmark b { color: var(--accent); font-weight: inherit; }
.top nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-left: auto; }
.top nav a { color: var(--text2); text-decoration: none; }
.top nav a:hover, .top nav a[aria-current] { color: var(--text); }
.btn { flex: none; background: var(--panel); border: 1px solid var(--ctl); border-radius: var(--radius); padding: 0 10px; height: var(--control-height); cursor: pointer; color: var(--text); white-space: nowrap; }
.btn:hover { border-color: var(--text2); }
.btn:disabled { background: none; border: 1px dashed var(--line); color: var(--text3); cursor: not-allowed; }   /* faded, but the label keeps 4.5:1 */
.btn.is-on { border-color: var(--accent); color: var(--accent); }
.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; }

/* ---------- tab bar (desktop row; phone dropdown) ---------- */
.tabbar { display: flex; align-items: stretch; border-bottom: 1px solid var(--ctl); padding: 0 var(--gutter); }
.tabsel { display: none; flex: 1; min-width: 0; flex-direction: row; align-items: center; gap: 8px; padding: 8px 0; font-size: var(--fs-note); }
.tabsel select { flex: 1; min-width: 0; height: var(--phone-control-height); padding: 2px 8px; font-size: var(--fs-phone-control); font-weight: 600; background: var(--panel); border: 1px solid var(--accent); border-radius: var(--radius); color: var(--text); }
.filters-btn { display: none; align-self: center; flex: none; height: var(--phone-control-height); margin-left: 8px; padding: 0 12px; background: var(--panel); border: 1px solid var(--ctl); border-radius: var(--radius); color: var(--text); font-size: var(--fs-phone-control); font-weight: 600; cursor: pointer; white-space: nowrap; }
.filters-btn.is-set { border-color: var(--accent); color: var(--accent); }
#tabs { display: flex; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: thin; gap: 2px; }
/* The active tab gets a short thick lane marker along its top edge. */
.tab { flex: none; background: none; border: 0; color: var(--text2); padding: 10px 10px 9px; font-weight: var(--tab-weight); cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); font-weight: var(--tab-active-weight); box-shadow: inset 0 var(--tab-marker) 0 var(--accent); }
.tab.is-empty { color: var(--text3); }
.tab-flag { font-size: var(--fs-label); }

/* ---------- toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; padding: 10px var(--gutter) 6px; }
.fld { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-label); color: var(--text2); }
.fld input, .fld select { height: var(--control-height); min-width: 0; padding: 2px 6px; background: var(--panel); border: 1px solid var(--ctl); border-radius: var(--radius-small); color: var(--text); }
.fld.is-set input, .fld.is-set select { border-color: var(--accent); }
.fld.is-set > span { color: var(--accent); }
#f-q { width: 92px; } #f-pos { width: 68px; } #f-team { width: 78px; } #season { width: 92px; }
#f-mp, #f-gp { width: 68px; }
.pair { display: flex; align-items: center; gap: 3px; }
.pair input { width: 54px; }
.seg { display: inline-flex; border: 1px solid var(--ctl); border-radius: var(--radius); overflow: hidden; }
.seg button { height: 26px; padding: 0 10px; white-space: nowrap; background: var(--panel); border: 0; color: var(--text2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent-fill); color: var(--ink); font-weight: 700; }

/* Rank / Percentile switch: sits directly left of the Columns button, at the right end of the toolbar. */
.right-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin-left: auto; }   /* on a narrow screen the group wraps as whole controls; no label ever leaves its button */

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px var(--gutter) 4px; }
.chips:empty { display: none; }
.chip { min-height: 24px; max-width: 100%; padding: 2px 9px; white-space: normal; text-align: left; border: 1px solid var(--accent); border-radius: 14px; background: none; color: var(--accent); cursor: pointer; font-size: var(--fs-note); }
.chip:hover { background: var(--hover); }

.picker-wrap { position: relative; }
#picker { position: absolute; z-index: 30; right: 0; top: calc(100% + 4px); width: var(--picker-width); max-height: 60vh; overflow: auto; padding: 10px; background: var(--panel); border: 1px solid var(--ctl); border-radius: 8px; box-shadow: var(--shadow); }
.pk-actions { display: flex; gap: 6px; margin-bottom: 8px; }
.pk-actions button { height: 24px; padding: 0 8px; background: none; border: 1px solid var(--ctl); border-radius: var(--radius-small); cursor: pointer; color: var(--text2); }
.pk-group { margin: 8px 0 2px; font-size: var(--fs-label); font-weight: 600; color: var(--accent); }
.pk-gap { height: 8px; }   /* separates the player-info columns from the tab's own columns */
.pk-item { display: flex; align-items: center; gap: 6px; padding: 2px 0; color: var(--text); }
.pk-item.is-off { color: var(--text3); }
.pk-item em { font-style: normal; font-size: var(--fs-label); color: var(--text3); }
.pk-src { font-size: var(--fs-rank); font-weight: 700; color: var(--accent); }

.notice { margin: 4px var(--gutter); padding: 6px 10px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 4px; color: var(--text2); font-size: var(--fs-note); }
.notice b { color: var(--text); }
.meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 4px var(--gutter); color: var(--text2); font-size: var(--fs-note); }
.meta b { color: var(--text); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.muted { color: var(--text3); }

/* ---------- table ---------- */
/* Fixed layout: main.js measures every column (widest value + rank, or longest header word) and writes the widths,
   so the default columns of every tab fit a 1366px laptop. If chosen columns cannot fit, the table scrolls sideways. */
.table-wrap { margin: 0 var(--gutter); overflow: auto; scrollbar-gutter: stable; max-height: var(--table-max-height); min-height: 200px; background: var(--row); border: 1px solid var(--line); border-radius: var(--table-radius); }
table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: var(--fs-value); font-variant-numeric: tabular-nums; }
th, td { padding: var(--cell-pad-y) var(--cell-pad-x); background: var(--row); border-bottom: 1px solid var(--line); }
thead th { position: sticky; top: 0; z-index: 3; background: var(--panel); padding: var(--head-pad-y) var(--cell-pad-x) 3px; font-size: var(--fs-head); font-weight: var(--head-weight); line-height: 1.2; color: var(--text2); text-align: right; vertical-align: bottom; border-bottom: 1px solid var(--ctl); }
table.has-group thead tr:nth-child(2) th { top: var(--group-row-height); }
thead th.group { height: var(--group-row-height); padding: 0 6px; text-align: left; color: var(--accent); font-size: var(--fs-label); letter-spacing: .02em; border-bottom: 1px solid var(--accent); border-left: 1px solid var(--line); }
thead th.group-blank { height: var(--group-row-height); padding: 0; border-bottom: 0; }
.th-in { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: flex-end; column-gap: var(--info-gap); max-width: 100%; text-align: right; }   /* the "i" button sits beside the name when both fit on a line, else it wraps below the name; the name itself wraps at its break points */
.sort { flex: 0 1 auto; min-width: 0; background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: right; cursor: pointer; }
.sort:hover { color: var(--text); }
th[aria-sort="ascending"], th[aria-sort="descending"] { color: var(--text); box-shadow: var(--sorted-edge); }
/* The sort marker is a small triangle in the sorted header's top edge (up = ascending, down = descending). It is absolutely
   positioned, so it takes no width or height: sorting never changes a header's geometry. */
th[aria-sort="ascending"]::before, th[aria-sort="descending"]::before { content: ""; position: absolute; top: 0; right: var(--sort-marker-right); width: var(--sort-marker-width); height: var(--sort-marker-height); background: var(--accent); }
th[aria-sort="ascending"]::before { clip-path: polygon(50% 0, 0 100%, 100% 100%); }
th[aria-sort="descending"]::before { clip-path: polygon(0 0, 100% 0, 50% 100%); }
.info { flex: none; width: var(--info-size); height: var(--info-size); padding: 0; border: 1px solid var(--text3); border-radius: 50%; background: none; color: var(--text3); font-size: var(--fs-info-glyph); line-height: 9px; cursor: pointer; }
.info:hover, .info[aria-expanded="true"] { color: var(--text); border-color: var(--text); }
.credit-tag { display: block; margin-top: 1px; font-size: var(--fs-rank); font-weight: 700; letter-spacing: .05em; color: var(--accent); text-align: right; }
th.txt, td.txt { text-align: center; }
th.txt .th-in { justify-content: center; text-align: center; }
td.num { text-align: right; white-space: nowrap; }
.player { position: sticky; left: 0; z-index: 2; text-align: left !important; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: var(--player-pad-left); border-right: 1px solid var(--line); }
thead th.player { z-index: 5; }

/* Compare checkbox: a real (visually transparent) input over a drawn square, so it is keyboard and screen-reader accessible.
   The label's ::after widens the tap area. Every visible row's square is drawn while the pointer is anywhere over the Player column (header or any cell), and a row's own square while the
   box has keyboard focus (:focus-visible, so a mouse click leaves nothing drawn), or while the player is ticked; then the name gives up the padding it needs (inside the same column
   width, so no column moves) and a long name ends in an ellipsis. Touch screens have no hover: there it is always drawn. */
.pick { position: absolute; left: var(--pick-left); top: 50%; width: var(--pick-size); height: var(--pick-size); margin-top: calc(var(--pick-size) / -2); cursor: pointer; }
.pick::after { content: ""; position: absolute; inset: var(--pick-hit); }
.pick-input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pick-box { position: relative; display: block; width: 100%; height: 100%; opacity: 0; background: var(--panel); border: 1px solid var(--ctl); border-radius: var(--pick-radius); }
.pick-input:checked + .pick-box { background: var(--accent); border-color: var(--accent); }
.pick-input:checked + .pick-box::after { content: ""; position: absolute; left: 2px; top: 0; width: 2px; height: 4px; border: solid var(--panel); border-width: 0 2px 2px 0; transform: rotate(45deg); }
#grid:has(.player:hover) .pick-box, .player:has(.pick-input:focus-visible) .pick-box, .player:has(.pick-input:checked) .pick-box { opacity: 1; }
#grid:has(.player:hover) tbody .player, tbody .player:has(.pick-input:focus-visible), tbody .player:has(.pick-input:checked) { padding-left: var(--player-pad-left-pick); }
@media (hover: none) {
  .pick::after { inset: var(--pick-hit-touch); }
  .pick-box { opacity: 1; }
  .player { padding-left: var(--player-pad-left-pick); }
}
.pick-input:focus-visible + .pick-box { outline: 2px solid var(--accent); outline-offset: 1px; }
tbody tr:hover > * { background: var(--hover); }
/* The sorted column is painted like the lane: a tinted band with faint edge lines. A hovered row gets a marker on its player cell. */
td.is-sorted { background: var(--sorted); box-shadow: inset 1px 0 0 color-mix(in srgb, var(--accent) var(--lane-edge), transparent), inset -1px 0 0 color-mix(in srgb, var(--accent) var(--lane-edge), transparent); }
tbody tr:hover > td.is-sorted { background: var(--hover); }
tbody tr:hover > .player { box-shadow: inset var(--hover-edge) 0 0 var(--accent); }
td.blank .value { color: var(--text3); }

/* Rank mode (default): the rank is a small colored number after the value. Each ranked cell carries d1..d4, the digit
   count of the widest number its column shows, and main.js writes --rank-slot-1..4 (measured), so values line up. */
.rank { display: inline-block; margin-left: var(--rank-gap); text-align: left; font-size: var(--fs-rank); font-weight: 600; }
.d1 .rank { min-width: var(--rank-slot-1); } .d2 .rank { min-width: var(--rank-slot-2); }
.d3 .rank { min-width: var(--rank-slot-3); } .d4 .rank { min-width: var(--rank-slot-4); }
.r1 { color: var(--r1); } .r2 { color: var(--r2); } .r3 { color: var(--r3); } .r4 { color: var(--r4); } .r5 { color: var(--r5); }
.legend .rank { margin-left: 8px; }

/* Percentile mode: the number sits in a small chip tinted with the rank color. The digits keep the normal text color,
   so they stay readable on every step and the color is never the only signal. Steps 1 and 5 are filled most. */
body.percentile-mode .rank { --chip: var(--r3); --chip-fill: var(--chip-fill-weak); height: var(--chip-height); margin-left: var(--chip-gap); padding: 0 var(--chip-pad); line-height: var(--chip-height); text-align: center; vertical-align: middle; border-radius: var(--chip-radius); color: var(--text); font-weight: var(--fw-chip);
  background: color-mix(in srgb, var(--chip) var(--chip-fill), transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--chip) var(--chip-edge), transparent); }
body.percentile-mode .r1 { --chip: var(--r1); --chip-fill: var(--chip-fill-strong); }
body.percentile-mode .r2 { --chip: var(--r2); --chip-fill: var(--chip-fill-medium); }
body.percentile-mode .r3 { --chip: var(--r3); --chip-fill: var(--chip-fill-weak); }
body.percentile-mode .r4 { --chip: var(--r4); --chip-fill: var(--chip-fill-medium); }
body.percentile-mode .r5 { --chip: var(--r5); --chip-fill: var(--chip-fill-strong); }
/* Legend chips center on the digits themselves (text-box trims the line to the digit height), in a 16px box: with the
   table's 14px line box Inter's digits sat visibly high at 125% display scaling. Browsers without text-box fall back
   to the old look. The table chips keep their 14px: they are part of the column widths. */
body.percentile-mode .legend .rank { height: auto; margin-left: var(--chip-pad-legend);
  padding: calc((var(--chip-height-legend) - var(--digit-height)) / 2) var(--chip-pad-legend);
  line-height: var(--digit-height); text-box: trim-both cap alphabetic; }

/* hidden spans the column fitter measures; they must use the same font settings as the table */
.measure-host { position: absolute; visibility: hidden; left: 0; top: 0; white-space: nowrap; font-variant-numeric: tabular-nums; pointer-events: none; }
.measure-host span { position: absolute; white-space: nowrap; }
.measure-value { font-size: var(--fs-value); }
.measure-player { font-size: var(--fs-value); font-weight: 500; }
.measure-head { font-size: var(--fs-head); font-weight: var(--head-weight); }
.measure-rank { font-size: var(--fs-rank); font-weight: 600; }

/* ---------- states ---------- */
.panel-msg { margin: 0 var(--gutter); padding: 44px 16px; text-align: center; border: 1px dashed var(--ctl); border-radius: var(--radius); color: var(--text2); }
.panel-msg h2 { margin: 0 0 6px; font-size: var(--fs-panel-title); color: var(--text); }
.panel-msg.is-error { border-color: var(--err); }
.panel-msg.is-error h2 { color: var(--err); }
.skeleton { margin: 0 var(--gutter); padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.skeleton i { display: block; height: 14px; margin: 9px 0; border-radius: 3px; background: linear-gradient(90deg, var(--panel), var(--hover), var(--panel)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton i { animation: none; } }

/* ---------- Multi seasons mode ---------- */
/* Season type's label line also holds the "Multi" switch, right-aligned over the Playoffs button. Every field's label line has the
   same height, so the switch's track never makes one field taller than the rest. */
.fld > span:first-child, .lbl-row { min-height: var(--label-row-height); }
.lbl-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mini-switch { position: relative; flex: none; display: inline-flex; align-items: center; gap: 6px; height: var(--label-row-height); padding: 0; background: none; border: 0; border-radius: var(--radius-small); color: var(--text2); font: inherit; cursor: pointer; white-space: nowrap; }
/* The click area is taller than the switch it draws; it reaches up into the empty padding above the label line, and
   only 2px down, so it never covers the buttons below. */
.mini-switch::after { content: ""; position: absolute; left: -4px; right: -4px; top: calc(var(--label-row-height) + 2px - var(--switch-hit)); bottom: -2px; }
.mini-switch:hover, .mini-switch[aria-checked="true"] { color: var(--text); }
.ms-track { position: relative; flex: none; width: var(--switch-track-width); height: var(--switch-track-height); border-radius: calc(var(--switch-track-height) / 2); background: var(--ctl); transition: background .12s; }
.ms-knob { position: absolute; left: var(--switch-knob-inset); top: var(--switch-knob-inset); width: var(--switch-knob); height: var(--switch-knob); border-radius: 50%; background: var(--text); transition: left .12s; }
.mini-switch[aria-checked="true"] .ms-track { background: var(--accent-fill); }
.mini-switch[aria-checked="true"] .ms-knob { left: calc(var(--switch-track-width) - var(--switch-knob) - var(--switch-knob-inset)); background: var(--ink); }
@media (prefers-reduced-motion: reduce) { .ms-track, .ms-knob { transition: none; } }

/* Season button: looks like the single-season select, opens the checklist */
.season-wrap { position: relative; }
.selbtn { position: relative; width: var(--season-btn-width); height: var(--control-height); padding: 2px 22px 2px 6px; text-align: left; white-space: nowrap; background: var(--panel); border: 1px solid var(--accent); border-radius: var(--radius-small); color: var(--text); cursor: pointer; }
.selbtn::after { content: ""; position: absolute; right: 8px; top: 50%; margin-top: -2px; border: 4px solid transparent; border-top-color: var(--text2); border-bottom: 0; }
.fld select#f-min-seasons { width: 68px; }
#season-pop { position: absolute; z-index: 40; left: 0; top: calc(100% + 4px); width: var(--popover-width); padding: 10px; background: var(--panel); border: 1px solid var(--ctl); border-radius: 8px; box-shadow: var(--shadow); }
.sp-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; color: var(--text); font-weight: 650; }
.sp-head span { font-weight: 400; color: var(--text2); font-size: var(--fs-note); }
#sp-list { columns: 2; column-gap: 10px; }
.sp-row { display: flex; align-items: center; gap: 6px; min-height: 26px; break-inside: avoid; color: var(--text); cursor: pointer; }
.sp-row em { font-style: normal; font-size: var(--fs-label); color: var(--text3); }
.sp-row.is-off { color: var(--text3); cursor: not-allowed; }
.sp-row input { accent-color: var(--accent-fill); width: 14px; height: 14px; margin: 0; }
.sp-row input:disabled { cursor: not-allowed; }
.sp-foot { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.btn.primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--ink); font-weight: 700; }
.btn.primary:hover { border-color: var(--text); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; }
#backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .55); }

/* Note line, one-time notice, "fewer seasons" cells */
.multi-note { margin: 4px var(--gutter) 2px; color: var(--text2); font-size: var(--fs-note); }
.multi-note b { color: var(--text); font-weight: 600; }
.flash { display: flex; align-items: flex-start; gap: 8px; }
.flash span { flex: 1; }
.flash button { background: none; border: 0; color: var(--text2); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; }
.legend .fewer-key { font-style: italic; color: var(--text2); margin-left: 12px; }
td.fewer .value { font-style: italic; color: var(--text2); }
td[data-tip] { cursor: help; }
.pk-note { margin: 8px 0 0; font-size: var(--fs-note); color: var(--text3); }

/* Loading and error in Multi: the old table stays, dimmed, with a message on top. The panel is positioned only while busy:
   as a positioned box all the time it changed how the browser renders the text of the whole page. */
#panel.is-busy { position: relative; }
.table-wrap.is-dim { opacity: .4; pointer-events: none; }
.overlay { position: absolute; z-index: 20; left: 50%; top: 90px; transform: translateX(-50%); max-width: calc(100% - 24px); padding: 10px 16px; text-align: center; background: var(--panel); border: 1px solid var(--ctl); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); }
.overlay.is-error { border-color: var(--err); }
.overlay.is-error b { color: var(--err); }
.progress { position: absolute; z-index: 21; left: var(--gutter); right: var(--gutter); top: 0; height: 2px; overflow: hidden; background: var(--line); }
.progress::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 35%; background: var(--accent); animation: slide 1s ease-in-out infinite; }
@keyframes slide { from { left: -35%; } to { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .progress::after { animation: none; width: 100%; } }

/* ---------- header tooltip ---------- */
#tip, #hint { position: fixed; z-index: 60; max-width: var(--tooltip-width); padding: 8px 10px; background: var(--panel); border: 1px solid var(--ctl); border-radius: var(--radius); box-shadow: var(--shadow); font-size: var(--fs-note); }
#tip p, #hint p { margin: 4px 0; color: var(--text2); }
.tip-title { font-weight: 700; color: var(--text); }

footer { padding: 10px var(--gutter) 28px; color: var(--text2); font-size: var(--fs-note); }
#credits b { color: var(--text); }

/* ---------- glossary page ---------- */
.glossary { max-width: 900px; margin: 0 auto; padding: 16px var(--gutter) 40px; }
.glossary h1 { margin: 0 0 6px; font-size: var(--fs-page-title); }
.glossary > p { margin: 0 0 12px; color: var(--text2); }
.section-nav { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 18px; padding: 0; list-style: none; }
.glossary section { margin: 0 0 26px; }
.glossary h2 { margin: 0 0 8px; padding-bottom: 4px; font-size: var(--fs-panel-title); border-bottom: 1px solid var(--accent); }
.glossary h2 a { font-size: var(--fs-note); font-weight: 400; margin-left: 10px; }
.entry { margin: 0 0 14px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); scroll-margin-top: 12px; }
.entry.is-linked, .compact li.is-linked { border-color: var(--accent); }
.entry h3 { margin: 0 0 4px; font-size: var(--fs-body); }
.entry p { margin: 4px 0; color: var(--text2); }
.entry .group-name { font-size: var(--fs-label); font-weight: 400; color: var(--accent); margin-left: 8px; }
.entry .read b, .entry .credit b { color: var(--text); }
.multi-glossary { margin: 0 0 26px; scroll-margin-top: 12px; }
.multi-glossary p { margin: 4px 0; color: var(--text2); }
.multi-glossary.is-linked h2 { color: var(--accent); }
.compact-title { margin: 10px 0 4px; font-size: var(--fs-body); color: var(--text2); }
.compact { margin: 0; padding: 0; list-style: none; columns: 2 320px; column-gap: 24px; font-size: var(--fs-note); }
.compact li { break-inside: avoid; margin: 0 0 6px; padding: 2px 4px; border: 1px solid transparent; border-radius: 4px; scroll-margin-top: 12px; color: var(--text2); }
.compact li b { color: var(--text); }

/* ---------- narrow screens: the half-court drawing would crowd the navigation ---------- */
@media (max-width: 900px) { .deco { display: none; } }

/* ---------- phone: 640px and below (keep in step with PHONE_QUERY in js/main.js) ---------- */
@media (max-width: 640px) {
  .toolbar { gap: 8px 10px; }
  #f-q { width: 130px; }
  .right-tools { margin-left: 0; }
  #picker { position: fixed; left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 65vh; }
  .table-wrap, .panel-msg, .skeleton { margin: 0 var(--gutter-phone); }
  .player { white-space: normal; text-overflow: clip; }
  #tabs { display: none !important; }   /* the dropdown replaces the tab row, so the active tab is always visible */
  .tabsel { display: flex; }
  .tabsel span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }   /* the label stays for screen readers; saves width for the Filters button */
  .filters-btn { display: inline-block; }
  /* collapsed filters hide the filter fields; season type, season and Columns stay; chips stay visible */
  body.filters-closed .filter-field { display: none; }
  body.filters-closed .toolbar { padding-bottom: 2px; }
  body.filters-closed .table-wrap { max-height: var(--table-max-height-phone-collapsed); }
  /* Multi: the season button grows with its label; the checklist becomes a bottom sheet */
  .selbtn { width: auto; min-width: var(--season-btn-width); }
  .mini-switch { --switch-hit: var(--switch-hit-phone); }
  .multi-note, .flash { margin-left: var(--gutter-phone); margin-right: var(--gutter-phone); }
  .progress { left: var(--gutter-phone); right: var(--gutter-phone); }
  #season-pop { position: fixed; left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: var(--sheet-max-height); display: flex; flex-direction: column; border-radius: 12px 12px 0 0; padding: 12px 14px 14px; }
  #sp-list { overflow: auto; }
  .sp-row { min-height: var(--sheet-row-height); font-size: var(--fs-phone-control); }
  .sp-row input { width: 20px; height: 20px; }
  .sp-foot { margin-top: 6px; }
  .sp-foot .btn { flex: 1; }
  .sp-foot .link-btn { padding: 12px 8px; font-size: var(--fs-phone-control); }
  #picker { z-index: 40; }
}
