:root {
  color-scheme: light dark;
  --bg: #f6f5f1;
  --surface: #ffffff;
  --sunken: #efeee9;
  --ink: #1b1f24;
  --muted: #56606b;
  --line: #d9d7cf;
  --accent: #0d5c63;
  --accent-ink: #ffffff;
  --accent-soft: #e2efef;
  --warn: #8a5300;
  --warn-soft: #f8ecd4;
  --neutral-soft: #e9e9e6;
  --focus: #1a6fd6;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131619;
    --surface: #1b1f23;
    --sunken: #171a1e;
    --ink: #e8eaed;
    --muted: #a3acb6;
    --line: #333a41;
    --accent: #72c8cc;
    --accent-ink: #0c1719;
    --accent-soft: #1c3336;
    --warn: #f0c170;
    --warn-soft: #3a2f18;
    --neutral-soft: #272c31;
    --focus: #8ab8ff;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  overflow-wrap: break-word;
}
.top, main, .foot { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.top { padding-top: 40px; }
.brand { margin: 0 0 8px; font-size: 14px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
h1 { margin: 0 0 12px; font-size: clamp(26px, 5vw, 36px); line-height: 1.15; letter-spacing: -0.01em; text-wrap: balance; }
h1 em { font-style: normal; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 5px; }
.lede { margin: 0 0 12px; color: var(--muted); max-width: 64ch; }
.status { margin: 0; font-size: 14px; color: var(--muted); }
.live-banner { margin: 12px 0 0; padding: 10px 14px; border-radius: 10px; border: 1.5px solid var(--accent); background: var(--accent-soft); font-weight: 600; }
.live-banner.refused { border-color: var(--warn); background: var(--warn-soft); }
.live-jump { margin: 0 0 14px; }
.judge-row { margin: 8px 0 0; }
.live-banner button { margin-left: 8px; }
#judge-dialog { border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; max-width: min(92vw, 420px); background: var(--surface); color: var(--ink); }
#judge-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
#judge-dialog h2 { margin: 0 0 8px; font-size: 20px; }
#judge-dialog label { display: block; margin: 12px 0 6px; font-weight: 600; }
#judge-dialog input { font: inherit; width: 100%; box-sizing: border-box; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
#judge-dialog .actions { margin-top: 14px; }
.status.error { color: var(--warn); }

.step { margin-top: 40px; }
h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font-size: 21px; line-height: 1.25; }
.num {
  flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: 15px; font-weight: 600;
}
h3 { margin: 28px 0 8px; font-size: 17px; }
h4 { margin: 20px 0 6px; font-size: 15px; }
p { margin: 0 0 12px; }
.note { color: var(--muted); font-size: 14.5px; }
a { color: var(--accent); }
code, .id { font-family: var(--mono); font-size: 0.86em; }
.id { display: block; color: var(--muted); overflow-wrap: anywhere; }

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

/* Step 1 */
.search label { display: block; font-weight: 600; margin-bottom: 6px; }
.search-row { display: flex; gap: 8px; }
input[type="text"] {
  flex: 1; min-width: 0; padding: 11px 12px; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
input[type="text"]::placeholder { color: var(--muted); opacity: 0.85; }
button {
  font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
}
button.quiet { background: transparent; color: var(--accent); }
button.small { padding: 6px 10px; font-size: 14px; }
button:disabled, input:disabled { opacity: 0.55; cursor: default; }
#flow-note { margin: 12px 0 10px; min-height: 1.5em; }

.cards { display: grid; gap: 10px; }
.card {
  display: block; width: 100%; text-align: left; font-weight: 400; padding: 14px 16px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
}
.card:hover { border-color: var(--accent); }
.card[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.card-title { font-weight: 650; font-size: 17px; }
.card-brief { display: block; margin: 4px 0 8px; color: var(--muted); font-size: 14.5px; }
.card-meta { display: block; font-size: 13.5px; color: var(--muted); }
.strength { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.bar { display: inline-block; width: 64px; height: 6px; border-radius: 3px; background: var(--neutral-soft); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }

/* Step 2 */
fieldset.pick { margin: 0 0 8px; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; font-weight: 650; font-size: 17px; }
.options { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.option {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: start; padding: 9px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; min-width: 0;
}
.option input { margin: 5px 0 0; accent-color: var(--accent); width: 16px; height: 16px; }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.option:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.option input:focus-visible { outline: none; }
.option.off { background: transparent; border-style: dashed; cursor: default; }
.options.compact { grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); }
.option.compact { padding: 7px 10px; }
.option.compact .sub { font-size: 12.5px; }
.option.off .name { color: var(--muted); }
.option .text { min-width: 0; }
.name { font-weight: 600; }
.sub { display: block; font-size: 13.5px; color: var(--muted); }
.suggest { margin: 14px 0 0; padding: 0 16px 2px; background: var(--sunken); border: 1px solid var(--line); border-radius: 10px; }
.suggest > summary { padding: 10px 0; cursor: pointer; font-weight: 600; }
.suggest > summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 10px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.cands { list-style: none; margin: 0 0 12px; padding: 0; }
.cands li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.cands .text { flex: 1 1 300px; min-width: 0; }
.cands .off { flex: none; font-style: italic; }

/* Tables that turn into stacked cards on a phone */
.table-wrap { margin: 0 0 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; vertical-align: top; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); }
th { font-size: 13px; font-weight: 600; color: var(--muted); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
@media (max-width: 640px) {
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; }
  table.stack tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { display: grid; grid-template-columns: minmax(0, 46%) minmax(0, 1fr); gap: 10px; padding: 2px 0; border: 0; text-align: left; white-space: normal; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 13px; }
  table.stack td.lead { display: block; padding-bottom: 4px; }
  table.stack td.lead::before { content: none; }
}

/* Step 3 */
.verdict {
  padding: 18px 18px 14px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--line); border-left: 6px solid var(--muted);
}
.verdict.better { border-left-color: var(--accent); }
.verdict.leaning { border-left-color: var(--warn); }
.kind { display: inline-block; margin: 0 0 8px; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--neutral-soft); }
.better .kind { background: var(--accent-soft); color: var(--accent); }
.leaning .kind { background: var(--warn-soft); color: var(--warn); }
.headline { margin: 0 0 6px; font-size: 22px; line-height: 1.25; font-weight: 650; text-wrap: balance; }
.verdict p:last-child { margin-bottom: 0; }
.facts { margin: 14px 0 0; padding-left: 20px; }
.facts li { margin-bottom: 4px; }
.yes { color: var(--accent); font-weight: 600; }
.no { color: var(--warn); font-weight: 600; }
.notes { margin: 0 0 12px; padding: 10px 14px 10px 32px; background: var(--warn-soft); border-radius: 8px; }
.notes li { margin: 2px 0; }
blockquote { margin: 0 0 12px; padding: 10px 14px; background: var(--sunken); border-left: 3px solid var(--line); border-radius: 0 8px 8px 0; font-size: 15px; }
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }
.tools li { padding: 7px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.tools .sub { font-size: 13px; }
ul.plain { margin: 0 0 12px; padding-left: 20px; }
ul.plain li { margin-bottom: 3px; }
.evidence code { overflow-wrap: anywhere; }
.tag { display: inline-block; padding: 0 7px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--warn-soft); color: var(--warn); white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 20px 0 8px; }
.actions .note { margin: 0; }

.g-box { fill: var(--sunken); stroke: var(--line); stroke-width: 1; }
.g-box.hot { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.g-box.src { fill: none; stroke-dasharray: 4 3; }
.g-kind { fill: var(--muted); font: 600 10px var(--sans); letter-spacing: 0.06em; text-transform: uppercase; }
.g-main { fill: var(--ink); font: 600 13px var(--sans); }
.g-sub { fill: var(--muted); font: 11.5px var(--sans); }
.g-edge { stroke: var(--muted); stroke-width: 1.25; fill: none; }
.g-dash { stroke-dasharray: 4 3; }
.g-arrow { fill: var(--muted); }
.g-rel { fill: var(--muted); font: 9.5px var(--mono); }

.foot { margin-top: 56px; padding-top: 20px; padding-bottom: 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.foot p { margin-bottom: 8px; }

/* ---- the result as a fight card ---------------------------------------------------------------------------- */
:root { --side-a: #2f6fb7; --side-b: #c9722b; --win: #12683f; --win-ink: #ffffff; --stop: #9b2c2c; --stop-soft: #fbeaea; }
@media (prefers-color-scheme: dark) { :root { --side-a: #6aa5e6; --side-b: #e39a5a; --win: #1f7d50; --stop: #f0a3a3; --stop-soft: #3a1f1f; } }
.center { text-align: center; }
.tolerance { border: 0; padding: 0; margin: 0 0 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tolerance legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.tolerance .option.on { border-color: var(--accent); background: var(--accent-soft); }
.fighters { display: grid; grid-template-columns: 1fr 56px 1fr; align-items: stretch; }
.fighter { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; min-width: 0; }
.fighter.a { border-top: 6px solid var(--side-a); }
.fighter.b { border-top: 6px solid var(--side-b); text-align: right; }
.fighter .name { font-size: 21px; font-weight: 700; overflow-wrap: anywhere; }
.fighter .id { font: 12.5px var(--mono); color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.vs { display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); }
.rounds { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 0; margin: 12px 0 8px; }
.rounds li { display: contents; }
.round { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px; cursor: pointer; }
.round:hover, .round:focus-visible { transform: translateY(-2px); box-shadow: 0 2px 0 var(--ink); }
.round.a { background: var(--side-a); } .round.b { background: var(--side-b); } .round.tie { background: var(--muted); }
.round.sole { outline: 2px dashed var(--ink); outline-offset: 2px; }
.round.neither { opacity: 0.55; }
.legend { text-align: center; font-size: 13.5px; color: var(--muted); margin: 0 0 22px; }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin: 0 5px 0 14px; }
.key.a { background: var(--side-a); } .key.b { background: var(--side-b); }
.key.both { background: var(--ink); }
.key.sole { outline: 2px dashed var(--ink); outline-offset: 1px; width: 9px; height: 9px; }
.key.neither { background: var(--muted); opacity: 0.55; }
.tape { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px 18px; margin-bottom: 18px; }
.tape-row { display: grid; grid-template-columns: 1fr minmax(170px, 260px) 1fr; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tape-row:last-child { border-bottom: 0; }
.tape-row .val { font-weight: 650; font-size: 17px; }
.tape-row .val.l { text-align: right; color: var(--side-a); } .tape-row .val.r { text-align: left; color: var(--side-b); }
.tape-row .lab { text-align: center; font-size: 14.5px; }
.tape-row .lab small { display: block; color: var(--muted); font-size: 12.5px; }
.tape-row.kid { padding: 5px 0; border-bottom: 0; }
.tape-row.kid .lab { font-size: 13px; color: var(--muted); }
.tape-row.kid .val { font-size: 14px; font-weight: 500; }
.fig.bad { color: var(--stop); text-decoration: underline; text-decoration-thickness: 2px; }
.fig.none { color: var(--muted); font-weight: 500; }
.tape-head { padding: 14px 0 6px; font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); text-align: center; border-bottom: 1px solid var(--line); }
.tape-head .plainer { display: block; text-transform: none; letter-spacing: 0; font-weight: 400; margin-top: 4px; }
select.level { display: block; margin: 5px auto 0; font: inherit; font-size: 13px; padding: 2px 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--sunken); color: var(--ink); }
select.level.unforgivable { border-color: var(--stop); background: var(--stop-soft); color: var(--stop); font-weight: 600; }
select.level.serious { border-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
.band { border-radius: 12px; padding: 20px 24px; text-align: center; margin-bottom: 14px; }
.band.win { background: var(--win); color: var(--win-ink); }
.band.even { background: var(--neutral-soft); border: 1.5px dashed var(--muted); }
.band.stop { background: var(--stop-soft); border: 1.5px solid var(--stop); }
.band .band-kind { font-size: 12.5px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; opacity: 0.85; margin: 0; }
.band .headline { font-size: 23px; font-weight: 750; margin: 6px 0 10px; }
.band p { margin: 0 auto 8px; max-width: 760px; }
.band .small { font-size: 13.5px; opacity: 0.85; margin-bottom: 0; }
.band .why { list-style: none; padding: 0; margin: 0 auto 10px; max-width: 760px; font-size: 15px; }
.proof { font-size: 13.5px; color: var(--muted); text-align: center; margin: 0 0 26px; }
@media (max-width: 640px) {
  .tolerance { grid-template-columns: 1fr; }
  .fighters { grid-template-columns: 1fr 30px 1fr; }
  .fighter { padding: 12px; } .fighter .name { font-size: 17px; }
  .tape { padding: 4px 10px; }
  .tape-row { grid-template-columns: 1fr minmax(120px, 1.4fr) 1fr; gap: 6px; }
  .tape-row .val { font-size: 15px; }
  .round { width: 34px; height: 34px; }
  .band .headline { font-size: 19px; }
}
.card.far { opacity: 0.6; }
.card.far:hover, .card.far:focus-visible, .card.far[aria-pressed="true"] { opacity: 1; }

/* ---- the race ---------------------------------------------------------------------------------------------- */
.race { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin: 4px 0 22px; }
.race h4 { margin: 0 0 4px; }
.race-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 14px; }
.race-controls select { font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.lane { margin-bottom: 16px; }
.lane-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 14px; align-items: baseline; }
.lane.a .name { color: var(--side-a); } .lane.b .name { color: var(--side-b); }
.lane .name { font-weight: 700; }
.gauges { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13.5px; color: var(--muted); }
.gauge b { color: var(--ink); font-variant-numeric: tabular-nums; }
.track { position: relative; height: 34px; margin: 6px 0 4px; background: var(--sunken); border-radius: 6px; overflow: hidden; }
.tick { position: absolute; bottom: 0; width: 3px; height: 12px; background: var(--muted); border-radius: 2px 2px 0 0; }
.tick[hidden] { display: none; }
.lane.a .tick.act { background: var(--side-a); } .lane.b .tick.act { background: var(--side-b); }
.tick.act { height: 24px; width: 4px; }
.tick.check { height: 24px; background: transparent; border-left: 3px dotted var(--ink); border-radius: 0; }
.tick.timeout { height: 34px; width: 5px; background: var(--warn); }
.tick.refused { height: 24px; background: var(--warn); }
.tick.again { height: 24px; width: 4px; background: var(--ink); }
.tick.wrong { height: 34px; width: 6px; background: var(--stop); }
.tick.end { height: 34px; width: 3px; background: var(--ink); }
.tick.talk { height: 8px; }
.now { margin: 0; font-size: 13.5px; color: var(--muted); min-height: 1.4em; font-family: var(--mono); }
.outcome { margin: 4px 0 0; font-size: 14.5px; }
.outcome .pass { color: var(--win); } .outcome .fail { color: var(--stop); }
.legend.left { text-align: left; margin: 0 0 10px; }
.legend .tick { position: static; display: inline-block; vertical-align: -3px; margin: 0 6px 0 14px; }
.legend .tick.act { background: var(--side-a); }
.legend .tick.timeout, .legend .tick.wrong { height: 20px; }
.finish { margin: 0; font-weight: 650; }
.race.live { border-style: dashed; }
.race.live h4 { margin: 0 0 4px; }
.race-controls input { font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 11em; }

/* ---- the graph behind a verdict ------------------------------------------------------------------------------ */
figure.graph { margin: 16px 0 0; }
figure.graph svg { display: block; width: 100%; height: auto; }
figure.graph figcaption { margin-top: 6px; font-size: 13.5px; color: var(--muted); }
.glink { stroke: var(--line); stroke-width: 1; }
.glink.ring { stroke: var(--ink); stroke-width: 1.6; }
.glink.live { stroke: var(--ink); stroke-width: 1.4; stroke-dasharray: 4 4; }
.gnode { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.gnode.a { stroke: var(--side-a); stroke-width: 2.5; } .gnode.b { stroke: var(--side-b); stroke-width: 2.5; }
.glabel { font: 600 13px var(--sans); fill: var(--ink); }
.gdot.a { fill: var(--side-a); } .gdot.b { fill: var(--side-b); } .gdot.tie { fill: var(--muted); }
.gdot.ring { stroke: var(--ink); stroke-width: 3; }
.gdot.live { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 3 3; }
@media (prefers-reduced-motion: no-preference) {
  .glink.ring, .glink.live { stroke-dashoffset: 400; stroke-dasharray: 400; animation: gdraw 0.9s ease-out forwards; }
  .glink.live { animation-name: gdraw-live; }
}
@keyframes gdraw { to { stroke-dashoffset: 0; } }
@keyframes gdraw-live { to { stroke-dashoffset: 0; stroke-dasharray: 4 4; } }
