/* Results: tabs, leaderboards and curves, in the Swiss Grid look. */
.board-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.board-tabs button {
  font: 600 13px var(--sans); letter-spacing: 0.04em; text-transform: uppercase;
  padding: 9px 16px; cursor: pointer; color: var(--ink);
  background: transparent; border: 1.5px solid var(--ink); border-radius: 0;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), background 0.3s var(--ease), color 0.3s var(--ease);
}
.board-tabs button:hover { transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--accent-1); }
.board-tabs button[aria-selected="true"] { background: var(--accent-1); color: var(--on-accent, var(--bg)); border-color: var(--accent-1); }

.board { padding: 24px 24px 18px; overflow: visible; }
.board.swap { animation: board-in 0.6s var(--ease); }
@keyframes board-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.board-head { margin-bottom: 14px; }
.board-title { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; text-transform: uppercase; }
.board-sub { margin-top: 6px; font-size: 14px; color: var(--ink-3); }

table.results { min-width: 720px; }
table.results th { vertical-align: bottom; white-space: nowrap; color: var(--ink-2); }
table.results th .th-sub, table.results td .th-sub { display: block; font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.06em; margin-top: 2px; }
table.results td { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.results td.model { font-weight: 600; color: var(--ink); }
table.results td.strong { font-weight: 700; color: var(--ink); }
table.results td.gain { color: var(--accent-1); font-weight: 600; }
table.results tbody tr { transition: background 0.25s var(--ease); }
table.results tbody tr:hover { background: color-mix(in srgb, var(--accent-1) 9%, transparent); }
table.results tbody tr:first-child td.model, table.results tbody tr:first-child td.strong { color: var(--accent-1); }
table.results tr.partial td { color: var(--ink-3); }
table.results tr.partial td.model { color: var(--ink-2); }
.wtag {
  display: inline-block; margin-left: 6px; padding: 1px 6px; vertical-align: 2px;
  font: 500 10px var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3); border: 1px solid var(--line);
}
.sw { display: inline-block; width: 10px; height: 10px; margin-right: 9px; vertical-align: 0; }

.curves-fig { margin: 22px 0 0; padding-top: 18px; border-top: 1.5px solid var(--line); }
.curves-fig figcaption { font: 500 12px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }
.curves-wrap { width: 100%; }
.curves-plot { display: block; width: 100%; height: auto; aspect-ratio: 760 / 300; overflow: visible; }
.curves-plot .gl { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.curves-plot .ax { font: 11px var(--mono); fill: var(--ink-3); }
.curves-plot .ln path { fill: none; stroke-width: 2.2; stroke-dasharray: 1; stroke-dashoffset: 1; transition: opacity 0.3s var(--ease), stroke-width 0.3s var(--ease); }
.curves-plot .ln circle { opacity: 0; transition: opacity 0.4s var(--ease) 1.2s; }
.curves-plot.drawn .ln path { animation: draw 1.6s var(--ease) forwards; }
.curves-plot.drawn .ln circle { opacity: 1; }
.curves-plot.focus .ln { opacity: 0.18; }
.curves-plot.focus .ln.on { opacity: 1; }
.curves-plot.focus .ln.on path { stroke-width: 3.4; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 12px 0 0; padding: 0; font-size: 13px; color: var(--ink-2); }
.legend li { cursor: default; transition: color 0.25s var(--ease); }
.legend li.on { color: var(--ink); }
.board-note { margin-top: 14px; font-size: 12.5px; color: var(--ink-3); }

@media (prefers-reduced-motion: reduce) {
  .curves-plot .ln path { stroke-dashoffset: 0; }
}

/* the open-ended last track card */
.track.more h3 { letter-spacing: 0.1em; }
.track.more p { color: var(--ink-3); }

/* category tabs carry a task count; the second row lists a category's tasks */
.board-tabs .count {
  display: inline-block; min-width: 18px; margin-left: 8px; padding: 0 5px;
  font: 600 11px var(--mono); line-height: 18px; text-align: center;
  border: 1px solid currentColor; opacity: 0.8;
}
.board-subtabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 16px; padding-bottom: 14px; border-bottom: 1.5px solid var(--line); }
.board-subtabs[hidden] { display: none; }
.board-subtabs button {
  font: 500 12px var(--mono); letter-spacing: 0.04em; text-transform: uppercase;
  padding: 6px 12px; cursor: pointer; color: var(--ink-2);
  background: transparent; border: 1px solid var(--line); border-radius: 0;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.board-subtabs button:hover { color: var(--ink); border-color: var(--ink); }
.board-subtabs button[aria-selected="true"] { color: var(--ink); border-color: var(--accent-1); background: color-mix(in srgb, var(--accent-1) 14%, transparent); }
table.results .cell-link { cursor: pointer; }
table.results td.cell-link:hover, table.results th.cell-link:hover { color: var(--accent-1); }
table.results td.na { color: var(--ink-3); }

/* ---------- leaderboard table ----------
   One grid: # and Model on the left, every number column centred under its head, each band
   label centred over its columns with a rule beneath it (as in a booktabs table). Every row is
   the same height: secondary readings sit inline after the value, never on a second line. */
table.results { border-collapse: separate; border-spacing: 0; }
table.results th, table.results td { padding: 0 10px; height: 52px; text-align: center; vertical-align: middle; border-bottom: 1px solid var(--line); }
table.results th:first-child, table.results td:first-child { width: 44px; padding: 0 6px 0 12px; text-align: center; }
table.results th.model, table.results td.model { text-align: left; padding-left: 10px; width: 1%; }
table.results td.model { color: var(--ink); font-weight: 600; }
.mcell { display: flex; align-items: center; gap: 10px; white-space: nowrap; padding-right: 18px; }
.model-name { white-space: nowrap; }
.wtag { margin-left: 0; vertical-align: 0; }

/* header: band row, then column heads */
table.results thead th { height: auto; font: 500 11px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
table.results thead tr.table-band th {
  padding: 12px 10px 8px; border-bottom: 0; background: none;
  font: 600 10px var(--mono); letter-spacing: 0.1em; color: var(--ink-3);
  background-image: linear-gradient(var(--ink-3), var(--ink-3));
  background-size: calc(100% - 16px) 1px; background-position: center bottom; background-repeat: no-repeat;
}
table.results thead tr.table-band th.band-l { text-align: left; padding-left: 12px; background-image: none; }
table.results thead tr:not(.table-band) th { padding: 10px 10px 10px; border-bottom: 1.5px solid var(--ink); vertical-align: bottom; }
table.results thead tr:not(.table-band) th.model { padding-left: 10px; }
table.results th .th-sub { display: block; margin-top: 3px; font-size: 10px; color: var(--ink-3); letter-spacing: 0.06em; text-transform: none; }

/* body cells */
table.results td { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink-2); }
table.results td.strong { font-weight: 700; color: var(--ink); }
table.results td.gain { color: var(--accent-1); font-weight: 600; }
table.results td.na { color: var(--ink-3); }
table.results .frac, table.results .ended {
  margin-left: 6px; font: 500 10.5px var(--mono); color: var(--ink-3); letter-spacing: 0.02em; font-weight: 500;
}
table.results .ended::before { content: "· "; }
table.results tbody tr { transition: background 0.25s var(--ease); }
table.results tbody tr:hover td { background: color-mix(in srgb, var(--accent-1) 7%, transparent); }
table.results tbody tr:last-child td { border-bottom: 0; }
table.results tr.partial td, table.results tr.partial td.strong { color: var(--ink-3); }
table.results tr.partial td.model { color: var(--ink-2); font-weight: 500; }

/* group rows */
table.results tbody tr.group-row th {
  height: 34px; padding: 0 12px; text-align: left; background: color-mix(in srgb, var(--ink) 3.5%, transparent);
  border-bottom: 1px solid var(--line); color: var(--ink-2);
  font: 600 10px var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
}
table.results tbody tr.group-row:hover th { background: color-mix(in srgb, var(--ink) 3.5%, transparent); }
table.results tbody tr.group-row + tr td { border-top: 0; }
.group-code { display: inline-block; margin-right: 10px; color: var(--accent-1); font-weight: 700; }
.group-code::before { content: "["; } .group-code::after { content: "]"; }
.group-title { color: var(--ink); }
.group-meta { margin-left: 12px; color: var(--ink-3); font: 400 11px var(--sans); letter-spacing: 0; text-transform: none; }

/* rank: plain mono numerals; the top three take a filled square in the theme's language */
table.results .rank-badge {
  display: inline-grid; place-items: center; width: 26px; height: 26px;
  font: 600 11px var(--mono); color: var(--ink-3); border: 1px solid var(--line);
}
table.results .rank-badge.medal { color: var(--ink); border-color: var(--ink); }
table.results .rank-badge.medal-1 { color: var(--on-accent, #fff); background: var(--accent-1); border-color: var(--accent-1); }
table.results tbody tr.podium-1 td { background: color-mix(in srgb, var(--accent-1) 5%, transparent); }
table.results tbody tr.podium-1 td.model, table.results tbody tr.podium-1 td.strong { color: var(--accent-1); }

/* provider marks: one 18px box so every name starts on the same line */
.model-icon { display: inline-grid; place-items: center; flex: 0 0 18px; width: 18px; height: 18px; }
.model-icon img { display: block; width: 18px; height: 18px; object-fit: contain; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend .model-icon { flex-basis: 14px; width: 14px; height: 14px; }
.legend .model-icon img { width: 14px; height: 14px; }
.legend-line { display: inline-block; flex: 0 0 16px; height: 3px; background: var(--legend-color); }

@media (max-width: 700px) {
  .group-meta { display: none; }
  table.results th, table.results td { padding: 0 10px; }
}

/* ---------- overview: coverage ----------
   A row of counts, then one bar per model: a segment per task it was run on, coloured by category.
   Opening the tab replays the entrance (.play): counts run up, bars grow in turn from the left. */
.cov[hidden], .board-scroll[hidden] { display: none; }
.cov-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1.5px solid var(--ink); border-bottom: 1px solid var(--line); }
.cov-stat { padding: 16px 16px 14px 0; }
.cov-stat + .cov-stat { padding-left: 16px; border-left: 1px solid var(--line); }
.cov-stat b { display: block; font-size: clamp(32px, 4vw, 52px); font-weight: 800; letter-spacing: -0.04em; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.cov-stat:first-child b { color: var(--accent-1); }
.cov-stat span { display: block; margin-top: 8px; font: 500 10.5px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.cov-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 20px; margin: 26px 0 10px;
            font: 500 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.cov-legend { list-style: none; display: flex; gap: 6px 16px; margin: 0; padding: 0; color: var(--ink-3); }
.cov-legend li { display: flex; align-items: center; gap: 6px; }
.cov-legend i { width: 10px; height: 10px; }

.cov-chart { --model-w: 270px; --n-w: 48px; }
.cov-axis, .cov-row { display: grid; grid-template-columns: var(--model-w) minmax(0, 1fr) var(--n-w); align-items: center; gap: 0 14px; }
.cov-ticks { position: relative; height: 18px; font: 500 10px var(--mono); color: var(--ink-3); }
.cov-ticks span { position: absolute; top: 0; transform: translateX(-50%); }
.cov-ticks span:first-child { transform: none; }
.cov-ticks span:last-child { transform: translateX(-100%); }
.cov-row { height: 44px; border-top: 1px solid var(--line); }
.cov-row:last-child { border-bottom: 1px solid var(--line); }
.cov-model { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 600; font-size: 14px; color: var(--ink); white-space: nowrap; }
.cov-model .model-name { overflow: hidden; text-overflow: ellipsis; }
.cov-track { position: relative; height: 24px;
  background: repeating-linear-gradient(90deg, transparent 0 calc(25% - 1px), var(--line) calc(25% - 1px) 25%); }
.cov-bar { display: flex; height: 100%; gap: 2px; transform-origin: left center; }
.cov-seg {
  position: relative; display: flex; align-items: center; min-width: 0; padding: 0 8px; margin: 0;
  border: 0; border-radius: 0; background: var(--c); color: #f4f4f1; cursor: pointer;
  font: 500 10.5px var(--mono); letter-spacing: 0.04em; text-transform: uppercase; text-align: left;
  transition: filter 0.2s var(--ease), transform 0.2s var(--ease);
}
.cov-seg span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cov-seg:hover, .cov-seg:focus-visible { filter: brightness(1.18); transform: translateY(-2px); outline: none; box-shadow: 0 3px 0 var(--ink); }
.cov-n { font: 500 12px var(--mono); color: var(--ink-3); text-align: right; }
.cov-n b { font-size: 15px; color: var(--ink); }

.cov.play .cov-bar { animation: cov-grow 0.9s var(--ease) both; animation-delay: calc(var(--i) * 70ms + 120ms); }
.cov.play .cov-seg span { animation: cov-fade 0.4s var(--ease) both; animation-delay: calc(var(--i) * 70ms + 700ms); }
.cov.play .cov-model, .cov.play .cov-n { animation: cov-fade 0.5s var(--ease) both; animation-delay: calc(var(--i) * 70ms); }
@keyframes cov-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes cov-fade { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 760px) {
  .cov-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
  .cov-stat, .cov-stat + .cov-stat { padding: 12px 0 10px; border-left: 0; }
  .cov-stat b { font-size: 30px; }
  .cov-chart { --model-w: 1fr; --n-w: 36px; }
  .cov-axis { display: none; }
  .cov-row { grid-template-columns: minmax(0, 1fr) var(--n-w); grid-template-rows: auto auto; height: auto; padding: 10px 0; gap: 8px 10px; }
  .cov-track { grid-column: 1 / -1; grid-row: 2; }
  .cov-model .wtag { display: none; }
  .cov-seg span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cov.play .cov-bar, .cov.play .cov-seg span, .cov.play .cov-model, .cov.play .cov-n { animation: none; }
}

/* validation start → best, with the absolute change */
table.results td.vchange { color: var(--ink-3); }
table.results td.vchange b { font-weight: 600; color: var(--ink); }
table.results td.vchange .to { padding: 0 3px; color: var(--ink-3); }
table.results td.vchange .delta { margin-left: 8px; font: 600 11px var(--mono); color: var(--accent-1); }
table.results td.vchange .delta.flat { color: var(--ink-3); }
