:root {
  --bg: #0c0616;
  --bg2: #1a0b30;
  --card: rgba(30, 16, 54, 0.78);
  --line: #3b2663;
  --text: #f7f0ff;
  --muted: #b8a7d8;
  --pink: #ff2fb3;
  --cyan: #22e4ff;
  --yellow: #ffd23f;
  --green: #3dff9a;
  --danger: #ff5470;
  --radius: 18px;
  --display: 'Bungee', 'Arial Black', system-ui, sans-serif;
  --body: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 400 16px/1.5 var(--body);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% -8%, rgba(255, 47, 179, 0.35), transparent 42%),
    radial-gradient(circle at 100% 18%, rgba(34, 228, 255, 0.2), transparent 38%),
    linear-gradient(180deg, var(--bg2), var(--bg) 65%);
  background-attachment: fixed;
}

/* Líneas de TV vieja */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px);
  z-index: 10;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--display);
  font-size: clamp(17px, 4vw, 26px);
}
.brand b { color: var(--pink); font-weight: 400; text-shadow: 0 0 14px rgba(255, 47, 179, 0.6); }
.live-badge {
  font-family: var(--display);
  font-size: 13px;
  color: #fff;
  background: var(--danger);
  padding: 6px 12px;
  border-radius: 999px;
  animation: pulse 1.4s infinite;
}
.live-badge[hidden] { display: none; }

main { max-width: 1100px; margin: 0 auto; padding: 0 16px 32px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  min-width: 0;
}

/* ---------- Reproductor ---------- */

.player {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 36px;
  padding: 28px;
  position: relative;
  overflow: hidden;
  border-color: rgba(255, 47, 179, 0.45);
}
.player::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 45%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent);
  pointer-events: none;
}

.disc-wrap { width: clamp(190px, 28vw, 280px); aspect-ratio: 1; }
.disc {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.16), transparent 40%),
    repeating-radial-gradient(circle, #111 0 2px, #1e1e22 2px 4px);
  box-shadow: 0 0 0 6px rgba(0, 0, 0, 0.6), 0 0 50px rgba(255, 47, 179, 0.4);
  animation: spin 5s linear infinite;
  animation-play-state: paused;
}
.playing .disc { animation-play-state: running; }
.disc img {
  width: 50%;
  height: 50%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #000;
}
.disc-hole {
  position: absolute;
  width: 7%;
  height: 7%;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: inset 0 0 0 2px #000;
}

.np { min-width: 0; }
.np-label {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--cyan);
  text-transform: uppercase;
}
h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(26px, 5vw, 44px);
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.artist {
  margin: 8px 0 18px;
  font-size: clamp(17px, 2.6vw, 22px);
  font-weight: 500;
  color: var(--yellow);
}
.progress {
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  margin-bottom: 20px;
}
.progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--pink), var(--cyan));
  transition: width 1s linear;
}

.controls { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.play {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background: radial-gradient(circle at 32% 25%, #ff9bdc, var(--pink) 55%, #a1006a);
  box-shadow: 0 6px 0 #6b0046, 0 12px 30px rgba(255, 47, 179, 0.45);
  transition: transform 0.08s, box-shadow 0.08s;
}
.play:hover { filter: brightness(1.08); }
.play:active { transform: translateY(4px); box-shadow: 0 2px 0 #6b0046, 0 6px 20px rgba(255, 47, 179, 0.45); }
.play:focus-visible { outline: 3px solid var(--cyan); outline-offset: 4px; }
.play svg { width: 32px; height: 32px; }
.play .icon-pause, .playing .play .icon-play { display: none; }
.playing .play .icon-pause { display: block; }

.eq { display: flex; align-items: flex-end; gap: 4px; height: 36px; }
.eq i { width: 6px; height: 18%; border-radius: 2px; background: linear-gradient(0deg, var(--cyan), var(--pink)); }
.playing .eq i { animation: eq 0.8s ease-in-out infinite alternate; }
.playing .eq i:nth-child(2) { animation-delay: -0.3s; animation-duration: 0.6s; }
.playing .eq i:nth-child(3) { animation-delay: -0.5s; animation-duration: 0.9s; }
.playing .eq i:nth-child(4) { animation-delay: -0.1s; animation-duration: 0.7s; }
.playing .eq i:nth-child(5) { animation-delay: -0.4s; animation-duration: 0.55s; }
.playing .eq i:nth-child(6) { animation-delay: -0.2s; animation-duration: 0.85s; }

.vol { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.vol svg { width: 22px; height: 22px; }
.vol input { width: 120px; accent-color: var(--pink); }

.listeners { margin: 16px 0 0; font-size: 14px; color: var(--muted); }
.listeners span { font-weight: 700; color: var(--green); }
.status { min-height: 1.5em; margin: 4px 0 0; font-size: 14px; color: var(--muted); }

/* ---------- Secciones ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.wide { grid-column: 1 / -1; }

h2 { margin: 0 0 12px; font-family: var(--display); font-weight: 400; font-size: 20px; }
.hint { margin: -4px 0 14px; font-size: 14px; color: var(--muted); }

form { display: grid; gap: 12px; position: relative; }
label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
label small { font-size: 12px; }
input, textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--line);
  border-radius: 10px;
}
input::placeholder, textarea::placeholder { color: #7d6ca0; }
input:focus, textarea:focus { outline: 2px solid var(--cyan); border-color: transparent; }
textarea { resize: vertical; min-height: 80px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.btn {
  justify-self: start;
  padding: 12px 20px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--display);
  font-size: 15px;
  color: #2a1600;
  background: linear-gradient(180deg, #ffe88a, var(--yellow) 50%, #e2a800);
  box-shadow: 0 4px 0 #8a6400;
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #8a6400; }
.btn:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.btn:disabled { opacity: 0.6; cursor: wait; }
.form-msg { min-height: 1.5em; margin: 0; font-size: 14px; }
.form-msg.ok { color: var(--green); }
.form-msg.err { color: var(--danger); }

.feed, .history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  max-height: 380px;
  overflow-y: auto;
}
.feed li {
  padding: 10px 12px;
  border-left: 3px solid var(--pink);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  overflow-wrap: anywhere;
}
.feed .who { font-weight: 700; }
.feed .song { font-size: 14px; color: var(--yellow); }
.feed .msg { margin: 4px 0 0; }
.feed .meta { display: flex; gap: 8px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.feed .sono { color: var(--green); }
.empty { color: var(--muted); font-style: italic; }

.ranking { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: pos; }
.ranking li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  counter-increment: pos;
}
.ranking li::before {
  content: counter(pos);
  flex: none;
  width: 1.7em;
  font-family: var(--display);
  text-align: center;
  color: var(--cyan);
}
.ranking li:nth-child(1)::before { color: var(--yellow); }
.ranking li:nth-child(2)::before { color: #d9d9e8; }
.ranking li:nth-child(3)::before { color: #e09a5a; }
.ranking .tema { min-width: 0; overflow-wrap: anywhere; }
.ranking .votos { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.ranking li.empty::before { content: none; }

.history li { display: flex; align-items: center; gap: 12px; min-width: 0; }
.history img { flex: none; width: 46px; height: 46px; border-radius: 8px; object-fit: cover; }
.history .info { min-width: 0; }
.history .t { font-weight: 500; overflow-wrap: anywhere; }
.history .a { font-size: 14px; color: var(--muted); }

.schedule { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.slot { padding: 14px; border-top: 3px solid var(--cyan); border-radius: 12px; background: rgba(255, 255, 255, 0.05); }
.slot:nth-child(even) { border-top-color: var(--pink); }
.slot .when { font-size: 13px; font-weight: 700; color: var(--cyan); }
.slot:nth-child(even) .when { color: var(--pink); }
.slot h3 { margin: 4px 0; font-size: 17px; }
.slot p { margin: 0; font-size: 14px; color: var(--muted); }

.notfound { min-height: 100vh; display: grid; place-items: center; text-align: center; }
.notfound .btn { display: inline-block; text-decoration: none; }

footer { padding: 16px 16px 40px; text-align: center; font-size: 13px; color: var(--muted); }
footer p { margin: 4px 0; }
.legal { font-size: 12px; opacity: 0.8; }

@media (max-width: 760px) {
  .player { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 22px; padding: 22px 18px; }
  .np { width: 100%; }
  .controls { justify-content: center; }
  .grid { grid-template-columns: 1fr; }
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes eq { from { height: 15%; } to { height: 100%; } }
@keyframes pulse { 50% { opacity: 0.6; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
