/* Read My Lips project page.
   Visual language after the supplementary video: deep navy-black, amber for Ours, teal for the original, red for wrong words,
   slate for what is inactive. Used with restraint: amber marks only the title, Ours and progress.
   Tokens first; every rule below uses them. Dark is defined under prefers-color-scheme (unless the visitor chose light)
   and again for the manual toggle. */

:root {
  /* colour: light */
  --bg: #f6f7f9;
  --bg-glow: radial-gradient(70% 420px at 50% 0%, rgba(244, 181, 59, .10), transparent 70%);
  --band: #eef1f5;
  --surface: #ffffff;
  --panel: #f2f4f8;
  --panel-active: #e8ecf3;
  --ink: #0e1420;
  --ink-2: #3a4354;
  --ink-3: #586173;
  --line: #e2e6ed;
  --line-strong: #cdd4df;
  --amber: #f4b53b;            /* fills, bars, frames (non-text) */
  --amber-ink: #8a5d00;        /* amber text */
  --amber-display: #a06d00;    /* large title text */
  --amber-soft: rgba(244, 181, 59, .16);
  --teal: #2fb5a2;
  --teal-ink: #0b7466;
  --red: #e5484f;
  --red-ink: #c02b33;
  --blk-ok: #0e1420;
  --blk-in: #9aa3b4;
  --bar: #c9d0db;
  --figure-bg: #ffffff;
  --code-bg: #f2f4f8;
  --on-ink: #ffffff;
  --player-bg: #05070b;
  --player-bar: #0b1018;
  --player-ink: #e9edf3;
  --player-ink-2: #9aa3b4;
  --shadow: 0 1px 2px rgba(14, 20, 32, .05), 0 12px 32px -20px rgba(14, 20, 32, .22);
  --nav-bg: rgba(246, 247, 249, .86);

  /* type */
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Figtree", "Inter", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-2xs: 0.75rem;     /* 12 */
  --fs-xs: 0.8125rem;    /* 13 */
  --fs-sm: 0.9375rem;    /* 15 */
  --fs-base: 1.0625rem;  /* 17 body */
  --fs-lg: 1.25rem;      /* 20 */
  --fs-xl: 1.625rem;     /* 26 */
  --fs-h2: clamp(1.875rem, 1.45rem + 1.5vw, 2.5rem);           /* 30 -> 40 */
  --fs-display: clamp(2.75rem, 1.7rem + 4.4vw, 4.75rem);        /* 44 -> 76 */
  --fs-subtitle: clamp(1.125rem, 0.95rem + 0.8vw, 1.5rem);      /* 18 -> 24 */
  --lh-tight: 1.12;
  --lh-snug: 1.35;
  --lh-body: 1.65;

  /* space (4 px base) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 48px;
  --s-9: 64px;
  --s-10: 96px;
  --section-y: clamp(64px, 5vw + 40px, 112px);

  /* size */
  --content: 1120px;
  --gutter: 24px;
  --measure: 100%;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --card-pad: var(--s-5);
  --grid-gap: var(--s-6);
  --tap: 44px;
  --nav-h: 64px;
  --video-ratio: 16 / 9;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #05070b;
    --bg-glow: radial-gradient(80% 520px at 50% -80px, rgba(36, 54, 92, .55), transparent 72%), radial-gradient(40% 260px at 50% 0%, rgba(244, 181, 59, .07), transparent 70%);
    --band: rgba(255, 255, 255, .018);
    --surface: #0b1018; --panel: #101722; --panel-active: #172131;
    --ink: #f3f5f8; --ink-2: #bcc3cf; --ink-3: #8b94a7;
    --line: #1a2230; --line-strong: #283042;
    --amber: #f4b53b; --amber-ink: #f4b53b; --amber-display: #f4b53b; --amber-soft: rgba(244, 181, 59, .13);
    --teal: #3fcdb9; --teal-ink: #3fcdb9; --red: #ff686c; --red-ink: #ff6b6f;
    --blk-ok: #f3f5f8; --blk-in: #949eb2; --bar: #2b3445;
    --figure-bg: #0c1119; --code-bg: #0b1018; --on-ink: #05070b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 18px 40px -24px rgba(0, 0, 0, .9);
    --nav-bg: rgba(5, 7, 11, .82);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #05070b;
  --bg-glow: radial-gradient(80% 520px at 50% -80px, rgba(36, 54, 92, .55), transparent 72%), radial-gradient(40% 260px at 50% 0%, rgba(244, 181, 59, .07), transparent 70%);
  --band: rgba(255, 255, 255, .018);
  --surface: #0b1018; --panel: #101722; --panel-active: #172131;
  --ink: #f3f5f8; --ink-2: #bcc3cf; --ink-3: #8b94a7;
  --line: #1a2230; --line-strong: #283042;
  --amber: #f4b53b; --amber-ink: #f4b53b; --amber-display: #f4b53b; --amber-soft: rgba(244, 181, 59, .13);
  --teal: #3fcdb9; --teal-ink: #3fcdb9; --red: #ff686c; --red-ink: #ff6b6f;
  --blk-ok: #f3f5f8; --blk-in: #949eb2; --bar: #2b3445;
  --figure-bg: #0c1119; --code-bg: #0b1018; --on-ink: #05070b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 18px 40px -24px rgba(0, 0, 0, .9);
  --nav-bg: rgba(5, 7, 11, .82);
  color-scheme: dark;
}
@media (max-width: 640px) { :root { --gutter: 16px; --card-pad: var(--s-4); --grid-gap: var(--s-5); --nav-h: 56px; --fs-base: 1rem; } }

/* theme-specific artwork, switched by the same selectors as the tokens */
.only-dark { display: none !important; }
:root[data-theme="dark"] .only-dark { display: block !important; }
:root[data-theme="dark"] .only-light { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .only-dark { display: block !important; }
  :root:not([data-theme="light"]) .only-light { display: none !important; }
}

/* ------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + var(--s-4)); -webkit-text-size-adjust: 100%; background: var(--bg); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body { margin: 0; background: var(--bg-glow) no-repeat, var(--bg); color: var(--ink); font: 400 var(--fs-base)/var(--lh-body) var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: hidden; }
img, svg, video { display: block; max-width: 100%; }
a { color: var(--amber-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
p { margin: 0; }
strong, b { font-weight: 600; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: var(--radius-sm); }
.skip { position: absolute; left: -999px; top: var(--s-2); background: var(--surface); padding: var(--s-2) var(--s-4); border-radius: var(--radius-sm); z-index: 100; }
.skip:focus { left: var(--s-3); }
.wrap { width: 100%; max-width: calc(var(--content) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }

/* ------------------------------------------------------------ header + section progress nav */
.nav { position: sticky; top: 0; z-index: 50; background: var(--nav-bg); backdrop-filter: saturate(1.3) blur(14px); -webkit-backdrop-filter: saturate(1.3) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .2s; }
.nav.scrolled { border-bottom-color: var(--line); }
.nav-inner { max-width: calc(var(--content) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); height: var(--nav-h); display: flex; align-items: center; gap: var(--s-7); }
.brand { flex: none; font: 700 var(--fs-lg)/1 var(--display); letter-spacing: -.01em; color: var(--amber-display); text-decoration: none; white-space: nowrap; }
.secnav { flex: 1; display: flex; gap: 3px; align-self: stretch; }
.secnav a { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 7px; text-decoration: none; }
.secnav span { font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; transition: color .2s; }
.secnav a:hover span, .secnav a.active span { color: var(--ink); }
.secnav i, .nav-progress i { display: block; height: 3px; border-radius: 3px; background: var(--line-strong); overflow: hidden; }
.secnav b, .nav-progress b { display: block; height: 100%; width: 0; background: var(--amber); border-radius: 3px; }
.nav-current { display: none; }
.nav-progress { display: none; }
.theme-toggle { flex: none; width: var(--tap); height: var(--tap); border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; display: grid; place-items: center; }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: var(--ink-2); stroke-width: 1.7; stroke-linecap: round; }
.theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .i-sun { display: none; }
  :root:not([data-theme]) .theme-toggle .i-moon { display: block; }
}
@media (max-width: 900px) {
  .secnav { display: none; }
  .nav-inner { gap: var(--s-4); }
  .nav-current { display: block; margin-left: auto; font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
  .nav-progress { display: flex; gap: 3px; position: absolute; left: 0; right: 0; bottom: 0; padding: 0 var(--gutter); }
  .nav-progress i { flex: 1; height: 2px; }
}

/* ------------------------------------------------------------ hero */
.hero { padding: var(--s-9) 0 var(--s-8); text-align: center; }
h1 { margin: 0; font-family: var(--display); font-weight: 700; letter-spacing: -.02em; }
.title-main { display: block; font-size: var(--fs-display); line-height: 1; color: var(--amber-display); }
.title-sub { display: block; margin: var(--s-4) auto 0; max-width: 30ch; font-size: var(--fs-subtitle); line-height: 1.3; font-weight: 600; color: var(--ink-2); text-wrap: balance; }
.authors { margin: var(--s-7) auto var(--s-2); max-width: 52rem; font-size: var(--fs-base); line-height: 1.9; text-wrap: balance; }
.authors .au { display: inline-block; white-space: nowrap; margin: 0 var(--s-2); }
.authors a { color: var(--ink); text-decoration-color: var(--line-strong); }
.authors sup, .affils sup { font-size: .68em; color: var(--ink-3); margin-left: 1px; font-weight: 500; }
.affils { margin: 0 auto; max-width: 50rem; font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.8; text-wrap: balance; }
.affils .af { display: inline-block; white-space: nowrap; margin: 0 var(--s-2); }
.affil-note { margin-top: var(--s-2); font-size: var(--fs-sm); color: var(--ink-3); }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-3); margin: var(--s-7) 0 var(--s-8); }
.btn { display: inline-flex; align-items: center; gap: var(--s-2); min-height: var(--tap); padding: 0 var(--s-5) 0 var(--s-4); border-radius: 999px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); text-decoration: none; font-weight: 600; font-size: var(--fs-sm);
  transition: border-color .15s, background .15s; }
.btn:hover { border-color: var(--ink-3); }
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn[data-placeholder] { color: var(--ink-3); border-style: dashed; cursor: default; background: transparent; }
.btn .soon { font-size: var(--fs-2xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }

/* figures: one panel style for the teaser and the pipeline */
figure { margin: 0; }
.fig-panel { background: var(--figure-bg); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: clamp(var(--s-3), 2vw, var(--s-6)); }
.fig-panel img { width: 100%; height: auto; }
.teaser { text-align: left; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 560px) { .scroll-x img { min-width: 640px; } }
@media (max-width: 760px) { .teaser .fig-panel img { width: 100%; height: auto; } }
figcaption { margin-top: var(--s-4); max-width: var(--measure); font-size: var(--fs-sm); line-height: 1.6; color: var(--ink-2); }
figcaption strong { color: var(--ink); }

/* ------------------------------------------------------------ sections */
.section { padding: var(--section-y) 0; }
.section.alt { background: var(--band); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
h2 { margin: 0 0 var(--s-4); font: 700 var(--fs-h2)/var(--lh-tight) var(--display); letter-spacing: -.015em; }
h3 { margin: 0 0 var(--s-2); font: 700 var(--fs-lg)/var(--lh-snug) var(--display); letter-spacing: -.005em; }
.lede { max-width: var(--measure); margin-bottom: var(--s-8); color: var(--ink-2); }
.abstract { max-width: var(--measure); color: var(--ink-2); }
.fine { font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.55; }

/* ------------------------------------------------------------ method */
.figure-card { margin-bottom: var(--s-8); }
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--grid-gap); }
@media (max-width: 1000px) { .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--card-pad); }
.step h3 { font-size: var(--fs-base); }
.step p { font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.6; }
.step-tag { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); margin-bottom: var(--s-3);
  font: 700 var(--fs-sm)/1 var(--display); background: var(--panel); color: var(--ink-2); border: 1px solid var(--line); }
.step-tag.sel { color: var(--amber-ink); border-color: var(--amber); background: var(--amber-soft); }

/* ------------------------------------------------------------ legend, tabs */
.legend-line { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-7); margin: calc(-1 * var(--s-6)) 0 var(--s-8); font-size: var(--fs-xs); color: var(--ink-3); }
.legend-line > span { display: inline-flex; align-items: center; gap: var(--s-2); }
.lg { display: inline-block; width: 22px; height: 12px; border-radius: 3px; }
.lg-span { box-shadow: inset 0 -2px 0 var(--amber); background: var(--amber-soft); }
.lg-band { height: 6px; background: repeating-linear-gradient(135deg, var(--amber) 0 3px, transparent 3px 6px); border-radius: 2px; }
.strip-demo { display: inline-flex; gap: 3px; width: 64px; }
.tabs { display: flex; flex-wrap: nowrap; gap: var(--s-2); max-width: 100%; overflow-x: auto; scrollbar-width: none; margin-bottom: var(--s-6); padding: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; min-height: 40px; border: 1px solid var(--line-strong); background: transparent; padding: 0 var(--s-4); border-radius: 999px;
  font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; transition: border-color .15s, color .15s; }
.tabs button:hover { color: var(--ink); border-color: var(--ink-3); }
.tabs button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.panel-note { max-width: var(--measure); margin-bottom: var(--s-6); font-size: var(--fs-sm); color: var(--ink-2); }

/* ------------------------------------------------------------ featured films */
.feature { margin-bottom: var(--s-10); }
.feature-head { max-width: var(--measure); margin-bottom: var(--s-6); }
.feature-kicker { display: block; margin-bottom: var(--s-2); font-size: var(--fs-2xs); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--amber-ink); }
.feature-head h3 { margin: 0 0 var(--s-2); font: 700 var(--fs-xl)/var(--lh-tight) var(--display); }
.feature-head p { font-size: var(--fs-sm); color: var(--ink-2); }

/* ------------------------------------------------------------ cards (equal height per row) */
.grid.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--grid-gap); align-items: stretch; }
@media (max-width: 860px) { .grid.cards { grid-template-columns: minmax(0, 1fr); } }
.card { display: flex; flex-direction: column; gap: var(--s-4); min-width: 0; height: 100%; padding: var(--card-pad); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-3); }
.route { font-size: var(--fs-xs); color: var(--ink-3); }
.route b { color: var(--ink-2); }
.desc { font-size: var(--fs-sm); color: var(--ink-3); line-height: 1.55; }
.why { margin-top: auto; align-self: flex-start; display: inline-flex; align-items: center; min-height: var(--tap); font-size: var(--fs-sm); font-weight: 600;
  text-decoration: none; color: var(--ink-2); }
.why:hover { color: var(--ink); text-decoration: underline; }
.why::after { content: "\2192"; margin-left: 6px; color: var(--amber-ink); }

/* condition badge: "babble · −20 dB" */
.cond { display: inline-flex; align-items: center; gap: var(--s-2); padding: 5px var(--s-3) 5px 10px; border-radius: 999px; background: var(--panel);
  border: 1px solid var(--line); font: 700 var(--fs-sm)/1.2 var(--display); color: var(--ink); white-space: nowrap; }
.cond svg { width: 18px; height: 14px; flex: none; }
.cond svg rect { fill: var(--amber); }

.badge { display: inline-block; font-size: var(--fs-2xs); font-weight: 600; padding: 1px var(--s-2); border-radius: 999px; background: var(--panel);
  border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; line-height: 1.5; }
.badge.typical { color: var(--ink-3); }
.badge.chosen { border-color: var(--amber); color: var(--amber-ink); background: var(--amber-soft); }
.badge.good { color: var(--teal-ink); border-color: var(--teal); background: transparent; }

/* ------------------------------------------------------------ player: one 16:9 box for every clip size */
.player { position: relative; }
.screen { position: relative; width: 100%; aspect-ratio: var(--video-ratio); background: var(--player-bg); border-radius: var(--radius-md); overflow: hidden;
  box-shadow: 0 0 0 2px var(--frame, transparent); transition: box-shadow .2s; }
.player[data-kind="orig"] { --frame: var(--teal); }
.player[data-kind="ours"] { --frame: var(--amber); }
.player[data-kind="other"] { --frame: var(--line-strong); }
.screen video, .screen .poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--player-bg); }
.screen .poster { pointer-events: none; }
.player.shown .poster { display: none; }
.bigplay { position: absolute; inset: 0; margin: auto; width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .94); box-shadow: 0 6px 24px rgba(0, 0, 0, .35); display: grid; place-items: center; transition: transform .15s, opacity .2s; }
.bigplay:hover { transform: scale(1.06); }
.bigplay svg { width: 22px; height: 22px; fill: #0b1018; margin-left: 3px; }
.player.started .bigplay { opacity: 0; pointer-events: none; }
.player .now { position: absolute; left: var(--s-3); top: var(--s-3); font: 700 var(--fs-xs)/1 var(--display); color: #e9edf3; background: rgba(8, 11, 17, .78);
  padding: 6px 10px; border-radius: 999px; pointer-events: none; }
.player[data-kind="orig"] .now { color: #3fcdb9; }
.player[data-kind="ours"] .now { color: #f4b53b; }
.bar { display: flex; align-items: center; gap: var(--s-2); margin-top: var(--s-2); }
.pbtn { flex: none; width: var(--tap); height: var(--tap); border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; display: grid; place-items: center; }
.pbtn:hover { border-color: var(--ink-3); }
.pbtn svg { width: 14px; height: 14px; fill: var(--ink); }
.pbtn .i-pause { display: none; }
.player.playing .pbtn .i-play { display: none; }
.player.playing .pbtn .i-pause { display: block; }
.timeline { position: relative; flex: 1; height: var(--tap); cursor: pointer; touch-action: none; }
.timeline .track { position: absolute; left: 0; right: 0; top: 20px; height: 4px; border-radius: 4px; background: var(--line-strong); overflow: hidden; }
.timeline .band { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, var(--amber) 0 3px, transparent 3px 6px); opacity: .9; }
.timeline .prog { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--ink-2); }
.player[data-kind="ours"] .timeline .prog { background: var(--amber); }
.player[data-kind="orig"] .timeline .prog { background: var(--teal); }
.timeline .head { position: absolute; top: 16px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--ink); left: 0; box-shadow: 0 0 0 3px var(--surface); }
.timeline .bandlabel { position: absolute; top: 3px; font-size: 10px; font-weight: 600; color: var(--amber-ink); letter-spacing: .06em; text-transform: uppercase; transform: translateX(-50%); white-space: nowrap; pointer-events: none; }
.ptime { flex: none; font: 400 var(--fs-2xs)/1 var(--mono); color: var(--ink-3); min-width: 46px; text-align: right; }
.loading .ptime { opacity: .5; }

/* method chips (switch the soundtrack) */
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-3); }
.chips button { min-height: 36px; padding: 0 var(--s-3); border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; cursor: pointer;
  font: 600 var(--fs-xs)/1 var(--display); color: var(--ink-2); }
.chips button:hover { color: var(--ink); border-color: var(--ink-3); }
.chips button[data-kind="ours"] { color: var(--amber-ink); }
.chips button[data-kind="orig"] { color: var(--teal-ink); }
.chips button[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); background: var(--panel-active); }
.chips button[aria-pressed="true"][data-kind="ours"] { border-color: var(--amber); color: var(--amber-ink); background: var(--amber-soft); }
.chips button[aria-pressed="true"][data-kind="orig"] { border-color: var(--teal); color: var(--teal-ink); background: transparent; }
.chips .vs { align-self: center; font-size: var(--fs-2xs); color: var(--ink-3); }
@media (pointer: coarse) { .chips button, .tabs button { min-height: var(--tap); } }

/* transcript panels */
.panels { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pnl { position: relative; padding: 10px var(--s-4) 12px; border-radius: 10px; background: var(--panel); cursor: pointer; border: 1px solid transparent; min-height: var(--tap); }
.pnl::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: transparent; }
.pnl:hover { background: var(--panel-active); }
.pnl.active { background: var(--panel-active); border-color: var(--line); }
.pnl.active::before { background: var(--ink-2); }
.pnl.active[data-kind="ours"]::before { background: var(--amber); }
.pnl.active[data-kind="orig"]::before { background: var(--teal); }
.pnl.disabled { cursor: default; opacity: .7; }
.pnl-head { display: flex; align-items: baseline; gap: var(--s-2); }
.pnl-name { font: 700 var(--fs-sm)/1.3 var(--display); color: var(--ink-2); }
.pnl.active .pnl-name { color: var(--ink); }
.pnl[data-kind="ours"] .pnl-name { color: var(--amber-ink); }
.pnl[data-kind="orig"] .pnl-name { color: var(--teal-ink); }
.pnl-sub { font-size: var(--fs-2xs); color: var(--ink-3); }
.pnl-count { margin-left: auto; font-size: var(--fs-2xs); color: var(--ink-3); white-space: nowrap; }
.pnl-count b { font: 700 var(--fs-sm)/1 var(--display); color: var(--ink); margin-right: 3px; }
.pnl-count b.bad { color: var(--red-ink); }
.pnl-count.exact b { color: var(--teal-ink); }
.pnl-text { margin-top: 4px; font-size: var(--fs-sm); line-height: 1.6; color: var(--ink-2); overflow-wrap: anywhere; }
.pnl.active .pnl-text { color: var(--ink); }
.pnl-text .note { font-style: italic; color: var(--ink-3); }

/* per-word error strip: one block per reference word */
.strip { display: flex; gap: 3px; margin-top: 8px; height: 8px; }
.blk { position: relative; display: block; flex: var(--g, 4) 1 0; min-width: 4px; height: 8px; border-radius: 2px; }
.blk.ok { background: var(--blk-ok); }
.blk.in { background: var(--blk-in); }
.blk.sub { background: var(--red); }
.blk.del { box-shadow: inset 0 0 0 1.5px var(--red); }
.blk.hole { box-shadow: inset 0 0 0 1.5px var(--amber); }
.blk.s::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px; border-radius: 1px; background: var(--amber); }

/* words */
.w.span { box-shadow: inset 0 -2px 0 var(--amber); }
.w.err { color: var(--red-ink); }
.w.span.err { box-shadow: inset 0 -2px 0 var(--red); }
.w.soft { color: var(--ink-3); }
.miss { display: inline-block; margin: 0 2px; padding: 0 7px; border: 1px solid var(--red); border-radius: 999px; color: var(--red-ink); font-size: var(--fs-2xs); font-weight: 600; line-height: 1.45; white-space: nowrap; vertical-align: 1px; }
.gap { display: inline-block; height: 1.05em; vertical-align: -2px; border: 1.5px dashed var(--amber); border-radius: 5px; background: var(--amber-soft); }

/* ------------------------------------------------------------ clip picker, comparisons, explorer */
.picker { display: flex; gap: var(--s-3); overflow-x: auto; padding: 2px 2px var(--s-3); margin-bottom: var(--s-6); scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.pick { flex: none; width: 136px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-md); padding: 0; overflow: hidden;
  cursor: pointer; text-align: left; scroll-snap-align: start; transition: border-color .15s; }
.pick:hover { border-color: var(--ink-3); }
.pick[aria-selected="true"] { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber); }
.pick .thumb { display: block; aspect-ratio: var(--video-ratio); background: var(--player-bg) center/contain no-repeat; }
.pick .cap { display: block; padding: 6px var(--s-2) var(--s-2); font-size: var(--fs-2xs); line-height: 1.35; color: var(--ink-2); font-weight: 600; min-height: 44px; }
.pick .cap em { font-style: normal; color: var(--ink-3); font-weight: 400; display: block; }
.compare-body, .explorer-body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--s-7); align-items: start; }
@media (max-width: 960px) { .compare-body, .explorer-body { grid-template-columns: minmax(0, 1fr); gap: var(--s-6); } }
.compare-side .ref { margin-bottom: var(--s-3); font-size: var(--fs-xs); color: var(--ink-3); }
.compare-side .ref b { color: var(--ink-2); }

.explorer-player .fine { margin-top: var(--s-3); }
.explorer-side { min-width: 0; }
.sel-summary { margin-bottom: var(--s-4); font-size: var(--fs-sm); color: var(--ink-2); background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--amber); border-radius: var(--radius-md); padding: var(--s-3) var(--s-4); }
.sel-summary b { color: var(--ink); }
.explorer-side > .fine { margin-top: var(--s-3); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.cand-table { width: 100%; min-width: 600px; border-collapse: collapse; font-size: var(--fs-xs); }
.cand-table th { text-align: left; font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600;
  padding: var(--s-3) var(--s-3) var(--s-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.cand-table td { padding: var(--s-3); border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-2); }
.cand-table tr:last-child td { border-bottom: 0; }
.cand-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cand-table tr.playable { cursor: pointer; }
.cand-table tr.playable:hover td { background: var(--panel); }
.cand-table tr.active td { background: var(--panel-active); }
.cand-table tr.voter td { color: var(--ink-3); }
.cand-table .cfg { white-space: nowrap; font: 700 var(--fs-xs)/1.4 var(--display); color: var(--ink); }
.cand-table tr.sel .cfg { color: var(--amber-ink); }
.cand-table .cfg small { display: block; font: 400 var(--fs-2xs)/1.4 var(--font); color: var(--ink-3); }
.cand-table .cfg .pi { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line-strong); margin-right: 6px; vertical-align: -3px; }
.cand-table .cfg .pi svg { width: 8px; height: 8px; fill: var(--ink-2); margin-left: 1px; }
.cand-table tr.active .cfg .pi { border-color: var(--amber); }
.cand-table tr.active .cfg .pi svg { fill: var(--amber); }
.cand-table .tw { min-width: 220px; line-height: 1.6; }
.cand-table .res { display: block; margin-top: var(--s-1); }
.mini { display: block; height: 4px; border-radius: 3px; background: var(--line); margin-top: 6px; overflow: hidden; min-width: 44px; }
.mini i { display: block; height: 100%; background: var(--ink-3); border-radius: 3px; }
.mini.w i { background: var(--amber); }
.nested { font-size: var(--fs-2xs); color: var(--ink-3); font-style: italic; }
.formula { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-4) var(--s-7); align-items: center; margin-bottom: var(--s-8);
  padding: var(--s-5) var(--s-6); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.eq { font: 400 var(--fs-lg)/1.3 var(--font); white-space: nowrap; color: var(--ink); }
.eq sub, .eq sup { font-size: .62em; }
.eq-legend { display: flex; flex-direction: column; gap: var(--s-1); font-size: var(--fs-xs); color: var(--ink-2); }
@media (max-width: 820px) { .formula { grid-template-columns: minmax(0, 1fr); padding: var(--s-4); } .eq { white-space: normal; } }

/* ------------------------------------------------------------ results */
.result { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: var(--s-8); padding: var(--s-8) 0; border-top: 1px solid var(--line); }
.result:first-of-type { border-top: 0; padding-top: 0; }
@media (max-width: 900px) { .result { grid-template-columns: minmax(0, 1fr); gap: var(--s-5); } }
.result-text p { margin-bottom: var(--s-3); color: var(--ink-2); }
.chart { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--card-pad); min-width: 0; }
.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: var(--s-3); margin-bottom: var(--s-4); }
.chart-title { font: 700 var(--fs-sm)/1.35 var(--display); color: var(--ink); }
.chart-title small { display: block; font: 400 var(--fs-xs)/1.4 var(--font); color: var(--ink-3); }
.chip-seg { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.chip-seg button { min-height: 32px; border: 1px solid var(--line-strong); background: transparent; padding: 0 var(--s-3); border-radius: 999px;
  font-size: var(--fs-2xs); font-weight: 600; color: var(--ink-2); cursor: pointer; }
.chip-seg button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
@media (pointer: coarse) { .chip-seg button { min-height: var(--tap); } }
.bars { display: flex; flex-direction: column; gap: 6px; }
.brow { display: grid; grid-template-columns: minmax(104px, 38%) minmax(0, 1fr) 44px; align-items: center; gap: var(--s-3); font-size: var(--fs-xs); min-height: 24px; }
.brow .bl { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brow .bl small { color: var(--ink-3); }
.brow.ours .bl { color: var(--amber-ink); font-weight: 600; }
.brow .bt { position: relative; height: 14px; }
.brow .bf { position: absolute; left: 0; top: 1px; bottom: 1px; background: var(--bar); border-radius: 0 4px 4px 0; transition: width .45s cubic-bezier(.2, .7, .2, 1); min-width: 2px; }
.brow.ours .bf { background: var(--amber); }
.brow.ref .bf { background: transparent; border: 1.5px dashed var(--line-strong); border-left: 0; }
.brow .bv { font-variant-numeric: tabular-nums; color: var(--ink-2); text-align: right; }
.brow.ours .bv { color: var(--ink); font-weight: 600; }
.brow:hover .bl { color: var(--ink); }
@media (max-width: 420px) { .brow { grid-template-columns: minmax(96px, 44%) minmax(0, 1fr) 40px; gap: var(--s-2); } }
.chart-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s-2); margin-top: var(--s-3); font-size: var(--fs-2xs); color: var(--ink-3); }
.linkbtn { min-height: 32px; border: 0; background: none; padding: 0; color: var(--ink-2); font-weight: 600; cursor: pointer; font-size: var(--fs-xs); text-decoration: underline; text-underline-offset: 3px; }
.chart table { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); }
.chart [hidden] { display: none !important; }
.chart th, .chart td { padding: 6px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.chart th:first-child, .chart td:first-child { text-align: left; }
.chart th { font-weight: 600; color: var(--ink-3); }
.duo { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-7); }
.callout { margin-top: var(--s-8); padding: var(--s-5) var(--s-6); border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--amber); color: var(--ink-2); }
.callout strong { color: var(--ink); }

/* ------------------------------------------------------------ bibtex, footer, tooltip */
.bib { position: relative; }
.bib pre { margin: 0; padding: var(--s-5) var(--s-6); padding-right: 88px; background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow-x: auto; font: var(--fs-xs)/1.7 var(--mono); color: var(--ink); }
.copy { position: absolute; top: var(--s-3); right: var(--s-3); min-height: 36px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px;
  padding: 0 var(--s-3); font-size: var(--fs-xs); font-weight: 600; cursor: pointer; color: var(--ink-2); }
.copy:hover { color: var(--ink); }
.footer { padding: var(--s-7) 0 var(--s-8); border-top: 1px solid var(--line); font-size: var(--fs-xs); color: var(--ink-3); }
.tooltip { position: fixed; z-index: 90; pointer-events: none; background: var(--ink); color: var(--on-ink); font-size: var(--fs-xs); line-height: 1.45;
  padding: 6px var(--s-3); border-radius: var(--radius-sm); max-width: 280px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }

/* narrow screens: badges wrap; every control reaches the 44 px tap size */
.cond { max-width: 100%; white-space: normal; }
@media (max-width: 900px) {
  .chip-seg button, .chips button, .tabs button, .linkbtn, .copy, .seg button { min-height: var(--tap); }
  .linkbtn { padding: 0 var(--s-1); }
}
.blk.hole.s::after { display: none; }
@media (max-width: 480px) { .links { gap: var(--s-2); } .btn { padding: 0 var(--s-4) 0 var(--s-3); } }
/* explorer: the table side gets the larger share so all six columns fit at desktop widths */
.explorer-body { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }
.cand-table { min-width: 560px; }
.cand-table .tw { min-width: 200px; }
@media (max-width: 960px) { .explorer-body { grid-template-columns: minmax(0, 1fr); } }
.explorer-body { grid-template-columns: minmax(0, .78fr) minmax(0, 1.22fr); }
.cand-table td, .cand-table th { padding-left: 10px; padding-right: 10px; }
.cand-table .tw { min-width: 180px; }
@media (max-width: 960px) { .explorer-body { grid-template-columns: minmax(0, 1fr); } }
