/* Abstand: brutal. Black boxes, condensed caps, hatched voids where points
   are missing. Rows travel slowly enough to follow who moves where. */

/* Archivo (SIL Open Font License, see fonts/OFL.txt), served from this
   site so no request goes to Google. Variable in weight and width. */
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url(../fonts/archivo-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;
}
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url(../fonts/archivo-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;
}

:root {
  --ground: #f0f0f0;
  --paper: #fff;
  --ink: #000;
  --muted: #555;
  --accent: #ff3d00;
  --hi: #d6ff00;
  /* Zones: ink for the top tier, blue and teal for the places below it,
     two oranges at the bottom, so neighbouring zones never share a grey. */
  --zone-cl: #000;
  --zone-el: #2b5cff;
  --zone-ecl: #12a594;
  --zone-up: #000;
  --zone-relup: #2b5cff;
  --zone-rel: #ff8a66;
  --zone-down: #ff3d00;
  --stat: #444;
  --track-c: #ddd;
  --hatch: rgba(0, 0, 0, 0.55);
  --veil: rgba(240, 240, 240, 0.85);
  --band: rgba(0, 0, 0, 0.08);
  /* Inverted chips: black with lime in light mode, lime with black in dark. */
  --chip-bg: #000;
  --chip-fg: #d6ff00;
  --on-hi: #000;
  color-scheme: light;

  --font: 'Archivo', system-ui, sans-serif;

  /* Rows travel on a soft spring: quick start, a 2% settle, no bounce.
     Play mode holds each matchday after the move has landed. */
  --move-dur: 900ms;
  --move-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --lift: cubic-bezier(0.34, 1.4, 0.64, 1);
  --lift-dur: 380ms;
  --step-ms: 1700;

  --page-w: 860px;
  --gutter: 16px;
  --spine: 112px;
  --logo: 28px;
  /* Pixel widths, not em: header and rows use different font sizes. */
  --cols: 48px var(--logo) minmax(0, 1fr) auto 36px 64px 60px 50px 46px;
  --col-gap: 12px;
  --row-pad: 12px;
}

@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --move-ease: linear(0, 0.042, 0.142, 0.269, 0.404, 0.533, 0.647, 0.745, 0.825, 0.887, 0.934, 0.968, 0.991, 1.006, 1.015, 1.019, 1.02, 1.019, 1.017, 1.015, 1.012, 1.009, 1.007, 1.005, 1.003, 1.002, 1.001, 1.001, 1, 1, 1, 1, 1);
    --lift: linear(0, 0.066, 0.225, 0.423, 0.624, 0.8, 0.94, 1.038, 1.096, 1.123, 1.125, 1.111, 1.088, 1.062, 1.038, 1.017, 1.002, 0.992, 0.986, 0.984, 0.985, 0.987, 0.99, 0.994, 1);
  }
}

/* Dark: same brutal grammar, light ink on near-black. */
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) {
    --ground: #101010; --paper: #1b1b1b; --ink: #f2f2f2; --muted: #a3a3a3; --accent: #ff5a26;
    --zone-cl: #f2f2f2; --zone-el: #5c84ff; --zone-ecl: #2cc7b4; --zone-up: #f2f2f2; --zone-relup: #5c84ff; --zone-rel: #ff8a66; --zone-down: #ff5a26;
    --stat: #c4c4c4; --track-c: #3a3a3a; --hatch: rgba(255, 255, 255, 0.32); --veil: rgba(16, 16, 16, 0.85); --band: rgba(255, 255, 255, 0.1);
    --chip-bg: #d6ff00; --chip-fg: #000; color-scheme: dark;
  }
}
:root[data-mode="dark"] {
  --ground: #101010; --paper: #1b1b1b; --ink: #f2f2f2; --muted: #a3a3a3; --accent: #ff5a26;
  --zone-cl: #f2f2f2; --zone-el: #5c84ff; --zone-ecl: #2cc7b4; --zone-up: #f2f2f2; --zone-relup: #5c84ff; --zone-rel: #ff8a66; --zone-down: #ff5a26;
  --stat: #c4c4c4; --track-c: #3a3a3a; --hatch: rgba(255, 255, 255, 0.32); --veil: rgba(16, 16, 16, 0.85); --band: rgba(255, 255, 255, 0.1);
  --chip-bg: #d6ff00; --chip-fg: #000; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { background: var(--ground); color: var(--ink); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }

.page {
  max-width: var(--page-w);
  margin: 0 auto;
  padding: 12px var(--gutter) calc(88px + env(safe-area-inset-bottom));
}

/* ------------------------------------------------------------ header */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

/* The league switch is the heading: big, condensed, two blocks. */
.leagues { display: flex; }
.leagues button {
  min-height: 44px;
  padding: 4px 12px;
  border: 2px solid var(--ink);
  background: var(--paper);
  font-size: 22px;
  font-weight: 900;
  font-stretch: 62%;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1;
  transition: transform 140ms var(--ease-out), background-color 160ms ease, color 160ms ease;
}
.leagues button + button { margin-left: -2px; }
.leagues button[aria-pressed="true"] { background: var(--chip-bg); color: var(--chip-fg); }
.leagues .lg-short { display: none; }

.tools { display: flex; gap: 6px; }
.tool {
  min-width: 40px;
  height: 40px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px solid var(--ink);
  background: var(--paper);
  font-size: 17px;
  font-weight: 800;
  transition: transform 140ms var(--ease-out), background-color 160ms ease, color 160ms ease, box-shadow 140ms var(--ease-out), translate 140ms var(--ease-out);
}
.tool svg { width: 18px; height: 18px; fill: currentColor; }
.tool-label { font-size: 14px; font-stretch: 75%; text-transform: uppercase; white-space: nowrap; }
.tool[aria-expanded="true"], .tool[aria-pressed="true"] { background: var(--chip-bg); color: var(--chip-fg); }
.tool:disabled { opacity: 0.5; }
#compact-btn .i-closed { display: none; }
#compact-btn[aria-pressed="true"] .i-open { display: none; }
#compact-btn[aria-pressed="true"] .i-closed { display: inline; }

.leagues button:active, .tool:active, .play:active, .now:active, .dock-toggle:active, .dock-close:active, .fx-toggle:active { transform: scale(0.97); }

@media (hover: hover) {
  .tool:hover:not([aria-expanded="true"]):not([aria-pressed="true"]),
  .leagues button:hover:not([aria-pressed="true"]) { translate: -2px -2px; box-shadow: 2px 2px 0 var(--ink); }
}

/* Drop-down panels under the header (Ansicht, Info). */
.panel {
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 15px;
  display: grid;
  gap: 12px;
  transform-origin: top right;
  animation: panel-in 220ms var(--ease-out);
}
.panel[hidden] { display: none; }
.panel p { margin: 0; max-width: 62ch; }
.panel h2 { margin: 0 0 6px; font-size: 13px; font-weight: 800; font-stretch: 75%; text-transform: uppercase; }
@keyframes panel-in { from { opacity: 0; transform: scale(0.97) translateY(-4px); } }

.seg { display: flex; flex-wrap: wrap; gap: 0; }
.seg button {
  min-height: 36px;
  padding: 4px 10px;
  margin: 0 -2px -2px 0;
  border: 2px solid var(--ink);
  background: var(--paper);
  font-weight: 800;
  font-stretch: 75%;
  text-transform: uppercase;
  transition: background-color 140ms ease, color 140ms ease;
}
.seg button[aria-checked="true"] { background: var(--chip-bg); color: var(--chip-fg); }
.from { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.from[hidden], .opt-group[hidden] { display: none; }
/* The help matches the page: table help on the table, chart help on the overview. */
.info-ov, .on-overview .info-table { display: none; }
.on-overview .info-ov { display: block; }
.from .step { width: 36px; height: 36px; border: 2px solid var(--ink); background: var(--hi); color: var(--on-hi); font-weight: 900; font-size: 18px; }
.from output { font-weight: 900; font-stretch: 62%; font-size: 20px; text-transform: uppercase; min-width: 9ch; text-align: center; }
.hint { color: var(--muted); font-size: 13px; }
.check { display: flex; align-items: center; gap: 8px; min-height: 32px; font-weight: 700; font-stretch: 75%; text-transform: uppercase; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); margin: 0; }

.banner {
  margin: 0 0 10px;
  padding: 6px 10px;
  background: var(--hi); color: var(--on-hi);
  border: 2px solid var(--ink);
  font-size: 14px;
}
.banner[hidden] { display: none; }
.banner button { border: 2px solid var(--ink); background: var(--chip-bg); color: var(--chip-fg); font-weight: 800; font-stretch: 75%; text-transform: uppercase; font-size: 12px; padding: 1px 6px; margin-left: 4px; }

/* ------------------------------------------------------------ table */

.cols, .row {
  display: grid;
  grid-template-columns: var(--cols);
  column-gap: var(--col-gap);
  align-items: center;
}

/* Column labels stay on screen while scrolling. The 2px side borders match
   the row borders so both grids start at the same x. */
.cols {
  position: sticky;
  top: 0;
  z-index: 150;
  margin-left: var(--spine);
  padding: 8px var(--row-pad) 6px;
  border: 2px solid transparent;
  border-width: 0 2px;
  background: var(--ground);
  font-size: 13px;
  font-weight: 800;
  font-stretch: 75%;
  text-transform: uppercase;
}
.cols .stat, .cols .pts { text-align: right; }

.board {
  position: relative;
  margin-left: var(--spine);
  /* Room above the first row, so its hover lift is not hidden under the
     sticky column labels. */
  margin-top: 4px;
  transition: height var(--move-dur) var(--move-ease), opacity 160ms ease;
}
.board.swap { opacity: 0; }

.row {
  position: absolute;
  inset: 0 0 auto 0;
  height: var(--row-h);
  padding: 0 var(--row-pad);
  background: var(--paper);
  border: 2px solid var(--ink);
  transform: translate3d(0, var(--y, 0px), 0);
  transition: transform var(--move-dur) var(--move-ease);
  will-change: transform;
}
.board { --row-h: 46px; --gap-budget: 560; --unit-min: 7; --unit-max: 18; }
.row.stacked { border-top-width: 0; }
.row.tie-below { border-bottom-style: dotted; }
/* Who moved: a short lime flash on rows that changed place. */
.row.moved { animation: moved 1400ms var(--ease-out); }
@keyframes moved { 0%, 35% { background: var(--hi); color: var(--on-hi); } 100% { background: var(--paper); } }

.rank, .stat, .pts, .live-chip { font-variant-numeric: tabular-nums; }
.row .rank { display: flex; align-items: center; gap: 4px; font-weight: 800; font-stretch: 62%; font-size: 20px; }
.delta { font-size: 12px; font-weight: 800; font-stretch: 75%; line-height: 1; padding: 2px 3px; display: inline-flex; align-items: center; }
.delta:empty { display: none; }
.delta.up { background: var(--hi); color: var(--on-hi); }
.delta.down { background: var(--accent); color: var(--on-hi); }
.stat { text-align: right; white-space: nowrap; }
.row .stat { color: var(--stat); font-weight: 500; }
.pts { text-align: right; }
.row .pts { font-weight: 900; font-stretch: 62%; font-size: 30px; line-height: 1; }

.logo { display: block; width: var(--logo); height: var(--logo); }
.logo svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(2px 2px 0 var(--ink)); }
.logo { color: var(--ink); }
/* Test switch: original crests from the feed. */
.logo img.real-logo, .fx-team img.real-logo { display: block; width: 100%; height: 100%; object-fit: contain; }
.fx-team img.real-logo { width: 18px; height: 18px; }

.name { min-width: 0; display: flex; align-items: center; gap: 8px; }
.nm { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.row .name { font-weight: 800; font-stretch: 75%; text-transform: uppercase; font-size: 18px; letter-spacing: 0.01em; }
.name .short { display: none; }

/* Goal difference only gets weight when it actually separates teams. */
.row[data-decider="gd"] .gd,
.row[data-decider="gf"] .goals { background: var(--hi); color: var(--on-hi); padding: 0 3px; font-weight: 800; }

/* Keep the chip in the grid even when empty, so columns stay aligned. */
.live-chip { font-size: 13px; padding: 2px 7px; white-space: nowrap; background: var(--accent); color: var(--on-hi); font-weight: 800; }
.live-chip[hidden] { display: block !important; visibility: hidden; padding: 0; }

.pts, .live-chip { display: inline-block; }
.tick { animation: tick 420ms var(--ease-out); }
@keyframes tick { from { opacity: 0.25; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

/* Zones and gaps sit behind the rows. */
.zone, .gap {
  position: absolute;
  top: 0;
  transform: translate3d(0, var(--top, 0px), 0);
  height: var(--h, 0px);
  transition: transform var(--move-dur) var(--move-ease), height var(--move-dur) var(--move-ease), opacity 200ms ease;
  pointer-events: none;
}
.zone { left: calc(var(--spine) * -1 + 4px); width: 14px; background: var(--z); }
.zone[hidden] { display: none; }
.zone-label {
  position: absolute;
  top: 0;
  left: 22px;
  /* One word per line: "Champions / League" stays inside the spine. */
  width: min-content;
  max-width: calc(var(--spine) - 30px);
  /* Long German compounds break at their soft hyphen (Aufstiegs-relegation). */
  hyphens: manual;
  overflow-wrap: break-word;
  font-size: 13px;
  line-height: 1.1;
  font-weight: 800;
  font-stretch: 62%;
  text-transform: uppercase;
}

.zone-cl { --z: var(--zone-cl); }
.zone-el { --z: var(--zone-el); }
.zone-ecl { --z: var(--zone-ecl); }
.zone-up { --z: var(--zone-up); }
.zone-relup { --z: var(--zone-relup); }
.zone-rel { --z: var(--zone-rel); }
.zone-down { --z: var(--zone-down); }

/* Points nobody has: hatched void. */
.gap {
  left: 0;
  right: 0;
  background: repeating-linear-gradient(-45deg, transparent 0 5px, var(--hatch) 5px 6.5px);
  border-left: 2px solid var(--ink);
  border-right: 2px solid var(--ink);
}
.gap-n {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--chip-bg);
  color: var(--chip-fg);
  font-size: 12px;
  font-weight: 800;
  font-stretch: 75%;
  text-transform: uppercase;
  padding: 1px 6px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 200ms ease;
}
.gap-roomy .gap-n { opacity: 1; }
.gap-out { opacity: 0; }

.status { min-height: 1.4em; color: var(--muted); font-size: 14px; margin: 6px 0 0 var(--spine); }
.status:empty { display: none; }

/* Rows answer the pointer with a short springy lift and a hard shadow.
   `translate` is separate from the position transform, so lifting never
   fights a move that is still running. */
.row {
  cursor: pointer;
  transition: transform var(--move-dur) var(--move-ease), translate var(--lift-dur) var(--lift), box-shadow var(--lift-dur) var(--lift), opacity 300ms ease;
}
@media (hover: hover) {
  .row:hover:not(.is-open) { translate: -3px -3px; box-shadow: 3px 3px 0 var(--ink); z-index: 120 !important; }
}
.row:active { translate: 0 0; box-shadow: 0 0 0 var(--ink); transition-duration: var(--move-dur), 90ms, 90ms, 300ms; }
.row.is-open { box-shadow: 4px 4px 0 var(--ink); z-index: 116 !important; }
.row.is-open .rank .rn { background: var(--chip-bg); color: var(--chip-fg); padding: 0 4px; }
.row.out-of-reach { opacity: 0.3; }

/* First paint: rows drop in one after another, then the gaps open. */
.row.enter { animation: enter 520ms var(--lift) both; animation-delay: calc(var(--rank, 1) * 24ms); }
@keyframes enter { from { opacity: 0; translate: 0 -12px; } }

.tag {
  display: inline-block;
  flex: none;
  font-size: 11px;
  font-weight: 800;
  font-stretch: 75%;
  text-transform: uppercase;
  line-height: 1;
  padding: 3px 5px;
  white-space: nowrap;
}
.tags { display: flex; gap: 4px; }
.tag .t-short { display: none; }

.tags:empty { display: none; }
.tag-hand { border: 2px dashed var(--ink); padding: 1px 4px; }
/* Runs: no box, just a marker underline, so they stay quieter than the
   boxed tags. Lime for good runs, orange for bad ones. */
.tag-streak { padding: 3px 1px 2px; box-shadow: inset 0 -4px 0 var(--hi); }
.tag-streak[data-kind="down"] { box-shadow: inset 0 -4px 0 var(--accent); }
.tag-dv { border: 2px solid var(--ink); padding: 1px 4px; }
/* Decided outcomes: outlined with a colour key, so they never read as the
   filled black "2 Punkte" gap labels. */
.tag-clinch { display: inline-flex; align-items: center; gap: 4px; border: 2px solid var(--ink); background: var(--paper); color: var(--ink); padding: 1px 5px 1px 3px; }
.tag-clinch::before { content: ''; width: 8px; height: 8px; background: var(--k, var(--muted)); }
.tag-clinch[data-kind="top"] { --k: var(--hi); }
.tag-clinch[data-kind="europe"] { --k: var(--zone-el); }
.tag-clinch[data-kind="safe"] { --k: var(--track-c); }
.tag-clinch[data-kind="down"] { --k: var(--accent); }
.tag-clinch[data-kind="top"]::before { outline: 2px solid var(--ink); outline-offset: -2px; }

/* Postponed games: dashed outline of the points still to come. */
.ghost {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  transform: translate3d(0, var(--top, 0px), 0);
  height: var(--h, 0px);
  border: 2px dashed var(--ink);
  border-bottom: 0;
  background: var(--veil);
  pointer-events: none;
  transition: transform var(--move-dur) var(--move-ease), height var(--move-dur) var(--move-ease);
  animation: fade-in 300ms ease;
}
@keyframes fade-in { from { opacity: 0; } }

/* What a selected club can still change: the most points it can reach
   (above) and the line below which nobody can catch it any more. */
.reach-mark {
  position: absolute;
  left: -6px;
  right: -6px;
  top: 0;
  height: 0;
  border-top: 3px dashed var(--accent);
  transform: translate3d(0, var(--top, 0px), 0);
  transition: transform var(--move-dur) var(--move-ease);
  z-index: 110;
  pointer-events: none;
  animation: fade-in 300ms ease;
}
.reach-mark.low { border-top-color: var(--ink); }
.reach-mark span {
  position: absolute;
  right: 6px;
  top: -12px;
  background: var(--accent);
  color: var(--on-hi);
  font-size: 11px;
  font-weight: 800;
  font-stretch: 75%;
  text-transform: uppercase;
  padding: 2px 5px;
}
.reach-mark.low span { background: var(--chip-bg); color: var(--chip-fg); }

/* Detail panel: hangs from the opened row and unfolds downwards in step
   with the rows below, which slide down by the same amount. */
.detail {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  transform: translate3d(0, var(--top, 0px), 0);
  padding: 10px 12px 12px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-top-style: dashed;
  box-shadow: 4px 4px 0 var(--ink);
  z-index: 117;
  clip-path: inset(0 -8px -8px -8px);
  transition: transform var(--move-dur) var(--move-ease), clip-path var(--move-dur) var(--move-ease);
}
.detail.is-new { transition: none; clip-path: inset(0 -8px 100% -8px); }
.detail.closing { pointer-events: none; clip-path: inset(0 -8px 100% -8px); }
.d-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.d-cmp-pick { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; font-stretch: 75%; text-transform: uppercase; color: var(--muted); }
.d-close { width: 32px; height: 32px; border: 2px solid var(--ink); background: var(--paper); color: var(--ink); font-size: 18px; line-height: 1; transition: translate var(--lift-dur) var(--lift), box-shadow var(--lift-dur) var(--lift); }
@media (hover: hover) { .d-close:hover { translate: -2px -2px; box-shadow: 2px 2px 0 var(--ink); } }
.cmp { font: inherit; font-size: 14px; font-weight: 800; text-transform: none; color: var(--ink); min-height: 30px; border: 2px solid var(--ink); background: var(--paper); padding: 2px 6px; border-radius: 0; }
.d-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 18px; }
.d-grid > section { min-width: 0; }
/* Single club: the rank chart gets the wide middle column. */
.d-grid:not(.duel-mode) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr) minmax(0, 1fr); }
/* Entrances only when the panel opens, never on later content swaps. */
.detail.fresh .d-grid > section { animation: rise 460ms var(--lift) both; }
.detail.fresh .d-grid > section:nth-child(2) { animation-delay: 50ms; } .detail.fresh .d-grid > section:nth-child(3) { animation-delay: 100ms; }
.detail.fresh .d-grid > section:nth-child(4) { animation-delay: 150ms; }
.detail.fresh .d-grid > section:nth-child(5) { animation-delay: 200ms; } .detail.fresh .d-grid > section:nth-child(6) { animation-delay: 250ms; }
@keyframes rise { from { opacity: 0; translate: 0 8px; } }
.d-grid h3 { margin: 0 0 8px; font-size: 15px; font-weight: 800; font-stretch: 75%; text-transform: uppercase; color: var(--muted); }
.d-empty, .d-cap { margin: 4px 0 0; font-size: 14px; color: var(--muted); }

/* Form and next games: six boxes, three by two; a strip of six in a duel. */
.form, .next { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.form.strip, .next.strip { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; }
.form li, .next li { min-width: 0; display: grid; justify-items: center; align-content: center; height: 48px; border: 2px solid var(--ink); font-size: 12px; font-weight: 700; font-stretch: 75%; white-space: nowrap; overflow: hidden; line-height: 1.15; }
.form b, .next b { font-size: 20px; font-weight: 900; font-stretch: 62%; }
.strip li { height: 42px; }
.strip b { font-size: 18px; }
.strip span { font-size: 11px; }
.form li.f-none, .next li.f-none { border-style: dashed; color: var(--muted); }
.form .f-S { background: var(--hi); color: var(--on-hi); }
.form .f-N { background: var(--accent); color: var(--on-hi); }
.pair { display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 6px; }
.pair + .pair { margin-top: 4px; }
.who { font-size: 14px; font-weight: 900; font-stretch: 62%; text-transform: uppercase; display: inline-flex; align-items: center; gap: 3px; }
.who::before, .key { content: ''; display: inline-block; width: 8px; height: 3px; background: var(--ink); }
.who.k1::before, .key.k1 { background: var(--accent); }
.key { margin-right: 3px; vertical-align: middle; }

.spark { width: 100%; height: auto; display: block; border: 2px solid var(--ink); background: var(--paper); overflow: visible; }
.spark .grid { stroke: var(--ink); stroke-width: 0.6; stroke-dasharray: 1.5 3; opacity: 0.5; }
.spark .ax { font-size: 11px; font-weight: 700; font-stretch: 75%; fill: var(--muted); font-variant-numeric: tabular-nums; }
.spark .hatch-line { stroke: var(--ink); stroke-width: 1; opacity: 0.16; }
.spark .line { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.spark .line.l1 { stroke: var(--accent); }
.spark .pt { fill: var(--paper); stroke: var(--ink); stroke-width: 1.2; }
.spark .pt.p1 { stroke: var(--accent); }
.spark .dot { fill: var(--hi); stroke: var(--ink); stroke-width: 1.6; }
.spark .dot.d1 { fill: var(--accent); }
.spark .b-top { fill: var(--band); }
.spark .b-down { fill: rgba(255, 61, 0, 0.12); }
/* Draw-in when the panel opens, and for a newly picked comparison line. */
.detail.fresh .spark .line.l0, .spark .line.l1 { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1200ms var(--ease-out) 160ms forwards; }
.detail.fresh .spark .area, .detail.fresh .spark .pt, .spark .pt.p1 { animation: fade-in 500ms ease 700ms both; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.hard { margin-top: 6px; }
.hard .d-cap b { color: var(--ink); font-weight: 800; text-transform: uppercase; font-stretch: 75%; }
.hard-bar { display: block; height: 8px; border: 2px solid var(--ink); background: linear-gradient(to right, var(--ink) var(--fill), transparent 0); }
.reach-line { margin: 0 0 6px; font-size: 14px; }

/* Number tiles: points per game, projection, last season. */
.nums { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.nums li { position: relative; min-width: 0; display: grid; align-content: center; justify-items: center; height: 54px; border: 2px solid var(--ink); text-align: center; }
.nums b { font-size: 24px; font-weight: 900; font-stretch: 62%; line-height: 1; font-variant-numeric: tabular-nums; }
.nums span { font-size: 10px; font-weight: 800; font-stretch: 75%; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.nums i { position: absolute; top: -2px; right: -2px; font-style: normal; font-size: 10px; font-weight: 800; line-height: 1; padding: 2px 3px; background: var(--chip-bg); color: var(--chip-fg); }
.nums i.up { background: var(--hi); color: var(--on-hi); }
.nums i.down { background: var(--accent); color: var(--on-hi); }
.nums li:first-child { background: var(--chip-bg); }
.nums li:first-child b { color: var(--chip-fg); }
.nums li:first-child span { color: var(--chip-fg); opacity: 0.75; }

.scorers { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.scorers li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 28px; }
.scorers b { display: grid; place-items: center; height: 28px; border: 2px solid var(--ink); font-size: 15px; font-weight: 900; font-stretch: 62%; line-height: 1; font-variant-numeric: tabular-nums; }
.scorers span { font-weight: 800; font-stretch: 75%; text-transform: uppercase; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scorers i { font-style: normal; font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.scorers li:first-child b { background: var(--hi); color: var(--on-hi); }
.scorers-inline { margin: 0; font-size: 14px; font-weight: 700; font-stretch: 75%; text-transform: uppercase; }
.scorers-inline b { font-weight: 900; }
.d-grid.duel-mode .d-duel { grid-row: span 2; }

/* Duel: mirrored bars around a centre label. */
.d-duel { min-width: 0; }
/* Duel: two wide columns, so strips and bars have room. */
.d-grid.duel-mode { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 22px; }

.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 84px minmax(0, 1fr) 40px; align-items: center; gap: 6px; font-size: 15px; font-variant-numeric: tabular-nums; }
.bv { font-weight: 700; text-align: right; }
.bar-row .bv:last-child { text-align: left; }
.bv b { font-weight: 700; padding: 0 3px; }
.bv b.win { font-weight: 900; background: var(--hi); color: var(--on-hi); }
.bl { text-align: center; font-size: 12px; font-weight: 800; font-stretch: 75%; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.bar { height: 12px; display: flex; }
.bar.l { justify-content: flex-end; }
.bar i { display: block; height: 100%; width: var(--w); background: var(--ink); transition: width var(--move-dur) var(--move-ease); }
.bar.r i { background: var(--accent); }
.bar i.lose { opacity: 0.28; }
.detail .duel-mode .bar i { animation: grow 700ms var(--lift) both; }
@keyframes grow { from { width: 0; } }
.duel { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.duel li { font-size: 14px; padding: 2px 6px; border: 2px solid var(--ink); white-space: nowrap; }
.duel li span { color: var(--muted); }
.duel li.tip { background: var(--hi); color: var(--on-hi); }



/* ------------------------------------------------------------ overview */

.on-overview main, .on-overview #compact-btn, .on-overview #share-btn { display: none; }
.overview[hidden] { display: none; }
.overview { animation: fade-in 240ms ease; }
.ov-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 12px; }
.ov-hint { margin: 0; color: var(--muted); font-size: 14px; max-width: 60ch; }
.ov-body { position: relative; border: 2px solid var(--ink); background: var(--paper); padding: 10px 0 6px; box-shadow: 4px 4px 0 var(--ink); }
.ov-body > .d-empty { padding: 12px; }

/* Lines in club colours; black clubs fall back to the ink colour. */
.ov-svg-wrap { position: relative; }
.ov-svg { display: block; overflow: visible; }
.ov-svg .grid { stroke: var(--ink); stroke-width: 0.7; stroke-dasharray: 2 4; opacity: 0.4; }
.ov-svg .ax { font-size: 12px; font-weight: 800; font-stretch: 75%; fill: var(--muted); font-variant-numeric: tabular-nums; }
.ov-svg .now { stroke: var(--ink); stroke-width: 1; opacity: 0.25; }
.ov-svg .ln { --c: var(--ink); }
.ov-svg .ln .hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
.ov-svg .ln .vis { fill: none; stroke: var(--c); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; opacity: 0.7; pointer-events: none; transition: opacity 200ms ease, stroke-width 200ms ease; }
.ov-svg .ln .lead { fill: none; stroke: var(--c); stroke-width: 1; opacity: 0.4; pointer-events: none; }
.ov-svg .ln .mk { fill: var(--paper); stroke: var(--c); stroke-width: 2; display: none; }
.has-sel .ov-svg .ln .vis, .has-hover .ov-svg .ln .vis { opacity: 0.16; }
.has-sel .ov-svg .ln .lead, .has-hover .ov-svg .ln .lead { opacity: 0.1; }
.ov-svg .ln.is-hover .vis { opacity: 1; stroke-width: 3.4; }
.ov-svg .ln.is-hover .lead { opacity: 0.7; }
.ov-svg .ln.sel-a .vis, .ov-svg .ln.sel-b .vis { opacity: 1; stroke-width: 4.2; }
.ov-svg .ln.sel-a .lead, .ov-svg .ln.sel-b .lead { opacity: 0.9; stroke-width: 1.6; }
.ov-svg .ln.sel-a .mk, .ov-svg .ln.sel-b .mk { display: block; }
.ov-body.fresh .ov-svg .ln .vis { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1300ms var(--ease-out) forwards; }
.ov-body.fresh .ov-svg .ln .lead, .ov-body.fresh .ov-svg .ln .mk { animation: fade-in 400ms ease 900ms both; }

/* Club labels in a lane on the right, gliding to their place. */
.ov-labels { position: absolute; inset: 0; pointer-events: none; }
.ov-lab {
  --c: var(--ink); --cf: var(--paper);
  position: absolute; left: 0; top: 0;
  display: inline-flex; align-items: center; gap: 5px;
  height: 25px; padding: 0 6px 0 4px;
  border: 0; border-left: 3px solid var(--c); background: var(--paper); color: var(--ink);
  font-size: 17px; font-weight: 800; font-stretch: 75%; text-transform: uppercase; line-height: 1;
  transform: translate3d(var(--x), var(--y), 0);
  transition: transform var(--move-dur) var(--move-ease), background-color 160ms ease, color 160ms ease, opacity 200ms ease;
  pointer-events: auto;
  white-space: nowrap;
}
.ov-lab .logo { width: 20px; height: 20px; }
.ov-lab .logo svg { filter: none; }
.ov-lab b { font-weight: 900; font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }
.ov-body.fresh .ov-lab { animation: fade-in 500ms ease 500ms both; }
.has-sel .ov-lab:not(.sel-a):not(.sel-b), .has-hover .ov-lab:not(.is-hover):not(.sel-a):not(.sel-b) { opacity: 0.45; }
.ov-lab.sel-a, .ov-lab.sel-b { background: var(--c); color: var(--cf); z-index: 2; }
.ov-lab.is-hover { z-index: 3; }

/* Club codes: one size in all four views. */
.ov-lab .cd, .ov-rl .cd { font-size: 17px; font-weight: 800; font-stretch: 75%; }

/* Rank grid and program: one absolutely placed row per club, so a new
   order glides like the table. */
.ov-head, .ov-row { display: grid; grid-template-columns: 104px minmax(0, 1fr) auto; align-items: center; column-gap: 10px; padding: 0 12px; }
.ov-head { height: 26px; font-size: 12px; font-weight: 800; font-stretch: 75%; color: var(--muted); font-variant-numeric: tabular-nums; }
.ov-rows { position: relative; margin-bottom: 4px; }
.ov-row {
  position: absolute; left: 0; right: 0; top: 0;
  height: var(--row);
  border: 0; background: none; color: var(--ink); text-align: left;
  transform: translate3d(0, var(--y), 0);
  transition: transform var(--move-dur) var(--move-ease), opacity 200ms ease;
}
.ov-rl { display: inline-flex; align-items: center; gap: 5px; min-width: 0; height: 100%; padding-right: 4px; font-size: 17px; font-weight: 800; font-stretch: 75%; text-transform: uppercase; }
.ov-rl .rk { width: 20px; text-align: right; font-weight: 900; font-stretch: 62%; font-size: 17px; font-variant-numeric: tabular-nums; }
.ov-rl .logo { width: 20px; height: 20px; flex: none; }
.ov-rl .logo svg { filter: none; }
.ov-cells { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 2px; height: 100%; padding: 1px 0; min-width: 0; }
.ov-head .ov-cells { padding: 0; }
.ov-head .ov-cells i { font-style: normal; text-align: center; align-self: center; }
/* Good for the club in lime, bad in orange, mid-table near paper. */
.ov-row .ov-cells i {
  display: grid; place-items: center; min-width: 0; overflow: hidden;
  font-style: normal; font-size: 13px; font-weight: 800; font-stretch: 75%; font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--hi) calc(var(--a, 0) * 100%), var(--paper));
  color: var(--ink);
}
.ov-row .ov-cells i.dn { background: color-mix(in srgb, var(--accent) calc(var(--a, 0) * 100%), var(--paper)); }
.ov-row .ov-cells i.strong { color: var(--on-hi); }
.ov-row .ov-cells i.e { background: none; outline: 1px dashed var(--track-c); outline-offset: -1px; color: var(--muted); }
.ov-row .ov-cells i.done { background: none; color: var(--muted); text-decoration: line-through; }
.ov-body.fresh .ov-row { animation: rise 420ms var(--lift) both; animation-delay: calc(var(--i, 0) * 18ms); }
.has-sel .ov-row:not(.sel-a):not(.sel-b) { opacity: 0.35; }
.has-hover .ov-row.is-hover { outline: 2px solid var(--ink); outline-offset: 0; z-index: 2; }
.ov-row.sel-a .ov-rl { background: var(--chip-bg); color: var(--chip-fg); }
.ov-row.sel-b .ov-rl { background: var(--accent); color: var(--on-hi); }
.ov-sort { border: 2px solid var(--ink); background: var(--paper); color: var(--ink); font: inherit; font-size: 11px; font-weight: 800; text-transform: uppercase; padding: 2px 5px; white-space: nowrap; }
.ov-sort[aria-pressed="true"] { background: var(--chip-bg); color: var(--chip-fg); }
.ov-body[data-variant="programm"] .ov-cells i { font-size: 13px; }
.ov-avg { width: 84px; display: grid; grid-template-columns: 38px 1fr; align-items: center; gap: 6px; font-size: 13px; font-variant-numeric: tabular-nums; }
.ov-head .ov-avg { display: block; text-align: left; }
.ov-avg b { font-weight: 900; font-stretch: 62%; font-size: 17px; text-align: right; }
.ov-avg .hard-bar { height: 10px; }
.ov-body:not([data-variant="programm"]) .ov-avg { display: none; }

/* Compact mode: classic table, no gaps. */
.is-compact .gap, .is-compact .ghost { display: none; }

/* ------------------------------------------------------------ footer */

.foot { margin: 22px 0 0 var(--spine); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 20px; font-size: 13px; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.legend li { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-stretch: 75%; text-transform: uppercase; }
.swatch { width: 12px; height: 12px; display: inline-block; background: var(--z); }
/* Overview legend: colour scale, line and pick samples. */
.lg-scale { display: inline-block; width: 120px; height: 12px; border: 2px solid var(--ink); background: linear-gradient(to right, var(--hi), var(--paper), var(--accent)); }
.lg-lines { display: inline-block; width: 26px; height: 12px; background: linear-gradient(to bottom, #E3001B 0 3px, transparent 3px 4.5px, #0067A5 4.5px 7.5px, transparent 7.5px 9px, #008856 9px 12px); }
.lg-pick { display: inline-block; width: 26px; height: 4px; background: var(--ink); box-shadow: 0 -5px 0 -1px var(--track-c), 0 5px 0 -1px var(--track-c); }
.legend .lg-bar { display: inline-block; width: 40px; height: 10px; }
.legend b { font-weight: 900; }
.credit { margin: 0; color: var(--muted); }
.privacy { flex-basis: 100%; color: var(--muted); }
.privacy summary { cursor: pointer; font-weight: 800; font-stretch: 75%; text-transform: uppercase; width: max-content; }
.privacy p { margin: 6px 0 0; max-width: 70ch; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  z-index: 300;
  background: var(--chip-bg);
  color: var(--chip-fg);
  padding: 8px 12px;
  font-weight: 800;
  font-stretch: 75%;
  text-transform: uppercase;
  animation: panel-in 200ms var(--ease-out);
}
.toast[hidden] { display: none; }

/* ------------------------------------------------------------ dock */

.dock {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 200;
  padding: 0 var(--gutter) calc(12px + env(safe-area-inset-bottom));
  pointer-events: none;
  display: flex;
  justify-content: flex-end;
}
.dock > * { pointer-events: auto; }

/* Collapsed: a small box with the matchday, bottom right. */
.dock-toggle {
  display: grid;
  justify-items: center;
  align-content: center;
  min-width: 64px;
  height: 64px;
  padding: 4px 10px;
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 140ms var(--ease-out), background-color 160ms ease;
}
.dock-md { font-weight: 900; font-stretch: 62%; font-size: 28px; line-height: 0.95; font-variant-numeric: tabular-nums; }
.dock-cap { font-weight: 800; font-stretch: 75%; font-size: 11px; text-transform: uppercase; }
.dock.is-past .dock-toggle { background: var(--hi); color: var(--on-hi); }
.shows-live .dock-toggle .dock-cap { background: var(--accent); color: var(--on-hi); padding: 0 3px; }

.dock-inner {
  width: min(100%, calc(var(--page-w) - 2 * var(--gutter)));
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  transform-origin: bottom right;
}
.dock-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.dock-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fx-toggle { min-height: 32px; padding: 2px 10px; border: 2px solid var(--ink); background: var(--paper); font-weight: 800; font-stretch: 75%; text-transform: uppercase; }
.fx-toggle::after { content: ' ▾'; }
.fx-toggle[aria-expanded="true"] { background: var(--chip-bg); color: var(--chip-fg); }
.fx-toggle[aria-expanded="true"]::after { content: ' ▴'; }
.scen { font-weight: 800; font-stretch: 75%; text-transform: uppercase; font-size: 13px; background: var(--hi); color: var(--on-hi); padding: 2px 6px; }
.scen[hidden] { display: none; }
.scen button { border: 2px solid var(--ink); background: var(--chip-bg); color: var(--chip-fg); font-weight: 800; font-size: 12px; text-transform: uppercase; padding: 1px 6px; margin-left: 4px; }
.dock.has-tips .dock-toggle { background: var(--hi); color: var(--on-hi); }
.dock.has-tips .dock-cap { background: var(--chip-bg); color: var(--chip-fg); padding: 0 3px; }

.fixtures {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(42vh, 360px);
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  gap: 4px;
}
.fixtures[hidden] { display: none; }
.fixtures li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 8px auto minmax(0, 1fr) 64px;
  align-items: center;
  gap: 6px;
  border: 2px solid var(--ink);
  padding: 3px 6px;
  font-weight: 800;
  font-stretch: 75%;
  text-transform: uppercase;
}
.fixtures li.is-tip { background: var(--hi); color: var(--on-hi); }
.fixtures li.is-done { color: var(--stat); }
.fx-team { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.fx-team svg { width: 20px; height: 20px; flex: none; }
.fx-away { justify-content: flex-start; }
.sc { display: inline-flex; align-items: center; gap: 2px; }
.sc b { min-width: 1.3em; text-align: center; font-size: 20px; font-weight: 900; font-stretch: 62%; font-variant-numeric: tabular-nums; }
.sc button { width: 24px; height: 24px; border: 2px solid var(--ink); background: var(--paper); font-weight: 900; line-height: 1; padding: 0; }
.sc button:active { background: var(--hi); color: var(--on-hi); }
.colon { text-align: center; font-weight: 900; }
.fx-when { text-align: right; font-size: 11px; color: var(--muted); }
.fx-when i { font-style: normal; }
.fx-when .fx-live { background: var(--accent); color: var(--on-hi); padding: 1px 4px; }
.is-tip .fx-when i { background: var(--chip-bg); color: var(--chip-fg); padding: 1px 4px; }

.dock:not(.is-open) .dock-inner { display: none; }
.dock.is-open { justify-content: center; }
.dock.is-open .dock-toggle { display: none; }
.dock.is-open .dock-inner { animation: dock-in 220ms var(--ease-out); }
@keyframes dock-in { from { opacity: 0; transform: scale(0.96) translateY(6px); } }

.play {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--hi); color: var(--on-hi);
  border: 2px solid var(--ink);
  transition: transform 140ms var(--ease-out);
}
.play svg { width: 20px; height: 20px; fill: currentColor; }
.play .i-pause { display: none; }
.play[aria-pressed="true"] .i-play { display: none; }
.play[aria-pressed="true"] .i-pause { display: inline; }

.scrub { min-width: 0; display: grid; gap: 6px; }
.scrub-text { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; overflow: hidden; }
#md-label { font-weight: 900; font-stretch: 62%; font-size: 22px; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.md-dates { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.live-flag { display: none; background: var(--accent); color: var(--on-hi); padding: 0 5px; font-size: 13px; font-weight: 800; text-transform: uppercase; }
.shows-live .live-flag { display: inline-block; }

.now, .dock-close {
  min-height: 40px;
  padding: 6px 10px;
  border: 2px solid var(--ink);
  font-weight: 800;
  font-stretch: 75%;
  text-transform: uppercase;
  transition: transform 140ms var(--ease-out);
}
.now { background: var(--chip-bg); color: var(--chip-fg); }
/* Lives in the text line above the slider and only fades, so showing or
   hiding it never changes the slider's width. */
.scrub-text .now { margin-left: auto; min-height: 24px; padding: 1px 8px; font-size: 12px; flex: none; transition: opacity 160ms ease, transform 140ms var(--ease-out); }
.scrub-text .now[hidden] { display: inline-block; visibility: hidden; opacity: 0; }
.dock-close { width: 40px; padding: 0; background: var(--paper); font-size: 20px; line-height: 1; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  --track: 10px;
  --thumb: 24px;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: var(--track);
  background: linear-gradient(to right, var(--ink) calc(var(--p, 1) * 100%), var(--track-c) 0);
}
input[type="range"]::-moz-range-track { height: var(--track); background: var(--track-c); }
input[type="range"]::-moz-range-progress { height: var(--track); background: var(--ink); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: var(--thumb);
  height: var(--thumb);
  margin-top: calc((var(--track) - var(--thumb)) / 2);
  background: var(--hi);
  border: 3px solid var(--on-hi);
}
input[type="range"]::-moz-range-thumb { width: var(--thumb); height: var(--thumb); background: var(--hi); border: 3px solid var(--on-hi); border-radius: 0; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------ narrow screens */

@media (max-width: 640px) {
  :root {
    --spine: 20px;
    --logo: 24px;
    --cols: 36px var(--logo) minmax(0, 1fr) auto 44px 34px;
    --col-gap: 8px;
    --row-pad: 8px;
  }
  .board { --row-h: 42px; }
  .leagues button { font-size: 19px; padding: 4px 9px; min-height: 40px; }
  .leagues .lg-long { display: none; }
  .leagues .lg-short { display: inline; }
  .tool { min-width: 36px; height: 36px; padding: 0 6px; }
  .tool-label { display: none; }
  .tools { gap: 4px; }
  .d-grid, .d-grid:not(.duel-mode) { grid-template-columns: 1fr 1fr; }
  .d-grid:not(.duel-mode) > section:nth-child(2) { grid-column: 1 / -1; order: -1; }
  .d-grid:not(.duel-mode) .reach-sec { grid-column: auto; }
  .d-grid.duel-mode { grid-template-columns: 1fr; }
  .d-grid.duel-mode .d-duel { grid-column: auto; grid-row: auto; }
  .tags .tag-streak:not(:only-child) { display: none; }
  .ov-head, .ov-row { grid-template-columns: 76px minmax(0, 1fr) auto; column-gap: 6px; padding: 0 6px; }
  .ov-head { font-size: 11px; }
  .ov-rl { gap: 4px; font-size: 14px; }
  .ov-lab .cd, .ov-rl .cd { font-size: 14px; }
  .ov-rl .rk { width: 16px; font-size: 14px; }
  .ov-rl .logo { width: 16px; height: 16px; }
  .ov-row .ov-cells i, .ov-body[data-variant="programm"] .ov-cells i { font-size: 11px; }
  .ov-avg { width: 34px; grid-template-columns: 1fr; }
  .ov-avg b { font-size: 15px; }
  .ov-avg .hard-bar { display: none; }
  .ov-lab { height: 20px; font-size: 14px; gap: 4px; border-left-width: 2px; }
  .ov-lab b { display: none; }
  .ov-lab .logo { width: 16px; height: 16px; }
  .ov-svg .ax { font-size: 11px; }
  .tag .t-long { display: none; }
  .tag .t-short { display: inline; }
  /* Level on points and goal difference: goals decide, so show them in
     place of the difference. */
  .row[data-decider="gf"] .stat.goals { display: block; font-size: 14px; }
  .row[data-decider="gf"] .stat.gd { display: none; }
  .foot { margin-left: 0; }
  .fixtures li { grid-template-columns: minmax(0, 1fr) auto 6px auto minmax(0, 1fr); }
  .fx-when { display: none; }
  .stat.played, .stat.wdl, .stat.goals, .live-chip .opp { display: none; }
  .row .name { font-size: 16px; }
  .name .long { display: none; }
  .name .short { display: inline; }
  .row .pts { font-size: 26px; }
  .row .rank { font-size: 18px; gap: 2px; }
  .delta { font-size: 10px; padding: 1px 2px; }
  .zone { left: -18px; width: 10px; }
  .zone-label { display: none; }
  .gap-n { left: auto; right: 6px; transform: translateY(-50%); }
  .dock-inner { padding: 8px 10px; }
  .dock-row { grid-template-columns: auto 1fr auto; gap: 10px; }
  #md-label { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}

/* ------------------------------------------------------------ time travel speed */

.seg.speed { margin-left: auto; }
.seg.speed button { min-height: 30px; padding: 2px 8px; font-size: 13px; }

/* ------------------------------------------------------------ share dialog */

.share-dlg {
  width: min(980px, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
}
.share-dlg::backdrop { background: rgba(0, 0, 0, 0.45); }
.share-dlg[open] { animation: panel-in 220ms var(--ease-out); }
.share-inner { display: grid; grid-template-rows: auto minmax(0, 1fr); max-height: inherit; margin: 0; }
.share-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px 4px; }
.share-head h2 { margin: 0; font-size: 22px; font-weight: 900; font-stretch: 62%; text-transform: uppercase; }
.share-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; padding: 14px; overflow: auto; }
/* One frame only (the dialog's): the preview sits on a quiet tint, no border. */
.share-preview { margin: 0; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--ink) 13%, var(--paper)); padding: 14px; height: min(62dvh, 640px); box-sizing: border-box; }
.share-preview img { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; transition: opacity 160ms ease; }
.share-preview img.is-busy { opacity: 0.45; }
.share-opts { display: grid; align-content: start; gap: 10px; }
/* One column of equal rows: label left, full-width segments right, so every
   control ends on the same edge as the buttons below. */
.share-opts .opt-group { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 10px; }
.share-opts .opt-group[hidden] { display: none; }
.share-opts h3 { margin: 0; font-size: 13px; font-weight: 800; font-stretch: 75%; text-transform: uppercase; color: var(--muted); }
.share-opts .seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.share-opts .seg button { min-height: 44px; padding: 4px 6px; font-size: 15px; line-height: 1.05; }
#share-format button[data-ratio]::after { content: attr(data-ratio); display: block; font-size: 11px; font-weight: 700; opacity: 0.7; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.share-actions .act {
  flex: 1 1 0; min-width: 0; min-height: 48px; padding: 6px 8px;
  border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  font-weight: 800; font-stretch: 75%; text-transform: uppercase; font-size: 15px;
  transition: translate var(--lift-dur) var(--lift), box-shadow var(--lift-dur) var(--lift);
}
.share-actions .act[hidden] { display: none; }
.share-actions .act-main { flex-basis: 100%; min-height: 54px; font-size: 18px; background: var(--chip-bg); color: var(--chip-fg); }
/* Without the system sheet, the download is the main action. */
.share-actions:not(:has(.act-main:not([hidden]))) #share-download { background: var(--chip-bg); color: var(--chip-fg); }
@media (hover: hover) { .share-actions .act:hover { translate: -2px -2px; box-shadow: 2px 2px 0 var(--ink); } }
.share-actions .act:active { translate: 0 0; box-shadow: none; }
@media (max-width: 640px) {
  .share-dlg { width: 100vw; max-width: 100vw; max-height: 100dvh; margin: auto 0 0; box-shadow: none; border-width: 2px 0 0; }
  .share-body { grid-template-columns: 1fr; }
  .share-preview { height: 44dvh; }
  .share-opts .opt-group { grid-template-columns: 78px minmax(0, 1fr); }
  .share-actions .act { font-size: 13px; }
  .seg.speed button { padding: 2px 6px; }
}
