:root {
  --bg: #0e0f13; --panel: #171920; --line: #2a2d38; --text: #e7e8ee; --muted: #8b8fa0;
  --l: #4da3ff; --r: #ff6b4a; --accent: #ffd166; --loop: rgba(255, 209, 102, .16);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text); font: 14px/1.4 -apple-system, system-ui, sans-serif;
  display: flex; flex-direction: column; overflow: hidden;
}
header { display: flex; align-items: center; gap: 14px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.spacer { flex: 1; }
select, button {
  background: #22252f; color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 11px; font: inherit; cursor: pointer;
}
button:hover { background: #2b2f3b; }
button.primary { background: var(--accent); color: #111; border-color: var(--accent); font-weight: 700; min-width: 52px; }
button.on { background: var(--accent); color: #111; border-color: var(--accent); }
.tog { display: flex; align-items: center; gap: 5px; color: var(--muted); cursor: pointer; user-select: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.l { background: var(--l); } .dot.r { background: var(--r); }
#main { flex: 1; display: flex; min-height: 0; }
#left { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#videoWrap { display: none; width: 44%; max-width: 900px; flex: none; background: #000; border-left: 1px solid var(--line); flex-direction: column; }
body.video #videoWrap { display: flex; }
#videoBox { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; }
#videoBox iframe, #yt { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vnote { color: var(--muted); font-size: 12px; padding: 8px 12px; }
.pick { display: flex; align-items: center; gap: 6px; color: var(--muted); }
#soundPick { display: none; }
body.video #soundPick { display: flex; }
#staffWrap { height: 270px; flex: none; background: #f6f3ea; border-bottom: 1px solid var(--line); }
#rollWrap { flex: 1; min-height: 200px; }
canvas { display: block; width: 100%; height: 100%; }
#staff { cursor: pointer; touch-action: none; }
#transport { background: var(--panel); border-top: 1px solid var(--line); padding: 8px 14px 10px; }
#timeline { height: 64px; border-radius: 8px; background: #0b0c10; cursor: crosshair; }
.controls { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
#time { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 120px; margin-left: 6px; }
.speed { display: flex; align-items: center; gap: 6px; color: var(--muted); margin-left: 8px; }
#speedV { min-width: 40px; color: var(--text); font-variant-numeric: tabular-nums; }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
#loading { position: fixed; inset: auto 14px 14px auto; background: var(--accent); color: #111; padding: 8px 12px; border-radius: 8px; font-weight: 600; }
#loading.hide { display: none; }
@media (max-width: 900px) { #main { flex-direction: column-reverse; } #videoWrap { width: 100%; max-width: none; border-left: 0; } .vnote { display: none; } }
@media (max-width: 700px) { .hint { display: none; } #staffWrap { height: 180px; } }
