/* Studiofish DAW - dark studio theme (matches the GameDB platform: near-black greys, orange accent) */
:root {
  color-scheme: dark;
  --bg: #0a0a0b;
  --bg1: #0e0e10;
  --bg2: #131315;
  --bg3: #18181b;
  --bg4: #1f1f23;
  --bg5: #28282d;
  --bg6: #323238;
  --line: rgba(255, 255, 255, .065);
  --line2: rgba(255, 255, 255, .12);
  --line3: rgba(255, 255, 255, .2);
  --text: #e6e6e6;
  --text2: #c4c4c8;
  --dim: #9a9aa1;
  --muted: #6c6c73;
  --accent: #ff5707;
  --accent2: #ff7a3d;
  --accent-soft: rgba(255, 87, 7, .14);
  --accent-line: rgba(255, 87, 7, .5);
  --on-accent: #140800;
  --green: #2fcf7c;
  --yellow: #ffd23f;
  --red: #ff3b6b;
  --blue: #4b8dff;
  --cyan: #2ec5e8;
  --violet: #8f7bff;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 18px 44px -12px rgba(0, 0, 0, .8);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  --topbar-h: 50px;
  --status-h: 26px;
  --browser-w: 268px;
  --detail-h: 300px;
  --header-w: 196px;
  --knob: var(--accent);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 12.5px/1.35 var(--font); overflow: hidden; }
body { -webkit-font-smoothing: antialiased; user-select: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
input, textarea { user-select: text; }
:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 1px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2b2b30; border-radius: 10px; border: 2px solid var(--bg2); }
::-webkit-scrollbar-thumb:hover { background: #3a3a41; }
::-webkit-scrollbar-corner { background: transparent; }
.icon { flex: none; display: block; }
.hidden { display: none !important; }
a { color: var(--accent2); }

/* ------------------------------------------------------------------ loading screen */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 35%, #1a0d05 0%, var(--bg) 60%); z-index: 100; transition: opacity .35s; }
.boot.out { opacity: 0; pointer-events: none; }
.boot-inner { text-align: center; }
.boot-logo { width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 22px; display: grid; place-items: center; background: linear-gradient(135deg, #ff3d00, #ff5707 55%, #ff9a1f); box-shadow: 0 0 60px rgba(255, 87, 7, .35); }
.boot h1 { margin: 0 0 6px; font: 600 24px var(--font); letter-spacing: .02em; }
.boot p { margin: 0; color: var(--dim); }
.boot-bar { width: 220px; height: 3px; margin: 20px auto 0; background: var(--bg4); border-radius: 3px; overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 30%; background: var(--accent); border-radius: 3px; animation: bootbar 1.1s ease-in-out infinite; }
@keyframes bootbar { 0% { transform: translateX(-100%); } 100% { transform: translateX(330%); } }
.boot-start { margin-top: 22px; }

/* ------------------------------------------------------------------ layout */
#app { display: grid; grid-template-rows: var(--topbar-h) 1fr var(--status-h); height: 100vh; }
#workspace { display: grid; grid-template-columns: var(--browser-w) 4px minmax(0, 1fr); min-height: 0; }
#workspace.no-browser { grid-template-columns: 0 0 minmax(0, 1fr); }
#workspace.no-browser #browser { display: none; }
#main { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(120px, 1fr) 4px var(--detail-h); min-width: 0; min-height: 0; }
#main.no-detail { grid-template-rows: minmax(120px, 1fr) 0 0; }
#main.no-detail #detail { display: none; }
.resizer { background: var(--bg); position: relative; z-index: 3; }
.resizer::after { content: ""; position: absolute; inset: 0; transition: background .12s; }
.resizer:hover::after, .resizer.active::after { background: var(--accent-line); }
.resizer-v { cursor: col-resize; }
.resizer-h { cursor: row-resize; }
#views { position: relative; min-height: 0; min-width: 0; background: var(--bg1); overflow: hidden; }
.view { position: absolute; inset: 0; display: none; flex-direction: column; min-height: 0; }
.view.active { display: flex; }

/* ------------------------------------------------------------------ top bar */
#topbar { display: flex; align-items: center; gap: 8px; padding: 0 10px; background: var(--bg2); border-bottom: 1px solid var(--line); min-width: 0; }
.tb-group { display: flex; align-items: center; gap: 4px; flex: none; }
.tb-sep { width: 1px; height: 26px; background: var(--line2); margin: 0 4px; flex: none; }
.tb-spacer { flex: 1; min-width: 0; }
.logo { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border: 0; background: none; border-radius: 8px; color: var(--text); flex: none; }
.logo:hover { background: var(--bg4); }
.logo-mark { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: linear-gradient(135deg, #ff3d00, #ff5707 55%, #ff9a1f); color: var(--on-accent); }
.logo-text { font-weight: 650; font-size: 14px; letter-spacing: .01em; }
.logo-text small { display: block; font-size: 10px; font-weight: 500; color: var(--muted); line-height: 1; }
.transport-btn { width: 34px; height: 30px; border-radius: 7px; border: 1px solid var(--line2); background: var(--bg4); display: grid; place-items: center; color: var(--text2); }
.transport-btn:hover { background: var(--bg5); color: var(--text); }
.transport-btn.on.play { background: var(--green); border-color: var(--green); color: #04150b; }
.transport-btn.on.rec { background: var(--red); border-color: var(--red); color: #19020a; }
.transport-btn.rec .icon { color: var(--red); }
.transport-btn.on.rec .icon { color: #19020a; }
.transport-btn.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent2); }
.lcd { display: flex; flex-direction: column; justify-content: center; min-width: 92px; height: 34px; padding: 0 10px; border-radius: 7px; background: #070708; border: 1px solid var(--line); font-family: var(--mono); }
.lcd-main { font-size: 15px; color: var(--accent2); letter-spacing: .03em; line-height: 1.1; }
.lcd-sub { font-size: 10px; color: var(--muted); line-height: 1.1; }
.tempo-box { display: flex; align-items: center; gap: 2px; }
.tempo-box .numbox { font: 600 15px var(--mono); color: var(--text); min-width: 66px; text-align: center; }
.tb-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.tb-small { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.cpu { font: 11px var(--mono); color: var(--dim); }
.master-meter { display: flex; align-items: center; gap: 6px; }
.midi-led { width: 8px; height: 8px; border-radius: 50%; background: #2a2a2f; transition: background .08s; flex: none; }
.midi-led.on { background: var(--yellow); box-shadow: 0 0 8px var(--yellow); }
.save-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: none; }
.dirty .save-dot { display: block; }

/* ------------------------------------------------------------------ buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 13px; border-radius: 8px; border: 1px solid var(--line2); background: var(--bg4); color: var(--text); font-weight: 550; white-space: nowrap; }
.btn:hover { background: var(--bg5); border-color: var(--line3); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent2); border-color: var(--accent2); }
.btn-danger { background: rgba(255, 59, 107, .14); border-color: rgba(255, 59, 107, .45); color: #ff8aa6; }
.btn-danger:hover { background: rgba(255, 59, 107, .24); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg4); }
.btn-sm { height: 24px; padding: 0 9px; font-size: 11.5px; border-radius: 6px; }
.btn-lg { height: 38px; padding: 0 18px; font-size: 13.5px; border-radius: 10px; }
.btn.left { margin-right: auto; }
.ibtn { width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--dim); flex: none; }
.ibtn:hover { background: var(--bg5); color: var(--text); }
.ibtn.on { color: var(--accent2); background: var(--accent-soft); }
.ibtn.sm { width: 22px; height: 22px; border-radius: 5px; }
.tog { height: 24px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line2); background: var(--bg4); color: var(--dim); font-size: 11.5px; font-weight: 600; }
.tog:hover { color: var(--text); background: var(--bg5); }
.tog.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.input, select.input, .select { height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line2); background: var(--bg1); color: var(--text); min-width: 0; }
.input:focus, .select:focus { border-color: var(--accent-line); outline: none; }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; }
select { cursor: pointer; }
.select-sm { height: 24px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--line2); background: var(--bg4); font-size: 11.5px; color: var(--text2); }
.seg { display: inline-flex; background: var(--bg1); border: 1px solid var(--line2); border-radius: 8px; padding: 2px; gap: 2px; flex: none; }
.seg-btn { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--dim); font-weight: 600; font-size: 12px; }
.seg-btn:hover { color: var(--text); background: var(--bg4); }
.seg-btn.on { background: var(--bg5); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.kbd { display: inline-block; min-width: 18px; padding: 1px 5px; border-radius: 4px; background: var(--bg5); border: 1px solid var(--line2); font: 11px var(--mono); color: var(--text2); text-align: center; }
.field-label { display: block; margin: 0 0 5px; font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; }
.form { display: grid; gap: 12px; }
.form-row { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 10px; }
.form-row > label { color: var(--dim); }
.hint { color: var(--muted); font-size: 11.5px; }
.badge { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 5px; background: var(--bg5); color: var(--dim); font-size: 10.5px; font-weight: 600; }
.badge.accent { background: var(--accent-soft); color: var(--accent2); }
.badge.green { background: rgba(47, 207, 124, .13); color: var(--green); }

/* ------------------------------------------------------------------ knobs, faders, numbers */
.knob { display: flex; flex-direction: column; align-items: center; gap: 1px; width: 60px; padding: 2px 0; border-radius: 6px; outline: none; cursor: ns-resize; }
.knob:focus-visible { background: var(--bg4); }
.knob-label { font-size: 10.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; text-align: center; }
.knob-value { font: 10.5px var(--mono); color: var(--text2); white-space: nowrap; }
.knob-svg { display: block; }
.knob-track { fill: none; stroke: #2c2c32; stroke-width: 3.5; stroke-linecap: round; }
.knob-arc { fill: none; stroke: var(--knob); stroke-width: 3.5; stroke-linecap: round; }
.knob-dot { stroke: var(--text); stroke-width: 2; stroke-linecap: round; }
.knob.active .knob-value { color: var(--accent2); }
.knob.automated .knob-arc { stroke: #ff3b6b; }
.knob.mapped::after, .param.mapped::after { content: ""; position: absolute; }
.param { position: relative; }
.param-select { width: 100%; height: 22px; padding: 0 4px; border-radius: 5px; border: 1px solid var(--line2); background: var(--bg1); font-size: 11px; }
.param-enum { width: 92px; display: flex; flex-direction: column; gap: 3px; padding: 2px 2px; }
.param-boolwrap { display: flex; align-items: center; padding: 14px 2px 2px; }
.param-bool { height: 22px; font-size: 10.5px; }
.fader { position: relative; width: 26px; cursor: ns-resize; outline: none; }
.fader-track { position: absolute; left: 50%; top: 4px; bottom: 4px; width: 4px; margin-left: -2px; background: #232328; border-radius: 3px; }
.fader-fill { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(to top, var(--accent), #ff9a1f); border-radius: 3px; opacity: .85; }
.fader-thumb { position: absolute; left: -9px; width: 22px; height: 12px; border-radius: 3px; background: #d9d9de; box-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.fader-thumb::after { content: ""; position: absolute; left: 3px; right: 3px; top: 5px; height: 2px; background: #333; }
.fader.active .fader-thumb, .fader:hover .fader-thumb { background: #fff; }
.mini-fader { position: relative; height: 6px; border-radius: 3px; background: #232328; cursor: ew-resize; overflow: hidden; }
.mini-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--dim); border-radius: 3px; }
.mini-fader:hover .mini-fill { background: var(--accent2); }
.numbox { display: inline-block; padding: 3px 6px; border-radius: 6px; background: #070708; border: 1px solid var(--line); cursor: ns-resize; font-family: var(--mono); outline: none; white-space: nowrap; }
.numbox:hover { border-color: var(--line2); }
.numbox-input { width: 100%; border: 0; background: transparent; outline: none; font: inherit; color: var(--accent2); padding: 0; text-align: center; }
.meter { display: block; border-radius: 2px; }

/* ------------------------------------------------------------------ browser */
#browser { display: flex; flex-direction: column; background: var(--bg2); min-height: 0; min-width: 0; border-right: 1px solid var(--line); }
.br-head { padding: 10px 10px 8px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.br-search { position: relative; }
.br-search .icon { position: absolute; left: 9px; top: 8px; color: var(--muted); }
.br-search input { width: 100%; padding-left: 30px; height: 31px; }
.br-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.br-tabs::-webkit-scrollbar { display: none; }
.br-tab { height: 26px; padding: 0 9px; border-radius: 6px; border: 0; background: transparent; color: var(--dim); font-weight: 600; font-size: 11.5px; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.br-tab:hover { background: var(--bg4); color: var(--text); }
.br-tab.on { background: var(--bg5); color: var(--text); }
.br-body { flex: 1; overflow-y: auto; padding: 8px; min-height: 0; }
.br-foot { padding: 8px 10px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 6px; }
.br-foot .preview-vol { flex: 1; }
.br-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 2px 2px 8px; }
.br-filters .select-sm { max-width: 130px; }
.chip { height: 22px; padding: 0 8px; border-radius: 11px; border: 1px solid var(--line2); background: var(--bg3); color: var(--dim); font-size: 11px; font-weight: 600; white-space: nowrap; }
.chip:hover { color: var(--text); border-color: var(--line3); }
.chip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent2); }
.br-section-title { display: flex; align-items: center; gap: 6px; margin: 10px 4px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.br-section-title:first-child { margin-top: 2px; }
.br-section-title .grow { flex: 1; }
.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.pack-card { position: relative; border-radius: 9px; overflow: hidden; background: var(--bg3); border: 1px solid var(--line); cursor: pointer; text-align: left; padding: 0; color: var(--text); }
.pack-card:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.pack-cover { aspect-ratio: 1; background: linear-gradient(135deg, #2a1407, #121214); display: grid; place-items: center; color: var(--accent2); overflow: hidden; }
.pack-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pack-info { padding: 6px 8px 7px; }
.pack-name { font-weight: 650; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pack-meta { font-size: 10.5px; color: var(--muted); }
.pack-src { position: absolute; top: 6px; left: 6px; }
.pack-header { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: center; padding: 4px 2px 10px; }
.pack-header .pack-cover { width: 64px; border-radius: 8px; }
.pack-header h3 { margin: 0; font-size: 14px; }
.pack-header p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.pack-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 2px 8px; }
.tree-folder { margin: 2px 0; }
.tree-folder > .tree-row { font-weight: 600; color: var(--text2); }
.tree-children { padding-left: 12px; }
.tree-row { display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 6px; border-radius: 6px; cursor: pointer; white-space: nowrap; overflow: hidden; color: var(--text2); }
.tree-row:hover { background: var(--bg4); color: var(--text); }
.tree-row.playing { color: var(--accent2); background: var(--accent-soft); }
.tree-row.sel { background: var(--bg5); color: var(--text); }
.tree-row .name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.tree-row .meta { font-size: 10px; color: var(--muted); font-family: var(--mono); }
.tree-row .icon { color: var(--muted); }
.tree-row.playing .icon { color: var(--accent2); }
.role-dot { width: 7px; height: 7px; border-radius: 2px; flex: none; }
.device-item { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 8px; padding: 6px 7px; border-radius: 8px; cursor: grab; }
.device-item:hover { background: var(--bg4); }
.device-icon { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; background: var(--bg4); color: var(--accent2); overflow: hidden; }
.device-icon img { width: 100%; height: 100%; object-fit: cover; }
.device-item .t { font-weight: 600; font-size: 12px; }
.device-item .d { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-item .presets-toggle { color: var(--muted); }
.preset-list { padding: 0 0 4px 38px; }
.preset-row { height: 24px; display: flex; align-items: center; padding: 0 8px; border-radius: 5px; color: var(--dim); cursor: grab; font-size: 11.5px; }
.preset-row:hover { background: var(--bg4); color: var(--text); }
.empty-note { padding: 18px 10px; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.5; }
.empty-note .btn { margin-top: 10px; }
.drag-ghost { position: fixed; top: -100px; left: -100px; padding: 5px 10px; border-radius: 7px; background: var(--accent); color: var(--on-accent); font-weight: 650; font-size: 12px; white-space: nowrap; }

/* ------------------------------------------------------------------ view toolbars */
.view-bar { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 8px; border-bottom: 1px solid var(--line); background: var(--bg2); flex: none; }
.view-bar .title { font-weight: 650; font-size: 12.5px; margin-right: 6px; color: var(--text2); }
.view-bar .grow { flex: 1; }

/* ------------------------------------------------------------------ arrangement */
.arr { display: grid; grid-template-columns: var(--header-w) 1fr; grid-template-rows: 30px 1fr; flex: 1; min-height: 0; }
.arr-corner { background: var(--bg2); border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); display: flex; align-items: center; gap: 4px; padding: 0 6px; }
.arr-ruler { position: relative; background: var(--bg2); border-bottom: 1px solid var(--line); cursor: text; overflow: hidden; }
.arr-ruler canvas { position: absolute; inset: 0; }
.arr-headers { overflow: hidden; border-right: 1px solid var(--line); background: var(--bg2); position: relative; }
.arr-headers-inner { position: relative; }
.arr-lanes { position: relative; overflow: hidden; }
.arr-lanes canvas { position: absolute; inset: 0; }
.arr-scroll { position: absolute; inset: 0; overflow: auto; }
.arr-spacer { pointer-events: none; }
.track-head { position: absolute; left: 0; right: 0; display: grid; grid-template-columns: 6px 1fr; border-bottom: 1px solid var(--line); background: var(--bg3); overflow: hidden; }
.track-head.sel { background: #222227; }
.track-head .colorbar { background: var(--tc); }
.th-body { display: flex; flex-direction: column; gap: 5px; padding: 6px 7px 6px 8px; min-width: 0; }
.th-top { display: flex; align-items: center; gap: 4px; min-width: 0; }
.th-body.compact { gap: 4px; padding: 5px 7px 4px 8px; }
.th-name { flex: 1; min-width: 0; font-weight: 650; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
.th-name input { width: 100%; height: 20px; border: 1px solid var(--accent-line); background: var(--bg1); border-radius: 4px; padding: 0 4px; font: inherit; color: var(--text); }
.th-btns { display: flex; gap: 3px; align-items: center; }
.th-mute, .th-solo, .th-arm { width: 22px; height: 18px; border-radius: 4px; border: 1px solid var(--line2); background: var(--bg4); color: var(--dim); font-size: 10px; font-weight: 750; display: grid; place-items: center; padding: 0; }
.th-mute.on { background: #ffd23f; border-color: #ffd23f; color: #1b1500; }
.th-mute.track-num { width: auto; min-width: 22px; padding: 0 4px; }
.th-mute.track-num:not(.on) { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent2); }
.th-mute.track-num.on { background: var(--bg4); border-color: var(--line2); color: var(--muted); }
.th-solo.on { background: var(--cyan); border-color: var(--cyan); color: #021317; }
.th-arm.on { background: var(--red); border-color: var(--red); color: #19020a; }
.th-row { display: flex; align-items: center; gap: 6px; }
.th-row .mini-fader { flex: 1; }
.th-auto { display: flex; align-items: center; gap: 4px; min-width: 0; }
.th-auto select { flex: 1; min-width: 0; }
.th-type { color: var(--muted); }
.th-meter { flex: none; }
.track-head.return-head { background: #141417; }
.track-head.master-head { background: #17140f; }
.arr-add { position: absolute; left: 0; right: 0; display: flex; gap: 6px; padding: 8px; }
.drop-line { position: absolute; pointer-events: none; z-index: 4; }

/* ------------------------------------------------------------------ session */
.session { flex: 1; overflow: auto; min-height: 0; position: relative; }
.ses-grid { display: inline-grid; grid-auto-flow: column; gap: 0; min-width: 100%; align-items: start; }
.ses-col { display: flex; flex-direction: column; width: 126px; border-right: 1px solid var(--line); background: var(--bg1); }
.ses-col.sel { background: #141418; }
.ses-col.return-col { width: 110px; }
.ses-col.master-col { width: 140px; background: var(--bg2); }
.ses-head { height: 34px; display: flex; align-items: center; gap: 6px; padding: 0 8px; border-bottom: 1px solid var(--line); background: var(--bg3); position: sticky; top: 0; z-index: 2; cursor: pointer; border-top: 3px solid var(--tc, transparent); }
.ses-head .n { flex: 1; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ses-head .icon { color: var(--muted); }
.slot { height: 26px; margin: 2px 4px; border-radius: 5px; display: flex; align-items: center; gap: 5px; padding: 0 6px; background: #161619; border: 1px solid transparent; cursor: default; position: relative; overflow: hidden; }
.slot:hover { border-color: var(--line2); }
.slot.empty .slot-stop { width: 8px; height: 8px; border-radius: 1.5px; background: #2e2e34; margin: 0 auto; }
.slot.empty.arm .slot-stop { width: 10px; height: 10px; border-radius: 50%; background: #5a2333; }
.slot.empty.arm:hover .slot-stop { background: var(--red); }
.slot.empty:hover .slot-stop { background: #4a4a52; }
.slot.clip { background: var(--cc); color: #0b0b0c; font-weight: 650; font-size: 11.5px; }
.slot.clip.dim { filter: saturate(.75) brightness(.92); }
.slot.clip .slot-play { width: 16px; height: 16px; display: grid; place-items: center; border-radius: 3px; flex: none; color: rgba(0, 0, 0, .65); }
.slot.clip .slot-play:hover { background: rgba(0, 0, 0, .2); color: #000; }
.slot.clip .slot-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot.clip.sel { box-shadow: 0 0 0 2px #fff inset; }
.slot.clip.playing .slot-play { color: #000; background: rgba(255, 255, 255, .45); }
.slot-progress { position: absolute; left: 0; bottom: 0; height: 3px; background: rgba(0, 0, 0, .55); }
.slot.queued .slot-play { animation: blink .5s steps(2) infinite; }
.slot.recording { box-shadow: 0 0 0 2px var(--red) inset; }
@keyframes blink { 50% { opacity: .2; } }
.slot.drop-hover { border-color: var(--accent); background: var(--accent-soft); }
.ses-stop { height: 26px; margin: 4px; border-radius: 5px; border: 1px solid var(--line2); background: var(--bg3); display: grid; place-items: center; color: var(--dim); }
.ses-stop:hover { color: var(--text); background: var(--bg5); }
.ses-strip { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 6px 10px; border-top: 1px solid var(--line); background: var(--bg2); }
.ses-strip .sends { display: flex; flex-wrap: wrap; justify-content: center; gap: 0; }
.ses-strip .sends .knob { width: 54px; }
.ses-strip .faderrow { display: flex; justify-content: center; align-items: stretch; gap: 8px; }
.ses-strip .btnrow { display: flex; justify-content: center; gap: 3px; }
.ses-strip .db { text-align: center; font: 10.5px var(--mono); color: var(--dim); }
.scene { height: 26px; margin: 2px 4px; border-radius: 5px; display: flex; align-items: center; gap: 6px; padding: 0 6px; background: var(--bg4); border: 1px solid var(--line); cursor: pointer; }
.scene:hover { background: var(--bg5); }
.scene .slot-play { color: var(--dim); }
.scene:hover .slot-play { color: var(--green); }
.scene .n { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600; }
.scene.sel { border-color: var(--accent-line); }
.ses-add-col { display: flex; flex-direction: column; gap: 6px; padding: 40px 10px; width: 140px; }

/* ------------------------------------------------------------------ mixer */
.mixer { flex: 1; overflow: auto; display: flex; align-items: flex-start; min-height: 0; padding: 0; }
.mix-strip { display: flex; flex-direction: column; gap: 6px; width: 96px; flex: none; padding: 8px 6px; border-right: 1px solid var(--line); background: var(--bg1); min-height: 100%; height: max-content; }
.mix-strip > * { flex-shrink: 0; }
.mix-strip.sel { background: #141418; }
.mix-strip.return-strip { background: #111114; }
.mix-strip.master-strip { background: #15130f; width: 110px; }
.mix-name { height: 26px; display: flex; align-items: center; padding: 0 6px; border-radius: 5px; background: var(--bg3); font-weight: 650; border-top: 3px solid var(--tc); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
/* fixed section heights: every strip has the same layout, so faders and buttons line up */
.mix-io { display: grid; gap: 3px; height: 51px; align-content: start; }
.mix-io select { width: 100%; }
.mix-devices { display: flex; flex-direction: column; gap: 2px; height: 86px; overflow-y: auto; }
.mix-dev { flex: none; height: 20px; display: flex; align-items: center; gap: 4px; padding: 0 5px; border-radius: 4px; background: var(--bg3); font-size: 10.5px; color: var(--text2); white-space: nowrap; overflow: hidden; cursor: pointer; }
.mix-dev:hover { background: var(--bg5); }
.mix-dev.off { color: var(--muted); text-decoration: line-through; }
.mix-sends { display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start; height: calc(var(--send-rows, 0) * 62px); }
.mix-sends .knob { width: 41px; }
.mix-pan { display: flex; justify-content: center; }
.mix-fader { flex: 1 0 auto; display: flex; justify-content: center; gap: 8px; min-height: 140px; }
.mix-db { text-align: center; font: 11px var(--mono); color: var(--text2); }
.mix-btns { display: flex; justify-content: center; gap: 3px; min-height: 18px; }
.mix-num { text-align: center; font: 600 11px var(--mono); color: var(--muted); }
.mix-add { display: flex; flex-direction: column; gap: 6px; padding: 12px; }

/* ------------------------------------------------------------------ detail panel */
#detail { display: flex; flex-direction: column; background: var(--bg2); min-height: 0; min-width: 0; border-top: 1px solid var(--line); }
.detail-bar { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 8px; border-bottom: 1px solid var(--line); flex: none; }
.detail-bar .title { font-weight: 650; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-bar .grow { flex: 1; }
.detail-body { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.chain { display: flex; gap: 8px; padding: 8px; overflow-x: auto; overflow-y: hidden; height: 100%; align-items: stretch; }
.dev { display: flex; flex-direction: column; flex: none; min-width: 150px; border-radius: 9px; background: var(--bg3); border: 1px solid var(--line); overflow: hidden; }
.dev.sel { border-color: var(--line3); }
.dev.off .dev-body { opacity: .45; }
.dev.missing { border-style: dashed; }
.dev-head { display: flex; align-items: center; gap: 4px; height: 30px; padding: 0 4px 0 6px; background: var(--bg4); border-bottom: 1px solid var(--line); cursor: grab; }
.dev-head .power { width: 18px; height: 18px; border-radius: 50%; border: 0; background: var(--accent); display: grid; place-items: center; color: var(--on-accent); padding: 0; flex: none; }
.dev.off .dev-head .power { background: #3a3a40; color: var(--muted); }
.dev-head .dname { flex: 1; font-weight: 650; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
.dev-head .preset { max-width: 120px; height: 22px; font-size: 11px; }
.dev-body { flex: 1; padding: 8px; overflow: auto; min-height: 0; }
.param-groups { display: flex; gap: 10px; align-items: flex-start; height: 100%; }
.param-group { display: flex; flex-direction: column; gap: 4px; padding: 4px 4px 6px; border-radius: 7px; background: rgba(255, 255, 255, .02); border: 1px solid var(--line); }
.param-group-title { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; padding: 0 2px; }
.param-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(2, auto); gap: 2px 0; }
.param-grid.rows-1 { grid-template-rows: auto; }
.chain-drop { flex: none; width: 190px; border-radius: 9px; border: 1.5px dashed var(--line2); display: grid; place-items: center; color: var(--muted); text-align: center; padding: 14px; font-size: 12px; line-height: 1.5; }
.chain-drop.drop-hover { border-color: var(--accent); color: var(--accent2); background: var(--accent-soft); }
.chain-empty { display: grid; place-items: center; height: 100%; color: var(--muted); text-align: center; line-height: 1.6; padding: 20px; }
.dev-gr { display: flex; align-items: center; gap: 6px; font: 10.5px var(--mono); color: var(--dim); margin-top: 6px; }
.dev-gr .bar { flex: 1; height: 6px; background: #222; border-radius: 3px; overflow: hidden; position: relative; }
.dev-gr .bar i { position: absolute; right: 0; top: 0; bottom: 0; background: var(--yellow); }
.dev canvas.curve { display: block; border-radius: 6px; background: #0b0b0d; border: 1px solid var(--line); }

/* drum rack */
.rack { display: grid; grid-template-columns: auto auto; gap: 10px; height: 100%; }
.pads { display: grid; grid-template-columns: repeat(4, 74px); grid-auto-rows: 52px; gap: 5px; }
.pad { position: relative; border-radius: 7px; background: var(--bg4); border: 1px solid var(--line2); padding: 5px 6px; display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; overflow: hidden; }
.pad:hover { border-color: var(--line3); background: var(--bg5); }
.pad.filled { background: linear-gradient(160deg, #2b1a10, #1c1c20); }
.pad.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.pad.hit { background: var(--accent); }
.pad.hit .pad-name, .pad.hit .pad-note { color: var(--on-accent); }
.pad-name { font-size: 11px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.pad-note { font: 9.5px var(--mono); color: var(--muted); display: flex; justify-content: space-between; }
.pad.drop-hover { border-color: var(--accent); background: var(--accent-soft); }
.pad.muted { opacity: .45; }
.pad-edit { display: flex; flex-direction: column; gap: 6px; min-width: 250px; }
.pad-edit-head { display: flex; align-items: center; gap: 6px; }
.pad-edit-head .n { font-weight: 650; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pad-knobs { display: flex; flex-wrap: wrap; }
.sample-wave { display: block; width: 100%; height: 54px; border-radius: 6px; background: #0b0b0d; border: 1px solid var(--line); }
.sampler-drop { border: 1.5px dashed var(--line2); border-radius: 8px; padding: 6px; }
.sampler-drop.drop-hover { border-color: var(--accent); background: var(--accent-soft); }

/* clip editor */
.clip-editor { display: grid; grid-template-columns: 210px 1fr; height: 100%; min-height: 0; }
.clip-props { border-right: 1px solid var(--line); padding: 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.clip-props .row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.clip-props .row > label { width: 54px; color: var(--muted); font-size: 11px; }
.clip-props .numbox { min-width: 70px; text-align: center; font-size: 11.5px; }
.clip-props h4 { margin: 4px 0 0; font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: .07em; text-transform: uppercase; }
.clip-name-input { width: 100%; }
.clip-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.clip-tools .btn { padding: 0 6px; font-size: 11px; }
.roll { position: relative; min-height: 0; min-width: 0; display: grid; grid-template-rows: 24px 1fr 6px 70px; }
.roll canvas { display: block; }
.roll-ruler, .roll-main, .roll-vel { position: relative; overflow: hidden; }
.roll-split { background: var(--bg); cursor: row-resize; }
.roll-tools { position: absolute; right: 10px; top: 30px; z-index: 3; display: flex; gap: 4px; background: rgba(19, 19, 21, .9); padding: 3px; border-radius: 8px; border: 1px solid var(--line2); }
.audio-ed { position: relative; min-width: 0; min-height: 0; display: grid; grid-template-rows: 24px 1fr; }

/* ------------------------------------------------------------------ overview */
.overview { flex: 1; overflow-y: auto; padding: 22px 24px 40px; }
.ov-wrap { max-width: 1240px; margin: 0 auto; display: grid; gap: 18px; }
.ov-hero { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: end; padding: 22px; border-radius: 16px; background: radial-gradient(ellipse at 0% 0%, rgba(255, 87, 7, .22), transparent 55%), linear-gradient(180deg, #17171a, #121214); border: 1px solid var(--line); }
.ov-hero .eyebrow { color: var(--accent2); font-weight: 700; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.ov-title { margin: 4px 0 8px; font: 650 28px var(--font); letter-spacing: -.01em; outline: none; border-radius: 6px; padding: 0 4px; margin-left: -4px; }
.ov-title:hover { background: rgba(255, 255, 255, .04); }
.ov-title:focus { background: var(--bg1); box-shadow: 0 0 0 1px var(--accent-line); }
.ov-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.stat { padding: 8px 12px; border-radius: 10px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); min-width: 92px; }
.stat b { display: block; font: 600 16px var(--mono); color: var(--text); }
.stat span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.ov-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.ov-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.card { border-radius: 14px; background: var(--bg2); border: 1px solid var(--line); padding: 16px; min-width: 0; }
.card h3 { margin: 0 0 12px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.card h3 .grow { flex: 1; }
.card h3 .icon { color: var(--accent2); }
.songmap { width: 100%; height: 150px; display: block; border-radius: 9px; background: var(--bg1); cursor: pointer; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tpl { text-align: left; padding: 12px; border-radius: 11px; background: var(--bg3); border: 1px solid var(--line); color: var(--text); display: grid; gap: 6px; }
.tpl:hover { border-color: var(--accent-line); background: #1c1714; }
.tpl .ti { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent2); }
.tpl b { font-size: 13px; }
.tpl span { font-size: 11px; color: var(--muted); line-height: 1.35; }
.recent { display: grid; gap: 4px; }
.recent-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.recent-row:hover { background: var(--bg4); }
.recent-row .n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-row .d { font-size: 11px; color: var(--muted); }
.ov-packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.tips { display: grid; gap: 7px; font-size: 12px; color: var(--text2); }
.tips div { display: flex; gap: 8px; align-items: baseline; }
.tips .kbd { flex: none; }
.dev-status { display: grid; gap: 6px; }
.dev-status-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--bg3); }
.dev-status-row .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--green); }
.dot.warn { background: var(--yellow); }
.dot.err { background: var(--red); }

/* ------------------------------------------------------------------ status bar */
#statusbar { display: flex; align-items: center; gap: 12px; padding: 0 10px; background: var(--bg2); border-top: 1px solid var(--line); color: var(--dim); font-size: 11.5px; min-width: 0; }
#statusbar .tip { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#statusbar .st-item { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
#statusbar .st-btn { border: 0; background: transparent; color: var(--dim); display: flex; align-items: center; gap: 5px; height: 20px; padding: 0 6px; border-radius: 5px; font-size: 11px; }
#statusbar .st-btn:hover { background: var(--bg4); color: var(--text); }
#statusbar .st-btn.on { color: var(--accent2); }

/* ------------------------------------------------------------------ menus, toasts, modals */
.menu { position: fixed; z-index: 1000; min-width: 210px; padding: 5px; border-radius: 10px; background: #1b1b1f; border: 1px solid var(--line2); box-shadow: var(--shadow); }
.menu.submenu { position: absolute; display: none; top: 0; }
.menu-item { position: relative; display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 8px 0 6px; border-radius: 6px; cursor: pointer; color: var(--text2); white-space: nowrap; }
.menu-item:hover { background: var(--bg5); color: var(--text); }
.menu-item.disabled { opacity: .4; cursor: default; }
.menu-item.disabled:hover { background: transparent; }
.menu-item.danger { color: #ff8aa6; }
.menu-check { width: 16px; display: grid; place-items: center; color: var(--accent2); }
.menu-label { flex: 1; }
.menu-key { color: var(--muted); font: 11px var(--mono); }
.menu-sep { height: 1px; background: var(--line2); margin: 4px 6px; }
.menu-header { padding: 6px 8px 3px; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.toasts { position: fixed; bottom: 36px; left: 50%; transform: translateX(-50%); z-index: 1100; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 9px; max-width: min(620px, calc(100vw - 30px)); padding: 9px 12px; border-radius: 10px; background: #1d1d21; border: 1px solid var(--line2); box-shadow: var(--shadow); font-size: 12.5px; transition: opacity .3s, transform .3s; }
.toast .icon { color: var(--accent2); }
.toast-error { border-color: rgba(255, 59, 107, .5); }
.toast-error .icon { color: var(--red); }
.toast-success .icon { color: var(--green); }
.toast.out { opacity: 0; transform: translateY(8px); }
.modal-back { position: fixed; inset: 0; z-index: 900; background: rgba(0, 0, 0, .6); display: grid; place-items: center; padding: 16px; backdrop-filter: blur(3px); }
.modal { max-height: calc(100vh - 32px); display: flex; flex-direction: column; border-radius: 14px; background: var(--bg2); border: 1px solid var(--line2); box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 10px 18px; }
.modal-head h2 { flex: 1; margin: 0; font-size: 15px; font-weight: 650; }
.modal-body { padding: 4px 18px 16px; overflow-y: auto; min-height: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.modal-text { margin: 0; color: var(--text2); line-height: 1.55; }
.modal h4 { margin: 14px 0 8px; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .07em; text-transform: uppercase; }
.modal p { line-height: 1.55; color: var(--text2); }
.modal code { font: 11.5px var(--mono); background: var(--bg4); padding: 1px 5px; border-radius: 4px; color: var(--text); }
.modal pre { font: 11.5px/1.5 var(--mono); background: var(--bg1); border: 1px solid var(--line); padding: 10px 12px; border-radius: 8px; overflow-x: auto; color: var(--text2); user-select: text; }
.progress { height: 6px; background: var(--bg4); border-radius: 4px; overflow: hidden; margin: 8px 0; }
.progress-fill { height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .15s; }
.progress-text { color: var(--dim); font-size: 12px; }
.list { display: grid; gap: 4px; }
.list-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--bg3); border: 1px solid var(--line); }
.list-row .n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .d { font-size: 11px; color: var(--muted); }
.list-row .acts { display: flex; gap: 4px; }
.color-grid { display: grid; grid-template-columns: repeat(8, 22px); gap: 5px; padding: 6px; }
.color-swatch { width: 22px; height: 22px; border-radius: 5px; border: 2px solid transparent; padding: 0; }
.color-swatch.on, .color-swatch:hover { border-color: #fff; }
.shortcut-table { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; font-size: 12px; }
.tabs { display: flex; gap: 4px; margin: 0 0 12px; border-bottom: 1px solid var(--line); }
.tab { height: 32px; padding: 0 12px; border: 0; background: transparent; color: var(--dim); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.export-result { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }

/* MIDI map mode: everything that can be mapped glows */
body.midi-map [data-map] { box-shadow: 0 0 0 1.5px rgba(75, 141, 255, .55); border-radius: 6px; background: rgba(75, 141, 255, .08); cursor: pointer !important; }
body.midi-map .is-mapped { box-shadow: 0 0 0 1.5px var(--blue) !important; background: rgba(75, 141, 255, .22) !important; }
body.midi-map .learning { box-shadow: 0 0 0 2px var(--yellow) !important; animation: blink .6s steps(2) infinite; }
.map-banner { position: fixed; top: calc(var(--topbar-h) + 8px); left: 50%; transform: translateX(-50%); z-index: 50; padding: 7px 14px; border-radius: 9px; background: #10203d; border: 1px solid var(--blue); color: #cfe0ff; font-size: 12px; display: flex; gap: 10px; align-items: center; }

/* the top bar gives up space step by step: menu labels (all menus stay in the logo menu), master meter,
   view labels, MIDI group, tempo label */
#topbar { overflow: hidden; }
@media (max-width: 2200px) { .tb-menus { display: none !important; } }
@media (max-width: 1880px) { .master-meter { display: none !important; } .seg-views .seg-btn span { display: none; } .seg-views .seg-btn { padding: 0 9px; } }
@media (max-width: 1240px) { .tb-label, .tempo-box .btn-ghost { display: none !important; } }
@media (max-width: 1100px) {
  .ov-grid { grid-template-columns: 1fr; }
  .tb-midi { display: none !important; }
  .lcd { min-width: 78px; }
}
@media (max-width: 820px) {
  :root { --browser-w: 0px; --header-w: 150px; }
  #browser, .resizer-v { display: none; }
  .tb-hide-sm { display: none !important; }
}
