/* JS Play PWA — estilos (móvil primero, tema burdeos) */
:root {
  --burgundy: #800020;
  --magenta: #c60c58;
  --bg: #12060d;
  --bg2: #1e0a13;
  --card: #26101c;
  --card2: #331627;
  --text: #f5eef1;
  --muted: #c9a8b8;
  --accent: #ff4d8d;
  --gold: #ffc93c;
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  padding-bottom: 96px; /* espacio para la barra de reproducción */
}
a { color: var(--accent); }
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 15px;
  background: var(--burgundy);
  color: #fff;
}
button.secondary { background: var(--card2); color: var(--text); }
button.ghost { background: transparent; color: var(--accent); padding: 8px 10px; }
button:disabled { opacity: .45; cursor: default; }
input, select, textarea {
  font-family: inherit;
  font-size: 15px;
  background: var(--bg2);
  color: var(--text);
  border: 1px solid #4a2233;
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
}
input[type="range"] { padding: 0; accent-color: var(--magenta); }
input[type="checkbox"] { width: auto; accent-color: var(--magenta); }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 18px; margin: 18px 0 8px; }
h3 { font-size: 16px; margin: 14px 0 6px; }
p { margin: 8px 0; }
small, .muted { color: var(--muted); }
code { background: var(--bg2); padding: 1px 6px; border-radius: 6px; font-size: 13px; }

/* Cabecera fija */
header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(90deg, var(--burgundy), #5c0a24);
  padding: 10px 12px;
}
header .logo { font-weight: 800; font-size: 20px; letter-spacing: .5px; white-space: nowrap; }
header .spacer { flex: 1; }
header .iconbtn {
  background: rgba(255,255,255,.12); color: #fff;
  width: 40px; height: 40px; padding: 0; border-radius: 12px;
  font-size: 19px; display: inline-flex; align-items: center; justify-content: center;
}
header .status-chip {
  font-size: 12px; background: rgba(0,0,0,.3); color: #ffd7e6;
  border-radius: 999px; padding: 6px 10px; white-space: nowrap; max-width: 150px;
  overflow: hidden; text-overflow: ellipsis;
}
nav#menu {
  display: none;
  background: var(--bg2);
  border-bottom: 1px solid #3a1626;
  padding: 8px 12px;
  flex-wrap: wrap; gap: 8px;
}
nav#menu.open { display: flex; }
nav#menu button { flex: 1 1 30%; white-space: nowrap; }

main { padding: 12px 14px 24px; max-width: 860px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }

/* Tarjetas */
.card {
  background: var(--card);
  border: 1px solid #3a1626;
  border-radius: var(--radius);
  padding: 14px;
  margin: 10px 0;
}
.card h3 { margin-top: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.group-card {
  background: var(--card);
  border: 1px solid #3a1626;
  border-radius: var(--radius);
  padding: 12px;
  text-align: left;
  color: var(--text);
  display: flex; flex-direction: column; gap: 6px;
}
.group-card b { font-size: 15px; }
.group-card .count { color: var(--muted); font-size: 13px; }
.group-card .row { display: flex; gap: 6px; }
.group-card .row button { flex: 1; padding: 7px 6px; font-size: 13px; }

.notice {
  border-radius: 12px; padding: 12px 14px; margin: 10px 0;
  background: #2a1a05; border: 1px solid #6b4d12; color: #ffe1a8;
}
.notice.info { background: #0a2233; border-color: #155e75; color: #bfe8ff; }
.notice.ok { background: #0a2e1a; border-color: #166534; color: #bbf7d0; }
.notice.danger { background: #330f0f; border-color: #7f1d1d; color: #fecaca; }
.hidden { display: none !important; }

/* Reproductor */
.cover {
  width: 100%; max-width: 320px; aspect-ratio: 1;
  margin: 6px auto 10px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 64px; font-weight: 800; color: rgba(255,255,255,.9);
  background: linear-gradient(135deg, var(--burgundy), var(--magenta));
  text-shadow: 0 2px 12px rgba(0,0,0,.5);
}
.track-title { text-align: center; font-size: 19px; font-weight: 700; margin: 4px 0 0; }
.track-artist { text-align: center; color: var(--muted); margin: 2px 0 8px; }
#viz { width: 100%; height: 74px; background: var(--bg2); border-radius: 12px; display: block; }
.controls { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 12px 0 4px; }
.controls .big {
  width: 64px; height: 64px; border-radius: 50%; font-size: 26px;
  background: var(--magenta); padding: 0;
}
.controls .mid { width: 48px; height: 48px; border-radius: 50%; font-size: 19px; padding: 0; background: var(--card2); }
.progress { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.progress input { flex: 1; }
.stars { display: flex; justify-content: center; gap: 4px; margin: 6px 0; }
.stars button { background: transparent; color: var(--gold); font-size: 26px; padding: 2px 4px; }
.stars button.off { color: #5b3a48; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.chip {
  background: var(--card2); border-radius: 999px; padding: 6px 12px;
  font-size: 13px; color: var(--text);
}
.chip.on { background: var(--magenta); }

/* Lista de canciones */
.song {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px; border-bottom: 1px solid #2c1220;
  cursor: pointer;
}
.song.playing { background: #331627; border-radius: 10px; }
.song .info { flex: 1; min-width: 0; }
.song .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song .s { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song .mini { font-size: 12px; color: var(--muted); }
.song button { padding: 6px 10px; font-size: 13px; }

/* Barra de reproducción siempre visible */
#playbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: #1e0a13f2; border-top: 1px solid #3a1626;
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  backdrop-filter: blur(6px);
}
#playbar .pb-info { flex: 1; min-width: 0; cursor: pointer; }
#playbar .pb-t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#playbar .pb-a { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#playbar button { padding: 8px 12px; }
#playbar .pb-play { width: 46px; height: 46px; border-radius: 50%; padding: 0; font-size: 19px; background: var(--magenta); }

/* Cola (panel) */
#queuePanel {
  position: fixed; left: 0; right: 0; bottom: 78px; z-index: 45;
  max-height: 55vh; overflow-y: auto;
  background: var(--bg2); border-top: 1px solid #3a1626;
  padding: 10px 14px 16px; box-shadow: 0 -8px 30px rgba(0,0,0,.5);
}
#queuePanel .q-head { display: flex; justify-content: space-between; align-items: center; }

/* Ecualizador */
.eq-band { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
.eq-band input[type="range"] { writing-mode: vertical-lr; direction: rtl; width: 26px; height: 110px; }
.eq-bands { display: flex; gap: 4px; margin: 10px 0; }
.eq-band span { font-size: 11px; color: var(--muted); }
.eq-band b { font-size: 12px; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }

/* Modal genérico */
.modal-back {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.65);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--bg2); width: 100%; max-width: 560px; max-height: 88vh;
  overflow-y: auto; border-radius: 18px 18px 0 0; padding: 16px;
}
.modal .m-head { display: flex; justify-content: space-between; align-items: center; }
.modal .m-head button { background: transparent; color: var(--text); font-size: 20px; padding: 4px 10px; }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 10px; font-size: 14px; margin: 8px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.device-code {
  font-size: 34px; font-weight: 800; letter-spacing: 6px; text-align: center;
  background: var(--bg); border: 1px dashed var(--magenta);
  border-radius: 12px; padding: 14px 6px; margin: 10px 0; user-select: all;
}
.progressbar { height: 10px; background: var(--bg2); border-radius: 999px; overflow: hidden; }
.progressbar > div { height: 100%; background: linear-gradient(90deg, var(--burgundy), var(--magenta)); }
.tag { display: inline-block; background: var(--card2); border-radius: 6px; padding: 2px 8px; font-size: 12px; margin: 2px; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 18px 0 8px; }
@media (min-width: 640px) {
  .modal-back { align-items: center; }
  .modal { border-radius: 18px; }
}
