@import url("./tokens.css");

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

html { scroll-behavior: smooth; scroll-padding-top: 76px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: 1.6;
  font-feature-settings: "cv05" 1, "ss03" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--a-700); color: var(--n-1000); }

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

h1, h2, h3 { margin: 0; font-weight: 620; letter-spacing: -0.03em; line-height: 1.1; }
p { margin: 0; }
a { color: inherit; }

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "zero" 1;
}

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.shell { width: min(100% - 40px, var(--page)); margin-inline: auto; }

.eyebrow {
  font-family: var(--mono);
  font-size: var(--t-nano);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.prose { max-width: var(--measure); color: var(--ink-dim); }
.prose + .prose { margin-top: var(--sp-4); }
.prose--spaced { margin-top: var(--sp-6); }
.prose strong { color: var(--ink); font-weight: 560; }
.prose em { color: var(--ink); font-style: normal; font-weight: 560; }

code {
  font-family: var(--mono);
  font-size: 0.88em;
  color: var(--a-200);
  background: var(--n-300);
  border-radius: 4px;
  padding: 0.1em 0.36em;
}

/* ============================================================ top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px) saturate(1.3);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.topbar[data-stuck="true"] { border-bottom-color: var(--border); }

.topbar__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  height: 56px;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 640;
  letter-spacing: -0.03em;
  text-decoration: none;
  margin-right: auto;
}
.wordmark svg { display: block; }

.navlinks { display: flex; gap: var(--sp-4); }
.navlinks a {
  font-size: var(--t-small);
  color: var(--ink-dim);
  text-decoration: none;
  padding: 4px 2px;
  transition: color 0.15s;
}
.navlinks a:hover { color: var(--ink); }

.ghost-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--t-small);
  color: var(--ink-dim);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 5px 11px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.ghost-link:hover { color: var(--ink); border-color: var(--border-strong); background: var(--surface); }

/* ============================================================ instrument */

.instrument {
  position: relative;
  padding: var(--sp-7) 0 var(--sp-8);
  overflow: hidden;
}

/* A single soft amber bloom behind the device. It is the only decoration on the
   page and it exists to stop a near-black hero reading as an empty box. */
.instrument::before {
  content: "";
  position: absolute;
  top: -18%;
  left: 50%;
  width: min(1100px, 120vw);
  aspect-ratio: 2 / 1;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgb(227 151 36 / 0.13), transparent 70%);
  pointer-events: none;
}

.instrument__head {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-5);
  margin-bottom: var(--sp-6);
}

.headline {
  font-size: var(--t-display);
  font-weight: 660;
  letter-spacing: -0.045em;
  line-height: 0.95;
  max-width: 15ch;
}
.headline em {
  font-style: normal;
  color: var(--accent);
}

.headline-note {
  max-width: 34ch;
  font-size: var(--t-small);
  color: var(--ink-dim);
  padding-bottom: 6px;
}

/* --- the device --- */

.device {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 336px;
  height: clamp(400px, 58vh, 580px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.viewport {
  position: relative;
  height: 100%;
  background: #0a0a09;
  border-right: 1px solid var(--border);
}
.viewport video,
.viewport canvas.overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* people expect to see a mirror of themselves */
}

.viewport__idle {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--sp-4);
  padding: var(--sp-6);
  text-align: center;
  background:
    radial-gradient(120% 90% at 50% 0%, var(--n-200), #0a0a09 72%);
}
.device[data-live="true"] .viewport__idle { display: none; }

.viewport__idle h2 {
  font-size: var(--t-h3);
  font-weight: 560;
  letter-spacing: -0.02em;
}
.viewport__idle p { max-width: 40ch; font-size: var(--t-small); color: var(--ink-dim); }

.viewport__hint {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 3;
  max-width: min(90%, 46ch);
  margin: 0;
  padding: 9px 14px;
  text-align: center;
  font-size: var(--t-micro);
  color: var(--n-1000);
  background: color-mix(in srgb, var(--n-100) 88%, transparent);
  border: 1px solid var(--a-700);
  border-radius: var(--r-sm);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s;
}
.device[data-live="true"][data-no-hand="true"] .viewport__hint { opacity: 1; visibility: visible; }

/* corner brackets: the frame reads as a viewfinder, not a card */
.brackets { position: absolute; inset: 14px; pointer-events: none; z-index: 2; }
.brackets span {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--n-600);
}
.brackets span:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.brackets span:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.brackets span:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.brackets span:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.device[data-live="true"] .brackets span { border-color: var(--a-700); }

.btn {
  font: inherit;
  font-size: var(--t-small);
  font-weight: 540;
  color: var(--ink);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
}
.btn:hover:not(:disabled) { background: var(--n-300); border-color: var(--border-strong); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn--primary {
  color: #22160a;
  background: var(--a-300);
  border-color: var(--a-300);
  font-weight: 620;
  padding: 11px 22px;
  font-size: var(--t-body);
}
.btn--primary:hover:not(:disabled) { background: var(--a-200); border-color: var(--a-200); }

.kbd {
  font-family: var(--mono);
  font-size: var(--t-nano);
  color: var(--ink-faint);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
}

/* --- readout panel --- */

.readout {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.readout__status {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: var(--t-nano);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--n-600);
  flex: none;
}
.readout__status[data-kind="ok"] .dot { background: var(--good); box-shadow: 0 0 0 3px rgb(111 191 115 / 0.16); }
.readout__status[data-kind="error"] .dot { background: var(--bad); }
.readout__status[data-kind="busy"] .dot { background: var(--a-300); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }

/* the big letter, with a progress ring that fills as the sign is held */
.glyph {
  position: relative;
  display: grid;
  place-items: center;
  padding: var(--sp-5) 0 var(--sp-3);
}
.glyph__ring { display: block; transform: rotate(-90deg); }
.glyph__ring circle { fill: none; stroke-width: 2; }
.glyph__ring .track { stroke: var(--n-300); }
.glyph__ring .progress {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: var(--circ);
  stroke-dashoffset: var(--circ);
  transition: stroke-dashoffset 0.09s linear;
}
.glyph__letter {
  position: absolute;
  font-size: 4.25rem;
  font-weight: 620;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition: color 0.15s;
}
.glyph__letter[data-idle="true"] { color: var(--n-700); }
.glyph__letter[data-committed="true"] { color: var(--accent); }

.ranked { list-style: none; margin: 0; padding: 0 var(--sp-4) var(--sp-4); display: grid; gap: 7px; }
.ranked li {
  display: grid;
  grid-template-columns: 1.25rem 1fr 2.75rem;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--t-micro);
  color: var(--ink-dim);
}
.ranked b { font-family: var(--mono); font-weight: 600; color: var(--ink); }
.ranked .track {
  height: 4px;
  border-radius: 2px;
  background: var(--n-300);
  overflow: hidden;
}
.ranked .track i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--a-600);
  width: var(--w, 0%);
  transition: width 0.12s linear;
}
.ranked li:first-child .track i { background: var(--accent); }
.ranked .pct { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }

.buffer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: var(--sp-4);
}
.buffer__label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: var(--t-nano);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.buffer__value {
  display: block;
  min-height: 2.4rem;
  margin: var(--sp-2) 0 var(--sp-3);
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--ink);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.buffer__value::-webkit-scrollbar { display: none; }
.buffer__value:empty::after {
  content: "awaiting a steady sign";
  font-size: var(--t-micro);
  letter-spacing: 0;
  font-weight: 400;
  color: var(--n-800);
}
.buffer__actions { display: flex; gap: var(--sp-2); }
.buffer__actions .btn { flex: 1; padding: 6px 10px; font-size: var(--t-micro); }

/* --- the strip under the device --- */

.statusstrip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-5);
  margin-top: var(--sp-3);
  padding: 0 var(--sp-1);
  font-family: var(--mono);
  font-size: var(--t-nano);
  letter-spacing: 0.05em;
  color: var(--n-800);
}
.statusstrip b { color: var(--n-900); font-weight: 500; }

/* ============================================================ sections */

.section { padding: var(--sp-9) 0; border-top: 1px solid var(--n-300); }
.section__head { margin-bottom: var(--sp-7); }
.section__head h2 { font-size: var(--t-h1); margin: var(--sp-3) 0 var(--sp-4); max-width: 20ch; }

/* --- the headline metric --- */

.verdict {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: var(--sp-7);
  align-items: center;
  padding: var(--sp-7);
  background: linear-gradient(180deg, var(--surface), var(--n-100));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.verdict__figure { font-family: var(--mono); }
.verdict__value {
  font-size: clamp(3.5rem, 2rem + 5vw, 5.5rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 0.9;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.verdict__caption {
  margin-top: var(--sp-3);
  font-family: var(--sans);
  font-size: var(--t-h3);
  font-weight: 560;
  letter-spacing: -0.02em;
  color: var(--ink);
  max-width: 22ch;
}
.verdict__sub { margin-top: var(--sp-3); font-family: var(--sans); font-size: var(--t-small); color: var(--ink-dim); max-width: 34ch; }

/* --- cards --- */

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: var(--sp-4);
  margin-top: var(--sp-4);
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  min-width: 0;
}
.card--wide { grid-column: 1 / -1; }
.card__title {
  font-size: var(--t-h3);
  font-weight: 580;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-2);
}
.card__note { font-size: var(--t-small); color: var(--ink-dim); max-width: var(--measure); }
.card__note + .chart, .card__title + .chart { margin-top: var(--sp-5); }

/* ============================================================ charts */

.chart { min-width: 0; }

/* comparison: two bars, one emphasised, one deliberately muted */
.cmp { display: grid; gap: var(--sp-4); }
.cmp__row { display: grid; grid-template-columns: 1fr; gap: 6px; }
.cmp__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-3);
  font-size: var(--t-small);
}
.cmp__name { color: var(--ink); font-weight: 540; }
.cmp__row[data-muted="true"] .cmp__name { color: var(--ink-dim); font-weight: 440; }
.cmp__val { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--accent); }
.cmp__row[data-muted="true"] .cmp__val { color: var(--ink-faint); }
.cmp__track { height: 14px; background: var(--n-300); border-radius: 4px; overflow: hidden; }
.cmp__fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent-fill);
  width: 0;
  transition: width 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.cmp__row[data-muted="true"] .cmp__fill { background: var(--n-600); }
.cmp__sub { font-size: var(--t-micro); color: var(--ink-faint); }
.cmp__gap {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--n-300);
  border-left: 2px solid var(--accent-fill);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: var(--t-small);
  color: var(--ink-dim);
}
.cmp__gap b { font-family: var(--mono); color: var(--accent); font-size: var(--t-h3); font-weight: 700; }

/* fold dot plot */
.dots { position: relative; padding: var(--sp-6) 0 var(--sp-5); }
.dots__axis { position: relative; height: 1px; background: var(--n-400); }
.dots__mean {
  position: absolute;
  top: -22px;
  bottom: -10px;
  width: 1px;
  background: color-mix(in srgb, var(--accent) 55%, transparent);
}
.dots__mean span {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: var(--mono);
  font-size: var(--t-nano);
  color: var(--accent);
}
.dots__pt {
  position: absolute;
  top: -6px;
  width: 13px;
  height: 13px;
  margin-left: -6.5px;
  border-radius: 50%;
  background: var(--accent-fill);
  border: 2px solid var(--n-100);
  cursor: default;
}
.dots__pt span {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: var(--t-nano);
  color: var(--ink-faint);
}
.dots__ticks {
  display: flex;
  justify-content: space-between;
  margin-top: var(--sp-5);
  font-family: var(--mono);
  font-size: var(--t-nano);
  color: var(--n-800);
}

/* per-letter bars */
.letters { display: grid; gap: 5px; }
.letters__row {
  display: grid;
  grid-template-columns: 1.4rem 1fr 3rem;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--t-micro);
  /* The interactive rows are real buttons; strip the chrome, keep the semantics. */
  width: 100%;
  padding: 2px 0;
  margin: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: inherit;
  font-family: inherit;
  text-align: left;
}
button.letters__row { cursor: pointer; }
button.letters__row:hover { background: var(--n-200); }
.letters__row b { font-family: var(--mono); font-weight: 600; color: var(--ink-dim); }
.letters__row[data-weak="true"] b { color: var(--accent); }
.letters__track { height: 9px; background: var(--n-300); border-radius: 3px; overflow: hidden; }
.letters__fill { height: 100%; border-radius: 3px; background: var(--a-600); width: var(--w); }
.letters__row[data-weak="true"] .letters__fill { background: var(--accent-fill); }
.letters__val { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; color: var(--ink-faint); }

/* confusion matrix */
.matrix-scroll { overflow-x: auto; padding-bottom: var(--sp-3); }
.matrix { border-collapse: separate; border-spacing: 2px; font-family: var(--mono); font-size: var(--t-nano); }
.matrix th { font-weight: 500; color: var(--n-800); padding: 0; }
.matrix th[scope="col"] { height: 18px; }
.matrix th[scope="row"] { width: 18px; text-align: right; padding-right: 5px; }
.matrix td {
  width: 19px;
  height: 19px;
  border-radius: 3px;
  background: var(--cell, var(--n-200));
  cursor: default;
}
.matrix td[data-diag="true"] { outline: 1px solid var(--n-500); outline-offset: -1px; }
.matrix td:hover { outline: 2px solid var(--ink); outline-offset: 0; }

.matrix-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-5);
  margin-top: var(--sp-4);
  font-size: var(--t-micro);
  color: var(--ink-faint);
}
.ramp { display: flex; align-items: center; gap: var(--sp-2); }
.ramp__swatches { display: flex; gap: 2px; }
.ramp__swatches i { width: 18px; height: 10px; border-radius: 2px; }

.matrix-readout {
  min-height: 2.4em;
  margin-top: var(--sp-3);
  font-size: var(--t-small);
  color: var(--ink-dim);
}
.matrix-readout b { font-family: var(--mono); color: var(--ink); }

/* ============================================================ alphabet */

.alphabet-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: var(--sp-6);
  align-items: start;
}

.alphabet-detail {
  position: sticky;
  top: 88px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  text-align: center;
}
.alphabet-detail canvas { width: 190px; height: 190px; }
.alphabet-detail__letter {
  font-size: 2.5rem;
  font-weight: 660;
  letter-spacing: -0.04em;
  line-height: 1;
}
.alphabet-detail__stat {
  font-family: var(--mono);
  font-size: var(--t-small);
  color: var(--accent);
  margin-top: var(--sp-1);
}
.alphabet-detail__note { font-size: var(--t-micro); color: var(--ink-dim); margin-top: var(--sp-3); min-height: 3em; }

.glyphgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: var(--sp-2);
}
.glyphcell {
  position: relative;
  margin: 0;
  padding: 6px 6px 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.glyphcell:hover, .glyphcell[aria-selected="true"] {
  border-color: var(--a-700);
  background: var(--surface-raised);
  transform: translateY(-2px);
}
.glyphcell[aria-selected="true"] { border-color: var(--accent); }
.glyphcell canvas { width: 100%; height: auto; display: block; }
.glyphcell figcaption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: var(--t-micro);
  font-weight: 600;
  color: var(--ink);
}
.glyphcell figcaption span { font-weight: 400; font-size: var(--t-nano); color: var(--ink-faint); }
.glyphcell::after {
  content: "";
  position: absolute;
  left: 6px; right: 6px; bottom: 2px;
  height: 2px;
  border-radius: 1px;
  background: var(--acc, var(--n-500));
}

/* ============================================================ method */

.steps { counter-reset: step; display: grid; gap: var(--sp-4); }
.step {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: var(--sp-4);
  padding: var(--sp-5) 0;
  border-top: 1px solid var(--n-300);
}
.step::before {
  counter-increment: step;
  content: "0" counter(step);
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: var(--accent);
  padding-top: 3px;
}
.step h3 { font-size: var(--t-h3); font-weight: 580; margin-bottom: var(--sp-2); }
.step p { font-size: var(--t-small); color: var(--ink-dim); max-width: var(--measure); }

/* ============================================================ footer */

footer { border-top: 1px solid var(--n-300); padding: var(--sp-7) 0 var(--sp-8); }
.footer__grid { display: flex; flex-wrap: wrap; gap: var(--sp-5); justify-content: space-between; }
footer p { font-size: var(--t-micro); color: var(--ink-faint); max-width: 52ch; }
footer a { color: var(--ink-dim); }
footer a:hover { color: var(--accent); }

.error-note { color: var(--bad); font-size: var(--t-small); }

/* ============================================================ responsive */

@media (max-width: 1000px) {
  .device { grid-template-columns: 1fr; }
  .viewport { border-right: 0; border-bottom: 1px solid var(--border); }
  .verdict { grid-template-columns: 1fr; gap: var(--sp-5); }
  .alphabet-layout { grid-template-columns: 1fr; }
  .alphabet-detail { position: static; display: grid; grid-template-columns: auto 1fr; gap: var(--sp-4); text-align: left; align-items: center; }
  .alphabet-detail__note { min-height: 0; }
}

@media (max-width: 640px) {
  .navlinks { display: none; }
  .section { padding: var(--sp-8) 0; }
  .verdict { padding: var(--sp-5); }
  .glyph__letter { font-size: 3.5rem; }
  .alphabet-detail { grid-template-columns: 1fr; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}


/* ============================================================ additions */

.readout__hint {
  padding: 0 var(--sp-4) var(--sp-4);
  font-size: var(--t-micro);
  color: var(--n-800);
}
/* Declarative rather than a JS toggle: the same state attribute that drives the
   rest of the live styling drives this, so it cannot silently fail to fire. */
.device[data-live="true"] .readout__hint { display: none; }
.ranked li[data-placeholder="true"] b { color: var(--n-800); }
.ranked li[data-placeholder="true"] .pct { color: var(--n-800); }

.chart__foot {
  margin-top: var(--sp-3);
  font-size: var(--t-micro);
  color: var(--ink-faint);
  max-width: 52ch;
}

/* compact table under the fold dot plot */
.minitable {
  width: 100%;
  margin-top: var(--sp-5);
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: var(--t-micro);
  font-variant-numeric: tabular-nums;
}
.minitable th {
  text-align: left;
  font-weight: 500;
  color: var(--n-800);
  padding: 0 0 6px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  font-size: var(--t-nano);
  letter-spacing: 0.08em;
}
.minitable td { padding: 7px 0; color: var(--ink-dim); border-bottom: 1px solid var(--n-200); }
.minitable td.n { text-align: right; }
.minitable td.strong { color: var(--accent); font-weight: 600; }
.minitable tr:last-child td { border-bottom: 0; }

/* top confusion pairs */
.pairs { display: grid; gap: 9px; }
.pairs__row {
  display: grid;
  grid-template-columns: 4.5rem 1fr 3rem;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--t-micro);
}
.pairs__pair { display: flex; align-items: center; gap: 5px; font-family: var(--mono); }
.pairs__pair b { font-weight: 600; color: var(--ink); }
.pairs__arrow { color: var(--n-800); }
.pairs__track { height: 9px; background: var(--n-300); border-radius: 3px; overflow: hidden; }
.pairs__fill { height: 100%; border-radius: 3px; background: var(--accent-fill); width: var(--w); }
.pairs__val { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink-faint); }

/* matrix beside its own summary */
.split { display: grid; grid-template-columns: minmax(0, auto) minmax(260px, 1fr); gap: var(--sp-7); align-items: start; }
.split__side { padding-top: 2px; }

@media (max-width: 1000px) {
  /* Below the camera, a stacked readout puts the letter most of a screen away
     from the hand making it. Laid out as a row, the whole instrument stays in
     view while you sign. */
  .readout {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "status status" "glyph ranked" "buffer buffer";
    align-items: center;
  }
  .readout__status { grid-area: status; }
  .glyph { grid-area: glyph; padding: var(--sp-4); }
  .glyph__ring { width: 116px; height: 116px; }
  .glyph__letter { font-size: 3rem; }
  .ranked { grid-area: ranked; padding: var(--sp-4) var(--sp-4) var(--sp-4) 0; align-self: center; }
  .readout__hint { display: none; }
  .buffer { grid-area: buffer; }

  .cards { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; gap: var(--sp-6); }
  .device { height: auto; }
  .viewport { aspect-ratio: 4 / 3; height: auto; }
}

/* calibration dumbbells */
.bells { display: grid; gap: 8px; }
.bells__row {
  display: grid;
  grid-template-columns: 4.2rem 1fr 2.6rem;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--t-micro);
}
.bells__row b { font-family: var(--mono); font-weight: 500; color: var(--ink-faint); }
.bells__track { position: relative; height: 14px; background: var(--n-300); border-radius: 3px; }
.bells__link {
  position: absolute;
  top: 6px;
  height: 2px;
  background: var(--a-700);
  border-radius: 1px;
}
.bells__dot {
  position: absolute;
  top: 3px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  border: 2px solid var(--surface);
}
.bells__dot--says { background: var(--n-700); }
.bells__dot--is { background: var(--accent-fill); }
.bells__val { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink-faint); }
.bells__legend { display: flex; gap: var(--sp-5); margin-top: var(--sp-4); font-size: var(--t-micro); color: var(--ink-faint); }
.bells__key { display: inline-flex; align-items: center; gap: 7px; }
.bells__key .bells__dot { position: static; margin: 0; border-color: var(--surface); }
.minitable tr[data-current="true"] td { color: var(--accent); }

/* 404 */
.notfound {
  min-height: 82vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: var(--sp-4);
  padding-block: var(--sp-8);
}
.notfound .headline { max-width: 14ch; }
.notfound__actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; margin-top: var(--sp-3); }
.notfound__actions a { text-decoration: none; }
