:root {
  --bg: #2a2a2a;
  --window: #3a3a3a;
  --strip: #4a4a4a;
  --well: #1c1c1c;
  --line: #2a2a2a;
  --text: #ececec;
  --muted: #b7b7b7;
  --amber: #e2a33a;
  --good: #8dffb0;
  --bad: #ff8d93;
  --solo: #f0d15a;
  --mute: #e25b64;
  --teal: #2fbfb3;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.app {
  width: min(1280px, calc(100% - 20px));
  margin: 0 auto;
  padding: 16px 0 28px;
}

.topbar, .lesson {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.topbar { align-items: center; margin-bottom: 14px; }
h1, h2 { margin: 0; font-weight: 650; }
h1 { font-size: 1.35rem; letter-spacing: -0.03em; }
h2 { font-size: 1.15rem; letter-spacing: -0.02em; }
.tagline, .eyebrow, .lesson-note, .pre-demo { color: var(--muted); }
.tagline { margin: 2px 0 0; }
.eyebrow { margin: 0 0 4px; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }

.top-controls, .action-row, .challenge-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, .btn {
  border: 1px solid #5a5a5a;
  background: #333;
  border-radius: 999px;
  padding: 8px 14px;
  text-decoration: none;
}
.btn.primary { background: var(--teal); color: #06211e; border-color: var(--teal); font-weight: 700; }
.btn.primary.is-stop { background: var(--mute); color: white; border-color: var(--mute); }
.btn.ghost { background: transparent; }

.lesson {
  background: var(--window);
  border: 1px solid #222;
  border-radius: 12px;
  padding: 14px 16px;
}
.lesson-copy { min-width: 0; flex: 1; }
#challenge-detail { margin: 6px 0 0; line-height: 1.45; }
.result { min-height: 1.3em; margin: 8px 0 0; font-weight: 650; }
.result.is-good { color: var(--good); }
.result.is-bad { color: var(--bad); }
.challenge-nav { justify-content: flex-end; margin-bottom: 8px; }
.challenge-nav button.is-on { border-color: var(--teal); color: white; }
.challenge-nav button.is-solved { color: var(--good); }
.lesson-note { margin: 10px 2px 12px; }

.console {
  background: #343434;
  border: 1px solid #1a1a1a;
  border-radius: 12px;
  padding: 10px;
}
.bus-lamps { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.lamp {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #2a2a2a;
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--muted);
  font-size: 0.82rem;
}
.lamp i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3a3a3a;
  box-shadow: inset 0 0 0 1px #111;
}
.lamp.is-hot { color: white; }
.lamp.is-hot i { background: #7dff9a; box-shadow: 0 0 8px #7dff9a; }

.strips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.strip {
  flex: 0 0 168px;
  background: var(--strip);
  border: 1px solid #2c2c2c;
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.strip.is-master { flex-basis: 150px; margin-left: 10px; background: #454545; }
.strip-head {
  border-radius: 4px;
  padding: 6px 8px;
  min-height: 46px;
}
.strip-type { display: block; font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.8; }
.strip-name { font-weight: 700; }
.field { display: flex; flex-direction: column; gap: 2px; }
.field span, .send-top span, .pan-row span { font-size: 0.68rem; letter-spacing: 0.04em; text-transform: uppercase; color: #ddd; }
select, .send {
  background: var(--well);
  border: 1px solid #111;
  border-radius: 4px;
  padding: 4px 6px;
}
select { width: 100%; }
select.is-attention, .send.is-attention, .is-attention { outline: 2px solid var(--amber); }
.send { padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.send-top, .pan-row, .ms, .fader-read { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pre, .ms button, .comp {
  border: 1px solid #111;
  background: #2a2a2a;
  border-radius: 3px;
  padding: 3px 6px;
  font-size: 0.72rem;
  font-weight: 700;
}
.pre.is-on { background: #d7e26a; color: #222; }
.comp.is-on { background: #e07a3d; color: #1a1a1a; }
.mute.is-on { background: var(--mute); color: white; }
.solo.is-on { background: var(--solo); color: #222; }
.send input[type="range"], .pan-row input[type="range"] { width: 100%; accent-color: #d0d0d0; }
.fader-row { display: flex; justify-content: center; gap: 8px; min-height: 176px; }
.fader-well { position: relative; width: 48px; height: 168px; }
.fader {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 150px;
  height: 28px;
  margin: 0;
  background: transparent;
  transform: translate(-50%, -50%) rotate(-90deg);
  accent-color: #f2f2f2;
}
.meter {
  width: 10px;
  height: 168px;
  background: #141414;
  border-radius: 2px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.meter-fill {
  width: 100%;
  height: 0%;
  background: linear-gradient(#e25b64, #e2a33a 30%, #8dffb0);
}
.fader-read { font-variant-numeric: tabular-nums; font-size: 0.82rem; }

.flow-panel {
  margin-top: 12px;
  background: var(--window);
  border-radius: 12px;
  padding: 12px 14px;
}
.flow-path {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}
.flow-path b { font-weight: 650; }
.flow-path span, .node {
  background: #2a2a2a;
  border-radius: 999px;
  padding: 3px 8px;
}
.node.is-pre { color: #d7e26a; }
.arrow { color: var(--muted); padding: 0; background: transparent; }
.empty { color: var(--muted); margin: 8px 0 0; }

@media (max-width: 720px) {
  .topbar, .lesson { flex-direction: column; }
  .strip { flex-basis: 156px; }
}
