/* ============================================================
   BEATBREAK PRO — rekordbox-class graphite chassis
   ============================================================ */

:root {
  --bg:            #0b0d10;
  --panel:         #14171c;
  --panel-2:       #191d23;
  --raised:        #21262d;
  --raised-2:      #2a3038;
  --sunken:        #0d1013;

  --text:          #e9eef4;
  --text-2:        #aab6c3;
  --muted:         #6f7d8c;
  --line:          rgba(255,255,255,.075);
  --line-2:        rgba(255,255,255,.13);

  --orange:        #ff8a1f;
  --orange-dim:    #b35c10;
  --blue:          #4aa8e8;
  --blue-dim:      #2b6f9e;
  --green:         #35c26a;
  --yellow:        #ffcc33;
  --red:           #e0483c;
  --violet:        #b18cff;

  --knob-track:    rgba(255,255,255,.10);

  --topbar-h:      44px;
  --status-h:      26px;
  --wave-h:        clamp(88px, 12vh, 132px);
  --stripe-h:      24px;
  --mixer-w:       clamp(230px, 17vw, 300px);
  --browser-h:     clamp(150px, 26vh, 320px);

  --font:  "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --mono:  "JetBrains Mono", "SF Mono", "Cascadia Mono", ui-monospace, Consolas, monospace;

  --inset: inset 0 1px 0 rgba(255,255,255,.05);
  --sunk:  inset 0 1px 3px rgba(0,0,0,.6);
}

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

/*
 * The console fills a tall screen exactly, but must never trap content it
 * can't fit. `min-height` on the body's regions lets the whole page grow past
 * the viewport and scroll, instead of the old `overflow: hidden` that crushed
 * the library to zero on a laptop. On a comfortably tall screen everything
 * still lands on one page — nothing scrolls unless it has to.
 */
html { height: 100%; }
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  display: flex;
  flex-direction: column;
}

/* Tall enough for the full console — pin to the viewport, no page scroll.
   Below this the page flows and scrolls so the library stays reachable. */
@media (min-height: 840px) and (min-width: 768px) {
  html, body { height: 100%; overflow: hidden; }
  body { min-height: 0; }
}

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--sunken); }
::-webkit-scrollbar-thumb { background: #2e353d; border: 2px solid var(--sunken); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #3d464f; }

.panel-label {
  font-size: 8px; font-weight: 700; letter-spacing: .16em;
  color: var(--muted); text-transform: uppercase; text-align: center;
}

/* ============================ TOP BAR ============================ */

.topbar {
  height: var(--topbar-h); flex: 0 0 auto;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: 0 12px;
  background: linear-gradient(180deg, #1b2027, #12151a);
  border-bottom: 1px solid var(--line-2);
}
.tb-left, .tb-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tb-right { justify-content: flex-end; }

.brand { display: flex; align-items: center; gap: 8px; padding-right: 6px; }
.brand-mark {
  width: 18px; height: 18px; border-radius: 50%;
  background: conic-gradient(from 200deg, var(--orange), #ffb45f, #6b3200, var(--orange));
  box-shadow: 0 0 10px -1px rgba(255,138,31,.55);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 6px; border-radius: 50%;
  background: #12151a; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.brand-name { font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.brand-name b { color: var(--orange); }

.tb-sel {
  padding: 4px 10px; border-radius: 3px;
  background: var(--raised); box-shadow: var(--inset);
  font-size: 10px; font-weight: 600; letter-spacing: .06em; color: var(--text-2);
  white-space: nowrap;
}
.tb-sel.wide { min-width: 130px; }

.tb-chip {
  padding: 4px 9px; border-radius: 3px;
  background: var(--raised); color: var(--muted);
  font-size: 9px; font-weight: 700; letter-spacing: .1em;
  box-shadow: var(--inset);
  transition: background .12s, color .12s;
}
.tb-chip:hover { background: var(--raised-2); color: var(--text); }
.tb-chip.is-on { background: #5a2000; color: #ffd7b0; box-shadow: inset 0 0 0 1px rgba(255,138,31,.6); }
.tb-chip.dim { opacity: .45; }

.master-clock {
  display: flex; align-items: center; gap: 9px;
  padding: 3px 12px; border-radius: 4px;
  background: linear-gradient(180deg, #10141a, #0b0e12);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.mc-label, .mc-unit { font-size: 8px; font-weight: 700; letter-spacing: .14em; color: var(--muted); }
.mc-bpm {
  font-family: var(--mono); font-size: 21px; font-weight: 700; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; color: #fff;
}
.beat-dots { display: flex; gap: 3px; }
.beat-dots i { width: 13px; height: 3px; border-radius: 1px; background: #2c333b; }
.beat-dots i.on { background: var(--orange); box-shadow: 0 0 6px rgba(255,138,31,.8); }
.beat-dots i.down.on { background: #fff; box-shadow: 0 0 7px rgba(255,255,255,.8); }

.wall-clock { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.link-led { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px rgba(53,194,106,.8); }

/* ============================ STAGE ============================ */

.stage {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr var(--mixer-w) 1fr;
  background: var(--sunken);
  border-bottom: 1px solid var(--line);
  min-height: var(--stage-min, 440px);
}
.deck-host, .mixer-host { min-width: 0; display: flex; }

/* ============================ DECK ============================ */

.deck {
  flex: 1; min-width: 0; display: flex;
  background: linear-gradient(180deg, #171b21, #12161b);
  position: relative;
}
.deck-2 { flex-direction: row-reverse; }
.deck.drop::after {
  content: "DROP TO LOAD"; position: absolute; inset: 4px; z-index: 30;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: .2em; color: var(--orange);
  background: rgba(255,138,31,.08); border: 1px dashed rgba(255,138,31,.6); border-radius: 4px;
  pointer-events: none;
}

/* --- rail --- */
.deck-rail {
  width: 62px; flex: 0 0 62px;
  display: flex; flex-direction: column; gap: 8px;
  padding: 6px 5px;
  background: #0f1216;
  border-right: 1px solid var(--line);
}
.deck-2 .deck-rail { border-right: 0; border-left: 1px solid var(--line); }
.rail-group { display: flex; flex-direction: column; gap: 3px; }
.rail-group.modes { margin-top: auto; }
.rail-btn {
  padding: 4px 2px; border-radius: 3px;
  background: var(--raised); color: var(--muted);
  font-size: 8px; font-weight: 700; letter-spacing: .06em;
  box-shadow: var(--inset);
  transition: background .12s, color .12s;
}
.rail-btn:hover { background: var(--raised-2); color: var(--text-2); }
.rail-btn.is-on { background: #4a1e00; color: #ffcb9a; box-shadow: inset 0 0 0 1px rgba(255,138,31,.55); }
.deck-2 .rail-btn.is-on { background: #0d3550; color: #cfe9ff; box-shadow: inset 0 0 0 1px rgba(74,168,232,.55); }

.deck-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* --- head --- */
.deck-head {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
}
.deck-2 .deck-head { flex-direction: row-reverse; }
.deck-2 .deck-info { text-align: right; }
.deck-2 .deck-sub { justify-content: flex-end; }
.deck-2 .deck-times { text-align: left; }

.deck-no {
  width: 26px; height: 26px; flex: 0 0 auto;
  display: grid; place-items: center; border-radius: 3px;
  font-family: var(--mono); font-size: 14px; font-weight: 700;
  background: var(--raised); color: var(--text-2);
  box-shadow: var(--inset);
}
.deck-1 .deck-no { color: var(--orange); box-shadow: inset 0 0 0 1px rgba(255,138,31,.5); }
.deck-2 .deck-no { color: var(--blue); box-shadow: inset 0 0 0 1px rgba(74,168,232,.5); }

.deck-info { flex: 1; min-width: 0; }
.deck-title {
  font-size: 14px; font-weight: 600; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.deck-sub { display: flex; align-items: center; gap: 8px; font-size: 10.5px; color: var(--muted); }
.deck-artist { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.deck-bpm { font-family: var(--mono); color: var(--text-2); font-variant-numeric: tabular-nums; }

.key-tag {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  padding: 0 5px; border-radius: 2px;
  background: rgba(74,168,232,.14); color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(74,168,232,.25);
}
.key-tag.estimated { color: #9fb3c6; background: rgba(159,179,198,.1); box-shadow: inset 0 0 0 1px rgba(159,179,198,.22); }
.key-tag.match { color: #0d1013; background: var(--green); box-shadow: none; }

.deck-times { text-align: right; flex: 0 0 auto; }
.time-remain {
  font-family: var(--mono); font-size: 19px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; color: #fff;
}
.time-remain.warn { color: var(--red); }
.time-elapsed { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.deck-flags { flex: 0 0 auto; }
.flag {
  font-size: 8px; font-weight: 700; letter-spacing: .12em;
  padding: 2px 6px; border-radius: 2px;
  background: var(--raised); color: #3d454e;
}
.flag.is-on { background: #4a3600; color: var(--yellow); box-shadow: 0 0 10px -3px rgba(255,204,51,.8); }

/* --- stripe --- */
.deck-stripe {
  height: var(--stripe-h); margin: 5px 8px 0;
  position: relative; cursor: pointer;
  background: var(--sunken); border-radius: 2px;
  box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
}
.deck-stripe canvas { display: block; width: 100%; height: 100%; }
.stripe-head {
  position: absolute; top: 0; bottom: 0; width: 2px; background: #fff;
  box-shadow: 0 0 6px rgba(255,255,255,.8); transform: translateX(-1px); pointer-events: none;
}

/* --- waveform --- */
.deck-wave {
  height: var(--wave-h); flex: 0 0 auto;
  margin-top: 5px; position: relative; overflow: hidden; cursor: ew-resize;
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent 40%, rgba(0,0,0,.3)), var(--sunken);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.deck-wave canvas { display: block; width: 100%; height: 100%; }
.wave-playhead {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 2px;
  background: #fff; box-shadow: 0 0 10px rgba(255,255,255,.6);
  transform: translateX(-1px); pointer-events: none;
}
.wave-zoom { position: absolute; right: 6px; top: 6px; display: flex; gap: 2px; z-index: 4; }
.wave-zoom button {
  width: 18px; height: 16px; display: grid; place-items: center;
  font-family: var(--mono); font-size: 11px; line-height: 1;
  background: rgba(12,15,19,.75); color: var(--text-2); border-radius: 2px;
  box-shadow: inset 0 0 0 1px var(--line);
}
.wave-zoom button:hover { color: var(--orange); }

/* --- pads --- */
.deck-pads {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px;
  padding: 6px 8px 4px;
}
.pad {
  height: 26px; border-radius: 3px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--raised), #1a1e24);
  box-shadow: var(--inset), inset 0 0 0 1px var(--line);
  color: var(--muted); overflow: hidden;
  transition: filter .1s, transform .06s;
}
.pad:hover { filter: brightness(1.35); }
.pad:active { transform: translateY(1px); }
.pad.is-set { color: #0d1013; box-shadow: none; }
.pad-k { font-family: var(--mono); font-size: 8px; font-weight: 700; opacity: .8; line-height: 1; }
.pad-l { font-size: 8px; font-weight: 700; letter-spacing: .04em; line-height: 1.2; white-space: nowrap; }
.pad-l.big { font-family: var(--mono); font-size: 12px; }

/* --- lower --- */
.deck-lower {
  flex: 1; min-height: 0;
  display: flex; align-items: stretch; gap: 6px;
  padding: 4px 6px 8px;
}
.deck-2 .deck-lower { flex-direction: row-reverse; }

.loop-panel {
  width: 110px; flex: 0 0 110px;
  display: flex; flex-direction: column; gap: 4px;
  padding: 5px; border-radius: 4px;
  background: linear-gradient(180deg, #141821, #0d1015);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), inset 0 0 0 1px var(--line), 0 1px 2px rgba(0,0,0,.4);
}
.loop-row { display: flex; align-items: center; gap: 4px; }
.loop-size {
  flex: 1; text-align: center;
  font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--text);
}
.loop-unit {
  text-align: center; margin-top: -3px;
  font-size: 7.5px; font-weight: 700; letter-spacing: .12em; color: var(--green);
}
.mini-btn {
  width: 18px; height: 18px; border-radius: 2px;
  display: grid; place-items: center; font-size: 10px;
  background: var(--raised); color: var(--text-2); box-shadow: var(--inset);
}
.mini-btn:hover { background: var(--raised-2); }
.loop-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.jump-row { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.sq-btn {
  height: 20px; border-radius: 2px;
  font-size: 8px; font-weight: 700; letter-spacing: .06em;
  background: var(--raised); color: var(--muted); box-shadow: var(--inset);
}
.sq-btn:hover { background: var(--raised-2); color: var(--text); }
.sq-btn.wide { grid-column: span 2; }
.sq-btn.is-on { background: #14512e; color: #d6ffe6; box-shadow: inset 0 0 0 1px rgba(53,194,106,.6); }

/* --- manual beat-match panel --- */
.manual-panel {
  width: 96px; flex: 0 0 96px;
  display: flex; flex-direction: column; gap: 3px;
  padding: 5px; border-radius: 4px;
  background: linear-gradient(180deg, #141821, #0d1015); box-shadow: inset 0 1px 0 rgba(255,255,255,.04), inset 0 0 0 1px var(--line), 0 1px 2px rgba(0,0,0,.4);
}
.phase-bar {
  height: 10px; position: relative; border-radius: 2px;
  background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
}
.phase-zero { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,.35); }
.phase-fill {
  position: absolute; top: 2px; bottom: 2px; left: 50%; width: 0;
  background: var(--orange); border-radius: 1px;
  transition: none;
}
.phase-bar.locked .phase-fill { background: var(--green); box-shadow: 0 0 8px rgba(53,194,106,.8); }
.phase-bar.locked { box-shadow: inset 0 0 0 1px rgba(53,194,106,.5); }
.phase-bar.idle .phase-fill { background: #333b44; }

.phase-read {
  text-align: center; font-family: var(--mono); font-size: 9px; font-weight: 700;
  color: var(--muted); letter-spacing: .04em; margin: -1px 0 1px;
}
.phase-read.ok { color: var(--green); }
.bpm-trim {
  text-align: center; font-family: var(--mono); font-size: 9px;
  color: var(--text-2); margin-top: 2px;
}

.manual-row { display: flex; gap: 3px; }
.mn-btn {
  flex: 1; height: 19px; border-radius: 2px;
  font-size: 8px; font-weight: 700; letter-spacing: .04em;
  background: var(--raised); color: var(--text-2); box-shadow: var(--inset);
  white-space: nowrap;
}
.mn-btn:hover { background: var(--raised-2); color: var(--text); }
.mn-btn:active { background: var(--orange); color: #2a1200; }
.mn-btn.wide { font-size: 8.5px; }

.transport {
  width: 64px; flex: 0 0 64px;
  display: flex; flex-direction: column; align-items: center;
  /* the CDJ buttons paint a 4px ring outside their box, so the gap has to
     clear 8px between two of them before any visual spacing is left over */
  gap: 14px;
  padding-top: 2px;
}
.t-row { display: flex; gap: 3px; width: 100%; }
.t-btn {
  flex: 1; height: 20px; border-radius: 3px;
  font-size: 8px; font-weight: 700; letter-spacing: .06em;
  background: linear-gradient(180deg, var(--raised), #1a1e24);
  color: var(--text-2);
  box-shadow: var(--inset), 0 1px 0 rgba(0,0,0,.5);
  display: grid; place-items: center;
  transition: filter .1s, transform .06s;
}
.t-btn:hover { filter: brightness(1.3); }
.t-btn:active { transform: translateY(1px); }
.t-btn.setcue {
  width: 100%; flex: 0 0 auto; color: var(--orange);
  box-shadow: var(--inset), inset 0 0 0 1px rgba(255,138,31,.35);
}
.t-btn.setcue:hover { background: linear-gradient(180deg, #ff9a3c, #d76a00); color: #2a1200; }
.t-btn.sync.is-on { background: #0d3550; color: #cfe9ff; box-shadow: inset 0 0 0 1px rgba(74,168,232,.6); }
.t-btn.master.is-on { background: #4a3600; color: var(--yellow); box-shadow: inset 0 0 0 1px rgba(255,204,51,.6); }

/* --- CDJ transport buttons: true circles, brushed cap, lit ring --- */
.jog-btn {
  width: 56px; height: 56px; flex: 0 0 56px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  display: grid; place-items: center;
  position: relative;
  background:
    radial-gradient(circle at 50% 30%, #3c444e 0%, #262c34 55%, #1b2027 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.16),
    inset 0 -3px 8px rgba(0,0,0,.55),
    0 2px 5px rgba(0,0,0,.6),
    0 0 0 3px #10141a,
    0 0 0 4px rgba(255,255,255,.06);
  color: var(--text-2);
  transition: box-shadow .12s, transform .05s, color .12s;
}
.jog-btn::after {
  content: ""; position: absolute; inset: 6px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
  pointer-events: none;
}
.jog-btn:hover { filter: brightness(1.12); }
.jog-btn:active { transform: translateY(1px) scale(.985); }
.jog-btn span { font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.jog-btn svg { width: 22px; height: 22px; fill: currentColor; }

.jog-btn.cue {
  color: var(--orange);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.16),
    inset 0 -3px 8px rgba(0,0,0,.55),
    0 2px 5px rgba(0,0,0,.6),
    0 0 0 3px #10141a,
    0 0 0 4px rgba(255,138,31,.55);
}
.jog-btn.cue:active,
.jog-btn.cue[data-held] {
  color: #2a1200;
  background: radial-gradient(circle at 50% 30%, #ffb765 0%, #ff8a1f 60%, #d76a00 100%);
  box-shadow: 0 0 22px -2px rgba(255,138,31,.85), 0 0 0 3px #10141a, 0 0 0 4px rgba(255,138,31,.8);
}

.jog-btn.play { color: #8fa3b6; }
.jog-btn.play.is-on {
  color: #08210f;
  background: radial-gradient(circle at 50% 30%, #7ce6a3 0%, #35c26a 58%, #1d8a48 100%);
  box-shadow: 0 0 24px -2px rgba(53,194,106,.85), 0 0 0 3px #10141a, 0 0 0 4px rgba(53,194,106,.75);
}

.jog-wrap {
  /* the jog is the centrepiece — it claims all the width the trimmed side
     panels give back */
  flex: 1 1 0; min-width: 0; display: grid; place-items: center;
  cursor: grab;
}
.jog-wrap:active { cursor: grabbing; }
/* square, driven by the wrap width, capped so it can't outgrow the deck height */
.jog { width: 100%; aspect-ratio: 1; max-width: 234px; max-height: 100%; display: block; margin: auto; }

.tempo-panel {
  width: 56px; flex: 0 0 56px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 4px 4px 5px; border-radius: 4px;
  background: linear-gradient(180deg, #141821, #0d1015); box-shadow: inset 0 1px 0 rgba(255,255,255,.04), inset 0 0 0 1px var(--line), 0 1px 2px rgba(0,0,0,.4);
}
.tempo-top { display: flex; flex-direction: column; align-items: center; }
.tempo-val {
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--text-2);
}
.tempo-val.pos { color: var(--orange); }
.tempo-val.neg { color: var(--blue); }
.tempo-body { flex: 1; min-height: 40px; display: flex; gap: 3px; align-items: stretch; }
.tempo-axis {
  writing-mode: vertical-rl; text-orientation: mixed;
  font-size: 7.5px; font-weight: 700; letter-spacing: .22em; color: #4b5560;
  display: grid; place-items: center;
}
.range-row { display: flex; gap: 2px; }
.range-btn {
  flex: 1; height: 15px; border-radius: 2px;
  font-family: var(--mono); font-size: 8px; font-weight: 700;
  background: var(--raised); color: var(--muted); box-shadow: var(--inset);
}
.range-btn.is-on { background: var(--raised-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }

/* ============================ WIDGETS ============================ */

.knob { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.knob-dial {
  --arc: none;
  width: 34px; height: 34px; border-radius: 50%; position: relative;
  cursor: ns-resize; touch-action: none;
  background: var(--arc);
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.55));
}
.knob-sm .knob-dial { width: 26px; height: 26px; }
.knob-dial::before {
  content: ""; position: absolute; inset: 4px; border-radius: 50%;
  background: radial-gradient(circle at 50% 22%, #434c56, #262c34 55%, #12161c);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.16),
    inset 0 -4px 8px rgba(0,0,0,.65),
    0 2px 4px rgba(0,0,0,.75);
}
.knob-sm .knob-dial::before { inset: 3px; }
.knob-ptr {
  position: absolute; left: 50%; top: 5px; width: 2px; height: 9px;
  border-radius: 1px; background: #eef3f8;
  transform-origin: 50% 12px;
  transform: translateX(-50%) rotate(var(--rot, 0deg));
}
.knob-sm .knob-ptr { top: 4px; height: 7px; transform-origin: 50% 9px; }
.knob-name { font-size: 7.5px; font-weight: 700; letter-spacing: .12em; color: var(--muted); }

.vfader { width: 30px; position: relative; cursor: ns-resize; touch-action: none; --fader-accent: var(--orange); }
.vfader-track {
  position: absolute; left: 50%; top: 5px; bottom: 5px; width: 6px;
  transform: translateX(-50%); border-radius: 3px;
  background: linear-gradient(90deg, #05070a, #1a1f25 45%, #05070a);
  box-shadow: var(--sunk), inset 0 0 0 1px rgba(0,0,0,.8);
}
.vfader-ticks { position: absolute; inset: 5px 0; pointer-events: none; }
.vfader-ticks i { position: absolute; left: 2px; right: 2px; height: 1px; background: rgba(255,255,255,.07); }
.vfader-ticks i.mid { left: 0; right: 0; background: rgba(255,255,255,.28); }
.vfader-fill {
  position: absolute; left: 50%; width: 3px; transform: translateX(-50%);
  border-radius: 2px; background: var(--fader-accent); opacity: .8;
  box-shadow: 0 0 8px -1px var(--fader-accent); pointer-events: none;
}
.vfader-cap {
  position: absolute; left: 50%; width: 26px; height: 14px;
  transform: translate(-50%, -50%); border-radius: 2px;
  background: linear-gradient(180deg, #767f89 0%, #3a424b 48%, #262c33 52%, #1a1f24 100%);
  box-shadow: 0 2px 5px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.28);
  pointer-events: none;
}
.vfader-cap::after {
  content: ""; position: absolute; left: 3px; right: 3px; top: 50%; height: 2px;
  transform: translateY(-50%); border-radius: 1px;
  background: var(--fader-accent); box-shadow: 0 0 5px var(--fader-accent);
}

.meter {
  width: 7px; display: flex; flex-direction: column-reverse; gap: 1px;
  padding: 2px 1px; border-radius: 2px;
  background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line);
}
.meter i { flex: 1; border-radius: 1px; background: #1c222a; box-shadow: inset 0 0 0 1px rgba(0,0,0,.3); }
.meter i.on { background: var(--green); box-shadow: 0 0 4px rgba(53,194,106,.55); }
.meter i.on.mid { background: var(--yellow); box-shadow: 0 0 4px rgba(255,204,51,.55); }
.meter i.on.hot { background: var(--red); box-shadow: 0 0 5px rgba(224,72,60,.65); }
.meter.tall { width: 8px; }

/* ============================ MIXER ============================ */

.mixer {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #191d23, #101317);
  border-left: 1px solid var(--line-2); border-right: 1px solid var(--line-2);
}
.mixer-head { display: flex; gap: 2px; padding: 5px 6px 0; }
.mx-tab {
  flex: 1; padding: 4px 0; border-radius: 3px 3px 0 0;
  font-size: 8.5px; font-weight: 700; letter-spacing: .1em;
  background: #0f1216; color: var(--muted);
}
.mx-tab.is-on { background: var(--raised); color: var(--text); }

.mixer-body {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 4px;
  padding: 6px;
}
.channel {
  min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 5px 4px; border-radius: 4px;
  background: #12161b; box-shadow: inset 0 0 0 1px var(--line);
}
.ch-no {
  font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--muted);
}
.ch-1 .ch-no { color: var(--orange); }
.ch-2 .ch-no { color: var(--blue); }

.ch-top { display: flex; gap: 10px; justify-content: center; }
.eq-row { display: flex; align-items: center; gap: 5px; width: 100%; justify-content: center; }
.kill {
  width: 30px; height: 17px; border-radius: 2px;
  font-size: 7px; font-weight: 800; letter-spacing: .08em;
  background: linear-gradient(180deg, #262c33, #1a1f25);
  color: #56606b; box-shadow: var(--inset), inset 0 0 0 1px var(--line);
  transition: background .1s, color .1s;
}
.kill:hover { color: var(--text-2); }
.kill.is-on {
  background: linear-gradient(180deg, #d33c30, #8e1f18);
  color: #fff; box-shadow: inset 0 0 0 1px rgba(255,120,110,.5), 0 0 12px -3px rgba(224,72,60,.9);
}

.color-type {
  font-size: 7px; font-weight: 700; letter-spacing: .1em;
  padding: 2px 8px; border-radius: 2px; align-self: center;
  background: var(--raised); color: var(--violet); box-shadow: var(--inset);
}

/* the channel fader is the control you touch most — give it real travel,
   but let it give some back on a short screen before the page has to scroll */
.ch-bottom { flex: 1; min-height: clamp(118px, 17vh, 150px); display: flex; gap: 8px; justify-content: center; }
.ch-bottom .meter { width: 9px; }
.ch-bottom .vfader { width: 44px; }
.ch-bottom .vfader-track { width: 9px; }
.ch-bottom .vfader-fill { width: 5px; }
.ch-bottom .vfader-cap { width: 40px; height: 20px; }
.ch-bottom .vfader-cap::after { height: 3px; }
.ch-cue {
  width: 100%; height: 18px; border-radius: 2px;
  font-size: 8px; font-weight: 700; letter-spacing: .1em;
  background: var(--raised); color: var(--muted); box-shadow: var(--inset);
}
.ch-cue.is-on { background: #0d3550; color: #cfe9ff; box-shadow: inset 0 0 0 1px rgba(74,168,232,.55); }

.mx-centre {
  width: 62px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 5px 3px; border-radius: 4px;
  background: linear-gradient(180deg, #141821, #0d1015); box-shadow: inset 0 1px 0 rgba(255,255,255,.04), inset 0 0 0 1px var(--line), 0 1px 2px rgba(0,0,0,.4);
}
.clip {
  font-size: 7px; font-weight: 800; letter-spacing: .1em;
  padding: 2px 6px; border-radius: 2px;
  background: var(--raised); color: #3d454e;
}
.clip.is-on { background: var(--red); color: #fff; }
.master-meters { flex: 1; min-height: 30px; display: flex; gap: 3px; }

.xf-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px 10px; }
.xf-side { font-family: var(--mono); font-size: 10px; font-weight: 700; color: var(--muted); }
.xf { flex: 1; height: 22px; position: relative; cursor: ew-resize; touch-action: none; }
.xf-track {
  position: absolute; left: 0; right: 0; top: 50%; height: 6px; transform: translateY(-50%);
  border-radius: 3px; background: linear-gradient(180deg, #05070a, #1a1f25 55%, #05070a);
  box-shadow: var(--sunk);
}
.xf-ticks { position: absolute; inset: 0; pointer-events: none; }
.xf-ticks i { position: absolute; top: 2px; bottom: 2px; width: 1px; background: rgba(255,255,255,.07); }
.xf-ticks i.mid { background: rgba(255,255,255,.3); }
.xf-cap {
  position: absolute; top: 50%; width: 17px; height: 22px;
  transform: translate(-50%, -50%); border-radius: 2px;
  background: linear-gradient(90deg, #767f89, #3a424b 45%, #262c33 55%, #1a1f24);
  box-shadow: 0 2px 6px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.25);
  pointer-events: none;
}
.xf-cap::after {
  content: ""; position: absolute; top: 3px; bottom: 3px; left: 50%; width: 2px;
  transform: translateX(-50%); border-radius: 1px; background: #dfe7ef;
}

/* ============================ FX ROW ============================ */

.fx-row {
  flex: 0 0 auto;
  display: grid; grid-template-columns: 1fr minmax(320px, 1.1fr) 1fr;
  gap: 1px; background: var(--line);
  border-bottom: 1px solid var(--line-2);
}
.fx-host, .auto-host { background: #12161b; display: flex; min-width: 0; }

.fx-bar {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px;
}
.fx-2 { flex-direction: row-reverse; }
.fx-label { font-size: 8px; font-weight: 700; letter-spacing: .14em; color: var(--muted); }
.fx-select {
  width: 96px; padding: 4px 6px; border-radius: 3px;
  background: var(--raised); color: var(--text);
  font-size: 10px; font-weight: 600; box-shadow: var(--inset);
}
.fx-div { display: flex; align-items: center; gap: 3px; }
.fx-div-val {
  width: 34px; text-align: center;
  font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--text-2);
}
.fx-knobs { display: flex; gap: 8px; }
.fx-on {
  margin-left: auto; padding: 8px 14px; border-radius: 3px;
  font-size: 10px; font-weight: 800; letter-spacing: .1em;
  background: linear-gradient(180deg, var(--raised), #1a1e24);
  color: var(--muted); box-shadow: var(--inset);
}
.fx-2 .fx-on { margin-left: 0; margin-right: auto; }
.fx-on.is-on {
  background: linear-gradient(180deg, #ff9a3c, #d76a00);
  color: #2a1200; box-shadow: 0 0 18px -4px rgba(255,138,31,.9);
}

/* ============================ AUTOPILOT ============================ */

.autopilot {
  flex: 1; min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  align-items: center; gap: 4px 10px;
  padding: 5px 12px;
  background: linear-gradient(180deg, #171c22, #0f1317);
}
.auto-power {
  grid-row: span 2;
  display: flex; align-items: center; gap: 7px;
  padding: 8px 12px; border-radius: 4px;
  background: linear-gradient(180deg, var(--raised), #1a1e24);
  font-size: 10px; font-weight: 800; letter-spacing: .12em; color: var(--muted);
  box-shadow: var(--inset);
}
.auto-power i {
  width: 9px; height: 9px; border-radius: 50%;
  background: #333b44; box-shadow: inset 0 0 0 1px rgba(0,0,0,.5);
}
.auto-power.is-on {
  background: linear-gradient(180deg, #2b7d4e, #175734); color: #eaffef;
  box-shadow: 0 0 20px -5px rgba(53,194,106,.9);
}
.auto-power.is-on i { background: #7dffb0; box-shadow: 0 0 8px rgba(125,255,176,.9); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.auto-readout { min-width: 0; }
.auto-line1 { font-size: 11px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auto-line1 em { font-style: normal; font-family: var(--mono); color: var(--blue); font-size: 10px; margin-left: 6px; }
.auto-line2 { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.auto-bar {
  grid-column: 2; height: 3px; border-radius: 2px;
  background: #20262d; overflow: hidden;
}
.auto-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--orange), var(--green)); transition: width .1s linear; }

.auto-controls { grid-row: span 2; display: flex; align-items: center; gap: 5px; }
.auto-tech {
  padding: 5px 7px; border-radius: 3px; max-width: 150px;
  background: var(--raised); color: var(--text-2); font-size: 10px; box-shadow: var(--inset);
}
.auto-btn {
  padding: 6px 10px; border-radius: 3px;
  font-size: 9px; font-weight: 700; letter-spacing: .08em;
  background: var(--raised); color: var(--text-2); box-shadow: var(--inset);
}
.auto-btn:hover { background: var(--raised-2); color: var(--text); }
.auto-btn.danger { color: #ffb0aa; }
.auto-btn.danger:hover { background: #6b1f19; color: #fff; }

/* ============================ BROWSER ============================ */

.browser-host { flex: 1; min-height: var(--browser-min, 200px); display: flex; background: var(--panel); }
.browser { flex: 1; min-width: 0; display: flex; }

.browser-side {
  width: 168px; flex: 0 0 168px;
  display: flex; flex-direction: column; gap: 8px;
  padding: 8px; background: #0f1216;
  border-right: 1px solid var(--line);
}
.source-box { display: flex; flex-direction: column; gap: 4px; }
.src-btn {
  padding: 7px 8px; border-radius: 3px; text-align: left;
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  background: var(--raised); color: var(--text-2); box-shadow: var(--inset);
}
.src-btn:hover { background: var(--raised-2); color: var(--text); }
.src-btn.primary { background: linear-gradient(180deg, #ff9a3c, #d76a00); color: #2a1200; }
.src-btn.primary:hover { filter: brightness(1.08); }
.folder-line { font-size: 9px; color: var(--muted); padding: 2px; word-break: break-all; }

.browser-nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 3px;
  font-size: 11px; color: var(--text-2); text-align: left;
}
.nav-item i { font-style: normal; color: var(--muted); width: 12px; }
.nav-item:hover { background: rgba(255,255,255,.04); }
.nav-item.is-on { background: rgba(255,138,31,.12); color: var(--orange); }
.nav-item.is-on i { color: var(--orange); }

.browser-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.browser-bar {
  height: 30px; flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 0 10px; border-bottom: 1px solid var(--line);
}
.browser-search {
  flex: 1; max-width: 320px; height: 20px; padding: 0 8px; border-radius: 3px;
  background: var(--sunken); color: var(--text); font-size: 11px;
  box-shadow: inset 0 0 0 1px var(--line);
}
.browser-search::placeholder { color: #4d5761; }
.import-progress { font-size: 10px; color: var(--orange); display: none; }
.import-progress.is-on { display: block; }
.browser-count { margin-left: auto; font-size: 10px; color: var(--muted); }

.browser-scroll { flex: 1; min-height: 0; overflow: auto; }
.tracks { width: 100%; border-collapse: collapse; }
.tracks thead th {
  position: sticky; top: 0; z-index: 2; background: #171b20;
  text-align: left; padding: 5px 8px;
  font-size: 9px; font-weight: 700; letter-spacing: .1em; color: var(--muted);
  border-bottom: 1px solid var(--line-2);
}
.tracks td {
  padding: 3px 8px; border-bottom: 1px solid rgba(255,255,255,.035);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tracks tbody tr { cursor: grab; }
.tracks tbody tr:hover { background: rgba(255,255,255,.045); }
.tracks tbody tr.on-a { background: rgba(255,138,31,.10); box-shadow: inset 2px 0 0 var(--orange); }
.tracks tbody tr.on-b { background: rgba(74,168,232,.10); box-shadow: inset 2px 0 0 var(--blue); }

.c-art { width: 30px; }
.c-prev { width: 160px; }
.c-artist { width: 20%; }
.c-key, .c-bpm, .c-time { width: 66px; }
.c-energy { width: 70px; }
.c-score { width: 54px; }
.c-load { width: 96px; }

.art-img, .art-ph {
  width: 22px; height: 22px; border-radius: 2px; display: block;
  object-fit: cover;
}
.art-ph {
  display: grid; place-items: center; font-size: 10px; font-weight: 700;
  color: #5b6672; background: linear-gradient(135deg, #2a3138, #171b20);
}
.prev-cv { display: block; width: 150px; height: 22px; opacity: .9; }

.t-title { color: var(--text); font-weight: 500; }
.t-mix, .t-artist { color: var(--muted); }
.t-num { font-family: var(--mono); font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.energy { display: flex; gap: 2px; align-items: center; }
.energy i { width: 4px; height: 9px; border-radius: 1px; background: #262d34; }
.energy i.on { background: var(--orange); }

.score {
  display: inline-block; min-width: 26px; text-align: center;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  padding: 1px 4px; border-radius: 2px;
  background: #262d34; color: var(--muted);
}
.score.perfect { background: var(--green); color: #06210f; }
.score.good { background: #2d6a45; color: #d8ffe8; }
.score.ok { background: #4a3f1a; color: #ffe9a8; }
.score.poor { background: #402326; color: #ffb6b0; }

.load-btns { display: flex; gap: 3px; opacity: 0; transition: opacity .1s; }
tr:hover .load-btns { opacity: 1; }
.load-btn {
  font-family: var(--mono); font-size: 9px; font-weight: 700;
  padding: 2px 7px; border-radius: 2px;
  background: var(--raised); color: var(--text-2); box-shadow: var(--inset);
}
.load-btn.a:hover { background: var(--orange); color: #2a1200; }
.load-btn.b:hover { background: var(--blue); color: #06263a; }
.load-btn.q { color: var(--green); }
.load-btn.q:hover { background: var(--green); color: #06210f; }

/* ============================ MIDI ============================ */

.midi-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: none; align-items: center; justify-content: center;
  background: rgba(6, 8, 10, .72);
  backdrop-filter: blur(3px);
}
.midi-overlay.is-open { display: flex; }

.midi-panel {
  width: min(780px, 92vw); max-height: 86vh;
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px 18px 18px;
  background: linear-gradient(180deg, #1b2027, #12161b);
  border-radius: 6px;
  box-shadow: 0 24px 60px -20px #000, inset 0 0 0 1px var(--line-2);
}
.midi-head { display: flex; align-items: center; justify-content: space-between; }
.midi-head h2 { font-size: 13px; font-weight: 700; letter-spacing: .16em; color: var(--text); }
.midi-close { font-size: 14px; color: var(--muted); padding: 2px 6px; }
.midi-close:hover { color: var(--text); }

.midi-conn { display: flex; align-items: center; gap: 12px; }
.midi-status { font-size: 11px; color: var(--muted); flex: 1; min-width: 0; }
.midi-status.ok { color: var(--green); }
.midi-status.ok b { color: var(--text); }
.midi-status.err { color: var(--red); }

.midi-row { display: flex; gap: 8px; align-items: center; }
.midi-select {
  flex: 1; padding: 7px 9px; border-radius: 3px; font-size: 11px;
  background: var(--raised); color: var(--text); box-shadow: var(--inset);
}
.midi-note { font-size: 10.5px; color: var(--muted); line-height: 1.5; }

.midi-btn {
  padding: 7px 12px; border-radius: 3px;
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  background: var(--raised); color: var(--text-2); box-shadow: var(--inset);
  white-space: nowrap;
}
.midi-btn:hover { background: var(--raised-2); color: var(--text); }
.midi-btn.primary { background: linear-gradient(180deg, #ff9a3c, #d76a00); color: #2a1200; }
.midi-btn.primary:hover { filter: brightness(1.08); }
.midi-btn.danger { color: #ffb0aa; }
.midi-btn.danger:hover { background: #6b1f19; color: #fff; }

.midi-walk {
  display: none; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 4px;
  background: rgba(255,138,31,.10);
  box-shadow: inset 0 0 0 1px rgba(255,138,31,.45);
}
.midi-walk.is-on { display: flex; }
.walk-text { flex: 1; font-size: 12px; color: var(--text); }
.walk-text b { color: var(--orange); }
.walk-text span { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }

.midi-list {
  flex: 1; min-height: 120px; overflow-y: auto;
  border-radius: 4px; background: var(--sunken);
  box-shadow: inset 0 0 0 1px var(--line);
}
.midi-mapping {
  display: grid; grid-template-columns: 1fr 66px 108px minmax(0, 210px) auto auto;
  align-items: center; gap: 8px;
  padding: 5px 10px;
  border-bottom: 1px solid rgba(255,255,255,.035);
  font-size: 11px;
}
.map-mode { display: flex; gap: 4px; align-items: center; min-width: 0; }
.map-select {
  flex: 1; min-width: 0; padding: 2px 4px; border-radius: 2px;
  font-size: 10px; background: var(--raised); color: var(--text-2);
  box-shadow: var(--inset);
}
.map-select.narrow { flex: 0 0 74px; }
.map-btn.on { background: var(--orange); color: #2a1200; }
.midi-mapping.is-bound { background: rgba(53,194,106,.06); }
.map-label { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.midi-mapping.is-bound .map-label { color: var(--text); }
.map-type { font-size: 9px; letter-spacing: .08em; color: #4d5761; text-transform: uppercase; }
.map-ctrl { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.midi-mapping.is-bound .map-ctrl { color: var(--green); }
.map-btn {
  font-size: 9px; font-weight: 700; letter-spacing: .08em;
  padding: 3px 8px; border-radius: 2px;
  background: var(--raised); color: var(--text-2); box-shadow: var(--inset);
}
.map-btn:hover { background: var(--orange); color: #2a1200; }
.map-btn.clear:hover { background: var(--red); color: #fff; }

/* ============================ STATUS ============================ */

.statusbar {
  height: var(--status-h); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; background: #0f1216; border-top: 1px solid var(--line);
  font-size: 10px; color: var(--muted);
}
.sb-left, .sb-right { display: flex; align-items: center; gap: 14px; }
.sb-brand { font-weight: 700; letter-spacing: .12em; color: #4d5761; }
.sb-msg { color: var(--text-2); font-family: var(--mono); }
.sb-led { width: 7px; height: 7px; border-radius: 50%; background: #2b323a; }
.sb-led.on { background: var(--green); box-shadow: 0 0 7px rgba(53,194,106,.8); }

/* ============================ RESPONSIVE ============================ */

/* the deck switcher is a phone-only control; hidden everywhere else */
.deck-switch { display: none; }

@media (max-width: 1500px) {
  :root { --mixer-w: 224px; }
  .c-prev { width: 0; padding: 0; }
  .c-prev, th.c-prev { display: none; }
  .loop-panel { width: 92px; flex-basis: 92px; }
}

/* laptop / landscape iPad */
@media (max-width: 1280px) {
  :root { --wave-h: clamp(74px, 10vh, 104px); }
  .deck-rail { width: 52px; flex-basis: 52px; }
  .c-artist, .c-energy { display: none; }
  .fx-knobs .knob:nth-child(2), .fx-knobs .knob:nth-child(3) { display: none; }
  .sb-right .sb-item:first-child { display: none; }
}

/* portrait iPad / small laptop: tighter still, top-bar selectors thin out */
@media (max-width: 1024px) {
  :root { --mixer-w: 196px; --stage-min: 400px; }
  .tb-sel { display: none; }
  .tb-sel.wide { display: block; }
  .deck-head { gap: 7px; }
  .manual-panel { width: 104px; flex-basis: 104px; }
}

/* ------------------------------- PHONE: one deck at a time ------------- */

@media (max-width: 767px) {
  :root {
    --mixer-w: 100%;
    --wave-h: clamp(96px, 15vh, 150px);
    --browser-min: 260px;
    --stage-min: 0;
  }

  /* the whole page flows and scrolls */
  html, body { height: auto; overflow: visible; }
  body { min-height: 100%; }

  .topbar { height: auto; flex-wrap: wrap; gap: 8px 12px; padding: 8px 12px; }
  .tb-left, .tb-right { flex: 1 1 auto; }
  .tb-centre { order: 3; flex-basis: 100%; }
  .master-clock { width: 100%; justify-content: center; }
  .tb-sel { display: none; }
  .wall-clock { display: none; }

  /* deck switcher: a sticky segmented control under the top bar */
  .deck-switch {
    display: flex; position: sticky; top: 0; z-index: 40;
    gap: 4px; padding: 6px 10px;
    background: linear-gradient(180deg, #1b2027, #12161b);
    border-bottom: 1px solid var(--line-2);
  }
  .ds-btn {
    flex: 1; padding: 12px 0; border-radius: 4px;
    font-size: 12px; font-weight: 800; letter-spacing: .12em;
    background: var(--raised); color: var(--muted); box-shadow: var(--inset);
  }
  .ds-btn.is-on[data-deck="A"] { background: #4a1e00; color: #ffcb9a; box-shadow: inset 0 0 0 1px rgba(255,138,31,.55); }
  .ds-btn.is-on[data-deck="B"] { background: #0d3550; color: #cfe9ff; box-shadow: inset 0 0 0 1px rgba(74,168,232,.55); }

  /* stage becomes a single column; the inactive deck is removed */
  .stage {
    display: flex; flex-direction: column;
    min-height: 0;
  }
  .mixer-host { order: 2; }
  body.show-a #deck-2,
  body.show-b #deck-1 { display: none; }
  body.show-a #deck-1,
  body.show-b #deck-2 { order: 1; }

  /* the deck itself: rail on top as a horizontal strip, body below */
  .deck { flex-direction: column; }
  .deck-2 { flex-direction: column; }
  .deck-rail {
    width: 100%; flex-basis: auto; flex-direction: row; flex-wrap: wrap;
    border-right: 0; border-bottom: 1px solid var(--line);
    gap: 4px; padding: 6px;
  }
  .deck-2 .deck-rail { border-left: 0; }
  .rail-group { flex-direction: row; flex: 1; }
  .rail-group.modes { margin-top: 0; }
  .rail-btn { flex: 1; padding: 9px 4px; font-size: 9px; }

  /* the control cluster wraps instead of overflowing */
  .deck-lower { flex-wrap: wrap; justify-content: center; gap: 10px; }
  .deck-2 .deck-lower { flex-direction: row; flex-wrap: wrap; }
  .jog-wrap { flex-basis: 100%; order: -1; }
  .jog { max-width: 216px; max-height: 216px; }
  .loop-panel, .manual-panel, .tempo-panel { width: auto; flex: 1 1 44%; }
  .transport { width: 100%; flex-direction: row; justify-content: center; gap: 16px; }
  .t-row { width: auto; }

  /* mixer: a full-width strip, its two channels side by side */
  .mixer { border-left: 0; border-right: 0; border-top: 1px solid var(--line-2); }
  .mixer-body { padding: 8px; }
  .ch-bottom { min-height: 130px; }

  /* pads and hit targets get bigger for fingers */
  .pad { height: 40px; }
  .deck-pads { gap: 4px; padding: 8px; }
  .t-btn { min-height: 34px; }

  /* FX row + autopilot stack */
  .fx-row { grid-template-columns: 1fr; }
  .fx-host, .auto-host { border-top: 1px solid var(--line); }
  body.show-a #fx-2, body.show-b #fx-1 { display: none; }

  /* library: full width, always scrollable at the bottom */
  .browser-side { width: 128px; flex-basis: 128px; }
  .c-bpm, .c-key { display: table-cell; }
  .c-time { display: none; }
  .statusbar { height: auto; padding: 6px 12px; }
  .sb-right { display: none; }
}

/* very small phones */
@media (max-width: 400px) {
  .browser-side { display: none; }
  .rail-group.modes { flex-basis: 100%; }
}

/* ============================================================
   Free-demo lock (web build only — body.demo)
   ============================================================ */

.demo .demo-locked { position: relative; cursor: pointer; }
.demo .demo-locked > * { filter: grayscale(1); opacity: .34; pointer-events: none; }
.demo .demo-locked::after {
  content: "🔒 PRO"; position: absolute; top: 5px; right: 5px; z-index: 8;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-weight: 700;
  font-size: 9px; letter-spacing: .12em; color: #ffb35b;
  background: rgba(16, 12, 8, .9); border: 1px solid rgba(255, 138, 31, .55);
  border-radius: 5px; padding: 3px 7px; pointer-events: none; transition: background .15s, color .15s;
}
.demo .demo-locked:hover::after { background: rgba(255, 138, 31, .95); color: #1a1000; }

.demo .demo-lockbtn { filter: grayscale(1); opacity: .55; position: relative; }
.demo .demo-lockbtn::after { content: " 🔒"; font-size: 10px; }

.demo-banner {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 90;
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 17px;
  background: rgba(14, 17, 22, .92); border: 1px solid rgba(255, 138, 31, .42); border-radius: 999px;
  color: #e6edf4; font-size: 12.5px; text-decoration: none;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 12px 34px -14px rgba(0, 0, 0, .85); transition: border-color .15s, transform .15s;
}
.demo-banner:hover { border-color: rgba(255, 138, 31, .85); transform: translateX(-50%) translateY(-1px); }
.demo-banner .dot { color: #35c26a; font-size: 9px; }
.demo-banner b { color: #ff8a1f; font-weight: 700; }

.demo-modal {
  position: fixed; inset: 0; z-index: 300; display: none; align-items: center; justify-content: center;
  background: rgba(4, 5, 7, .74); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.demo-modal.show { display: flex; }
.demo-card {
  width: 404px; max-width: 90vw; text-align: center; padding: 34px 30px; border-radius: 18px;
  background: linear-gradient(180deg, #141a22, #0e1218); border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 44px 110px -44px rgba(0, 0, 0, .92);
}
.demo-lockicon { font-size: 30px; margin-bottom: 12px; }
.demo-kicker { font-family: ui-monospace, monospace; font-size: 11px; letter-spacing: .22em; color: #ff8a1f; margin-bottom: 8px; }
.demo-card h2 { font-size: 22px; font-weight: 800; margin: 0 0 8px; color: #f3f7fb; }
.demo-msg { color: rgba(229, 236, 244, .66); font-size: 14px; line-height: 1.55; margin: 0 0 22px; }
.demo-buy {
  display: block; padding: 13px; border-radius: 10px; text-decoration: none; font-weight: 700; color: #2a1200;
  background: linear-gradient(180deg, #ffb35b, #ff8a1f); box-shadow: 0 8px 26px -10px rgba(255, 138, 31, .7);
}
.demo-buy:hover { filter: brightness(1.06); }
.demo-close { margin-top: 12px; background: none; border: 0; color: rgba(229, 236, 244, .5); font-size: 13px; cursor: pointer; }
.demo-close:hover { color: #e6edf4; }

/* ============================================================
   Mobile demo — hide the locked pro tools so a phone shows a tidy,
   usable teaser (waveform + jog + Cue/Play/Sync + mixer + library).
   Scoped to .demo, so the paid desktop build is never affected.
   ============================================================ */
@media (max-width: 767px) {
  .demo .deck-pads,
  .demo .rail-group.modes,
  .demo .loop-panel,
  .demo .manual-panel,
  .demo .fx-row { display: none !important; }

  /* give the jog + transport room now that the clutter is gone */
  .demo .jog { max-width: 240px; max-height: 240px; }
  .demo .deck-lower { gap: 14px; padding-bottom: 8px; }

  /* keep the demo banner clear of the controls */
  .demo-banner { bottom: 14px; font-size: 11.5px; padding: 8px 14px; }
}

/* record button — turns red and pulses while capturing the master mix */
#btn-rec.is-rec {
  color: #ff5545;
  box-shadow: inset 0 0 0 1px rgba(255, 60, 50, .65), 0 0 12px -2px rgba(255, 60, 50, .5);
  animation: recpulse 1.4s ease-in-out infinite;
}
@keyframes recpulse { 0%, 100% { opacity: 1; } 50% { opacity: .62; } }
