:root {
  --bg: #f6f5f2;
  --panel: #ffffff;
  --ink: #17171a;
  --muted: #6b6b73;
  --faint: #a9a9b0;
  --line: #e4e2dc;
  --accent: #3b5bdb;
  --accent-ink: #ffffff;
  --accent-soft: #e8ecfb;
  --live: #d6336c;
  --ok: #2b8a3e;
  --warn: #b35c00;
  --radius: 14px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111114;
    --panel: #1a1a1f;
    --ink: #ececf1;
    --muted: #9a9aa5;
    --faint: #5e5e68;
    --line: #2a2a31;
    --accent: #7c95ff;
    --accent-ink: #0d0f1a;
    --accent-soft: #232a45;
    --live: #ff6b9a;
    --ok: #69db7c;
    --warn: #ffa94d;
  }
}
:root[data-theme="dark"] {
  --bg: #111114; --panel: #1a1a1f; --ink: #ececf1; --muted: #9a9aa5; --faint: #5e5e68; --line: #2a2a31;
  --accent: #7c95ff; --accent-ink: #0d0f1a; --accent-soft: #232a45; --live: #ff6b9a; --ok: #69db7c; --warn: #ffa94d;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.top, main, footer { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.top { padding-top: 40px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 12px; }
.mark { display: inline-flex; gap: 3px; align-items: center; height: 28px; }
.mark i { display: block; width: 4px; border-radius: 2px; background: var(--accent); }
.mark i:nth-child(1) { height: 10px; } .mark i:nth-child(2) { height: 22px; } .mark i:nth-child(3) { height: 28px; }
.mark i:nth-child(4) { height: 16px; } .mark i:nth-child(5) { height: 8px; }
h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; font-weight: 700; }
h1 span { color: var(--muted); font-weight: 500; }
.lede { margin: 10px 0 0; color: var(--muted); max-width: 640px; }

main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding-top: 24px;
  padding-bottom: 24px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  min-width: 0;
}
.panel.wide { grid-column: 1 / -1; }
@media (max-width: 720px) { main { grid-template-columns: 1fr; } }

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
h2 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: 0.01em; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.row.end { justify-content: flex-end; margin-top: 10px; }
.hint { color: var(--muted); font-size: 13.5px; }

.pill {
  font-size: 12.5px; padding: 3px 10px; border-radius: 999px;
  background: var(--bg); color: var(--muted); border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.pill.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.pill.busy { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.pill.err { color: var(--live); border-color: color-mix(in srgb, var(--live) 35%, transparent); }

button, .file-btn {
  font: inherit; font-size: 14.5px; cursor: pointer;
  border-radius: 10px; padding: 9px 16px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink);
  transition: background .15s, border-color .15s, opacity .15s;
}
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.primary:hover:not(:disabled) { filter: brightness(1.06); }
button.ghost:hover:not(:disabled), .file-btn:hover { border-color: var(--faint); }
button.small { padding: 5px 12px; font-size: 13px; }
.file-btn input { display: none; }
button:focus-visible, .file-btn:focus-within, .drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.progress { margin-bottom: 14px; }
.bar { height: 6px; border-radius: 3px; background: var(--bg); overflow: hidden; border: 1px solid var(--line); }
.fill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progress-text { margin-top: 6px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.facts {
  margin-top: 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px;
}
.fact { background: var(--bg); border-radius: 10px; padding: 8px 12px; }
.fact b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.fact span { font-size: 12px; color: var(--muted); }

.segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.segmented button { text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; min-width: 0; }
.segmented button small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.segmented button[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
#backend-note { margin: 10px 0 0; min-height: 1.5em; }
.device { margin: 6px 0 0; font-size: 12.5px; color: var(--faint); }
#backend-note a { color: var(--accent); }

.mic { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.mic svg { width: 18px; height: 18px; fill: currentColor; }
.mic[aria-pressed="true"] { background: var(--live); border-color: var(--live); color: #fff; }
.meter { width: 120px; height: 6px; border-radius: 3px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.meter div { height: 100%; width: 0; background: var(--live); transition: width .06s linear; }

.transcript {
  margin-top: 14px; min-height: 96px; max-height: 360px; overflow: auto;
  padding: 14px 16px; border-radius: 10px; background: var(--bg);
  font-size: 17px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
}
.transcript .placeholder { color: var(--faint); }
.transcript .partial { color: var(--muted); }
.words span.w { cursor: pointer; border-radius: 4px; }
.words span.w:hover { background: var(--accent-soft); }
.words span.w.now { background: var(--accent-soft); color: var(--accent); }

.drop {
  display: block; border: 1.5px dashed var(--faint); border-radius: 12px; padding: 22px;
  text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop strong { color: var(--ink); }
.drop input { display: none; }
.result { margin-top: 16px; }
.stat { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; margin-bottom: 10px; }
.stat b { color: var(--ink); }
audio { width: 100%; height: 36px; }

footer { color: var(--faint); font-size: 12.5px; padding-bottom: 40px; }
footer a { color: var(--muted); }
