/* ============ DJ INTERRUPTUS ============ */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

:root {
  --bg: #0d0d14;
  --panel: #16161f;
  --panel2: #1d1d2b;
  --line: #2c2c3e;
  --txt: #e8e8f0;
  --dim: #8a8aa0;
  --a: #00e5ff;   /* deck A cian */
  --b: #ff3d81;   /* deck B magenta */
  --acc: #ffd166; /* acento ámbar */
}

html, body { margin: 0; padding: 0; background: var(--bg); color: var(--txt);
  font-family: -apple-system, "SF Pro", Segoe UI, Roboto, sans-serif;
  -webkit-user-select: none; user-select: none; }

/* ---------- Header ---------- */
header { display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--panel); border-bottom: 1px solid var(--line); }
header h1 { font-size: 18px; margin: 0; letter-spacing: 2px; white-space: nowrap; }
header h1 span { color: var(--acc); }
.searchbar { flex: 1; display: flex; gap: 6px; }
.searchbar input { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; color: var(--txt); padding: 10px 14px; font-size: 16px; outline: none; }
.searchbar input:focus { border-color: var(--acc); }
.searchbar button, #keyBtn { background: var(--panel2); border: 1px solid var(--line);
  border-radius: 10px; font-size: 18px; padding: 8px 14px; color: var(--txt); }

/* ---------- Layout principal ---------- */
main { display: grid; grid-template-columns: minmax(0,1fr) minmax(180px, 240px) minmax(0,1fr);
  gap: 12px; padding: 12px; align-items: start; }
@media (max-width: 900px) {
  main { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .mixer { grid-column: 1 / -1; grid-row: 2; }
}
/* móvil / ventana estrecha: todo en una columna */
@media (max-width: 600px) {
  main { grid-template-columns: minmax(0,1fr); gap: 10px; padding: 8px; }
  .mixer { grid-column: auto; grid-row: auto; }
  header { flex-wrap: wrap; padding: 8px 10px; }
  header h1 { font-size: 14px; letter-spacing: 1px; }
  .controls { width: 100%; }
  .btn { min-width: 0; flex: 1; padding: 12px 4px; }
  .btn.big { flex: none; }
  #panel { margin: 0 8px 8px; }
}

/* ---------- Decks ---------- */
.deck { background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.deck-head { display: flex; align-items: center; gap: 8px; min-height: 22px; }
.deck-tag { font-size: 11px; font-weight: 800; letter-spacing: 1px;
  padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.tag-a { color: var(--a); border: 1px solid var(--a); }
.tag-b { color: var(--b); border: 1px solid var(--b); }
.deck-title { font-size: 13px; color: var(--dim); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }

.player-wrap { position: relative; aspect-ratio: 16/9; background: #000;
  border-radius: 10px; overflow: hidden; }
.player-wrap iframe, .player-wrap > div:first-child { position: absolute; inset: 0;
  width: 100%; height: 100%; border: 0; }
.shield { position: absolute; inset: 0; z-index: 5; }

.times { display: flex; justify-content: space-between; font-size: 12px;
  color: var(--dim); font-variant-numeric: tabular-nums; padding: 0 2px; }

.controls { display: flex; gap: 6px; justify-content: center; }
.btn { background: var(--panel2); color: var(--txt); border: 1px solid var(--line);
  border-radius: 10px; font-size: 16px; font-weight: 700; padding: 12px 14px;
  min-width: 52px; cursor: pointer; }
.btn:active { background: var(--line); }
.btn.play { min-width: 70px; font-size: 20px; }
.deck[data-deck="A"] .btn.play { border-color: var(--a); color: var(--a); }
.deck[data-deck="B"] .btn.play { border-color: var(--b); color: var(--b); }
.btn.small { font-size: 12px; min-width: 42px; padding: 12px 8px; }
.btn.tiny { font-size: 11px; min-width: 36px; padding: 6px; }
.btn.big { font-size: 17px; padding: 16px 10px; width: 100%;
  background: linear-gradient(180deg, #2a2a3d, #1d1d2b);
  border-color: var(--acc); color: var(--acc); letter-spacing: 1px; }
.btn.big:active { background: var(--acc); color: #000; }
.btn.big.mixing { animation: pulse 0.7s infinite alternate; }
@keyframes pulse { from { box-shadow: 0 0 4px var(--acc); } to { box-shadow: 0 0 18px var(--acc); } }

.rate { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); }
.rate label { white-space: nowrap; }
.rate input { flex: 1; }

/* ---------- Sliders ---------- */
input[type="range"] { -webkit-appearance: none; appearance: none; background: transparent; height: 34px; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--line); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; border-radius: 50%; background: var(--txt);
  margin-top: -10px; border: 2px solid var(--bg); box-shadow: 0 2px 6px rgba(0,0,0,.6); }
.seek { width: 100%; }
.deck[data-deck="A"] .seek::-webkit-slider-thumb { background: var(--a); }
.deck[data-deck="B"] .seek::-webkit-slider-thumb { background: var(--b); }

/* ---------- Mixer ---------- */
.mixer { background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 12px; display: flex; flex-direction: column; gap: 10px; }
.xfade-labels { display: flex; justify-content: space-between; font-size: 11px;
  font-weight: 800; letter-spacing: 1px; color: var(--dim); }
.xfade-labels .tag-a { border: none; }
.xfade-labels .tag-b { border: none; }
#xfader { width: 100%; height: 56px; }
#xfader::-webkit-slider-runnable-track { height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--a), var(--panel2) 35%, var(--panel2) 65%, var(--b)); }
#xfader::-webkit-slider-thumb { width: 44px; height: 44px; border-radius: 10px;
  background: #dfe3ee; margin-top: -16px; }
.automix { display: flex; flex-direction: column; gap: 10px; }
.durlabel { font-size: 13px; color: var(--dim); display: flex; align-items: center; gap: 8px; }
.durlabel select { background: var(--panel2); color: var(--txt); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 15px; }
.check { font-size: 12px; color: var(--dim); display: flex; align-items: center; gap: 6px; }
.check input { width: 18px; height: 18px; }
.modenote { font-size: 11px; color: var(--dim); line-height: 1.4;
  border-top: 1px dashed var(--line); padding-top: 8px; }

/* ---------- Panel lista/resultados ---------- */
#panel { margin: 0 12px 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden;
  margin-bottom: max(12px, env(safe-area-inset-bottom)); }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab { flex: 1; background: none; border: none; color: var(--dim); font-size: 14px;
  font-weight: 700; padding: 12px; }
.tab.active { color: var(--txt); background: var(--panel2); }
.list { max-height: 320px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.list.hidden { display: none; }
.empty { padding: 24px; text-align: center; color: var(--dim); font-size: 13px; }

.item { display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-bottom: 1px solid var(--line); }
.item img { width: 84px; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px;
  background: #000; flex-shrink: 0; }
.item .meta { flex: 1; min-width: 0; }
.item .t { font-size: 13px; line-height: 1.3; max-height: 2.6em; overflow: hidden; }
.item .s { font-size: 11px; color: var(--dim); margin-top: 2px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.item .acts { display: flex; gap: 6px; flex-shrink: 0; }
.item .acts button { width: 44px; height: 44px; border-radius: 10px; font-size: 15px;
  font-weight: 800; background: var(--panel2); border: 1px solid var(--line); color: var(--txt); }
.item .acts button[data-act="loadA"] { color: var(--a); border-color: var(--a); }
.item .acts button[data-act="loadB"] { color: var(--b); border-color: var(--b); }
.item .acts button[data-act="del"] { color: var(--dim); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal.hidden { display: none; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; max-width: 480px; width: 100%; }
.modal-box h2 { margin: 0 0 10px; font-size: 17px; }
.modal-box p, .modal-box ol { font-size: 13px; color: var(--dim); line-height: 1.5; }
.modal-box input { width: 100%; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; color: var(--txt); padding: 12px; font-size: 14px; margin: 10px 0; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--acc); color: #000; font-weight: 700; font-size: 14px;
  padding: 12px 20px; border-radius: 12px; z-index: 60;
  box-shadow: 0 4px 20px rgba(0,0,0,.5); transition: opacity .3s; }
.toast.hidden { opacity: 0; pointer-events: none; }
