/* ============================================================
   6oal DJ — console theme
   Dark neon studio palette, laid out like DJ hardware.
   Self-contained: this page loads no other stylesheet.
   ============================================================ */

:root {
  --bg: #0b0e14;
  --panel: #151a24;
  --raised: #1d2432;
  --sunken: #10141d;
  --line: #2a3346;
  --line-bright: #3b4763;
  --text: #e8ecf4;
  --dim: #8a94a8;
  --accent: #00e5ff;
  --accent2: #ff3d81;
  --good: #3dff8a;
  --warn: #ffb020;
  --danger: #ff4757;
  --accent-soft: rgba(0, 229, 255, 0.14);
  --accent2-soft: rgba(255, 61, 129, 0.14);
  --radius: 10px;
  --radius-sm: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --deck-hue: var(--accent);
}

* { box-sizing: border-box; }
html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(0, 229, 255, 0.07), transparent 60%),
    radial-gradient(900px 500px at 0% 110%, rgba(255, 61, 129, 0.06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

::selection { background: rgba(0, 229, 255, 0.3); }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--line-bright); }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

a { color: var(--accent); }
h2, h3 { margin: 0 0 10px; line-height: 1.2; }
code { font-family: var(--mono); font-size: .92em; background: var(--sunken); padding: 1px 5px; border-radius: 4px; }

/* ---------------- tooltips ---------------- */
[data-tip] { position: relative; }
[data-tip]:hover::after,
[data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 90;
  left: 50%;
  top: calc(100% + 7px);
  transform: translateX(-50%);
  background: #05070c;
  color: var(--text);
  border: 1px solid var(--line-bright);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  width: max-content;
  max-width: 240px;
  white-space: normal;
  text-align: left;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .6);
}
@media (hover: none) { [data-tip]:hover::after { display: none; } }

/* ---------------- buttons ---------------- */
button { font-family: inherit; font-size: inherit; color: inherit; touch-action: manipulation; }

.btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-bright);
  background: linear-gradient(180deg, var(--raised), #171d29);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: #fff; }
.btn.small { min-height: 34px; padding: 0 11px; font-size: 13px; }
.btn.tiny { min-height: 28px; padding: 0 9px; font-size: 12px; border-radius: 5px; }
.btn.primary { background: linear-gradient(180deg, #00b6cc, #007e91); border-color: #00d6f0; color: #04222a; }
.btn.primary:hover { color: #001318; box-shadow: 0 0 14px rgba(0, 229, 255, .35); }
.btn.danger { border-color: var(--danger); color: #ffd9dd; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--dim); }
.btn[disabled], .icon-btn[disabled], .pad[disabled], select[disabled], input[disabled] {
  opacity: .42;
  cursor: not-allowed;
  filter: saturate(.3);
}

.icon-btn {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--raised);
  cursor: pointer;
  font-weight: 700;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn.tiny { width: 26px; height: 26px; font-size: 15px; line-height: 1; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.seg-btn {
  min-height: 34px; padding: 0 12px;
  background: var(--panel); border: 0; border-right: 1px solid var(--line);
  color: var(--dim); font-size: 13px; font-weight: 600; cursor: pointer;
}
.seg-btn:last-child { border-right: 0; }
.seg-btn.active { background: var(--accent-soft); color: var(--accent); }
.seg-btn:hover { color: var(--text); }

input[type="search"], input[type="text"], select {
  min-height: 34px;
  background: var(--sunken);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 9px;
  font-family: inherit;
  font-size: 13px;
}
input[type="search"]:focus, select:focus { border-color: var(--accent); }

.mini-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--dim); cursor: pointer; min-height: 28px; }
.mini-check input { accent-color: var(--accent); width: 15px; height: 15px; }
.mini-check:hover { color: var(--text); }

.pill {
  display: inline-flex; align-items: center;
  height: 26px; padding: 0 10px;
  border-radius: 13px; border: 1px solid var(--line);
  background: var(--panel); color: var(--dim);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill.warn { border-color: var(--warn); color: var(--warn); cursor: pointer; }
.pill.ok { border-color: var(--good); color: var(--good); }

.tag {
  display: inline-block; margin-left: 7px;
  padding: 1px 7px; border-radius: 4px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11px; font-weight: 700; font-family: var(--mono);
}

/* ================= header ================= */
#djtop {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 10px 14px;
  padding: 8px 14px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: rgba(11, 14, 20, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); }
.brand-mark img { display: block; border-radius: 8px; }
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: .3px; }
.brand-name em { font-style: normal; color: var(--accent); font-weight: 600; }
.tb-group { display: flex; align-items: center; gap: 8px; }
.tb-apps { margin-left: auto; }
.applink {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 0 10px;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--panel); color: var(--dim);
  font-size: 13px; font-weight: 600; text-decoration: none;
}
.applink:hover { color: var(--text); border-color: var(--accent); }

/* ================= layout ================= */
#djmain {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  align-items: start;
}
body.lib-hidden #djmain { grid-template-columns: minmax(0, 1fr); }
body.lib-hidden #library { display: none; }

#console {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-width: 0;
}
.deck-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

/* ================= deck ================= */
.deck {
  --deck-hue: var(--accent);
  background: linear-gradient(180deg, var(--panel), #11151e);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  min-width: 0;
  display: flex; flex-direction: column; gap: 8px;
  position: relative;
}
.deck.focused { border-color: var(--deck-hue); box-shadow: 0 0 0 1px var(--deck-hue), 0 0 22px -6px var(--deck-hue); }
.deck.deck-b, .deck.deck-d { --deck-hue: var(--accent2); }
.deck.dragover { border-color: var(--good); box-shadow: 0 0 0 2px var(--good); }
.deck.empty .deck-wrap-needs-track { opacity: .5; }

.deck-head { display: flex; align-items: center; gap: 9px; min-width: 0; }
.deck-badge {
  width: 34px; height: 34px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 8px;
  border: 1px solid var(--deck-hue);
  background: color-mix(in srgb, var(--deck-hue) 14%, transparent);
  color: var(--deck-hue);
  font-weight: 800; font-size: 16px;
  cursor: pointer;
}
.deck-titles { min-width: 0; flex: 1 1 auto; }
.deck-title {
  font-weight: 700; font-size: 15px; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.deck-artist { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-readouts { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.readout { text-align: right; font-family: var(--mono); line-height: 1.1; }
.readout b { display: block; font-size: 16px; font-weight: 700; color: var(--text); }
.readout span { display: block; font-size: 9px; letter-spacing: .09em; color: var(--dim); text-transform: uppercase; }
.readout.key b { color: var(--accent); }
.readout.key.compat b { color: var(--good); }
.readout.bpm b { color: var(--deck-hue); }
.deck-eject { width: 30px; height: 30px; }

.deck-status { font-size: 11px; color: var(--warn); min-height: 0; }
.deck-status:empty { display: none; }
.deck-status button { background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 0 0 0 4px; font-size: 11px; }

/* waveforms */
.wave-wrap { position: relative; border-radius: var(--radius-sm); overflow: hidden; background: var(--sunken); border: 1px solid var(--line); }
canvas.wave { display: block; width: 100%; height: 108px; touch-action: none; cursor: ew-resize; }
canvas.ovw { display: block; width: 100%; height: 40px; touch-action: none; cursor: pointer; }
.wave-zoom { position: absolute; right: 6px; top: 6px; display: flex; gap: 4px; }
.wave-zoom button {
  width: 26px; height: 26px; border-radius: 5px;
  border: 1px solid var(--line-bright); background: rgba(5, 7, 12, .8);
  color: var(--dim); cursor: pointer; font-size: 14px; line-height: 1;
}
.wave-zoom button:hover { color: var(--accent); border-color: var(--accent); }
.time-row { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; color: var(--dim); padding: 0 2px; }
.time-row .rem { color: var(--warn); }

/* deck body split */
.deck-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.deck-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.deck-strip { display: flex; gap: 8px; align-items: flex-start; }

/* transport */
.transport { display: flex; gap: 6px; flex-wrap: wrap; }
.tbtn {
  min-width: 46px; min-height: 44px; padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-bright);
  background: linear-gradient(180deg, var(--raised), #171d29);
  color: var(--text); font-weight: 700; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  cursor: pointer;
}
.tbtn:hover { border-color: var(--deck-hue); }
.tbtn.on { background: color-mix(in srgb, var(--deck-hue) 22%, var(--raised)); border-color: var(--deck-hue); color: #fff; box-shadow: 0 0 12px -3px var(--deck-hue); }
.tbtn.play.on { background: rgba(61, 255, 138, .2); border-color: var(--good); color: var(--good); }
.tbtn.cue.on { background: rgba(255, 176, 32, .2); border-color: var(--warn); color: var(--warn); }
.tbtn.master.on { background: rgba(255, 176, 32, .18); border-color: var(--warn); color: var(--warn); }
.tbtn svg { display: block; }

/* hot cues */
.pads { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.pad {
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--sunken);
  color: var(--dim);
  font-size: 11px; font-weight: 700; font-family: var(--mono);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow: hidden; padding: 2px;
}
.pad .pad-n { font-size: 13px; }
.pad .pad-t { font-size: 9px; opacity: .8; }
.pad.set { background: color-mix(in srgb, var(--deck-hue) 20%, var(--sunken)); border-color: var(--deck-hue); color: #fff; }
.pad.set:hover { box-shadow: 0 0 12px -4px var(--deck-hue); }
.pad:hover { border-color: var(--line-bright); }
.pad-mode { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pad-mode span { font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: var(--dim); }

/* loops */
.loop-row { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.lbtn {
  min-height: 34px; min-width: 38px; padding: 0 7px;
  border-radius: 5px; border: 1px solid var(--line);
  background: var(--sunken); color: var(--dim);
  font-size: 11px; font-weight: 700; font-family: var(--mono); cursor: pointer;
}
.lbtn:hover { border-color: var(--line-bright); color: var(--text); }
.lbtn.on { background: rgba(0, 229, 255, .18); border-color: var(--accent); color: var(--accent); }
.lbtn.roll.on { background: rgba(255, 61, 129, .2); border-color: var(--accent2); color: var(--accent2); }
.row-label { font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: var(--dim); margin-right: 2px; }

/* knobs */
.knob-bank { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.knob-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 54px; }
.knob {
  --k: .5;
  position: relative;
  width: 46px; height: 46px; border-radius: 50%;
  background: conic-gradient(from 225deg,
    var(--knob-col, var(--accent)) calc(var(--k) * 270deg),
    rgba(255, 255, 255, .09) calc(var(--k) * 270deg) 270deg,
    transparent 270deg);
  cursor: ns-resize;
  touch-action: none;
  flex: 0 0 auto;
}
.knob::before {
  content: ''; position: absolute; inset: 5px; border-radius: 50%;
  background: linear-gradient(180deg, var(--raised), #151a24);
  border: 1px solid var(--line-bright);
}
.knob::after {
  content: ''; position: absolute; left: 50%; top: 8px;
  width: 2px; height: 13px; margin-left: -1px;
  background: var(--text); border-radius: 1px;
  transform-origin: 50% 15px;
  transform: rotate(calc(var(--k) * 270deg - 135deg));
}
.knob:hover::before { border-color: var(--knob-col, var(--accent)); }
.knob.killed { --knob-col: var(--danger); }
.knob-label { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.knob-val { font-size: 10px; font-family: var(--mono); color: var(--text); }

/* vertical faders */
.vfader { position: relative; width: 46px; height: 168px; touch-action: none; cursor: ns-resize; flex: 0 0 auto; }
.vfader .vf-track {
  position: absolute; left: 50%; top: 8px; bottom: 8px; width: 8px; margin-left: -4px;
  background: var(--sunken); border: 1px solid var(--line); border-radius: 4px;
}
.vfader .vf-fill {
  position: absolute; left: 50%; width: 6px; margin-left: -3px; bottom: 9px;
  border-radius: 3px;
  background: linear-gradient(0deg, var(--deck-hue), color-mix(in srgb, var(--deck-hue) 40%, transparent));
  height: calc(var(--k, 0) * (100% - 18px));
}
.vfader .vf-cap {
  position: absolute; left: 3px; right: 3px; height: 22px; border-radius: 4px;
  background: linear-gradient(180deg, #39435a, #202737);
  border: 1px solid var(--line-bright);
  bottom: calc(8px + var(--k, 0) * (100% - 18px) - 11px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .5);
}
.vfader .vf-cap::after { content: ''; position: absolute; left: 5px; right: 5px; top: 50%; height: 2px; margin-top: -1px; background: var(--dim); border-radius: 1px; }
.vfader:hover .vf-cap { border-color: var(--deck-hue); }
.vfader.centered .vf-fill { display: none; }
.fader-col { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.fader-col .fc-label { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.fader-col .fc-val { font-size: 11px; font-family: var(--mono); color: var(--text); }
.fader-col .fc-val.big { font-size: 13px; font-weight: 700; color: var(--deck-hue); }

.meter { width: 16px; height: 168px; display: block; border-radius: 3px; background: var(--sunken); border: 1px solid var(--line); }
.vu { display: flex; }
.vu canvas { border-radius: 4px; background: var(--sunken); border: 1px solid var(--line); }

/* ================= mixer ================= */
#mixer {
  background: linear-gradient(180deg, #171d29, #10141d);
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  padding: 10px;
  display: flex; flex-direction: column; gap: 10px;
  min-width: 0;
}
.mx-block { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; background: rgba(0, 0, 0, .18); }
.mx-title { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin-bottom: 7px; }
.mx-master-row { display: flex; align-items: center; gap: 12px; justify-content: center; }
.mx-reduction { height: 4px; border-radius: 2px; background: var(--sunken); margin-top: 7px; overflow: hidden; }
.mx-reduction i { display: block; height: 100%; width: 0; background: var(--warn); }
.mx-sliders { display: flex; flex-direction: column; gap: 5px; margin-top: 7px; }
.hs { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--dim); }
.hs span { width: 26px; flex: 0 0 auto; }
.hs input { flex: 1 1 auto; min-width: 0; }
#mixer select { width: 100%; }
#cue-device { margin-top: 5px; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  height: 26px; background: transparent; cursor: pointer; touch-action: pan-y;
}
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--sunken); border: 1px solid var(--line); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--sunken); border: 1px solid var(--line); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; margin-top: -7px; border-radius: 50%;
  background: linear-gradient(180deg, #43506c, #232b3c);
  border: 1px solid var(--line-bright);
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line-bright);
  background: linear-gradient(180deg, #43506c, #232b3c);
}
input[type="range"]:hover::-webkit-slider-thumb { border-color: var(--accent); }

.xfader { width: 100%; height: 44px; }
.xfader::-webkit-slider-runnable-track { height: 10px; border-radius: 5px; background: linear-gradient(90deg, var(--accent-soft), var(--sunken) 45%, var(--sunken) 55%, var(--accent2-soft)); }
.xfader::-moz-range-track { height: 10px; border-radius: 5px; background: linear-gradient(90deg, var(--accent-soft), var(--sunken) 45%, var(--sunken) 55%, var(--accent2-soft)); }
.xfader::-webkit-slider-thumb { width: 22px; height: 34px; margin-top: -12px; border-radius: 5px; background: linear-gradient(180deg, #4a5771, #232b3c); }
.xfader::-moz-range-thumb { width: 22px; height: 34px; border-radius: 5px; background: linear-gradient(180deg, #4a5771, #232b3c); }
.xf-row { display: flex; gap: 6px; align-items: center; }
.xf-row select { flex: 1 1 auto; min-width: 0; }

.fx-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-bottom: 8px; }
.fx-pick button {
  min-height: 32px; border-radius: 5px; border: 1px solid var(--line);
  background: var(--sunken); color: var(--dim); font-size: 11px; font-weight: 700; cursor: pointer;
  text-transform: capitalize; padding: 0 4px;
}
.fx-pick button.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.fx-pick button.wet { border-color: var(--accent2); color: var(--accent2); }
.fx-pick button.active.wet { background: var(--accent2-soft); }
.fx-params { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 8px; min-height: 60px; }
.fx-params .fxsel { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 74px; }
.fx-params .fxsel select { width: 100%; min-height: 30px; font-size: 11px; }

.rec-btn {
  width: 100%; min-height: 52px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--danger);
  background: linear-gradient(180deg, #2a1620, #1b0f16);
  color: #ffd9dd; font-weight: 800; font-size: 14px;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  cursor: pointer;
}
.rec-btn:hover { box-shadow: 0 0 16px -4px var(--danger); }
.rec-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--danger); flex: 0 0 auto; }
.rec-btn.recording { background: linear-gradient(180deg, #5a1622, #38101a); color: #fff; }
.rec-btn.recording .rec-dot { animation: blink 1s steps(2, start) infinite; }
@keyframes blink { 50% { opacity: .15; } }
.rec-time { text-align: center; font-family: var(--mono); font-size: 20px; font-weight: 700; margin-top: 6px; }
.rec-note { text-align: center; font-size: 10px; color: var(--dim); line-height: 1.3; }

/* ================= library ================= */
#library {
  background: linear-gradient(180deg, var(--panel), #11151e);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  min-width: 0;
  position: sticky; top: 62px;
  max-height: calc(100vh - 76px);
  overflow: hidden;
}
.lib-head { padding: 9px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 7px; }
.lib-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.lib-actions .btn { flex: 1 1 auto; }
.lib-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.lib-body { flex: 1 1 auto; display: flex; min-height: 0; }

.crates { width: 104px; flex: 0 0 auto; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.crates-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 4px 9px; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.crate-list { list-style: none; margin: 0; padding: 0 4px 4px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.crate-list li {
  padding: 7px 7px; border-radius: 5px; font-size: 12px; color: var(--dim);
  cursor: pointer; min-height: 32px; display: flex; align-items: center; gap: 4px;
  overflow: hidden;
}
.crate-list li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crate-list li:hover { background: var(--raised); color: var(--text); }
.crate-list li.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.crate-list li.dragover { outline: 1px dashed var(--good); color: var(--good); }
.crate-list li .cn { margin-left: auto; font-size: 10px; opacity: .7; font-family: var(--mono); }
.crates-foot { display: flex; gap: 4px; padding: 5px; border-top: 1px solid var(--line); }
.crates-foot .btn { flex: 1 1 auto; padding: 0 4px; }

.tracks { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.track-head { display: grid; grid-template-columns: minmax(0, 1fr) 46px 40px 46px; border-bottom: 1px solid var(--line); }
.th { background: none; border: 0; padding: 6px 4px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); cursor: pointer; text-align: left; }
.th:hover { color: var(--accent); }
.th.sorted { color: var(--accent); }
.th.th-bpm, .th.th-key, .th.th-len { text-align: right; }

.track-list { flex: 1 1 auto; overflow-y: auto; min-height: 120px; }
.trow {
  display: grid; grid-template-columns: minmax(0, 1fr) 46px 40px 46px;
  align-items: center;
  padding: 5px 4px; border-bottom: 1px solid rgba(42, 51, 70, .5);
  cursor: grab; min-height: 46px;
}
.trow:hover { background: var(--raised); }
.trow.sel { background: var(--accent-soft); }
.trow.compat { box-shadow: inset 3px 0 0 var(--good); }
.trow.relink { opacity: .55; }
.trow.busy { background: rgba(255, 176, 32, .08); }
.tr-name { min-width: 0; }
.tr-t { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-a { font-size: 10.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-bpm, .tr-key, .tr-len { font-family: var(--mono); font-size: 11.5px; text-align: right; padding-right: 3px; }
.tr-key { color: var(--accent); }
.trow.compat .tr-key { color: var(--good); }
.tr-bpm.weak { color: var(--warn); }
.tr-flag { font-size: 9px; color: var(--warn); }
.tr-load { display: flex; gap: 3px; padding-top: 3px; }
.tr-load button {
  min-width: 26px; min-height: 26px; border-radius: 4px;
  border: 1px solid var(--line); background: var(--sunken);
  color: var(--dim); font-size: 10px; font-weight: 700; cursor: pointer;
}
.tr-load button:hover { border-color: var(--accent); color: var(--accent); }
.tr-load button.del:hover { border-color: var(--danger); color: var(--danger); }
.trow .tr-load { visibility: hidden; }
.trow:hover .tr-load, .trow.sel .tr-load { visibility: visible; }
@media (hover: none) { .trow .tr-load { visibility: visible; } }

.lib-empty { padding: 14px; }
.lib-empty[hidden] { display: none; }
.drop-target {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 22px 14px; text-align: center;
  border: 2px dashed var(--line-bright); border-radius: var(--radius);
  color: var(--dim);
}
.drop-target strong { color: var(--text); font-size: 14px; }
.drop-target span { font-size: 11.5px; }
.drop-note { color: var(--good); }
.drop-target.dragover { border-color: var(--good); color: var(--good); background: rgba(61, 255, 138, .06); }

.analysis-bar { padding: 7px 9px; border-top: 1px solid var(--line); background: rgba(0, 0, 0, .25); }
.ab-text { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--dim); }
.ab-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-stage { color: var(--accent); flex: 0 0 auto; }
.ab-track { height: 5px; border-radius: 3px; background: var(--sunken); margin: 5px 0 3px; overflow: hidden; }
.ab-track i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .12s linear; }
.ab-count { font-size: 10px; color: var(--dim); font-family: var(--mono); }

/* ================= overlays ================= */
.dropzone {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(4, 8, 14, .88);
  display: grid; place-items: center;
  pointer-events: none;
}
.dropzone[hidden] { display: none; }
.dz-inner {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 40px 54px; border: 3px dashed var(--accent); border-radius: 18px;
  color: var(--accent); text-align: center;
}
.dz-inner strong { font-size: 22px; color: var(--text); }
.dz-inner span { font-size: 13px; color: var(--dim); }

.modal-root { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal-root[hidden] { display: none; }
.modal-back { position: fixed; inset: 0; background: rgba(4, 8, 14, .8); backdrop-filter: blur(3px); }
.modal {
  position: relative;
  width: min(640px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: linear-gradient(180deg, var(--panel), #11151e);
  border: 1px solid var(--line-bright);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .7);
}
.modal.wide { width: min(820px, 100%); }
.modal[hidden] { display: none; }
.modal h2 { font-size: 21px; }
.modal .lede { color: var(--dim); font-size: 14px; margin: 0 0 14px; }
.steps { margin: 0 0 14px; padding-left: 20px; font-size: 13.5px; }
.steps li { margin-bottom: 7px; }
.steps em { color: var(--accent); font-style: normal; font-weight: 600; }
.note { border-radius: var(--radius-sm); padding: 11px 13px; font-size: 13px; margin-bottom: 12px; line-height: 1.5; }
.note p { margin: 7px 0 0; }
.note-good { border: 1px solid rgba(61, 255, 138, .4); background: rgba(61, 255, 138, .07); }
.note-good strong { color: var(--good); }
.note-warn { border: 1px solid rgba(255, 176, 32, .45); background: rgba(255, 176, 32, .07); }
.note-warn strong { color: var(--warn); }
.note-fix { color: var(--dim); }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.tips { font-size: 13px; color: var(--dim); padding-left: 20px; margin: 0; }
.tips li { margin-bottom: 7px; }
.tips strong { color: var(--text); }
.relink-result { font-size: 12.5px; color: var(--dim); margin-top: 10px; }

.keygrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; margin-bottom: 16px; }
.keyrow { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; }
.keyrow kbd {
  font-family: var(--mono); font-size: 11px;
  background: var(--sunken); border: 1px solid var(--line-bright);
  border-bottom-width: 2px; border-radius: 4px; padding: 2px 6px;
  color: var(--text); white-space: nowrap; flex: 0 0 auto;
}
.keyrow span { color: var(--dim); }

#toast-root { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 7px; align-items: center; pointer-events: none; }
.toast {
  background: #05070c; border: 1px solid var(--line-bright); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 9px 15px; font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6); max-width: 88vw;
}
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--good); }

/* ================= footer ================= */
#sitefoot {
  margin-top: auto;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 5px 9px; justify-content: center; align-items: center;
  font-size: 11.5px; color: var(--dim); text-align: center;
}
#sitefoot a { color: var(--dim); text-decoration: none; }
#sitefoot a:hover { color: var(--accent); }
.foot-sep { opacity: .4; }
.foot-tm em { font-style: italic; }
.foot-motto { color: var(--accent); }

/* ================= responsive ================= */

/* 4-deck mode: two decks stacked per side */
body.decks-2 .deck[data-deck="3"], body.decks-2 .deck[data-deck="4"] { display: none; }

@media (max-width: 1400px) {
  #console { grid-template-columns: minmax(0, 1fr) 220px minmax(0, 1fr); }
  .vfader { height: 140px; }
  .meter { height: 140px; }
}

@media (max-width: 1180px) {
  #djmain { grid-template-columns: minmax(0, 1fr); }
  #library { position: static; max-height: 46vh; }
  .lib-body { min-height: 200px; }
}

@media (max-width: 900px) {
  #console { grid-template-columns: minmax(0, 1fr); }
  #mixer { order: 3; flex-direction: row; flex-wrap: wrap; }
  #mixer .mx-block { flex: 1 1 190px; }
  .deck-col { order: 1; }
  #deck-right { order: 2; }
}

/* phone: single deck at a time */
@media (max-width: 720px) {
  #djtop { gap: 7px 9px; padding: 7px 9px; }
  .brand-name { font-size: 16px; }
  .tb-apps .applink-txt { display: none; }
  .tb-status { order: 9; }
  #djmain { padding: 8px; gap: 8px; }
  #console { gap: 8px; }
  .deck-body { grid-template-columns: minmax(0, 1fr); }
  .deck-strip { justify-content: space-around; }
  .vfader { height: 132px; }
  .meter { height: 132px; }
  canvas.wave { height: 92px; }
  .pads { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #library { max-height: 52vh; }
  .crates { width: 88px; }
  /* Side by side, Export + Import are wider than an 88px column and spill over
     the track list. Stack them instead. */
  .crates-foot { flex-direction: column; }
  .crates-foot .btn { padding: 0 6px; font-size: 11px; min-width: 0; }
  #mixer .mx-block { flex: 1 1 100%; }
  body.phone .deck { display: none; }
  body.phone .deck.showing { display: flex; }
  .modal { padding: 15px; border-radius: 12px; }
  .modal h2 { font-size: 18px; }
  #sitefoot { font-size: 10.5px; }
}

@media (max-width: 420px) {
  .lib-actions .btn { flex: 1 1 100%; }
  .knob-wrap { width: 48px; }
  .knob { width: 42px; height: 42px; }
  .knob::after { transform-origin: 50% 13px; height: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
