/* ============ TOKENS ============ */
:root {
  --bg-0: oklch(0.11 0.02 270);
  --bg-1: oklch(0.15 0.025 270);
  --bg-2: oklch(0.19 0.03 270);
  --panel: oklch(0.22 0.035 270 / 0.55);
  --panel-strong: oklch(0.26 0.04 270 / 0.75);
  --stroke: oklch(1 0 0 / 0.08);
  --stroke-strong: oklch(1 0 0 / 0.14);
  --ink-0: oklch(0.98 0.005 270);
  --ink-1: oklch(0.82 0.015 270);
  --ink-2: oklch(0.62 0.02 270);
  --ink-3: oklch(0.45 0.025 270);

  --accent-cyan: oklch(0.82 0.14 200);
  --accent-violet: oklch(0.7 0.2 295);
  --accent-pink: oklch(0.74 0.2 350);
  --accent-green: oklch(0.82 0.18 150);
  --accent-amber: oklch(0.82 0.16 75);
  --accent-red: oklch(0.7 0.22 25);

  --deck-a: oklch(0.78 0.16 215);
  --deck-b: oklch(0.74 0.2 340);

  --grad-main: linear-gradient(90deg, var(--accent-cyan), var(--accent-violet), var(--accent-pink));
  --grad-a: linear-gradient(135deg, oklch(0.78 0.16 215), oklch(0.66 0.2 270));
  --grad-b: linear-gradient(135deg, oklch(0.72 0.2 320), oklch(0.74 0.2 350));

  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;
  --radius-xl: 22px;

  --font-ui: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --shadow-glass: 0 8px 32px 0 rgb(0 0 0 / 0.45), inset 0 1px 0 oklch(1 0 0 / 0.06);
  --shadow-raised: 0 2px 0 oklch(0 0 0 / 0.3), 0 10px 28px oklch(0 0 0 / 0.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-ui);
  background:
    radial-gradient(1200px 800px at 15% -10%, oklch(0.3 0.12 280 / 0.35), transparent 60%),
    radial-gradient(1000px 700px at 90% 110%, oklch(0.32 0.14 340 / 0.3), transparent 60%),
    radial-gradient(800px 600px at 50% 50%, oklch(0.22 0.06 220 / 0.2), transparent 70%),
    var(--bg-0);
  color: var(--ink-0);
  min-height: 100vh;
  overflow: hidden;
  letter-spacing: -0.005em;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
}

button, input, select { font-family: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; padding: 0; }

/* ============ APP SHELL ============ */
.app {
  display: grid;
  grid-template-rows: 56px 1fr;
  grid-template-columns: 1fr 320px;
  grid-template-areas:
    "top top"
    "main queue";
  height: 100vh;
  gap: 10px;
  padding: 10px;
}

/* ============ TOP BAR ============ */
.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: var(--panel);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-glass);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
}
.logo-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--grad-main);
  position: relative;
  box-shadow: 0 0 24px oklch(0.7 0.2 310 / 0.5);
}
.logo-mark::after {
  content: ''; position: absolute; inset: 6px; border-radius: 4px;
  background: var(--bg-0);
}
.logo-mark::before {
  content: ''; position: absolute; inset: 10px; border-radius: 50%;
  background: var(--grad-main);
}
.logo b { background: var(--grad-main); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }

.top-url {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: oklch(0 0 0 / 0.35);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 0 12px;
  height: 36px;
  max-width: 680px;
  transition: border-color .2s, box-shadow .2s;
}
.top-url:focus-within {
  border-color: oklch(0.7 0.2 295 / 0.6);
  box-shadow: 0 0 0 3px oklch(0.7 0.2 295 / 0.15);
}
.top-url input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--ink-0);
}
.top-url input::placeholder { color: var(--ink-3); }
.top-url-btn {
  padding: 6px 12px;
  border-radius: 7px;
  border: none;
  background: var(--grad-main);
  color: oklch(0.12 0.02 270);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}
.top-url-btn + .top-url-btn { margin-left: 6px; }
.top-url-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.top-actions { display: flex; gap: 8px; align-items: center; flex: 0 0 auto; margin-right: auto; }
.top-action-btn {
  padding: 7px 14px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  background: oklch(0.22 0.02 290);
  border: 1px solid var(--stroke);
  color: var(--ink-1);
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s, border-color .15s, transform .1s;
}
.top-action-btn:hover:not(:disabled) { background: oklch(0.28 0.03 290); border-color: oklch(0.5 0.05 290); }
.top-action-btn:active:not(:disabled) { transform: translateY(1px); }
.top-action-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.top-action-btn.demos {
  background: linear-gradient(135deg, oklch(0.55 0.15 290), oklch(0.6 0.18 330));
  color: white; border-color: transparent;
}

.top-right { display: flex; gap: 8px; align-items: center; }

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 9px;
  color: var(--ink-1);
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--stroke); color: var(--ink-0); border-color: var(--stroke-strong); }
.icon-btn.on { background: oklch(0.7 0.2 295 / 0.2); color: oklch(0.85 0.15 295); border-color: oklch(0.7 0.2 295 / 0.4); }

.rec-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 0 10px; height: 36px;
  border-radius: 9px; border: 1px solid var(--stroke);
  font-size: 12px; font-weight: 600; color: var(--ink-1);
}
.rec-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-red); box-shadow: 0 0 10px var(--accent-red); }
.rec-btn.recording { color: var(--accent-red); border-color: oklch(0.7 0.22 25 / 0.4); }
.rec-btn.recording .dot { animation: pulse 1s ease-in-out infinite; }

@keyframes pulse { 50% { opacity: 0.3; } }

/* ============ MAIN ============ */
.main {
  grid-area: main;
  display: grid;
  grid-template-columns: 1fr 300px 1fr;
  gap: 10px;
  min-height: 0;
}

/* ============ PANELS ============ */
.panel {
  background: var(--panel);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-glass);
  position: relative;
  overflow: hidden;
}
.panel::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, oklch(1 0 0 / 0.03), transparent 30%);
  pointer-events: none;
}

/* ============ DECK ============ */
.deck {
  display: flex; flex-direction: column;
  padding: 14px;
  gap: 12px;
  min-height: 0;
  position: relative;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--stroke) transparent;
}
.deck::-webkit-scrollbar { width: 6px; }
.deck::-webkit-scrollbar-thumb { background: var(--stroke); border-radius: 3px; }
.deck::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 3px;
  background: var(--deck-a);
  opacity: 0.6;
  border-radius: 3px;
}
.deck.a::after { left: 0; background: linear-gradient(180deg, var(--accent-cyan), var(--accent-violet)); }
.deck.b::after { right: 0; background: linear-gradient(180deg, var(--accent-violet), var(--accent-pink)); }

.deck-head {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 2px;
  flex-wrap: wrap;
}
.deck-label {
  width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 8px;
  font-weight: 800; font-size: 13px;
  color: var(--bg-0);
}
.deck.a .deck-label { background: var(--grad-a); }
.deck.b .deck-label { background: var(--grad-b); }

.deck-track { flex: 1; min-width: 0; }
.deck-title {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--ink-0);
}
.deck-artist {
  font-size: 11px; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.deck-empty-title { color: var(--ink-3); font-style: italic; font-size: 12px; }

.deck-meta {
  display: flex; gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  flex-shrink: 1;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}
.pill {
  padding: 3px 7px;
  border-radius: 5px;
  background: oklch(0 0 0 / 0.35);
  border: 1px solid var(--stroke);
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--ink-1);
  text-transform: uppercase;
}
.pill.bpm { color: var(--accent-cyan); }
.pill.bpm.shifted {
  background: oklch(0.82 0.18 150 / 0.14);
  border-color: oklch(0.82 0.18 150 / 0.45);
  color: var(--accent-green);
  /* Subtle pulse so the user knows the tempo is being actively held to master */
  animation: bpm-shift-pulse 2.4s ease-in-out infinite;
}
@keyframes bpm-shift-pulse {
  0%, 100% { box-shadow: inset 0 0 0 1px oklch(0.82 0.18 150 / 0.0); }
  50%      { box-shadow: inset 0 0 0 1px oklch(0.82 0.18 150 / 0.5); }
}
.bpm-was {
  display: inline-block;
  margin-left: 6px;
  padding-left: 6px;
  border-left: 1px solid oklch(0.82 0.18 150 / 0.3);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  opacity: 0.85;
  vertical-align: 1px;
}
.pill.key { color: var(--accent-violet); }
.pill.match {
  background: oklch(0.82 0.18 150 / 0.12);
  border-color: oklch(0.82 0.18 150 / 0.4);
  color: var(--accent-green);
}

.waveform-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ----- Rekordbox-style phase (zoomed, scrolling) waveform ----- */
.waveform-phase {
  position: relative;
  height: 120px;
  border-radius: var(--radius-m);
  background: oklch(0 0 0 / 0.75);
  border: 1px solid var(--stroke);
  overflow: hidden;
  cursor: ew-resize;
  user-select: none;
}
.waveform-phase-svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.waveform-phase-playhead {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: #ffffff;
  box-shadow: 0 0 14px oklch(1 0 0 / 0.8), 0 0 28px oklch(1 0 0 / 0.4);
  pointer-events: none;
  z-index: 4;
}
.waveform-phase-playhead::before,
.waveform-phase-playhead::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
}
.waveform-phase-playhead::before {
  top: -1px;
  border-top: 7px solid #ffffff;
}
.waveform-phase-playhead::after {
  bottom: -1px;
  border-bottom: 7px solid #ffffff;
}
.waveform-bpm-badge {
  position: absolute;
  top: 6px; left: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: oklch(0.94 0.15 90);
  background: oklch(0 0 0 / 0.55);
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 4;
  border: 1px solid oklch(0.94 0.15 90 / 0.35);
}

/* Overview (existing .waveform-wrap) is shorter since phase view does the detail */
/* Waveform */
.waveform-wrap {
  position: relative;
  height: 52px;
  border-radius: var(--radius-m);
  background: oklch(0 0 0 / 0.55);
  border: 1px solid var(--stroke);
  overflow: hidden;
  cursor: ew-resize;
  user-select: none;
}
.waveform-bg {
  position: absolute; inset: 0;
  background: var(--grad-main);
  opacity: 0.28;
}
.waveform-svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.waveform-empty {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); letter-spacing: 0.1em;
  text-transform: uppercase;
}
.waveform-playhead {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: oklch(1 0 0 / 0.95);
  box-shadow: 0 0 12px oklch(1 0 0 / 0.8);
  pointer-events: none;
  z-index: 3;
}
.waveform-overlay {
  position: absolute; top: 0; bottom: 0; left: 0;
  background: oklch(1 0 0 / 0.06);
  border-right: 1px solid oklch(1 0 0 / 0.15);
  pointer-events: none;
  z-index: 2;
}
.waveform-cue {
  position: absolute; top: 4px; bottom: 4px; width: 2px;
  background: var(--accent-amber);
  box-shadow: 0 0 8px var(--accent-amber);
  z-index: 2;
}
.waveform-loop {
  position: absolute; top: 0; bottom: 0;
  background: oklch(0.82 0.18 150 / 0.15);
  border-left: 1.5px dashed var(--accent-green);
  border-right: 1.5px dashed var(--accent-green);
  z-index: 2;
  pointer-events: none;
}
.waveform-time {
  position: absolute; top: 6px; right: 8px;
  font-family: var(--font-mono); font-size: 10px;
  color: var(--ink-0); opacity: 0.8;
  z-index: 4;
  background: oklch(0 0 0 / 0.4);
  padding: 2px 5px; border-radius: 4px;
}

/* Sync info strip (shown when SYNC active) */
.sync-strip {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: oklch(0.18 0.04 280 / 0.5);
  border: 1px solid oklch(0.5 0.15 290 / 0.35);
}
.sync-strip.clash {
  background: oklch(0.2 0.08 25 / 0.4);
  border-color: oklch(0.7 0.22 25 / 0.5);
  animation: syncClashPulse 1.4s ease-in-out infinite;
}
@keyframes syncClashPulse {
  0%, 100% { border-color: oklch(0.7 0.22 25 / 0.5); }
  50% { border-color: oklch(0.8 0.28 25 / 0.9); box-shadow: 0 0 10px oklch(0.7 0.22 25 / 0.4); }
}
.sync-strip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  background: oklch(0 0 0 / 0.4);
  border: 1px solid oklch(1 0 0 / 0.1);
  color: var(--ink-1);
}
.sync-chip.rate { color: var(--accent-cyan); border-color: oklch(0.8 0.15 200 / 0.4); }
.sync-chip.pitch.warn {
  color: oklch(0.85 0.2 60);
  border-color: oklch(0.8 0.2 60 / 0.5);
  background: oklch(0.85 0.2 60 / 0.08);
}
.sync-chip.keylock-btn { cursor: pointer; transition: all 0.15s; }
.sync-chip.keylock-btn:hover { background: oklch(0 0 0 / 0.6); border-color: oklch(1 0 0 / 0.25); }
.sync-chip.keylock-btn.on {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  background: oklch(0.8 0.15 200 / 0.15);
  box-shadow: 0 0 8px oklch(0.8 0.15 200 / 0.3);
}
.sync-chip.clash-warn {
  color: oklch(0.85 0.22 25);
  border-color: oklch(0.8 0.22 25 / 0.6);
  background: oklch(0.85 0.22 25 / 0.12);
  font-weight: 600;
}
.sync-chip.harmonic { color: var(--accent-green); border-color: oklch(0.82 0.18 150 / 0.4); }
.sync-chip.match {
  color: var(--accent-green);
  border-color: oklch(0.82 0.18 150 / 0.5);
  background: oklch(0.82 0.18 150 / 0.12);
}

/* Transport — consolidated row: PLAY · CUE · ±1 BAR · MATCH · MASTER · ⚙ */
.transport {
  display: grid;
  /* PLAY | CUE | MATCH | MASTER | Fix beats */
  grid-template-columns: 1.15fr 0.65fr 1.4fr 0.95fr 1.4fr;
  gap: 4px;
}
.t-btn { min-width: 0; overflow: hidden; }
.t-btn {
  height: 42px;
  border-radius: 9px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--stroke);
  background: oklch(0 0 0 / 0.3);
  color: var(--ink-1);
  display: flex; align-items: center; justify-content: center; gap: 3px;
  transition: all .15s;
  padding: 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.t-btn:hover:not(:disabled) { background: oklch(0 0 0 / 0.5); color: var(--ink-0); border-color: var(--stroke-strong); }
.t-btn:disabled { opacity: 0.4; cursor: default; }

/* PRIMARY: Play — the only filled, loud button. Everything else is quiet. */
.t-btn.play {
  grid-column: span 1;
  background: var(--grad-main);
  color: oklch(0.12 0.02 270);
  border-color: transparent;
  font-size: 13px;
}
.t-btn.play.playing {
  background: oklch(0.82 0.18 150);
  box-shadow: 0 0 24px oklch(0.82 0.18 150 / 0.5);
}

/* SECONDARY buttons — all share the same neutral resting style.
   Each one's "active" or "engaged" state is a SUBTLE color tint, not a full fill. */
.t-btn.cue,
.t-btn.sync,
.t-btn.master-btn {
  background: oklch(0 0 0 / 0.3);
  border: 1px solid var(--stroke);
  color: var(--ink-2);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  padding: 0 6px;
}
/* CUE — amber-tinted icon, but button itself stays neutral until pressed */
.t-btn.cue { color: oklch(0.78 0.08 75); }
.t-btn.cue:hover:not(:disabled) {
  border-color: oklch(0.7 0.14 75 / 0.5);
  color: var(--accent-amber);
}
.t-btn.cue.active {
  background: oklch(0.5 0.16 75 / 0.18);
  border-color: oklch(0.7 0.14 75 / 0.5);
  color: oklch(0.92 0.14 75);
}
/* MATCH — neutral until synced; then quiet green */
.t-btn.sync { color: var(--ink-2); }
.t-btn.sync:hover:not(:disabled) {
  border-color: oklch(0.7 0.14 150 / 0.45);
  color: oklch(0.86 0.14 150);
}
.t-btn.sync.active {
  background: oklch(0.5 0.16 150 / 0.15);
  border-color: oklch(0.7 0.16 150 / 0.5);
  color: oklch(0.9 0.16 150);
}
/* MASTER — neutral until master; then quiet amber */
.t-btn.master-btn { color: var(--ink-2); }
.t-btn.master-btn:hover:not(:disabled) {
  border-color: oklch(0.7 0.14 75 / 0.4);
  color: var(--ink-1);
}
.t-btn.master-btn.active {
  background: oklch(0.5 0.16 75 / 0.12);
  border-color: oklch(0.7 0.14 75 / 0.4);
  color: oklch(0.86 0.14 75);
}
.t-btn.master-btn.pinned {
  background: oklch(0.5 0.16 75 / 0.22);
  border-color: oklch(0.75 0.16 75 / 0.6);
  color: oklch(0.92 0.16 75);
}
.t-btn.load { color: var(--ink-1); }

/* Jump-pair inside transport row — two stacked buttons that share one grid cell */
.t-jump-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.t-jump {
  height: 42px;
  border-radius: 9px;
  border: 1px solid var(--stroke);
  background: oklch(0 0 0 / 0.3);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: all .12s;
  padding: 0 2px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}
.t-jump:hover:not(:disabled) {
  background: oklch(0.78 0.16 200 / 0.15);
  border-color: oklch(0.78 0.16 200 / 0.5);
  color: var(--accent-cyan);
}
.t-jump:active:not(:disabled) { transform: scale(0.95); background: oklch(0.78 0.16 200 / 0.3); }
.t-jump:disabled { opacity: 0.35; cursor: default; }

/* Secondary skip row — beat-aligned ±1/±4 bar nudges */
.transport-skip {
  display: grid;
  grid-template-columns: auto 1fr 1fr 1fr 1fr;
  gap: 4px;
  align-items: center;
  margin-top: 6px;
  padding: 4px 4px;
  background: oklch(0 0 0 / 0.2);
  border: 1px solid var(--stroke);
  border-radius: 8px;
}
.ts-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 8px 0 4px;
}
.ts-btn {
  height: 26px;
  border-radius: 5px;
  background: oklch(0 0 0 / 0.4);
  border: 1px solid var(--stroke);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.12s;
  display: flex; align-items: center; justify-content: center;
  white-space: nowrap;
}
.ts-btn:hover:not(:disabled) {
  background: oklch(0.78 0.16 200 / 0.18);
  border-color: oklch(0.78 0.16 200 / 0.5);
  color: oklch(0.92 0.14 200);
}
.ts-btn:active:not(:disabled) {
  transform: scale(0.96);
  background: oklch(0.78 0.16 200 / 0.32);
}
.ts-btn:disabled { opacity: 0.3; cursor: default; }

/* Advanced ⚙ toggle — small, low-key */
.t-btn.t-adv {
  font-size: 16px;
  letter-spacing: 0;
  color: var(--ink-3);
  padding: 0;
}
.t-btn.t-adv:hover { color: var(--ink-1); }
.t-btn.t-adv.on {
  background: oklch(0.78 0.18 295 / 0.18);
  border-color: oklch(0.78 0.18 295 / 0.5);
  color: oklch(0.86 0.16 295);
}

/* ---- New simplified sync-bar (replaces .sync-strip for default view) ---- */
.sync-bar {
  margin-top: 8px;
  padding: 8px 12px;
  background: oklch(0 0 0 / 0.35);
  border-radius: 9px;
  border: 1px solid var(--stroke);
  font-family: var(--font-mono);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sync-bar.on { border-color: oklch(0.82 0.18 150 / 0.4); }
.sync-bar.clash { border-color: oklch(0.82 0.22 25 / 0.5); }
.sync-bar-main {
  display: flex; align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-height: 18px;
}
.sync-state {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.sync-state.idle { color: var(--ink-3); font-weight: 500; }
.sync-state.lock-tight { color: oklch(0.86 0.18 150); }
.sync-state.lock-near { color: oklch(0.86 0.16 90); }
.sync-state.lock-drift { color: oklch(0.85 0.22 25); }
.sync-led {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.sync-state.lock-tight .sync-led { animation: syncLed 1.2s ease-in-out infinite; }
@keyframes syncLed { 50% { opacity: 0.45; transform: scale(0.85); } }
.sync-state.lock-drift .sync-led { animation: syncLedDrift 0.6s ease-in-out infinite; }
@keyframes syncLedDrift { 50% { opacity: 0.3; } }
.sync-key {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 5px;
  letter-spacing: 0.02em;
}
.sync-key.good {
  color: oklch(0.86 0.18 150);
  background: oklch(0.82 0.18 150 / 0.12);
  border: 1px solid oklch(0.82 0.18 150 / 0.35);
}
.sync-key.bad {
  color: oklch(0.85 0.22 25);
  background: oklch(0.82 0.22 25 / 0.15);
  border: 1px solid oklch(0.82 0.22 25 / 0.45);
}
.sync-bar-detail {
  display: flex; align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px solid var(--stroke);
  font-size: 10px;
}

/* ---- Advanced tray (grid nudge + deep jumps) ---- */
.adv-tray {
  margin-top: 8px;
  padding: 10px 12px;
  background: oklch(0.18 0.04 295 / 0.4);
  border: 1px solid oklch(0.78 0.18 295 / 0.3);
  border-radius: 9px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: advTraySlide 0.18s ease-out;
}
@keyframes advTraySlide { from { opacity: 0; transform: translateY(-4px); } }
.adv-row {
  display: flex; align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.adv-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  font-weight: 700;
  color: oklch(0.86 0.16 295);
  text-transform: uppercase;
  width: 78px;
  flex-shrink: 0;
}
.adv-btn {
  flex: 0 0 auto;
  min-width: 36px;
  padding: 5px 10px;
  background: oklch(0 0 0 / 0.4);
  border: 1px solid var(--stroke);
  color: var(--ink-1);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  font-weight: 600;
  transition: all .12s;
}
.adv-btn:hover:not(:disabled) {
  background: oklch(0.78 0.18 295 / 0.18);
  border-color: oklch(0.78 0.18 295 / 0.55);
  color: oklch(0.92 0.14 295);
}
.adv-btn.primary {
  background: oklch(0.82 0.16 75 / 0.18);
  border-color: oklch(0.82 0.16 75 / 0.5);
  color: oklch(0.92 0.14 75);
  margin-left: auto;
}
.adv-btn.primary:hover { background: oklch(0.82 0.16 75 / 0.32); }
.adv-btn.primary.tapping {
  background: oklch(0.85 0.2 75 / 0.5);
  border-color: oklch(0.88 0.22 75);
  box-shadow: 0 0 12px oklch(0.85 0.2 75 / 0.5);
  animation: tapFlash .15s;
}
@keyframes tapFlash {
  from { transform: scale(1.06); }
  to   { transform: scale(1); }
}
.adv-val {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-1);
  min-width: 50px;
  text-align: center;
  font-weight: 600;
}
.adv-warn {
  font-size: 10px;
  color: oklch(0.86 0.16 75);
  margin-left: 6px;
}

/* ---- Empty-deck LOAD button (replaces "load a track" placeholder) ---- */
.deck-empty-load {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  background: oklch(0 0 0 / 0.4);
  border: 1px dashed oklch(0.78 0.16 200 / 0.45);
  color: var(--accent-cyan);
  padding: 6px 12px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.deck-empty-load:hover {
  background: oklch(0.78 0.16 200 / 0.12);
  border-color: oklch(0.78 0.16 200 / 0.7);
  border-style: solid;
  box-shadow: 0 0 18px oklch(0.78 0.16 200 / 0.25);
}

/* ---- Deck-targeted drop overlay (audio files OR queue drags) ---- */
.panel.deck { position: relative; }
.deck-drop-overlay {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s;
  z-index: 50;
  background: oklch(0 0 0 / 0.55);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
}
.panel.deck.drop-active .deck-drop-overlay {
  opacity: 1;
}
.deck-drop-overlay-inner {
  border: 2px dashed var(--accent-cyan);
  border-radius: 16px;
  padding: 24px 36px;
  text-align: center;
  background: oklch(0.78 0.16 200 / 0.08);
  box-shadow: 0 0 40px oklch(0.78 0.16 200 / 0.4), inset 0 0 30px oklch(0.78 0.16 200 / 0.15);
  animation: drop-pulse 0.9s ease-in-out infinite;
}
@keyframes drop-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}
.deck-drop-icon {
  font-size: 36px;
  color: var(--accent-cyan);
  text-shadow: 0 0 16px oklch(0.78 0.16 200 / 0.7);
  line-height: 1;
}
.deck-drop-text {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.15em;
  color: var(--accent-cyan);
  font-weight: 800;
}

/* Subtle hint border on empty decks so the drop affordance reads even
   without an active drag */
.panel.deck.is-empty {
  border-color: oklch(0.78 0.16 200 / 0.25);
  background-image: linear-gradient(135deg, oklch(0.78 0.16 200 / 0.04), transparent 60%);
}

/* ============================================================
   DECK EMPTY PORTAL — "Mix the internet"
   The deck's empty state is the most-seen surface (every session
   begins here), so it's not a placeholder — it's the front door
   to the open music web. Source picker + paste-anywhere URL +
   ready-track suggestions, all in one card.
   ============================================================ */
.deck-portal {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 360px;
  padding: 36px 18px 18px;
  background:
    radial-gradient(120% 80% at 50% 0%, oklch(0.78 0.16 200 / 0.07), transparent 60%),
    oklch(0 0 0 / 0.35);
  border: 1px solid oklch(0.78 0.16 200 / 0.22);
  border-radius: 12px;
  color: var(--ink-2);
}
.deck-portal-b {
  background:
    radial-gradient(120% 80% at 50% 0%, oklch(0.74 0.2 340 / 0.07), transparent 60%),
    oklch(0 0 0 / 0.35);
  border-color: oklch(0.74 0.2 340 / 0.22);
}

/* Deck letter badge in the top-left corner */
.deck-portal-letter {
  position: absolute;
  top: 12px;
  left: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: oklch(0.78 0.16 200 / 0.14);
  color: var(--accent-cyan);
  border: 1px solid oklch(0.78 0.16 200 / 0.45);
}
.deck-portal-b .deck-portal-letter {
  background: oklch(0.74 0.2 340 / 0.14);
  color: var(--accent-pink);
  border-color: oklch(0.74 0.2 340 / 0.45);
}

.deck-portal-headline {
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-1);
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-top: 4px;
}
.deck-portal-tagline {
  text-align: center;
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 4px;
}

/* Unified URL field */
.deck-portal-url {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 12px;
  background: oklch(0 0 0 / 0.5);
  border: 1px solid var(--stroke-strong);
  border-radius: 9px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.deck-portal-url:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px oklch(0.78 0.16 200 / 0.18);
}
.deck-portal-url.youtube { border-color: oklch(0.62 0.24 25 / 0.6); box-shadow: 0 0 0 2px oklch(0.62 0.24 25 / 0.18); }
.deck-portal-url.soundcloud { border-color: oklch(0.74 0.2 50 / 0.6); box-shadow: 0 0 0 2px oklch(0.74 0.2 50 / 0.18); }
.deck-portal-url.spotify { border-color: oklch(0.72 0.2 145 / 0.6); box-shadow: 0 0 0 2px oklch(0.72 0.2 145 / 0.18); }
.dpu-icon {
  display: inline-flex;
  align-items: center;
  color: var(--ink-3);
  flex-shrink: 0;
  transition: color 0.15s;
}
.deck-portal-url.youtube .dpu-icon { color: #FF0033; }
.deck-portal-url.soundcloud .dpu-icon { color: #FF7700; }
.deck-portal-url.spotify .dpu-icon { color: #1DB954; }
.deck-portal-url input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 12px;
  color: var(--ink-1);
  min-width: 0;
}
.deck-portal-url input::placeholder { color: var(--ink-3); }
.dpu-go {
  flex-shrink: 0;
  padding: 6px 12px;
  background: oklch(0.78 0.16 200 / 0.18);
  border: 1px solid oklch(0.78 0.16 200 / 0.45);
  border-radius: 6px;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.12s;
}
.deck-portal-b .dpu-go {
  background: oklch(0.74 0.2 340 / 0.18);
  border-color: oklch(0.74 0.2 340 / 0.45);
  color: var(--accent-pink);
}
.dpu-go:hover:not(:disabled) {
  background: oklch(0.78 0.16 200 / 0.32);
  filter: brightness(1.1);
}
.deck-portal-b .dpu-go:hover:not(:disabled) {
  background: oklch(0.74 0.2 340 / 0.32);
}
.dpu-go:disabled { opacity: 0.4; cursor: not-allowed; }

/* Source rows */
.deck-portal-sources {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}
.source-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: oklch(0 0 0 / 0.25);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  font-family: inherit;
  text-align: left;
  color: var(--ink-2);
  transition: all 0.14s;
  position: relative;
  /* Subtle source-color accent on the left edge */
  border-left: 3px solid var(--source-color, var(--stroke));
}
.source-row.clickable {
  cursor: pointer;
}
.source-row.clickable:hover {
  background: oklch(0 0 0 / 0.45);
  border-color: var(--source-color, var(--stroke-strong));
  transform: translateX(2px);
}
.sr-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
}
.sr-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-1);
  letter-spacing: 0.01em;
  flex-shrink: 0;
}
.sr-note {
  font-size: 10px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.sr-arrow {
  font-size: 14px;
  color: var(--ink-3);
  flex-shrink: 0;
  transition: transform 0.14s, color 0.14s;
  opacity: 0.5;
}
.source-row.clickable:hover .sr-arrow {
  color: var(--source-color);
  opacity: 1;
  transform: translateX(3px);
}

/* Bottom suggest strip */
.deck-portal-suggest {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px dashed var(--stroke);
}
.dps-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
  text-align: center;
}
.dps-tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.dps-tile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  background: oklch(0 0 0 / 0.4);
  border: 1px solid var(--stroke);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  color: var(--ink-1);
  transition: all 0.12s;
  min-width: 0;
}
.dps-tile:hover {
  border-color: oklch(0.78 0.16 200 / 0.55);
  background: oklch(0.78 0.16 200 / 0.08);
}
.deck-portal-b .dps-tile:hover {
  border-color: oklch(0.74 0.2 340 / 0.55);
  background: oklch(0.74 0.2 340 / 0.08);
}
.dps-tile img,
.dps-tile-placeholder {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}
.dps-tile-placeholder {
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-pink));
  opacity: 0.5;
}
.dps-tile-meta {
  flex: 1;
  min-width: 0;
}
.dps-tile-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dps-tile-bpm {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.dps-demos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 9px;
  background: linear-gradient(135deg, oklch(0.55 0.15 290 / 0.4), oklch(0.6 0.18 330 / 0.4));
  border: 1px solid oklch(0.6 0.18 320 / 0.4);
  border-radius: 7px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-1);
  cursor: pointer;
  transition: all 0.12s;
}
.dps-demos:hover:not(:disabled) {
  background: linear-gradient(135deg, oklch(0.6 0.17 290 / 0.55), oklch(0.65 0.2 330 / 0.55));
  border-color: oklch(0.7 0.2 320 / 0.6);
}
.dps-demos:disabled { opacity: 0.5; cursor: not-allowed; }

/* Manual grid nudge strip — sits below the waveform when a track is loaded */
.grid-nudge {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 4px 8px;
  background: oklch(0 0 0 / 0.35);
  border: 1px solid var(--stroke);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
}
.gn-label {
  color: var(--ink-2);
  font-weight: 700;
  letter-spacing: 0.12em;
}
.gn-btn {
  background: oklch(0 0 0 / 0.4);
  border: 1px solid var(--stroke);
  color: var(--ink-1);
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  line-height: 1;
  transition: all .12s;
}
.gn-btn:hover { background: oklch(0 0 0 / 0.6); color: var(--accent-cyan); border-color: oklch(0.78 0.16 200 / 0.5); }
.gn-val {
  min-width: 50px;
  text-align: center;
  color: var(--accent-cyan);
  font-weight: 600;
}
.gn-set {
  margin-left: auto;
  background: transparent;
  border: 1px solid oklch(0.82 0.16 75 / 0.4);
  color: var(--accent-amber);
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 9px;
  letter-spacing: 0.1em;
  font-weight: 700;
  transition: all .12s;
}
.gn-set:hover { background: oklch(0.82 0.16 75 / 0.18); }
.gn-warn {
  color: var(--accent-amber);
  margin-left: 4px;
}
/* EQ + Filter row */
.knob-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 6px 0;
}

.knob-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.knob {
  width: 56px; height: 56px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, oklch(0.3 0.03 270), oklch(0.14 0.02 270) 70%);
  border: 1px solid var(--stroke-strong);
  position: relative;
  cursor: ns-resize;
  box-shadow:
    inset 0 2px 4px oklch(1 0 0 / 0.06),
    inset 0 -2px 4px oklch(0 0 0 / 0.5),
    0 2px 8px oklch(0 0 0 / 0.4);
  touch-action: none;
}
.knob-arc {
  position: absolute; inset: -4px;
  pointer-events: none;
}
.knob-indicator {
  /* Indicator pivots at the knob's center. The knob is `size` px tall;
     this line is positioned from the top and rotates around its base
     which must sit on the geometric center (size/2). We center it via
     percentage geometry so any knob size renders symmetrically. */
  position: absolute;
  top: 4px;
  left: 50%;
  width: 2px;
  height: calc(50% - 6px);
  background: var(--ink-0);
  transform-origin: 50% 100%;
  border-radius: 2px;
  box-shadow: 0 0 6px oklch(1 0 0 / 0.6);
}
.knob.active .knob-indicator { background: var(--accent-cyan); box-shadow: 0 0 10px var(--accent-cyan); }

.knob-label {
  font-family: var(--font-mono); font-size: 9px;
  letter-spacing: 0.15em; color: var(--ink-2);
  text-transform: uppercase; font-weight: 700;
}
.knob-value {
  font-family: var(--font-mono); font-size: 9px;
  color: var(--ink-3);
  min-height: 12px;
}
.knob.filter {
  background: radial-gradient(circle at 30% 30%, oklch(0.35 0.06 295), oklch(0.18 0.04 295) 70%);
}

/* Section headers */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2px;
  margin-top: 2px;
}
.section-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  font-weight: 600;
  color: var(--ink-2);
  text-transform: uppercase;
  display: flex; align-items: center; gap: 8px;
}
.section-title::before {
  content: ''; width: 4px; height: 4px; border-radius: 50%;
  background: var(--ink-3);
}
.collapse-btn {
  font-size: 10px; color: var(--ink-3);
  display: flex; align-items: center; gap: 4px;
  padding: 4px 7px; border-radius: 5px;
  transition: background .15s, color .15s;
}
.collapse-btn:hover { background: var(--stroke); color: var(--ink-1); }

/* FX rack */
.fx-rack {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.fx-btn {
  padding: 8px 4px;
  border-radius: 8px;
  background: oklch(0 0 0 / 0.35);
  border: 1px solid var(--stroke);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-2);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: all .15s;
  position: relative;
  overflow: hidden;
}
.fx-btn:hover { color: var(--ink-0); border-color: var(--stroke-strong); }
.fx-btn.active {
  background: linear-gradient(135deg, oklch(0.7 0.2 295 / 0.25), oklch(0.74 0.2 350 / 0.2));
  border-color: oklch(0.7 0.2 295 / 0.6);
  color: oklch(0.95 0.08 310);
  box-shadow: 0 0 16px oklch(0.7 0.2 295 / 0.3);
}
.fx-icon {
  width: 18px; height: 18px;
}
.fx-amount {
  position: absolute; bottom: 0; left: 0;
  height: 2px;
  background: var(--grad-main);
  transition: width .15s;
}

/* Loops */
.loop-rack {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.loop-btn {
  height: 32px;
  border-radius: 6px;
  background: oklch(0 0 0 / 0.35);
  border: 1px solid var(--stroke);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
  transition: all .15s;
}
.loop-btn:hover { color: var(--ink-0); border-color: var(--stroke-strong); }
.loop-btn.active {
  background: oklch(0.82 0.18 150 / 0.18);
  border-color: oklch(0.82 0.18 150 / 0.5);
  color: var(--accent-green);
  box-shadow: 0 0 12px oklch(0.82 0.18 150 / 0.25);
}

/* ============ MIXER ============ */
.mixer {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
.mixer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 4px;
}
.mixer-title {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 700;
}
.match-indicator {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 10px;
  padding: 4px 8px; border-radius: 6px;
  background: oklch(0 0 0 / 0.35);
  border: 1px solid var(--stroke);
  color: var(--ink-2);
}
.match-indicator.ok {
  background: oklch(0.82 0.18 150 / 0.12);
  border-color: oklch(0.82 0.18 150 / 0.4);
  color: var(--accent-green);
}
.match-indicator .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

/* VU meters + faders */
.fader-row {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-height: 0;
  padding: 8px 4px;
}
.fader-row.compact {
  flex: 0 0 auto;
  height: 220px;
  padding: 4px 4px 0;
}
.fader-col {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  min-height: 0;
}
.fader-channel-label {
  font-family: var(--font-mono); font-size: 10px;
  font-weight: 700; color: var(--ink-2);
  letter-spacing: 0.1em;
}
.fader-stack {
  display: flex; gap: 8px; flex: 1; min-height: 0; align-items: stretch;
}

.vu-meter {
  width: 8px;
  background: oklch(0 0 0 / 0.55);
  border-radius: 3px;
  border: 1px solid var(--stroke);
  overflow: hidden;
  position: relative;
}
.vu-fill {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(0deg,
    var(--accent-green) 0%,
    var(--accent-green) 60%,
    var(--accent-amber) 75%,
    var(--accent-amber) 88%,
    var(--accent-red) 95%);
  transition: height .08s linear;
  border-radius: 2px 2px 0 0;
}
.vu-fill::after {
  content: '';
  position: absolute; top: -1px; left: 0; right: 0;
  height: 2px;
  background: oklch(1 0 0 / 0.8);
  box-shadow: 0 0 4px oklch(1 0 0 / 0.7);
}

.fader {
  width: 22px;
  flex: 1;
  min-height: 60px;
  background: linear-gradient(180deg, oklch(0.16 0.02 270), oklch(0.12 0.02 270));
  border-radius: 6px;
  border: 1px solid var(--stroke-strong);
  position: relative;
  cursor: ns-resize;
  box-shadow:
    inset 0 2px 6px oklch(0 0 0 / 0.7),
    inset 0 -1px 0 oklch(1 0 0 / 0.04);
  touch-action: none;
  overflow: hidden;
}
.fader-track {
  position: absolute; left: 50%; top: 10px; bottom: 10px;
  width: 2px;
  background: oklch(1 0 0 / 0.08);
  transform: translateX(-50%);
  border-radius: 2px;
}
/* Colored fill rises from the bottom up to the handle position — like a real fader's level indicator */
.fader-fill {
  position: absolute;
  left: 0; right: 0;
  bottom: 0;
  background: var(--grad-main);
  opacity: 0.85;
  pointer-events: none;
  box-shadow: 0 0 12px var(--fill-glow, oklch(0.7 0.2 295 / 0.5));
  transition: height 0.05s linear;
}
.fader-a .fader-fill {
  background: linear-gradient(0deg, oklch(0.78 0.16 200) 0%, oklch(0.86 0.14 200) 100%);
  --fill-glow: oklch(0.78 0.16 200 / 0.55);
}
.fader-b .fader-fill {
  background: linear-gradient(0deg, oklch(0.72 0.22 350) 0%, oklch(0.82 0.20 350) 100%);
  --fill-glow: oklch(0.72 0.22 350 / 0.55);
}
.fader-ticks {
  position: absolute; inset: 10px;
  pointer-events: none;
  z-index: 2;
}
.fader-tick {
  position: absolute; right: 3px;
  width: 4px; height: 1px;
  background: oklch(1 0 0 / 0.35);
  mix-blend-mode: screen;
}
.fader-handle {
  position: absolute; left: -3px; right: -3px;
  height: 22px;
  border-radius: 5px;
  background: linear-gradient(180deg, oklch(0.78 0.02 270) 0%, oklch(0.62 0.02 270) 45%, oklch(0.42 0.02 270) 50%, oklch(0.58 0.02 270) 55%, oklch(0.74 0.02 270) 100%);
  border: 1px solid oklch(0.92 0.02 270);
  box-shadow:
    inset 0 1px 0 oklch(1 0 0 / 0.5),
    inset 0 -1px 0 oklch(0 0 0 / 0.4),
    0 3px 8px oklch(0 0 0 / 0.7),
    0 0 0 1px oklch(0 0 0 / 0.5);
  display: flex; align-items: center; justify-content: center;
  transform: translateY(-50%);
  z-index: 3;
}
.fader-handle::before {
  content: '';
  width: 14px; height: 2px;
  background: oklch(0.18 0.02 270);
  border-radius: 1px;
  box-shadow: 0 -3px 0 oklch(0.18 0.02 270 / 0.5), 0 3px 0 oklch(0.18 0.02 270 / 0.5);
}
.fader-a .fader-handle { border-color: oklch(0.86 0.14 200); box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.5), inset 0 -1px 0 oklch(0 0 0 / 0.4), 0 3px 8px oklch(0 0 0 / 0.7), 0 0 12px oklch(0.78 0.16 200 / 0.4); }
.fader-b .fader-handle { border-color: oklch(0.82 0.20 350); box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.5), inset 0 -1px 0 oklch(0 0 0 / 0.4), 0 3px 8px oklch(0 0 0 / 0.7), 0 0 12px oklch(0.72 0.22 350 / 0.4); }

/* Crossfader */
.crossfader-wrap {
  padding: 6px 4px 2px;
  flex: 0 0 auto;
}
.crossfader-labels {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 10px;
  font-weight: 700; color: var(--ink-3);
  letter-spacing: 0.1em; margin-bottom: 6px;
}
.crossfader-labels .a { color: var(--accent-cyan); }
.crossfader-labels .b { color: var(--accent-pink); }
.crossfader {
  position: relative;
  height: 36px;
  background: oklch(0 0 0 / 0.5);
  border-radius: 10px;
  border: 1px solid var(--stroke);
  cursor: ew-resize;
  box-shadow: inset 0 2px 6px oklch(0 0 0 / 0.5);
  touch-action: none;
}
.crossfader-track {
  position: absolute; top: 50%; left: 10px; right: 10px;
  height: 2px; background: oklch(1 0 0 / 0.08);
  transform: translateY(-50%); border-radius: 2px;
}
.crossfader-center {
  position: absolute; top: 50%; left: 50%;
  width: 1px; height: 14px;
  background: oklch(1 0 0 / 0.2);
  transform: translate(-50%, -50%);
}
.crossfader-handle {
  position: absolute; top: 4px; bottom: 4px;
  width: 36px;
  border-radius: 7px;
  background: linear-gradient(180deg, oklch(0.38 0.04 270), oklch(0.24 0.03 270));
  border: 1px solid var(--stroke-strong);
  box-shadow:
    inset 0 1px 0 oklch(1 0 0 / 0.15),
    inset 0 -1px 0 oklch(0 0 0 / 0.5),
    0 4px 12px oklch(0 0 0 / 0.5);
  transform: translateX(-50%);
  display: flex; align-items: center; justify-content: center;
}
.crossfader-handle::before {
  content: '';
  width: 2px; height: 16px;
  background: var(--grad-main);
  border-radius: 2px;
  box-shadow: 0 0 8px oklch(0.7 0.2 295 / 0.6);
}

/* Master */
.master-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 2px 2px;
  border-top: 1px solid var(--stroke);
}
.master-knob-wrap {
  display: flex; align-items: center; gap: 10px;
}
.master-mini {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--ink-2); letter-spacing: 0.1em; text-transform: uppercase;
}
.time-display {
  font-family: var(--font-mono);
  font-size: 14px; font-weight: 700;
  color: var(--ink-0);
  letter-spacing: 0.02em;
}

/* ============ QUEUE SIDEBAR ============ */
.queue {
  grid-area: queue;
  padding: 14px;
  display: flex; flex-direction: column;
  gap: 12px;
  min-height: 0;
}
.queue-head {
  display: flex; align-items: center; justify-content: space-between;
}
.queue-title {
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.02em;
}

.automix-card {
  padding: 12px;
  border-radius: 12px;
  background: linear-gradient(135deg,
    oklch(0.25 0.08 290 / 0.5),
    oklch(0.22 0.09 340 / 0.4));
  border: 1px solid oklch(0.7 0.2 295 / 0.3);
  position: relative;
  overflow: hidden;
}
.automix-card::before {
  content: '';
  position: absolute; top: -40%; right: -20%;
  width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, oklch(0.74 0.2 340 / 0.3), transparent 70%);
  pointer-events: none;
}
.automix-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
  position: relative;
}
.automix-label {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.2em; font-weight: 700;
  color: oklch(0.85 0.08 310);
  text-transform: uppercase;
}
.automix-btn {
  width: 100%;
  height: 46px;
  border-radius: 10px;
  background: var(--grad-main);
  color: oklch(0.1 0.02 270);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all .2s;
  position: relative;
  box-shadow: 0 6px 24px oklch(0.7 0.2 295 / 0.35);
}
.automix-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 30px oklch(0.7 0.2 295 / 0.5); }
.automix-btn.on {
  background: oklch(0.82 0.18 150);
  color: oklch(0.12 0.02 150);
  box-shadow: 0 0 30px oklch(0.82 0.18 150 / 0.6);
  animation: automixPulse 2s ease-in-out infinite;
}
@keyframes automixPulse {
  50% { box-shadow: 0 0 40px oklch(0.82 0.18 150 / 0.9); }
}
.automix-sub {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 10px;
  color: oklch(0.82 0.05 310);
  margin-top: 10px;
  letter-spacing: 0.05em;
}

/* ---------- Automix v2: now/next preview, friendly caption, settings drawer, confirm modal ---------- */
.automix-card.is-on { border-color: oklch(0.82 0.18 150 / 0.4); }
.automix-card.is-fading { border-color: oklch(0.78 0.18 295 / 0.55); }

.automix-phase {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.16em; font-weight: 700;
  color: oklch(0.82 0.05 310);
  text-transform: uppercase;
}
.automix-phase.on { color: oklch(0.86 0.16 150); }
.am-led {
  width: 7px; height: 7px; border-radius: 50%;
  background: oklch(0.86 0.18 150);
  box-shadow: 0 0 10px oklch(0.86 0.18 150 / 0.8);
  animation: amLed 1.4s ease-in-out infinite;
}
@keyframes amLed { 50% { opacity: 0.35; transform: scale(0.8); } }

.automix-preview {
  margin: 8px 0 12px;
  padding: 10px 12px;
  background: oklch(0 0 0 / 0.3);
  border: 1px solid var(--stroke);
  border-radius: 9px;
  display: flex; flex-direction: column; gap: 5px;
  position: relative;
}
.amp-row {
  display: flex; align-items: center; gap: 9px;
  font-size: 12px;
  min-width: 0;
}
.amp-tag {
  font-family: var(--font-mono); font-size: 9px;
  letter-spacing: 0.18em; font-weight: 700;
  width: 36px; flex-shrink: 0;
  color: var(--ink-3);
}
.amp-row.now .amp-tag { color: oklch(0.86 0.18 150); }
.amp-row.next .amp-tag { color: oklch(0.82 0.05 310); }
.amp-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink-1);
  font-weight: 500;
}
.amp-row.now .amp-title { color: var(--ink-0); font-weight: 600; }

.amp-progress {
  position: relative;
  height: 4px;
  margin-top: 4px;
  background: oklch(0 0 0 / 0.5);
  border-radius: 2px;
  overflow: hidden;
}
.amp-progress-fill {
  position: absolute; inset: 0 auto 0 0;
  background: linear-gradient(90deg, oklch(0.78 0.18 295), oklch(0.82 0.18 150));
  border-radius: 2px;
  transition: width 0.2s linear;
}
.amp-progress-marker {
  position: absolute; top: -2px; bottom: -2px;
  width: 1px;
  background: oklch(0.82 0.16 75 / 0.7);
}
.amp-progress-marker::after {
  content: '';
  position: absolute;
  top: -3px; left: -3px;
  width: 7px; height: 3px;
  background: oklch(0.82 0.16 75);
  border-radius: 1px;
}

/* Friendly plain-English caption below the START button */
.automix-caption {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-1);
  flex-wrap: wrap;
}
.amc-main {
  flex: 1;
  min-width: 0;
  font-weight: 500;
}
.amc-empty { color: var(--ink-3); font-style: italic; }
.amc-sub {
  color: var(--ink-3);
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.amc-gear {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--stroke);
  color: var(--ink-3);
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}
.amc-gear:hover { background: oklch(0 0 0 / 0.4); color: var(--ink-1); border-color: var(--stroke-strong); }

/* Hidden settings drawer */
.automix-settings {
  margin-top: 10px;
  padding: 10px 12px;
  background: oklch(0 0 0 / 0.35);
  border: 1px solid var(--stroke);
  border-radius: 9px;
  animation: amsSlide 0.18s ease-out;
}
@keyframes amsSlide { from { opacity: 0; transform: translateY(-4px); } }
.ams-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px;
  color: var(--ink-1);
}
.ams-name { flex-shrink: 0; min-width: 110px; font-weight: 500; }
.ams-slider { flex: 1; min-width: 80px; accent-color: oklch(0.82 0.18 150); }
.ams-val {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-green);
  min-width: 28px; text-align: right;
}
.ams-help {
  margin-top: 6px;
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.45;
}

/* ---------- Confirm modal ---------- */
.am-modal-backdrop {
  position: fixed; inset: 0;
  background: oklch(0 0 0 / 0.65);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.18s ease-out;
}
.am-modal {
  width: min(420px, 92vw);
  background: var(--panel-strong);
  border: 1px solid var(--stroke-strong);
  border-radius: 16px;
  padding: 28px 28px 22px;
  box-shadow:
    0 30px 80px oklch(0 0 0 / 0.6),
    0 0 0 1px oklch(1 0 0 / 0.05) inset,
    0 0 60px oklch(0.78 0.18 295 / 0.15);
  animation: amModalIn 0.22s cubic-bezier(.2,.8,.2,1);
  text-align: center;
}
@keyframes amModalIn { from { opacity: 0; transform: translateY(8px) scale(0.96); } }

.am-modal-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, oklch(0.78 0.18 295), oklch(0.82 0.18 150));
  display: flex; align-items: center; justify-content: center;
  color: oklch(0.12 0.02 270);
  margin: 0 auto 12px;
  box-shadow: 0 8px 24px oklch(0.78 0.18 295 / 0.4);
}
.am-modal-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink-0);
  margin-bottom: 18px;
}
.am-modal-stat {
  display: flex; flex-direction: column; gap: 2px;
  margin: 6px 0 4px;
}
.am-modal-stat-num {
  font-family: var(--font-mono);
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, oklch(0.86 0.18 150), oklch(0.78 0.18 295));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.1;
}
.am-modal-stat-lbl {
  font-size: 12px;
  color: var(--ink-2);
  letter-spacing: 0.04em;
}
.am-modal-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.am-modal-warn {
  margin-top: 18px;
  padding: 12px 14px;
  background: oklch(0.82 0.16 75 / 0.12);
  border: 1px solid oklch(0.82 0.16 75 / 0.4);
  border-radius: 10px;
  display: flex; align-items: flex-start; gap: 8px;
  text-align: left;
  font-size: 12.5px;
  line-height: 1.45;
  color: oklch(0.92 0.1 75);
}
.am-modal-warn svg { flex-shrink: 0; margin-top: 2px; color: oklch(0.86 0.16 75); }
.am-modal-tip {
  margin-top: 18px;
  padding: 10px 12px;
  background: oklch(0 0 0 / 0.3);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  font-size: 12px;
  color: var(--ink-2);
  text-align: left;
}
.am-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}
.am-modal-btn {
  height: 42px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid var(--stroke);
  background: oklch(0 0 0 / 0.4);
  color: var(--ink-1);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all .15s;
}
.am-modal-btn.cancel:hover { background: oklch(0 0 0 / 0.6); color: var(--ink-0); }
.am-modal-btn.go {
  background: linear-gradient(135deg, oklch(0.82 0.18 150), oklch(0.78 0.18 200));
  color: oklch(0.12 0.04 150);
  border-color: transparent;
  box-shadow: 0 6px 18px oklch(0.82 0.18 150 / 0.35);
}
.am-modal-btn.go:hover { transform: translateY(-1px); box-shadow: 0 10px 24px oklch(0.82 0.18 150 / 0.5); }


.queue-list {
  flex: 1;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  padding-right: 2px;
}
.queue-list::-webkit-scrollbar { width: 4px; }
.queue-list::-webkit-scrollbar-thumb { background: var(--stroke-strong); border-radius: 2px; }

.queue-empty {
  padding: 30px 20px;
  text-align: center;
  font-size: 12px; color: var(--ink-3);
  border: 1px dashed var(--stroke);
  border-radius: 10px;
  line-height: 1.5;
}
.queue-empty-icon { font-size: 24px; margin-bottom: 8px; opacity: 0.5; display: block; }

.queue-item {
  display: flex; gap: 10px; align-items: center;
  padding: 8px;
  border-radius: 9px;
  cursor: grab;
  transition: background .15s;
  position: relative;
  border: 1px solid transparent;
}
.queue-item:hover {
  background: var(--stroke);
  border-color: var(--stroke);
}
.queue-item.loaded-a { background: oklch(0.78 0.16 215 / 0.1); border-color: oklch(0.78 0.16 215 / 0.3); }
.queue-item.loaded-b { background: oklch(0.74 0.2 340 / 0.1); border-color: oklch(0.74 0.2 340 / 0.3); }
.queue-item.dragging { opacity: 0.4; }

.queue-thumb {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 7px;
  background: var(--bg-2);
  position: relative;
  overflow: hidden;
  display: grid; place-items: center;
}
.queue-thumb img { width: 100%; height: 100%; object-fit: cover; }
.queue-thumb-placeholder {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-pink));
  opacity: 0.6;
}

.queue-info { flex: 1; min-width: 0; }
.queue-item-title {
  font-size: 12px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--ink-0);
}
.queue-item-meta {
  display: flex; gap: 6px;
  font-family: var(--font-mono); font-size: 9px;
  color: var(--ink-2); margin-top: 3px;
  letter-spacing: 0.05em;
}
.queue-item-meta .sep { opacity: 0.4; }

.queue-actions {
  display: flex; gap: 3px;
  opacity: 0;
  transition: opacity .15s;
}
.queue-item:hover .queue-actions { opacity: 1; }
.qa-btn {
  width: 22px; height: 22px; border-radius: 5px;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  background: oklch(0 0 0 / 0.4);
  border: 1px solid var(--stroke);
  color: var(--ink-2);
  transition: all .15s;
}
.qa-btn:hover { color: var(--ink-0); border-color: var(--stroke-strong); }
.qa-btn.a:hover { color: var(--accent-cyan); border-color: oklch(0.78 0.16 215 / 0.5); background: oklch(0.78 0.16 215 / 0.15); }
.qa-btn.b:hover { color: var(--accent-pink); border-color: oklch(0.74 0.2 340 / 0.5); background: oklch(0.74 0.2 340 / 0.15); }
.qa-btn:disabled { opacity: 0.3; pointer-events: none; }

/* ============ QUEUE ITEM LOADING STATE ============ */
.queue-item.loading {
  background: oklch(0.25 0.02 290 / 0.5);
  border-color: oklch(0.55 0.12 295 / 0.3);
}
.queue-item.loading .queue-thumb {
  position: relative;
  background: oklch(0.2 0.02 290);
}
.queue-thumb-spinner {
  position: absolute; inset: 0;
  border-radius: inherit;
  background: conic-gradient(from 0deg, transparent, oklch(0.7 0.2 295), transparent);
  mask: radial-gradient(circle at center, transparent 14px, black 15px);
  -webkit-mask: radial-gradient(circle at center, transparent 14px, black 15px);
  animation: spin 1.1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.queue-item-progress {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 3px;
}
.qi-bar {
  height: 3px; background: oklch(0 0 0 / 0.5);
  border-radius: 2px; overflow: hidden;
}
.qi-bar.analyzing .qi-bar-fill {
  background: linear-gradient(90deg, var(--accent-amber), var(--accent-cyan));
  box-shadow: 0 0 6px oklch(0.82 0.16 75 / 0.6);
}
.analyze-low {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  color: var(--accent-amber);
  margin-left: 4px;
}
.qi-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-violet), var(--accent-pink));
  border-radius: 2px;
  transition: width 0.2s ease-out;
  box-shadow: 0 0 6px oklch(0.7 0.2 295 / 0.6);
}
.qi-status {
  font-family: var(--font-mono); font-size: 9px;
  letter-spacing: 0.05em;
  color: oklch(0.75 0.08 295);
  text-transform: uppercase;
}

/* ============ SOURCE BADGES ============ */
.src-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 8px; font-weight: 700;
  letter-spacing: 0.05em;
  padding: 1px 4px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: 1px;
}
.src-badge.yt { background: oklch(0.55 0.22 25 / 0.2); color: oklch(0.75 0.2 25); border: 1px solid oklch(0.55 0.22 25 / 0.4); }
.src-badge.sc { background: oklch(0.65 0.2 40 / 0.2); color: oklch(0.8 0.18 50); border: 1px solid oklch(0.65 0.2 40 / 0.4); }
.sc-hint {
  color: oklch(0.75 0.12 50);
  font-size: 8px;
}

/* ============ X/Y FX PAD ============ */
.fxpad-wrap {
  margin-top: 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.fxpad-head {
  display: flex; align-items: center; justify-content: space-between;
}
.fxpad-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--ink-2);
  text-transform: uppercase;
}
.fxpad-controls { display: flex; gap: 6px; align-items: center; }
.fxpad-select {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  background: oklch(0 0 0 / 0.4);
  color: var(--ink-1);
  border: 1px solid var(--stroke);
  border-radius: 5px;
  padding: 3px 6px;
  cursor: pointer;
}
.fxpad-select:focus { outline: none; border-color: oklch(0.7 0.2 295 / 0.6); }
.fxpad-latch {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  background: oklch(0 0 0 / 0.4);
  color: var(--ink-2);
  border: 1px solid var(--stroke);
  border-radius: 5px;
  padding: 3px 8px;
  cursor: pointer;
  transition: all .15s;
}
.fxpad-latch:hover { color: var(--ink-0); border-color: var(--stroke-strong); }
.fxpad-latch.on {
  background: linear-gradient(135deg, oklch(0.55 0.22 25), oklch(0.6 0.25 10));
  border-color: oklch(0.65 0.25 15);
  color: #fff;
  box-shadow: 0 0 12px oklch(0.6 0.25 15 / 0.4);
}

.fxpad {
  position: relative;
  aspect-ratio: 16 / 9;
  min-height: 140px;
  flex-shrink: 0;
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 50%, oklch(0.25 0.05 295 / 0.4), oklch(0.12 0.02 290) 70%),
    linear-gradient(135deg, oklch(0.15 0.02 290), oklch(0.1 0.02 290));
  border: 1px solid var(--stroke);
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  transition: border-color .2s, box-shadow .2s;
}
.fxpad:not(.empty):hover {
  border-color: oklch(0.55 0.15 295 / 0.4);
}
.fxpad.active {
  border-color: oklch(0.7 0.2 295 / 0.7);
  box-shadow:
    inset 0 0 24px oklch(0.55 0.2 295 / 0.2),
    0 0 16px oklch(0.55 0.2 295 / 0.25);
}
.fxpad.empty { cursor: not-allowed; opacity: 0.55; }

.fxpad-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(oklch(1 0 0 / 0.04) 1px, transparent 1px),
    linear-gradient(90deg, oklch(1 0 0 / 0.04) 1px, transparent 1px);
  background-size: 12.5% 12.5%;
  pointer-events: none;
}
.fxpad-grid::before, .fxpad-grid::after {
  content: ''; position: absolute;
  background: oklch(1 0 0 / 0.1);
}
.fxpad-grid::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.fxpad-grid::after { top: 50%; left: 0; right: 0; height: 1px; }

.fxpad-axis-x, .fxpad-axis-y {
  position: absolute;
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  pointer-events: none;
}
.fxpad-axis-x {
  left: 8px; right: 8px; bottom: 4px;
}
.fxpad-axis-x span:nth-child(2) {
  color: oklch(0.75 0.08 150);
  font-weight: 600;
}
.fxpad-axis-y {
  flex-direction: column;
  top: 4px; bottom: 4px; left: 4px;
  width: 14px;
}
.fxpad-axis-y span:nth-child(2) {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: oklch(0.75 0.12 295);
  font-weight: 600;
}

.fxpad-dot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 24px; height: 24px;
  pointer-events: none;
}
.fxpad-dot-inner {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, oklch(0.8 0.2 295) 50%, oklch(0.5 0.25 295) 100%);
  box-shadow:
    0 0 12px oklch(0.7 0.2 295 / 0.8),
    0 0 24px oklch(0.7 0.2 295 / 0.4),
    0 2px 4px oklch(0 0 0 / 0.6);
}
.fxpad-crosshair-h, .fxpad-crosshair-v {
  position: absolute;
  background: linear-gradient(var(--d, 90deg), transparent, oklch(0.7 0.2 295 / 0.4), transparent);
  pointer-events: none;
}
.fxpad-crosshair-h {
  top: 50%; left: -1000px; right: -1000px; height: 1px;
  transform: translateY(-0.5px);
  --d: 90deg;
}
.fxpad-crosshair-v {
  left: 50%; top: -1000px; bottom: -1000px; width: 1px;
  transform: translateX(-0.5px);
  background: linear-gradient(0deg, transparent, oklch(0.7 0.2 295 / 0.4), transparent);
}

.fxpad-hint, .fxpad-empty-label {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  text-transform: uppercase;
  pointer-events: none;
}
.fxpad-empty-label { color: var(--ink-3); }

/* ============ HINT / TOAST ============ */
.toast {
  position: fixed;
  bottom: 16px; left: 50%;
  transform: translateX(-50%);
  padding: 10px 16px;
  background: var(--panel-strong);
  backdrop-filter: blur(20px);
  border: 1px solid var(--stroke-strong);
  border-radius: 10px;
  font-size: 12px;
  color: var(--ink-0);
  box-shadow: var(--shadow-glass);
  animation: toastIn 0.3s ease-out;
  z-index: 100;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
}

/* ============ HELP / KEYMAP HINT ============ */
.hint-chip {
  position: fixed; bottom: 14px; right: 14px;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: var(--panel);
  backdrop-filter: blur(20px);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  font-size: 11px;
  color: var(--ink-2);
  z-index: 50;
}
kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  background: oklch(0 0 0 / 0.5);
  border: 1px solid var(--stroke);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--ink-1);
}

/* Responsive guard */
@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; grid-template-areas: "top" "main"; }
  .queue { display: none; }
}

/* ============ AUDIO GATE ============ */
.audio-gate {
  position: fixed; inset: 0;
  background: oklch(0 0 0 / 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 200;
  display: grid; place-items: center;
  cursor: pointer;
  animation: fadeIn .3s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } }
.audio-gate-card {
  display: flex; gap: 16px; align-items: center;
  padding: 22px 28px;
  background: var(--panel-strong);
  border: 1px solid var(--stroke-strong);
  border-radius: 16px;
  box-shadow: var(--shadow-glass);
  max-width: 440px;
}
.ag-mark {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--grad-main);
  display: grid; place-items: center;
  color: oklch(0.12 0.02 270);
  box-shadow: 0 0 28px oklch(0.7 0.2 295 / 0.5);
}
.ag-title { font-size: 15px; font-weight: 700; color: var(--ink-0); }
.ag-sub { font-size: 12px; color: var(--ink-2); margin-top: 4px; line-height: 1.5; }

/* ============ PHASE 3: PRO SYNC ============ */

/* ---- Phase-error chip in sync strip ---- */
.sync-chip.phase {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.sync-chip.phase.lock {
  background: oklch(0.78 0.18 150 / 0.18);
  border-color: oklch(0.78 0.18 150 / 0.55);
  color: var(--accent-green);
  box-shadow: 0 0 8px oklch(0.78 0.18 150 / 0.35);
}
.sync-chip.phase.near {
  background: oklch(0.82 0.16 90 / 0.15);
  border-color: oklch(0.82 0.16 90 / 0.5);
  color: oklch(0.85 0.16 90);
}
.sync-chip.phase.drift {
  background: oklch(0.65 0.22 25 / 0.18);
  border-color: oklch(0.65 0.22 25 / 0.55);
  color: oklch(0.78 0.2 25);
  animation: phaseDriftPulse 1s ease-in-out infinite;
}
@keyframes phaseDriftPulse {
  0%, 100% { box-shadow: 0 0 0 oklch(0.65 0.22 25 / 0); }
  50%      { box-shadow: 0 0 12px oklch(0.65 0.22 25 / 0.6); }
}

/* ---- Beat-jump row ---- */
.beat-jump-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  margin-top: 6px;
  background: oklch(0 0 0 / 0.3);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  font-family: var(--font-mono);
}
.beat-jump-row .bj-label {
  font-size: 9px;
  color: var(--ink-3);
  letter-spacing: 0.1em;
  margin-right: 4px;
  flex-shrink: 0;
}
.bj-btn {
  flex: 1;
  min-width: 0;
  padding: 6px 4px;
  background: oklch(0 0 0 / 0.4);
  border: 1px solid var(--stroke);
  border-radius: 5px;
  color: var(--ink-1);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all .12s;
}
.bj-btn:hover:not(:disabled) {
  background: oklch(0.78 0.16 200 / 0.15);
  border-color: oklch(0.78 0.16 200 / 0.6);
  color: var(--accent-cyan);
}
.bj-btn:active:not(:disabled) {
  transform: scale(0.94);
  background: oklch(0.78 0.16 200 / 0.3);
}
.bj-btn:disabled { opacity: 0.4; cursor: default; }

/* ---- Beat-loop instant rack ---- */
.beatloop-rack {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  margin-top: 4px;
  background: oklch(0 0 0 / 0.3);
  border: 1px solid var(--stroke);
  border-radius: 8px;
}
.beatloop-rack .bl-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink-3);
  letter-spacing: 0.1em;
  margin-right: 4px;
  flex-shrink: 0;
}
.beatloop-btn {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  background: oklch(0 0 0 / 0.4);
  border: 1px solid var(--stroke);
  border-radius: 5px;
  color: var(--ink-1);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all .12s;
}
.beatloop-btn:hover:not(:disabled) {
  background: oklch(0.74 0.18 320 / 0.18);
  border-color: oklch(0.74 0.18 320 / 0.65);
  color: oklch(0.86 0.18 320);
}
.beatloop-btn.active {
  background: oklch(0.74 0.18 320 / 0.32);
  border-color: oklch(0.74 0.18 320);
  color: oklch(0.95 0.05 320);
  box-shadow: 0 0 12px oklch(0.74 0.18 320 / 0.5);
}
.beatloop-btn:disabled { opacity: 0.4; cursor: default; }

/* ---- BPM-synced FX row ---- */
.fx-sync-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  margin-top: 6px;
  background: oklch(0 0 0 / 0.3);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  font-family: var(--font-mono);
  flex-wrap: wrap;
}
.fxs-label {
  font-size: 9px;
  color: var(--ink-3);
  letter-spacing: 0.1em;
  flex-shrink: 0;
}
.fxs-toggle {
  padding: 4px 8px;
  background: oklch(0 0 0 / 0.45);
  border: 1px solid var(--stroke);
  border-radius: 5px;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all .12s;
  flex-shrink: 0;
}
.fxs-toggle.on {
  background: oklch(0.74 0.18 240 / 0.25);
  border-color: oklch(0.74 0.18 240 / 0.7);
  color: oklch(0.86 0.18 240);
  box-shadow: 0 0 8px oklch(0.74 0.18 240 / 0.4);
}
.fxs-divs {
  display: flex;
  gap: 3px;
  flex: 1;
  min-width: 0;
}
.fxs-div {
  flex: 1;
  min-width: 0;
  padding: 4px 0;
  background: oklch(0 0 0 / 0.4);
  border: 1px solid var(--stroke);
  border-radius: 4px;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all .12s;
}
.fxs-div:hover:not(:disabled) {
  border-color: oklch(0.74 0.18 240 / 0.5);
  color: var(--ink-1);
}
.fxs-div.active {
  background: oklch(0.74 0.18 240 / 0.3);
  border-color: oklch(0.74 0.18 240);
  color: oklch(0.92 0.1 240);
}

/* ---- Quantize panel in mixer ---- */
.quantize-panel {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px 8px;
  margin: 6px 0;
  background: oklch(0 0 0 / 0.35);
  border: 1px solid var(--stroke);
  border-radius: 8px;
}
.q-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: oklch(0 0 0 / 0.45);
  border: 1px solid var(--stroke);
  border-radius: 6px;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all .12s;
}
.q-led {
  width: 7px; height: 7px; border-radius: 50%;
  background: oklch(0.4 0.05 270);
  box-shadow: inset 0 0 3px oklch(0 0 0 / 0.6);
  transition: all .15s;
}
.q-toggle.on {
  background: oklch(0.78 0.16 200 / 0.18);
  border-color: oklch(0.78 0.16 200 / 0.65);
  color: var(--accent-cyan);
}
.q-toggle.on .q-led {
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan), inset 0 0 2px oklch(1 0 0 / 0.4);
}
.q-divs {
  display: flex;
  gap: 3px;
}
.q-div {
  flex: 1;
  min-width: 0;
  padding: 4px 0;
  background: oklch(0 0 0 / 0.4);
  border: 1px solid var(--stroke);
  border-radius: 4px;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all .12s;
}
.q-div:disabled { opacity: 0.35; cursor: default; }
.q-div:hover:not(:disabled) {
  border-color: oklch(0.78 0.16 200 / 0.5);
  color: var(--accent-cyan);
}
.q-div.active {
  background: oklch(0.78 0.16 200 / 0.28);
  border-color: var(--accent-cyan);
  color: oklch(0.95 0.06 200);
  box-shadow: 0 0 6px oklch(0.78 0.16 200 / 0.4);
}
.master-tag {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.15em;
  padding: 3px 0;
  border-radius: 4px;
  background: oklch(0 0 0 / 0.4);
  border: 1px solid var(--stroke);
  color: var(--ink-3);
}
.master-tag.a { color: var(--accent-cyan); border-color: oklch(0.78 0.16 200 / 0.5); background: oklch(0.78 0.16 200 / 0.1); }
.master-tag.b { color: var(--accent-pink); border-color: oklch(0.74 0.2 350 / 0.5); background: oklch(0.74 0.2 350 / 0.1); }

/* MASTER button — already exists, but ensure pinned/active states are clear */
.t-btn.master-btn {
  font-size: 9px;
  letter-spacing: 0.12em;
  padding: 6px 8px;
}
.t-btn.master-btn.active {
  background: oklch(0.85 0.18 90 / 0.18);
  border-color: oklch(0.85 0.18 90 / 0.7);
  color: oklch(0.92 0.16 90);
  box-shadow: 0 0 10px oklch(0.85 0.18 90 / 0.4);
}
.t-btn.master-btn.pinned {
  background: oklch(0.85 0.18 90 / 0.28);
  border-color: oklch(0.9 0.16 90);
  color: oklch(0.97 0.1 90);
  box-shadow: 0 0 14px oklch(0.85 0.18 90 / 0.6);
}
.t-btn.master-btn.pinned::before {
  content: '◆ ';
  font-size: 8px;
}


/* ============ HELP MODAL ============ */
.hint-help {
  margin-left: 6px;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 1px solid var(--stroke-strong);
  background: oklch(0.78 0.16 200 / 0.18);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: help;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}
.hint-help:hover {
  background: oklch(0.78 0.16 200 / 0.4);
  color: oklch(0.95 0.1 200);
  transform: scale(1.1);
}
.help-backdrop {
  position: fixed;
  inset: 0;
  background: oklch(0 0 0 / 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: helpFadeIn .2s ease-out;
}
@keyframes helpFadeIn { from { opacity: 0; } }
.help-modal {
  background: oklch(0.18 0.04 290 / 0.98);
  border: 1px solid oklch(0.78 0.16 200 / 0.4);
  border-radius: 18px;
  width: min(640px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px 36px;
  box-shadow: 0 20px 80px oklch(0 0 0 / 0.6), 0 0 60px oklch(0.78 0.18 295 / 0.25);
  position: relative;
  animation: helpSlide .25s ease-out;
}
@keyframes helpSlide { from { opacity: 0; transform: translateY(20px) scale(0.96); } }
.help-close {
  position: absolute;
  top: 14px; right: 18px;
  background: transparent;
  border: none;
  color: var(--ink-3);
  font-size: 24px;
  cursor: pointer;
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.help-close:hover { background: oklch(0 0 0 / 0.4); color: var(--ink-0); }
.help-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: var(--grad-main);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.help-sub {
  color: var(--ink-2);
  font-size: 13px;
  margin-top: 4px;
  margin-bottom: 22px;
}
.help-section { margin-top: 22px; }
.help-h2 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.help-step {
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
  align-items: flex-start;
}
.help-num {
  width: 26px; height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  background: oklch(0.78 0.18 295 / 0.25);
  border: 1px solid oklch(0.78 0.18 295 / 0.6);
  color: oklch(0.92 0.14 295);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-top: 2px;
}
.help-step-title {
  color: var(--ink-0);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.help-step-body {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.55;
}
.help-step-body b {
  color: var(--accent-cyan);
  font-weight: 600;
  background: oklch(0.78 0.16 200 / 0.12);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
}
.help-glossary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
  padding: 14px 16px;
  background: oklch(0 0 0 / 0.3);
  border-radius: 10px;
  border: 1px solid var(--stroke);
}
.help-glossary b {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  margin-right: 8px;
  display: inline-block;
  min-width: 88px;
}
.help-keys {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 18px;
  font-size: 13px;
  color: var(--ink-2);
}
.help-keys kbd {
  background: oklch(0.25 0.04 280);
  border: 1px solid var(--stroke-strong);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 5px;
  margin-right: 8px;
  min-width: 40px;
  display: inline-block;
  text-align: center;
}
.help-done {
  width: 100%;
  margin-top: 24px;
  height: 48px;
  background: var(--grad-main);
  color: oklch(0.12 0.02 270);
  border: none;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .2s;
}
.help-done:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px oklch(0.78 0.18 295 / 0.4);
}


/* ============ CUSTOM TOOLTIP ============ */
/* Replaces native title= with a styled, fast tooltip. Show delay 120ms. */
.tip-target {
  display: inline-block; /* allow proper bounding-rect */
}
.tip-target.tip-inline {
  display: contents; /* don't introduce a wrapper box for inline text */
}
.tip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  transform: translate(-50%, -100%);
  animation: tipIn .12s ease-out;
}
.tip-bottom { transform: translate(-50%, 0); }
.tip-body {
  background: oklch(0.18 0.02 290);
  color: oklch(0.96 0.01 290);
  border: 1px solid oklch(0.32 0.04 290);
  padding: 8px 11px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  font-weight: 500;
  letter-spacing: 0.005em;
  box-shadow: 0 8px 24px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.4);
  white-space: normal;
  word-break: break-word;
  text-align: center;
}
.tip-body strong, .tip-body b {
  color: oklch(0.92 0.16 75); /* amber accent */
  font-weight: 600;
}
.tip-arrow {
  position: absolute;
  left: 50%;
  width: 8px; height: 8px;
  background: oklch(0.18 0.02 290);
  border: 1px solid oklch(0.32 0.04 290);
  transform: translateX(-50%) rotate(45deg);
}
.tip-top .tip-arrow {
  bottom: -5px;
  border-top: none; border-left: none;
}
.tip-bottom .tip-arrow {
  top: -5px;
  border-bottom: none; border-right: none;
}
@keyframes tipIn {
  from { opacity: 0; transform: translate(-50%, calc(-100% - 4px)); }
}
.tip-bottom { animation-name: tipInBottom; }
@keyframes tipInBottom {
  from { opacity: 0; transform: translate(-50%, 4px); }
}

/* ============ "FIX BEATS" panel — replaces ⚙ tray ============ */
.fixbeats-trigger {
  /* Lives in the transport row where ⚙ used to be.
     Subtle by default, amber-pulsing when there's drift to fix. */
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid oklch(0.32 0.03 290);
  background: oklch(0.20 0.02 290);
  color: oklch(0.78 0.04 290);
  font: 600 11px/1 var(--font-ui, system-ui);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .15s;
}
.fixbeats-trigger:hover:not(:disabled) {
  border-color: oklch(0.5 0.08 290);
  color: oklch(0.94 0.02 290);
  background: oklch(0.24 0.03 290);
}
.fixbeats-trigger.on,
.fixbeats-trigger.open {
  background: oklch(0.30 0.06 295);
  border-color: oklch(0.5 0.12 295);
  color: oklch(0.96 0.04 295);
}
.fixbeats-trigger.alert {
  background: oklch(0.40 0.16 65);
  border-color: oklch(0.6 0.2 65);
  color: oklch(0.99 0.04 75);
  animation: alertPulse 1.6s ease-in-out infinite;
}
.fixbeats-trigger.alert:hover {
  background: oklch(0.45 0.18 65);
}
@keyframes alertPulse {
  0%, 100% { box-shadow: 0 0 0 0 oklch(0.7 0.2 65 / 0.4); }
  50%      { box-shadow: 0 0 0 6px oklch(0.7 0.2 65 / 0); }
}
.fixbeats-trigger .fb-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Split button: primary action (Fix beats) + chevron toggle for manual tools */
.fixbeats-split {
  display: grid;
  grid-template-columns: 1fr auto;
  height: 42px;
  border-radius: 9px;
  background: oklch(0.22 0.02 290);
  border: 1px solid oklch(0.36 0.04 290);
  color: oklch(0.88 0.02 290);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  overflow: hidden;
  transition: all .15s;
}
.fixbeats-split:hover {
  border-color: oklch(0.5 0.08 290);
  background: oklch(0.26 0.03 290);
  color: oklch(0.96 0.02 290);
}
.fixbeats-split.on {
  background: oklch(0.30 0.06 295);
  border-color: oklch(0.5 0.12 295);
  color: oklch(0.96 0.04 295);
}
.fixbeats-split.alert {
  background: oklch(0.40 0.16 65);
  border-color: oklch(0.6 0.2 65);
  color: oklch(0.98 0.04 80);
  animation: alertPulse 1.6s ease-in-out infinite;
}
.fixbeats-split.alert:hover { background: oklch(0.45 0.18 65); }
.fixbeats-action {
  background: transparent;
  border: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 8px;
  border-right: 1px solid oklch(0 0 0 / 0.3);
  transition: background .12s;
  min-width: 0;
}
.fixbeats-action:hover:not(:disabled) {
  background: oklch(1 0 0 / 0.06);
}
.fixbeats-action:active:not(:disabled) {
  transform: scale(0.97);
  background: oklch(1 0 0 / 0.12);
}
.fixbeats-action:disabled { opacity: 0.4; cursor: default; }
.fixbeats-action .fb-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.fixbeats-action .fb-amt {
  font-size: 8.5px;
  opacity: 0.75;
  letter-spacing: 0.02em;
  font-weight: 600;
}
.fixbeats-toggle {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s;
  font-size: 18px;
  font-weight: 400;
  padding: 0;
}
.fixbeats-toggle:hover:not(:disabled) {
  background: oklch(1 0 0 / 0.08);
}
.fixbeats-toggle:disabled { opacity: 0.4; cursor: default; }
.fb-chev {
  display: inline-block;
  transition: transform .18s;
  line-height: 1;
  transform: rotate(90deg);
}
.fb-chev.open { transform: rotate(-90deg); }

/* The panel itself — replaces .adv-tray entirely. */
.fixbeats-panel {
  margin: 8px 0 4px;
  background: linear-gradient(180deg, oklch(0.18 0.02 290), oklch(0.15 0.02 290));
  border: 1px solid oklch(0.32 0.05 290);
  border-radius: 12px;
  padding: 12px 14px 14px;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
  animation: fbSlide .18s ease-out;
}
@keyframes fbSlide {
  from { opacity: 0; transform: translateY(-4px); }
}
.fixbeats-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.fixbeats-title {
  font: 700 12px/1 var(--font-ui, system-ui);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: oklch(0.92 0.04 295);
}
.fixbeats-close {
  background: none; border: none;
  width: 22px; height: 22px;
  border-radius: 5px;
  color: oklch(0.7 0.04 290);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1;
}
.fixbeats-close:hover {
  background: oklch(0.28 0.04 290);
  color: oklch(0.96 0.02 290);
}

.fb-card {
  background: oklch(0.13 0.015 290);
  border: 1px solid oklch(0.26 0.03 290);
  border-radius: 9px;
  padding: 11px 12px;
}
.fb-card + .fb-card { margin-top: 10px; }
.fb-card-q {
  font: 600 12.5px/1.3 var(--font-ui, system-ui);
  color: oklch(0.94 0.04 295);
  margin-bottom: 4px;
}
.fb-card-hint {
  font: 400 11px/1.4 var(--font-ui, system-ui);
  color: oklch(0.66 0.03 290);
  margin-bottom: 9px;
}
.fb-card-actions {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.fb-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 30px;
  padding: 0 11px;
  border-radius: 7px;
  border: 1px solid oklch(0.34 0.04 290);
  background: oklch(0.22 0.02 290);
  color: oklch(0.93 0.02 290);
  font: 600 11.5px/1 var(--font-ui, system-ui);
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all .12s;
}
.fb-btn:hover:not(:disabled) {
  background: oklch(0.30 0.06 295);
  border-color: oklch(0.55 0.13 295);
  color: oklch(0.97 0.05 295);
  transform: translateY(-1px);
}
.fb-btn:disabled { opacity: 0.4; cursor: default; }
.fb-btn.primary {
  background: oklch(0.55 0.16 295);
  border-color: oklch(0.65 0.2 295);
  color: white;
}
.fb-btn.primary:hover:not(:disabled) {
  background: oklch(0.62 0.18 295);
}
.fb-btn.tapping {
  background: oklch(0.85 0.22 75);
  border-color: oklch(0.92 0.22 75);
  color: oklch(0.18 0.04 65);
  box-shadow: 0 0 14px oklch(0.85 0.2 75 / 0.6);
}
.fb-btn.icon-btn {
  width: 30px; padding: 0;
  font-size: 14px;
}
.fb-readout {
  margin-left: auto;
  font: 600 11px/1 var(--font-mono, ui-monospace);
  color: oklch(0.7 0.03 290);
  letter-spacing: 0.02em;
  padding: 0 8px;
  white-space: nowrap;
}
.fb-readout strong {
  color: oklch(0.94 0.04 295);
  font-weight: 700;
}
.fb-warn {
  display: inline-flex; align-items: center; gap: 5px;
  font: 500 10.5px/1.2 var(--font-ui, system-ui);
  color: oklch(0.84 0.18 65);
  padding: 4px 8px;
  border-radius: 5px;
  background: oklch(0.34 0.12 65 / 0.25);
  border: 1px solid oklch(0.5 0.16 65 / 0.4);
  margin-top: 6px;
}

/* Tip wrapper inside grid containers must not break the grid layout */
.transport > .tip-target,
.fb-card-actions > .tip-target,
.t-jump-pair > .tip-target,
.fixbeats-header > .tip-target {
  display: contents;
}


/* ============================================================
   MIXER EXTRAS — beat clock, center BPM, dual waveform overview
   ============================================================ */

/* DUAL WAVEFORM — bird's-eye, two decks stacked, scrolls around playhead */
.dual-wave {
  position: relative;
  height: 132px;
  border-radius: 8px;
  background: oklch(0.06 0.01 270);
  border: 1px solid var(--stroke);
  overflow: hidden;
  margin-bottom: 6px;
}
.dual-wave .dual-wave-cv {
  display: block;
  width: 100%;
  height: 64px;
}
.dual-wave .dual-wave-cv.top { border-bottom: 1px solid oklch(0.78 0.16 215 / 0.18); }
.dual-wave .dual-wave-cv.bot { border-top: 1px solid oklch(0.74 0.2 340 / 0.18); }
.dual-wave .dual-wave-axis {
  height: 4px;
  background:
    repeating-linear-gradient(90deg,
      oklch(1 0 0 / 0.05) 0 1px,
      transparent 1px 12px),
    linear-gradient(90deg,
      oklch(0.78 0.16 215 / 0.4),
      oklch(0.7 0.2 295 / 0.5),
      oklch(0.74 0.2 340 / 0.4));
  position: relative;
}
.dual-wave .dual-wave-axis::after {
  content: ''; position: absolute;
  top: 0; bottom: 0; left: 50%; width: 2px;
  transform: translateX(-50%);
  background: oklch(1 0 0 / 0.85);
  box-shadow: 0 0 6px oklch(1 0 0 / 0.5);
}
.dual-wave.empty {
  background:
    repeating-linear-gradient(45deg,
      oklch(0.1 0.01 270) 0 8px,
      oklch(0.08 0.01 270) 8px 16px);
}
.dual-wave-hint {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* CENTER BPM — large pulse-on-beat counter, sits above faders */
.center-bpm {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 8px 12px;
  border-radius: 10px;
  background: linear-gradient(180deg, oklch(0.13 0.02 270), oklch(0.09 0.02 270));
  border: 1.5px solid var(--stroke);
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.04), 0 4px 14px oklch(0 0 0 / 0.5);
  position: relative;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}
.center-bpm.status-locked {
  border-color: oklch(0.82 0.18 150 / 0.65);
  box-shadow:
    inset 0 1px 0 oklch(1 0 0 / 0.05),
    0 0 22px oklch(0.82 0.18 150 / 0.35),
    0 4px 14px oklch(0 0 0 / 0.5);
}
.center-bpm.status-matched {
  border-color: oklch(0.82 0.18 150 / 0.35);
}
.center-bpm.status-off {
  border-color: oklch(0.7 0.22 25 / 0.35);
}
.center-bpm-num {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink-0);
  line-height: 1;
  transition: transform 90ms ease, color 90ms ease;
  text-shadow: 0 0 14px oklch(1 0 0 / 0.15);
}
.center-bpm.status-locked .center-bpm-num { color: oklch(0.92 0.18 150); text-shadow: 0 0 18px oklch(0.82 0.18 150 / 0.6); }
.center-bpm-num.pulse-1 { transform: scale(1.06); }
.center-bpm-num.pulse-0 { transform: scale(1.0); }
.center-bpm-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink-3);
  letter-spacing: 0.25em;
  margin-top: 2px;
}
.center-bpm-status {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--ink-2);
}
.center-bpm.status-locked .center-bpm-status { color: oklch(0.9 0.16 150); }
.center-bpm.status-matched .center-bpm-status { color: oklch(0.82 0.16 150); }
.center-bpm.status-off .center-bpm-status { color: oklch(0.78 0.18 25); }

/* MASTER tag — inline variant beneath center BPM */
.master-tag.inline {
  align-self: center;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: oklch(0 0 0 / 0.35);
  color: var(--ink-2);
}
.master-tag.inline.a { color: var(--accent-cyan); border-color: oklch(0.78 0.16 215 / 0.45); background: oklch(0.78 0.16 215 / 0.08); }
.master-tag.inline.b { color: var(--accent-pink); border-color: oklch(0.74 0.2 340 / 0.45); background: oklch(0.74 0.2 340 / 0.08); }

/* BEAT CLOCK — 4 LEDs labeled 1 2 3 4, one row per deck */
.beat-clock-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 4px;
}
.beat-clock {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border-radius: 8px;
  background: oklch(0 0 0 / 0.35);
  border: 1px solid var(--stroke);
  transition: border-color 200ms ease;
}
.beat-clock.synced { border-color: oklch(0.82 0.18 150 / 0.4); }
.beat-clock-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
  opacity: 0.85;
}
.beat-clock-leds {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  width: 100%;
}
.beat-clock-led {
  position: relative;
  height: 16px;
  border-radius: 4px;
  background: oklch(0 0 0 / 0.5);
  border: 1px solid var(--stroke);
  display: flex; align-items: center; justify-content: center;
  transition: background 60ms ease, box-shadow 60ms ease;
  background-color: color-mix(in oklch, var(--led-color, white) calc(var(--led-on, 0) * 80%), oklch(0.05 0.01 270));
  box-shadow: 0 0 calc(var(--led-on, 0) * 14px) color-mix(in oklch, var(--led-color, white) 60%, transparent);
}
.beat-clock-led.down {
  border-color: color-mix(in oklch, var(--led-color, white) calc(40% + var(--led-on, 0) * 60%), var(--stroke));
}
.beat-clock-num {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  color: var(--ink-1);
  opacity: calc(0.45 + var(--led-on, 0) * 0.55);
  mix-blend-mode: difference;
}

/* QUANTIZE PANEL slim variant — single row, less prominent */
.quantize-panel.slim {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: oklch(0 0 0 / 0.3);
  border: 1px solid var(--stroke);
}
.quantize-panel.slim .q-toggle {
  flex: 0 0 auto;
}
.quantize-panel.slim .q-divs {
  display: flex; gap: 3px;
  flex: 1; justify-content: flex-end;
}
