:root {
  --bg: #0b0e12; --panel: #141a21; --panel2: #1b232c; --fg: #cfe3f7; --muted: #7c8b9a;
  --accent: #c9a227; --cond: #2d6a8a; --gen: #c9a227; --border: #283340;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 13px/1.4 -apple-system, system-ui, sans-serif; }
header { display: flex; align-items: baseline; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
header h1 { font-size: 16px; margin: 0; }
.meta { color: var(--muted); font-size: 12px; }
.hidden { display: none !important; }

#controls { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); gap: 8px 12px; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--border); }
.ctl { display: flex; flex-direction: column; gap: 3px; }
.ctl.wide { grid-column: span 3; }
.ctl.chk { justify-content: flex-end; }
.ctl.actions { flex-direction: row; align-items: flex-end; gap: 8px; }
label { color: var(--muted); font-size: 11px; }
input, select { background: var(--panel2); color: var(--fg); border: 1px solid var(--border); border-radius: 5px; padding: 5px 7px; font-size: 13px; }
input[type="checkbox"] { width: auto; }
button { background: var(--accent); color: #0b0e12; border: 0; border-radius: 5px; padding: 7px 14px; font-weight: 600; cursor: pointer; }
button:disabled { opacity: 0.45; cursor: default; }
#saveBtn { background: var(--panel2); color: var(--fg); border: 1px solid var(--border); }

#status { color: var(--muted); margin-bottom: 4px; }
#progressWrap { height: 6px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
#progressBar { height: 100%; width: 0%; background: var(--accent); transition: width 0.2s; }

#result { padding: 12px 16px; }
.row { display: flex; gap: 24px; margin-bottom: 12px; flex-wrap: wrap; }
.playbar { align-items: center; gap: 12px; }
#playBtn { min-width: 84px; }
audio { display: none; }

/* Shared-width timeline: one grid column for every waveform/overlay/ribbon/ruler → aligned x-axes. */
.tracks { display: grid; grid-template-columns: 130px 1fr; gap: 4px 10px; align-items: center; }
.tracks .lab { color: var(--muted); text-align: right; font-size: 11px; }
.tracks .cell { position: relative; min-width: 0; }
canvas.wave { width: 100%; height: 80px; display: block; background: var(--panel); border: 1px solid var(--border); border-radius: 5px; }
canvas.overlay { position: absolute; inset: 0; width: 100%; height: 80px; pointer-events: none; }
canvas.ribbon { width: 100%; height: 30px; display: block; background: var(--panel); border: 1px solid var(--border); border-radius: 5px; }
canvas.ruler { width: 100%; height: 22px; display: block; }

.legends { margin: 8px 0 4px; display: flex; flex-direction: column; gap: 4px; }
.legendrow { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-left: 130px; }
.legendrow .who { color: var(--muted); font-size: 11px; }
.legendrow label { color: var(--fg); display: flex; align-items: center; gap: 5px; cursor: pointer; }
.legendrow .swatch { width: 14px; height: 3px; display: inline-block; border-radius: 2px; }

.texts { display: flex; gap: 18px; margin-top: 14px; flex-wrap: wrap; }
.textpanel { flex: 1; min-width: 280px; }
.textpanel h3 { font-size: 12px; color: var(--muted); margin: 0 0 4px; font-weight: 600; }
.mono { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 10px; white-space: pre-wrap; font-family: ui-monospace, monospace; font-size: 12px; min-height: 50px; }

.tooltip { position: fixed; z-index: 50; background: #000; color: #fff; border: 1px solid var(--border); border-radius: 4px; padding: 4px 7px; font-size: 11px; white-space: pre; pointer-events: none; }
