:root {
  color-scheme: dark;
  --bg: #0b0c10;
  --panel: #14161c;
  --strip: #1b1e27;
  --ink: #e8eadf;
  --muted: #8b917c;
  --line: #2a2e38;
  --accent: #b8ff3c;
  --hot: #ff5a7a;
  --ok: #5ee0a0;
  --saul: #e0b15a;
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  min-height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  background: #101218;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

.dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--hot);
  box-shadow: 0 0 10px var(--hot);
}

.dot.on {
  background: var(--ok);
  box-shadow: 0 0 10px var(--ok);
}

.hint {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.top-actions,
.presets,
.user-presets {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.user-presets input,
.user-presets select {
  background: #222632;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.4rem 0.55rem;
  font: inherit;
  font-size: 0.8rem;
  min-width: 8rem;
}

.user-presets input {
  flex: 1;
  min-width: 10rem;
}

button,
select {
  background: #222632;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
}

button:hover,
select:hover {
  border-color: var(--accent);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#start {
  background: var(--accent);
  color: #111;
  font-weight: 700;
  border-color: var(--accent);
}

#go-live.on {
  background: var(--hot);
  color: #fff;
  border-color: var(--hot);
}

#kick-auth.on {
  background: var(--ok);
  color: #111;
  border-color: var(--ok);
}

#chat-mix.on {
  background: var(--accent);
  color: #111;
  border-color: var(--accent);
}

#psycho.on {
  background: #6b1d3a;
  color: #ffd4de;
  border-color: var(--hot);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr);
  gap: 1rem;
  padding: 1rem;
  flex: 1;
}

.stage-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

#preview {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  cursor: grab;
}

.live-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  background: #3a3f4c;
  color: #d7dcc8;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  padding: 0.22rem 0.5rem;
  border-radius: 3px;
  pointer-events: none;
}

.live-badge.on {
  background: #e03131;
  color: #fff;
}

.stage-caption {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.desk {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.master-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
}

.master {
  display: grid;
  grid-template-columns: 4rem 1fr 2.5rem;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.strips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.4rem;
  overflow: auto;
}

.strip {
  background: var(--strip);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.35rem 0.55rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-height: 260px;
}

.strip h3 {
  margin: 0;
  font-size: 0.68rem;
  text-align: center;
  line-height: 1.2;
  font-weight: 650;
}

.strip .btns {
  display: flex;
  gap: 0.2rem;
}

.strip .btns button {
  padding: 0.15rem 0.35rem;
  font-size: 0.65rem;
}

.strip .btns button.on {
  background: var(--accent);
  color: #111;
  border-color: var(--accent);
}

.strip .btns button.hot {
  background: var(--hot);
  color: #fff;
  border-color: var(--hot);
}

.strip input[type="range"][data-act="vol"] {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 1.4rem;
  height: 110px;
  accent-color: var(--accent);
}

.pan-row {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  width: 100%;
}

.pan-row input[type="range"] {
  writing-mode: horizontal-tb;
  direction: ltr;
  width: 100%;
  height: 1.1rem;
  accent-color: var(--accent);
}

.pan-row button {
  padding: 0.1rem 0.28rem;
  font-size: 0.62rem;
  font-weight: 700;
}

.pan-readout {
  font-variant-numeric: tabular-nums;
  font-size: 0.62rem;
  color: var(--muted);
  cursor: pointer;
}

.osc-rate {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  font-size: 0.58rem;
  color: var(--muted);
  text-transform: uppercase;
}

.osc-rate input[type="range"] {
  writing-mode: horizontal-tb;
  direction: ltr;
  width: 100%;
  height: 1rem;
  accent-color: var(--accent);
}

.meter {
  width: 8px;
  height: 110px;
  background: #0e1016;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.meter > span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0%;
  background: linear-gradient(to top, var(--ok), var(--accent), var(--hot));
}

.vol {
  font-variant-numeric: tabular-nums;
  font-size: 0.7rem;
  color: var(--muted);
}

.keys {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
}

.keys summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.key-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem 0.8rem;
  margin-top: 0.7rem;
}

#saul-reset {
  grid-column: 1 / -1;
}

.key-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: var(--muted);
}

input[type="range"] {
  accent-color: var(--accent);
  width: 100%;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
}
