:root {
  --bg: #f2efe7;
  --surface: #fbfaf6;
  --ink: #1e1d1a;
  --muted: #6d685e;
  --line: #d8d2c4;
  --accent: #3b6a4c;
  --accent-ink: #f6f4ee;
  --mark: #e6d39b;
  --rec: #b4432f;
  --h: 34px;
  --r: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151513;
    --surface: #1c1c19;
    --ink: #ebe6da;
    --muted: #9b958a;
    --line: #34332e;
    --accent: #8cb796;
    --accent-ink: #12130f;
    --mark: #57492a;
    --rec: #e07a63;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151513; --surface: #1c1c19; --ink: #ebe6da; --muted: #9b958a; --line: #34332e;
  --accent: #8cb796; --accent-ink: #12130f; --mark: #57492a; --rec: #e07a63; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 "IBM Plex Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
main { max-width: 780px; margin: 0 auto; padding: 20px 16px 24px; display: flex; flex-direction: column; gap: 12px; }

header h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.tag { font: 500 11px/1 "IBM Plex Mono", monospace; border: 1px solid var(--line); color: var(--muted); padding: 4px 6px; border-radius: 4px; }
.links { margin: 4px 0 0; font: 12.5px/1.4 "IBM Plex Mono", monospace; }
.links .sep { color: var(--line); margin: 0 4px; }
.sub { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bar > .status, .bar > #copyBtn { margin-left: auto; }

button { font: inherit; color: inherit; }
.btn, .chip, .seg button {
  height: var(--h); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  cursor: pointer; font-size: 13px; font-weight: 500; white-space: nowrap; user-select: none;
}
.btn:hover:not(:disabled), .chip:hover:not(:disabled) { border-color: var(--muted); }
.btn:disabled, .chip:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); min-width: 112px; }
.btn.primary:hover:not(:disabled) { border-color: var(--accent); filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.chip { font-weight: 400; padding: 0 10px; }
.chip.on { border-color: var(--ink); }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; height: var(--h); }
.seg button { border: 0; border-radius: 0; height: 100%; background: transparent; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--ink); color: var(--bg); }
.seg button small { font: 400 11px "IBM Plex Mono", monospace; opacity: .75; }
.seg.small button { font-size: 12.5px; padding: 0 10px; }

.status { display: inline-flex; align-items: center; gap: 6px; font: 12px/1 "IBM Plex Mono", monospace; color: var(--muted); }
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.status.ready .dot { background: var(--accent); }
.status.busy .dot { background: var(--mark); }
.status.err { color: var(--rec); }
.status.err .dot { background: var(--rec); }

.progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
#progressFill { height: 100%; width: 0; background: var(--accent); transition: width .15s linear; }

.inputs .divider { width: 1px; height: 20px; background: var(--line); margin: 0 2px; }
.examples { display: flex; gap: 6px; flex-wrap: wrap; }
.recdot { width: 8px; height: 8px; border-radius: 50%; background: var(--rec); }
#recBtn.recording { border-color: var(--rec); color: var(--rec); }
#recBtn.recording .recdot { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }

.player audio { flex: 1 1 240px; height: var(--h); min-width: 0; }
.clipname { font: 12px "IBM Plex Mono", monospace; color: var(--muted); margin-top: -4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.transcript { font-size: 16px; line-height: 1.7; min-height: 96px; padding: 2px 2px; word-wrap: break-word; }
.transcript.empty { color: var(--muted); font-size: 14px; }
.transcript .w { cursor: pointer; border-radius: 3px; padding: 1px 0; }
.transcript .w:hover { text-decoration: underline; text-decoration-color: var(--line); }
.transcript .w.cur { background: var(--mark); }
.wordlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 2px 12px; max-height: 360px; overflow: auto; font-size: 13px; }
.wordlist div { display: flex; gap: 8px; padding: 2px 4px; border-radius: 3px; cursor: pointer; }
.wordlist div:hover { background: var(--bg); }
.wordlist div.cur { background: var(--mark); }
.wordlist time { font: 11.5px/1.9 "IBM Plex Mono", monospace; color: var(--muted); flex: none; }
.stats { font: 12px "IBM Plex Mono", monospace; color: var(--muted); border-top: 1px solid var(--line); padding-top: 8px; min-height: 18px; }
.stats:empty { display: none; }

footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); padding: 0 2px; }

@media (max-width: 560px) {
  main { padding: 14px 16px 20px; }
  .bar > .status { margin-left: 0; width: 100%; }
  .inputs .divider { display: none; }
  .seg button small { display: none; }
  .player .btn.primary { flex: 1 1 100%; }
}
.slash { color: var(--line); font-weight: 400; }
