/* SPDX-License-Identifier: AGPL-3.0-only */
/* Page layout. Reads only the names in brand/tokens.css (placeholders until the brand packet arrives). */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: var(--text-base);
  line-height: var(--line); overflow-wrap: anywhere;
}
.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 var(--space-4); }
a { color: var(--link); text-underline-offset: 0.15em; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 var(--space-3); }
h1 { font-size: var(--text-h1); }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-large); margin-top: var(--space-5); }
p, ul, ol, dl, pre, blockquote { margin: 0 0 var(--space-3); }
code { font-family: var(--font-mono); font-size: 0.92em; }

:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: var(--focus-offset); }
/* visible to a screen reader only: the progress announcements, so the percentage is shown once */
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip { position: absolute; left: var(--space-3); top: -4rem; background: var(--btn-bg); color: var(--btn-text); padding: var(--space-2) var(--space-3); z-index: 10; }
.skip:focus { top: var(--space-2); }

.site-header { padding: var(--space-5) 0 var(--space-4); }
.lockup { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2) var(--space-4); }
.lockup { align-items: center; }
.lockup-name { margin: 0; font-family: var(--font-display); font-weight: 700; text-transform: lowercase; letter-spacing: -0.01em; color: var(--text); }
.lockup-parent { display: block; margin: 0; }
.wm { display: block; width: 193px; height: auto; max-width: none; }
.wm-dark { display: none; }
@media (prefers-color-scheme: dark) { .wm-light { display: none; } .wm-dark { display: block; } }
.lead { font-size: var(--text-large); max-width: 40rem; margin-top: var(--space-3); }
.page-nav ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-2); padding: var(--space-5) var(--space-4); margin-bottom: var(--space-5); }
.stage-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-5); }
@media (min-width: 52rem) { .stage-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; } }

.field-label { display: block; font-weight: 600; margin: 0 0 var(--space-2); }
textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 2px solid var(--border);
  border-radius: var(--radius-1); padding: var(--space-3); resize: vertical; min-height: 6.5rem;
}
.hint { font-size: var(--text-small); color: var(--muted); margin-bottom: var(--space-3); }
.button-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.presets { margin: var(--space-3) 0 var(--space-4); }
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: var(--radius-1); border: 2px solid var(--btn-bg);
  background: var(--btn-bg); color: var(--btn-text); padding: var(--space-2) var(--space-4); min-height: 2.75rem; text-align: left;
}
.btn.quiet { background: var(--btn-quiet-bg); color: var(--btn-quiet-text); border-color: var(--border); }
.btn[disabled] { cursor: not-allowed; background: var(--disabled-bg); color: var(--disabled-text); border-color: var(--border); }
.btn[hidden] { display: none; }
.btn.small { padding: var(--space-1) var(--space-3); min-width: 2.75rem; text-align: center; }
.btn[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-text); border-color: var(--btn-bg); }
.voice-load { margin: var(--space-3) 0; }

/* the input chooser: Type text, Record, Upload (text first, no icon alone) */
.input-chooser { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-2); }
.input-chooser .seg { border: 2px solid var(--seg-border); border-radius: var(--radius-1); overflow: hidden; display: inline-flex; }
.seg-opt button { display: inline-flex; align-items: center; justify-content: center; min-width: 3.5rem; min-height: 2.75rem; padding: var(--space-1) var(--space-4);
  font: inherit; font-weight: 600; background: var(--seg-bg); color: var(--seg-text); border: none; cursor: pointer; }
.seg-opt[hidden] { display: none; }
.rec-take-row { margin-top: var(--space-3); }
.rec-take-row[hidden] { display: none; }
.seg-opt + .seg-opt button { border-left: 2px solid var(--seg-border); }
.seg-opt button[aria-pressed="true"] { background: var(--seg-selected-bg); color: var(--seg-selected-text); }
.seg-opt button:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: -5px; }
.seg-opt button[aria-pressed="true"]:focus-visible { outline-color: var(--seg-selected-text); }
.privacy { min-height: 1.6em; }

/* only one input panel shows at a time */
.input-panel { display: none; margin-top: var(--space-3); }
.input-panel.shown { display: block; }

/* Record */
.rec-privacy { min-height: 1.6em; }
.rec-row { margin-bottom: var(--space-2); }
.rec-meter-row { display: flex; align-items: center; gap: var(--space-2); margin: var(--space-2) 0 var(--space-3); }
#rec-meter { border: 1px solid var(--border); border-radius: var(--radius-1); background: var(--bg); display: block; }
.rec-dot[aria-hidden="true"] { display: none; }
.rec-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--error); margin-left: var(--space-1); box-shadow: 0 0 0 2px var(--bg); }
.rec-timer { font-variant-numeric: tabular-nums; font-family: var(--font-mono); }

/* Upload */
.audio-upload-area { position: relative; border: 1px dashed var(--border); border-radius: var(--radius-1); padding: var(--space-3) var(--space-4); text-align: center; cursor: pointer; background: var(--bg); }
.audio-upload-area.drag { border-color: var(--link); background: var(--scrub-bg); }
#upload-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-title { font-weight: 600; color: var(--text); margin: 0 0 var(--space-1); }
.upload-hint { font-size: var(--text-small); color: var(--muted); margin: 0; }

/* What was said + mode */
.mode-line { min-height: 1.6em; margin-top: var(--space-1); }
.mode-line .tools-label { font-weight: 600; }
.progress-block { margin-top: var(--space-3); }
progress { width: 100%; height: 1rem; accent-color: var(--link); }
.progress-text { min-height: 1.6em; margin-bottom: 0; font-variant-numeric: tabular-nums; }
.play-row { margin-bottom: var(--space-3); }
.sample-row { margin-bottom: var(--space-2); }
.sample-note, .source-note { max-width: 40rem; }
.source-note[hidden] { display: none; }
.status { min-height: 3.2em; padding: var(--space-2) var(--space-3); border-left: 4px solid var(--border); background: var(--bg); border-radius: var(--radius-1); }
#rec-state:empty, #upload-state:empty { min-height: 0; padding: 0; border: 0; background: none; }
.error { padding: var(--space-3); border: 2px solid var(--error); background: var(--error-bg); color: var(--error); border-radius: var(--radius-1); margin-top: var(--space-3); }
.error[hidden] { display: none; }

.mouth-figure { margin: 0; }
.mouth-host { width: 100%; max-width: 34rem; margin: 0 auto; border-radius: var(--radius-2); overflow: hidden; aspect-ratio: 400 / 260; background: var(--mouth-skin); }
/* the 2D | 3D control (Brand Amendment 5): a labelled radio group, two sides of equal weight, the selected side solid deep violet with cream text */
.face-switch-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--space-2) var(--space-3); max-width: 34rem; margin: 0 auto var(--space-2); }
.seg { display: inline-flex; border: 2px solid var(--seg-border); border-radius: var(--radius-1); overflow: hidden; }
.seg-opt { position: relative; display: inline-flex; }
.seg-opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg-opt span { display: inline-flex; align-items: center; justify-content: center; min-width: 3.5rem; min-height: 2.75rem; padding: var(--space-1) var(--space-4);
  font-weight: 600; background: var(--seg-bg); color: var(--seg-text); }
.seg-opt + .seg-opt span { border-left: 2px solid var(--seg-border); }
.seg-opt input:checked + span { background: var(--seg-selected-bg); color: var(--seg-selected-text); }
.seg-opt input:focus-visible + span { outline: var(--focus-width) solid var(--seg-text); outline-offset: -5px; }
.seg-opt input:checked:focus-visible + span { outline-color: var(--seg-selected-text); }
/* both faces sit in one grid cell with the same box: swapping them moves nothing (the hidden one keeps its size) */
.face-stage { display: grid; max-width: 34rem; margin: 0 auto; }
.face-stage > .mouth-host { grid-area: 1 / 1; max-width: none; margin: 0; }
.mouth-host[data-active="false"] { visibility: hidden; pointer-events: none; }
/* the lip grab (faces/pointer-grab.mjs): a grab cursor over the mouth, grabbing while a lip is held; the stage takes the keys; a soft ring (a circle, no text) marks the pointer */
.face-stage { position: relative; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.face-stage:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: 3px; }
.face-stage[data-grab="over"] { cursor: grab; }
.face-stage[data-grab="down"], .face-stage[data-grab="down"] * { cursor: grabbing; }
.grab-ring { position: absolute; left: 0; top: 0; width: 3rem; height: 3rem; margin: -1.5rem 0 0 -1.5rem; box-sizing: border-box; border: 3px solid var(--focus);
  border-radius: 50%; background: color-mix(in srgb, var(--focus) 16%, transparent); pointer-events: none; z-index: 2; }
.grab-ring[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) { .grab-ring.pop { animation: grab-pop 0.16s ease-out; } }
@keyframes grab-pop { from { scale: 0.55; opacity: 0.4; } to { scale: 1; opacity: 1; } }
.grab-hint { max-width: 34rem; margin: var(--space-2) auto 0; text-align: center; }
#mouth-host-3d { background: #16142E; }
/* Customise the face (Brand's wording and layout): a disclosure, closed on a phone and open on a desktop; two columns when there is room, one on a phone */
.customise { margin: var(--space-4) auto 0; max-width: 34rem; border: 2px solid var(--border); border-radius: var(--radius-2); background: var(--surface); }
.customise > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 2.75rem; padding: var(--space-2) var(--space-4);
  cursor: pointer; font-weight: 700; font-size: var(--text-large); list-style: none; }
.customise > summary::-webkit-details-marker { display: none; }
.customise > summary::after { content: "Show"; font-size: var(--text-small); font-weight: 600; text-decoration: underline; }
.customise[open] > summary::after { content: "Hide"; }
.customise > summary:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: -4px; }
.cz-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr)); gap: 0 var(--space-5); padding: var(--space-2) var(--space-4) var(--space-4); }
.cz-actions { grid-column: 1 / -1; }
.cz-group { min-width: 0; margin: 0 0 var(--space-5); padding: 0; border: 0; }
.cz-legend { padding: 0; margin-bottom: var(--space-2); font-weight: 700; }
.swatches, .lip-options { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch, .lip-opt { position: relative; display: inline-flex; }
.swatch input, .lip-opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.swatch-dot { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; width: 2.75rem; height: 2.75rem; border: 2px solid var(--text);
  border-radius: 50%; background: var(--swatch); color: var(--swatch-ink); font-weight: 700; font-size: 1.25rem; }
.swatch input:checked + .swatch-dot::after { content: "\2713"; }
.swatch input:focus-visible + .swatch-dot { outline: var(--focus-width) solid var(--focus); outline-offset: 3px; }
.cz-selected { margin: var(--space-2) 0 0; }
.lip-chip { display: inline-flex; align-items: center; gap: var(--space-2); box-sizing: border-box; min-height: 2.75rem; padding: 0 var(--space-3) 0 var(--space-2); border: 2px solid var(--text);
  border-radius: 999px; background: var(--seg-bg); color: var(--seg-text); font-weight: 600; }
.lip-dot { display: inline-block; box-sizing: border-box; width: 1.5rem; height: 1.5rem; border: 2px solid var(--text); border-radius: 50%; background: var(--swatch, transparent); }
.lip-opt input:checked + .lip-chip { background: var(--seg-selected-bg); color: var(--seg-selected-text); }
.lip-opt input:checked + .lip-chip .lip-name::after { content: " \2713"; }
.lip-opt input:checked + .lip-chip .lip-dot { border-color: var(--seg-selected-text); }
.lip-opt input:focus-visible + .lip-chip { outline: var(--focus-width) solid var(--focus); outline-offset: 3px; }
.cz-slider { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-3); }
.cz-slider input[type="range"] { flex: 1 1 auto; min-width: 0; height: 2.75rem; accent-color: var(--seg-selected-bg); }
.cz-shape-out { flex: 0 0 auto; min-width: 8rem; font-size: var(--text-small); color: var(--muted); }
.cz-group .seg { display: flex; max-width: 100%; }
.cz-group .seg-opt { flex: 1 1 auto; }
.cz-group .seg-opt span { width: 100%; min-width: 0; padding: var(--space-1) var(--space-2); white-space: nowrap; }
.seg-opt input:disabled { cursor: not-allowed; }
.seg-opt input:disabled + span { background: var(--disabled-bg); color: var(--disabled-text); }
.cz-actions .button-row { margin-bottom: var(--space-2); }
.cz-share-status { min-height: 1.5em; margin: 0; }
.face-note { min-height: 1.6em; margin: var(--space-2) 0 0; text-align: center; }
.face-caption { margin: 0; text-align: center; }
.mouth-readout { margin-top: var(--space-2); min-height: 3.2em; text-align: center; color: var(--muted); font-size: var(--text-small); }

.track-block { margin-top: var(--space-5); }
.track-title { margin-top: var(--space-4); }
.track { position: relative; width: 100%; border: 1px solid var(--border); border-radius: var(--radius-1); background: var(--bg); overflow: hidden; }
.wave { display: block; width: 100%; height: 110px; }
.small-track .wave { height: 90px; }
.timeline { position: relative; height: 34px; border-top: 1px solid var(--border); }
.timeline .block {
  position: absolute; top: 2px; bottom: 2px; border-radius: 4px; border: 1px solid var(--border); color: var(--v-text);
  font-size: 0.7rem; line-height: 28px; text-align: center; overflow: hidden; white-space: nowrap; padding: 0; min-width: 2px;
}
.cursor { position: absolute; top: 0; bottom: 0; width: 3px; left: 0; background: var(--cursor); pointer-events: none; transform: translateX(-1px); }
.phoneme-text { min-height: 4.8em; max-height: 6.5em; overflow: auto; font-family: var(--font-mono); font-size: var(--text-small); padding: var(--space-2) var(--space-3); border: 1px dashed var(--border); border-radius: var(--radius-1); }

.readout { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: var(--space-2) var(--space-4); margin-bottom: var(--space-3); }
.readout div { min-height: 3.4rem; }
.readout dt { font-size: var(--text-small); color: var(--muted); }
.readout dd { margin: 0; font-size: var(--text-large); font-weight: 600; font-variant-numeric: tabular-nums; min-height: 1.6em; }

.tag { display: inline-block; font-size: var(--text-small); font-weight: 600; border: 1px solid var(--border); border-radius: 999px; padding: 0 var(--space-2); background: var(--bg); color: var(--text); vertical-align: middle; }
.step-nav { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin: var(--space-3) 0; }
.step-now { font-weight: 600; min-width: 11rem; }
.steps { list-style: none; padding: 0; display: grid; gap: var(--space-4); }
.step { border: 2px solid var(--border); border-radius: var(--radius-2); padding: var(--space-4); background: var(--bg); }
.step h3 { margin-top: 0; }
.step.current { border-color: var(--focus); border-style: solid; box-shadow: inset 6px 0 0 var(--focus); }
.sample { border-left: 4px solid var(--border); padding-left: var(--space-3); font-size: var(--text-large); }
.mini-label { font-size: var(--text-small); font-weight: 600; color: var(--muted); margin-bottom: var(--space-1); }
.code-line { font-family: var(--font-mono); word-break: break-all; min-height: 1.6em; }
.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-1); min-height: 2.2rem; }
.chips li { border: 1px solid var(--border); border-radius: var(--radius-1); padding: 0 var(--space-2); font-family: var(--font-mono); font-size: var(--text-small); background: var(--surface); color: var(--text); }
.chips.visemes li { color: var(--v-text); }
.chips.visemes li.on { outline: 3px solid var(--focus); outline-offset: 1px; font-weight: 700; }
.bars { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--space-1) var(--space-4); }
.bars li { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) 2.6rem; align-items: center; gap: var(--space-2); font-size: var(--text-small); }
.bars .bar-track { height: 0.7rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); overflow: hidden; }
.bars .bar-fill { display: block; height: 100%; width: 100%; background: var(--wave); transform-origin: 0 50%; transform: scaleX(var(--v, 0)); }
.bars .num { font-variant-numeric: tabular-nums; text-align: right; }
.glossary { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--space-3) var(--space-4); }
.glossary dt { font-weight: 700; }
.glossary dd { margin: 0; }

.code { font-family: var(--font-mono); font-size: var(--text-small); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-1); padding: var(--space-3); overflow: auto; max-width: 100%; white-space: pre; min-height: 6rem; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: var(--space-4); }

.calls h2 { margin-top: var(--space-5); }
.calls-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.call { background: var(--surface); border: 1px solid var(--border); border-top: 8px solid var(--border); border-radius: var(--radius-2); padding: var(--space-4); }
.call[data-claim="plc"] { border-top-color: var(--plc-edge); }
.call[data-claim="sonalon"] { border-top-color: var(--sonalon-edge); }
.call h3 { margin-top: 0; }
.call .links { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin: 0; padding: 0; list-style: none; }

.site-footer { border-top: 1px solid var(--border); padding: var(--space-4) 0 var(--space-6); color: var(--muted); font-size: var(--text-small); }
.site-footer a { color: var(--link); }

/* the page, calm: no transitions or smooth scrolling unless the visitor allows motion */
@media (prefers-reduced-motion: no-preference) {
  .btn { transition: background-color 0.15s ease; }
  html { scroll-behavior: smooth; }
}

/* viseme group colours, from the tokens (colour is never the only cue: every block carries its sound name) */
.viseme-sil { background: var(--v-sil); } .viseme-pp { background: var(--v-pp); } .viseme-ff { background: var(--v-ff); }
.viseme-th { background: var(--v-th); }   .viseme-dd { background: var(--v-dd); } .viseme-kk { background: var(--v-kk); }
.viseme-ch { background: var(--v-ch); }   .viseme-ss { background: var(--v-ss); } .viseme-nn { background: var(--v-nn); }
.viseme-rr { background: var(--v-rr); }   .viseme-aa { background: var(--v-aa); } .viseme-e { background: var(--v-e); }
.viseme-i { background: var(--v-i); }     .viseme-o { background: var(--v-o); }   .viseme-u { background: var(--v-u); }

/* ---- the waveform scrubber: waveform, phoneme strip and ruler are one widget, one coordinate frame (same x = same time) ---------- */
.scrub-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-3); }
.tools-label { font-weight: 600; }
.toggle { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 2.75rem; }
.toggle input { width: 1.25rem; height: 1.25rem; accent-color: var(--link); }
.scrubber {
  --scrub-wave-h: 150px; --scrub-strip-h: 38px; --scrub-ruler-h: 26px;
  position: relative; background: var(--scrub-bg); border: 1px solid var(--border); border-radius: var(--radius-2);
}
.scrubber:focus-visible { outline: var(--focus-width) solid var(--scrub-focus); outline-offset: 3px; }
.scrubber[data-empty="true"] { opacity: 0.75; }
.scroller { overflow-x: auto; overflow-y: hidden; border-radius: inherit; scroll-behavior: auto; overscroll-behavior-x: contain; }
.inner {
  display: block; width: max-content; min-width: 100%; box-sizing: border-box; padding: 0 calc(var(--scrub-size) / 2 + 4px);
  touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.scrubber[data-empty="true"] .inner { cursor: default; }
.scrubber.is-scrubbing .inner { cursor: grabbing; }
.track { position: relative; }
.scrubber .wave { display: block; width: 100%; height: var(--scrub-wave-h); }
.played-clip { position: absolute; left: 0; top: 0; width: 100%; height: var(--scrub-wave-h); clip-path: inset(0 100% 0 0); pointer-events: none; }
.played-clip .wave { position: absolute; left: 0; top: 0; }
.boundary-lines { position: absolute; left: 0; top: 0; width: 100%; height: var(--scrub-wave-h); pointer-events: none; }
.bline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--scrub-boundary); }
.scrubber .timeline { height: var(--scrub-strip-h); border-top: 1px solid var(--border); }
.scrubber .timeline .block { line-height: calc(var(--scrub-strip-h) - 6px); box-sizing: border-box; }
.timeline .block.pause { background-image: repeating-linear-gradient(135deg, transparent 0 4px, var(--scrub-boundary) 4px 6px); }
.ruler { display: block; width: 100%; height: var(--scrub-ruler-h); font-size: 0.75rem; font-family: var(--font-body); }
.wave-tip {
  position: absolute; bottom: calc(var(--scrub-strip-h) + var(--scrub-ruler-h) + 6px); left: 0; z-index: 3; max-width: 22rem; pointer-events: none;
  background: var(--scrub-tip-bg); color: var(--scrub-tip-text); font-size: var(--text-small); line-height: 1.35; padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-1); box-shadow: 0 2px 8px var(--scrub-shadow); white-space: nowrap;
}
.wave-tip[hidden] { display: none; }
.playhead {
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: var(--scrub-line);
  box-shadow: 0 0 0 1px var(--scrub-ring-inner); pointer-events: none; z-index: 2; will-change: transform;
}
.handle {
  position: absolute; left: 50%; top: calc(var(--scrub-wave-h) / 2); width: calc(var(--scrub-size) / 2); height: calc(var(--scrub-size) * 1.3);
  margin: calc(var(--scrub-size) * -0.65) 0 0 calc(var(--scrub-size) / -4); border-radius: calc(var(--scrub-size) / 4);
  background: var(--scrub-knob-bg); pointer-events: auto; cursor: grab;
  box-shadow: 0 0 0 2px var(--scrub-ring-inner), 0 0 0 4px var(--scrub-ring-outer), 0 6px 14px var(--scrub-shadow);
}
.scrubber[data-empty="true"] .handle { cursor: default; }
.handle .hit { position: absolute; inset: -14px; border-radius: 999px; } /* the touch target stays wide: the visible handle is half the token width (owner, 2026-11-18) */
.handle .grip { position: absolute; left: 50%; top: 50%; width: 10px; height: 22px; margin: -11px 0 0 -5px;
  background: repeating-linear-gradient(90deg, var(--scrub-knob-ink) 0 2px, transparent 2px 4px); }
.handle::before, .handle::after { content: none; }
.handle:hover { transform: scale(1.06); }
.scrubber.is-scrubbing .handle { transform: scale(1.1); cursor: grabbing; }
.scrubber:focus-visible .handle { box-shadow: 0 0 0 2px var(--scrub-ring-inner), 0 0 0 5px var(--scrub-focus), 0 6px 14px var(--scrub-shadow); }
@media (prefers-reduced-motion: no-preference) { .handle { transition: transform 0.12s ease; } }
.moment-text { margin: var(--space-3) 0; font-variant-numeric: tabular-nums; font-weight: 600; min-height: 1.6em; }
.scrub-actions { margin-bottom: var(--space-3); }
.downloads { margin-top: var(--space-5); }
.dl { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.dl-size { font-size: var(--text-small); font-weight: 400; min-height: 1.2em; font-variant-numeric: tabular-nums; }
.dl[aria-busy="true"] { cursor: progress; }

.why { margin: var(--space-5) 0 var(--space-2); max-width: 46rem; }
.call .claim-text + .claim-text { margin-top: 0; }

@media (max-width: 40rem) {
  .wrap { padding: 0 var(--space-3); }
  .card { padding: var(--space-4) var(--space-3); }
  .scrubber { --scrub-wave-h: 130px; }
}
.scrubber .track { border: 0; background: none; overflow: visible; border-radius: 0; }
.timeline .block.thin { border-color: transparent; }

/* ---- motion: the Natural / Raw switch and the plot "Why the mouth has mass" ------------------------------------------------------- */
:root { --plot-raw: var(--text); }
.motion { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-2) var(--space-3); margin-top: var(--space-2); }
.motion-btn { min-width: 6rem; }
.movement input[type=range], .headmotion input[type=range] { width: min(16rem, 60vw); min-height: 2.75rem; accent-color: var(--btn-bg); }
.movement-out { min-width: 3.5rem; font-variant-numeric: tabular-nums; }
.motion-help { text-align: center; margin: var(--space-2) auto 0; max-width: 30rem; }
/* Articulation: a radio group of three text labels, each a 44 px target; the real radio input sits over its label, invisible but focusable */
.articulation { margin-top: var(--space-3); }
.art-opt, .video-opt { position: relative; display: inline-flex; }
.art-opt input, .video-opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.art-opt span, .video-opt span { display: inline-flex; align-items: center; justify-content: center; min-width: 6rem; min-height: 2.75rem; padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border); border-radius: var(--radius-1); background: var(--btn-quiet-bg); color: var(--btn-quiet-text); font-weight: 600; }
.art-opt input:checked + span, .video-opt input:checked + span { background: var(--btn-bg); color: var(--btn-text); border-color: var(--btn-bg); }
.art-opt input:focus-visible + span, .video-opt input:focus-visible + span { outline: var(--focus-width) solid var(--focus); outline-offset: var(--focus-offset); }
.plot-title { font-size: var(--text-base); margin: var(--space-4) 0 var(--space-1); }
.plot { position: relative; width: 100%; border: 1px solid var(--border); border-radius: var(--radius-1); background: var(--surface); margin: var(--space-2) 0; }
.plot-canvas { display: block; width: 100%; height: 280px; }
.plot .cursor { top: 8px; bottom: 22px; left: 0; }
.plot-key { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); font-size: var(--text-small); }
.plot-key li { display: inline-flex; align-items: center; gap: var(--space-2); }
.key { display: inline-block; width: 2.2rem; background: var(--text); height: 2px; }
.key-raw { height: 2px; background: var(--plot-raw); }
.key-smooth { height: 5px; border-radius: 3px; background: var(--wave); }
.plot-text { font-variant-numeric: tabular-nums; }
@media (max-width: 40rem) { .plot-canvas { height: 250px; } }

/* ---- Download video: the button, the progress bar (a 12 px bar with an ink outline and a deep-violet fill, never animated), the options ---- */
.video { margin-top: var(--space-5); }
.video-bar { height: 12px; border: 2px solid var(--text); border-radius: 6px; background: var(--bg); overflow: hidden; box-sizing: content-box; }
.video-fill { display: block; height: 100%; width: calc(var(--p, 0) * 1%); background: var(--seg-selected-bg); }
.video-progress { margin: var(--space-3) 0; }
.video-ready { margin: 0 0 var(--space-3); }
.video-ready[hidden] { display: none; }
.video-options { margin: 0 0 var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-1); background: var(--surface); }
.video-options > summary { display: flex; align-items: center; min-height: 2.75rem; padding: var(--space-1) var(--space-3); font-weight: 600; cursor: pointer; }
.video-options-body { padding: 0 var(--space-3) var(--space-3); }
.video-sizes { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-2); }
.video-sizes .video-opt span, .video-opt span { min-width: 0; text-align: center; }

/* ---- The Kokoro voices: the status line, the button, the progress, the three hosted samples (the page's own classes; only the spacing is new) ---- */
.kokoro { margin: var(--space-4) 0; }
.kokoro .status { min-height: 0; margin-bottom: var(--space-3); }
.kokoro [hidden] { display: none; }
.kokoro-sample { margin-bottom: var(--space-2); }
.kokoro-sample .hint { margin: var(--space-1) 0 0; }

/* ---- the loading panel (voices and the 3D head): one row per thing that loads, the words first, a progress indication beside them ---- */
.load-row { margin: 0 0 var(--space-3); padding: var(--space-2) 0 0; border-top: 1px solid var(--border); }
.load-row[hidden] { display: none; }
.load-row .progress-block { margin-top: var(--space-2); }
.load-name { font-weight: 600; margin: 0 0 var(--space-1); }
.load-row .progress-text { margin-bottom: var(--space-2); }
.load-row .hint[hidden], #load-sample[hidden] { display: none; }
#head3d-progress[hidden] { display: none; }
/* a progress bar with no value (testing, loading, or a download whose size the page cannot know): a striped bar from the page's own colours; it moves only when motion is allowed */
progress:indeterminate { -webkit-appearance: none; appearance: none; display: block; border: 1px solid var(--border); border-radius: 999px; overflow: hidden;
  background-color: var(--surface); background-image: repeating-linear-gradient(135deg, var(--link) 0 8px, var(--surface) 8px 16px); background-size: 22.63px 100%; }
progress:indeterminate::-webkit-progress-bar { background: transparent; }
progress:indeterminate::-moz-progress-bar { background: transparent; }
@media (prefers-reduced-motion: no-preference) {
  progress:indeterminate { animation: busy-stripes 0.9s linear infinite; }
  @keyframes busy-stripes { to { background-position: 22.63px 0; } }
}
@media (prefers-reduced-motion: reduce) { progress:indeterminate { animation: none; } }

/* ---- the silent-mode check (touch devices): a modal dialog; the page behind it is inert ---- */
.sound-backdrop { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: var(--space-3);
  background: color-mix(in srgb, var(--bg) 92%, transparent); overflow: auto; }
.sound-backdrop[hidden] { display: none; }
.sound-dialog { width: 100%; max-width: 30rem; max-height: 100%; overflow: auto; background: var(--surface); color: var(--text); border: 2px solid var(--border);
  border-radius: var(--radius-2); padding: var(--space-4); }
.sound-dialog h2 { margin-top: 0; }
.sound-dialog:focus { outline: none; }
.sound-dialog .btn { min-width: 2.75rem; }
#sound-question[hidden], #sound-play-row[hidden] { display: none; }

/* The two call-to-action cards after "How it works": links as a whole, one tab stop each, 44 px or more, no motion. */
.cta-row { min-height: 12rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: var(--space-4); margin-bottom: var(--space-5); }
.cta-card { display: block; min-height: 44px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-2); padding: var(--space-4); color: inherit; text-decoration: none; }
.cta-card .cta-title { margin-top: 0; }
.cta-card p { margin: 0 0 var(--space-3); }
.cta-card .cta-go { display: inline-block; min-height: 44px; line-height: 44px; text-decoration: underline; font-weight: 600; }


/* ==== ui_team proposal (T1105 steps 1 and 2): the take, its actions and the one primary action sit next to the face ==== */

/* The take bar: waveform, take actions and Play from here, directly under the face. */
.take-bar { margin: var(--space-3) 0; padding: var(--space-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-2); }
.take-bar .scrub-actions { margin: var(--space-3) 0 0; }
.take-bar .moment-text { margin: var(--space-2) 0 0; }
.take-bar .rec-take-row { margin: 0 0 var(--space-3); }
.take-bar #play-from, .take-bar #play-from-moving { min-height: 3rem; }
.speak-why { display: none; margin: calc(var(--space-2) * -1) 0 var(--space-3); }
.play-row:has(#speak:disabled):has(~ .speak-why) { margin-bottom: var(--space-2); }
.input-panel:has(#speak:disabled):has(#stop:disabled) .speak-why { display: block; }

/* One filled (primary) button per state. Before there is anything to play: Speak (or Use this recording, once a take is waiting).
   Once there is audio on the face: Play from here, and everything else steps back to the quiet look. */
.stage-grid:has(#scrub:not([data-empty="true"])) :is(#speak, #rec-use, #rec-btn, #upload-choose, #voice-start, #kokoro-start),
.stage-grid:has(#rec-take:not([hidden])) :is(#rec-btn, #speak) {
  background: var(--btn-quiet-bg); color: var(--btn-quiet-text); border-color: var(--border);
}

/* Disabled must not look like a quiet button: a dashed edge and the disabled colour pair, never colour alone. */
.btn[disabled] { border-style: dashed; border-color: var(--disabled-text); }

/* The waveform handle: findable, a real 44 px touch area, a clear focus ring. */
.handle .hit { inset: -14px -16px; min-width: 44px; min-height: 44px; }
.scrubber:focus-visible .handle { box-shadow: 0 0 0 3px var(--scrub-ring-inner), 0 0 0 6px var(--scrub-focus), 0 6px 14px var(--scrub-shadow); }

@media (min-width: 52rem) {
  .mouth-figure { position: sticky; top: var(--space-3); align-self: start; }
}

/* Phone: Type | Record | Upload and the 2D/3D switch first (normal flow), then ONE sticky block pinned to the top of the viewport:
   the compact face with the take bar directly under it. It stays stuck while the controls scroll underneath, so after Speak both the
   moving mouth and Play from here are always in view. .controls and .mouth-figure become display: contents, so the stage grid
   (as tall as the whole section) is the sticky block's containing block. */
@media (max-width: 51.99rem) {
  /* a tighter head on a phone (same words): the voice picker and Speak reach the first screen */
  .site-header { padding: var(--space-3) 0 var(--space-2); }
  .site-header .lead { font-size: var(--text-small); line-height: 1.4; margin: 0 0 var(--space-2); }
  .page-nav ul { gap: 0 var(--space-3); } .page-nav { font-size: var(--text-small); }
  #stage { padding-top: var(--space-3); margin-top: var(--space-2); } #stage-h { margin-bottom: var(--space-2); font-size: 1.25rem; }
  .stage-grid { display: flex; flex-direction: column; gap: var(--space-3); }
  .controls, .mouth-figure { display: contents; }
  .input-chooser { order: -4; display: flex; align-items: center; gap: var(--space-2) var(--space-3); flex-wrap: wrap; } .input-chooser .field-label { font-size: var(--text-small); }
  .input-chooser .field-label { margin: 0; }
  .face-switch-row { order: -3; margin: 0; }
  .stage-dock { order: -2; position: sticky; top: 0; z-index: 6; background: var(--surface); padding: var(--space-2) 0 var(--space-1); border-bottom: 1px solid var(--border); }
  .stage-dock .face-stage { max-width: none; }
  .stage-dock .mouth-host { max-height: 28svh; width: auto; margin: 0 auto; }
  .stage-dock .grab-hint, .stage-dock .face-note:empty { display: none; }
  .stage-dock .face-caption { margin: var(--space-1) 0 var(--space-2); text-align: center; }
  .take-bar { margin: 0; padding: var(--space-2); }
  .take-bar .scrubber { --scrub-wave-h: 48px; }
  .take-bar .moment-text, .take-bar .scrub-actions + * { display: none; }
  /* nothing to play and no take waiting: no bar at all, and a smaller face, so Speak reaches the first screen */
  .take-bar:has(#scrub[data-empty="true"]):not(:has(#rec-take:not([hidden]))) { display: none; }
  .stage-grid:has(#scrub[data-empty="true"]) .stage-dock { border-bottom: 0; }
  .stage-grid:has(#scrub[data-empty="true"]) .stage-dock .mouth-host { max-height: 16svh; }
  .stage-grid:has(#scrub[data-empty="true"]) .stage-dock .face-caption { display: none; }
  #panel-type > #text { height: 3.5rem; min-height: 3.5rem; resize: vertical; } #panel-type > label { margin-bottom: var(--space-1); }
  /* Inside the Type panel: the textbox, then Speak, then the rest. */
  #panel-type.shown { display: flex; flex-direction: column; }
  #panel-type > label { order: 1; } #panel-type > #text { order: 2; } #panel-type > .play-row { order: 3; }
  #panel-type > .speak-why { order: 4; } #panel-type > .sample-row { order: 5; } #panel-type > #sample-note { order: 6; }
  #panel-type > .hint:not(.speak-why):not(.sample-note) { order: 7; } #panel-type > .presets { order: 8; }
}


/* ==== ui_team proposal (T1105 step 3) ==== */

/* One primary action per state. Everything in the stage looks quiet; the state picks the ONE filled button (Brand: Speak, or Hear a sample while the
   voice is not loaded; after a take Play from here; while recording Stop). Toggles (.seg-btn, .motion-btn) are selections, not actions. */
#stage .btn:not(.quiet):not(.seg-btn):not(.motion-btn):not([disabled]) { background: var(--btn-quiet-bg); color: var(--btn-quiet-text); border-color: var(--border); }
.stage-grid:not(:has(#rec-take:not([hidden]))):has(#panel-upload.shown) #upload-choose,
.stage-grid:not(:has(#rec-take:not([hidden]))):has(#panel-record.shown) #rec-btn:not([disabled]),
.stage-grid:not(:has(#rec-take:not([hidden]))):has(#panel-type.shown) #speak:not([disabled]),
.stage-grid:not(:has(#rec-take:not([hidden]))):has(#panel-type.shown #speak[disabled]) #sample:not([hidden]) { background: var(--btn-bg); color: var(--btn-text); border-color: var(--btn-bg); }
.stage-grid:has(#rec-take:not([hidden])) #rec-use { background: var(--btn-bg); color: var(--btn-text); border-color: var(--btn-bg); }
.stage-grid:has(#rec-stop:not([disabled])) #rec-stop,
.stage-grid:has(#stop:not([disabled])) #stop { background: var(--btn-bg); color: var(--btn-text); border-color: var(--btn-bg); }
/* with audio on the face, Play from here is the one filled button (unless a recording is running or a new take waits) */
.stage-grid:has(#scrub:not([data-empty="true"])):not(:has(#rec-stop:not([disabled]))):not(:has(#stop:not([disabled]))):not(:has(#rec-take:not([hidden]))) #play-from:not([disabled]) { background: var(--btn-bg); color: var(--btn-text); border-color: var(--btn-bg); }
.stage-grid:has(#scrub:not([data-empty="true"])):not(:has(#rec-stop:not([disabled]))):not(:has(#stop:not([disabled]))):not(:has(#rec-take:not([hidden]))) :is(#speak, #sample, #rec-btn, #upload-choose) { background: var(--btn-quiet-bg); color: var(--btn-quiet-text); border-color: var(--border); }
/* a pending take beats the old audio: Use this recording is the one */
.stage-grid:has(#rec-take:not([hidden])) #play-from { background: var(--btn-quiet-bg); color: var(--btn-quiet-text); border-color: var(--border); }

/* The jump links: ONE horizontally scrolling row of 44 px chips on phones (never three wrapped lines pushing the face down). */
@media (max-width: 51.99rem) {
  .page-nav { margin: var(--space-2) calc(var(--space-3) * -1) 0; }  /* the phone .wrap pads by --space-3: the row bleeds to the screen edges and never overflows the page */
  .page-nav ul { flex-wrap: nowrap; overflow-x: auto; gap: var(--space-2); padding: 0 var(--space-3) var(--space-1); scroll-padding-inline: var(--space-3); -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .page-nav ul::-webkit-scrollbar { display: none; }
  .page-nav li { flex: 0 0 auto; scroll-margin-inline: var(--space-3); }
  .page-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-3); border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); white-space: nowrap; text-decoration: none; font-weight: 600; }
  /* a chip never needs to be wider than the screen (the longest one wraps to two lines at 320 px) */
  .page-nav a { max-width: calc(100vw - var(--space-3) * 2); box-sizing: border-box; text-align: center; }
  .page-nav a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
  /* fade hint that the row scrolls */
  .page-nav { -webkit-mask-image: linear-gradient(90deg, black calc(100% - 1.5rem), transparent); mask-image: linear-gradient(90deg, black calc(100% - 1.5rem), transparent); }
  /* lede: ONE short line on a phone; the privacy note moves to sit under the Speak and Hear a sample buttons */
  .lead-more, #privacy-note { display: none; }
  #panel-type > .sample-row { order: 5; } #panel-type > .privacy-note-phone { order: 6; } #panel-type > #sample-note { order: 7; }
  #panel-type > .hint:not(.speak-why):not(.sample-note):not(.privacy-note-phone) { order: 8; } #panel-type > .presets { order: 9; }
}
.privacy-note-phone { display: none; }
@media (max-width: 51.99rem) { .privacy-note-phone { display: block; } }

/* Teaching panels on the page's role tokens (both schemes through brand/tokens.css; no hex). */
.step { background: var(--surface); }
.step h3 { font-family: var(--font-display); }
.step-nav .btn { min-height: 44px; }
.step .try-it { display: inline-flex; align-items: center; min-height: 44px; margin: var(--space-2) 0 0; font-weight: 600; color: var(--link); }
.glossary > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-2); padding: var(--space-3) var(--space-4); }
.glossary dt { font-family: var(--font-display); font-size: var(--text-large); margin-bottom: var(--space-1); }
.code { background: var(--bg); color: var(--text); border-left: 4px solid var(--focus); }
.code:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (max-width: 51.99rem) { .step { padding: var(--space-3); } .code { font-size: 0.8125rem; } }

/* a pending take beats everything else: only Use this recording is filled (also after switching panel) */
.stage-grid:has(#rec-take:not([hidden])) :is(#upload-choose, #rec-btn, #speak, #sample, #stop) { background: var(--btn-quiet-bg); color: var(--btn-quiet-text); border-color: var(--border); }

/* 320 px: the Type text | Record | Upload control never breaks a word (it broke 'Record' and 'Upload' mid-word). */
.seg-opt button { white-space: nowrap; }
@media (max-width: 23.5rem) { .seg-opt button { padding-inline: var(--space-2); min-width: 0; } .seg-opt button { font-size: 0.9375rem; } }
