:root {
  --bg: #0d1018; --panel: #141926; --card: #1b2233; --line: #29324a; --text: #e6ebf7; --muted: #8b97b5;
  --accent: #6ea8ff; --ok: #6dffb0;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, -apple-system, 'Segoe UI', sans-serif; }
#app { display: grid; grid-template-columns: 1fr 380px; height: 100%; }
.stage { position: relative; min-width: 0; overflow: hidden; }
#view { position: absolute; inset: 0; }
.toolbar { position: absolute; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.top-left { top: 10px; left: 10px; }
.group { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: rgba(20, 25, 38, .85); backdrop-filter: blur(6px); }
.group button { border: 0; border-radius: 0; background: transparent; }
.group button + button { border-left: 1px solid var(--line); }
.banner { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); background: rgba(20, 25, 38, .85); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; color: var(--muted); white-space: nowrap; pointer-events: none; }
#loading { position: absolute; inset: 0; display: grid; place-items: center; background: var(--bg); color: var(--muted); }
#toast { position: absolute; top: 56px; left: 50%; transform: translate(-50%, -10px); background: var(--card); border: 1px solid var(--line); padding: 6px 12px; border-radius: 8px; opacity: 0; transition: .2s; pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.dropzone { position: absolute; inset: 12px; border: 2px dashed var(--accent); border-radius: 16px; display: none; place-items: center; font-size: 20px; background: rgba(110, 168, 255, .12); pointer-events: none; }
.dragging-file .dropzone { display: grid; }

.panel { background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.top { display: flex; align-items: baseline; justify-content: space-between; }
h1 { font-size: 18px; margin: 0; }
#audio-state { font-size: 12px; color: var(--muted); }
#audio-state::before { content: '●'; margin-right: 5px; color: #d9a441; }
#audio-state[data-on="1"]::before { color: var(--ok); }
.transport { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
button, select, input[type="number"] { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.active, button.on { background: var(--accent); color: #07101f; border-color: var(--accent); }
button.primary { background: var(--accent); color: #07101f; border-color: var(--accent); font-weight: 600; }
button.small { padding: 3px 9px; font-size: 12px; }
kbd { font: 11px ui-monospace, monospace; opacity: .6; margin-left: 4px; }
select { width: 100%; }
#preset { margin-bottom: 4px; }
details { margin-top: 6px; }
summary { cursor: pointer; color: var(--muted); padding: 4px 0; }

.row { display: grid; grid-template-columns: 96px 1fr 58px; gap: 8px; align-items: center; margin: 5px 0; }
.row > span { color: var(--muted); font-size: 12px; }
.row b { font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; font-size: 12px; }
.row select { grid-column: 2 / 4; }
.row .chk, .row button { grid-column: auto; }
.row:has(> .chk), .row:has(> button) { grid-template-columns: 96px auto auto 1fr; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="number"] { width: 70px; padding: 3px 6px; }
.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }

.card { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 10px; }
.card.open { border-color: var(--c); box-shadow: 0 0 0 1px var(--c) inset; }
.card > header { display: flex; align-items: center; gap: 6px; padding: 8px; cursor: pointer; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.name { flex: 1; min-width: 0; background: transparent; border: 1px solid transparent; color: var(--text); font: inherit; font-weight: 600; padding: 3px 5px; border-radius: 6px; }
.name:hover, .name:focus { border-color: var(--line); background: #10141f; outline: none; }
.card > header button { padding: 2px 8px; min-width: 28px; }
.body { padding: 2px 12px 12px; }
h4 { margin: 12px 0 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.hint { color: var(--muted); font-size: 11px; margin: 2px 0 4px; }
.dir.off { opacity: .35; pointer-events: none; }
.readout { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.readout b { color: var(--text); font-weight: 500; }
.empty { color: var(--muted); text-align: center; padding: 20px; }
footer p { color: var(--muted); font-size: 11px; margin: 4px 0 0; }

@media (max-width: 800px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 45vh 1fr; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
}
