
  :root {
    --bg: #fff;
    --card: oklch(0.975 0 0);
    --fg: oklch(0.145 0 0);
    --muted: oklch(0.556 0 0);
    --border: oklch(0 0 0 / 10%);
    --tok-a: oklch(0.935 0.028 245);
    --tok-b: oklch(0.94 0.038 85);
    --tok-line: oklch(0 0 0 / 40%);
    color-scheme: light;
  }
  html.dark {
    --bg: oklch(0.145 0 0);
    --card: oklch(0.205 0 0);
    --fg: oklch(0.985 0 0);
    --muted: oklch(0.708 0 0);
    --border: oklch(1 0 0 / 10%);
    /* Token chips carry the structure, so they need more than the hairline the
       rest of the page uses — a 10% outline reads as ~#2e2e2e here, invisible
       below full screen brightness (same in reverse for light). Alternating two
       faint tints makes each boundary readable from the fill alone. */
    --tok-a: oklch(0.275 0.032 245);
    --tok-b: oklch(0.275 0.038 80);
    --tok-line: oklch(1 0 0 / 30%);
    color-scheme: dark;
  }
  * { box-sizing: border-box; margin: 0; }
  body {
    background: var(--bg);
    color: var(--fg);
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.5;
  }
  .mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  }
  main { max-width: 42rem; margin: 0 auto; padding: 0 1.25rem 3rem; }
  header {
    display: flex; align-items: baseline; justify-content: space-between;
    padding: 1.1rem 0 0.4rem;
  }
  header h1 { font-size: 15px; font-weight: 500; }
  header h1, nav, .meta, .stats, footer, textarea, .gap-row, .empty {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  }
  nav { display: flex; gap: 1rem; font-size: 13px; }
  nav a, nav button, nav select {
    background: none; border: 0; padding: 0; cursor: pointer;
    color: var(--muted); font: inherit; text-decoration: none;
  }
  nav a:hover, nav button:hover, nav select:hover { color: var(--fg); }
  nav select { appearance: none; -webkit-appearance: none; }
  .stats {
    font-size: 11px; color: var(--muted);
    letter-spacing: 0.02em;
    padding-bottom: 1rem; border-bottom: 1px solid var(--border);
  }
  textarea {
    width: 100%;
    margin-top: 1.25rem;
    background: var(--card);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    padding: 0.75rem 0.9rem;
    font-size: 13px;
    line-height: 1.55;
    min-height: 9.5rem;
    resize: vertical;
    outline: none;
  }
  textarea:focus { border-color: oklch(0.556 0 0 / 45%); }
  #out { margin-top: 0.5rem; }
  #out > div { padding: 0.7rem 0; border-bottom: 1px solid var(--border); }
  .meta {
    font-size: 11px; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.08em;
    margin-bottom: 0.35rem;
  }
  .sent { white-space: pre-wrap; word-break: break-word; }
  .tok {
    box-shadow: 0 0 0 1px var(--tok-line);
    border-radius: 4px;
    padding: 0 1px;
  }
  .tok.a { background: var(--tok-a); }
  .tok.b { background: var(--tok-b); }
  .gap-row { font-size: 11px; color: var(--muted); }
  .gap-row .g { opacity: 0.75; }
  #rust {
    margin-top: 1.4rem; padding-top: 0.9rem; border-top: 1px solid var(--border);
    font-family: ui-monospace, monospace; font-size: 11.5px; line-height: 1.55;
    color: var(--muted); overflow-x: auto; white-space: pre;
  }
  #rust:empty { display: none; }
  .empty { font-size: 13px; color: var(--muted); padding: 1.5rem 0; }
  footer {
    display: flex; justify-content: space-between;
    font-size: 11px; color: var(--muted);
    padding-top: 0.7rem;
  }

  .demo-tabs { gap: 0.25rem; margin: 0.8rem 0 1rem; border-bottom: 1px solid var(--border); }
  .demo-tabs a { padding: 0.65rem 0.9rem; border-bottom: 2px solid transparent; }
  .demo-tabs a[aria-current="page"] { color: var(--fg); border-color: var(--fg); }
  a { color: inherit; }
  button:disabled { cursor: default; opacity: 0.5; }
  :focus-visible { outline: 2px solid var(--fg); outline-offset: 4px; }
  .intro { color: var(--muted); margin: 1.25rem 0; }
  .audio-input { padding: 1rem; background: var(--card); border: 1px solid var(--border); border-radius: 0.6rem; }
  .audio-input label { display: block; margin-bottom: 0.5rem; }
  input[type="file"] { max-width: 100%; font: inherit; }
  .actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }
  .actions button { font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--tok-line); border-radius: 0.4rem; padding: 0.45rem 0.8rem; cursor: pointer; }
  .actions button:disabled { cursor: default; }
  audio { width: 100%; margin-top: 1rem; }
  [hidden] { display: none !important; }
  .hint { font-size: 12px; color: var(--muted); margin-top: 0.8rem; }
  #status { margin-top: 1rem; min-height: 3rem; font-size: 13px; }
  #result { border-top: 1px solid var(--border); padding-top: 1rem; }
  #ipa { font-size: 26px; line-height: 1.6; overflow-wrap: anywhere; margin-bottom: 1rem; }
  #phones { display: flex; flex-wrap: wrap; gap: 0.5rem; }
  .phone { border: 1px solid var(--tok-line); border-radius: 0.4rem; padding: 0.4rem 0.6rem; background: var(--tok-a); }
  .phone summary { cursor: pointer; }
  .phone small { color: var(--muted); font-size: 11px; }
  .phone p { font-size: 13px; margin-top: 0.4rem; }
  @media (max-width: 600px) {
    header { align-items: flex-start; gap: 0.7rem; flex-wrap: wrap; }
    header nav { flex-wrap: wrap; gap: 0.7rem; }
    footer { flex-wrap: wrap; gap: 0.5rem; }
  }

  #ipa { margin-bottom: 0.4rem; }
  #ipa .current-phone { outline: 2px solid var(--fg); outline-offset: 2px; }
  .frame-view { margin: 1.4rem 0; }
  #frame-strip { display: block; width: 100%; height: 40px; margin-top: 0.5rem; border: 1px solid var(--border); }
  #frame-cursor { width: 100%; margin: 0.6rem 0; }
  #frame-detail { font-size: 12px; min-height: 3rem; overflow-wrap: anywhere; }
  #model-version, #status { overflow-wrap: anywhere; }
