:root {
  --bg: #0d0a0c; --surface: #171217; --surface2: #221a20; --line: #32262d;
  --text: #f6eff2; --dim: #a8979f; --faint: #6f6168;
  --ruby: #a6192e; --ruby-hi: #e8455c; --ruby-deep: #5e0d1a; --blush: #f9d9e6;
  --warn: #ffc857; --radius: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; color: var(--text);
  font: 15px/1.45 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(900px 420px at 15% -10%, rgba(190, 30, 52, .22), transparent 70%),
    radial-gradient(700px 380px at 95% 0%, rgba(110, 14, 30, .28), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
button, input { font: inherit; color: inherit; }
a { color: inherit; }
svg { display: block; }

/* ---------- piezas base ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 20px 20px 48px; }
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; font-size: 22px; font-weight: 800; letter-spacing: -.02em; text-decoration: none; }
.brand svg { width: 28px; height: 28px; filter: drop-shadow(0 0 10px rgba(190, 30, 52, .6)); }
.brand em { font-style: normal; color: var(--ruby-hi); font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; cursor: pointer; font-weight: 600; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { border-color: var(--faint); background: #2a2027; }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .35; cursor: default; transform: none; }
.btn svg { width: 16px; height: 16px; }
.btn.ruby { background: linear-gradient(135deg, #c8223c, var(--ruby)); border-color: transparent; color: #fff; box-shadow: 0 6px 20px -6px rgba(190, 30, 52, .7); }
.btn.ruby:hover { filter: brightness(1.1); }
.btn.round { width: 34px; height: 34px; padding: 0; flex: none; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--dim); }
.btn.ghost:hover { background: var(--surface2); color: var(--text); }

.field {
  width: 100%; background: var(--surface2); border: 1px solid var(--line); border-radius: 999px;
  padding: 11px 18px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field::placeholder { color: var(--faint); }
.field:focus { border-color: var(--ruby); box-shadow: 0 0 0 3px rgba(190, 30, 52, .25); }

.card { background: rgba(23, 18, 23, .82); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; backdrop-filter: blur(8px); }
.card h2 { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); margin: 0 0 12px; }
.card h2 .count { margin-left: auto; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--faint); }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; min-width: 0; }
.card { min-width: 0; }
.cols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
@media (max-width: 820px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.empty { color: var(--faint); padding: 14px 4px; text-align: center; }
.err { color: var(--ruby-hi); margin-top: 10px; font-size: 14px; }
.err:empty { display: none; }
.notice { margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: rgba(255, 200, 87, .1); border: 1px solid rgba(255, 200, 87, .3); color: var(--warn); font-size: 14px; }
.notice:empty { display: none; }

/* chip de persona: --c es su color */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--c, #888) 16%, transparent); color: var(--c, var(--dim)); white-space: nowrap; flex: none; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.plain { background: var(--surface2); color: var(--dim); }
.chip.plain::before { display: none; }

/* ---------- sonando ---------- */
.hero { position: relative; overflow: hidden; display: flex; gap: 22px; align-items: center; padding: 22px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); isolation: isolate; }
.hero-bg { position: absolute; inset: -40px; z-index: -1; background-size: cover; background-position: center; filter: blur(48px) saturate(1.5); opacity: .55; transition: background-image .6s; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(13, 10, 12, .3), rgba(13, 10, 12, .72)); }
.cover { width: 148px; height: 148px; border-radius: 14px; object-fit: cover; flex: none; background: var(--surface2); box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .8); }
.hero-info { min-width: 0; flex: 1; }
.eyebrow { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--ruby-hi); }
.eyebrow .where { color: var(--dim); font-weight: 600; letter-spacing: .04em; text-transform: none; }
.hero-title { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin: 6px 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-sub { display: flex; align-items: center; gap: 10px; color: var(--dim); min-width: 0; }
.hero-sub > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { height: 14px; margin-top: 12px; display: flex; align-items: center; cursor: pointer; }
.progress .track { height: 4px; width: 100%; background: rgba(255, 255, 255, .12); border-radius: 2px; overflow: hidden; }
.progress:hover .track { height: 6px; }
.progress .fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--ruby), var(--ruby-hi)); border-radius: 2px; transition: width 1s linear; }
.hero-controls { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.play { width: 46px; height: 46px; }
.play svg { width: 20px; height: 20px; }
.time { font-variant-numeric: tabular-nums; color: var(--dim); font-size: 13px; }
.vol { display: flex; align-items: center; gap: 8px; margin-left: auto; color: var(--dim); }
.vol svg { width: 18px; height: 18px; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 110px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .16); outline: none; cursor: pointer; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--text); border: none; }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--text); border: none; }
.hero.idle .progress, .hero.idle .hero-controls, .hero.idle .eq { display: none; }
.hero.idle .cover { width: 96px; height: 96px; border-radius: 50%; border: 3px solid var(--blush); max-width: none; aspect-ratio: auto; }
.hero.idle { flex-direction: row; align-items: center; }
.hero.idle .eyebrow { color: var(--dim); }
.hero.idle .hero-title { font-size: 22px; white-space: normal; }
@media (max-width: 600px) {
  .hero { flex-direction: column; align-items: stretch; text-align: left; padding: 16px; }
  .cover { width: 100%; height: auto; aspect-ratio: 1; max-width: 220px; }
  .hero-title { font-size: 22px; white-space: normal; }
  .vol input { width: 80px; }
}

/* ecualizador: se mueve solo cuando está sonando */
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.eq i { width: 3px; height: 30%; background: currentColor; border-radius: 1px; }
.playing .eq i { animation: eq 1s ease-in-out infinite; }
.playing .eq i:nth-child(2) { animation-delay: -.35s; }
.playing .eq i:nth-child(3) { animation-delay: -.7s; }
.playing .eq i:nth-child(4) { animation-delay: -.15s; }
@keyframes eq { 0%, 100% { height: 25%; } 50% { height: 100%; } }
@media (prefers-reduced-motion: reduce) { .playing .eq i { animation: none; height: 70%; } .progress .fill { transition: none; } }

/* ---------- filas de canciones ---------- */
.row { display: flex; gap: 12px; align-items: center; padding: 8px; border-radius: 12px; transition: background .12s; }
.row:hover { background: rgba(255, 255, 255, .04); }
.row .num { width: 18px; text-align: center; color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; flex: none; }
.row img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: var(--surface2); flex: none; }
.row .meta { min-width: 0; flex: 1; }
.row .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .a { font-size: 13px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .acts { display: flex; gap: 2px; flex: none; opacity: .55; transition: opacity .12s; }
.row:hover .acts, .row .acts:focus-within { opacity: 1; }
.row .acts.always { opacity: 1; }

/* ---------- buscar ---------- */
.search { display: flex; gap: 8px; }
.seg { display: inline-flex; background: var(--surface2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; flex: none; }
.seg button { border: none; background: transparent; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--dim); }
.seg button.on { background: var(--ruby); color: #fff; }
#results:not(:empty) { margin-top: 10px; }
@media (max-width: 600px) { .search { flex-wrap: wrap; } .search .field { flex-basis: 100%; } }

/* ---------- turnos ---------- */
.turns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.turns .arrow { color: var(--faint); font-size: 12px; }
.turns .chip.next { outline: 2px solid currentColor; outline-offset: 1px; }
.turns .chip.none { opacity: .4; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; background: none; border: none; padding: 6px 4px; }
.switch i { width: 38px; height: 22px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--line); position: relative; transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--dim); transition: transform .15s, background .15s; }
.switch.on i { background: var(--ruby); border-color: var(--ruby); }
.switch.on i::after { transform: translateX(16px); background: #fff; }

/* ---------- diálogo y pantalla de inicio ---------- */
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 20px; padding: 28px; width: min(380px, 92vw); box-shadow: 0 30px 80px -20px #000; }
dialog::backdrop { background: rgba(8, 5, 7, .75); backdrop-filter: blur(6px); }
.welcome { display: grid; gap: 16px; justify-items: center; text-align: center; }
.welcome .brand { margin: 0; font-size: 28px; }
.welcome .brand svg { width: 40px; height: 40px; }
.welcome p { margin: 0; color: var(--dim); }
.welcome .field { text-align: center; }

/* ---------- página del parlante ---------- */
.gate { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; padding: 20px; background: radial-gradient(600px 400px at 50% 30%, rgba(190, 30, 52, .25), transparent 70%), var(--bg); }
.gate .welcome { width: min(360px, 100%); }
.stage-bg { position: fixed; inset: -60px; z-index: -1; background-size: cover; background-position: center; filter: blur(70px) saturate(1.5); opacity: .3; transition: background-image .8s; }
.stage { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .stage { grid-template-columns: minmax(0, 1fr); } }
.screen { aspect-ratio: 16/9; background: #000; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 30px 70px -25px #000; }
.banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; margin-bottom: 16px; border-radius: 14px; background: rgba(255, 200, 87, .1); border: 1px solid rgba(255, 200, 87, .35); }
.banner[hidden] { display: none; }
.banner .msg { color: var(--warn); font-weight: 600; margin-right: auto; }
.banner.ask { background: rgba(190, 30, 52, .14); border-color: var(--ruby); animation: pulse 1.6s ease-in-out infinite; }
.banner.ask .msg { color: var(--text); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(190, 30, 52, .18); } }

/* ajustes finos */
a.btn, .brand { text-decoration: none; }
@media (max-width: 600px) {
  .row { gap: 10px; padding: 8px 4px; }
  .row .acts .btn.round { width: 28px; height: 28px; }
  .card { padding: 16px 14px; }
}

/* ---------- marca: logo y mascota ---------- */
.brand img { height: 54px; width: auto; display: block; }
.top { margin-bottom: 14px; }
.welcome .brand img { height: 84px; }
.mascot { width: 112px; height: 112px; border-radius: 50%; border: 4px solid var(--blush); box-shadow: 0 0 0 6px rgba(190, 30, 52, .25), 0 20px 40px -15px #000; }

/* buscador: el origen elegido toma su color */
.seg button.spotify.on { background: #1db954; color: #06210f; }
.search { flex-wrap: wrap; }
.search .field { flex: 1 1 260px; }
