/* Tokens de las reglas de diseño (modo noche por defecto; modo día con data-theme="dia") */
:root {
  --bg: #0a0b0d;
  --panel: #111317;
  --panel-2: #181b20;
  --panel-3: #23272e;
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.17);
  --track: rgba(255, 255, 255, 0.1);
  --text: #eef0f3;
  --muted: #9aa1ab;
  --on: #0a0b0d;
  --a: #4c9aff;
  --b: #ff9447;
  --deck-c: #9b7bff;
  --deck-d: #2bb8cc;
  --accent: #3ddb9a;
  --accent-2: #4c9aff;
  --cue: #ff9447;
  --play: #3ddb9a;
  --sync: #4c9aff;
  --warn: #f4c84b;
  --hot: #ff5d6c;
  --wave-bg: #111317;
  --w-lo: #2b6cff;
  --w-mid: #ff9b33;
  --w-hi: #ffffff;
  --grid: rgba(255, 255, 255, 0.16);
  --grid-strong: rgba(255, 255, 255, 0.5);
  --radius: 14px;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
:root[data-theme='dia'] {
  --bg: #eceef1;
  --panel: #ffffff;
  --panel-2: #f4f5f7;
  --panel-3: #e6e9ed;
  --line: rgba(16, 24, 40, 0.11);
  --line-2: rgba(16, 24, 40, 0.2);
  --track: rgba(16, 24, 40, 0.12);
  --text: #12151a;
  --muted: #56606c;
  --on: #ffffff;
  --a: #1d6fe0;
  --b: #b84e0e;
  --deck-c: #6a4bd6;
  --deck-d: #0c7a8a;
  --accent: #0b7d52;
  --accent-2: #1d6fe0;
  --cue: #b84e0e;
  --play: #0b7d52;
  --sync: #1d6fe0;
  --warn: #a86d00;
  --hot: #d93a4c;
  --wave-bg: #ffffff;
  --w-lo: #1e5ae0;
  --w-mid: #e8820f;
  --w-hi: #10151c;
  --grid: rgba(16, 24, 40, 0.14);
  --grid-strong: rgba(16, 24, 40, 0.42);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.35 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  transition: background-color 0.5s, color 0.5s;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

/* ---------- Barra superior ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.5px;
}
.brand span {
  color: var(--accent);
}
.status {
  display: flex;
  gap: 6px;
  flex: 1;
  flex-wrap: wrap;
}
.pill {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pill.ok {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
}
.top-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.btn:hover {
  border-color: var(--muted);
}
.btn.small {
  padding: 3px 9px;
  font-size: 12px;
}
.btn.active {
  border-color: var(--accent);
  color: var(--accent);
}
.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ---------- Ondas ---------- */
.waves {
  display: grid;
  gap: 4px;
}
.wave {
  width: 100%;
  height: clamp(64px, 11vh, 120px);
  border-radius: 8px;
  display: block;
  touch-action: none;
  cursor: grab;
}

/* ---------- Consola: deck | mixer | deck ---------- */
.console {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
}
.deck,
.mixer,
.library {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  min-width: 0;
}

.deck-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.deck-letter {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--panel-2);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--accent-2);
  flex: none;
}
.track-info {
  flex: 1;
  min-width: 0;
}
.track-info .title {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-info .artist {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bpm {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.bpm b {
  font-size: 22px;
  display: block;
  line-height: 1;
}
.bpm small {
  color: var(--muted);
  font-size: 10px;
}
.overview {
  width: 100%;
  height: 42px;
  margin-top: 8px;
  border-radius: 6px;
  display: block;
  cursor: pointer;
  touch-action: none;
}
.times {
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 8px;
}
.times .pitch {
  color: var(--text);
}

.deck-body {
  display: flex;
  gap: 10px;
}
.deck-left .deck-body {
  flex-direction: row-reverse;
}
.pads {
  flex: 1;
  display: grid;
  gap: 6px;
  min-width: 0;
}
.hotcues,
.loops,
.transport {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.loops,
.transport {
  grid-template-columns: 1fr 2fr 1fr;
}
.transport {
  grid-template-columns: 1fr 1fr 1fr;
}

.pad {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  font-weight: 700;
  cursor: pointer;
  touch-action: none;
  transition: background 0.06s, border-color 0.06s, box-shadow 0.06s;
}
.pad:active {
  transform: translateY(1px);
}
.pad.small {
  min-height: 28px;
  font-size: 12px;
  font-weight: 600;
}
.transport .pad {
  min-height: 56px;
  font-size: 15px;
}
.pad.cue {
  color: var(--cue);
}
.pad.cue.on {
  border-color: var(--cue);
}
.pad.play {
  color: var(--play);
}
.pad.play.on {
  background: color-mix(in srgb, var(--play) 25%, var(--panel-2));
  border-color: var(--play);
  box-shadow: 0 0 12px color-mix(in srgb, var(--play) 40%, transparent);
}
.pad.sync {
  color: var(--sync);
}
.pad.hotcue {
  color: var(--hc);
}
.pad.hotcue.on {
  background: color-mix(in srgb, var(--hc) 30%, var(--panel-2));
  border-color: var(--hc);
  color: #fff;
}
.shift .pad.hotcue.on {
  outline: 2px dashed var(--hc);
}
.pad.loop.on {
  background: color-mix(in srgb, var(--accent) 25%, var(--panel-2));
  border-color: var(--accent);
}
.pad.pfl.on {
  background: color-mix(in srgb, var(--cue) 30%, var(--panel-2));
  border-color: var(--cue);
}

.tempo-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 52px;
}
.tempo-col .pad {
  width: 100%;
}

/* ---------- Faders ---------- */
.fader {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  touch-action: none;
  cursor: pointer;
  margin: 0;
}
.fader.vertical {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 34px;
  height: 140px;
}
.fader.tempo {
  height: 170px;
  flex: 1;
}
.fader.horizontal {
  width: 100%;
  height: 34px;
}
.fader::-webkit-slider-runnable-track {
  background: #0a0c10;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.fader.vertical::-webkit-slider-runnable-track {
  width: 6px;
  margin: 0 auto;
}
.fader.horizontal::-webkit-slider-runnable-track {
  height: 6px;
}
.fader::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(#d9dce3, #9aa0ad);
  border-radius: 4px;
  border: 1px solid #000;
}
.fader.vertical::-webkit-slider-thumb {
  width: 30px;
  height: 18px;
  margin-left: -13px;
}
.fader.horizontal::-webkit-slider-thumb {
  width: 18px;
  height: 30px;
  margin-top: -13px;
}
.fader::-moz-range-track {
  background: #0a0c10;
  border: 1px solid var(--line);
  border-radius: 4px;
  width: 6px;
  height: 6px;
}
.fader::-moz-range-thumb {
  background: linear-gradient(#d9dce3, #9aa0ad);
  border-radius: 4px;
  border: 1px solid #000;
  width: 28px;
  height: 18px;
}

/* ---------- Mixer ---------- */
.mixer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.strips {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.strip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 64px;
}
.strip.center {
  justify-content: flex-start;
  gap: 8px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 0 8px;
  width: 76px;
}
.strip .pfl {
  width: 100%;
  min-height: 32px;
}
.fader-row {
  display: flex;
  gap: 4px;
  align-items: stretch;
}
.xfader-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.knob {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.knob-dial {
  --size: 36px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #3a404d, #1a1d24 70%);
  border: 1px solid #000;
  position: relative;
  touch-action: none;
  cursor: ns-resize;
  transform: rotate(var(--angle, 0deg));
  box-shadow: 0 0 0 3px var(--panel), 0 0 0 4px var(--line);
}
.knob-ind {
  position: absolute;
  left: 50%;
  top: 3px;
  width: 3px;
  height: 11px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--text);
}
.knob-label {
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.4px;
  margin-top: 4px;
}

.meter {
  width: 8px;
  height: 140px;
  background: #0a0c10;
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.meter-fill {
  position: absolute;
  inset: 0;
  transform-origin: bottom;
  transform: scaleY(0);
  background: linear-gradient(to top, #3ddc97 0 65%, #ffd166 65% 88%, #ff4d6d 88%);
}
.strip.center .meter {
  height: 60px;
  width: 14px;
}
.meter.clip {
  border-color: #ff4d6d;
}

/* ---------- Biblioteca ---------- */
.library {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 180px;
}
.library-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.library-bar input[type='search'] {
  flex: 1;
  min-width: 140px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  -webkit-user-select: text;
  user-select: text;
}
.table-wrap {
  overflow: auto;
  flex: 1;
  max-height: 34vh;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  background: var(--panel);
  padding: 4px 8px;
}
td {
  padding: 5px 8px;
  border-top: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}
tbody tr {
  cursor: pointer;
}
tbody tr:hover {
  background: var(--panel-2);
}
tr.selected {
  background: color-mix(in srgb, var(--accent-2) 18%, transparent) !important;
}
td.load {
  display: flex;
  gap: 4px;
}
.empty {
  color: var(--muted);
  text-align: center;
  padding: 24px 12px;
}

/* ---------- Ajustes ---------- */
dialog {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  width: min(900px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 16px 18px;
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dialog-head h2 {
  margin: 0;
  font-size: 18px;
}
dialog h3 {
  margin: 18px 0 8px;
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.grid2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.grid2 label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}
.grid2 select,
.grid2 input[type='number'],
.map-actions select {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
}
label.check {
  flex-direction: row !important;
  align-items: center;
  gap: 6px;
}
.note {
  color: var(--muted);
  font-size: 12px;
}
.map-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.mapping {
  max-height: 40vh;
}
.map-actions.wrap {
  flex-wrap: wrap;
}
.mixxx-status {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 0 0 8px;
}
.mixxx-status.ok {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  color: var(--accent);
}
dialog a {
  color: var(--accent-2);
}
.mapping td {
  max-width: none;
}
.mapping td.type,
.mapping td.binding {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}
.mapping tr.learning {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
}
.mapping td:last-child {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}
.monitor {
  background: #0a0c10;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  height: 120px;
  overflow: auto;
  font-size: 11px;
  color: var(--muted);
  margin: 0;
  -webkit-user-select: text;
  user-select: text;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  z-index: 10;
  max-width: calc(100vw - 32px);
  width: max-content;
}

/* ---------- Pantallas estrechas (iPad vertical, móvil) ---------- */
@media (max-width: 900px) {
  .console {
    grid-template-columns: 1fr 1fr;
  }
  .mixer {
    grid-column: 1 / -1;
    order: 3;
  }
}
@media (max-width: 600px) {
  #setDecks .srow:has(> select) {
    flex-wrap: wrap;
  }
  #setDecks .srow:has(> select) > .g {
    flex-basis: 100%;
  }
  #setDecks .srow > select.btn {
    width: 100%;
    max-width: 100%;
  }
  body {
    padding-left: 16px;
    padding-right: 16px;
  }
  .console {
    grid-template-columns: minmax(0, 1fr);
  }
  .strips {
    gap: 4px;
  }
  .strip {
    width: 56px;
  }
  .top-actions .btn {
    padding: 6px 9px;
  }
}

/* Vista previa de las pantallas del controlador (320×240 por deck) */
.screens-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}
.screens-preview canvas {
  width: 320px;
  height: 240px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

/* Opciones del mapeo de Mixxx activo */
.options {
  margin-top: 12px;
}
.options summary {
  cursor: pointer;
  font-weight: 600;
}
.options-group {
  margin: 10px 0 0 12px;
}
.options-group > label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.option-row {
  justify-content: space-between;
}
.option-row input,
.option-row select {
  width: 140px;
}

/* ---------- Capa del diseño nuevo: color por deck, transporte, controles y tema día ---------- */
#deckA {
  --deck: var(--a);
}
#deckB {
  --deck: var(--b);
}
.brand span {
  color: var(--muted);
  font-weight: 400;
}
.deck-letter {
  background: var(--deck);
  color: var(--on);
  border-radius: 10px;
}
.bpm b {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.04em;
  color: color-mix(in srgb, var(--deck) 82%, var(--text));
}
.times,
td:nth-child(4),
td:nth-child(5),
.loop-size {
  font-family: var(--mono);
}
.btn,
.pad {
  border-radius: 10px;
  color: var(--muted);
  transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.5s, border-color 0.5s, color 0.5s;
}
.btn:hover,
.pad:hover {
  background: var(--panel-3);
  color: var(--text);
}
.btn:active,
.pad:active {
  transform: scale(0.95);
}
.btn.active {
  background: color-mix(in srgb, var(--accent-2) 14%, var(--panel-2));
}
/* Transporte: play, CUE y SYNC de 36 px, con el loop en la misma fila */
.transport {
  display: flex;
  align-items: center;
  gap: 6px;
}
.transport > .pad {
  min-height: 36px;
  padding: 0 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.transport > .pad.play {
  width: 54px;
  padding: 0;
  display: grid;
  place-items: center;
}
.play-ico {
  width: 0;
  height: 0;
  border-left: 10px solid currentColor;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}
.pad.play.on .play-ico {
  width: 10px;
  height: 12px;
  border: 0;
  border-left: 3px solid currentColor;
  border-right: 3px solid currentColor;
}
.pad.play.on {
  background: var(--play);
  border-color: transparent;
  color: var(--on);
  box-shadow: none;
}
.pad.cue.on {
  border-color: var(--line-2);
  color: var(--text);
}
.pad.sync:active,
.pad.sync.on {
  color: color-mix(in srgb, var(--sync) 80%, var(--text));
}
.transport > .loops {
  margin-left: auto;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 11px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.transport > .loops .pad {
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  background: none;
  font-size: 11px;
  font-weight: 600;
}
.transport > .loops .pad.loop.on {
  background: color-mix(in srgb, var(--accent) 16%, var(--panel));
  color: var(--accent);
}
/* Pads de hot cue: 8 en dos filas, con su color */
.hotcues {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.pad.hotcue {
  min-height: 40px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}
.pad.hotcue.on {
  background: color-mix(in srgb, var(--hc) 14%, var(--panel-2));
  border-color: color-mix(in srgb, var(--hc) 42%, transparent);
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--hc);
}
.pad.pfl {
  display: grid;
  place-items: center;
}
.pad.pfl.on {
  background: color-mix(in srgb, var(--deck, var(--accent-2)) 16%, var(--panel-2));
  border-color: color-mix(in srgb, var(--accent-2) 45%, transparent);
  color: var(--accent-2);
}
.ico {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Faders, perillas y vúmetros con los tokens (valen para los dos temas) */
.fader::-webkit-slider-runnable-track {
  background: var(--track);
  border: 0;
}
.fader::-moz-range-track {
  background: var(--track);
  border: 0;
}
.fader::-webkit-slider-thumb {
  background: var(--panel-3);
  border: 1px solid var(--line-2);
  border-radius: 6px;
}
.fader::-moz-range-thumb {
  background: var(--panel-3);
  border: 1px solid var(--line-2);
  border-radius: 6px;
}
.knob-dial {
  background: var(--panel-3);
  border: 1px solid var(--line-2);
  box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--track);
}
.knob-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.meter {
  width: 5px;
  background: var(--track);
  border: 0;
}
.meter-fill {
  background: linear-gradient(to top, var(--accent) 0 68%, var(--warn) 68% 88%, var(--hot) 88%);
}
.meter.clip {
  outline: 1px solid var(--hot);
}
.wave,
.overview {
  border-radius: 12px;
}
.wave {
  border: 1px solid var(--line);
}

/* Mezclador compacto: cada canal lleva las perillas en columna y el fader al lado */
.strips {
  align-items: stretch;
}
.strip:not(.center) {
  flex-direction: row;
  align-items: stretch;
  width: auto;
  gap: 10px;
}
.strip:not(.center):last-child {
  flex-direction: row-reverse;
}
.strip-knobs {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.strip-fader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.strip-fader .pfl {
  width: 34px;
  min-height: 32px;
}
.strip-fader .fader-row {
  flex: 1;
}
.strip-fader .fader.vertical,
.strip-fader .meter {
  height: auto;
  min-height: 150px;
}
.strip.center {
  justify-content: space-between;
}
.console {
  align-items: start;
}
.mixer {
  align-self: stretch;
}

/* ---------- Cabina configurable: elementos, tamaños y modo de edición ---------- */
.lbl {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.master {
  display: flex;
  align-items: center;
  gap: 10px;
}
.master b {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.03em;
  min-width: 68px;
}
.beats {
  display: flex;
  gap: 5px;
}
.beats i {
  width: 14px;
  height: 4px;
  border-radius: 2px;
  background: var(--track);
  transition: background-color 0.25s;
}
.beats i.on {
  background: var(--text);
  transition: none;
}
.top-actions {
  align-items: center;
}
/* En pantallas grandes la cabina ocupa la ventana y la lista de pistas se desplaza por dentro */
/* Cabina a pantalla fija (sin desplazar): ordenador y también tableta en vertical. */
@media (min-width: 901px), (min-width: 700px) and (min-height: 700px) {
  body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
  .library {
    min-height: 0;
  }
  .table-wrap {
    max-height: none;
    min-height: 0;
  }
}
.wave {
  height: 94px;
}
.ondas-m .wave {
  height: 60px;
}
.ondas-s .wave {
  height: 36px;
}
.no-ondas .waves,
.no-mix .mixer,
.no-lib .library {
  display: none;
}
.no-mix .console {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.library {
  flex: none;
}
.grow-lib .library {
  flex: 1;
}
.lib-s .table-wrap,
.libfold .table-wrap {
  display: none;
}
.lib-s .library-bar,
.libfold .library-bar {
  margin-bottom: 0;
}
.grow-ondas .waves {
  flex: 1;
  min-height: 0;
  grid-auto-rows: minmax(0, 1fr);
}
.grow-ondas .wave {
  height: 100%;
}
/* Tamaños del deck */
.decks-m .tempo-col,
.decks-s .tempo-col,
.decks-s .times,
.decks-s .hotcues .pad:nth-child(n + 5) {
  display: none;
}
.decks-s .overview {
  height: 28px;
}
.decks-s .pad.hotcue {
  min-height: 34px;
}
/* Tamaños del mezclador */
.mix-m .mixer .only-l,
.mix-s .mixer .only-l,
.mix-s .mixer .not-s {
  display: none;
}
.mix-s .strip-fader .fader.vertical,
.mix-s .strip-fader .meter {
  min-height: 96px;
}
.mix-s .strip.center {
  border: 0;
  width: auto;
  padding: 0 4px;
}
/* Modo Esencial: transporte más grande y sin loop */
.v-esencial .transport > .loops {
  display: none;
}
.v-esencial .transport > .pad {
  min-height: 44px;
  padding: 0 20px;
  font-size: 12px;
}
.v-esencial .transport > .pad.play {
  width: 72px;
  padding: 0;
}
/* Modo de edición: cada elemento se atenúa y muestra su barra (tamaño y quitar) */
.mod {
  position: relative;
}
.mtool {
  display: none;
}
.editing .mod {
  outline: 1.5px dashed color-mix(in srgb, var(--a) 70%, transparent);
  outline-offset: 2px;
}
.editing .mod > :not(.mtool) {
  opacity: 0.26;
  pointer-events: none;
}
.editing .mtool {
  position: absolute;
  z-index: 6;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border-radius: 13px;
  background: var(--panel);
  border: 1px solid color-mix(in srgb, var(--a) 65%, transparent);
  box-shadow: 0 14px 34px -14px rgba(0, 0, 0, 0.7);
  white-space: nowrap;
}
.mtool-n {
  height: 26px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--a);
  color: var(--on);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  line-height: 26px;
}
.seg {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.seg button {
  height: 22px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}
.seg button.on {
  background: var(--panel);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
}
.seg button:disabled {
  opacity: 0.3;
  cursor: default;
}
.view-tray {
  flex: none;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px 10px 18px;
  border-radius: 16px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
}
.view-tray input {
  width: 170px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  -webkit-user-select: text;
  user-select: text;
}
.view-tray { max-width: calc(100% - 16px); }
.view-order-editor {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  flex-basis: 100%;
  min-width: 0;
}
.view-order-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 8px;
  flex: 1 1 320px;
  min-width: 0;
}
.view-order-group > .lbl { grid-column: 1 / -1; }
.view-order-items, .view-order-actions { display: flex; gap: 4px; min-width: 0; }
.view-order-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  touch-action: none;
  cursor: grab;
}
.view-order-item.on { border-color: var(--accent); }
.view-order-grip { opacity: .55; flex: none; }
.view-order-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.view-order-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.view-order-item.dragging { opacity: .5; cursor: grabbing; }
.view-order-item.drop-target { box-shadow: inset 0 0 0 2px var(--accent); }
.view-order-actions .btn { min-width: 32px; min-height: 32px; padding: 4px 8px; }
.view-order-actions .btn:disabled { opacity: .35; }
.view-order-ghost {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  padding: 8px 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 5px 20px #0005;
}
.view-order-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.n2.custom-deck-order #mixer .ch-letter { display: grid; }
@media (pointer: coarse), (max-width: 600px) {
  .view-order-item, .view-order-actions .btn { min-height: 44px; }
  .view-order-actions .btn { min-width: 44px; }
}
@media (max-width: 600px) {
  .view-order-group > .lbl { grid-column: 1; grid-row: 1; align-self: center; }
  .view-order-actions { grid-column: 2; grid-row: 1; }
  .view-order-items { grid-column: 1 / -1; grid-row: 2; }
  .view-order-item { padding: 5px 6px; font-size: 10px; }
}
.tray-sep {
  width: 1px;
  height: 26px;
  background: var(--line-2);
}
.btn.primary {
  background: var(--a);
  border-color: transparent;
  color: var(--on);
}

/* ---------- Cuatro decks: A y C a la izquierda, B y D a la derecha, mezclador C · A · máster · B · D ---------- */
#deckC,
.ch-c {
  --deck: var(--deck-c);
}
#deckD,
.ch-d {
  --deck: var(--deck-d);
}
.ch-a {
  --deck: var(--a);
}
.ch-b {
  --deck: var(--b);
}
#deckA {
  grid-area: var(--deck-slot, a);
}
#deckB {
  grid-area: var(--deck-slot, b);
}
#deckC {
  grid-area: var(--deck-slot, c);
}
#deckD {
  grid-area: var(--deck-slot, d);
}
#mixer {
  grid-area: mix;
}
.console {
  grid-template-areas: 'a mix b';
}
.n4 .console {
  grid-template-areas: 'a mix b' 'c mix d';
}
.no-mix .console {
  grid-template-areas: 'a b';
}
.n4.no-mix .console {
  grid-template-areas: 'a b' 'c d';
}
.n2 #deckC,
.n2 #deckD,
.n2 .ch-c,
.n2 .ch-d,
.n2 .only-4 {
  display: none;
}
.strip:not(.center):last-child {
  flex-direction: row;
}
.strip.right {
  flex-direction: row-reverse !important;
}
.xf-l,
.xf-r {
  display: flex;
  gap: 6px;
}
.xf-l i,
.xf-r i {
  font-style: normal;
}
.n4 .wave {
  height: 56px;
}
.n4.ondas-m .wave {
  height: 40px;
}
.n4.ondas-s .wave {
  height: 26px;
}
.n4.grow-ondas .wave {
  height: 100%;
}
.transport {
  flex-wrap: wrap;
}
@media (max-width: 900px) {
  .console {
    grid-template-areas: 'a b' 'mix mix';
  }
  .n4 .console {
    grid-template-areas: 'a b' 'c d' 'mix mix';
  }
  .no-mix .console {
    grid-template-areas: 'a b';
  }
  .n4.no-mix .console {
    grid-template-areas: 'a b' 'c d';
  }
}
@media (max-width: 600px) {
  .console,
  .no-mix .console {
    grid-template-columns: minmax(0, 1fr);
  }
  .console {
    grid-template-areas: 'a' 'b' 'mix';
  }
  .n4 .console {
    grid-template-areas: 'a' 'b' 'c' 'd' 'mix';
  }
  .no-mix .console {
    grid-template-areas: 'a' 'b';
  }
  .n4.no-mix .console {
    grid-template-areas: 'a' 'b' 'c' 'd';
  }
  /* En el móvil los cuatro canales no caben en una fila: se reparten en dos */
  .n4 .strips {
    flex-wrap: wrap;
    row-gap: 14px;
  }
  .rx-quant {
    display: none;
  }
}

/* ---------- Remix deck: 4 ranuras en columnas, una muestra sonando por ranura ---------- */
.track-ui {
  display: contents;
}
.deck.is-remix .track-ui,
.deck:not(.is-remix) .remix-ui {
  display: none;
}
.deck.is-remix {
  align-self: stretch;
  display: flex;
  flex-direction: column;
}
.remix-ui {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rx-quant {
  text-align: right;
}
.rx-quant-v {
  display: block;
  margin-top: 2px;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.pad.rx-play {
  width: 44px;
  min-height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  flex: none;
}
.rx-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(30px, 1fr);
  gap: 6px;
}
.rx-cell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 0;
  padding: 0 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.25s, border-color 0.25s;
}
.rx-cell span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.rx-cell:active {
  transform: scale(0.95);
}
.rx-cell.set {
  background: color-mix(in srgb, var(--c) 11%, var(--panel-2));
  border-color: color-mix(in srgb, var(--c) 34%, transparent);
  color: var(--text);
}
.rx-cell.set::before {
  content: '';
  flex: none;
  align-self: stretch;
  width: 3px;
  margin: 7px 0;
  border-radius: 2px;
  background: var(--c);
}
.rx-cell.shot::before {
  margin: 11px 0;
}
.rx-cell.live {
  background: color-mix(in srgb, var(--c) 30%, var(--panel-2));
  border-color: var(--c);
}
.rx-cell.live::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--c);
  transform-origin: left;
  transform: scaleX(var(--ph, 0));
}
.rx-cell.wait {
  animation: rx-wait 0.3s linear infinite alternate;
}
.rx-cell.pads {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--deck) 55%, transparent);
}
.rx-cell.sel {
  outline: 2px solid var(--deck);
  outline-offset: -2px;
}
@keyframes rx-wait {
  to {
    border-color: var(--c);
    background: color-mix(in srgb, var(--c) 22%, var(--panel-2));
  }
}
.rx-slots {
  flex: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.rx-slot {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.rx-slot-controls {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rx-filter {
  width: 100%;
  min-width: 0;
  height: 14px;
  margin: 0;
  accent-color: var(--muted);
  cursor: ew-resize;
}
.rx-stop {
  flex: none;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}
.rx-stop.on {
  border-color: var(--line-2);
  color: var(--text);
}
.rx-bar {
  flex: 1;
  min-width: 0;
  height: 14px;
  padding: 5px 0;
  background: linear-gradient(var(--track), var(--track)) center / 100% 4px no-repeat;
  cursor: ew-resize;
  touch-action: none;
}
.rx-bar i {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: var(--muted);
}
.rx-bar.muted i {
  opacity: 0.3;
}
.rx-row {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  min-width: 0;
}
.rx-row .btn {
  padding: 5px 10px;
  font-size: 12px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rx-row .btn.primary {
  margin-left: auto;
}
.rx-sync {
  margin-left: auto;
}
.rx-name {
  flex: 1;
  min-width: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.rx-beats {
  font-family: var(--mono);
  font-size: 12px;
  min-width: 22px;
  text-align: center;
}
/* Edición de una celda: el nombre en una línea y los ajustes debajo */
.rx-edit {
  flex-wrap: wrap;
  row-gap: 6px;
}
.rx-edit .rx-name {
  flex: 1 1 100%;
}
.sw {
  flex: none;
  position: relative;
  width: 34px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: var(--track);
  cursor: pointer;
  transition: background-color 0.25s;
}
.sw::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sw.on {
  background: var(--accent);
}
.sw.on::after {
  transform: translateX(14px);
  background: var(--on);
}
/* Tamaños del Remix deck: en S y M se quedan la cuadrícula y las ranuras */
.decks-m .rx-tools,
.decks-s .rx-tools,
.decks-s .rx-quant {
  display: none;
}
.decks-s .rx-grid {
  grid-auto-rows: minmax(26px, 1fr);
}
.v-esencial .rx-tools,
.v-esencial .rx-quant {
  display: none;
}
/* La barra de edición se centra en su elemento y, si no cabe en una línea, se parte */
.editing .mtool {
  left: 6px;
  right: 6px;
  width: fit-content;
  margin: 0 auto;
  transform: translateY(-50%);
  flex-wrap: wrap;
  justify-content: center;
}
.editing .mod > .track-ui > *,
.editing .mod > .remix-ui > * {
  opacity: 0.26;
  pointer-events: none;
}
.editing .mod > .remix-ui {
  opacity: 1;
}
/* Mezclador: los canales llenan la altura (con cuatro decks ocupa dos filas) y cada uno lleva su letra */
.strips {
  flex: 1;
  min-height: 0;
}
.ch-letter {
  width: 20px;
  height: 20px;
  border-radius: 7px;
  background: var(--deck);
  color: var(--on);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  flex: none;
}

/* Vúmetros: colores fijos en su altura (verde, amarillo desde −6 dB y rojo al saturar);
   la barra se descubre desde abajo en vez de estirarse */
.meter-fill {
  transform: none;
  clip-path: inset(100% 0 0 0);
  background: linear-gradient(to top, var(--accent) 0 76.9%, var(--warn) 76.9% 92.3%, var(--hot) 92.3%);
}
/* Mando de efecto del canal: la etiqueta dice qué efecto es y lo cambia al pulsarla */
.knob-label.fx {
  cursor: pointer;
  border-radius: 5px;
  padding: 1px 4px;
  margin: -1px -4px;
}
.knob-label.fx:hover {
  background: var(--panel-3);
  color: var(--text);
}
/* Cada efecto de mezclador lleva el color de su botón en la S4 */
.knob-label.fx {
  color: color-mix(in srgb, var(--fxc, var(--muted)) 75%, var(--text));
}
.knob-label.fx.off {
  opacity: 0.4;
  text-decoration: line-through;
}

/* ---------- Cabecera del diseño: marca, secciones, vistas, controlador y tema ---------- */
.topbar {
  flex-wrap: nowrap;
  /* El body es una columna de alto fijo: sin esto, al faltar sitio la cabecera se encogía y su
     segunda fila (a menos de 900 px) quedaba tapada por la cabina. */
  flex-shrink: 0;
  min-height: 40px;
  min-width: 0;
}
.logo,
.ico {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.logo {
  width: 32px;
  height: 32px;
  color: var(--a);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 4px 0 0;
}
.brand .brand-edition {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.brand-edition span {
  color: inherit;
}
.seg button.on,
.seg a.on {
  background: var(--panel);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
}
#sections button,
#viewSeg button {
  height: 26px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.master {
  margin: 0 auto;
}
.top-actions {
  flex-wrap: nowrap;
  gap: 8px;
  min-width: 0;
}
.btn {
  gap: 6px;
}
.btn.sq {
  width: 34px;
  height: 34px;
  padding: 0;
  flex: none;
}
.btn.fill {
  background: var(--deck, var(--a));
  border-color: transparent;
  color: var(--on);
  font-weight: 600;
}
.btn.fill:hover {
  background: color-mix(in srgb, var(--deck, var(--a)) 86%, var(--text));
  color: var(--on);
}
:root[data-theme='dia'] .sun,
:root:not([data-theme='dia']) .moon {
  display: none;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  min-width: 0;
}
button.chip {
  cursor: pointer;
}
#ctlName {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.chip.ok {
  color: var(--text);
}
.chip.ok .dot {
  background: var(--accent);
}
.chip.num {
  font-family: var(--mono);
  height: 24px;
  padding: 0 9px;
}
/* Vistas: botones si caben; si no, el desplegable */
#viewSelect {
  display: none;
  max-width: 190px;
}
@media (max-width: 1360px) {
  #viewSeg,
  .top-actions > .lbl {
    display: none;
  }
  #viewSelect {
    display: inline-flex;
  }
}
.many-views #viewSeg {
  display: none;
}
.many-views #viewSelect {
  display: inline-flex;
}
@media (max-width: 1100px) {
  #btnEditView span,
  .master .lbl {
    display: none;
  }
  #ctlName {
    max-width: 110px;
  }
}
@media (max-width: 900px) {
  .topbar {
    flex-wrap: wrap;
  }
}

/* ---------- Secciones: sólo se ve lo de la sección elegida ---------- */
body:not([data-sec='cabina']):not([data-sec='mezcla']) :is(.waves, .console),
body:not([data-sec='cabina']) :is(.fx-units, .view-tray, .only-cabina),
body[data-sec='mezcla'] :is(.deck, .deck-pick, .library),
body:not([data-sec='biblio']) .lib-decks,
body:not([data-sec='ajustes']) .page,
body[data-sec='ajustes'] .library {
  display: none !important;
}

/* ---------- Ondas con etiqueta de deck, pista y tiempo restante ---------- */
.wave-box {
  position: relative;
  min-height: 0;
}
.grow-ondas .wave-box {
  display: flex;
}
.wave-tag {
  position: absolute;
  top: 6px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 55%;
  height: 22px;
  padding: 0 9px 0 3px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--wave-bg) 78%, transparent);
  font-size: 11px;
  pointer-events: none;
  white-space: nowrap;
}
.wave-tag.right {
  left: auto;
  right: 8px;
  padding: 0 9px;
  font-family: var(--mono);
}
.wave-tag:has(.wt-title:empty),
.wave-tag.right:empty {
  display: none;
}
.wt-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wt-artist {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}
.deck-letter.mini {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
}
.deck-letter.mini.none {
  background: none;
}
.ondas-s .wave-tag {
  display: none;
}

/* ---------- Biblioteca: lista con filtros, panel de listas y ficha de la pista ---------- */
.library {
  flex-direction: row;
  padding: 0;
  overflow: hidden;
  min-height: 0;
}
.lib-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px;
  container-type: inline-size;
}
.library-bar {
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  min-width: 0;
}
.search {
  flex: 1 1 200px;
  max-width: 320px;
  min-width: 90px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
}
.search input,
.library-bar .search input[type='search'] {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 0;
  background: none;
  outline: none;
  color: var(--text);
  -webkit-user-select: text;
  user-select: text;
}
.library-bar .btn {
  height: 32px;
  padding: 0 11px;
  font-size: 12px;
  flex: none;
}
.library-bar .btn.active {
  border-color: transparent;
  background: color-mix(in srgb, var(--a) 18%, var(--panel-2));
  color: color-mix(in srgb, var(--a) 80%, var(--text));
}
#libCount {
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.lib-load {
  display: flex;
  gap: 4px;
  flex: none;
}
.library-bar .lib-load .btn {
  width: 32px;
  padding: 0;
}
.table-wrap {
  max-height: none;
}
.tr {
  display: grid;
  grid-template-columns: 22px minmax(0, 1.7fr) minmax(0, 1fr) minmax(0, 1fr) 62px 46px 52px 104px;
  align-items: center;
  gap: 0 10px;
  min-height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
}
.tr > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tr.hd {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 26px;
  background: var(--panel);
  cursor: default;
}
.tr .ti {
  color: var(--text);
  font-weight: 500;
}
.tr .r {
  text-align: right;
}
.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.okc {
  color: var(--accent);
}
.mut {
  color: var(--muted);
}
#trackList .tr:hover {
  background: var(--panel-2);
}
#trackList .tr.selected {
  background: color-mix(in srgb, var(--a) 15%, transparent);
  color: var(--text);
}
@container (max-width: 760px) {
  .tr {
    grid-template-columns: 22px minmax(0, 1.7fr) minmax(0, 1fr) 62px 46px 52px;
  }
  .c-genre,
  .c-mix {
    display: none;
  }
  #libCount,
  #fltGenre {
    display: none;
  }
}
@container (max-width: 520px) {
  #fltBpm,
  #fltKey,
  .library-bar label.btn,
  #btnFolder {
    display: none;
  }
}
.lib-side {
  flex: none;
  width: 196px;
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 10px;
  border-right: 1px solid var(--line);
  min-height: 0;
  overflow: auto;
}
.lib-info {
  flex: none;
  width: 268px;
  display: none;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-left: 1px solid var(--line);
  min-height: 0;
  overflow: auto;
}
.lib-l .lib-side,
.lib-l .lib-info,
body[data-sec='biblio'] .lib-side,
body[data-sec='biblio'] .lib-info {
  display: flex;
}
.libfold .lib-side,
.libfold .lib-info {
  display: none;
}
.nav {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  flex: none;
}
.nav:hover {
  background: var(--panel-2);
  color: var(--text);
}
.nav.on {
  background: var(--panel-2);
  color: var(--text);
  font-weight: 500;
}
.nav .ti {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav .n {
  font-size: 11px;
  color: var(--muted);
}
.nav.closed .n {
  color: color-mix(in srgb, var(--a) 80%, var(--text));
}
.side-h {
  margin: 14px 10px 4px;
}
.side-note {
  margin: 0 10px;
}
.side-add {
  margin-top: auto;
  height: 34px;
  flex: none;
}
.info-title {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.lib-info .overview {
  height: 34px;
  margin: 0;
  flex: none;
}
.cue-row {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 26px;
  font-size: 12px;
}
.cue-row .ti {
  flex: 1;
}
.cdot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  flex: none;
}
.mix-note {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel-2);
}
.mix-note.ok {
  background: color-mix(in srgb, var(--accent) 12%, var(--panel-2));
}
.mix-h {
  font-weight: 600;
  margin-bottom: 3px;
}
.info-load {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.info-load .btn {
  height: 38px;
}
/* Sección Biblioteca: la lista ocupa la ventana y arriba queda una franja con los decks */
body[data-sec='biblio'] .library {
  display: flex !important;
  flex: 1;
}
body[data-sec='biblio'] .table-wrap {
  display: block !important;
}
body[data-sec='biblio'] .library-bar {
  margin-bottom: 8px !important;
}
body[data-sec='biblio'] .library > .mtool {
  display: none;
}
.lib-decks {
  flex: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  grid-auto-flow: column;
  gap: 8px;
}
.mini-deck {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  height: 60px;
  padding: 0 12px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}
.mini-deck .track-info {
  flex: 0 1 190px;
}
.mini-deck .overview {
  flex: 1;
  min-width: 40px;
  height: 30px;
  margin: 0;
}
.mini-deck .bpm b {
  font-size: 18px;
}
.mini-deck .pad.play {
  width: 44px;
  min-height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  flex: none;
}
@media (max-width: 900px) {
  .lib-decks {
    grid-auto-flow: row;
    grid-template-columns: minmax(0, 1fr);
  }
  .lib-side,
  .lib-info {
    display: none !important;
  }
}

/* ---------- Ajustes como página ---------- */
.page {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 10px;
}
.set-nav {
  flex: none;
  width: 214px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}
.set-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 2px 10px 10px;
}
.set-foot {
  margin: auto 10px 2px;
}
.set-body {
  flex: 1;
  min-width: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 8px;
}
.panel {
  flex: none;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}
.panel h2 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
}
.panel h3 {
  margin: 20px 0 8px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.panel a,
.set-foot a {
  color: color-mix(in srgb, var(--a) 80%, var(--text));
}
.srow {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.srow.col {
  flex-wrap: wrap;
}
.srow.col .note {
  flex: 1 1 100%;
}
/* Ajustes: apartados de cada controlador conectado. */
.nav-sub:empty {
  display: none;
}
.nav.sub {
  padding-left: 24px;
  font-size: 12px;
}
.dev-status .chip {
  flex-shrink: 0;
  white-space: nowrap;
}
.swatch-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.swatch-row .btn.on {
  border-color: var(--accent);
  color: var(--text);
}
.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.range-row input[type='range'] {
  flex: 1;
  min-width: 0;
  accent-color: var(--accent);
}
.range-val {
  min-width: 96px;
  text-align: right;
  color: var(--muted);
  font-size: 12px;
}
/* Menú de un hot cue (clic derecho en el pad). */
.cue-menu {
  position: fixed;
  z-index: 1000;
  width: 272px;
  max-width: calc(100vw - 16px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line2, var(--line));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  font-size: 13px;
}
.cm-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cm-sub,
.cm-label {
  color: var(--muted);
  font-size: 11px;
}
.cm-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cm-colors .swc {
  width: 22px;
  height: 22px;
  border-radius: 7px;
}
.cm-auto {
  font-size: 10px;
  font-weight: 700;
  color: #000;
}
.cm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.cue-menu .seg button {
  height: 26px;
  padding: 0 10px;
  font-size: 12px;
}
.cm-del {
  align-self: flex-start;
}
/* Botones de efecto del canal: cuatro selectores con el color de su botón. */
.fx-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.fx-slot {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
}
.fx-slot .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c);
}
.fx-slot select.btn {
  height: 30px;
  padding: 0 8px;
}
/* En una fila apilada, el título con su explicación ocupa toda la línea y el selector va debajo. */
.srow.col > .g:has(.note) {
  flex: 1 1 100%;
}
.srow .g {
  flex: 1;
  min-width: 0;
}
.srow select.btn,
.map-actions select.btn {
  max-width: 280px;
  height: 34px;
  padding: 0 10px;
}
.srow .seg button,
#segCue button {
  height: 26px;
  padding: 0 11px;
  font-size: 12px;
}
.ctl-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0 12px;
}
.ctl-ico {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--panel-3), var(--panel-2));
  border: 1px solid var(--line);
  flex: none;
}
.ctl-name {
  font-weight: 600;
}
.swc {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 8px;
  border: 0;
  background: var(--c);
  cursor: pointer;
  flex: none;
}
.swc.on {
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--c);
}
.thm-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.thm {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 132px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.thm.on {
  border-color: var(--a);
  color: var(--text);
}
.pv {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 54px;
  padding: 8px;
  border-radius: 8px;
  background: #0a0b0d;
}
.pv.dia {
  background: #eceef1;
}
.pv.auto {
  background: linear-gradient(105deg, #0a0b0d 50%, #eceef1 50%);
}
.pv i {
  flex: 1;
  border-radius: 3px;
  background: #4c9aff;
  height: 60%;
}
.pv i:nth-child(2) {
  background: #ff9447;
  height: 100%;
}
.pv i:nth-child(3) {
  background: #3ddb9a;
  height: 40%;
}
.key-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 6px 18px;
}
.key-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}
kbd {
  min-width: 34px;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text);
  font: 500 11px var(--mono);
  text-align: center;
}
.opt {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}
.opt input {
  width: 80px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
}
.monitor {
  max-height: 220px;
  overflow: auto;
}
@media (max-width: 900px) {
  .page {
    flex-direction: column;
  }
  .set-nav {
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .set-nav .nav {
    width: auto;
  }
  .set-title,
  .set-foot {
    display: none;
  }
}
/* Reducir animaciones: a petición del usuario o del sistema */
.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
  transition: none !important;
  animation: none !important;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* En la cabina la ficha de la pista es la versión corta; la completa está en la sección Biblioteca */
body[data-sec='cabina'] .lib-info .full {
  display: none;
}

/* ---------- Deck completo: tono, tempo, vista general con sus tiempos, modos de pads ---------- */
.dk-key {
  text-align: right;
  line-height: 1.2;
}
.dk-key b {
  display: block;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  margin-top: 2px;
}
.bpm small {
  font-family: var(--mono);
  white-space: nowrap;
}
.ov-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  font-size: 12px;
}
.ov-row .overview {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.ov-row .t-el {
  width: 46px;
  flex: none;
}
.ov-row .t-re {
  width: 54px;
  flex: none;
  text-align: right;
  color: var(--muted);
}
.pads {
  align-content: start;
}
.pad-modes {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  min-width: 0;
}
.tabs {
  display: flex;
  gap: 12px;
  margin-right: auto;
  min-width: 0;
}
.tab {
  height: 28px;
  padding: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.tab.on {
  color: var(--text);
  border-bottom-color: var(--deck);
}
.tab:disabled {
  opacity: 0.35;
  cursor: default;
}
.pad-modes .pad.small {
  min-height: 26px;
  padding: 0 9px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.pad.flux.on {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.pad.sync.on {
  background: color-mix(in srgb, var(--sync) 14%, var(--panel-2));
  border-color: color-mix(in srgb, var(--sync) 40%, transparent);
}
.pad.hotcue {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 10px;
  min-width: 0;
}
.pad.hotcue .pl {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pad.hotcue .pt {
  color: var(--muted);
  font-size: 10px;
  flex: none;
}
.pad.hotcue.live {
  background: color-mix(in srgb, var(--hc) 30%, var(--panel-2));
  border-color: var(--hc);
}
.decks-m .deck .only-l,
.decks-s .deck .only-l,
.v-esencial .deck .only-l,
.decks-s .deck .not-s,
.decks-s .ov-row .num {
  display: none;
}
.decks-s .ov-row {
  margin: 6px 0;
}
.auto-mix {
  display: none;
}
.v-esencial .auto-mix {
  display: inline-flex;
  background: var(--a);
  border-color: transparent;
  color: var(--on);
}

body[data-sec='cabina'].libshort .lib-side,
body[data-sec='cabina'].libshort .lib-info {
  display: none;
}

/* ---------- Unidades de efectos ---------- */
.fx-units {
  flex: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  position: relative;
}
.no-fx .fx-units {
  display: none;
}
.fx-unit {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  height: 56px;
  padding: 0 14px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}
.fx-unit .knob-label {
  display: none;
}
.fx-unit .knob {
  flex: none;
}
.fx-decks {
  display: flex;
  gap: 3px;
  margin-right: 4px;
}
.pad.small.fx-deck {
  width: 24px;
  min-height: 24px;
  padding: 0;
  font-size: 10px;
  font-weight: 700;
}
.pad.fx-deck.on {
  background: var(--deck);
  border-color: transparent;
  color: var(--on);
}
.pad.small.fx-on {
  min-height: 28px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pad.fx-on.on {
  background: color-mix(in srgb, var(--deck) 18%, var(--panel-2));
  border-color: color-mix(in srgb, var(--deck) 50%, transparent);
  color: var(--text);
}
.fx-mix {
  margin-left: auto;
}
@media (max-width: 1100px) {
  .fx-unit > .lbl {
    display: none;
  }
}
@media (max-width: 760px) {
  .fx-units {
    grid-template-columns: minmax(0, 1fr);
  }
}

.knob-sm {
  --size: 32px;
}
/* Medidor de espacio de la bandeja de edición */
.space {
  display: block;
  width: 96px;
  height: 6px;
  border-radius: 3px;
  background: var(--track);
  overflow: hidden;
  flex: none;
}
.space i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
}
.space.full i {
  background: var(--warn);
}
/* Biblioteca plegada en la cabina: buscador, aviso y acceso a la sección completa */
.fold-note,
.fold-only {
  display: none !important;
}
body[data-sec='cabina'].libfold.lib-m .fold-note,
body[data-sec='cabina'].libfold.lib-l .fold-note {
  display: inline !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
body[data-sec='cabina'].libfold.lib-m .fold-only,
body[data-sec='cabina'].libfold.lib-l .fold-only {
  display: inline-flex !important;
  margin-left: auto;
}
body[data-sec='cabina'].libfold :is(#fltBpm, #fltKey, #fltGenre, #libCount, .lib-load, .library-bar label.btn, #btnFolder) {
  display: none;
}

/* ---------- Móvil: un deck cada vez, crossfader y barra de secciones abajo ---------- */
.deck-pick {
  display: none;
}
@media (max-width: 600px) {
  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }
  .topbar {
    flex-wrap: wrap;
    gap: 6px;
  }
  #sections {
    position: fixed;
    z-index: 20;
    left: 12px;
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    height: 48px;
    padding: 4px;
    border-radius: 16px;
    background: var(--panel);
    border: 1px solid var(--line-2);
    box-shadow: 0 16px 36px -16px rgba(0, 0, 0, 0.8);
  }
  #sections button {
    flex: 1;
    height: 100%;
    border-radius: 12px;
    font-size: 13px;
  }
  .top-actions > :not(#btnTheme):not(#btnEditView),
  .master .lbl,
  .logo {
    display: none !important;
  }
  .brand {
    margin-left: 0;
  }
  .master {
    margin: 0 0 0 auto;
    gap: 6px;
  }
  /* Una sola fila de cabecera: beats más estrechos y CRUISE solo con su icono. */
  .topbar {
    gap: 5px;
  }
  .beats {
    gap: 3px;
  }
  .beats i {
    width: 8px;
  }
  .master b {
    font-size: 18px;
    min-width: 0;
  }
  .top-actions {
    gap: 4px;
  }
  .brand-wordmark {
    font-size: 14px;
  }
  .btn.cruise {
    width: 30px;
    padding: 0;
    justify-content: center;
  }
  .topbar .btn.cruise .cruise-ico {
    display: block;
  }
  .topbar .btn.cruise .cruise-label {
    display: none;
  }
  .deck-pick {
    display: flex;
  }
  .deck-pick button {
    flex: 1;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    font-size: 12px;
  }
  .deck-pick button span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .n2 .deck-pick .only-4 {
    display: none;
  }
  /* Sólo se ve el deck elegido; del mezclador queda el crossfader */
  body[data-pick='0'] .deck:not(#deckA),
  body[data-pick='1'] .deck:not(#deckB),
  body[data-pick='2'] .deck:not(#deckC),
  body[data-pick='3'] .deck:not(#deckD),
  .mixer .strips,
  .mixer > .mtool,
  body[data-sec='cabina'] .library {
    display: none !important;
  }
  .mixer {
    padding: 8px 12px;
  }
  .wave {
    height: 54px !important;
  }
  .deck .only-l {
    display: flex !important;
  }
  .deck .dk-key.only-l {
    display: block !important;
  }
  .pad.hotcue {
    min-height: 44px;
  }
  .transport > .pad {
    min-height: 44px;
  }
  .page {
    padding-bottom: 8px;
  }
}
@media (max-width: 600px) {
  /* Las unidades de efectos no caben en el móvil: quedan para pantallas más anchas */
  .fx-units {
    display: none !important;
  }
}
/* Si las pestañas de los pads y FLUX/REV/cuantizar no caben en una línea, se parten en dos */
.pad-modes {
  flex-wrap: wrap;
  row-gap: 4px;
}
.tabs {
  flex: none;
}

/* ---------- Grabación, listas propias ---------- */
.btn.rec {
  height: 30px;
  padding: 0 11px;
  font-family: var(--mono);
  font-size: 11px;
  flex: none;
}
.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hot);
  flex: none;
}
.btn.cruise {
  height: 30px;
  padding: 0 10px;
  font-family: var(--mono);
  font-size: 11px;
  flex: none;
}
.btn.cruise .cruise-ico {
  display: none;
}
/* Cruise activo: en verde, como el botón de Traktor. */
.btn.cruise.on {
  border-color: color-mix(in srgb, var(--play) 60%, transparent);
  color: var(--play);
}
.btn.rec.on {
  border-color: color-mix(in srgb, var(--hot) 60%, transparent);
  color: var(--text);
}
.btn.rec.on .rec-dot {
  animation: rec-blink 1s steps(2, start) infinite;
}
@keyframes rec-blink {
  to {
    visibility: hidden;
  }
}
.master {
  margin: 0 0 0 auto;
}
.btn.rec {
  margin-right: auto;
}
.nav .del {
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  text-align: center;
  line-height: 18px;
  color: var(--muted);
}
.nav:hover .del {
  display: block;
}
.nav:hover .del:hover {
  background: var(--panel-3);
  color: var(--text);
}
.nav:hover .n:has(+ .del) {
  display: none;
}
.new-list {
  flex: none;
  height: 30px;
  margin: 2px 0;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px dashed var(--line-2);
  background: none;
  font-size: 12px;
  -webkit-user-select: text;
  user-select: text;
}
.lib-info button.chip {
  height: 26px;
}
#trackList a {
  text-decoration: none;
}
@media (max-width: 600px) {
  .btn.rec span {
    display: none;
  }
  .btn.rec {
    padding: 0 9px;
  }
}

/* Bloques de la cabina reordenables; la bandeja de edición siempre al final */
.view-tray {
  order: 90;
}
.page {
  order: 95;
}
.meter-pair {
  display: flex;
  gap: 3px;
}
.strip.center .meter-pair {
  flex: 1;
  min-height: 30px;
  max-height: 96px;
}
.strip.center .meter-pair .meter {
  height: auto;
  width: 6px;
}
/* Pantallas táctiles (iPad): pads, transporte y filas con tamaño de dedo */
@media (pointer: coarse) {
  .pad.hotcue,
  .transport > .pad,
  .rx-cell {
    min-height: 44px;
  }
  .transport > .loops .pad {
    min-height: 36px;
    padding: 0 12px;
  }
  .tab {
    height: 36px;
  }
  .tr {
    min-height: 40px;
  }
  .nav {
    height: 40px;
  }
  .seg button,
  #sections button,
  #viewSeg button {
    height: 32px;
  }
  .rx-slot-controls {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rx-filter {
  width: 100%;
  min-width: 0;
  height: 14px;
  margin: 0;
  accent-color: var(--muted);
  cursor: ew-resize;
}
.rx-stop {
    width: 30px;
    height: 30px;
  }
}

.cue-name {
  flex: 1;
  min-width: 0;
  height: 24px;
  padding: 0 6px;
  margin-left: -6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  font-size: 12px;
  -webkit-user-select: text;
  user-select: text;
}
.cue-name:hover,
.cue-name:focus {
  border-color: var(--line-2);
  background: var(--panel-2);
  outline: none;
}

/* Pattern Player comparte el módulo FX; el secuenciador permanece visible. */
.fx-controls { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fx-unit.is-pattern { height: auto; min-height: 132px; padding: 8px 12px; }
.pattern-panel { flex: 1; min-width: 0; display: grid; gap: 4px; }
.pattern-head, .pattern-controls { display: flex; align-items: center; gap: 6px; }
.pattern-name { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; }
.pattern-head .btn { padding: 2px 6px; min-height: 20px; }
.pattern-steps { display: grid; grid-template-columns: repeat(8,minmax(0,1fr)); gap: 3px; }
.pattern-step { min-width: 0; padding: 2px 0; font: 500 9px 'Geist Mono', monospace; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); background: var(--panel-2); cursor: pointer; }
.pattern-step.on { color: var(--play); border-color: var(--play); }
.pattern-step.playing { background: var(--play); color: var(--on); }
.pattern-controls .pad { min-width: 28px; }
@media(max-width: 600px) { .fx-unit.is-pattern { padding: 6px; gap: 6px; } .pattern-controls { gap: 3px; } .pattern-steps { gap: 2px; } }

@media(max-width:600px) { body[data-sec='cabina']:not(.no-fx) .fx-units:has(.is-pattern, .is-single) { display: grid !important; } .fx-unit:not(.is-pattern):not(.is-single) { display:none; } }

@media(max-width:1100px) {
  .fx-units:has(.is-pattern, .is-single) { grid-template-columns: minmax(0,1fr); }
}
@media(max-width:600px) {
  .fx-unit.is-pattern { display:grid; grid-template-columns:20px minmax(0,1fr); height:auto; }
  .is-pattern .pattern-panel { grid-column:1 / -1; }
  .pattern-controls { display:grid; grid-template-columns:repeat(8,minmax(0,1fr)); }
  .pattern-controls .knob { min-width:0; }
  .pattern-controls .knob-dial { --size:30px; }
  .pattern-controls .pad { padding:0 2px; font-size:10px; }
}

.fx-unit-setting { display:flex; align-items:center; gap:12px; width:100%; flex-wrap:wrap; }
.fx-unit-setting .g { flex:1; }
#fxModes .fx-slots { flex-wrap:wrap; }
#fxAvailable input { accent-color:var(--accent); }

.tr.recording-row { grid-template-columns:minmax(0,1fr) auto 52px auto; gap:12px; }
.tr.recording-row .btn { padding:2px 8px; }

@media(max-width:600px) { .toast { bottom:calc(76px + env(safe-area-inset-bottom)); } }

.tone-key { color:hsl(var(--key-hue) 65% 70%); }
:root[data-theme='dia'] .tone-key { color:hsl(var(--key-hue) 75% 25%); }

@media (max-width: 600px) {
  #setLibrary .srow.col > .g { flex: 1 1 100%; }
  #setLibrary .seg { flex-wrap: wrap; }
  #setLibrary .seg button { white-space: nowrap; }
}
@media (max-width: 600px) {
  .dev-status { flex-wrap: wrap; }
  .dev-status > .g { flex: 1 1 100%; }
}

#btnSettingsApply { color: var(--on); }
.mixer.hide-gain [data-mixer-control="gain"],
.mixer.hide-eq [data-mixer-control="eq"],
.mixer.hide-fx [data-mixer-control="fx"],
.mixer.hide-monitor [data-mixer-control="monitor"],
.mixer.hide-pfl .pfl,
.mixer.hide-crossfader .xfader-wrap,
.mixer.hide-gain.hide-eq.hide-fx .strip-knobs,
.mix-m .mixer.hide-eq.hide-fx .strip-knobs { display: none; }
@media (max-width:600px) { .mixer.hide-crossfader:has(#externalMixerNote[hidden]) { display:none; } }
.rx-cell-param { display:flex;align-items:center;gap:4px;font-size:11px;color:var(--muted); }
.rx-cell-param input { width:58px;height:28px;border:1px solid var(--line);border-radius:7px;background:var(--panel-2);color:var(--text);padding:0 5px;font:inherit; }

/* Cabecera de pista: duplicar entre decks con el gesto de arrastrar. */
.deck-drag[draggable="true"] { cursor: grab; }
.deck-drag[draggable="true"]:active { cursor: grabbing; }

/* Densidad configurable; en táctil mantiene objetivos de al menos 44 px. */
#library { --library-default-font:12px; --library-default-row:32px; --library-touch-row:32px; }
#trackList .tr { font-size:var(--library-font,var(--library-default-font)); min-height:max(var(--library-row,var(--library-default-row)),var(--library-touch-row)); }
#trackList .tag-input { width:100%; min-width:0; height:28px; padding:0 4px; border:1px solid var(--acc,var(--a)); border-radius:4px; background:var(--s1); color:var(--tx); font:inherit; user-select:text; -webkit-user-select:text; }
#trackList .tr:focus-visible { outline:1px solid var(--a); outline-offset:-1px; }
@media (pointer:coarse), (max-width:900px) { #library { --library-default-font:13px; --library-default-row:44px; --library-touch-row:44px; } }

#library .table-wrap { scroll-snap-type:y proximity; }
#trackList .tr { scroll-snap-align:start; }
@media(max-width:699px) {
  body[data-sec='biblio'] { height:100dvh; min-height:100dvh; overflow:hidden; }
  body[data-sec='biblio'] .table-wrap { min-height:0; }
}

/* Portadas: tamaño fijo, nunca desplazan BPM/transporte ni reemplazan la letra. */
.artwork { object-fit:cover; border-radius:8px; background:var(--s2); flex:none; }
.artwork[hidden], body[data-artwork='hide'] .artwork { display:none !important; }
.deck-artwork { width:40px; height:40px; }
.mini-artwork { width:32px; height:32px; }
.info-artwork { width:96px; height:96px; align-self:start; }
.track-marker { width:22px; height:24px; position:relative; overflow:visible !important; }
.track-marker .artwork { width:22px; height:22px; border-radius:4px; display:block; }
.track-marker .deck-letter { position:absolute; inset:0; }
body[data-artwork='show'] .track-marker.has-artwork .deck-letter:not(.none) { width:14px; height:14px; font-size:10px; border-radius:4px; inset:auto -3px -2px auto; }
body[data-artwork='show'] .track-marker.has-artwork .deck-letter.none { display:none; }
@container (max-width:360px) { .deck-artwork { width:32px; height:32px; } }
.tag-dialog { width:min(440px,calc(100vw - 32px)); max-height:calc(100dvh - 32px); }
.tag-dialog h2 { margin:0 0 8px; font-size:15px; }
.tag-file { overflow-wrap:anywhere; }
.tag-field { display:grid; gap:8px; margin:16px 0; font-size:12px; }
.tag-field input { min-width:0; width:100%; padding:8px; border-radius:8px; border:1px solid var(--line); background:var(--s2); color:var(--tx); font:inherit; }
.tag-field input:focus-visible { outline:2px solid var(--a); outline-offset:2px; }
.tag-actions { display:flex; justify-content:flex-end; gap:8px; }
.library-bar #btnEditTags { display:grid; place-items:center; width:32px; padding:0; }
body[data-sec='cabina'].libfold #btnEditTags { display:none; }
@media (pointer:coarse), (max-width:900px) {
  .tag-field input, .tag-actions button, .library-bar #btnEditTags { min-height:44px; }
  .library-bar #btnEditTags { min-width:44px; }
  .tag-field { font-size:13px; }
}

/* Efecto único: mezcla + tres parámetros visibles y sus restablecimientos. */
.fx-unit.is-single { height:auto; min-height:132px; padding:8px 12px; flex-wrap:wrap; }
.single-controls { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; flex:1; min-width:300px; }
.single-param, .single-mix { display:flex; flex-direction:column; align-items:center; gap:4px; min-width:0; }
.single-controls .knob { min-width:0; max-width:100%; }
.single-controls .knob-label { display:block; max-width:100%; font-size:10px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.single-controls .pad { max-width:100%; }
.single-value { font:10px 'Geist Mono',monospace; color:var(--muted); white-space:nowrap; }
@media(max-width:600px) { .single-controls { flex-basis:100%; min-width:0; } }
@media(pointer:coarse) { .single-controls .pad { min-height:44px; } }

/* Entradas en directo: transporte de pista oculto; mezcla y PFL compartidos. */
.deck.is-live .track-ui, .deck:not(.is-live) .live-ui { display:none; }
.live-ui { display:flex; flex-direction:column; gap:12px; padding:12px; min-width:0; }
.live-ui .title { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.live-ui .deck-head { min-width:0; }
.live-ui .note { margin:0; }
.input-levels { display:grid; grid-template-columns:minmax(0,1fr) 80px auto; gap:12px; align-items:center; padding:12px 0; }
.input-levels label { display:flex; gap:12px; align-items:center; min-width:0; }
.input-levels input { min-width:0; flex:1; accent-color:var(--accent); }
.input-levels meter { width:100%; }
@media(max-width:600px){.input-levels { grid-template-columns:minmax(0,1fr) 80px; }.input-levels .btn { grid-column:1 / -1; }.live-ui { padding:8px; }}

.played-check { position:absolute; left:-3px; bottom:-3px; width:14px; height:14px; display:grid; place-items:center; border-radius:50%; background:var(--panel); color:var(--play); font-size:11px; font-weight:700; }

.library-bar #fltGenre{max-width:150px}
.library-bar #libCount{white-space:normal;max-width:205px;line-height:1.2}
.lib-info button.chip{max-width:100%;height:auto;min-height:26px;white-space:normal;overflow-wrap:anywhere;text-align:left}
.lib-info button.chip .dot{flex-shrink:0}

/* Biblioteca accesible cuando la barra lateral no cabe. El nodo se reutiliza
   dentro de un diálogo para conservar acciones, foco y estado sin duplicar IDs. */
#btnLibraryMenu { display: none; flex: none; min-width: 36px; }
#libraryMenuDialog { width: min(360px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 12px; }
#libraryMenuDialog .lib-side { display: flex !important; width: 100%; max-height: calc(100dvh - 100px); border: 0; padding: 8px 0 0; }
@media (max-width: 900px) { #btnLibraryMenu { display: inline-flex; justify-content: center; } }

/* Sincronía sin texto: tempo a la izquierda, fase alrededor del centro. */
.deck-phase {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(40px, 1fr) minmax(0, auto);
  align-items: center;
  gap: 10px;
  height: 26px;
  margin-top: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.mt-tempo { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 600; overflow: hidden; }
.mt-tempo .ico { flex: none; width: 15px; height: 15px; stroke-width: 2; }
.mt-text, .mt-value { overflow: hidden; text-overflow: ellipsis; }
.mt-value { text-align: right; font-weight: 600; }
.phase-rail { position: relative; height: 16px; }
.phase-rail::before { content: ''; position: absolute; top: 7px; left: 0; right: 0; height: 2px; border-radius: 1px; background: var(--line); }
.phase-rail::after { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--text); opacity: 0.7; }
.mt-q { position: absolute; top: 4px; bottom: 4px; width: 1px; background: var(--muted); opacity: 0.45; }
.mt-q1 { left: 25%; }
.mt-q3 { left: 75%; }
.mt-fill { position: absolute; z-index: 1; top: 4px; height: 8px; min-width: 4px; margin-left: -2px; border-radius: 4px; background: currentColor; }
.deck-phase[data-state='tempo'] { color: var(--cue, #ffad45); }
.deck-phase[data-state='tempo'] .phase-rail { opacity: 0.35; }
.deck-phase[data-state='tempo'] .mt-fill { visibility: hidden; }
.deck-phase[data-state='phase'], .deck-phase[data-state='ready'] { color: var(--deck, var(--a)); }
.deck-phase[data-state='phase'] .mt-tempo, .deck-phase[data-state='ready'] .mt-tempo, .deck-phase[data-state='aligned'] .mt-tempo { color: var(--play); }
.deck-phase[data-state='aligned'] { color: var(--play); border-color: color-mix(in srgb, var(--play) 45%, transparent); }
.deck-phase[data-state='aligned'] .mt-fill { box-shadow: 0 0 8px color-mix(in srgb, currentColor 60%, transparent); }
.deck-phase[data-state='none'] { opacity: 0.45; }
.deck-phase[data-state='none'] .mt-fill { visibility: hidden; }

/* BPM y rejilla: una sola pieza; pulsar el número o el icono abre el editor. */
.bpm-box { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); overflow: hidden; }
.bpm-open { padding: 3px 8px 2px; border: 0; background: none; color: inherit; font: inherit; text-align: right; cursor: pointer; }
.bpm-open:hover, .grid-open:hover { background: var(--panel-3); }
.grid-open { display: grid; place-items: center; width: 32px; padding: 0; border: 0; border-left: 1px solid var(--line); background: none; color: var(--muted); cursor: pointer; }
.grid-open:hover { color: var(--text); }

/* Actividad permanente, separada del área útil y de la navegación móvil. */
:root { --activity-height: 32px; }
body { padding-bottom: calc(var(--activity-height) + 8px + env(safe-area-inset-bottom)); }
.activity-bar { position:fixed; z-index:90; left:0; right:0; bottom:0; min-width:0; height:calc(var(--activity-height) + env(safe-area-inset-bottom)); padding:0 max(12px,env(safe-area-inset-right)) env(safe-area-inset-bottom) max(12px,env(safe-area-inset-left)); display:flex; align-items:center; gap:10px; background:var(--panel); border-top:1px solid var(--line); font-size:11px; }
.activity-dot { flex:none; width:5px; height:5px; border-radius:50%; background:var(--muted); }
.activity-bar[data-state='busy'] .activity-dot { background:var(--a); }
.activity-bar[data-state='error'] .activity-dot { background:var(--cue,#ffad45); }
.activity-label { flex:0 1 auto; max-width:40%; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-weight:500; }
.activity-detail { flex:1; min-width:0; color:var(--muted); overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.activity-count,.activity-percent { flex:none; font-family:var(--mono); color:var(--muted); }
.activity-bar progress { flex:none; width:160px; height:5px; border:0; border-radius:4px; overflow:hidden; background:var(--line); accent-color:var(--a); }
.activity-bar progress::-webkit-progress-bar { background:var(--line); }
.activity-bar progress::-webkit-progress-value { background:var(--a); border-radius:4px; }
.activity-bar progress::-moz-progress-bar { background:var(--a); }
.activity-bar progress:indeterminate { background:linear-gradient(90deg,var(--line) 20%,var(--a) 50%,var(--line) 80%); background-size:200% 100%; animation:activity-wait 1.8s linear infinite; }
.activity-bar progress:indeterminate::-webkit-progress-bar { background:transparent; }
.activity-bar button { flex:none; border:0; background:none; color:var(--text); width:28px; height:28px; cursor:pointer; }
.toast { bottom:calc(var(--activity-height) + 20px + env(safe-area-inset-bottom)); }
@keyframes activity-wait { to { background-position:-200% 0; } }
@media(prefers-reduced-motion:reduce) { .activity-bar progress:indeterminate { animation:none; } }
@media(max-width:600px) {
  :root { --activity-height:44px; }
  body { padding-bottom:calc(64px + var(--activity-height) + env(safe-area-inset-bottom)); }
  #sections { bottom:calc(10px + var(--activity-height) + env(safe-area-inset-bottom)); }
  .activity-bar { gap:6px; flex-wrap:wrap; align-content:center; row-gap:2px; }
  .activity-label { max-width:55%; }
  .activity-detail { flex-basis:30%; }
  .activity-bar progress { order:5; flex:1; width:auto; min-width:60%; }
  .activity-percent { order:6; }
  .toast { bottom:calc(76px + var(--activity-height) + env(safe-area-inset-bottom)); }
}

.activity-bar .activity-cancel { width:auto; padding:0 8px; border:1px solid var(--line); border-radius:5px; }
.activity-bar .activity-cancel:disabled { opacity:.65; cursor:wait; }

/* Beatgrid preview stays separate from live playback until Apply. */
.grid-editor { width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; padding: 18px; box-sizing: border-box; display: flex; flex-direction: column; gap: 12px; }
.grid-head { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.grid-head h2 { margin: 0; font-size: 18px; white-space: nowrap; }
.grid-head .note { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.grid-head .btn { margin-left: auto; }
.grid-editor canvas { display: block; width: 100%; height: 170px; border: 1px solid var(--line); border-radius: 10px; touch-action: none; cursor: crosshair; }
.grid-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.grid-row label { display: flex; align-items: center; gap: 8px; max-width: 100%; }
.grid-row input { width: 100px; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--text); font: inherit; font-family: var(--mono); }
.grid-row input[type=checkbox] { width: 18px; min-height: 18px; accent-color: var(--accent-2); }
.grid-row select { max-width: 100%; min-width: 0; padding: 8px; min-height: 40px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.grid-row .num { min-width: 70px; text-align: center; color: var(--muted); }
.grid-group { display: inline-flex; flex-wrap: nowrap; align-items: center; gap: 8px; }
.grid-sep { width: 1px; height: 22px; margin: 0 2px; background: var(--line); }
.grid-tabs { display: flex; gap: 2px; padding: 3px; width: max-content; max-width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.grid-tab { padding: 7px 14px; border: 0; border-radius: 9px; background: none; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.grid-tab i { margin-right: 6px; font-style: normal; font-weight: 500; opacity: 0.7; }
.grid-tab[aria-selected='true'] { background: var(--panel-3); color: var(--text); }
.grid-panel { display: flex; flex-direction: column; gap: 10px; min-height: 124px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.grid-panel[hidden] { display: none; }
.grid-hint { margin: 0; line-height: 1.45; }
.grid-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.grid-foot [role='status'] { flex: 1; min-width: 160px; margin: 0; }
.grid-editor .btn { min-height: 40px; }
.grid-editor .btn.small { min-height: 34px; min-width: 34px; justify-content: center; }
@media (max-width: 600px) {
  .grid-editor { padding: 12px; }
  .grid-editor .btn, .grid-editor .btn.small, .grid-row input { min-height: 44px; }
  .grid-editor canvas { height: 120px; }
  .grid-tabs { width: 100%; }
  .grid-tab { flex: 1; padding: 7px 6px; }
  .grid-sep { display: none; }
}

/* Ajustes → Biblioteca: mantenimiento agrupado (antes en la columna de la biblioteca). */
.maint-group { padding: 10px 0; border-bottom: 1px solid var(--line); }
.maint-group:last-child { border-bottom: 0; }
.maint-group h3 { margin: 0 0 8px; font-size: 13px; }
.maint-group .note { margin: 8px 0 0; }

/* Aviso de arranque de Pro mientras macOS pide el permiso de Documentos (bootstrap.js). */
.startup-hint { position: fixed; z-index: 99998; top: 72px; left: 50%; transform: translateX(-50%); width: min(460px, calc(100vw - 32px)); padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35); }
.startup-hint strong { display: block; margin-bottom: 4px; }
.startup-hint p { margin: 0; color: var(--muted); line-height: 1.45; }

/* Aviso de que CoreAudio vuelve a responder tras arrancar con el audio del navegador (main.js). */
.native-recovery { position: fixed; z-index: 95; right: 16px; bottom: calc(var(--activity-height) + 16px + env(safe-area-inset-bottom)); width: min(420px, calc(100vw - 32px)); padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35); }
.native-recovery strong { display: block; margin-bottom: 4px; }
.native-recovery p { margin: 0 0 10px; color: var(--muted); line-height: 1.45; }

/* Ficha de pista: corregir la octava del BPM (½ o ×2). */
.bpm-octave { display: flex; gap: 6px; flex-wrap: wrap; }

/* Móviles muy estrechos (360 px): el cambio de tema queda en Ajustes → Apariencia para que la
   cabecera quepa en una fila. */
@media (max-width: 370px) {
  .topbar #btnTheme {
    display: none !important;
  }
}

/* ---------- Móvil: pestaña Mezcla ----------
   En el móvil la cabina enseña un deck cada vez y del mezclador solo el crossfader; la pestaña
   Mezcla (solo en el móvil, como en la propuesta de diseño) enseña las ondas y el mezclador
   entero: gain, EQ, filtro, faders, vúmetros y crossfader. */
#sections .sec-movil {
  display: none;
}
@media (max-width: 600px) {
  #sections .sec-movil {
    display: block;
  }
  body[data-sec='mezcla'] .mixer .strips {
    display: flex !important;
  }
  body[data-sec='mezcla'] .mixer {
    padding: 12px;
  }
}

/* Lista estrecha (el móvil): título y artista en dos líneas, y a la derecha BPM y tono. Así el
   título no se corta en «Marea b…» por dejar sitio a columnas fijas. La duración se ve en la
   ficha. Orden de cada fila: marca, título, artista, género, BPM, tono, duración, mezcla. */
@container (max-width: 460px) {
  #trackList .tr:not(.recording-row),
  #libHead:not(.rec-head) {
    grid-template-columns: 22px minmax(0, 1fr) 56px 38px;
    grid-template-rows: auto auto;
    row-gap: 0;
    padding-top: 4px;
    padding-bottom: 4px;
    line-height: 1.15;
  }
  #trackList .tr:not(.recording-row) > :nth-child(1),
  #libHead:not(.rec-head) > :nth-child(1) {
    grid-row: 1 / 3;
  }
  #trackList .tr:not(.recording-row) > :nth-child(2),
  #libHead:not(.rec-head) > :nth-child(2) {
    grid-column: 2;
    grid-row: 1;
  }
  #trackList .tr:not(.recording-row) > :nth-child(3) {
    grid-column: 2;
    grid-row: 2;
    font-size: 0.86em;
  }
  #trackList .tr:not(.recording-row) > :nth-child(5),
  #libHead:not(.rec-head) > :nth-child(5) {
    grid-column: 3;
    grid-row: 1 / 3;
  }
  #trackList .tr:not(.recording-row) > :nth-child(6),
  #libHead:not(.rec-head) > :nth-child(6) {
    grid-column: 4;
    grid-row: 1 / 3;
  }
  #trackList .tr:not(.recording-row) > :nth-child(7),
  #libHead:not(.rec-head) > :nth-child(3),
  #libHead:not(.rec-head) > :nth-child(7) {
    display: none;
  }
}

/* Separadores de la lista virtual de la biblioteca (ver libview.js). */
.list-spacer {
  pointer-events: none;
}

/* Ajustes en tarjetas (21-10-2026, ver js/settings-layout.js): cada sección con su título y sus
   grupos en tarjetas, en una rejilla de una a tres columnas; las explicaciones, tras el botón ⓘ. */
.set-body {
  gap: 18px;
}
.set-body .panel {
  background: transparent;
  border: 0;
  padding: 4px 2px 6px;
}
.set-body .panel > h2,
.set-body .panel-head > h2 {
  margin: 6px 2px 12px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.scards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
  gap: 14px;
  align-items: start;
}
.scard {
  min-width: 0;
  padding: 12px 16px 8px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}
.scard.wide {
  grid-column: 1 / -1;
}
.scard-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  margin-bottom: 2px;
}
.scard-head.untitled {
  justify-content: flex-end;
}
.scard-head.untitled:empty {
  display: none;
}
.scard-head h3 {
  flex: 1;
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}
.scard .srow {
  flex-wrap: wrap;
  min-height: 44px;
  padding: 6px 0;
}
/* En una tarjeta estrecha, el nombre del ajuste guarda un ancho mínimo y el control baja a la
   línea siguiente antes que apretarlo; un selector de opciones largo parte sus botones. */
.scard .srow > .g {
  flex: 1 1 10em;
}
.scard .srow > .seg {
  flex-wrap: wrap;
  max-width: 100%;
}
.scard .srow > .seg button {
  flex: 1 1 auto;
}
/* El buscador queda fijo arriba: al saltar a una sección, su título no se esconde debajo. */
.set-body > .panel {
  scroll-margin-top: 52px;
}
.scard-head + .srow,
.scard-head + [hidden] + .srow,
.scard > .srow:first-child,
.scard > [hidden]:first-child + .srow {
  border-top: 0;
}
.help-btn {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--muted);
  font: 700 12px/1 var(--mono);
  cursor: pointer;
}
.scard.show-help .help-btn {
  background: var(--panel-3);
  color: var(--text);
}
.set-body .help-note {
  display: none;
}
.set-body .scard.show-help .help-note {
  display: block;
}
.set-search {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  padding: 6px 2px;
  background: var(--bg);
}
.set-search input {
  width: min(320px, 100%);
  height: 34px;
  padding: 0 12px;
}
.set-body .search-miss {
  display: none !important;
}
/* Título de una sección de una sola tarjeta, con el botón ⓘ de esa tarjeta al lado. */
.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel-head > h2 {
  flex: 0 1 auto;
}
.panel-head > .help-btn {
  margin-top: -6px;
}
/* Etiquetas de estado junto al título de una sección o de una tarjeta. */
.set-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.set-chips:empty {
  display: none;
}
.panel-head > .set-chips {
  flex: 1;
  margin-bottom: 6px;
}
.scard-head > .set-chips {
  justify-content: flex-end;
}
.schip {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--text);
  font: 600 12px/1.2 var(--mono);
}
.schip.ok {
  background: var(--accent);
  color: var(--on);
}
.schip.warn {
  background: var(--warn);
  color: #0a0b0d;
}
/* Más opciones: lo poco usado queda plegado hasta pulsar el botón (el buscador lo enseña). */
.set-body:not(.searching) .panel:not(.show-more) .more {
  display: none;
}
.more-btn {
  max-width: 100%;
  margin-top: 12px;
  height: auto;
  min-height: 36px;
  padding: 8px 14px;
  border-style: dashed;
  background: transparent;
  white-space: normal;
  text-align: left;
}
.set-body.searching .more-btn {
  display: none;
}
/* Salidas: una fila por señal y una columna por par de canales. */
.route-grid {
  max-width: 560px;
  display: grid;
  grid-template-columns: minmax(96px, 1fr) repeat(4, minmax(40px, 64px));
  align-items: center;
  gap: 4px 6px;
  padding: 6px 0;
}
.route-row {
  display: contents;
}
.route-col {
  text-align: center;
  font: 600 12px var(--mono);
  color: var(--muted);
}
.route-name {
  min-width: 0;
  font-size: 14px;
}
.route-dot {
  justify-self: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: transparent;
  cursor: pointer;
  position: relative;
}
.route-dot::after {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--panel-3);
}
.route-dot.on {
  border-color: var(--accent);
}
.route-dot.on::after {
  background: var(--accent);
}
.route-dot.na {
  border-style: dashed;
  opacity: 0.45;
  cursor: default;
}
.route-dot.on.na::after {
  background: var(--warn);
}
.route-dot:focus-visible {
  outline: 2px solid var(--a);
  outline-offset: 2px;
}
/* Controladores: una pestaña por aparato conectado. */
.dev-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 2px 14px;
}
.dev-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}
.dev-tab .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.dev-tab[aria-selected='true'] {
  border-color: var(--a);
  background: color-mix(in srgb, var(--a) 14%, var(--panel));
}
.set-body:not(.searching) #devicePanels > .panel.tab-hidden {
  display: none;
}
/* En una tarjeta, la fila de estado de un aparato y la lista de conectados parten sus botones. */
.scard .ctl-row {
  flex-wrap: wrap;
}
.scard .ctl-row > .g {
  flex: 1 1 12em;
}
