:root {
  --bg: #0f1115; --card: #181b22; --line: #262a33; --fg: #e8e9ec; --muted: #8b90a0;
  --accent: #f2b544; --accent2: #5ec8ff; --danger: #ff6b6b;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.4 -apple-system, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif; }
.layout { display: flex; gap: 16px; max-width: 1000px; margin: 0 auto; padding: 20px 16px 48px; align-items: flex-start; }
main { flex: 0 0 520px; max-width: 520px; display: flex; flex-direction: column; gap: 14px; }
.side { flex: 1 1 300px; min-width: 260px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 16px; }
@media (max-width: 880px) { .layout { flex-direction: column; } main { flex: none; max-width: 100%; width: 100%; } .side { position: static; width: 100%; } }
.speed input[type=range]::-webkit-slider-runnable-track { background: linear-gradient(90deg, var(--accent2), #9be0ff); }
.lines { max-height: 60vh; overflow-y: auto; margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.line { padding: 8px 10px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; }
.line:hover { border-color: var(--line); }
.line.cur { background: #24201a; border-color: var(--accent); }
.line .who { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.line .tgt { font-size: 18px; line-height: 1.35; }
.line.narr .tgt { font-size: 14px; color: var(--muted); }
.line .rom { font-size: 13px; color: var(--accent2); }
.line .eng { font-size: 13px; color: var(--muted); }
.line.chunk .tgt { font-size: 15px; padding-left: 12px; }
.transcript.hidden .lines, .transcript.hidden .hint { display: none; }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
h1 { font-size: 20px; margin: 0; letter-spacing: .3px; }
.langs { display: flex; gap: 6px; }
.langs button { background: var(--card); border: 1px solid var(--line); color: var(--muted); padding: 8px 12px;
  border-radius: 999px; font-size: 14px; cursor: pointer; }
.langs button.on { color: var(--fg); border-color: var(--accent); background: #2a2413; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
select, input[type=text], input:not([type]) { width: 100%; margin-top: 6px; background: #0f1115; color: var(--fg);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 16px; }
details { margin-top: 10px; }
summary { color: var(--accent2); cursor: pointer; font-size: 14px; }
.row { display: flex; gap: 8px; margin-top: 8px; }
.row input { margin-top: 0; }
button { font: inherit; cursor: pointer; }
#genbtn { background: var(--accent2); color: #08141c; border: 0; border-radius: 10px; padding: 0 14px; font-weight: 600; }
#genbtn:disabled { opacity: .5; cursor: default; }
.hint { color: var(--muted); font-size: 13px; margin-top: 6px; min-height: 1em; }
.knobhead { display: flex; justify-content: space-between; align-items: baseline; }
.knobhead b { color: var(--accent); font-size: 22px; }
input[type=range] { width: 100%; margin: 14px 0 6px; -webkit-appearance: none; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, #3aa66a, var(--accent) 55%, var(--danger)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; border-radius: 50%; margin-top: -11px;
  background: #fff; border: 4px solid var(--bg); box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.now { min-height: 120px; text-align: center; }
#unit { font-size: 18px; font-weight: 600; }
.cue { color: var(--muted); font-size: 15px; margin-top: 6px; min-height: 1.4em; }
.cue.turn { color: var(--accent); font-weight: 600; }
.bar { height: 4px; background: var(--line); border-radius: 2px; margin-top: 12px; overflow: hidden; }
#barfill { height: 100%; width: 0; background: var(--accent); transition: width linear; }
.transport { display: flex; justify-content: center; align-items: center; gap: 22px; margin-top: 6px; }
.transport button { width: 54px; height: 54px; border-radius: 50%; border: 1px solid var(--line); background: var(--card);
  color: var(--fg); font-size: 20px; }
.transport button.big { width: 92px; height: 92px; font-size: 38px; background: var(--accent); color: #1a1200; border: 0;
  box-shadow: 0 6px 24px rgba(242,181,68,.35); }
.transport button.big.playing { background: var(--fg); color: var(--bg); }
footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 13px; padding: 0; }
.err { color: var(--danger); }
