/* Match event dashboard. Tokens first; light + dark selected separately (not an automatic flip). */

:root {
  color-scheme: light;
  --page: #eef2ee;
  --surface: #fbfcfb;
  --surface-2: #f1f5f2;
  --ink: #1d2a24;
  --ink-2: #4a5852;
  --muted: #65726b;
  --line: #d6ded8;
  --line-strong: #b5c2ba;
  --accent: #0f5c45;
  --accent-ink: #ffffff;
  --accent-soft: #dcebe4;
  --focus: #0f5c45;

  --pitch: #e6efe4;
  --pitch-stripe: #dfe9dc;
  --pitch-line: #a9bba5;

  /* Data: categorical slots 1 (blue) and 2 (orange). Validated against the pitch (#e6efe4) and the
     panel surface: both >= 3:1, CVD separation 25 (scripts/validate_palette.js of the dataviz method).
     The orange is the palette's darker step; the lighter #eb6834 is only 2.7:1 on the pitch. */
  --pass-ok: #2a78d6;
  --pass-fail: #d95926;
  --shot: #2a78d6;
  --goal: #d95926;
  --eng-python: #2a78d6;
  --eng-rust: #d95926;

  /* Sequential blue ramp (steps 250 → 700). The lightest step is the smallest non-zero count and
     still stands out from the pitch (1.8:1, 1.7:1 on the mowing stripes); empty zones show the pitch. */
  --heat-0: #86b6ef;
  --heat-1: #6da7ec;
  --heat-2: #5598e7;
  --heat-3: #3987e5;
  --heat-4: #256abf;
  --heat-5: #184f95;
  --heat-6: #0d366b;

  /* Status (always paired with text). */
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --warn-bg: #fff6e0;
  --error-bg: #fbe8e6;

  --font-display: Bahnschrift, "DIN Alternate", "DIN 2014", "D-DIN", "Barlow Semi Condensed", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 12px;
  --radius-sm: 7px;
  --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0f1512;
    --surface: #171e1a;
    --surface-2: #1e2722;
    --ink: #e8eee9;
    --ink-2: #b8c4bc;
    --muted: #8b978f;
    --line: #2a352f;
    --line-strong: #3d4a42;
    --accent: #5cc49b;
    --accent-ink: #0c1f17;
    --accent-soft: #1f3a2f;
    --focus: #7fd6b2;

    --pitch: #15201a;
    --pitch-stripe: #19251e;
    --pitch-line: #3e5547;

    --pass-ok: #3987e5;
    --pass-fail: #d95926;
    --shot: #3987e5;
    --goal: #d95926;
    --eng-python: #3987e5;
    --eng-rust: #d95926;

    /* Dark mode: near-zero is the dark end (step 650, 1.7:1 on the pitch) so sparse zones recede but stay visible. */
    --heat-0: #104281;
    --heat-1: #184f95;
    --heat-2: #256abf;
    --heat-3: #3987e5;
    --heat-4: #6da7ec;
    --heat-5: #9ec5f4;
    --heat-6: #cde2fb;

    --warn-bg: #352c14;
    --error-bg: #3a1c1a;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.5 var(--font-body);
  overflow-x: hidden;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
}

a {
  color: var(--accent);
}

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

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -40px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-sm);
  z-index: 50;
}

.skip-link:focus {
  top: 8px;
}

/* ---- Page frame ---------------------------------------------------------------------------- */

.masthead,
.toolbar,
.notice,
.summary,
.charts,
.lower,
.footer {
  max-width: 1480px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

@media (min-width: 900px) {
  :root {
    --gutter: 28px;
  }
}

/* ---- Masthead ------------------------------------------------------------------------------ */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
  padding-top: 24px;
  padding-bottom: 18px;
}

.brand h1 {
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.01em;
}

.match-line {
  margin: 6px 0 0;
  color: var(--ink-2);
  font-size: 14px;
}

.engine-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.segmented {
  display: inline-flex;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
}

.segmented legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.segmented label {
  position: relative;
  display: inline-flex;
}

.segmented input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.segmented span {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--ink-2);
  transition: background-color 0.15s, color 0.15s;
}

.segmented input:checked + span {
  background: var(--accent);
  color: var(--accent-ink);
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.segmented input:disabled {
  cursor: not-allowed;
}

.segmented input:disabled + span {
  opacity: 0.55;
}

.engine-status {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.engine-status::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line-strong);
  flex: none;
}

.engine-status[data-status="loading"]::before {
  background: var(--warning);
  animation: pulse 1.2s ease-in-out infinite;
}

.engine-status[data-status="ready"]::before {
  background: var(--good);
}

.engine-status[data-status="unavailable"]::before {
  background: var(--critical);
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

/* ---- Toolbar ------------------------------------------------------------------------------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px 28px;
  padding-top: 14px;
  padding-bottom: 14px;
  border-block: 1px solid var(--line);
  background: var(--surface);
  max-width: none;
}

.toolbar > .toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
}

@media (min-width: 1480px) {
  .toolbar {
    padding-inline: max(var(--gutter), calc((100vw - 1480px) / 2 + var(--gutter)));
  }
}

.data-group {
  padding-right: 28px;
  border-right: 1px solid var(--line);
}

.filter-group {
  flex: 1 1 520px;
}

/* Reset sits on the controls' baseline row, also when it wraps. */
.filter-group > .btn {
  align-self: flex-end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.field-label {
  font-size: 13px;
  color: var(--muted);
}

.field-label output {
  color: var(--ink);
  font-weight: 600;
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}

.inline {
  display: flex;
  gap: 8px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%237d8a82' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 7px 30px 7px 10px;
  min-height: 36px;
  max-width: 100%;
  min-width: 132px;
}

#player-select {
  width: 200px;
}

select:disabled {
  opacity: 0.55;
}

.btn {
  font: inherit;
  font-size: 14px;
  line-height: 1.2;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  min-height: 36px;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: var(--surface-2);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 88%, var(--ink));
}

.btn-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--accent);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Two overlaid range inputs make one from–to minute slider. */
.field-minutes {
  min-width: 180px;
  flex: 1 1 180px;
  max-width: 280px;
}

.dual-range {
  --from: 0;
  --to: 1;
  position: relative;
  height: 36px;
}

.dual-range::before,
.dual-fill {
  content: "";
  position: absolute;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  border-radius: 2px;
}

.dual-range::before {
  left: 9px;
  right: 9px;
  background: var(--line);
}

.dual-fill {
  left: calc(9px + (100% - 18px) * var(--from));
  right: calc(9px + (100% - 18px) * (1 - var(--to)));
  background: var(--accent);
}

.dual-range input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  background: none;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
}

.dual-range input::-webkit-slider-runnable-track {
  background: transparent;
  height: 36px;
}

.dual-range input::-moz-range-track {
  background: transparent;
}

.dual-range input::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 18px;
  height: 18px;
  margin-top: 9px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  cursor: grab;
}

.dual-range input::-moz-range-thumb {
  pointer-events: auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  cursor: grab;
}

.dual-range input:focus-visible {
  outline: none;
}

.dual-range input:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--focus);
}

.dual-range input:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--focus);
}

.dual-range input:disabled::-webkit-slider-thumb {
  border-color: var(--line-strong);
  cursor: not-allowed;
}

.dual-range input:disabled::-moz-range-thumb {
  border-color: var(--line-strong);
}

/* Before data loads the slider shows its full (inactive) range in neutral grey. */
.dual-range:has(input:disabled) .dual-fill {
  background: var(--line-strong);
}

/* ---- Notice -------------------------------------------------------------------------------- */

.notice {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.notice[hidden] {
  display: none;
}

.notice p {
  margin: 0;
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--warning);
  background: var(--warn-bg);
}

.notice[data-kind="error"] p {
  border-left-color: var(--critical);
  background: var(--error-bg);
}

.notice p::before {
  content: "Note: ";
  font-weight: 600;
}

.notice[data-kind="error"] p::before {
  content: "Error: ";
}

/* ---- Summary tiles ------------------------------------------------------------------------- */

.summary {
  padding-top: 18px;
  padding-bottom: 6px;
}

.filter-line {
  margin: 0 0 10px;
  color: var(--ink-2);
  font-size: 14px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.tile {
  padding: 12px 18px 14px;
  min-width: 0;
}

.tile + .tile {
  border-left: 1px solid var(--line);
}

.tile dt {
  font-size: 13px;
  color: var(--muted);
}

.tile dd {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: clamp(26px, 3.2vw, 38px);
  line-height: 1.1;
  font-weight: 600;
}

.tile dd.tile-sub {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-2);
}

@media (max-width: 720px) {
  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tile + .tile {
    border-left: 0;
  }

  .tile {
    border-top: 1px solid var(--line);
  }

  .tile:nth-child(-n + 2) {
    border-top: 0;
  }

  .tile:nth-child(even) {
    border-left: 1px solid var(--line);
  }

  .tile:last-child {
    grid-column: 1 / -1;
    border-left: 0;
  }

  .data-group {
    padding-right: 0;
    border-right: 0;
  }

  .field,
  .field-minutes {
    flex: 1 1 100%;
    max-width: none;
  }

  select,
  #player-select {
    width: 100%;
    min-width: 0;
  }

  .inline select {
    flex: 1;
  }
}

/* ---- Charts -------------------------------------------------------------------------------- */

.charts {
  display: grid;
  gap: 16px;
  padding-top: 16px;
  padding-bottom: 8px;
  grid-template-columns: minmax(0, 1fr);
}

.charts:focus {
  outline: none;
}

@media (min-width: 760px) {
  .charts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-pass,
  .stage-status {
    grid-column: 1 / -1;
  }
}

/* Wide: the pass map on the left, shot map and heatmap stacked on the right. The column ratio keeps
   the two sides close in height; the pass map card spans both rows and centres its pitch in any
   height left over, so no empty block opens under it. */
@media (min-width: 1200px) {
  .charts {
    grid-template-columns: minmax(0, 2.6fr) minmax(0, 1fr);
  }

  .chart-pass {
    grid-column: 1;
    grid-row: span 2;
  }

  .chart-pass .pitch-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

.stage-status {
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 14px;
}

.stage-status[hidden] {
  display: none;
}

.chart {
  margin: 0;
  padding: 14px 16px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 16px;
}

.chart-head h2 {
  font-size: 21px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
}

.toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  margin: 0;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  font-size: 13px;
  color: var(--ink-2);
}

.key {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-label {
  color: var(--muted);
}

.key-pass {
  stroke-width: 2;
}

.key-pass.ok {
  stroke: var(--pass-ok);
}

.key-pass.fail {
  stroke: var(--pass-fail);
  stroke-dasharray: 5 3.5;
}

.key-head.ok {
  fill: var(--pass-ok);
}

.key-head.fail {
  fill: none;
  stroke: var(--pass-fail);
  stroke-width: 1.6;
}

.key-goal {
  fill: var(--goal);
}

.key-shot {
  fill: color-mix(in srgb, var(--shot) 22%, transparent);
  stroke: var(--shot);
  stroke-width: 1.5;
}

.size-key-wrap {
  display: inline-flex;
  align-items: center;
}

.size-key circle {
  fill: color-mix(in srgb, var(--shot) 14%, transparent);
  stroke: var(--muted);
  stroke-width: 1;
}

.size-key text {
  font-size: 12px;
  fill: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.heat-legend .ramp {
  display: inline-block;
  width: 140px;
  height: 10px;
  border-radius: 3px;
}

.ramp-tick {
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

.pitch-wrap {
  position: relative;
  transition: opacity 0.2s;
}

.charts.is-busy .pitch-wrap,
.charts.is-busy figcaption {
  opacity: 0.5;
}

.chart figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 16px;
  font-size: 13.5px;
  color: var(--ink-2);
}

.caption-text {
  flex: 1 1 260px;
}

.attack {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  white-space: nowrap;
}

.attack path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---- Pitch SVG ----------------------------------------------------------------------------- */

svg.pitch {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  touch-action: pan-y;
}

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

.pitch .grass {
  fill: var(--pitch);
}

.pitch .stripe {
  fill: var(--pitch-stripe);
}

.pitch-lines rect,
.pitch-lines line,
.pitch-lines circle,
.pitch-lines path {
  fill: none;
  stroke: var(--pitch-line);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.pitch-lines .spot {
  fill: var(--pitch-line);
  stroke: none;
}

.pitch-overlay {
  fill: transparent;
  pointer-events: all;
  cursor: crosshair;
}

/* Pass map. No per-line opacity: it lowers contrast and makes every line its own paint layer. */
.pass {
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
}

.pass.ok {
  stroke: var(--pass-ok);
}

.pass.fail {
  stroke: var(--pass-fail);
  stroke-dasharray: 5 3.5;
}

.pass-bulk {
  fill: none;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  stroke-opacity: 0.45;
}

.pass-bulk.ok {
  stroke: var(--pass-ok);
}

.pass-bulk.fail {
  stroke: var(--pass-fail);
  stroke-dasharray: 4 3;
}

.head.ok {
  fill: var(--pass-ok);
}

.head.fail {
  fill: none;
  stroke: var(--pass-fail);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.head.hl {
  fill: var(--ink);
}

.head.hl-fail {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.pitch.has-hl .passes,
.pitch.has-hl .pass-bulk {
  opacity: 0.3;
}

.pass-hl {
  stroke: var(--ink);
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
}

/* A highlighted failed pass keeps its dashed line and open head. */
.pass-hl.fail {
  stroke-dasharray: 6 4;
}

/* Shot map */
.shot {
  fill: color-mix(in srgb, var(--shot) 22%, transparent);
  stroke: var(--shot);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.shot.goal {
  fill: var(--goal);
  stroke: var(--pitch);
  stroke-width: 2;
}

/* Bulk mode (thousands of shots): one path per kind, filled as a union. */
.shot-bulk {
  fill: color-mix(in srgb, var(--shot) 22%, transparent);
  stroke: var(--shot);
  stroke-width: 1;
  stroke-opacity: 0.6;
  vector-effect: non-scaling-stroke;
}

.shot-bulk.goal {
  fill: var(--goal);
  stroke: var(--pitch);
  stroke-width: 0.75;
  stroke-opacity: 0.5;
}

.shot-hl {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}

/* Font must match LABEL_FONT in charts/shotmap.js (used to measure labels for placement). */
.goal-labels text {
  font-family: var(--font-body);
  font-size: calc(12px * var(--k, 1));
  font-weight: 600;
  fill: var(--ink);
  text-anchor: start;
  dominant-baseline: central;
  paint-order: stroke;
  stroke: var(--pitch);
  stroke-width: calc(3px * var(--k, 1));
  stroke-linejoin: round;
}

.goal-labels line {
  stroke: var(--ink-2);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

/* Heatmap */
.cell-hl {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

/* ---- Shot list + data tables --------------------------------------------------------------- */

.shot-list summary {
  cursor: pointer;
  font-size: 14px;
  color: var(--accent);
  padding: 4px 0;
}

.table-scroll {
  overflow-x: auto;
  max-width: 100%;
}

.shot-list .table-scroll {
  max-height: 320px;
  overflow-y: auto;
}

.data-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13.5px;
}

.data-table caption {
  text-align: left;
  color: var(--muted);
  font-size: 13px;
  padding-bottom: 6px;
  caption-side: top;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table thead th {
  color: var(--muted);
  font-weight: 500;
  position: sticky;
  top: 0;
  background: var(--surface);
}

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table tr.is-goal td {
  font-weight: 600;
}

/* ---- Lower panels -------------------------------------------------------------------------- */

.lower {
  display: grid;
  gap: 16px;
  padding-top: 16px;
  padding-bottom: 16px;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 1100px) {
  .lower {
    grid-template-columns: minmax(300px, 1fr) minmax(0, 2.3fr);
    align-items: start;
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  min-width: 0;
}

.panel h2 {
  font-size: 21px;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 16px;
}

.panel-head .actions {
  display: flex;
  gap: 8px;
}

.panel-note {
  color: var(--muted);
  font-size: 13.5px;
  margin: 6px 0 10px;
  max-width: 78ch;
}

.busy-note {
  color: var(--ink-2);
}

.empty {
  color: var(--muted);
  margin: 8px 0;
}

.timings-list {
  margin: 0;
  display: grid;
  gap: 0;
}

.timings-list > div {
  display: grid;
  grid-template-columns: minmax(110px, 40%) minmax(0, 1fr);
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.timings-list dt {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.timings-list dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.bench-progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 10px 0;
  font-size: 14px;
}

.bench-progress[hidden] {
  display: none;
}

.bench-progress progress {
  flex: 0 1 260px;
  height: 8px;
  accent-color: var(--accent);
}

.load-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  font-size: 14px;
}

.load-list li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex: none;
}

.swatch-python,
.bar-python {
  background: var(--eng-python);
}

.swatch-rust,
.bar-rust {
  background: var(--eng-rust);
}

.bench-error {
  color: var(--ink);
  border-left: 3px solid var(--critical);
  padding-left: 10px;
  font-size: 14px;
}

.bench-chart h3 {
  font-size: 17px;
  margin-top: 14px;
}

.bench-chart .panel-note {
  margin-bottom: 6px;
}

.multiples {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 24px;
  margin: 10px 0 16px;
}

.mini {
  margin: 0;
  display: grid;
  gap: 6px;
}

.mini figcaption {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-2);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.mini figcaption strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
}

.bar-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  border-radius: 4px;
  padding: 2px 0;
}

.bar-row:hover .bar,
.bar-row:focus-visible .bar {
  filter: brightness(1.12);
}

.bar-label {
  color: var(--ink-2);
}

.bar-track {
  display: block;
  height: 16px;
}

.bar {
  display: block;
  height: 100%;
  border-radius: 0 4px 4px 0;
}

.bar-value {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  min-width: 64px;
  text-align: right;
}

.bench-table tr.ratio-row td,
.bench-table tr.ratio-row th {
  color: var(--ink-2);
  font-style: italic;
  border-bottom-color: var(--line-strong);
}

.bench-export {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 14px;
  font-size: 14px;
  color: var(--ink-2);
}

.bench-export[hidden] {
  display: none;
}

/* ---- Footer, tooltip, drop hint ------------------------------------------------------------ */

.footer {
  padding-top: 8px;
  padding-bottom: 32px;
  color: var(--ink-2);
  font-size: 13.5px;
}

.footer p {
  margin: 0;
  max-width: 90ch;
}

.tooltip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 40;
  max-width: 300px;
  padding: 9px 12px 10px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.16);
  font-size: 13px;
  pointer-events: none;
}

.tooltip[hidden] {
  display: none;
}

.tt-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.tt-rows {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1px 12px;
  margin: 0;
}

.tt-rows dt {
  color: var(--muted);
}

.tt-rows dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.tt-note {
  margin-top: 4px;
  color: var(--ink-2);
}

.drop-hint {
  position: fixed;
  inset: 12px;
  z-index: 60;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--page) 86%, transparent);
  pointer-events: none;
  font-family: var(--font-display);
  font-size: 22px;
}

.drop-hint[hidden] {
  display: none;
}

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

@media (forced-colors: active) {
  .pass.fail,
  .pass-bulk.fail,
  .pass-hl.fail {
    stroke-dasharray: 6 4;
  }
}
