:root {
  --bg: #0d1117;
  --panel: #151b24;
  --panel-2: #1b222d;
  --line: #273140;
  --text: #e6edf3;
  --dim: #8b98a8;
  --accent: #6ee7a8;
  --accent-dim: #2f7f5c;
  --hot: #f4a261;
  --choke: #7aa2f7;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 20px 16px 40px;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  max-width: 1180px;
  margin-inline: auto;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.support-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: #06281a;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 6px 14px;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s;
}

.support-btn:hover {
  background: #86f0bb;
  border-color: #86f0bb;
}

.tag {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 999px;
  padding: 2px 8px;
  vertical-align: 3px;
}

.sub {
  color: var(--dim);
  margin: 6px 0 18px;
  max-width: 76ch;
}

.keys {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #68758a;
}

kbd {
  font: inherit;
  font-size: 11px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
}

/* ---------------------------------------------------------- transport */

.transport {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}

.spacer { flex: 1 1 auto; }

button {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 13px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

button:hover { background: #222b38; border-color: #3a475a; }

button.primary {
  min-width: 96px;
  font-weight: 600;
}

button.primary.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #06281a;
}

/* ---------------------------------------------------------- controls */

.ctl {
  display: grid;
  grid-template-columns: 62px 1fr 76px;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.ctl.inline { margin-bottom: 0; grid-template-columns: auto 130px 70px; }

.ctl label {
  color: var(--dim);
  font-size: 12px;
  white-space: nowrap;
}

.ctl .val {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text);
  text-align: right;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: #2b3542;
  border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
}

input[type="range"]::-moz-range-track {
  height: 4px;
  background: #2b3542;
  border-radius: 2px;
}

input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
}

select {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 6px;
  grid-column: 2 / span 2;
}

/* ---------------------------------------------------------- channel grid */

:root { --track-head-w: 128px; }

.grid-wrap {
  margin: 16px 0 0;
  overflow-x: auto;
}

.grid-wrap .hint { margin: 10px 0 0; }

.ruler {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0 0 5px calc(var(--track-head-w) + 5px);
  color: #5b6879;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.grid {
  display: grid;
  grid-template-columns: var(--track-head-w) repeat(16, minmax(26px, 1fr));
  grid-auto-rows: 30px;
  gap: 4px;
}

.track-head {
  position: sticky;
  left: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 4px;
  border-radius: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  cursor: pointer;
  overflow: hidden;
}

.track-head.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(110, 231, 168, 0.3);
}

.track-name {
  flex: 1 1 auto;
  width: 0; /* let flex-basis + overflow handle sizing, not content */
  min-width: 0;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: none;
  padding: 0;
  cursor: text;
  text-overflow: ellipsis;
}

.track-head.active .track-name { color: var(--accent); }

.track-toggles {
  display: flex;
  gap: 2px;
  flex: 0 0 auto;
}

.track-mute,
.track-solo,
.track-choke {
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 4px;
}

.track-mute.on {
  background: #4a2a1f;
  border-color: var(--hot);
  color: var(--hot);
}

.track-solo.on {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.track-choke.on {
  background: #26314a;
  border-color: var(--choke);
  color: var(--choke);
}

/* ---------------------------------------------------------- mixer */

.mixer-wrap { margin: 16px 0 0; }
.mixer-wrap .hint { margin: 10px 0; }

.mixer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.mixer-mode {
  display: flex;
  gap: 4px;
}

.mixer-mode button {
  font-size: 11px;
  padding: 4px 10px;
}

.mixer-mode button.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* Minimal: everything but the EQ/Comp groups. */
.mixer-wrap.mode-minimal .mixer-group { display: none; }

/* Hidden: collapse to just the header/mode toggle. */
.mixer-wrap.mode-hidden .hint,
.mixer-wrap.mode-hidden #mixer { display: none; }

.mixer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mixer-strip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 84px;
  padding: 8px 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}

.mixer-strip.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(110, 231, 168, 0.3);
}

.mixer-strip-name {
  width: 100%;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mixer-strip.active .mixer-strip-name { color: var(--accent); }

.mixer-strip .track-toggles { gap: 4px; }

.mixer-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding-top: 5px;
  border-top: 1px solid var(--line);
}

.mixer-group-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--dim);
}

.mixer-mini {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.mixer-mini-label {
  font-size: 9px;
  color: var(--dim);
}

.mixer-mini input[type="range"] {
  width: 100%;
  height: 14px;
}

.mixer-mini .val {
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.mixer-strip-level {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-top: 5px;
  border-top: 1px solid var(--line);
}

.mixer-fader-row {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 5px;
  height: 90px;
}

.mixer-fader-row input[type="range"] {
  writing-mode: vertical-lr;
  direction: rtl;
  -webkit-appearance: slider-vertical;
  width: 20px;
  height: 90px;
}

.mixer-meter {
  width: 6px;
  height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
}

.mixer-meter-fill {
  width: 100%;
  height: 0%;
  background: var(--accent);
}

.mixer-meter-fill.hot {
  background: var(--hot);
}

.mixer-strip-level .val {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.step {
  min-width: 0;
  padding: 0;
  border-radius: 5px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.step.downbeat { background: #1a212b; border-color: #313c4c; }

.step.on {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.step.on.accent {
  background: var(--accent);
  border-color: #a7f3cf;
  box-shadow: 0 0 0 1px rgba(110, 231, 168, 0.35);
}

.step.on.ghost { background: #1f4a38; border-color: #38705a; }

.step.playing {
  outline: 2px solid var(--hot);
  outline-offset: 1px;
}

/* ---------------------------------------------------------- voice */

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

.voice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 20px;
}

/* ------------------------------------------------------ channel editor */

.channel-editor {
  margin-top: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 14px 14px;
}

.muted {
  color: #4d5a6b;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  font-size: 11px;
}

input[type="number"] {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
}

.num-sm { width: 56px; }

.check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--dim);
  cursor: pointer;
  white-space: nowrap;
}

.check-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.voice-fx {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.voice-fx .hint { margin-bottom: 10px; }

.panels.voice-panels {
  margin-top: 0;
  gap: 10px;
}

/* ---------------------------------------------------------- scope */

.scope-wrap {
  position: relative;
  margin-top: 18px;
  background: #0a0e14;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

#scope {
  display: block;
  width: 100%;
  height: 110px;
}

.sr {
  position: absolute;
  right: 10px;
  top: 8px;
  font-size: 11px;
  color: #4d5a6b;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------- panels */

.panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 14px 11px;
}

.hint {
  margin: -2px 0 11px;
  font-size: 11.5px;
  line-height: 1.45;
  color: #68758a;
}

footer {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: #5b6879;
  font-size: 12px;
}

code {
  font-size: 11.5px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}

@media (max-width: 640px) {
  .grid { gap: 3px; }
  .step { border-radius: 4px; }
  .transport { gap: 10px; }
  .ctl.inline { grid-template-columns: auto 1fr 64px; flex: 1 1 200px; }
}
