/* ── LivePads Móvil — identidad de la app (oscuro + ámbar), táctil ───────── */
:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --card: #1a1a1a;
  --border: rgba(255, 255, 255, 0.08);
  --accent: #fbae00;
  --accent-dim: rgba(251, 174, 0, 0.14);
  --text: #f2f2f2;
  --muted: #9aa0ad;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  overscroll-behavior: none;
}
.hidden { display: none !important; }
/* El atributo `hidden` debe ganar SIEMPRE (el display:flex de algunas cajas
   —p. ej. la carátula de respaldo— lo pisaba y salían dos carátulas). */
[hidden] { display: none !important; }
.screen { min-height: 100dvh; display: flex; flex-direction: column; }
/* Entrada suave de cada pantalla (sensación de app nativa). */
.screen:not(.hidden) { animation: screen-in 0.26s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes screen-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen:not(.hidden) { animation: none; } }
button { font-family: inherit; cursor: pointer; }
input[type='range'] { accent-color: var(--accent); height: 30px; width: 100%; }

/* ── Login ──────────────────────────────────────────────────────────────── */
#screen-login { align-items: center; justify-content: center; padding: 24px; }
.login-box { width: 100%; max-width: 360px; text-align: center; }
.login-logo { width: 72px; height: 72px; border-radius: 18px; margin-bottom: 14px; }
.login-box h1 { margin: 0 0 4px; font-size: 26px; font-weight: 900; letter-spacing: -0.02em; }
.login-box h1 span { color: var(--accent); }
.login-sub { color: var(--muted); margin: 0 0 26px; font-size: 14px; }
#login-form { display: flex; flex-direction: column; gap: 10px; }
#login-form input {
  height: 52px; padding: 0 16px; border-radius: 12px; font-size: 16px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
#login-form input:focus { outline: none; border-color: rgba(251, 174, 0, 0.5); }
.btn-primary {
  height: 52px; border: none; border-radius: 12px; font-size: 16px; font-weight: 800;
  background: var(--accent); color: #111;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary[disabled] { opacity: 0.6; }
.login-err { color: #ff6b6b; font-size: 13px; min-height: 18px; margin: 12px 0 0; }
.login-hint { color: var(--muted); font-size: 12px; margin-top: 18px; }

/* ── Biblioteca ─────────────────────────────────────────────────────────── */
.lib-head {
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 10px;
  position: sticky; top: 0; z-index: 5; background: rgba(10, 10, 10, 0.96);
  border-bottom: 1px solid var(--border);
}
.lib-head-inner { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lib-title {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  background: none; border: none; color: var(--text); padding: 0; text-align: left;
}
.lib-title:active { opacity: 0.7; }
.lib-title-txt { min-width: 0; }
.caret { color: var(--accent); font-size: 12px; }
.lib-logo { width: 38px; height: 38px; border-radius: 10px; }
.lib-title h2 { margin: 0; font-size: 17px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-sub { margin: 0; color: var(--muted); font-size: 11px; }
.lib-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; font-size: 19px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.icon-btn:active { background: var(--card); }
.lib-head-inner, .lib-tools, .song-list { max-width: 720px; margin-left: auto; margin-right: auto; width: 100%; }
.lib-tools { padding: 10px 16px 4px; }
#search {
  width: 100%; height: 48px; padding: 0 16px; border-radius: 12px; font-size: 15px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
#search:focus { outline: none; border-color: rgba(251, 174, 0, 0.5); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 9px 14px; border-radius: 10px; font-size: 12px; font-weight: 700;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.chip.active { background: var(--accent); color: #111; border-color: var(--accent); }
.chip .hoy {
  font-size: 9px; font-weight: 900; padding: 1px 4px; border-radius: 4px;
  background: var(--accent); color: #111; margin-right: 5px;
}
.chip.active .hoy { background: rgba(0, 0, 0, 0.2); }

.song-list { flex: 1; padding: 6px 16px calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; -webkit-overflow-scrolling: touch; }
.song-card {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--border); text-align: left; color: var(--text); width: 100%;
  transition: transform 0.08s ease, background 0.12s ease;
}
.song-card:active { background: #222; transform: scale(0.985); }
.song-cover {
  width: 54px; height: 54px; border-radius: 10px; flex: none; object-fit: cover;
  background: var(--surface); display: flex; align-items: center; justify-content: center;
  font-weight: 900; color: var(--accent); font-size: 18px;
}
.song-info { flex: 1; min-width: 0; }
.song-info b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-info small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.song-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.key-badge {
  min-width: 38px; text-align: center; padding: 5px 8px; border-radius: 8px; font-weight: 900; font-size: 13px;
  background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(251, 174, 0, 0.3);
}
.bpm-badge { color: var(--muted); font-size: 11px; font-family: ui-monospace, monospace; }
.empty { color: var(--muted); text-align: center; padding: 48px 20px; font-size: 14px; }

/* ── Reproducción ───────────────────────────────────────────────────────── */
.pl-head {
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  position: sticky; top: 0; z-index: 5; background: rgba(10, 10, 10, 0.96);
  border-bottom: 1px solid var(--border);
}
.pl-head-inner { display: flex; align-items: center; gap: 10px; }
.pl-head-inner, .pl-nav, .pl-body { max-width: 560px; margin-left: auto; margin-right: auto; width: 100%; }
.pl-title { flex: 1; min-width: 0; text-align: left; }
.pl-title h2 { margin: 0; font-size: 16px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-title p { margin: 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px 16px calc(28px + env(safe-area-inset-bottom, 0px)); }

.pl-cover-wrap { display: flex; justify-content: center; margin-bottom: 18px; }
.pl-cover, .pl-cover-fallback {
  width: min(62vw, 280px); height: min(62vw, 280px); border-radius: 22px; object-fit: cover;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  animation: cover-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes cover-in { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
.pl-cover-fallback { background: var(--card); display: flex; align-items: center; justify-content: center; font-size: 64px; }

.pl-track { margin-bottom: 14px; }
.seg { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.seg-btn { flex: 1; height: 46px; border: none; background: transparent; color: var(--muted); font-weight: 800; font-size: 14px; }
.seg-btn.active { background: var(--accent); color: #111; }
.seg-btn[disabled] { opacity: 0.35; }
.pl-state { min-height: 18px; text-align: center; color: var(--accent); font-size: 12px; padding-top: 6px; }
.pl-transport { display: flex; align-items: center; justify-content: center; gap: 26px; padding: 10px 0 6px; }
.round-btn {
  width: 56px; height: 56px; border-radius: 50%; font-size: 14px; font-weight: 800;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  transition: transform 0.09s ease, background 0.12s ease;
}
.round-btn.big {
  width: 80px; height: 80px; font-size: 28px; background: var(--accent); color: #111; border: none;
  box-shadow: 0 8px 26px rgba(251, 174, 0, 0.35);
}
.round-btn:active { transform: scale(0.92); }
.pl-progress { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.pl-progress span { font-family: ui-monospace, monospace; font-size: 11px; color: var(--muted); min-width: 36px; }
.pl-progress span:last-child { text-align: right; }
.pl-progress input { flex: 1; }

.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px;
}
.panel h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }
.panel-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.panel-row h3 { margin: 0; }
.hint { color: var(--muted); font-size: 11px; margin: 8px 0 0; }

/* Mezcla: un bloque por canal. Nombre arriba, volumen a lo ancho, y el paneo
   L—R debajo (más pequeño). Claro y con targets grandes para el dedo. */
.mix-ch { padding: 10px 0; border-bottom: 1px solid var(--border); }
.mix-ch:last-of-type { border-bottom: none; padding-bottom: 4px; }
.mix-name { display: block; font-size: 13px; font-weight: 800; margin-bottom: 2px; }
.mix-vol { width: 100%; display: block; }
.mix-pan { display: grid; grid-template-columns: 16px 1fr 16px; align-items: center; gap: 8px; margin-top: 2px; }
.mix-pan small { color: var(--muted); font-size: 10px; font-weight: 900; text-align: center; }
.mix-pan input { width: 100%; height: 24px; }

.bpm-ctl { display: flex; align-items: center; gap: 8px; }
.mini-btn {
  width: 40px; height: 40px; border-radius: 10px; font-size: 18px; font-weight: 900;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.bpm-val { font-family: ui-monospace, monospace; font-size: 20px; font-weight: 800; min-width: 52px; text-align: center; }
.bpm-unit { color: var(--muted); font-size: 11px; font-weight: 800; }
.btn-toggle {
  height: 44px; padding: 0 18px; border-radius: 12px; font-weight: 800; font-size: 14px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.btn-toggle.on { background: var(--accent); color: #111; border-color: var(--accent); }
.beat-dots { display: flex; gap: 10px; justify-content: center; padding-top: 12px; }
.beat-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); transition: transform 0.05s; }
.beat-dot.hit { background: var(--accent); transform: scale(1.35); }
.beat-dot.accent.hit { background: #fff; }

.pads-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pad-btn {
  height: 58px; border-radius: 12px; font-size: 16px; font-weight: 900;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  position: relative;
}
.pad-btn { transition: transform 0.08s ease, background 0.12s ease, box-shadow 0.15s ease; }
.pad-btn:active { transform: scale(0.94); }
/* Feedback táctil consistente en todos los controles */
.chip, .seg-btn, .mini-btn, .btn-toggle, .icon-btn, .nav-btn { transition: transform 0.08s ease, background 0.12s ease, color 0.12s ease; }
.chip:active, .mini-btn:active, .btn-toggle:active, .icon-btn:active { transform: scale(0.94); }
.pad-btn.on { background: var(--accent); color: #111; border-color: var(--accent); box-shadow: 0 0 24px rgba(251, 174, 0, 0.35); }
.pad-btn.song-key::after {
  content: '●'; position: absolute; top: 4px; right: 7px; font-size: 8px; color: var(--accent);
}
.pad-btn.on.song-key::after { color: #111; }
.pad-btn.loading { opacity: 0.55; }

/* ── Descarga offline (barra + punto por canción) ───────────────────────── */
.offline-bar {
  width: 100%; margin-top: 8px; height: 42px; border-radius: 10px;
  background: var(--accent-dim); border: 1px solid var(--accent);
  color: var(--accent); font-size: 13px; font-weight: 800; letter-spacing: 0.02em;
}
.offline-bar:active { opacity: 0.8; }
.offline-bar.done {
  background: rgba(134, 239, 172, 0.08); border-color: rgba(134, 239, 172, 0.3); color: #86efac;
}
.song-meta-top { display: flex; align-items: center; gap: 7px; }
.offline-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: transparent; border: 1.5px solid var(--border);
}
.offline-dot.ready { background: #86efac; border-color: #86efac; box-shadow: 0 0 6px rgba(134, 239, 172, 0.5); }

/* ── Navegación dentro del setlist (player) ─────────────────────────────── */
.pl-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 6px 16px 0;
}
.nav-btn {
  width: 52px; height: 40px; border-radius: 10px; font-size: 15px; font-weight: 900;
  background: var(--card); border: 1px solid var(--border); color: var(--accent);
}
.nav-btn:disabled { opacity: 0.25; color: var(--muted); }
.nav-btn:active:not(:disabled) { background: var(--accent-dim); }
.pl-pos { font-size: 13px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ── Hoja de selección (repertorio) ─────────────────────────────────────── */
.sheet {
  position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.7);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-card {
  width: 100%; max-width: 480px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 20px 20px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
}
.sheet-card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 900; text-align: center; }
.sheet-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.sheet-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 15px 16px; border-radius: 12px; font-size: 15px; font-weight: 700;
  background: var(--card); border: 1px solid var(--border); color: var(--text); text-align: left;
}
.sheet-item.active { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }
.btn-ghost {
  width: 100%; height: 48px; border-radius: 12px; font-size: 15px; font-weight: 700;
  background: transparent; border: 1px solid var(--border); color: var(--muted);
}

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%); z-index: 50; max-width: 90vw;
  background: #222; color: var(--text); border: 1px solid var(--border);
  padding: 12px 18px; border-radius: 12px; font-size: 13px; font-weight: 600;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); text-align: center;
}

/* Tablet: dos columnas de cards */
@media (min-width: 700px) {
  .song-list { display: grid; grid-template-columns: 1fr 1fr; align-content: start; }
  .pads-grid { grid-template-columns: repeat(6, 1fr); }
}
