:root {
  --bg: #0d0f12;
  --panel: #14171c;
  --panel-2: #1a1e25;
  --line: #262b34;
  --line-strong: #3a4150;
  --text: #e8ebf0;
  --text-dim: #8d95a3;
  --accent: #4fe3b0;
  --accent-ink: #06231a;
  --danger: #ff6b7a;
  --meter: #4fe3b0;
  --meter-hot: #ffd24a;

  --roll-bg: #0d0f12;
  --roll-row: #15181e;
  --roll-row-alt: #101318;
  --roll-line: #262b34;
  --roll-line-strong: #3a4150;
  --roll-text: #c9cfd9;
  --roll-text-dim: #5d6573;
  --roll-note: #4fe3b0;
  --roll-note-edge: #0b3a2b;
  --roll-playhead: #ffffff;
  --clip-audio: #7aa2ff;
  --clip-audio-edge: #a9c2ff;
  --loop: #ffd24a;
  --record: #ff5468;
  --auto: #ff9f43;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.4 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
  user-select: none;
}

h2 { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }

/* ---- Buttons and fields ---- */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--panel-2); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #56607a; background: #212631; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn.small { height: 26px; padding: 0 9px; font-size: 12px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 650; min-width: 84px; justify-content: center; }
.btn.primary:hover { background: #6cf0c2; border-color: #6cf0c2; }
.btn.primary[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #0d0f12; }
.btn[aria-pressed="true"]:not(.primary) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.field { display: inline-flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 12px; }
input[type="number"], select, input[type="text"] {
  height: 30px; padding: 0 8px;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--bg); color: var(--text); font: inherit;
}
input[type="number"] { width: 64px; font-variant-numeric: tabular-nums; }
input[type="range"] { accent-color: var(--accent); min-width: 0; }

/* ---- Top bar ---- */

.bar {
  display: flex; align-items: center; gap: 20px;
  padding: 10px 14px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.transport { display: flex; align-items: center; gap: 14px; }
.readout {
  min-width: 74px; padding: 5px 10px; text-align: center;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg);
  font: 600 15px/1.2 ui-monospace, "SF Mono", Menlo, monospace; font-variant-numeric: tabular-nums;
}
.master { display: grid; gap: 3px; width: 160px; margin-left: auto; }
.file { display: flex; gap: 6px; }

.meter { height: 5px; border-radius: 3px; background: #05070a; overflow: hidden; border: 1px solid var(--line); }
.meter i { display: block; height: 100%; width: var(--lv, 0%); background: var(--meter); }
.meter i.hot { background: var(--meter-hot); }
.meter.wide { height: 7px; }

/* ---- Workspace ---- */

.workspace { display: grid; grid-template-columns: 260px 1fr; min-height: 0; }

.sidebar { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 10px; }
.add { display: flex; gap: 6px; }
.tracks { flex: 1; overflow-y: auto; padding: 0 8px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; align-content: start; }
.hint { margin: 0; padding: 10px 12px; color: var(--text-dim); font-size: 12px; border-top: 1px solid var(--line); }

.track {
  padding: 8px 8px 9px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel-2); cursor: pointer;
}
.track.selected { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.track-head { display: flex; align-items: center; gap: 6px; }
.track-kind { flex: none; width: 44px; font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); }
.track-name {
  flex: 1; min-width: 0; height: 26px; padding: 0 6px;
  border: 1px solid transparent; border-radius: 5px; background: transparent;
  color: var(--text); font: inherit; font-weight: 600;
}
.track-name:hover { border-color: var(--line-strong); }
.track-name:focus { border-color: var(--accent); background: var(--bg); user-select: text; }
.icon-btn {
  flex: none; width: 26px; height: 26px; padding: 0;
  border: 1px solid var(--line-strong); border-radius: 5px;
  background: var(--bg); color: var(--text); font: inherit; font-weight: 700; font-size: 11px; cursor: pointer;
}
.icon-btn:hover { border-color: #56607a; }
.icon-btn.mute[aria-pressed="true"] { background: var(--meter-hot); border-color: var(--meter-hot); color: #241a00; }
.icon-btn.del:hover { border-color: var(--danger); color: var(--danger); }
.track-ctl { display: grid; grid-template-columns: 1fr 64px; align-items: center; gap: 10px; margin-top: 8px; }

/* ---- Editor ---- */

.editor { display: grid; grid-template-rows: auto 1fr; min-width: 0; min-height: 0; }
.inspector {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px;
  min-height: 52px; padding: 8px 14px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.inspector .title { font-weight: 650; margin-right: 6px; }
.inspector .empty { color: var(--text-dim); }
.param { display: grid; grid-template-columns: auto 96px 54px; align-items: center; gap: 8px; color: var(--text-dim); font-size: 12px; }
.param output { color: var(--text); font-variant-numeric: tabular-nums; text-align: right; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.seg button { height: 28px; padding: 0 10px; border: 0; background: var(--bg); color: var(--text); font: inherit; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 650; }

.roll-wrap { overflow: auto; min-height: 0; background: var(--roll-bg); }
#roll { display: block; cursor: crosshair; touch-action: none; }

/* ---- Status bar and toast ---- */

.status {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 6px 14px; background: var(--panel); border-top: 1px solid var(--line);
  color: var(--text-dim); font-size: 12px; font-variant-numeric: tabular-nums;
}

.toast {
  position: fixed; left: 50%; bottom: 44px; transform: translate(-50%, 8px);
  padding: 9px 14px; border-radius: 8px; background: var(--text); color: #0d0f12; font-weight: 550;
  opacity: 0; pointer-events: none; transition: opacity 0.15s, transform 0.15s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---- Shared parameter controls ---- */

.param select { height: 28px; }
.param.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.param.check input { accent-color: var(--accent); width: 15px; height: 15px; }

/* ---- Dock: effects and mixer ---- */

.editor { grid-template-rows: auto 1fr auto; }
.dock { display: grid; grid-template-rows: auto 1fr; height: 268px; background: var(--panel); border-top: 1px solid var(--line); min-width: 0; }
.dock-head { display: flex; align-items: center; gap: 14px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.dock-title { color: var(--text-dim); font-size: 12px; }
.dock-title b { color: var(--text); font-weight: 650; }

.fx-panel, .mixer-panel { display: flex; gap: 10px; padding: 10px 14px; overflow-x: auto; overflow-y: hidden; min-height: 0; align-items: stretch; }
.fx-panel[hidden], .mixer-panel[hidden] { display: none; }

.fx-card {
  flex: none; width: 250px; display: flex; flex-direction: column; gap: 7px;
  padding: 9px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel-2);
  overflow-y: auto;
}
.fx-card.off { opacity: 0.55; }
.fx-head { display: flex; align-items: center; gap: 8px; }
.fx-name { flex: 1; font-weight: 650; }
.icon-btn.power { width: 34px; }
.icon-btn.power[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.fx-card .param { grid-template-columns: 68px 1fr 58px; }
.fx-card .param.check, .fx-card .param.menu { display: grid; grid-template-columns: 68px 1fr; }
.fx-card .param.check { grid-template-columns: 16px 1fr; }
.fx-add { flex: none; align-self: flex-start; display: grid; gap: 6px; color: var(--text-dim); font-size: 12px; }
.fx-empty { align-self: flex-start; padding-top: 4px; color: var(--text-dim); margin-right: 6px; }

.strip {
  flex: none; width: 150px; display: flex; flex-direction: column; gap: 6px;
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); cursor: pointer;
}
.strip.selected { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.strip.return, .strip.master-strip { background: #171b22; }
.strip-head { display: flex; align-items: center; gap: 6px; }
.strip-name { flex: 1; min-width: 0; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip-kind { font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); }
.strip label { display: grid; grid-template-columns: 42px 1fr; align-items: center; gap: 6px; color: var(--text-dim); font-size: 11px; }
.strip .spacer { flex: 1; }

/* ---- Audio devices dialog ---- */

.dialog {
  width: min(520px, calc(100vw - 32px)); padding: 20px;
  border: 1px solid var(--line-strong); border-radius: 12px; background: var(--panel); color: var(--text);
  user-select: text;
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.dialog h2 { font-size: 15px; letter-spacing: 0; text-transform: none; color: var(--text); margin-bottom: 6px; }
.dialog-note { margin: 0 0 14px; color: var(--text-dim); font-size: 12px; }
.dialog .row { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 12px; margin-bottom: 10px; color: var(--text-dim); font-size: 12px; }
.dialog .row select { width: 100%; min-width: 0; }
.dialog .row.check { grid-template-columns: 16px 1fr; color: var(--text); cursor: pointer; margin-top: 14px; }
.dialog .row.check input { accent-color: var(--accent); width: 15px; height: 15px; }
.dialog-actions { display: flex; justify-content: space-between; margin-top: 16px; }
.dialog [hidden] { display: none !important; }
.time-sig { display: flex; align-items: center; gap: 6px; }
.time-sig input { width: 56px; }
.dialog .row .time-sig select { width: auto; }
#time-bpm { width: 90px; }
#meter { min-width: 44px; }


/* ---- Song timeline ---- */

.bar { flex-wrap: wrap; row-gap: 8px; }
.transport { flex-wrap: wrap; row-gap: 8px; }
.file { flex-wrap: wrap; }
.btn.record { color: var(--record); }
.btn.record[aria-pressed="true"] { background: var(--record); border-color: var(--record); color: #fff; }
.seg button { min-width: 30px; font-weight: 600; }

.editor { grid-template-rows: minmax(120px, 1fr) auto; }
.arr-wrap { position: relative; overflow: auto; min-height: 0; background: var(--roll-bg); }
#arr { position: sticky; top: 0; left: 0; display: block; touch-action: none; }
.arr-spacer { position: absolute; top: 0; left: 0; pointer-events: none; }

/* Track headers line up with the timeline lanes: 70px ruler, 72px per track. */
.sidebar-head { height: 70px; padding: 0 8px; gap: 6px; justify-content: flex-start; border-bottom: 1px solid var(--line-strong); }
.tracks { padding: 0; gap: 0; overflow: hidden; }
.track { height: 72px; padding: 7px 8px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--panel); }
.track.selected { background: var(--panel-2); border-color: var(--line); box-shadow: inset 3px 0 0 var(--accent); }
.track-kind { width: 38px; }
.track-ctl { margin-top: 6px; }
.icon-btn.arm[aria-pressed="true"] { background: var(--record); border-color: var(--record); color: #fff; }
.sidebar-foot { padding: 8px; border-top: 1px solid var(--line); }

/* ---- Dock: notes panel ---- */

.dock { height: 300px; }
.notes-panel { display: grid; grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr); min-height: 0; min-width: 0; }
.notes-panel[hidden] { display: none; }
.notes-panel .inspector { min-height: 44px; padding: 6px 14px; }
.notes-panel .roll-wrap[hidden] { display: none; }
.dialog .inline { color: var(--text-dim); }
.dialog .inline input { width: 64px; margin-right: 4px; }


/* ---- Project folder ---- */

.btn.attention { border-color: var(--loop); color: var(--loop); }
.dialog-alert { margin: 0 0 14px; padding: 9px 11px; border: 1px solid var(--loop); border-radius: 8px; color: var(--text); font-size: 12px; }
.dialog-alert[hidden] { display: none; }
.dialog-stack { display: grid; gap: 8px; margin: 4px 0 14px; }
.dialog-stack .btn { justify-content: center; height: 36px; }
.dialog-stack .btn[hidden] { display: none; }
.dialog-note.small { margin: 0; }
.status { justify-content: flex-start; }
#status-save { margin-left: auto; }


/* ---- Knobs ---- */

.knob { display: grid; justify-items: center; gap: 1px; width: 60px; cursor: ns-resize; outline: none; touch-action: none; }
.knob svg { width: 42px; height: 42px; display: block; }
.k-track { fill: none; stroke: #272c36; stroke-width: 3; stroke-linecap: round; }
.k-val { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.k-cap { fill: #1f242d; stroke: #3a4150; }
.k-tip { stroke: var(--text); stroke-width: 2; stroke-linecap: round; }
.k-label { font-size: 10px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-dim); white-space: nowrap; }
.knob output { font-size: 11px; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.knob:hover .k-cap { stroke: #5a647a; }
.knob:focus-visible .k-cap { stroke: var(--accent); stroke-width: 1.5; }
.knob.small { width: 48px; }
.knob.small svg { width: 32px; height: 32px; }
.knob.small .k-label { font-size: 9px; }
.knob.small output { font-size: 10px; }
.knob-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 2px; }
.knob-row .param.menu, .knob-row .param.check { align-self: center; margin-left: 8px; }
.knob-row .param.menu { display: grid; grid-template-columns: auto; gap: 3px; font-size: 10px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.knob-row .seg { align-self: center; margin-right: 8px; }

/* ---- Devices: effects and the synth ---- */

.dock { height: 372px; }
.fx-panel { align-items: flex-start; overflow-y: auto; }
.fx-card { width: 300px; overflow: visible; gap: 8px; padding: 10px; border-color: #313745; background: linear-gradient(#1b1f27, #171a21); box-shadow: 0 1px 0 #2a2f3a inset; }
.fx-card.dev-eq { width: 580px; }
.fx-card.dev-comp { width: 470px; }
.fx-card.dev-delay { width: 360px; }
.fx-card.dev-reverb { width: 330px; }
.fx-card.dev-sat { width: 230px; }
.fx-card.off .dev-graph, .fx-card.off .knob-row, .fx-card.off .eq-row { opacity: 0.5; }
.fx-card.off { opacity: 1; }
.fx-name { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
.dev-graph { display: block; width: 100%; height: 150px; border: 1px solid #2a303a; border-radius: 6px; background: #0a0c0f; touch-action: none; }
.dev-eq .dev-graph { height: 180px; }
.dev-sat .dev-graph { height: 150px; }

.eq-row { display: flex; align-items: center; gap: 14px; }
.eq-bands { display: grid; grid-template-columns: repeat(3, 28px); gap: 4px; }
.eq-band { height: 24px; border: 1.5px solid var(--band); border-radius: 5px; background: transparent; color: var(--band); font: 700 11px/1 inherit; cursor: pointer; }
.eq-band[aria-pressed="true"] { background: var(--band); color: #0a0c0f; }
.eq-band.off { opacity: 0.45; }
.eq-knobs { align-items: center; }
.eq-band-name { min-width: 96px; font-size: 12px; font-weight: 650; }

.notes-panel .inspector { align-items: flex-start; gap: 10px 14px; padding: 8px 14px; }
.inspector .title { align-self: center; min-width: 60px; }
.synth-graph { display: grid; gap: 3px; }
.synth-graph canvas { width: 120px; height: 62px; border: 1px solid #2a303a; border-radius: 6px; background: #0a0c0f; touch-action: none; }
.synth-graph.wide canvas { width: 190px; }
.synth-graph span { font-size: 10px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-dim); }

/* ---- Mixer: channel strips with faders ---- */

.mixer-panel { gap: 6px; align-items: stretch; }
.strip { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 3px; width: 122px; padding: 8px 8px 6px; border-color: #313745; background: linear-gradient(#1b1f27, #171a21); }
.strip.return, .strip.master-strip { width: 84px; background: linear-gradient(#1d2230, #171a24); }
.strip.selected { box-shadow: inset 0 3px 0 var(--accent); }
.strip-name { flex: none; }
.strip-body { display: grid; grid-template-columns: auto 1fr; gap: 8px; min-height: 0; margin-top: 4px; }
.strip-fader { display: grid; grid-template-columns: 10px 24px; gap: 6px; min-height: 0; }
.vmeter { position: relative; width: 10px; height: 100%; border: 1px solid var(--line); border-radius: 3px; background: #05070a; overflow: hidden; }
.vmeter i { position: absolute; left: 0; right: 0; bottom: 0; height: var(--lv, 0%); background: linear-gradient(to top, var(--meter) 0 78%, var(--meter-hot) 92%); background-size: 100% 220px; background-position: bottom; }
.vmeter i.hot { background: var(--meter-hot); }
.fader { writing-mode: vertical-lr; direction: rtl; width: 24px; height: 100%; margin: 0; cursor: ns-resize; }
.strip-knobs { display: grid; justify-items: center; align-content: start; gap: 5px; }
.strip-db { font-size: 11px; color: var(--text); font-variant-numeric: tabular-nums; }

.fx-head .param.menu { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-dim); }
.fx-head .param.menu select { height: 26px; }

.dock-head .seg { flex: none; }
.dock-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* ---- Solo, presets, device tools ---- */

.icon-btn.solo[aria-pressed="true"] { background: #6fc3ff; border-color: #6fc3ff; color: #04213a; }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.icon-btn.reset { width: auto; padding: 0 8px; font-weight: 600; }
.fx-head { flex-wrap: wrap; row-gap: 6px; }
.fx-head .fx-name { flex: none; margin-right: 2px; }
.fx-tools { display: inline-flex; gap: 4px; margin-left: auto; }
select.preset { height: 26px; max-width: 150px; font-size: 12px; }
.fx-card.dev-sat { width: 330px; }
.fx-card.dev-reverb, .fx-card.dev-delay { width: 380px; }
.fx-add { display: grid; gap: 6px; align-content: start; min-width: 140px; }
.fx-add span { font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); }
.fx-add .btn { justify-content: flex-start; }
.synth-tools { display: grid; gap: 6px; align-content: center; align-self: center; }
.strip-buttons { display: flex; gap: 4px; }
.strip-buttons .icon-btn { width: 24px; height: 24px; }
.strip { width: 132px; }

/* ---- Export ---- */

.dialog.wide { width: min(640px, calc(100vw - 32px)); }
.export-list { display: grid; gap: 8px; }
.export-item {
  display: grid; gap: 3px; padding: 11px 13px; text-align: left;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel-2); color: var(--text); font: inherit; cursor: pointer;
}
.export-item:hover { border-color: var(--accent); }
.export-item:disabled { opacity: 0.5; cursor: default; }
.export-item b { font-weight: 650; }
.export-item b i { margin-left: 6px; padding: 1px 6px; border-radius: 4px; background: var(--loop); color: #241a00; font-size: 10px; font-style: normal; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.export-item span { color: var(--text-dim); font-size: 12px; }


/* ---- Per-track inputs ---- */

.track-ctl.audio { grid-template-columns: 76px 26px 1fr 34px; gap: 6px; margin-top: 5px; }
.track-input { height: 26px; padding: 0 4px; font-size: 11px; min-width: 0; }
.track-ctl.audio .icon-btn { width: 26px; height: 26px; }
.icon-btn.listen[aria-pressed="true"] { background: var(--loop); border-color: var(--loop); color: #241a00; }
.in-meters { display: flex; flex-wrap: wrap; gap: 6px; min-height: 52px; align-items: flex-end; }
.in-meter { display: grid; justify-items: center; gap: 2px; font-size: 10px; color: var(--text-dim); }
.in-meter .vmeter { height: 40px; }
.dialog-note.indent { margin: -4px 0 12px 122px; }

.track-kind { width: 34px; font-size: 9px; }
.track-head { gap: 4px; }
.track-head .icon-btn { width: 24px; height: 24px; }


/* ---- Note editor tools and velocity strip ---- */

.notes-panel { grid-template-rows: auto minmax(0, 1fr) auto; }
.vel-box { position: relative; }
.vel-box[hidden] { display: none; }
.vel-wrap { height: 64px; overflow: hidden; border-top: 1px solid var(--line-strong); background: var(--roll-row-alt); }
.lane-select { position: absolute; left: 4px; top: 4px; width: 56px; font-size: 10px; padding: 1px 0; z-index: 1; }
.vel-wrap[hidden] { display: none; }
#vel { display: block; cursor: ns-resize; touch-action: none; }
.roll-tools { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.roll-tools[hidden] { display: none; }
.roll-tools select { height: 26px; }
.btn.small[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }


/* ---- Sampler ---- */

.workspace { grid-template-columns: 300px 1fr; }
.sidebar-head .btn.small { padding: 0 7px; }
.pads { display: grid; grid-template-columns: repeat(4, 62px); gap: 4px; }
.pad {
  display: grid; align-content: space-between; height: 36px; padding: 3px 5px; text-align: left; overflow: hidden;
  border: 1px solid var(--line-strong); border-radius: 5px; background: #12151a; color: var(--text-dim); font: inherit; font-size: 10px; cursor: pointer;
}
.pad b { font-size: 9px; font-weight: 700; color: var(--text-dim); }
.pad span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pad.filled { background: #1d2a26; border-color: #2f6b58; color: var(--text); }
.pad.filled:active { background: var(--accent); color: var(--accent-ink); }
.pad.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.sample-box { display: grid; gap: 3px; }
.sample-wave { width: 260px; height: 62px; border: 1px solid #2a303a; border-radius: 6px; }
.sound-name { font-size: 11px; color: var(--text-dim); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sampler-side { display: grid; gap: 6px; align-content: center; align-self: center; }

.sf2-list { width: 100%; height: 260px; padding: 4px; font: 12px/1.5 ui-monospace, 'SF Mono', Menlo, monospace; }
.sf2-list option { padding: 2px 6px; border-radius: 4px; }


/* ---- Library ---- */

.library-panel { display: grid; grid-template-rows: auto auto minmax(0, 1fr); min-height: 0; padding: 8px 14px 0; gap: 6px; }
.library-panel[hidden] { display: none; }
.lib-head { display: flex; gap: 8px; align-items: center; }
#lib-search { flex: 1; min-width: 0; height: 30px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; user-select: text; }
#lib-search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.lib-status { margin: 0; color: var(--text-dim); font-size: 12px; }
.lib-status b { color: var(--text); font-weight: 600; }
.lib-list { overflow-y: auto; min-height: 0; border-top: 1px solid var(--line); }
.lib-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) 44px 64px; gap: 10px; align-items: center; width: 100%;
  padding: 6px 8px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.lib-row:hover, .lib-row:focus-visible { background: var(--panel-2); outline: none; }
.lib-row.loading { opacity: 0.55; cursor: progress; }
.lib-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-file { color: var(--text-dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-kind { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; color: var(--text-dim); }
.lib-load { justify-self: end; font-size: 12px; color: var(--accent); }
.lib-more { padding: 10px 8px; color: var(--text-dim); font-size: 12px; }

/* ---- Automation ---- */

.icon-btn.auto[aria-pressed="true"] { background: var(--auto); border-color: var(--auto); color: #2a1500; }
.btn.write[aria-pressed="true"] { background: var(--auto); border-color: var(--auto); color: #2a1500; }
.track-ctl.lane { grid-template-columns: 1fr 26px 34px; gap: 6px; margin-top: 5px; }
.lane-param { height: 26px; padding: 0 4px; font-size: 11px; min-width: 0; color: var(--auto); }


/* ---- Built-in instruments and credits ---- */

.lib-kind.own { color: var(--accent); }
.credits-list { display: grid; gap: 14px; max-height: 60vh; overflow-y: auto; }
.credit h3 { margin: 0 0 4px; font-size: 13px; }
.credit p { margin: 0; color: var(--text-dim); font-size: 12px; }
.credit a { color: var(--accent); }
.credit .notice { margin-top: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 11px; line-height: 1.5; }

/* New effects: card sizes, the grouped add menu and the multiband layout. */
.fx-card.dev-chorus, .fx-card.dev-flanger { width: 340px; }
.fx-card.dev-phaser { width: 400px; }
.fx-card.dev-gate { width: 400px; }
.fx-card.dev-deess { width: 400px; }
.fx-card.dev-pitch { width: 380px; }
.fx-card.dev-multi { width: 900px; }
.fx-card.dev-multi .dev-graph { height: 160px; }
.fx-add { grid-template-columns: repeat(2, minmax(150px, auto)); align-items: start; column-gap: 14px; }
.fx-add > span { grid-column: 1 / -1; }
.fx-group { display: grid; gap: 5px; }
.fx-group span { font-size: 9px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); opacity: 0.8; margin-top: 2px; }
.fx-group .btn { justify-content: flex-start; }
.multi-row { display: flex; gap: 8px; }
.band-col { flex: none; flex-wrap: nowrap; padding: 4px 2px 2px; border-radius: 6px; border-top: 2px solid var(--band, #2a303a); background: rgba(255, 255, 255, 0.02); }

/* Step sequencer */
.steps-wrap { overflow: auto; min-height: 0; min-width: 0; background: var(--roll-bg); padding: 2px 0 0 0; }
.steps-wrap[hidden] { display: none; }
.steps-wrap canvas { display: block; touch-action: none; }
#step-mode button { padding: 0 8px; }

/* MIDI effects strip in the instrument panel */
.midi-strip { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; width: 100%; padding-top: 6px; border-top: 1px solid var(--line, #232831); }
.midi-title { align-self: center; font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); width: 92px; }
.midi-card { display: grid; gap: 6px; padding: 8px; border: 1px solid #313745; border-radius: 8px; background: linear-gradient(#1b1f27, #171a21); }
.midi-card.off .knob-row { opacity: 0.45; }
.midi-card .fx-head { display: flex; align-items: center; gap: 8px; }
.midi-card .fx-name { flex: 1; font-size: 12px; font-weight: 600; }
.midi-adds { display: grid; gap: 4px; align-content: center; }
.midi-adds .btn { justify-content: flex-start; }

/* Comp editor */
.comp-box { width: 100%; display: grid; gap: 6px; }
.comp-head { display: flex; align-items: center; gap: 12px; }
.comp-editor { display: block; width: 100%; height: 120px; border: 1px solid #2a303a; border-radius: 6px; touch-action: none; cursor: crosshair; }

/* Follow tempo and transpose */
.flex-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; width: 100%; }
.flex-row input[type='number'] { width: 76px; margin-left: 6px; }

/* Loudness readout and mastering assistant */
.loudness { display: flex; justify-content: space-between; gap: 6px; padding: 0; border: 0; background: none; color: var(--text-dim); font: 500 10px/1.2 ui-sans-serif, system-ui, sans-serif; cursor: pointer; white-space: nowrap; }
.loudness:hover b { color: #4fe3b0; }
.loudness b { color: var(--text, #e8ebf0); font-variant-numeric: tabular-nums; font-weight: 600; }
.loudness b.hot { color: #ffd24a; }
.master-form { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0 12px; }
.master-result { display: grid; gap: 6px; font-size: 13px; }
.master-result table { border-collapse: collapse; }
.master-result td, .master-result th { padding: 3px 14px 3px 0; text-align: left; font-variant-numeric: tabular-nums; }
.master-result th { color: var(--text-dim); font-weight: 500; }
.master-result .warn { color: #ffd24a; }
.assist-tag { margin-left: 6px; padding: 1px 5px; border-radius: 4px; background: rgba(79, 227, 176, 0.15); color: #4fe3b0; font-style: normal; font-size: 9px; letter-spacing: 0.05em; text-transform: uppercase; }
.status-version { margin-left: auto; opacity: 0.6; }

/* Chop editor */
.chop-box { width: 100%; display: grid; gap: 6px; }
.chop-wave { display: block; width: 100%; height: 110px; border: 1px solid #2a303a; border-radius: 6px; touch-action: none; cursor: pointer; }
.chop-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* Wavetable synth panel */
.wave-head { display: flex; align-items: center; gap: 12px; width: 100%; }
.wave-panel { display: flex; gap: 8px; overflow-x: auto; width: 100%; padding-bottom: 4px; }
.wsec { flex: none; display: grid; align-content: start; gap: 6px; width: 236px; padding: 8px; border: 1px solid #313745; border-radius: 8px; background: linear-gradient(#1b1f27, #171a21); }
.wsec h4 { margin: 0; font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); }
.wsec-oscA, .wsec-oscB { width: 290px; }
.wsec-lfo, .wsec-voice, .wsec-mix { width: 200px; }
.wdisp { display: block; width: 100%; height: 74px; border: 1px solid #2a303a; border-radius: 6px; }
.wsec .knob-row { justify-content: flex-start; }
/* Compact knobs inside the synth's sections, and a panel that scrolls when the dock is short. */
.notes-panel .inspector:has(.wave-panel) { max-height: 46vh; overflow-y: auto; }
.wsec .knob { width: 52px; }
.wsec .knob svg { width: 34px; height: 34px; }
.wsec .k-label { font-size: 9px; letter-spacing: 0.03em; }
.wsec .knob output { font-size: 10px; }
.wsec .knob-row { gap: 4px 2px; }
.wsec .param.menu { margin-left: 0; }
.wsec-oscA, .wsec-oscB { width: 322px; }
.wdisp { height: 62px; }

/* Drum synth panel */
.drum-panel { display: flex; gap: 6px; overflow-x: auto; width: 100%; padding-bottom: 4px; }
.drum-col { flex: none; display: grid; justify-items: center; gap: 2px; width: 66px; padding: 6px 2px; border: 1px solid #313745; border-radius: 8px; background: linear-gradient(#1b1f27, #171a21); }
.drum-col .knob { width: 52px; }
.drum-col .knob svg { width: 30px; height: 30px; }
.drum-col .k-label { font-size: 9px; }
.drum-col .knob output { font-size: 10px; }
.drum-hit { width: 58px; height: 30px; border: 1px solid #3a4150; border-radius: 6px; background: #232933; color: var(--text); font: 600 10px ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
.drum-hit:active { background: #4fe3b0; color: #0a0c0f; }
.notes-panel .inspector:has(.drum-panel) { max-height: 46vh; overflow-y: auto; }

/* Convolution reverb, amp, tape, vintage EQ, vocoder */
.fx-card.dev-space { width: 470px; }
.fx-card.dev-amp { width: 470px; }
.fx-card.dev-tape { width: 380px; }
.fx-card.dev-vintage { width: 560px; }
.fx-card.dev-vocoder { width: 420px; }
.ir-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Mixer: track outputs and buses */
.strip-out { display: grid; gap: 2px; font-size: 9px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-dim); }
.strip-out select { width: 64px; height: 22px; font-size: 10px; }
.bus-add { align-self: center; flex: none; margin: 0 10px; }

/* Session player */
.player-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; width: 100%; padding-top: 6px; border-top: 1px solid var(--line, #232831); }
.pl-range { display: grid; gap: 2px; font-size: 10px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-dim); }
.pl-range input { width: 90px; accent-color: #4fe3b0; }

/* Live view: clip cells per track, one column per scene */
.live-wrap { overflow: auto; min-height: 0; background: var(--roll-bg); }
.live-wrap[hidden] { display: none; }
.live-row { display: flex; align-items: stretch; gap: 4px; padding: 3px 6px; box-sizing: border-box; border-bottom: 1px solid #1b2027; width: max-content; min-width: 100%; }
.live-head { align-items: center; background: #13161b; position: sticky; top: 0; z-index: 2; border-bottom: 1px solid var(--line-strong, #2a303a); }
.live-scene { flex: none; width: 140px; display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text); cursor: default; }
.live-scene span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-go, .live-tosong { border: 1px solid #3a4150; border-radius: 5px; background: #232933; color: var(--text); cursor: pointer; font-size: 10px; padding: 3px 6px; }
.live-go:hover { background: #4fe3b0; color: #0a0c0f; }
.live-cell { flex: none; width: 140px; position: relative; display: flex; align-items: center; gap: 6px; padding: 0 8px; border-radius: 6px; border: 1px solid #3a4b45; background: #1a2a25; color: var(--text); font-size: 11px; cursor: pointer; overflow: hidden; user-select: none; }
.live-cell.empty { border: 1px dashed #2a303a; background: transparent; cursor: default; }
.live-cell.selected { outline: 2px solid #ffd24a; outline-offset: -1px; }
.live-cell.playing { border-color: #4fe3b0; background: #1f3b31; }
.live-cell.pending { animation: live-wait 0.5s steps(2) infinite; }
@keyframes live-wait { 50% { border-color: #4fe3b0; } }
.live-icon { width: 14px; color: #4fe3b0; }
.live-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-progress { position: absolute; left: 0; bottom: 0; height: 3px; background: #4fe3b0; }
.live-end { flex: none; display: flex; align-items: center; gap: 6px; margin-left: 6px; }

/* ---- Folders, VCAs and lanes for buses and the master ---- */

.track.folder-row { background: #171b23; box-shadow: inset 3px 0 0 #b79bff; }
.folder-row .folder-open { font-size: 12px; }
.folder-info { margin-top: 10px; padding-left: 4px; font-size: 11px; color: var(--text-dim); }
.track.in-folder { padding-left: 18px; box-shadow: inset 3px 0 0 #3c3352; }
.track.in-folder.selected { box-shadow: inset 3px 0 0 #3c3352, inset 6px 0 0 var(--accent); }
.track.mix-row { background: #12151b; box-shadow: inset 3px 0 0 var(--auto); }
.mix-row .mix-name { flex: 1; min-width: 0; font-weight: 650; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mix-row .track-kind { width: auto; min-width: 40px; }
.live-row.live-blank { background: #101318; }
.strip.vca-strip { width: 92px; background: linear-gradient(#211d2c, #18161f); border-color: #3c3352; }
.strip .vca-name { width: 100%; min-width: 0; padding: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 650; }
.strip .vca-name:focus { outline: 1px solid var(--accent); }
.vca-meter i { opacity: 0.55; }
.strip .lane-toggle[aria-pressed="true"] { background: var(--auto); border-color: var(--auto); color: #2a1500; }
.strip:has(.strip-route) { grid-template-rows: auto auto minmax(0, 1fr) auto auto; }
.strip-route { display: grid; gap: 2px; margin-top: 4px; }
.strip-route label { display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 4px; font-size: 9px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-dim); }
.strip-route select { width: 100%; min-width: 0; height: 20px; padding: 0 2px; font-size: 10px; }
/* A strip with many sends scrolls its knobs, so the fader and routing stay in view. */
.strip-body { overflow: hidden; }
.strip-fader { height: 100%; }
.strip-knobs { min-height: 0; max-height: 100%; overflow-y: auto; scrollbar-width: thin; }
.vca-strip .strip-buttons { display: grid; gap: 4px; }

/* ---- Audio quantize and pitch editing ---- */
.small-title { font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-dim); }
.pitch-box .flex-row { margin-top: 0; }
.pitch-editor { height: 180px; cursor: default; }
/* Tall clip tools (takes, quantize, pitch) scroll inside the panel rather than pushing the page down. */
.notes-panel { overflow-y: auto; }

/* ---- Score view ---- */
.score-wrap { overflow: auto; min-height: 0; min-width: 0; background: #f4f1ea; }
.score-wrap[hidden] { display: none; }
.score { display: block; cursor: crosshair; touch-action: none; user-select: none; }
.score .sc-line, .score .sc-bar { stroke: #2b2b2b; stroke-width: 1; }
.score .sc-stem { stroke: #111; stroke-width: 1.2; }
.score .sc-beam { stroke: #111; stroke-width: 4; }
.score .sc-tie { stroke: #111; stroke-width: 1.2; fill: none; }
.score .sc-head { fill: #111; stroke: #111; stroke-width: 1.2; }
.score .sc-head.open { fill: #f4f1ea; }
.score .sc-head.sel { fill: #e0610f; stroke: #e0610f; }
.score .sc-head.open.sel { fill: #f4f1ea; }
.score .sc-dot, .score .sc-restbox { fill: #111; }
.score .sc-clef, .score .sc-rest { fill: #111; font-size: 30px; }
.score .sc-acc { fill: #111; font-size: 15px; font-family: ui-serif, Georgia, serif; }
.score .sc-time { fill: #111; font-size: 17px; font-weight: 700; font-family: Georgia, 'Times New Roman', serif; }
.score .sc-num { fill: #6b665c; font-size: 10px; font-family: ui-sans-serif, system-ui, sans-serif; }
.score-wrap { min-height: 220px; }
.score .sc-clef { font-size: inherit; }
.score .sc-restpath { fill: #111; }

/* ---- Freeze and bounce ---- */
.render-tools { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.render-tools .lbl { color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.frozen-note { display: flex; flex-direction: column; gap: 8px; max-width: 560px; }
.frozen-actions { display: flex; gap: 8px; }
