/* ════════════════════════════════════════════════════════
   DJ STUDIO — CSS v3.0 (Complete Rewrite)
   Clean architecture, CSS custom properties, flex/grid
   ════════════════════════════════════════════════════════ */

/* ── 1. Custom Properties ──────────────────────────────── */
:root {
  /* Colors — Base */
  --bg: #08080c;
  --surface: #0e0e14;
  --raised: #15151e;
  --border: #27272f;
  --border-glow: rgba(34, 211, 238, 0.15);

  /* Colors — Text */
  --txt: #f5f5f5;
  --txt2: #b0b0be;
  --txt3: #7a7a90;

  /* Colors — Accent */
  --cyan: #22d3ee;
  --cyan2: #06b6d4;
  --purple: #a78bfa;
  --red: #ef4444;
  --green: #34d399;
  --amber: #fbbf24;
  --blue: #60a5fa;

  /* Colors — Deck */
  --deck-bg: #0a0a12;
  --knob-bg: #2a2a3a;
  --knob-ring: #3a3a50;

  /* Colors — Vinyl */
  --vinyl: #111118;
  --vinyl-groove: #1a1a24;
  --vinyl-label: #222230;

  /* Colors — EQ */
  --eq-hi: #ef4444;
  --eq-mid: #eab308;
  --eq-lo: #22c55e;

  /* Sizing */
  --mixer-w: 220px;
  --mixer-min-w: 180px;
  --knob-size: 46px;
  --knob-sm: 24px;
  --wf-height: 64px;
  --fader-track-h: 110px;
  --vu-width: 18px;
  --vu-min-h: 80px;
  --sampler-pad-h: 56px;
  --deck-sampler-h: 36px;

  /* Typography */
  --font-sans: 'SF Pro Display', 'Inter', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Menlo', monospace;

  /* Effects */
  --glow-text: 0 0 8px rgba(255, 255, 255, 0.3), 0 0 2px rgba(255, 255, 255, 0.5);
  --glow-cyan: 0 0 8px rgba(34, 211, 238, 0.08);
  --shadow-btn: 0 2px 4px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --shadow-knob: 0 2px 6px rgba(0, 0, 0, 0.5), 0 0 6px rgba(34, 211, 238, 0.12), inset 0 1px 2px rgba(255, 255, 255, 0.08);
  --shadow-control: 0 0 6px rgba(34, 211, 238, 0.06), 0 1px 3px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ── 2. Reset ──────────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font-sans);
  font-size: 14px;
  user-select: none;
  -webkit-user-select: none;
}

/* ── 3. Range Inputs (Sliders) ─────────────────────────── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  touch-action: none;
  height: 28px;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03));
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 18px;
  background: linear-gradient(180deg, #555, #2a2a34);
  border-radius: 3px;
  margin-top: -6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  touch-action: none;
}

input[type="range"]:active::-webkit-slider-thumb {
  background: linear-gradient(180deg, #666, #333);
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Vertical slider (rotated horizontal) */
.v-slider-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.v-slider-wrap input[type="range"] {
  transform: rotate(-90deg);
  transform-origin: center;
  width: 120px;
}

/* ── 4. Base Button ────────────────────────────────────── */
button {
  cursor: pointer;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: all 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ── 5. App Layout ─────────────────────────────────────── */
#app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  overflow: hidden;
}

/* ── 6. Header ─────────────────────────────────────────── */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-glow);
  flex-shrink: 0;
}

#header h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  text-shadow: var(--glow-text);
}

#header h1 span {
  color: var(--cyan);
  font-weight: 300;
}

#header .meta {
  color: var(--txt2);
  font-size: 11px;
  font-family: var(--font-mono);
  text-shadow: var(--glow-text);
}

/* ── 7. Main 3-Column Grid ─────────────────────────────── */
#main {
  display: grid;
  grid-template-columns: 1fr minmax(var(--mixer-min-w), var(--mixer-w)) 1fr;
  overflow: hidden;
  min-height: 0;
}

/* ── 8. Deck ───────────────────────────────────────────── */
.deck {
  display: flex;
  flex-direction: column;
  background: var(--deck-bg);
  min-width: 0;
  overflow: hidden;
}

.deck.left {
  border-right: 1px solid var(--border-glow);
}

.deck.right {
  border-left: 1px solid var(--border-glow);
}

.deck.live-active {
  border-color: rgba(251, 191, 36, 0.2);
}

/* ── 9. Waveform ───────────────────────────────────────── */
.deck-wf {
  flex-shrink: 0;
  padding: 4px 6px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-color: var(--border-glow);
  box-shadow: var(--glow-cyan);
}

.deck-wf .wf-container {
  height: var(--wf-height);
}

.wf-container {
  flex: 1;
  position: relative;
  height: 72px;
  background: var(--bg);
  border: 1px solid rgba(34, 211, 238, 0.25);
  border-radius: 6px;
  overflow: hidden;
  cursor: crosshair;
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.1), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.wf-container canvas {
  width: 100%;
  height: 100%;
}

.wf-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
  pointer-events: none;
  z-index: 2;
}

.wf-info {
  position: absolute;
  top: 4px;
  left: 8px;
  z-index: 3;
  display: flex;
  gap: 8px;
  align-items: center;
}

.wf-info .title {
  font-size: 12px;
  color: var(--txt);
  font-weight: 600;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: var(--glow-text);
}

.wf-info .bpm {
  font-size: 12px;
  color: var(--cyan);
  font-family: var(--font-mono);
  font-weight: 700;
  text-shadow: 0 0 8px rgba(34, 211, 238, 0.3);
}

.wf-info .key {
  font-size: 10px;
  color: var(--purple);
  font-family: var(--font-mono);
  padding: 2px 6px;
  background: rgba(167, 139, 250, 0.15);
  border-radius: 3px;
}

.wf-time {
  position: absolute;
  bottom: 4px;
  right: 10px;
  font-size: 11px;
  color: var(--txt2);
  font-family: var(--font-mono);
  z-index: 3;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.2);
}

.wf-overview {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1;
}

.wf-overview canvas {
  width: 100%;
  height: 100%;
}

.wf-overview .viewport {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.3);
  pointer-events: none;
}

/* ── 10. Transport Controls ────────────────────────────── */
.deck-controls-row {
  display: flex;
  gap: 4px;
  padding: 3px 8px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
  border-color: var(--border-glow);
  box-shadow: var(--glow-cyan);
}

.ctrl-col,
.ctrl-col-wide {
  display: contents;
}

.transport {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-content: start;
}

.transport button {
  padding: 4px 12px;
  border-radius: 5px;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  min-height: 30px;
  min-width: 44px;
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.06), var(--shadow-btn);
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-shadow: 0 0 3px rgba(255, 255, 255, 0.15);
}

.btn-play {
  background: linear-gradient(180deg, #3ee8a0, #28b67d);
  color: #000;
  border-color: rgba(52, 211, 153, 0.3);
  text-shadow: none;
}

.btn-play:active {
  transform: scale(0.95);
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.4);
}

.btn-play.active {
  background: linear-gradient(180deg, #fcd34d, #d4a017);
  color: #000;
  border-color: rgba(251, 191, 36, 0.3);
}

.btn-cue {
  background: linear-gradient(180deg, var(--raised), #0d0d14);
  color: var(--cyan);
  border: 2px solid var(--cyan);
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.15), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn-cue:hover,
.btn-cue:active {
  background: rgba(34, 211, 238, 0.12);
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.3);
}

.btn-sync {
  background: linear-gradient(180deg, var(--raised), #0d0d14);
  color: var(--purple);
  border: 2px solid var(--purple);
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.15), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn-sync:hover,
.btn-sync:active {
  background: rgba(167, 139, 250, 0.12);
  box-shadow: 0 0 14px rgba(167, 139, 250, 0.3);
}

.btn-load {
  background: linear-gradient(180deg, var(--raised), #0d0d14);
  color: var(--txt2);
  border: 1px solid var(--border);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn-load:hover,
.btn-load:active {
  background: var(--knob-bg);
  color: var(--txt);
}

/* ── 11. Live Input ────────────────────────────────────── */
.btn-live {
  background: linear-gradient(180deg, var(--raised), #0d0d14);
  color: var(--amber);
  border: 2px solid var(--amber);
  box-shadow: 0 0 6px rgba(251, 191, 36, 0.15), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn-live:hover,
.btn-live:active {
  background: rgba(251, 191, 36, 0.1);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.25);
}

.btn-live.active {
  background: rgba(251, 191, 36, 0.12);
  color: #fff;
  border-color: var(--green);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.3);
}

.live-indicator {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 7px;
  color: var(--green);
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  display: none;
}

.deck.live-active .live-indicator {
  display: block;
}

.live-source-bar {
  display: none;
  padding: 4px 16px;
  border-top: 1px solid var(--border);
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  background: rgba(251, 191, 36, 0.03);
}

.live-source-bar.active {
  display: flex;
}

.live-source-bar label {
  font-size: 9px;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.live-source-bar select {
  background: var(--bg);
  color: var(--txt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  font-family: inherit;
  flex: 1;
  min-height: 32px;
}

.live-vu-mini {
  width: 60px;
  height: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.live-vu-mini-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, var(--green), var(--amber) 70%, var(--red) 95%);
  transition: width 60ms;
}

/* ── 12. Hot Cues ──────────────────────────────────────── */
.hotcue-row {
  padding: 3px 8px;
  flex-shrink: 0;
  border-top: 1px solid var(--border-glow);
  box-shadow: var(--glow-cyan);
}

.hotcue-row .perf-group-label {
  margin-bottom: 2px;
}

.hotcues {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}

.hotcue {
  aspect-ratio: 1;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--pad-color, var(--cyan));
  background: rgba(0, 0, 0, 0.3);
  color: var(--pad-color, var(--cyan));
  transition: all 0.2s;
  min-width: 0;
  position: relative;
  touch-action: manipulation;
  text-shadow: 0 0 8px var(--pad-glow, rgba(34, 211, 238, 0.25));
  box-shadow:
    0 0 16px var(--pad-glow, rgba(34, 211, 238, 0.4)),
    0 0 4px rgba(255, 255, 255, 0.15),
    inset 0 0 10px var(--pad-glow, rgba(34, 211, 238, 0.15));
}

.hotcue::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
}

.hotcue.set::after {
  background: var(--green);
  box-shadow: 0 0 4px var(--green);
}

.hotcue.set {
  background: rgba(0, 0, 0, 0.2);
  box-shadow:
    0 0 16px var(--pad-glow, rgba(34, 211, 238, 0.4)),
    inset 0 0 10px var(--pad-glow, rgba(34, 211, 238, 0.15));
}

.hotcue:hover,
.hotcue:active {
  background: rgba(0, 0, 0, 0.15);
  box-shadow:
    0 0 18px var(--pad-glow, rgba(34, 211, 238, 0.5)),
    inset 0 0 12px var(--pad-glow, rgba(34, 211, 238, 0.2));
}

/* Hot cue pad colors */
.hotcue:nth-child(1) { --pad-color: #ff2d55; --pad-glow: rgba(255, 45, 85, 0.4); }
.hotcue:nth-child(2) { --pad-color: #ff6b00; --pad-glow: rgba(255, 107, 0, 0.4); }
.hotcue:nth-child(3) { --pad-color: #ffdd00; --pad-glow: rgba(255, 221, 0, 0.4); }
.hotcue:nth-child(4) { --pad-color: #00ff88; --pad-glow: rgba(0, 255, 136, 0.4); }
.hotcue:nth-child(5) { --pad-color: #00e5ff; --pad-glow: rgba(0, 229, 255, 0.4); }
.hotcue:nth-child(6) { --pad-color: #3d7aff; --pad-glow: rgba(61, 122, 255, 0.4); }
.hotcue:nth-child(7) { --pad-color: #bf5af2; --pad-glow: rgba(191, 90, 242, 0.4); }
.hotcue:nth-child(8) { --pad-color: #ff2d95; --pad-glow: rgba(255, 45, 149, 0.4); }

/* ── 13. Performance Strip (Loop + Beat Jump) ──────────── */
.perf-strip {
  display: flex;
  gap: 8px;
  padding: 3px 8px;
  flex-shrink: 0;
  border-top: 1px solid var(--border-glow);
  align-items: start;
  box-shadow: var(--glow-cyan);
}

.perf-group {
  flex: 1;
  min-width: 0;
}

.perf-group-label {
  font-size: 7px;
  color: var(--txt3);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1px;
  text-shadow: var(--glow-text);
}

.loop-section {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.loop-btn {
  padding: 2px 0;
  font-size: 10px;
  background: var(--raised);
  color: var(--txt2);
  border-radius: 4px;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  flex: 1;
  min-width: 30px;
  min-height: 26px;
  text-align: center;
  touch-action: manipulation;
  box-shadow: var(--shadow-control);
  text-shadow: 0 0 3px rgba(255, 255, 255, 0.15);
}

.loop-btn.active {
  color: var(--green);
  border-color: var(--green);
  background: rgba(52, 211, 153, 0.08);
}

.loop-btn:hover,
.loop-btn:active {
  background: var(--knob-bg);
}

.beatjump {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.bj-btn {
  padding: 2px 0;
  font-size: 10px;
  background: var(--raised);
  color: var(--txt2);
  border-radius: 4px;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  flex: 1;
  min-width: 30px;
  min-height: 26px;
  text-align: center;
  touch-action: manipulation;
  box-shadow: var(--shadow-control);
  text-shadow: 0 0 3px rgba(255, 255, 255, 0.15);
}

.bj-btn:hover,
.bj-btn:active {
  background: var(--knob-bg);
  color: var(--txt);
}

/* ── 14. Platter & Pitch ──────────────────────────────── */
.platter-row {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  min-height: 0;
  max-height: 55%;
  overflow: hidden;
}

.platter-pitch-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.deck.left .platter-pitch-row {
  flex-direction: row;
}

.deck.right .platter-pitch-row {
  flex-direction: row-reverse;
}

.platter-wrap {
  position: relative;
  aspect-ratio: 1;
  height: 95%;
  min-height: 80px;
  flex-shrink: 1;
}

.platter {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 50%,
    var(--vinyl-label) 18%,
    var(--vinyl-groove) 19%,
    var(--vinyl) 22%,
    var(--vinyl-groove) 30%,
    var(--vinyl) 33%,
    var(--vinyl-groove) 45%,
    var(--vinyl) 48%,
    var(--vinyl-groove) 60%,
    var(--vinyl) 63%,
    var(--vinyl-groove) 75%,
    var(--vinyl) 78%,
    var(--vinyl-groove) 88%,
    #0d0d15 90%
  );
  border: 3px solid var(--knob-ring);
  cursor: grab;
  transition: box-shadow 0.3s;
}

.platter.playing {
  box-shadow: 0 0 30px rgba(34, 211, 238, 0.2);
}

.platter .label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: var(--vinyl-label);
  border: 2px solid var(--knob-ring);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--txt3);
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.platter .dot {
  position: absolute;
  top: 12%;
  left: 50%;
  width: 6px;
  height: 6px;
  background: var(--cyan);
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 4px var(--cyan);
}

/* Vertical pitch strip beside platter */
.pitch-strip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 64px;
  flex-shrink: 0;
  height: 92%;
  justify-content: center;
}

.pitch-strip label {
  font-size: 10px;
  color: var(--txt);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
  font-weight: 600;
}

.pitch-fader-wrap {
  flex: 1;
  width: 100%;
  position: relative;
  min-height: 60px;
}

.pitch-strip input[type="range"] {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  transform-origin: center;
  width: calc(var(--pitch-h, 250px));
  height: 28px;
}

.pitch-val {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(34, 211, 238, 0.4);
  font-weight: 600;
}

.pitch-range-col {
  display: flex;
  gap: 3px;
}

.pitch-range-col button {
  padding: 4px 8px;
  font-size: 10px;
  background: linear-gradient(180deg, var(--raised), #0a0a10);
  color: var(--txt3);
  border-radius: 4px;
  border: 1px solid var(--border);
  min-height: 28px;
  min-width: 28px;
  box-shadow: var(--shadow-control);
  touch-action: manipulation;
}

.pitch-range-col button.active {
  color: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 6px rgba(34, 211, 238, 0.2);
}

/* Horizontal pitch (legacy) */
.pitch-section {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.pitch-section label {
  font-size: 10px;
  color: var(--txt3);
  text-transform: uppercase;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.pitch-section input[type="range"] {
  flex: 1;
  height: 24px;
  min-width: 80px;
}

.pitch-value {
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--cyan);
  min-width: 50px;
  text-align: right;
  text-shadow: 0 0 8px rgba(34, 211, 238, 0.4);
}

.pitch-range-btns {
  display: flex;
  gap: 3px;
}

.pitch-range-btns button {
  padding: 2px 6px;
  font-size: 8px;
  background: linear-gradient(180deg, var(--raised), #0d0d14);
  color: var(--txt3);
  border-radius: 3px;
  border: 1px solid var(--border);
  min-height: 22px;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.pitch-range-btns button.active {
  color: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.2), 0 2px 3px rgba(0, 0, 0, 0.2);
}

/* ── 15. Per-Deck FX Strip ─────────────────────────────── */
.deck-fx {
  display: flex;
  gap: 4px;
  padding: 3px 6px;
  flex-shrink: 0;
  border-top: 1px solid var(--border-glow);
  align-items: center;
  background: var(--surface);
  box-shadow: var(--glow-cyan);
}

.deck-fx .fx-label {
  font-size: 8px;
  color: var(--txt3);
  text-transform: uppercase;
  letter-spacing: 1px;
  flex-shrink: 0;
  text-shadow: var(--glow-text);
}

.deck-fx select {
  background: var(--bg);
  color: var(--txt);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 4px;
  font-size: 9px;
  font-family: inherit;
  min-height: 22px;
}

.deck-fx .knob {
  width: var(--knob-sm);
  height: var(--knob-sm);
}

.deck-fx .fx-toggle {
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 8px;
  min-height: 22px;
}

.deck-fx .fx-beat {
  padding: 2px 4px;
  font-size: 7px;
  min-height: 18px;
}

/* FX shared */
.fx-unit {
  flex: 1;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 4px 8px;
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.fx-unit .fx-label {
  font-size: 10px;
  color: var(--txt3);
  text-transform: uppercase;
  letter-spacing: 1px;
  width: 30px;
  flex-shrink: 0;
}

.fx-select {
  background: var(--bg);
  color: var(--txt);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 3px 6px;
  font-size: 10px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  min-height: 24px;
}

.fx-select:focus {
  border-color: var(--cyan);
}

.fx-knobs {
  display: flex;
  gap: 8px;
  align-items: center;
}

.fx-knob-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.fx-knob-wrap label {
  font-size: 8px;
  color: var(--txt3);
  text-transform: uppercase;
}

.fx-knob-wrap .knob {
  width: 28px;
  height: 28px;
}

.fx-toggle {
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 9px;
  text-transform: uppercase;
  background: var(--bg);
  color: var(--txt3);
  border: 1px solid var(--border);
  min-height: 36px;
  box-shadow: var(--shadow-control);
}

.fx-toggle.active {
  color: var(--cyan);
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.08);
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.15);
}

.fx-beat-btns {
  display: flex;
  gap: 3px;
}

.fx-beat {
  padding: 5px 8px;
  font-size: 9px;
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--txt3);
  border: 1px solid var(--border);
  border-radius: 3px;
  min-height: 28px;
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-control);
}

.fx-beat.active {
  color: var(--purple);
  border-color: var(--purple);
}

/* ── 16. Per-Deck Sampler ──────────────────────────────── */
.deck-sampler {
  padding: 3px 8px;
  flex-shrink: 0;
  border-top: 1px solid var(--border-glow);
  box-shadow: var(--glow-cyan);
}

.deck-sampler-label {
  font-size: 7px;
  color: var(--txt2);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 2px;
  text-shadow: var(--glow-text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.deck-sampler-pads {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  height: var(--deck-sampler-h);
}

.deck-sampler-pad {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(180deg, var(--raised), #0a0a10);
  border: 2px solid rgba(34, 211, 238, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  overflow: hidden;
  min-width: 0;
  touch-action: manipulation;
  padding-bottom: 2px;
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.08), 0 2px 4px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.deck-sampler-pad:hover {
  background: var(--knob-bg);
}

.deck-sampler-pad:active {
  transform: scale(0.95);
}

.deck-sampler-pad .dsp-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--txt3);
  z-index: 2;
}

.deck-sampler-pad .dsp-label {
  font-size: 6px;
  color: var(--txt3);
  z-index: 2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deck-sampler-pad .dsp-wf {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 14px;
  overflow: hidden;
}

.deck-sampler-pad .dsp-wf canvas {
  width: 100%;
  height: 100%;
}

.deck-sampler-pad .dsp-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--cyan);
  z-index: 3;
}

.deck-sampler-pad .dsp-playhead {
  position: absolute;
  top: 0;
  bottom: 14px;
  width: 2px;
  background: var(--green);
  z-index: 3;
  display: none;
  box-shadow: 0 0 3px var(--green);
}

/* Deck sampler states */
.deck-sampler-pad.dsp-loaded {
  border-color: var(--cyan);
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.06), rgba(34, 211, 238, 0.02));
  box-shadow: 0 0 6px rgba(34, 211, 238, 0.12);
}

.deck-sampler-pad.dsp-loaded .dsp-num {
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(34, 211, 238, 0.5);
}

.deck-sampler-pad.dsp-recording {
  border-color: var(--red);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.08), rgba(239, 68, 68, 0.02));
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.12);
  animation: rec-pulse 1s ease infinite;
}

.deck-sampler-pad.dsp-recording .dsp-num {
  color: var(--red);
  text-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.deck-sampler-pad.dsp-playing {
  border-color: var(--green);
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.06), rgba(52, 211, 153, 0.02));
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.12);
}

.deck-sampler-pad.dsp-playing .dsp-num {
  color: var(--green);
  text-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
}

.deck-sampler-pad.dsp-playing .dsp-playhead {
  display: block;
}

.deck-sampler-rec {
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 10px;
  text-transform: uppercase;
  background: var(--bg);
  color: var(--txt3);
  border: 1px solid var(--border);
  min-height: 30px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: var(--shadow-control);
}

.deck-sampler-rec.dsp-armed {
  color: var(--red);
  border-color: var(--red);
  animation: rec-pulse 1s ease infinite;
}

/* ── 17. Mixer (Center Column) ─────────────────────────── */
#mixer {
  background: var(--surface);
  border-left: 1px solid var(--border-glow);
  border-right: 1px solid var(--border-glow);
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 6px;
  overflow-y: auto;
  box-shadow:
    inset 2px 0 10px rgba(34, 211, 238, 0.04),
    inset -2px 0 10px rgba(34, 211, 238, 0.04);
}

.mixer-header {
  text-align: center;
  font-size: 11px;
  color: var(--txt3);
  text-transform: uppercase;
  letter-spacing: 2px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  text-shadow: var(--glow-text);
}

/* Channel strips */
.ch-strips {
  display: flex;
  gap: 12px;
  flex: 1;
}

.ch-strip {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.ch-label {
  font-size: 11px;
  color: var(--txt3);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  text-shadow: var(--glow-text);
}

/* EQ Knobs */
.eq-knobs {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.knob-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  position: relative;
}

.knob-group label {
  font-size: 9px;
  color: var(--txt3);
  text-transform: uppercase;
}

.knob {
  width: var(--knob-size);
  height: var(--knob-size);
  border-radius: 50%;
  background: conic-gradient(from 220deg, #2a2a38, #1a1a24 40%, #2a2a38 80%, #1a1a24);
  border: 2px solid var(--knob-ring);
  position: relative;
  cursor: pointer;
  touch-action: none;
  box-shadow: var(--shadow-knob);
}

.knob::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  width: 3px;
  height: 14px;
  background: var(--cyan);
  transform-origin: bottom center;
  transform: translateX(-50%);
  border-radius: 2px;
  box-shadow: 0 0 4px var(--cyan);
}

.knob.hi::after  { background: var(--eq-hi); }
.knob.mid::after { background: var(--eq-mid); }
.knob.lo::after  { background: var(--eq-lo); }

/* Knob digital readout */
.knob-readout {
  display: flex;
  align-items: center;
  gap: 2px;
  justify-content: center;
  margin-top: 3px;
}

.knob-btn {
  width: 26px;
  height: 22px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--raised), #0a0a10);
  color: var(--txt3);
  border: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  touch-action: manipulation;
  box-shadow: var(--shadow-control);
}

.knob-btn:hover,
.knob-btn:active {
  color: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 6px rgba(34, 211, 238, 0.2);
}

.knob-display {
  min-width: 36px;
  height: 22px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
  text-shadow: 0 0 6px currentColor;
}

.knob-display.hi-color {
  color: var(--eq-hi);
  text-shadow: 0 0 6px rgba(239, 68, 68, 0.3);
}

.knob-display.mid-color {
  color: var(--eq-mid);
  text-shadow: 0 0 6px rgba(234, 179, 8, 0.3);
}

.knob-display.lo-color {
  color: var(--eq-lo);
  text-shadow: 0 0 6px rgba(34, 197, 94, 0.3);
}

/* Filter knob */
.filter-knob {
  margin: 4px 0;
}

/* VU Meters */
.vu-wrap {
  display: flex;
  gap: 3px;
  flex: 1;
  justify-content: center;
}

.vu-meter {
  width: var(--vu-width);
  flex: 1;
  min-height: var(--vu-min-h);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}

.vu-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, var(--green) 0%, var(--green) 60%, var(--amber) 80%, var(--red) 95%);
  transition: height 60ms;
}

/* Channel fader */
.ch-fader {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.ch-fader-label {
  font-size: 7px;
  color: var(--txt2);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-shadow: var(--glow-text);
}

.ch-fader-track {
  width: 36px;
  height: var(--fader-track-h);
  margin: 4px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ch-fader-track input[type="range"] {
  transform: rotate(-90deg);
  width: 100px;
  height: 28px;
}

.ch-fader-val {
  font-size: 8px;
  font-family: var(--font-mono);
  color: var(--cyan);
  text-shadow: 0 0 6px rgba(34, 211, 238, 0.3);
}

/* Crossfader */
.crossfader-section {
  padding: 6px 0;
  border-top: 1px solid var(--border-glow);
}

.crossfader-section .xf-label {
  display: block;
  text-align: center;
  font-size: 7px;
  color: var(--txt2);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
  text-shadow: var(--glow-text);
}

.crossfader-section .xf-markers {
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
  margin-bottom: 2px;
}

.crossfader-section .xf-markers span {
  font-size: 7px;
  color: var(--txt3);
}

.crossfader-section .xf-track {
  position: relative;
  padding: 4px 0;
}

.crossfader-section input[type="range"] {
  width: 100%;
  height: 28px;
}

.crossfader-section input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  background: linear-gradient(90deg, var(--cyan) 0%, rgba(255, 255, 255, 0.1) 40%, rgba(255, 255, 255, 0.1) 60%, var(--purple) 100%);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.crossfader-section input[type="range"]::-webkit-slider-thumb {
  width: 34px;
  height: 20px;
  background: linear-gradient(180deg, #555, #2a2a34);
  border-radius: 3px;
  margin-top: -7px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Headphone cue */
.hp-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 0;
  border-top: 1px solid var(--border-glow);
}

.hp-section-title {
  font-size: 8px;
  color: var(--txt2);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-align: center;
  text-shadow: var(--glow-text);
}

.hp-row {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
}

.hp-mix-row {
  display: flex;
  gap: 4px;
  align-items: center;
}

.hp-mix-row label {
  font-size: 7px;
  color: var(--txt3);
  text-transform: uppercase;
  flex-shrink: 0;
}

.hp-btn {
  flex: 1;
  height: 26px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--raised), #0a0a10);
  color: var(--txt3);
  box-shadow: var(--shadow-control);
  touch-action: manipulation;
  letter-spacing: 0.5px;
}

.hp-btn.active {
  border-color: var(--amber);
  color: var(--amber);
  background: rgba(251, 191, 36, 0.08);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}

/* Master volume */
.master-section {
  padding: 6px 0;
  border-top: 1px solid var(--border-glow);
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.master-section label {
  font-size: 10px;
  color: var(--txt3);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.master-vu {
  display: flex;
  gap: 4px;
  justify-content: center;
  height: 32px;
}

.master-vu .vu-meter {
  width: 10px;
  min-height: auto;
}

/* ── 18. Global Sampler Section ────────────────────────── */
#sampler-section {
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
}

/* Recording display */
.sampler-rec-display {
  display: none;
  padding: 6px 16px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
  align-items: center;
}

.sampler-rec-display.active {
  display: flex;
}

.rec-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
  animation: rec-blink 1s ease infinite;
}

.rec-time {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--red);
  min-width: 50px;
}

.rec-waveform {
  flex: 1;
  height: 48px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.rec-waveform canvas {
  width: 100%;
  height: 100%;
}

.rec-vu {
  width: 24px;
  height: 48px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.rec-vu-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, var(--green) 0%, var(--green) 60%, var(--amber) 80%, var(--red) 95%);
  transition: height 50ms;
}

.rec-vu-label {
  font-size: 7px;
  color: var(--txt3);
  text-align: center;
  margin-top: 2px;
}

.rec-gain-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.rec-gain-wrap label {
  font-size: 8px;
  color: var(--txt3);
  text-transform: uppercase;
}

.rec-gain-wrap input[type="range"] {
  width: 60px;
  height: 24px;
}

/* Sampler pad row */
#sampler-bar {
  display: flex;
  gap: 6px;
  padding: 6px 12px;
  align-items: center;
}

.sampler-label {
  font-size: 10px;
  color: var(--txt3);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  flex-shrink: 0;
  margin-right: 4px;
  text-shadow: var(--glow-text);
}

.sampler-pads {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 5px;
  flex: 1;
}

.sampler-pad {
  height: var(--sampler-pad-h);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--raised), #0a0a10);
  border: 2px solid rgba(34, 211, 238, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  overflow: hidden;
  min-width: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: 4px;
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.08), 0 2px 4px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.sampler-pad:hover {
  background: linear-gradient(180deg, #1e1e2a, #12121a);
  border-color: rgba(34, 211, 238, 0.35);
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.15), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.sampler-pad:active {
  transform: scale(0.94);
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.2);
}

.sampler-pad .pad-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--txt3);
  letter-spacing: 1px;
  z-index: 2;
}

.sampler-pad .pad-label {
  font-size: 8px;
  color: var(--txt3);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 4px;
  text-align: center;
  z-index: 2;
}

.sampler-pad .pad-waveform {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 16px;
  overflow: hidden;
}

.sampler-pad .pad-waveform canvas {
  width: 100%;
  height: 100%;
}

.sampler-pad .pad-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--cyan);
  transition: width 50ms;
  z-index: 3;
}

.sampler-pad .pad-playhead {
  position: absolute;
  top: 0;
  bottom: 16px;
  width: 2px;
  background: var(--green);
  z-index: 3;
  display: none;
  box-shadow: 0 0 4px var(--green);
}

/* Sampler pad states */
.sampler-pad.loaded {
  border-color: var(--cyan);
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.08), rgba(34, 211, 238, 0.02));
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.15), inset 0 1px 0 rgba(34, 211, 238, 0.1);
}

.sampler-pad.loaded .pad-num {
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(34, 211, 238, 0.5);
}

.sampler-pad.loaded .pad-label {
  color: var(--cyan);
}

.sampler-pad.recording {
  border-color: var(--red);
  background: rgba(239, 68, 68, 0.06);
  animation: rec-pulse 1s ease infinite;
}

.sampler-pad.recording .pad-num {
  color: var(--red);
  text-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.sampler-pad.playing-sample {
  border-color: var(--green);
  background: rgba(52, 211, 153, 0.06);
}

.sampler-pad.playing-sample .pad-num {
  color: var(--green);
  text-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
}

.sampler-pad.playing-sample .pad-playhead {
  display: block;
}

/* Sampler controls */
.sampler-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
  margin-left: 8px;
}

.sampler-src {
  background: var(--bg);
  color: var(--txt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  min-height: 34px;
}

.sampler-src:focus {
  border-color: var(--cyan);
}

.sampler-rec-btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 11px;
  text-transform: uppercase;
  background: linear-gradient(180deg, var(--raised), #0d0d14);
  color: var(--txt3);
  border: 2px solid var(--border);
  min-height: 40px;
  font-weight: 700;
  box-shadow: var(--shadow-control);
}

.sampler-rec-btn.armed {
  color: var(--red);
  border-color: var(--red);
  background: rgba(239, 68, 68, 0.08);
  animation: rec-pulse 1s ease infinite;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.sampler-clear-btn {
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 10px;
  background: linear-gradient(180deg, var(--raised), #0d0d14);
  color: var(--txt3);
  border: 1px solid var(--border);
  min-height: 36px;
  box-shadow: var(--shadow-control);
}

/* ── 19. Tooltips ──────────────────────────────────────── */
[data-tip] {
  position: relative;
}

[data-tip]:hover::before {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2a;
  color: var(--txt);
  font-size: 10px;
  font-weight: 400;
  padding: 5px 10px;
  border-radius: 5px;
  white-space: nowrap;
  z-index: 50;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  letter-spacing: 0;
}

[data-tip]:hover::after {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #1a1a2a;
  z-index: 50;
  pointer-events: none;
}

/* ── 20. Help Overlay ──────────────────────────────────── */
#help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 200;
  display: none;
  overflow-y: auto;
  padding: 40px;
}

#help-overlay.active {
  display: block;
}

#help-overlay .help-close {
  position: fixed;
  top: 16px;
  right: 24px;
  font-size: 24px;
  color: var(--txt3);
  cursor: pointer;
  z-index: 201;
  background: none;
  border: none;
  padding: 8px;
}

#help-overlay .help-close:hover {
  color: var(--txt);
}

.help-content {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.help-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--txt);
  text-align: center;
  letter-spacing: 1px;
}

.help-subtitle {
  font-size: 12px;
  color: var(--txt3);
  text-align: center;
  margin-top: -16px;
}

.help-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}

.help-section h3 {
  font-size: 14px;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
}

.help-item {
  display: flex;
  gap: 10px;
  align-items: start;
  padding: 6px 0;
}

.help-key {
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cyan);
  white-space: nowrap;
  min-width: 40px;
  text-align: center;
  flex-shrink: 0;
}

.help-desc {
  font-size: 12px;
  color: var(--txt2);
  line-height: 1.4;
}

.help-diagram {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: start;
}

.help-deck {
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.help-deck h4 {
  font-size: 11px;
  color: var(--purple);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.help-mixer-col {
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.help-mixer-col h4 {
  font-size: 11px;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.help-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.help-list li {
  font-size: 11px;
  color: var(--txt2);
  padding: 3px 0;
  display: flex;
  gap: 6px;
}

.help-list li::before {
  content: '\25B8';
  color: var(--cyan);
  flex-shrink: 0;
}

.help-color-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

/* ── 21. Source Picker Modal ───────────────────────────── */
.source-picker {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
}

.source-picker.active {
  display: flex;
}

.source-picker-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  width: 340px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.source-picker-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--txt);
  margin-bottom: 4px;
}

.source-picker-subtitle {
  font-size: 10px;
  color: var(--txt3);
  margin-bottom: 16px;
}

.source-picker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.source-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--raised);
  cursor: pointer;
  transition: all 0.15s;
  touch-action: manipulation;
}

.source-option:hover {
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.04);
}

.source-option:active {
  transform: scale(0.98);
}

.source-option-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.source-option-icon.mic    { background: rgba(52, 211, 153, 0.1);  color: var(--green); }
.source-option-icon.system { background: rgba(34, 211, 238, 0.1);  color: var(--cyan); }
.source-option-icon.screen { background: rgba(167, 139, 250, 0.1); color: var(--purple); }
.source-option-icon.device { background: rgba(251, 191, 36, 0.1);  color: var(--amber); }

.source-option-info {
  flex: 1;
  min-width: 0;
}

.source-option-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--txt);
}

.source-option-desc {
  font-size: 9px;
  color: var(--txt3);
  margin-top: 2px;
}

.source-picker-cancel {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  border-radius: 6px;
  font-size: 11px;
  background: var(--bg);
  color: var(--txt3);
  border: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.source-picker-cancel:hover {
  color: var(--txt);
  border-color: var(--txt3);
}

/* ── 22. Drop Zone ─────────────────────────────────────── */
.drop-zone {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 12, 0.9);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

.drop-zone.active {
  display: flex;
}

.drop-zone .ring {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 3px dashed var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 1.5s ease infinite;
}

.drop-zone .ring span {
  color: var(--cyan);
  font-size: 18px;
  font-weight: 600;
}

.drop-zone .hint {
  color: var(--txt3);
  font-size: 13px;
}

/* ── 23. Stems ─────────────────────────────────────────── */
.stems {
  display: flex;
  gap: 4px;
  align-items: center;
}

.stems label {
  font-size: 9px;
  color: var(--txt3);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-right: 2px;
}

.stem-fader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.stem-fader label {
  font-size: 7px;
  color: var(--txt3);
}

.stem-fader input[type="range"] {
  width: 50px;
  height: 14px;
}

/* ── 24. Keyframe Animations ──────────────────────────── */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes rec-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

@keyframes rec-pulse {
  0%, 100% { box-shadow: none; }
  50%      { box-shadow: 0 0 12px rgba(239, 68, 68, 0.3); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; transform: scale(0.95); }
  50%      { opacity: 1;   transform: scale(1.05); }
}

/* Platter spin states */
.platter.spinning      { animation: spin 1.8s linear infinite; }
.platter.spinning.slow { animation-duration: 3s; }
.platter.spinning.fast { animation-duration: 1s; }

/* ── 25. Utility ───────────────────────────────────────── */
.flex-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.spacer {
  flex: 1;
}

/* ── 26. Responsive — Width ────────────────────────────── */

/* Wide (>1800px) */
@media (min-width: 1800px) {
  :root {
    --mixer-w: 260px;
    --knob-size: 48px;
    --fader-track-h: 140px;
  }
}

/* Small (<1200px) */
@media (max-width: 1200px) {
  :root {
    --mixer-w: 200px;
    --mixer-min-w: 160px;
    --knob-size: 36px;
  }

  .knob-readout { display: none; }

  .transport button {
    padding: 3px 8px;
    font-size: 9px;
    min-height: 26px;
    min-width: 36px;
  }

  .pitch-strip { width: 40px; }
  .hotcue { font-size: 10px; }
  .hotcues { gap: 2px; }
  .ch-fader-track { height: 90px; }
}

/* Narrow (<900px) — stack vertically */
@media (max-width: 900px) {
  #main {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto 1fr;
  }

  #mixer {
    flex-direction: row;
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: hidden;
  }

  .ch-strips      { flex-direction: row; flex: none; }
  .ch-fader-track { height: 60px; }
  .platter-wrap   { max-height: 200px; }
  .deck-wf .wf-container { height: 50px; }
}

/* ── 27. Responsive — Height ───────────────────────────── */

/* Tall (>1100px) */
@media (min-height: 1100px) {
  :root {
    --wf-height: 100px;
    --fader-track-h: 150px;
  }

  .hotcue { font-size: 14px; }
  .transport button { min-height: 34px; font-size: 12px; }
  .platter-row { padding: 8px; }
}

/* Short (<700px) */
@media (max-height: 700px) {
  :root {
    --wf-height: 50px;
    --knob-size: 32px;
    --fader-track-h: 70px;
    --deck-sampler-h: 24px;
  }

  #header { padding: 3px 12px; }
  #header h1 { font-size: 16px; }
  .wf-overview { height: 12px; }
  .hotcue { font-size: 9px; }
  .hotcues { gap: 2px; }
  .deck-controls-row { padding: 2px 6px; gap: 4px; }
  .transport button { min-height: 24px; padding: 2px 8px; font-size: 9px; }
  .perf-strip { padding: 2px 6px; }
  .loop-btn, .bj-btn { min-height: 22px; font-size: 8px; }
  .platter-row { padding: 2px; }
  .deck-fx { padding: 2px 4px; }
  #sampler-bar { padding: 2px 6px; }
  #sampler-section .sampler-pad { max-height: 28px; }
  .master-vu { height: 18px; }
}

/* Very short (<550px) — hide non-essential */
@media (max-height: 550px) {
  .deck-wf        { display: none; }
  .perf-strip     { display: none; }
  .deck-sampler   { display: none; }
  #sampler-section { display: none; }
  .knob-readout   { display: none; }
  .master-vu      { display: none; }
}


/* ── Pro upgrade: library / settings / header ── */
.hdr-btn {
  background: var(--raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 10px;
  font-family: 'SF Mono', ui-monospace, monospace;
  margin-left: 4px;
  cursor: pointer;
}
.hdr-btn.active, #quantize-toggle.active {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 6px rgba(34,211,238,.25);
}
#set-rec-btn.recording {
  border-color: var(--red);
  color: var(--red);
  animation: pulse-rec 1s infinite;
}
@keyframes pulse-rec {
  50% { box-shadow: 0 0 8px rgba(239,68,68,.5); }
}
.cue-vu {
  display: flex;
  gap: 3px;
  height: 28px;
  margin-top: 6px;
  justify-content: center;
}
.side-panel {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-height: 42vh;
  background: rgba(10,12,16,.96);
  border-top: 1px solid var(--border);
  z-index: 50;
  display: none;
  flex-direction: column;
  backdrop-filter: blur(8px);
}
.side-panel.open { display: flex; }
.side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  letter-spacing: .08em;
}
.side-panel-actions button, .settings-body button, .library-list button {
  background: var(--raised);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 3px;
  padding: 4px 8px;
  font-size: 10px;
  cursor: pointer;
  margin-left: 4px;
}
.library-toolbar {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
}
.library-toolbar input, .library-toolbar select, .settings-body select {
  background: var(--sunken);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 3px;
  padding: 4px 6px;
  font-size: 11px;
}
.library-toolbar input { flex: 1; }
.library-status { padding: 0 12px 6px; font-size: 10px; color: var(--muted); }
.library-list {
  overflow: auto;
  padding: 0 8px 12px;
  font-size: 11px;
}
.library-row {
  display: grid;
  grid-template-columns: 1fr 56px 64px 120px;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.library-row:hover { background: rgba(255,255,255,.04); }
.library-row.compatible { outline: 1px solid rgba(52,211,153,.45); }
.library-row .camelot {
  font-family: 'SF Mono', ui-monospace, monospace;
  color: var(--cyan);
}
.settings-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12px;
}
.settings-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wf-info .key {
  margin-left: 8px;
  color: var(--cyan);
  font-family: 'SF Mono', ui-monospace, monospace;
  font-size: 10px;
}
