/* ════════════════════════════════════════════════════════════════════════════
   Connected Speech Lab — “editorial acoustic”
   Paper, ink and a vermilion signal. The linking arc ‿ is the signature: it
   draws itself between words and pulses while a clip plays.
   ════════════════════════════════════════════════════════════════════════════ */

/* ─── tokens ─────────────────────────────────────────────────────────────── */
:root {
  --paper: #f3eee4;
  --paper-2: #ebe3d4;
  --surface: #fbf8f2;
  --surface-2: #f2ecdf;
  --ink: #17161b;
  --ink-2: #36343d;
  --muted: #6c675f;
  --line: #ddd3c2;
  --line-2: #c9bda8;
  --accent: #e0482c;
  --accent-ink: #b3321a;
  --accent-soft: #f7dccf;
  --on-accent: #ffffff;
  --glow: rgb(224 72 44 / 0.13);
  --good: #1d7549;
  --good-soft: #d9eee1;
  --bad: #bf3328;
  --bad-soft: #f8dcd7;
  --warn: #c98a10;

  /* connected-speech categories (lab + legends) */
  --c-link: #e0482c;
  --c-glide: #5b44d6;
  --c-pal: #0d7a68;
  --c-asm: #1f5fc4;
  --c-del: #8b857b;
  --c-gem: #2d7a36;
  --c-flap: #c0265f;
  --c-red: #a8690f;
  --c-weak: #9a9387;

  --shadow-1: 0 1px 0 rgb(23 22 27 / 0.03), 0 1px 3px rgb(23 22 27 / 0.06);
  --shadow-2: 0 2px 4px rgb(23 22 27 / 0.04), 0 14px 34px -12px rgb(23 22 27 / 0.2);
  --shadow-3: 0 30px 80px -20px rgb(23 22 27 / 0.35), 0 4px 12px rgb(23 22 27 / 0.08);

  --r-sm: 12px;
  --r: 18px;
  --r-lg: 28px;
  --sidebar: 276px;
  --top: 64px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --t-fast: 160ms;
  --t: 260ms;

  --f-display: 'Instrument Serif', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --f-body: 'Onest', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-ipa: 'Gentium Book Plus', 'Charis SIL', 'Doulos SIL', 'Noto Serif', 'Times New Roman', serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --grain-opacity: 0.55;
  --grain-blend: multiply;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #0f0f12;
    --paper-2: #141418;
    --surface: #18181d;
    --surface-2: #202027;
    --ink: #f1ebdf;
    --ink-2: #d6cfc2;
    --muted: #a19b90;
    --line: #2b2a31;
    --line-2: #3d3b45;
    --accent: #ff6a45;
    --accent-ink: #ff8f72;
    --accent-soft: #3a1e16;
    --on-accent: #1a0b06;
    --glow: rgb(255 106 69 / 0.12);
    --good: #5fd08f;
    --good-soft: #13301f;
    --bad: #ff7b6e;
    --bad-soft: #3a1714;
    --warn: #f0b44c;
    --c-link: #ff6a45;
    --c-glide: #a594ff;
    --c-pal: #3fd1b5;
    --c-asm: #6fa3ff;
    --c-del: #8d887e;
    --c-gem: #7fd48a;
    --c-flap: #ff6fa3;
    --c-red: #f0b44c;
    --c-weak: #857f75;
    --shadow-1: 0 1px 0 rgb(0 0 0 / 0.2), 0 1px 3px rgb(0 0 0 / 0.3);
    --shadow-2: 0 2px 4px rgb(0 0 0 / 0.2), 0 18px 40px -14px rgb(0 0 0 / 0.6);
    --shadow-3: 0 30px 80px -20px rgb(0 0 0 / 0.75), 0 4px 12px rgb(0 0 0 / 0.3);
    --grain-opacity: 0.22;
    --grain-blend: screen;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --paper: #0f0f12;
  --paper-2: #141418;
  --surface: #18181d;
  --surface-2: #202027;
  --ink: #f1ebdf;
  --ink-2: #d6cfc2;
  --muted: #a19b90;
  --line: #2b2a31;
  --line-2: #3d3b45;
  --accent: #ff6a45;
  --accent-ink: #ff8f72;
  --accent-soft: #3a1e16;
  --on-accent: #1a0b06;
  --glow: rgb(255 106 69 / 0.12);
  --good: #5fd08f;
  --good-soft: #13301f;
  --bad: #ff7b6e;
  --bad-soft: #3a1714;
  --warn: #f0b44c;
  --c-link: #ff6a45;
  --c-glide: #a594ff;
  --c-pal: #3fd1b5;
  --c-asm: #6fa3ff;
  --c-del: #8d887e;
  --c-gem: #7fd48a;
  --c-flap: #ff6fa3;
  --c-red: #f0b44c;
  --c-weak: #857f75;
  --shadow-1: 0 1px 0 rgb(0 0 0 / 0.2), 0 1px 3px rgb(0 0 0 / 0.3);
  --shadow-2: 0 2px 4px rgb(0 0 0 / 0.2), 0 18px 40px -14px rgb(0 0 0 / 0.6);
  --shadow-3: 0 30px 80px -20px rgb(0 0 0 / 0.75), 0 4px 12px rgb(0 0 0 / 0.3);
  --grain-opacity: 0.22;
  --grain-blend: screen;
  color-scheme: dark;
}

/* ─── base ───────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--top) + 16px);
}
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font: 400 16px/1.65 var(--f-body);
  background:
    radial-gradient(1100px 520px at 88% -8%, var(--glow), transparent 62%),
    radial-gradient(900px 480px at -10% 110%, var(--glow), transparent 60%),
    var(--paper);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.4 0 0 0 0 0.35 0 0 0 0 0.3 0 0 0 0.35 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
a {
  color: var(--accent-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--t-fast);
}
a:hover {
  color: var(--ink);
}
h1,
h2,
h3,
h4 {
  margin: 0 0 0.5em;
  font-weight: 400;
  line-height: 1.08;
}
h1,
h2 {
  font-family: var(--f-display);
  letter-spacing: -0.01em;
}
h1 {
  font-size: clamp(2.6rem, 6vw, 4.6rem);
}
h2 {
  font-size: clamp(1.7rem, 3.2vw, 2.3rem);
}
h3 {
  font-family: var(--f-body);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.3;
}
h1 em,
h2 em {
  font-style: italic;
  color: var(--accent-ink);
}
p {
  margin: 0 0 0.9em;
}
strong,
b {
  font-weight: 600;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
svg {
  width: 1em;
  height: 1em;
  flex: none;
}
code {
  font-family: var(--f-mono);
  font-size: 0.84em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 0.05em 0.4em;
  border-radius: 6px;
}
::selection {
  background: var(--accent);
  color: var(--on-accent);
}
[hidden] {
  display: none !important;
}
.ipa {
  font-family: var(--f-ipa);
}
.mono {
  font-family: var(--f-mono);
}
.muted {
  color: var(--muted);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip {
  position: absolute;
  left: -999px;
  top: 10px;
  z-index: 200;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 14px;
  border-radius: 10px;
}
.skip:focus {
  left: 10px;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ─── top bar ────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--top);
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover {
  color: var(--ink);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--ink);
  transition: transform var(--t) var(--spring);
}
.brand:hover .brand-mark {
  transform: rotate(-6deg) scale(1.05);
}
.brand-mark svg {
  width: 26px;
  height: 26px;
}
.brand-mark path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-dasharray: 14 6;
}
.audio-playing .brand-mark path {
  animation: arc-flow 0.9s linear infinite;
}
.brand-name {
  font-family: var(--f-display);
  font-size: 1.35rem;
}
.brand-name em {
  color: var(--accent-ink);
}
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  transition:
    transform var(--t-fast) var(--ease-out),
    border-color var(--t-fast);
}
.icon-btn:hover {
  border-color: var(--line-2);
}
.icon-btn:active {
  transform: scale(0.94);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.stop-btn {
  animation: pop 0.35s var(--spring);
}
.stop-btn svg {
  fill: currentColor;
  stroke: none;
}
.theme-btn .i-moon {
  display: none;
}
:root[data-theme='dark'] .theme-btn .i-sun {
  display: none;
}
:root[data-theme='dark'] .theme-btn .i-moon {
  display: block;
}
.menu-btn {
  display: none;
}
.scroll-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(0);
}
@supports (animation-timeline: scroll()) {
  .scroll-progress {
    animation: grow-x linear both;
    animation-timeline: scroll(root);
  }
}

/* voice engine trigger */
.engine-wrap {
  position: relative;
}
.engine {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  max-width: min(46vw, 340px);
  padding: 0 12px 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.86rem;
  font-weight: 500;
  transition:
    border-color var(--t-fast),
    box-shadow var(--t) var(--ease-out),
    transform var(--t-fast);
}
.engine:hover,
.engine[aria-expanded='true'] {
  border-color: var(--line-2);
  box-shadow: var(--shadow-1);
}
.engine:active {
  transform: scale(0.98);
}
.engine-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.engine-label .short {
  display: none;
}
@media (max-width: 560px) {
  .engine-label .long {
    display: none;
  }
  .engine-label .short {
    display: inline;
  }
}
.engine-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.engine[data-level='eleven'] .engine-dot {
  background: var(--good);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 20%, transparent);
}
.engine[data-level='warn'] .engine-dot {
  background: var(--warn);
}
.engine .eq {
  display: none;
  color: var(--accent);
}
.audio-playing .engine .engine-dot {
  display: none;
}
.audio-playing .engine .eq {
  display: inline-flex;
}
.engine .chev {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--t) var(--ease-out);
}
.engine[aria-expanded='true'] .chev {
  transform: rotate(180deg);
}

/* ─── equalizer (playing state) ──────────────────────────────────────────── */
.eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}
.eq i {
  display: block;
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: currentColor;
  transform-origin: bottom;
  animation: eq 0.9s ease-in-out infinite;
}
.eq i:nth-child(2) {
  animation-duration: 0.7s;
  animation-delay: -0.3s;
}
.eq i:nth-child(3) {
  animation-duration: 1.05s;
  animation-delay: -0.5s;
}
.eq i:nth-child(4) {
  animation-duration: 0.8s;
  animation-delay: -0.15s;
}

/* ─── layout ─────────────────────────────────────────────────────────────── */
.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: calc(100dvh - var(--top));
}
.sidebar {
  position: sticky;
  top: var(--top);
  height: calc(100dvh - var(--top));
  overflow-y: auto;
  padding: 28px 14px 48px 18px;
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
}
.nav-group {
  margin-bottom: 22px;
}
.nav-title {
  font-family: var(--f-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 12px 8px;
}
.nav-title small {
  display: block;
  margin-top: 2px;
  font-family: var(--f-body);
  font-size: 0.72rem;
  letter-spacing: 0;
  text-transform: none;
}
.nav-link {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.93rem;
  line-height: 1.35;
  transition:
    background var(--t-fast),
    color var(--t-fast),
    transform var(--t) var(--ease-out);
}
.nav-link:hover {
  background: var(--surface-2);
  color: var(--ink);
  transform: translateX(2px);
}
.nav-link .nav-num {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  color: var(--muted);
  min-width: 1.6em;
}
.nav-link[aria-current='page'] {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-1);
}
.nav-link[aria-current='page']::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
  animation: grow-y 0.35s var(--ease-out);
}
.nav-link[aria-current='page'] .nav-num {
  color: var(--accent-ink);
}
.nav-link .num {
  margin-left: auto;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  color: var(--muted);
}
main {
  width: 100%;
  max-width: 1000px;
  padding: 44px clamp(16px, 5vw, 64px) 120px;
  view-transition-name: page;
}
main:focus,
main:focus-visible {
  outline: none;
}
.scrim {
  display: none;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .menu-btn {
    display: inline-grid;
  }
  .sidebar {
    position: fixed;
    top: var(--top);
    left: 0;
    bottom: 0;
    z-index: 35;
    width: min(86vw, 320px);
    height: auto;
    background: var(--paper);
    transform: translateX(-104%);
    transition: transform 0.38s var(--ease-out);
  }
  .sidebar.open {
    transform: none;
    box-shadow: var(--shadow-3);
  }
  .scrim:not([hidden]) {
    display: block;
    position: fixed;
    inset: var(--top) 0 0 0;
    z-index: 30;
    background: rgb(10 9 12 / 0.45);
    backdrop-filter: blur(3px);
    animation: fade-in 0.25s var(--ease-out);
  }
  main {
    padding-top: 30px;
  }
}
@media (max-width: 560px) {
  .brand-name em {
    display: none;
  }
  .brand-name {
    font-size: 1.15rem;
  }
  .engine {
    padding: 0 10px;
  }
  .engine-label {
    max-width: 24vw;
  }
  .theme-btn {
    display: none;
  }
}
@media (max-width: 400px) {
  .brand-name {
    display: none;
  }
}

/* ─── type helpers ───────────────────────────────────────────────────────── */
.eyebrow,
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: 14px;
}
.eyebrow a {
  color: inherit;
}
.kicker::before {
  content: '';
  width: 28px;
  height: 1px;
  background: currentColor;
}
.lede {
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 60ch;
}

/* ─── generic components ─────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px 24px;
  box-shadow: var(--shadow-1);
}
.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--ink-2);
  font-family: var(--f-mono);
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
}
.badge.cm::before {
  background: var(--c-asm);
}
.badge.pr::before {
  background: var(--accent);
}
.badge.pp::before,
.badge.book::before {
  background: var(--c-glide);
}
.badge.pa::before {
  background: var(--c-pal);
}
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  transition:
    transform var(--t-fast) var(--ease-out),
    box-shadow var(--t) var(--ease-out),
    background var(--t-fast),
    border-color var(--t-fast),
    color var(--t-fast);
}
.btn:hover {
  border-color: var(--ink);
  color: var(--ink);
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}
.btn:active {
  transform: translateY(0) scale(0.97);
  box-shadow: none;
}
.btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  transition: transform var(--t) var(--ease-out);
}
.btn:hover svg {
  transform: translateX(3px);
}
.btn.back:hover svg {
  transform: translateX(-3px);
}
.btn.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.btn.primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.callout {
  position: relative;
  margin: 18px 0;
  padding: 16px 20px 16px 24px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--ink);
}
.callout::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}
.callout p:last-child {
  margin: 0;
}
.rule {
  position: relative;
  margin: 14px 0 20px;
  padding: 16px 20px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background:
    repeating-linear-gradient(-45deg, transparent 0 10px, color-mix(in srgb, var(--line) 35%, transparent) 10px 11px),
    var(--surface);
  font-size: 0.98rem;
}
.rule::before {
  content: 'Rule';
  display: inline-block;
  margin-right: 10px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  vertical-align: 2px;
}
.table-wrap {
  overflow-x: auto;
  margin: 14px 0 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.93rem;
}
th,
td {
  text-align: left;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-family: var(--f-mono);
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  white-space: nowrap;
}
tr:last-child td {
  border-bottom: 0;
}
tbody tr {
  transition: background var(--t-fast);
}
tbody tr:hover {
  background: color-mix(in srgb, var(--accent-soft) 45%, transparent);
}
td {
  font-family: var(--f-ipa);
  font-size: 1rem;
}
ul.bullets {
  padding-left: 0;
  margin: 12px 0 18px;
  list-style: none;
}
ul.bullets li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 8px;
}
ul.bullets li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.6em;
  width: 11px;
  height: 6px;
  border: 1.8px solid var(--accent);
  border-top: 0;
  border-radius: 0 0 11px 11px;
}

/* ─── linking arcs & markup ──────────────────────────────────────────────── */
.lk {
  position: relative;
  display: inline-block;
  width: 0.52em;
  height: 0.5em;
  vertical-align: -0.34em;
}
.lk::after,
.jn .arc::after {
  content: '';
  position: absolute;
  left: -0.08em;
  right: -0.08em;
  top: 0;
  height: 0.42em;
  border: 2px solid transparent;
  border-bottom-color: var(--c-link);
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
  clip-path: inset(0 0 0 0);
}
.reveal .lk::after {
  clip-path: inset(0 100% 0 0);
}
.reveal.in .lk::after {
  animation: arc-draw 0.6s var(--ease-out) forwards;
  animation-delay: calc(220ms + var(--k, 0) * 110ms);
}
.is-playing .lk::after {
  animation: arc-pulse 1.1s var(--ease-out) infinite;
  animation-delay: calc(var(--k, 0) * 140ms);
}
.ins {
  display: inline-block;
  margin: 0 1px;
  color: var(--c-glide);
  font-family: var(--f-ipa);
  font-size: 0.62em;
  font-weight: 700;
  vertical-align: 0.72em;
  line-height: 1;
}
.del {
  color: var(--c-del);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  opacity: 0.75;
}
.hl {
  color: var(--accent-ink);
  font-weight: inherit;
  background: linear-gradient(transparent 62%, color-mix(in srgb, var(--accent) 22%, transparent) 62%);
  border-radius: 2px;
}

/* ─── audio buttons ──────────────────────────────────────────────────────── */
.pbtn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  transition:
    transform var(--t-fast) var(--ease-out),
    background var(--t-fast),
    border-color var(--t-fast),
    color var(--t-fast),
    box-shadow var(--t) var(--ease-out);
}
.pbtn:hover {
  background: var(--surface-2);
  border-color: var(--line-2);
  color: var(--ink);
}
.pbtn:active {
  transform: scale(0.95);
}
.pbtn:disabled {
  opacity: 0.6;
  cursor: default;
}
.pbtn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}
.pbtn .eq {
  display: none;
  height: 13px;
}
.pbtn.is-playing svg {
  display: none;
}
.pbtn.is-playing .eq {
  display: inline-flex;
}
.pbtn.main {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.pbtn.main:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.pbtn.round {
  width: 46px;
  min-height: 46px;
  padding: 0;
}
.pbtn.round span:not(.eq) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.pbtn.round svg {
  width: 17px;
  height: 17px;
  margin-left: 2px;
}
.pbtn.is-playing {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 18%, transparent);
}
.pbtn.is-playing::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1px solid var(--accent);
  animation: ripple 1.6s var(--ease-out) infinite;
  pointer-events: none;
}
.pbtn.is-loading {
  color: transparent !important;
  pointer-events: none;
}
.pbtn.is-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
.pbtn.rec.is-recording {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
}
.pbtn.rec.is-recording svg {
  animation: breathe 1s ease-in-out infinite;
}
@media (max-width: 560px), (pointer: coarse) {
  .pbtn {
    min-height: 44px;
  }
  .pbtn .lbl-long {
    display: none;
  }
}

/* ─── topic pages ────────────────────────────────────────────────────────── */
.topic-head {
  position: relative;
  margin-bottom: 34px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.topic-num {
  position: absolute;
  right: 0;
  top: -26px;
  font-family: var(--f-display);
  font-size: clamp(6rem, 16vw, 11rem);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px var(--line-2);
  user-select: none;
  pointer-events: none;
  animation: rise 1s var(--ease-out) 0.1s both;
}
.topic-head h1 {
  position: relative;
  max-width: 15ch;
}
.topic-head .lede {
  position: relative;
}
.topic-head .row {
  margin-top: 14px;
}
.topic-intro {
  font-size: 1.08rem;
  max-width: 64ch;
  color: var(--ink-2);
}
.section {
  margin: 56px 0;
}
.section > h2 {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 14px;
}
.section > h2 .sec-num {
  flex: none;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--accent-ink);
  transform: translateY(-0.5em);
}
.section > p,
.section > .rule,
.section > .callout {
  max-width: 70ch;
}
.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

/* examples */
.examples {
  list-style: none;
  margin: 18px 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.ex {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 18px;
  align-items: center;
  padding: 14px 14px 14px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-1);
  transition:
    opacity 0.7s var(--ease-out),
    transform var(--t) var(--ease-out),
    box-shadow var(--t) var(--ease-out),
    border-color var(--t);
}
.ex::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform var(--t) var(--ease-out);
}
.ex.in:hover,
.ex:not(.reveal):hover {
  transform: translateY(-2px);
  border-color: var(--line-2);
  box-shadow: var(--shadow-2);
}
.ex.is-playing {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: var(--shadow-2), 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent);
}
.ex.is-playing::before {
  transform: scaleY(1);
}
.ex-body {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 16px;
}
.ex-mark {
  font-family: var(--f-display);
  font-size: clamp(1.35rem, 2.6vw, 1.65rem);
  line-height: 1.25;
  color: var(--ink);
}
.ex-ipa {
  font-family: var(--f-ipa);
  font-size: 1.04rem;
  color: var(--muted);
}
.ex-note {
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.ex-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}
.rec-out {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding-top: 10px;
  margin-top: 4px;
  border-top: 1px dashed var(--line);
  font-size: 0.84rem;
  color: var(--muted);
  animation: rise 0.35s var(--ease-out);
}
@media (max-width: 640px) {
  .ex {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px 14px 14px 20px;
  }
  .ex-actions {
    justify-content: flex-start;
  }
}

/* dialogues */
.dialogue {
  margin: 16px 0;
  padding: 18px 20px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.dlg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.dlg-head h3 {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 1.5rem;
}
.dlg-lines {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 4px;
}
.dlg-line {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 8px 8px 8px 6px;
  border-radius: var(--r-sm);
  transition: background var(--t);
}
.dlg-line.is-playing {
  background: var(--accent-soft);
}
.dlg-line .who {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-family: var(--f-display);
  font-size: 1.1rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.dlg-line.voice-A .who {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}
.dlg-line.voice-B .who {
  background: color-mix(in srgb, var(--c-asm) 16%, var(--surface));
  border-color: color-mix(in srgb, var(--c-asm) 35%, var(--line));
}
.dlg-line .said {
  font-family: var(--f-display);
  font-size: 1.22rem;
  line-height: 1.35;
}
.dlg-line .said small {
  margin-left: 10px;
  font-family: var(--f-mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ─── home ───────────────────────────────────────────────────────────────── */
.hero {
  display: grid;
  gap: 36px;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: center;
  padding: 10px 0 34px;
}
.hero h1 {
  font-size: clamp(3rem, 7vw, 5.4rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  margin-bottom: 22px;
}
.hero h1 .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.1em;
  margin-bottom: -0.1em;
}
.hero h1 .line > span {
  display: inline-block;
  animation: line-up 0.9s var(--ease-out) both;
  animation-delay: calc(var(--l, 0) * 90ms + 80ms);
}
.hero .lede {
  animation: rise 0.8s var(--ease-out) 0.35s both;
}
.hero-cta {
  margin-top: 26px;
  animation: rise 0.8s var(--ease-out) 0.45s both;
}
.stage {
  position: relative;
  overflow: hidden;
  padding: 24px 26px 22px;
  border-radius: var(--r-lg);
  background: #17161b;
  color: #f1ebdf;
  box-shadow: var(--shadow-3);
  animation: stage-in 1s var(--ease-out) 0.2s both;
  isolation: isolate;
}
:root[data-theme='dark'] .stage {
  background: #1d1c22;
  border: 1px solid #2f2d36;
}
.stage::before {
  content: '';
  position: absolute;
  inset: -40% -20% auto auto;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgb(255 106 69 / 0.35), transparent);
  filter: blur(10px);
  z-index: -1;
  animation: float 9s ease-in-out infinite;
}
.stage .eyebrow {
  color: #ffb49f;
  margin-bottom: 12px;
}
.stage-toggle {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.07);
  border: 1px solid rgb(255 255 255 / 0.1);
  margin-bottom: 18px;
}
.stage-toggle::before {
  content: '';
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 999px;
  background: #f1ebdf;
  transition: transform 0.4s var(--spring);
}
.stage-toggle[data-mode='natural']::before {
  transform: translateX(100%);
}
.stage-toggle button {
  position: relative;
  z-index: 1;
  min-height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgb(241 235 223 / 0.7);
  font-size: 0.82rem;
  font-weight: 500;
  transition: color var(--t);
}
.stage-toggle button[aria-pressed='true'] {
  color: #17161b;
}
.stage-phrase {
  font-family: var(--f-display);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  line-height: 1.25;
  min-height: 2.6em;
  color: #f1ebdf;
}
.stage-phrase .w {
  display: inline-block;
  transition: margin 0.45s var(--spring);
}
.stage-phrase[data-mode='words'] .w {
  margin-right: 0.45em;
}
.stage-phrase .lk {
  transition:
    width 0.45s var(--spring),
    opacity var(--t);
}
.stage-phrase[data-mode='words'] .lk {
  width: 0;
  opacity: 0;
}
.stage-phrase .lk::after {
  border-bottom-color: #ff6a45;
}
.stage-phrase[data-mode='natural'] .lk::after {
  animation: arc-draw 0.55s var(--ease-out) both;
  animation-delay: calc(var(--arc-delay, 900ms) + var(--k, 0) * 120ms);
}
.stage-phrase .hl {
  color: #ff9a80;
  background: none;
  transition: color var(--t);
}
.stage-phrase[data-mode='words'] .hl {
  color: inherit;
  background: none;
}
.stage .ipa {
  color: rgb(241 235 223 / 0.65);
  font-size: 1.1rem;
  margin: 4px 0 12px;
  min-height: 1.6em;
  transition: opacity var(--t);
}
.stage .pbtn {
  color: #f1ebdf;
  border-color: rgb(255 255 255 / 0.18);
}
.stage .pbtn:hover {
  background: rgb(255 255 255 / 0.08);
  border-color: rgb(255 255 255 / 0.32);
  color: #fff;
}
.stage .pbtn.main {
  background: #ff6a45;
  border-color: #ff6a45;
  color: #1a0b06;
}
.wave {
  position: relative;
  height: 84px;
  margin: 4px -26px 12px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.wave svg {
  position: absolute;
  left: 0;
  top: 0;
  width: 200%;
  height: 100%;
  overflow: visible;
}
.wave path {
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.wave .w1 {
  stroke: #ff6a45;
  animation: wave-x 7s linear infinite;
}
.wave .w2 {
  stroke: rgb(241 235 223 / 0.45);
  animation: wave-x 11s linear infinite reverse;
}
.wave .w3 {
  stroke: rgb(165 148 255 / 0.6);
  animation: wave-x 15s linear infinite;
}
.wave g {
  transform-box: fill-box;
  transform-origin: center;
  transform: scaleY(0.4);
  transition: transform 0.7s var(--spring);
}
.audio-playing .wave g {
  transform: scaleY(1);
}
.marquee {
  position: relative;
  overflow: hidden;
  margin: 18px 0 40px;
  padding: 16px 0;
  border-block: 1px solid var(--line);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track {
  display: flex;
  gap: 52px;
  width: max-content;
  animation: marquee 52s linear infinite;
}
.marquee:hover .marquee-track {
  animation-play-state: paused;
}
.marquee span {
  font-family: var(--f-display);
  font-size: 1.6rem;
  color: var(--ink-2);
  white-space: nowrap;
}
.marquee span i {
  font-family: var(--f-ipa);
  font-style: normal;
  font-size: 1.05rem;
  color: var(--muted);
  margin-left: 10px;
}
.home-section {
  margin: 80px 0;
}
.home-section > h2 {
  max-width: 20ch;
}
.split {
  display: grid;
  gap: 36px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
}
.pull {
  font-family: var(--f-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.2;
  margin: 0;
  color: var(--ink);
}
.pull::before {
  content: '“';
  display: block;
  font-size: 3.4em;
  line-height: 0.6;
  color: var(--accent);
  margin-bottom: 0.1em;
}
.pull cite {
  display: block;
  margin-top: 14px;
  font-family: var(--f-mono);
  font-style: normal;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.minimal-pair {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 14px;
  font-family: var(--f-display);
  font-size: 2.4rem;
  line-height: 1.1;
  margin: 4px 0 12px;
}
.minimal-pair .vs {
  font-family: var(--f-mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.minimal-pair s {
  color: var(--muted);
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}
.frameworks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.framework ol {
  list-style: none;
  counter-reset: fw;
  margin: 14px 0 0;
  padding: 0;
}
.framework li {
  counter-increment: fw;
  position: relative;
  padding: 10px 0 10px 36px;
  border-top: 1px solid var(--line);
}
.framework li::before {
  content: counter(fw, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 14px;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  color: var(--accent-ink);
}
.framework h3 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 1.8rem;
  margin: 12px 0 0;
}
.index-list {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.index-row {
  position: relative;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 20px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
}
.index-row:hover {
  color: var(--ink);
}
.index-row::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--surface);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.4s var(--ease-out);
}
.index-row:hover::before,
.index-row:focus-visible::before {
  transform: scaleY(1);
}
.index-row .idx {
  font-family: var(--f-mono);
  font-size: 0.8rem;
  color: var(--muted);
  transition: color var(--t);
}
.index-row:hover .idx {
  color: var(--accent-ink);
}
.index-row .t {
  display: block;
  font-family: var(--f-display);
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1.1;
  transition: transform 0.4s var(--ease-out);
}
.index-row:hover .t {
  transform: translateX(6px);
}
.index-row .s {
  display: block;
  margin-top: 4px;
  font-size: 0.9rem;
  color: var(--muted);
}
.index-row .go {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  transition:
    background var(--t),
    border-color var(--t),
    color var(--t),
    transform 0.4s var(--spring);
}
.index-row .go svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.index-row:hover .go {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  transform: rotate(-45deg);
}
.cta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.cta-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 230px;
  padding: 26px;
  border-radius: var(--r-lg);
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  transition:
    transform 0.45s var(--ease-out),
    box-shadow 0.45s var(--ease-out);
}
.cta-card:hover {
  color: var(--ink);
  transform: translateY(-4px);
  box-shadow: var(--shadow-3);
}
.cta-card.dark {
  background: #17161b;
  color: #f1ebdf;
  border-color: #17161b;
}
.cta-card.dark:hover {
  color: #f1ebdf;
}
:root[data-theme='dark'] .cta-card.dark {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.cta-card.session {
  background:
    radial-gradient(420px 220px at 100% 0%, color-mix(in srgb, var(--c-glide) 22%, transparent), transparent 70%),
    var(--surface);
  border-color: color-mix(in srgb, var(--c-glide) 40%, var(--line));
}
.cta-card.session .big-num {
  color: var(--c-glide);
}
.cta-card h3 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 2.1rem;
  line-height: 1.05;
  margin: auto 0 0;
}
.cta-card p {
  margin: 0;
  opacity: 0.78;
  font-size: 0.95rem;
}
.cta-card .big-num {
  font-family: var(--f-display);
  font-size: 4.4rem;
  line-height: 0.9;
  color: var(--accent);
}
.cta-card .arrow {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: 0.6;
  transition:
    transform 0.4s var(--spring),
    opacity var(--t);
}
.cta-card .arrow svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.cta-card:hover .arrow {
  transform: rotate(-45deg);
  opacity: 1;
}
.legend-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 30px;
  font-size: 0.95rem;
}
.legend-inline > span {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
}
.legend-inline .sample {
  font-family: var(--f-display);
  font-size: 1.55rem;
}
.notation {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px 18px;
  font-size: 0.92rem;
  color: var(--ink-2);
}
.notation span {
  font-family: var(--f-ipa);
  color: var(--ink);
  font-size: 1.05rem;
}
.colophon {
  margin-top: 64px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 0.84rem;
  color: var(--muted);
}
@media (max-width: 900px) {
  .hero,
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 560px) {
  .index-row {
    grid-template-columns: 30px minmax(0, 1fr) auto;
    gap: 12px;
    padding: 16px 4px;
  }
  .stage {
    padding: 20px 18px 18px;
  }
  .wave {
    margin-inline: -18px;
  }
}

/* ─── practice ───────────────────────────────────────────────────────────── */
.set-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  transition:
    opacity 0.7s var(--ease-out),
    transform 0.4s var(--ease-out),
    box-shadow 0.4s var(--ease-out),
    border-color var(--t);
}
.set-card:hover {
  color: var(--ink);
  border-color: var(--line-2);
  box-shadow: var(--shadow-2);
}
.set-card.in:hover {
  transform: translateY(-3px);
}
.set-card h3 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 1.6rem;
  line-height: 1.1;
}
.set-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.set-card small {
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.05em;
}
.progress {
  height: 4px;
  margin-top: auto;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.6s var(--ease-out);
}
.scorebar {
  position: sticky;
  top: calc(var(--top) + 10px);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 18px 0 22px;
  padding: 8px 8px 8px 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-2);
}
.scorebar .score {
  font-family: var(--f-display);
  font-size: 1.5rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.scorebar .progress {
  flex: 1 1 120px;
  margin: 0;
}
.scorebar .btn {
  min-height: 40px;
}
.items {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
  counter-reset: item;
}
.item {
  counter-increment: item;
}
.item-q {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}
.item-q .q {
  flex: 1 1 240px;
  font-size: 1.12rem;
  line-height: 1.5;
}
.item-q .q::before {
  content: counter(item, decimal-leading-zero);
  margin-right: 12px;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  color: var(--accent-ink);
  vertical-align: 2px;
}
.item-q .q b {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 1.3em;
}
.blank {
  display: inline-block;
  min-width: 4.6em;
  border-bottom: 2px solid var(--line-2);
  text-align: center;
  font-weight: 600;
  transition: border-color var(--t);
}
.blank.filled {
  border-color: var(--accent);
  color: var(--accent-ink);
  animation: pop 0.4s var(--spring);
}
.options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.opt {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  font-family: var(--f-ipa);
  font-size: 1.02rem;
  transition:
    transform var(--t-fast) var(--ease-out),
    background var(--t),
    border-color var(--t),
    color var(--t),
    opacity var(--t);
}
.opt:hover:not(:disabled) {
  border-color: var(--ink);
  transform: translateY(-1px);
}
.opt:active:not(:disabled) {
  transform: scale(0.96);
}
.opt:disabled {
  cursor: default;
}
.opt:disabled:not(.correct):not(.wrong) {
  opacity: 0.45;
}
.opt.correct {
  background: var(--good-soft);
  border-color: var(--good);
  color: var(--good);
  font-weight: 700;
  animation: pop 0.45s var(--spring);
}
.opt.correct::before {
  content: '✓ ';
}
.opt.wrong {
  background: var(--bad-soft);
  border-color: var(--bad);
  color: var(--bad);
  animation: shake 0.4s var(--ease-out);
}
.opt.wrong::before {
  content: '✕ ';
}
.feedback {
  margin-top: 14px;
  font-size: 0.95rem;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  animation: rise 0.35s var(--ease-out);
}
.feedback .verdict {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.feedback .verdict.ok {
  color: var(--good);
}
.feedback .verdict.no {
  color: var(--bad);
}
.passage {
  font-family: var(--f-display);
  font-size: 1.45rem;
  line-height: 2;
}
.pw {
  border: 0;
  background: none;
  padding: 0 4px;
  margin: 0 -2px;
  border-radius: 8px;
  font: inherit;
  color: inherit;
  transition:
    background var(--t-fast),
    color var(--t-fast);
}
.pw:hover {
  background: var(--surface-2);
}
.pw.sel {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.pw.correct {
  background: var(--good-soft);
  color: var(--good);
}
.pw.wrong {
  background: var(--bad-soft);
  color: var(--bad);
  text-decoration: line-through;
}
.pw.missed {
  box-shadow: inset 0 -2px 0 var(--good);
}
.dict-input {
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  margin-top: 12px;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: var(--paper);
  font-size: 1.05rem;
  transition:
    border-color var(--t),
    box-shadow var(--t);
}
.dict-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}
.diff span {
  padding: 1px 5px;
  border-radius: 5px;
  margin-right: 3px;
}
.diff .ok {
  color: var(--good);
}
.diff .missing {
  background: var(--bad-soft);
  color: var(--bad);
  text-decoration: underline wavy;
}
.diff .extra {
  color: var(--muted);
  text-decoration: line-through;
}
.done-panel {
  margin-top: 20px;
  border-color: var(--accent);
  background:
    radial-gradient(600px 200px at 100% 0%, var(--glow), transparent 70%),
    var(--surface);
  animation: rise 0.5s var(--ease-out);
}
.done-panel h2 {
  font-size: 2.1rem;
}
.done-panel .sent {
  color: var(--good);
  margin: 0;
}

/* Session VI (Pronunciation Plus) */
.nav-link.sub {
  padding-left: 30px;
  font-size: 0.9em;
  color: var(--muted);
}
.nav-link.sub::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--c-glide);
}
.practice-group + .practice-group {
  margin-top: 56px;
}
.group-head {
  margin-bottom: 18px;
}
.group-head h2 {
  margin: 4px 0 0;
}
.q-mark {
  font-family: var(--f-display);
  font-size: clamp(1.4rem, 2.8vw, 1.75rem);
  line-height: 1.3;
}
.feedback .dialogue {
  flex: 1 1 100%;
  margin: 4px 0 0;
  padding: 12px 14px;
}
.feedback .dialogue .dlg-head {
  margin-bottom: 6px;
}

/* a conversation to listen to first; the text is blurred until revealed */
.listen-card {
  margin-bottom: 22px;
}
.listen-card .dialogue {
  margin-top: 0;
}
.listen-card .dlg-line .said {
  transition:
    filter 0.6s var(--ease-out),
    opacity 0.6s var(--ease-out);
}
.listen-card[data-transcript='hidden'] .dlg-line .said {
  filter: blur(7px);
  opacity: 0.55;
  user-select: none;
}
.listen-card[data-transcript='shown'] [data-show-text] {
  display: none;
}

/* gap fill: a two-line conversation with a missing word */
.gap-item .dlg-lines {
  margin-top: 12px;
}
.gap-form {
  margin-top: 12px;
}
.gap-form .dict-input {
  flex: 1 1 200px;
  width: auto;
  margin: 0;
}
.compare .examples {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* disappearing /h/: tap the words that lose it */
.hd .said {
  line-height: 1.8;
}
.hw {
  border: 0;
  margin: 0 -1px;
  padding: 0 4px;
  border-radius: 8px;
  background: none;
  font: inherit;
  color: inherit;
  transition:
    background var(--t-fast),
    color var(--t-fast);
}
.hw .h {
  color: var(--c-glide);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.hw:hover:not(:disabled) {
  background: var(--surface-2);
}
.hw.sel {
  background: var(--accent-soft);
}
.hw.sel .h,
.hw.dropped .h {
  color: var(--c-del);
  text-decoration-line: line-through;
}
.hw:disabled {
  cursor: default;
}
.hw.ok {
  background: var(--good-soft);
  color: var(--good);
}
.hw.no {
  background: var(--bad-soft);
  color: var(--bad);
  animation: shake 0.4s var(--ease-out);
}
.hd-check {
  margin: 8px 0 16px;
}

/* the original book recording, from the teacher's Drive */
.book-audio-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.9rem;
}
.book-audio-note svg {
  flex: none;
  width: 16px;
  height: 16px;
  fill: var(--c-glide);
}
.book-audio-note small {
  margin-left: 6px;
  opacity: 0.8;
}
.pick-lines {
  margin: 0;
  padding-left: 1.6em;
}
.pick-lines li::marker {
  font-family: var(--f-mono);
  font-size: 0.7em;
  color: var(--accent-ink);
}
.reveal-h {
  margin: 22px 0 0;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 1.4rem;
}
.examples-first {
  margin-top: 0;
}
.book-audio {
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}
.book-audio figure {
  margin: 0;
  padding: 0 18px 16px;
}
.book-audio figcaption {
  margin-bottom: 6px;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.book-audio summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 600;
}
.book-audio summary svg {
  width: 18px;
  height: 18px;
  fill: var(--c-glide);
}
.book-audio iframe {
  display: block;
  width: 100%;
  height: 64px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

/* Session VI worksheets: the book's sections and numbered steps */
.book-part {
  margin: 44px 0 0;
}
.part-h {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 14px;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(1.7rem, 3.4vw, 2.2rem);
  line-height: 1.1;
}
.part-letter {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.45em;
  height: 1.45em;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-family: var(--f-body);
  font-weight: 700;
  font-size: 0.72em;
}
.part-rule {
  max-width: 72ch;
  margin: 0 0 22px;
  padding: 14px 18px;
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  color: var(--ink-2);
  line-height: 1.6;
}
.step {
  margin: 26px 0 0;
}
.step.plain {
  margin: 0;
}
.step-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.step-n {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-mono);
  font-size: 0.8rem;
  font-weight: 600;
}
.step-task {
  margin: 3px 0 0;
  max-width: 72ch;
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.5;
}
.step-audio svg {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  vertical-align: -3px;
  fill: var(--c-glide);
}
.step-note {
  max-width: 72ch;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.step-head + .step-note,
.step-note + .step-note {
  margin-left: 42px;
}
.step-note.app-voice {
  font-style: italic;
}
.step-body {
  margin-top: 14px;
}
.step-body > .examples {
  margin-top: 0;
}
.lock-note {
  display: none;
}
.step.locked .step-body {
  display: none;
}
.step.locked .lock-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 0 42px;
  padding: 12px 16px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: 0.92rem;
}
.lock-note svg {
  flex: none;
  width: 16px;
  height: 16px;
  fill: var(--muted);
}
.step:not(.locked) > .step-body {
  animation: rise 0.4s var(--ease-out);
}
.item-example {
  counter-increment: item;
  opacity: 0.88;
}
.item-example .feedback {
  animation: none;
}
.dlg-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* draw a linking line: tap the space between two words */
.lk-lines {
  margin: 0 0 14px;
  padding-left: 1.7em;
  display: grid;
  gap: 6px;
}
.lk-lines li::marker {
  font-family: var(--f-mono);
  font-size: 0.75rem;
  color: var(--accent-ink);
}
.lk-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.lk-text {
  font-family: var(--f-display);
  font-size: clamp(1.35rem, 2.6vw, 1.6rem);
  line-height: 2.1;
}
.lk-gap {
  position: relative;
  display: inline-block;
  width: 0.9em;
  height: 1.3em;
  margin: 0 1px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  vertical-align: -0.3em;
  cursor: pointer;
  touch-action: manipulation;
}
.lk-gap:hover:not(:disabled),
.lk-gap:focus-visible {
  background: var(--surface-2);
}
.lk-gap::before {
  content: '';
  position: absolute;
  left: -0.42em;
  right: -0.42em;
  bottom: 0;
  height: 0.42em;
  border: 2.5px solid transparent;
  border-top: 0;
  border-radius: 0 0 1em 1em;
  transition: border-color var(--t-fast);
}
.lk-gap:not([data-state=''])::before {
  border-color: var(--c-glide);
  animation: pop 0.35s var(--spring);
}
.lk-gap::after {
  position: absolute;
  left: 50%;
  top: -0.7em;
  transform: translateX(-50%);
  font-family: var(--f-ipa);
  font-size: 0.6em;
  font-weight: 700;
  color: var(--c-glide);
}
.lk-gap[data-state='y']::after {
  content: '/y/';
}
.lk-gap[data-state='w']::after {
  content: '/w/';
}
.lk-gap:disabled {
  cursor: default;
}
.lk-gap.wrong::before {
  border-color: var(--bad);
}
.lk-gap.wrong::after {
  color: var(--bad);
}
.lk-gap.missed::before {
  border-color: var(--good);
  border-style: dashed;
}
.lk-line.solved .lk-text {
  color: var(--muted);
}
.lk-tag {
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.lk-answer {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: -4px 0 6px;
  animation: rise 0.35s var(--ease-out);
}
.lk-answer .verdict {
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.lk-answer .verdict.ok {
  color: var(--good);
}
.lk-answer .verdict.no {
  color: var(--bad);
}
.lk-right {
  font-family: var(--f-display);
  font-size: 1.2rem;
}

/* choose all that apply */
.sel-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.sel-opts.list {
  flex-direction: column;
  align-items: stretch;
}
.so-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.so {
  min-height: 44px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  font-size: 1.02rem;
  text-align: left;
  transition:
    background var(--t),
    border-color var(--t),
    color var(--t),
    transform var(--t-fast) var(--ease-out);
}
.sel-opts.list .so {
  width: 100%;
  border-radius: var(--r-sm);
  line-height: 1.45;
}
.sel-opts.list .so-wrap {
  display: flex;
}
.so:hover:not(:disabled) {
  border-color: var(--ink);
}
.so:active:not(:disabled) {
  transform: scale(0.97);
}
.so.sel {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.so.sel::before {
  content: '◉ ';
}
.so:disabled {
  cursor: default;
}
.so.ok.sel {
  background: var(--good-soft);
  border-color: var(--good);
  color: var(--good);
}
.so.no {
  background: var(--bad-soft);
  border-color: var(--bad);
  color: var(--bad);
}
.so.missed {
  border-style: dashed;
}
.so.missed::after {
  content: ' ← this one too';
  font-size: 0.8em;
}

/* spelling: add more examples */
.spell {
  display: grid;
  gap: 4px;
  padding: 10px 18px;
}
.sp-row {
  display: grid;
  grid-template-columns: minmax(70px, 150px) minmax(0, 1fr);
  gap: 4px 16px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.sp-row:last-child {
  border-bottom: 0;
}
.sp-label {
  font-weight: 700;
  font-family: var(--f-ipa);
  font-size: 1.05rem;
}
.sp-words {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  font-family: var(--f-display);
  font-size: 1.25rem;
}
.sp-row.info {
  color: var(--muted);
}
.sp-in {
  width: 9.5em;
  min-height: 40px;
  padding: 4px 12px;
  border: 0;
  border-bottom: 2px solid var(--line-2);
  border-radius: 8px 8px 0 0;
  background: var(--paper);
  font-family: var(--f-display);
  font-size: 1.2rem;
}
.sp-in:focus {
  outline: none;
  border-color: var(--accent);
}
.sp-in.ok {
  border-color: var(--good);
  color: var(--good);
}
.sp-in.no {
  border-color: var(--bad);
  color: var(--bad);
}
.sp-fb {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-size: 0.92rem;
  animation: rise 0.35s var(--ease-out);
}
.sp-fb .sp-ok {
  color: var(--good);
}
.sp-fb .sp-no {
  color: var(--bad);
}
@media (max-width: 640px) {
  .sp-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* write the answer, role-play, interview, sentence builder */
.from {
  color: var(--muted);
}
.from .q-mark {
  font-size: 1.15rem;
  color: var(--ink);
}
.free-rec p {
  margin: 0 0 10px;
}
.opt.chosen {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.iv {
  counter-increment: item;
}
.dlg-line .who.long {
  font-size: 0.8rem;
}
@media (max-width: 640px) {
  .build .dlg-line {
    grid-template-columns: 38px minmax(0, 1fr);
  }
  .build .dlg-actions {
    grid-column: 2;
  }
}
.iv-total {
  margin-top: 14px;
  font-size: 1.05rem;
}
.iv-total b {
  font-family: var(--f-display);
  font-size: 1.5rem;
  font-weight: 400;
}
.build .said {
  line-height: 2;
}
.bd-sel {
  min-height: 40px;
  max-width: 100%;
  padding: 2px 8px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--paper);
  color: var(--accent-ink);
  font-family: var(--f-display);
  font-size: 1.1rem;
}

/* ─── lab ────────────────────────────────────────────────────────────────── */
.lab-input {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  padding: 18px 20px;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: var(--surface);
  font-family: var(--f-display);
  font-size: 1.6rem;
  line-height: 1.35;
  box-shadow: var(--shadow-1);
  transition:
    border-color var(--t),
    box-shadow var(--t);
}
.lab-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 14%, transparent);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 24px;
}
.chip {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 0.86rem;
  color: var(--ink-2);
  transition:
    background var(--t-fast),
    border-color var(--t-fast),
    transform var(--t-fast);
}
.chip:hover {
  background: var(--surface);
  border-color: var(--line-2);
  transform: translateY(-1px);
}
.annot {
  font-family: var(--f-display);
  font-size: clamp(1.7rem, 4.2vw, 2.5rem);
  line-height: 2.5;
  padding: 4px 6px 16px;
  word-spacing: 0.04em;
}
.aw {
  position: relative;
}
.aw.weak {
  color: color-mix(in srgb, var(--ink) 70%, var(--muted));
  text-decoration: underline dotted var(--c-weak);
  text-decoration-thickness: 2px;
  text-underline-offset: 8px;
}
.aw .d {
  color: var(--c-del);
  text-decoration: line-through;
  opacity: 0.7;
}
.aw .h {
  color: var(--c-flap);
}
.jn {
  position: relative;
  display: inline-block;
  min-width: 0.42em;
  text-align: center;
}
.jn .arc {
  position: relative;
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  vertical-align: -0.34em;
}
.jn .arc::after {
  border-bottom-color: currentColor;
  animation: arc-draw 0.5s var(--ease-out) both;
}
.jn .lab {
  position: absolute;
  left: 50%;
  top: 70%;
  translate: -50% 0;
  font-family: var(--f-ipa);
  font-size: 0.42em;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  padding: 3px 6px;
  border-radius: 7px;
  background: var(--surface);
  border: 1px solid currentColor;
  animation: pop 0.45s var(--spring) both;
}
.red {
  position: relative;
  border-bottom: 3px solid var(--c-red);
  padding-bottom: 2px;
}
.red::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translate(-50%, 6px);
  font-family: var(--f-mono);
  font-size: 0.34em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-red);
  line-height: 1;
  white-space: nowrap;
}
.t-link,
.t-resyllabification,
.t-link-cv,
.t-vv-smooth {
  color: var(--c-link);
}
.t-glide {
  color: var(--c-glide);
}
.t-palatalization {
  color: var(--c-pal);
}
.t-nasal-assimilation,
.t-place-assimilation,
.t-sibilant-assimilation {
  color: var(--c-asm);
}
.t-td-deletion,
.t-h-drop,
.t-syncope,
.t-disappearing-t {
  color: var(--c-del);
}
.t-gemination,
.t-unreleased {
  color: var(--c-gem);
}
.t-flap {
  color: var(--c-flap);
}
.t-reduction {
  color: var(--c-red);
}
.t-weak-form {
  color: var(--c-weak);
}
.findings {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.finding {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  animation: rise 0.4s var(--ease-out) both;
}
.finding:nth-child(2) {
  animation-delay: 40ms;
}
.finding:nth-child(3) {
  animation-delay: 80ms;
}
.finding:nth-child(4) {
  animation-delay: 120ms;
}
.finding:nth-child(n + 5) {
  animation-delay: 160ms;
}
.finding .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 18%, transparent);
}
.finding .what {
  color: var(--ink);
}
.finding .what .res {
  font-family: var(--f-ipa);
  color: var(--muted);
  margin-left: 6px;
}
.finding a {
  font-family: var(--f-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.weak-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.weak-list span {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px dashed var(--c-weak);
  font-family: var(--f-ipa);
  font-size: 0.92rem;
}
.lab-grid {
  display: grid;
  gap: 22px;
}

/* ─── voice engine panel ─────────────────────────────────────────────────── */
.engine-panel {
  position: absolute;
  right: -48px;
  top: calc(100% + 12px);
  z-index: 60;
  width: min(420px, calc(100vw - 24px));
  max-height: min(700px, calc(100dvh - var(--top) - 24px));
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-3);
  transform-origin: calc(100% - 100px) -8px;
  animation: panel-in 0.38s var(--spring);
  overflow: hidden;
}
.engine-panel.closing {
  animation: panel-out 0.16s var(--ease-in) forwards;
}
@media (max-width: 560px) {
  .engine-wrap {
    position: static;
  }
  .engine-panel {
    position: fixed;
    left: 12px;
    right: 12px;
    top: calc(var(--top) + 8px);
    width: auto;
    transform-origin: 60% -8px;
  }
}
.vp-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 12px;
}
.vp-head h2 {
  font-size: 2rem;
  margin: 0;
}
.vp-head .eyebrow {
  margin-bottom: 6px;
}
.vp-body {
  padding: 0 20px 16px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.seg {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  margin-bottom: 14px;
}
.seg::before {
  content: '';
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: transform 0.4s var(--spring);
}
.seg[data-value='browser']::before {
  transform: translateX(100%);
}
.seg button {
  position: relative;
  z-index: 1;
  min-height: 40px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
  transition: color var(--t);
}
.seg button[aria-checked='true'] {
  color: var(--ink);
}
.vp-status {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 0.86rem;
  line-height: 1.45;
  margin-bottom: 14px;
}
.vp-status .dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--muted);
}
.vp-status.ok .dot {
  background: var(--good);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 20%, transparent);
}
.vp-status.warn .dot {
  background: var(--warn);
}
.vp-status.busy .dot {
  background: var(--accent);
  animation: breathe 1s ease-in-out infinite;
}
.vp-usage .bar {
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin: 8px 0 3px;
}
.vp-usage .bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.6s var(--ease-out);
}
.vp-usage small {
  font-family: var(--f-mono);
  font-size: 0.64rem;
  color: var(--muted);
}
.vp-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.vp-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: transparent;
  text-align: left;
  transition:
    border-color var(--t),
    background var(--t),
    box-shadow var(--t);
}
.vp-tab small {
  font-family: var(--f-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.vp-tab span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--f-display);
  font-size: 1.3rem;
  line-height: 1.1;
}
.vp-tab[aria-selected='true'] {
  border-color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.vp-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.vp-search {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 0.9rem;
}
.vp-search:focus {
  outline: none;
  border-color: var(--accent);
}
.vp-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--ink-2);
  white-space: nowrap;
}
.vp-filter input {
  accent-color: var(--accent);
}
.vp-list {
  list-style: none;
  margin: 0;
  padding: 2px;
  display: grid;
  gap: 4px;
  max-height: 300px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.vp-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  animation: rise 0.3s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 22ms);
}
.vp-pick {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 18px;
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 6px 10px 6px 6px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  text-align: left;
  transition:
    background var(--t-fast),
    border-color var(--t-fast);
}
.vp-pick:hover {
  background: var(--surface-2);
}
.vp-pick[aria-selected='true'] {
  background: var(--surface);
  border-color: var(--line-2);
  box-shadow: var(--shadow-1);
}
.vp-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-family: var(--f-display);
  font-size: 1.15rem;
  color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 72% 58%), hsl(calc(var(--h) + 40) 62% 40%));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.18);
}
.vp-name {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
}
.vp-meta {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vp-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--line-2);
  transition:
    background var(--t),
    border-color var(--t);
}
.vp-pick[aria-selected='true'] .vp-check {
  border-color: var(--accent);
  background: radial-gradient(circle, var(--accent) 45%, transparent 50%);
  animation: pop 0.35s var(--spring);
}
.vp-preview.pbtn {
  width: 40px;
  min-height: 40px;
  padding: 0;
}
.vp-empty {
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}
.vp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 60%, transparent);
}
.vp-foot a {
  font-family: var(--f-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.vp-disabled .vp-tabs,
.vp-disabled .vp-tools,
.vp-disabled .vp-list {
  opacity: 0.45;
  pointer-events: none;
}

/* ─── settings / forms ───────────────────────────────────────────────────── */
.form {
  display: grid;
  gap: 18px;
}
.form h2 {
  margin: 0;
}
.field label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--f-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.field .hint {
  margin-top: 6px;
  font-size: 0.84rem;
  color: var(--muted);
}
.field input[type='text'],
.field input[type='password'],
.field select {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--paper);
  transition:
    border-color var(--t),
    box-shadow var(--t);
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.check input {
  margin-top: 5px;
  accent-color: var(--accent);
}
.kv {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 18px;
  font-size: 0.92rem;
  margin: 0;
}
.kv dt {
  font-family: var(--f-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 3px;
}
.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.meter {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  margin: 8px 0 4px;
}
.meter span {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 0.6s var(--ease-out);
}
.settings-stack {
  display: grid;
  gap: 18px;
}
details.card > summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--f-display);
  font-size: 1.6rem;
}
details.card > summary::-webkit-details-marker {
  display: none;
}
details.card > summary::after {
  content: '+';
  float: right;
  font-family: var(--f-mono);
  font-size: 1.1rem;
  color: var(--muted);
  transition: transform var(--t) var(--ease-out);
}
details.card[open] > summary::after {
  transform: rotate(45deg);
}
details.card[open] > summary {
  margin-bottom: 14px;
}

/* ─── toast ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 100;
  max-width: min(92vw, 560px);
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.9rem;
  box-shadow: var(--shadow-3);
  transform: translateX(-50%);
  animation: toast-in 0.45s var(--spring);
}

/* ─── reveal on scroll ───────────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.7s var(--ease-out),
    transform 0.7s var(--ease-out),
    box-shadow var(--t) var(--ease-out),
    border-color var(--t);
  transition-delay: calc(var(--i, 0) * 45ms), calc(var(--i, 0) * 45ms), 0s, 0s;
}
.reveal.in {
  opacity: 1;
  transform: none;
}

/* ─── page transitions (View Transitions API) ────────────────────────────── */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
}
::view-transition-old(page) {
  animation: page-out 0.16s var(--ease-in) both;
}
::view-transition-new(page) {
  animation: page-in 0.42s var(--ease-out) both;
}

/* ─── keyframes ──────────────────────────────────────────────────────────── */
@keyframes eq {
  0%,
  100% {
    transform: scaleY(0.25);
  }
  50% {
    transform: scaleY(1);
  }
}
@keyframes arc-draw {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}
@keyframes arc-pulse {
  0%,
  100% {
    clip-path: inset(0 0 0 0);
    border-bottom-width: 2px;
    filter: none;
  }
  35% {
    clip-path: inset(0 0 0 0);
    border-bottom-width: 3.5px;
    filter: drop-shadow(0 2px 6px var(--accent));
  }
}
@keyframes arc-flow {
  to {
    stroke-dashoffset: -40;
  }
}
@keyframes ripple {
  from {
    opacity: 0.8;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(1.5);
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes breathe {
  50% {
    opacity: 0.35;
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes pop {
  0% {
    transform: scale(0.9);
  }
  60% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes shake {
  20%,
  60% {
    transform: translateX(-4px);
  }
  40%,
  80% {
    transform: translateX(4px);
  }
}
@keyframes line-up {
  from {
    transform: translateY(105%);
  }
}
@keyframes stage-in {
  from {
    opacity: 0;
    transform: translateY(24px) rotate(1.2deg) scale(0.97);
  }
}
@keyframes float {
  50% {
    transform: translate(-30px, 24px);
  }
}
@keyframes wave-x {
  to {
    transform: translateX(-50%);
  }
}
@keyframes marquee {
  to {
    transform: translateX(-50%);
  }
}
@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.94);
  }
}
@keyframes panel-out {
  to {
    opacity: 0;
    transform: translateY(-4px) scale(0.97);
  }
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 16px) scale(0.96);
  }
}
@keyframes page-out {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}
@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}
@keyframes grow-x {
  to {
    transform: scaleX(1);
  }
}
@keyframes grow-y {
  from {
    transform: scaleY(0);
  }
}

/* ─── reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
  .reveal .lk::after {
    clip-path: none;
  }
  .marquee-track {
    animation: none;
  }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}
