:root {
  --bg: #0f1115; --panel: #171a21; --panel2: #1d212a; --line: #2a303c; --text: #eef1f6; --muted: #8f98ab;
  --accent: #3ddbc0; --danger: #ff4d5e; --others: #ffb454; --me: #5aa9ff; --sub: 28px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; overscroll-behavior: none; }
body { display: flex; flex-direction: column; height: 100dvh; padding: env(safe-area-inset-top) 0 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; }
.logo { width: 20px; height: 20px; border-radius: 6px; background: conic-gradient(from 200deg, var(--accent), var(--me), var(--others), var(--accent)); }
.status { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: #4cd964; } .dot.mock { background: var(--others); } .dot.bad { background: var(--danger); }
.icon-btn { background: none; border: 0; font-size: 20px; padding: 6px 8px; color: var(--muted); }
.sheet { margin: 8px 16px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.sheet h2 { margin: 0 0 6px; font-size: 17px; } .sheet p { margin: 0 0 12px; color: var(--muted); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; } .sheet-head h2 { margin: 0; }
.player { width: 100%; margin-bottom: 8px; color-scheme: dark; }
#recList { max-height: 38vh; overflow-y: auto; color: var(--muted); }
.rec-item { padding: 10px 0; border-top: 1px solid var(--line); color: var(--text); }
.rec-item small { display: block; color: var(--muted); margin-top: 2px; }
.rec-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
code { background: var(--panel2); padding: 1px 6px; border-radius: 5px; }
input, select { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; width: 100%; }
select { width: auto; padding: 8px 10px; }
.row { display: flex; gap: 10px; align-items: center; margin-top: 12px; } .row.tight { margin-top: 8px; gap: 6px; flex-wrap: nowrap; }
.row.tight select { flex: 1; min-width: 0; font-size: 14px; padding: 8px 8px; }
.row.tight .chip-btn { padding: 8px 12px; white-space: nowrap; }
.btn { padding: 11px 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #05221d; font-weight: 600; }
.err { color: var(--danger); min-height: 1.2em; margin: 8px 0 0 !important; }
.stage { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 18px 14px; display: flex; flex-direction: column; }
.subs { margin-top: auto; display: grid; gap: 14px; }
.placeholder { color: var(--muted); text-align: center; margin: auto; padding: 40px 0; }
.line { opacity: .38; transition: opacity .25s; }
.line.latest { opacity: 1; }
.line .en { font-size: var(--sub); font-weight: 600; line-height: 1.25; color: var(--text); }
.line .orig { font-size: calc(var(--sub) * .68); color: var(--muted); margin-top: 2px; }
.line.latest .orig { color: var(--accent); }
.line.only-orig .orig { font-size: var(--sub); font-weight: 600; color: var(--text); }
.line.pending .en, .line.pending .orig { color: var(--muted); font-style: italic; font-weight: 400; }
.line.error .en { color: var(--danger); font-size: 15px; font-weight: 400; }
.list-mode .subs { margin-top: 0; }
.list-mode .line { opacity: 1; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.options { padding: 8px 16px 0; border-top: 1px solid var(--line); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--panel2); border-radius: 10px; padding: 3px; }
.seg-btn { background: none; border: 0; padding: 9px 0; border-radius: 8px; color: var(--muted); }
.seg-btn.on { background: var(--bg); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.sel { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.chip-btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-size: 14px; }
.chip-btn:disabled { opacity: .4; } .chip-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.dock { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
.meter { height: 6px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--accent); transition: width 80ms linear; }
.dock-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-top: 10px; }
.clock { font: 600 16px ui-monospace, Consolas, monospace; color: var(--muted); }
.actions { display: flex; gap: 8px; justify-content: flex-end; }
.rec { width: 76px; height: 76px; border-radius: 50%; border: 3px solid var(--text); background: transparent; display: grid; place-items: center; padding: 0; }
.rec-core { width: 54px; height: 54px; border-radius: 50%; background: var(--danger); transition: border-radius .15s, width .15s, height .15s; }
.rec.live .rec-core { border-radius: 10px; width: 30px; height: 30px; }
.rec.live { border-color: var(--danger); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px #ff4d5e33; } }
.note { margin: 6px 0 0; font-size: 11px; color: var(--muted); text-align: center; }
.toast { position: fixed; left: 16px; right: 16px; bottom: 150px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; text-align: center; }
@media (prefers-reduced-motion: reduce) { .rec.live, .line { animation: none; transition: none; } }
@media (min-width: 700px) { body { max-width: 720px; margin: 0 auto; } }
