:root {
  color-scheme: light dark;
  --bg: #f6f6f4;
  --panel: #ffffff;
  --ink: #1c1d1f;
  --muted: #5d6066;
  --line: #dedfe2;
  --accent: #b2182b;
  --accent-ink: #ffffff;
  --ok: #1a7f4b;
  --neg: #2166ac;
  --pos: #b2182b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131416;
    --panel: #1c1e21;
    --ink: #ececec;
    --muted: #a3a7ad;
    --line: #33363b;
    --accent: #e0606e;
    --accent-ink: #16171a;
    --ok: #5cc28e;
    --neg: #6ea8dc;
    --pos: #e0606e;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 1240px; margin: 0 auto; padding: 24px 20px 40px; }
h1 { font-size: 28px; line-height: 1.2; margin: 0 0 8px; text-wrap: balance; }
h2 { font-size: 15px; margin: 0 0 10px; }
.lede { max-width: 72ch; margin: 0 0 8px; color: var(--muted); }
.lede strong { color: var(--ink); }
.links { margin: 0 0 20px; display: flex; gap: 16px; flex-wrap: wrap; }
a { color: var(--accent); }
.controls { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented button, select, button.ghost {
  font: inherit; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; cursor: pointer;
}
.segmented button[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary {
  font: inherit; font-weight: 600; color: var(--accent-ink); background: var(--accent);
  border: 1px solid var(--accent); border-radius: 8px; padding: 8px 18px; cursor: pointer;
}
button:focus-visible, select:focus-visible, .thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.layout { display: grid; grid-template-columns: minmax(260px, 2fr) 3fr; gap: 16px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; max-height: 640px; overflow-y: auto; }
.thumb { position: relative; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: var(--bg); cursor: pointer; aspect-ratio: 1; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb[aria-selected="true"] { border-color: var(--accent); }
.thumb span { position: absolute; left: 0; right: 0; bottom: 0; font-size: 11px; line-height: 1.3; padding: 2px 4px; color: #fff; background: rgba(0, 0, 0, .58); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
figure { margin: 0; }
figcaption { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.pair img, .pair canvas { width: 100%; height: 260px; object-fit: contain; background: var(--bg); border-radius: 8px; display: block; }
.legend { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 8px; vertical-align: -1px; }
.sw.neg { background: var(--neg); margin-left: 0; }
.sw.pos { background: var(--pos); }
.summary { margin: 0; }
.row { display: grid; gap: 10px; }
.row.five { grid-template-columns: repeat(5, 1fr); }
.row.three { grid-template-columns: repeat(3, 1fr); }
.row.votes { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); margin-bottom: 14px; }
.card { margin: 0; }
.card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; background: var(--bg); }
.card .blank { width: 100%; aspect-ratio: 1; border-radius: 8px; background: var(--bg); border: 1px dashed var(--line, #c9ccd1); display: grid; place-items: center; padding: 6px; text-align: center; font-size: 12px; color: var(--muted); box-sizing: border-box; }
.card.hit .blank { border: 3px solid var(--ok); }
.note { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.card figcaption { margin: 5px 0 0; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.card.hit img { outline: 3px solid var(--ok); outline-offset: -3px; }
.hitmark { color: var(--ok); font-weight: 700; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
footer { color: var(--muted); font-size: 14px; max-width: 90ch; }
footer strong { color: var(--ink); }
[hidden] { display: none !important; }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .picker { max-height: 300px; }
  .row.five { grid-template-columns: repeat(3, 1fr); }
  .pair img, .pair canvas { height: 200px; }
}
@media (max-width: 520px) {
  .pair { grid-template-columns: 1fr; }
  .row.three { grid-template-columns: repeat(2, 1fr); }
  h1 { font-size: 23px; }
}

.pair:has(#signal-figure[hidden]) { grid-template-columns: 1fr; }
@media (min-width: 861px) {
  .pair.wide-signal { grid-template-columns: 2fr 3fr; }
  .pair.wide-signal img, .pair.wide-signal canvas { height: 340px; }
}
.pair.wide-signal canvas { cursor: zoom-in; }
.pair canvas.zoomed {
  position: fixed; inset: 0; margin: auto; width: auto; height: auto;
  max-width: 94vw; max-height: 92vh; z-index: 20; cursor: zoom-out;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .62);
}
.ramp {
  display: inline-block; width: 72px; height: 9px; border-radius: 2px; vertical-align: 0; margin: 0 4px;
  background: linear-gradient(90deg, #440154, #482878, #3e4a89, #31688e, #26828e, #1f9e89, #35b779, #6ece58, #b5de2b, #fde725);
}
