:root {
  --deep-purple: #1a0b2e;
  --mystic-gold: #c5a059;
  --bright-gold: #f4d068;
  --pink-accent: #f06292;
  --neon-pink: #ff4081;
  --bg-color: #080312;
  --text-main: #e2d9f3;
  --text-dim: #a89fc7;
  --card-bg: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.12);
  --ok: #29d98c;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: #0f0a1a;
  background-image: url('https://www.transparenttextures.com/patterns/stardust.png');
  animation: stardustMove 120s linear infinite;
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
  line-height: 1.6;
}

@keyframes stardustMove {
  from { background-position: 0 0; }
  to { background-position: -1000px 1000px; }
}

/* ============ AMBIENTES DE FONDO ============
   Capa fija detras de todo; cada tema reutiliza los mismos 12 <span class="fx">
   y esconde los que no necesita. Solo se animan transform/opacity/filter
   para que no le pese al equipo que hace de TV. */
.bg-fx {
  position: fixed; inset: 0; z-index: 0;
  overflow: hidden; pointer-events: none;
}
.screen { position: relative; z-index: 1; }
.bg-fx .fx { display: none; position: absolute; }

@keyframes spinSlow { to { transform: rotate(360deg); } }

/* --- 1. COMETAS --- */
body[data-bg="cometas"] { background-color: #06030f; }
body[data-bg="cometas"] .fx {
  display: block; top: -20vh; left: var(--rx); width: 4px; height: 220px; border-radius: 4px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), #fff 40%, var(--rc));
  filter: drop-shadow(0 0 14px var(--rc)) drop-shadow(0 0 34px var(--rc));
  animation: cometFall calc(var(--rd) / 2.6) linear infinite;
  animation-delay: var(--rdelay);
  opacity: 0;
}
/* con 36 particulas serian una lluvia de meteoritos; 14 es fiesta, no apocalipsis */
body[data-bg="cometas"] .fx:nth-child(n+15) { display: none; }
@keyframes cometFall {
  0%   { transform: translate3d(0, -20vh, 0) rotate(28deg); opacity: 0; }
  8%   { opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: translate3d(55vw, 125vh, 0) rotate(28deg); opacity: 0; }
}

/* --- 2. NEON RGB --- */
body[data-bg="neon"] { background-color: #0a0518; background-image: none; animation: none; }
body[data-bg="neon"] .bg-fx::before {
  content: ''; position: absolute; inset: -35%;
  background: conic-gradient(from 0deg, #ff3d81, #7c4dff, #00e5ff, #29d98c, #f4d068, #ff3d81);
  filter: blur(60px); opacity: 0.85;
  will-change: transform;
  animation: spinSlow 11s linear infinite;
}
body[data-bg="neon"] .bg-fx::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 50%, transparent 35%, rgba(6,3,15,0.6) 100%);
  animation: neonPulse 3.4s ease-in-out infinite;
}
@keyframes neonPulse { 50% { opacity: 0.45; } }

/* --- 3. DISCO --- */
body[data-bg="disco"] { background-color: #0b0416; background-image: none; animation: none; }
body[data-bg="disco"] .bg-fx::before {
  content: ''; position: absolute; inset: -60%;
  background: repeating-conic-gradient(from 0deg,
    rgba(255,61,129,0.45) 0deg 7deg, transparent 7deg 22deg,
    rgba(0,229,255,0.40) 22deg 29deg, transparent 29deg 45deg,
    rgba(244,208,104,0.35) 45deg 52deg, transparent 52deg 70deg);
  animation: spinSlow 12s linear infinite;
}
body[data-bg="disco"] .bg-fx::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(255,255,255,0.10), transparent 45%);
}

/* --- 4. AURORA --- */
body[data-bg="aurora"] { background-color: #050310; background-image: none; animation: none; }
body[data-bg="aurora"] .fx:nth-child(-n+4) {
  display: block; width: 55vw; height: 55vw; border-radius: 45% 55% 60% 40%;
  filter: blur(65px); opacity: 0.72;
  will-change: transform;
  animation: auroraDrift var(--dur, 24s) ease-in-out infinite alternate;
}
@keyframes auroraDrift {
  from { transform: translate3d(0, 0, 0) scale(1) rotate(0deg); }
  to   { transform: translate3d(22vw, -18vh, 0) scale(1.4) rotate(70deg); }
}
body[data-bg="aurora"] .fx:nth-child(1) { top: -18%; left: -12%; background: #ff3d81; --dur: 11s; }
body[data-bg="aurora"] .fx:nth-child(2) { top: 12%;  left: 45%;  background: #00e5ff; --dur: 14s; animation-delay: -4s; }
body[data-bg="aurora"] .fx:nth-child(3) { top: 45%;  left: 8%;   background: #7c4dff; --dur: 12.5s; animation-delay: -7s; }
body[data-bg="aurora"] .fx:nth-child(4) { top: 40%;  left: 60%;  background: #29d98c; --dur: 15s; animation-delay: -2s; }

/* --- 5. RETRO 80s --- */
body[data-bg="retro"] {
  background-color: #14002b; background-image: none; animation: none;
}
body[data-bg="retro"] .bg-fx {
  background: linear-gradient(to bottom, #1a0533 0%, #43125e 38%, #b0248a 54%, #ff2d95 60%, #14002b 60.5%);
}
/* sol ochentero */
body[data-bg="retro"] .fx:nth-child(1) {
  display: block; left: 50%; top: 14%; width: 34vh; height: 34vh; margin-left: -17vh;
  border-radius: 50%;
  background: linear-gradient(to bottom, #f4d068 0%, #ff8a3d 45%, #ff2d95 100%);
  -webkit-mask-image: repeating-linear-gradient(to bottom, #000 0 14px, transparent 14px 20px);
  mask-image: repeating-linear-gradient(to bottom, #000 0 14px, transparent 14px 20px);
  filter: drop-shadow(0 0 60px rgba(255, 45, 149, 0.65));
}
/* rejilla en perspectiva */
body[data-bg="retro"] .bg-fx::after {
  content: ''; position: absolute; left: -60%; right: -60%; bottom: 0; height: 42%;
  background-image:
    repeating-linear-gradient(to right, rgba(0,229,255,0.55) 0 2px, transparent 2px 90px),
    repeating-linear-gradient(to bottom, rgba(0,229,255,0.55) 0 2px, transparent 2px 90px);
  transform: perspective(320px) rotateX(72deg);
  transform-origin: bottom center;
  animation: gridMove 2.4s linear infinite;
}
@keyframes gridMove { to { background-position: 0 90px, 0 90px; } }

/* --- 6. 420 --- */
body[data-bg="420"] { background-color: #04120a; background-image: none; animation: none; }
/* resplandor rasta de fondo */
body[data-bg="420"] .bg-fx::before {
  content: ''; position: absolute; inset: -30%;
  background: conic-gradient(from 0deg, #d32f2f, #f4d068, #29d98c, #d32f2f);
  filter: blur(70px); opacity: 0.32;
  will-change: transform;
  animation: spinSlow 24s linear infinite;
}
/* humo flotando */
body[data-bg="420"] .bg-fx::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 80%, rgba(87, 193, 89, 0.20), transparent 45%),
              radial-gradient(circle at 75% 30%, rgba(244, 208, 104, 0.16), transparent 45%);
  animation: neonPulse 6s ease-in-out infinite;
}
body[data-bg="420"] .fx {
  display: block; left: var(--rx); width: var(--rs); height: var(--rs);
  background: url('assets/leaf.svg') no-repeat center / contain;
  filter: drop-shadow(0 0 10px rgba(87, 193, 89, 0.75));
  animation: leafFloat var(--rd) linear infinite;
  animation-delay: var(--rdelay);
  opacity: 0;
}
@keyframes leafFloat {
  0%   { transform: translate3d(0, 115vh, 0) rotate(0deg);    opacity: 0; }
  10%  { opacity: 0.85; }
  85%  { opacity: 0.85; }
  100% { transform: translate3d(6vw, -25vh, 0) rotate(320deg); opacity: 0; }
}

/* --- Reacciones en vivo --- */
.reacciones { display: flex; gap: 12px; margin-top: 16px; }
.reacciones[hidden] { display: none; }
.reaccion {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.07); border: 1px solid var(--border);
  border-radius: 16px; padding: 14px 10px; cursor: pointer;
  color: var(--text-main); font-family: 'Outfit', sans-serif;
  transition: border-color 0.2s, background 0.2s;
}
.reaccion:hover { border-color: var(--pink-accent); }
.reaccion-emoji { font-size: 2.1rem; line-height: 1; display: block; }
.reaccion-label { font-size: 0.85rem; color: var(--text-dim); }
.reaccion.pulso { animation: reaccionPulso 0.35s ease; border-color: var(--bright-gold); }
@keyframes reaccionPulso {
  0% { transform: scale(1); }
  45% { transform: scale(1.14); background: rgba(244, 208, 104, 0.18); }
  100% { transform: scale(1); }
}

/* Emojis que suben flotando sobre el video en la TV */
.lluvia { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 15; }
.emoji-vuela {
  position: absolute; bottom: -10%;
  animation: emojiSube 3s ease-out forwards;
  filter: drop-shadow(0 3px 10px rgba(0,0,0,0.6));
}
@keyframes emojiSube {
  0%   { transform: translateY(0) scale(0.5) rotate(0deg); opacity: 0; }
  15%  { opacity: 1; transform: translateY(-12vh) scale(1.1) rotate(-8deg); }
  100% { transform: translateY(-95vh) scale(1) rotate(12deg); opacity: 0; }
}

/* Marcador de reacciones sobre el video */
.marcador {
  position: absolute; top: 14px; right: 14px; z-index: 16;
  display: flex; gap: 14px; padding: 8px 16px;
  background: rgba(8, 3, 18, 0.72); border: 1px solid var(--border);
  border-radius: 999px; backdrop-filter: blur(8px);
}
.marcador[hidden] { display: none; }
.marcador-item { font-size: 1.2rem; color: white; }
.marcador-item b { color: var(--bright-gold); margin-left: 2px; }

.resumen-fila.favorito { border-color: var(--neon-pink); box-shadow: 0 0 18px rgba(255, 64, 129, 0.3); }
.resumen-fila.favorito .resumen-nombre { color: #ffb6d1; }

/* --- Resumen de la fiesta --- */
.resumen-btn { margin-top: 22px; }
#screen-resumen.active {
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.resumen-publico .btn-lg { margin-top: 6px; }
.cta-propia { display: block; text-decoration: none; margin-top: 10px; }
.resumen-card {
  background: linear-gradient(160deg, rgba(43, 18, 72, 0.97), rgba(10, 4, 24, 0.97));
  border: 1px solid var(--mystic-gold); border-radius: 24px;
  padding: 36px 40px; max-width: 560px; width: 100%; text-align: center;
  box-shadow: 0 24px 70px rgba(0,0,0,0.7), 0 0 60px rgba(255, 61, 129, 0.25);
  max-height: 92vh; overflow-y: auto;
}
.resumen-kicker {
  font-family: 'Cinzel', serif; color: var(--mystic-gold);
  text-transform: uppercase; letter-spacing: 4px; font-size: 0.9rem; margin: 0;
}
.resumen-total {
  font-family: 'Luckiest Guy', 'Cinzel', serif; font-size: 5.5rem; line-height: 1;
  color: var(--bright-gold); margin: 6px 0 0;
  text-shadow: 0 0 22px var(--neon-pink), 0 0 55px rgba(255, 64, 129, 0.6);
}
.resumen-total-label {
  font-family: 'Luckiest Guy', 'Cinzel', serif; color: #ffb6d1;
  font-size: 1.3rem; margin: 0 0 26px; letter-spacing: 1px;
}
.resumen-podio { list-style: none; margin: 0 0 26px; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.resumen-fila {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 16px;
}
.resumen-fila.top1 { border-color: var(--bright-gold); box-shadow: 0 0 20px rgba(244, 208, 104, 0.35); }
.resumen-medalla { font-size: 1.6rem; flex-shrink: 0; width: 34px; }
.resumen-nombre {
  flex: 1; font-family: 'Luckiest Guy', 'Cinzel', serif; font-size: 1.35rem;
  color: white; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.resumen-fila.top1 .resumen-nombre { color: var(--bright-gold); }
.resumen-conteo { color: #ffb6d1; font-size: 1.05rem; flex-shrink: 0; }
.resumen-vacio { color: var(--text-dim); padding: 20px 0; }
.resumen-footer {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  border-top: 1px solid var(--border); padding-top: 18px; margin-bottom: 18px;
}
.resumen-footer img { width: 130px; height: auto; opacity: 0.9; }
.resumen-footer span { color: var(--text-dim); font-size: 0.85rem; letter-spacing: 2px; }

/* --- Selector de ambiente --- */
.bg-picker { margin-top: 26px; }
.bg-picker-label {
  color: var(--text-dim); margin: 0 0 10px; font-size: 0.85rem;
  text-transform: uppercase; letter-spacing: 2px;
}
.bg-picker-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.bg-opt {
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  border-radius: 12px; padding: 8px 12px; font-size: 1.3rem; cursor: pointer;
  line-height: 1; transition: border-color 0.2s, transform 0.15s;
}
.bg-opt:hover { border-color: var(--pink-accent); transform: translateY(-2px); }
.bg-opt.active { border-color: var(--bright-gold); box-shadow: 0 0 14px rgba(244, 208, 104, 0.45); }

h1, h2 {
  font-family: 'Cinzel', serif;
  color: var(--bright-gold);
  font-weight: 700;
  margin: 0;
}

.cursive {
  font-family: 'Dancing Script', cursive;
  color: var(--pink-accent);
  text-shadow: 0 0 8px var(--neon-pink), 0 0 18px var(--neon-pink), 0 0 32px rgba(255, 64, 129, 0.6);
}

.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

/* ---------- Landing ---------- */
#screen-landing.active {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 40px 32px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.jukebox-logo {
  width: 220px;
  max-width: 65vw;
  animation: floatLogo 4s infinite ease-in-out;
}
@keyframes floatLogo {
  0%   { transform: translateY(0) scale(1);     filter: drop-shadow(0 0 18px rgba(240, 98, 146, 0.55)); }
  50%  { transform: translateY(-14px) scale(1.04); filter: drop-shadow(0 0 28px rgba(244, 208, 104, 0.6)); }
  100% { transform: translateY(0) scale(1);     filter: drop-shadow(0 0 18px rgba(240, 98, 146, 0.55)); }
}
.tagline { font-size: 1.8rem; margin: 10px 0 0; }
.tagline-sm { font-size: 1.3rem; margin: 4px 0; }
.subtitle { color: var(--text-dim); margin: 6px 0 28px; }
.landing-actions { display: flex; flex-direction: column; gap: 16px; }
.divider { color: var(--text-dim); font-size: 0.85rem; }
.join-form { display: flex; gap: 8px; }
.join-form input {
  flex: 1;
  min-width: 0;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
}
.domain-footer {
  display: block;
  margin-top: 28px;
  color: var(--mystic-gold);
  font-size: 0.78rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-decoration: none;
  opacity: 0.75;
}
.domain-footer:hover { opacity: 1; color: var(--bright-gold); }

/* ---------- Buttons / inputs ---------- */
.btn {
  border: none;
  border-radius: 30px;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: 'Outfit', sans-serif;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(45deg, var(--pink-accent), var(--neon-pink));
  color: white;
  box-shadow: 0 4px 15px rgba(255, 64, 129, 0.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255, 64, 129, 0.6); }
.btn-secondary {
  background: transparent;
  color: var(--bright-gold);
  border: 2px solid var(--mystic-gold);
}
.btn-secondary:hover { background: rgba(197, 160, 89, 0.1); transform: translateY(-2px); }
.btn-ghost { background: transparent; color: var(--text-main); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--pink-accent); color: var(--pink-accent); }
.btn-lg { padding: 18px 24px; font-size: 1.05rem; width: 100%; }
.btn-sm { padding: 10px 16px; font-size: 0.8rem; width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

input[type="text"], input[type="url"] {
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 1rem;
  width: 100%;
  font-family: 'Outfit', sans-serif;
}
input::placeholder { color: var(--text-dim); }

.input-error { border-color: var(--neon-pink) !important; animation: shake 0.4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ---------- Host / TV layout ---------- */
.host-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 0;
  height: 100vh;
  overflow: hidden;
}
/* El video flota como tarjeta sobre el fondo animado, para que el ambiente
   se vea alrededor en vez de quedar tapado por un panel negro. */
.player-pane {
  display: flex; flex-direction: column; background: transparent;
  min-height: 0; padding: 16px; gap: 12px;
}
#yt-player-wrap {
  position: relative; width: 100%; flex: 1; min-height: 0; background: #000;
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 0 45px rgba(255, 61, 129, 0.35), 0 0 110px rgba(124, 77, 255, 0.28);
}
#yt-player { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-warning {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 24px; text-align: center;
  background: rgba(8, 3, 18, 0.94);
}
.player-warning[hidden] { display: none; }
.pw-title { font-family: 'Cinzel', serif; font-size: 1.4rem; color: var(--bright-gold); margin: 0; }
.pw-text { color: var(--text-dim); margin: 0; max-width: 440px; line-height: 1.5; }

.idle-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 30% 50%, rgba(148, 0, 211, 0.25) 0%, transparent 60%), var(--bg-color);
  text-align: center; padding: 20px;
}
.idle-overlay[hidden] { display: none; }
.idle-title { font-family: 'Cinzel', serif; font-size: 1.6rem; font-weight: 700; color: var(--bright-gold); margin: 0 0 8px; }
.idle-hint { color: var(--text-dim); margin: 0; }

.now-playing-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; background: rgba(26, 11, 46, 0.72);
  border: 1px solid var(--border); border-radius: 14px;
  gap: 12px; flex-wrap: wrap; flex-shrink: 0;
}
.now-playing-info { overflow: hidden; min-width: 0; }
.np-label { color: var(--text-dim); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 2px; }
.np-title {
  font-family: 'Luckiest Guy', 'Cinzel', serif;
  font-size: 2.6rem;
  line-height: 1.15;
  color: var(--bright-gold);
  -webkit-text-stroke: 1px rgba(26, 11, 46, 0.6);
  text-shadow: 0 0 18px rgba(240, 98, 146, 0.45);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.np-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.np-singer {
  font-family: 'Luckiest Guy', 'Cinzel', serif;
  color: #ffb6d1;
  font-size: 2.1rem;
  letter-spacing: 0.5px;
  text-shadow: 0 0 6px rgba(255, 64, 129, 0.7);
}
.np-singer[hidden] { display: none; }
.np-by { color: var(--text-dim); font-size: 0.85rem; }

/* Tira de "las que siguen" bajo el reproductor, para verse desde lejos */
.up-next-bar {
  display: flex; align-items: center; gap: 18px;
  padding: 12px 22px; background: rgba(26, 11, 46, 0.62);
  border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; flex-shrink: 0;
}
.up-next-label {
  font-family: 'Cinzel', serif; font-size: 1.1rem; letter-spacing: 3px;
  text-transform: uppercase; color: var(--mystic-gold); flex-shrink: 0;
}
.up-next {
  list-style: none; margin: 0; padding: 0;
  display: flex; align-items: center; gap: 22px;
  overflow: hidden; flex: 1; min-width: 0;
}
.un-item { display: flex; align-items: center; gap: 14px; min-width: 0; flex-shrink: 0; max-width: 500px; }
.un-pos {
  font-family: 'Cinzel', serif; font-weight: 700; font-size: 2rem; color: var(--neon-pink);
  text-shadow: 0 0 8px var(--neon-pink), 0 0 18px rgba(255, 64, 129, 0.6); flex-shrink: 0;
}
.un-thumb { width: 94px; height: 53px; object-fit: cover; border-radius: 6px; flex-shrink: 0; background: #333; }
.un-meta { min-width: 0; }
.un-title {
  font-size: 1.5rem; font-weight: 600; color: white; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.un-singer { font-size: 1.2rem; color: #ffb6d1; text-shadow: 0 0 6px rgba(255, 64, 129, 0.55); }
.un-more { font-size: 1.1rem; color: var(--text-dim); flex-shrink: 0; }
.un-empty { font-size: 1.15rem; color: var(--text-dim); }

.side-pane {
  background: rgba(26, 11, 46, 0.32);
  border-left: 1px solid var(--border);
  padding: 24px;
  overflow-y: auto;
  max-height: 100vh;
}
/* Tipografia mas grande solo en la pantalla de TV, que se ve de lejos */
.side-pane .queue-block h2 { font-size: 1.2rem; }
.side-pane .queue-item { padding: 14px 16px; gap: 12px; }
.side-pane .queue-item .thumb { width: 68px; height: 38px; }
.side-pane .queue-item .qi-title { font-size: 1.18rem; }
.side-pane .queue-item .qi-by { font-size: 1.02rem; }
.side-pane .queue-item .qi-pos { font-size: 1.35rem; min-width: 26px; }
.side-pane .queue-empty { font-size: 1.05rem; }
.side-pane .join-url { font-size: 0.9rem; }

.logo-lockup { display: flex; flex-direction: column; align-items: center; margin-bottom: 24px; }
.brand-mini-wordmark { max-width: 100%; height: auto; filter: drop-shadow(0 0 10px rgba(240, 98, 146, 0.35)); }

.room-code-block { text-align: center; margin-bottom: 28px; }
.room-code-label { color: var(--text-dim); margin: 0 0 4px; font-size: 1rem; text-transform: uppercase; letter-spacing: 1px; }
.room-code-big { font-family: 'Cinzel', serif; font-size: 2.3rem; font-weight: 700; letter-spacing: 6px; margin: 0 0 16px; color: var(--bright-gold); text-shadow: 0 0 15px rgba(197, 160, 89, 0.4); }
#qr-canvas { border-radius: 12px; background: white; padding: 8px; }
.join-url { color: var(--text-dim); font-size: 0.8rem; margin-top: 10px; word-break: break-all; }

.queue-block h2 { font-family: 'Outfit', sans-serif; font-size: 0.9rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; margin: 0 0 12px; font-weight: 600; }
.queue-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.queue-item {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px;
  backdrop-filter: blur(10px);
  padding: 12px 14px; display: flex; align-items: center; gap: 10px;
  transition: border-color 0.25s, transform 0.25s;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.queue-item:hover { border-color: var(--pink-accent); transform: translateY(-2px); }
.queue-item .thumb { width: 56px; height: 32px; object-fit: cover; border-radius: 6px; flex-shrink: 0; background: #333; }
.queue-item .meta { flex: 1; min-width: 0; }
.queue-item .qi-title { font-size: 0.9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: white; }
.queue-item .qi-by { font-size: 0.78rem; color: var(--text-dim); }
.queue-item .qi-pos {
  font-family: 'Cinzel', serif; color: var(--neon-pink); font-weight: 700; font-size: 1.15rem;
  min-width: 22px; text-shadow: 0 0 8px var(--neon-pink), 0 0 18px var(--neon-pink), 0 0 32px rgba(255, 64, 129, 0.6);
}
.queue-item .qi-pos.qi-pos-flash { animation: posFlash 0.6s ease; }
@keyframes posFlash {
  0% { transform: scale(1); }
  35% { transform: scale(1.6); text-shadow: 0 0 14px var(--neon-pink), 0 0 28px var(--neon-pink); }
  100% { transform: scale(1); }
}
.queue-item .qi-remove { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 1.1rem; padding: 4px 8px; }
.queue-item .qi-remove:hover { color: var(--neon-pink); text-shadow: 0 0 8px var(--neon-pink); }
.queue-item .drag-handle {
  cursor: grab; color: var(--text-dim); font-size: 1.2rem; padding: 0 4px;
  touch-action: none; user-select: none;
}
.queue-item .drag-handle:hover { color: var(--bright-gold); }
/* Placeholder showing where the card will land: empty dashed slot, no peek-through text */
.queue-item.sortable-ghost {
  background: rgba(255, 255, 255, 0.04);
  border: 2px dashed var(--pink-accent);
}
.queue-item.sortable-ghost > * { visibility: hidden; }

/* The original slot while its card is being carried elsewhere */
.queue-item.sortable-chosen { opacity: 0.35; }

/* The actual card following your finger/cursor: lit up and fully opaque
   so nothing behind it bleeds through */
.queue-item.sortable-drag,
.queue-item.sortable-fallback {
  background: #fff8fb;
  opacity: 1;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.7), 0 0 0 3px var(--neon-pink);
  z-index: 1000;
}
.queue-item.sortable-drag .qi-title,
.queue-item.sortable-fallback .qi-title { color: var(--deep-purple); }
.queue-item.sortable-drag .qi-by,
.queue-item.sortable-fallback .qi-by { color: #6b5c8a; }
.queue-item.sortable-drag .qi-pos,
.queue-item.sortable-fallback .qi-pos { text-shadow: none; }
.queue-item.sortable-drag .drag-handle,
.queue-item.sortable-fallback .drag-handle { color: var(--deep-purple); }

/* While something is being dragged, dim everything not directly involved
   so the floating card and its landing slot pop out clearly */
.queue-list.is-reordering .queue-item {
  transition: opacity 0.2s ease;
}
.queue-list.is-reordering .queue-item:not(.sortable-ghost):not(.sortable-chosen):not(.sortable-drag):not(.sortable-fallback) {
  opacity: 0.45;
}
.queue-empty { color: var(--text-dim); font-size: 0.9rem; text-align: center; padding: 20px 0; }

/* ---------- Guest layout ---------- */
#screen-guest.active { display: flex; justify-content: center; padding: 20px; }
.guest-layout { max-width: 480px; width: 100%; padding-bottom: 40px; }
.guest-header { text-align: center; margin-bottom: 24px; }
.logo-lockup-machine { height: 140px; width: auto; filter: drop-shadow(0 0 14px rgba(240, 98, 146, 0.5)); animation: floatLogo 4s infinite ease-in-out; display: block; }
.logo-lockup-wordmark { max-width: 280px; width: 100%; height: auto; margin: -18px 0 8px; display: block; }
.guest-header h1 { margin: 4px 0 0; font-size: 1.7rem; }
#guest-room-code {
  color: var(--pink-accent); letter-spacing: 3px;
  text-shadow: 0 0 8px var(--neon-pink), 0 0 18px var(--neon-pink), 0 0 32px rgba(255, 64, 129, 0.6);
}

.add-song-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.feedback { min-height: 1.2em; font-size: 0.9rem; margin: 0; text-align: center; }
.feedback.ok { color: var(--ok); }
.feedback.err { color: var(--neon-pink); text-shadow: 0 0 8px var(--neon-pink), 0 0 16px rgba(255, 64, 129, 0.6); }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(5, 2, 12, 0.75); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100;
}
.modal-overlay[hidden] { display: none; }
.modal-card {
  background: var(--deep-purple); border: 1px solid var(--border); border-radius: 20px;
  padding: 28px 24px; max-width: 380px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.modal-card h3 { font-size: 1.3rem; text-align: center; margin: 0 0 16px; }
.modal-card input { margin-bottom: 16px; }
.modal-card .singer-chips { margin-bottom: 16px; justify-content: center; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }

.singer-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: -4px; }
.singer-chips:empty { display: none; }
.singer-chip {
  background: rgba(255,255,255,0.06); border: 1px solid var(--border); color: var(--text-dim);
  backdrop-filter: blur(10px);
  border-radius: 20px; padding: 6px 14px; font-size: 0.82rem; cursor: pointer;
  font-family: 'Outfit', sans-serif; transition: border-color 0.2s, color 0.2s;
}
.singer-chip:hover { border-color: var(--pink-accent); color: white; }
.singer-chip.active { border-color: var(--bright-gold); color: var(--bright-gold); background: rgba(244, 208, 104, 0.1); }

.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1; min-width: 0; }
.search-row .btn { flex-shrink: 0; padding: 14px 20px; }

.search-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.search-result {
  display: flex; align-items: center; gap: 12px;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px;
  backdrop-filter: blur(10px);
  padding: 10px 12px; cursor: pointer; text-align: left; width: 100%;
  color: var(--text-main); font-family: 'Outfit', sans-serif; transition: border-color 0.2s, transform 0.15s;
}
.search-result:hover, .search-result:active { border-color: var(--pink-accent); transform: translateY(-1px); }
.search-result img { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; flex-shrink: 0; background: #333; }
.search-result .sr-meta { min-width: 0; flex: 1; }
.search-result .sr-title { font-size: 0.9rem; font-weight: 600; color: white; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.search-result .sr-channel { font-size: 0.78rem; color: var(--text-dim); margin-top: 2px; }
.search-result .sr-add { color: var(--bright-gold); font-size: 1.3rem; flex-shrink: 0; transition: transform 0.2s; }

.search-result.added {
  border-color: var(--ok);
  background: rgba(41, 217, 140, 0.12);
  cursor: default;
  opacity: 0.75;
  animation: addedPulse 0.35s ease;
}
.search-result.added .sr-add { color: var(--ok); transform: scale(1.3); }
.search-result.added:hover { transform: none; }
@keyframes addedPulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.sr-oculto { display: none; }
.ver-mas { width: 100%; margin-top: 4px; font-size: 0.9rem; padding: 12px; }

.manual-fallback { margin-top: 4px; }
.manual-fallback summary { color: var(--text-dim); font-size: 0.85rem; cursor: pointer; padding: 6px 0; }
.manual-fallback summary:hover { color: var(--pink-accent); }
.manual-fallback[open] summary { margin-bottom: 10px; }
.manual-fallback > input { margin-bottom: 10px; }

.now-playing-guest {
  background: var(--card-bg); border: 1px solid var(--border); backdrop-filter: blur(10px);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 24px; font-size: 0.95rem;
}
.now-playing-guest .np-title { font-size: 1.3rem; margin: 4px 0 6px; white-space: normal; }
.now-playing-guest .np-singer { display: inline-block; margin-top: 2px; font-size: 1rem; }

@media (max-width: 860px) {
  .host-layout { grid-template-columns: 1fr; height: auto; overflow: visible; }
  #yt-player-wrap { flex: none; aspect-ratio: 16 / 9; }
  .side-pane { border-left: none; border-top: 1px solid var(--border); max-height: none; }
  .up-next-bar { flex-wrap: wrap; }
  /* En pantalla chica los tamanos de TV quedan absurdos */
  .np-title { font-size: 1.4rem; }
  .np-singer { font-size: 1.05rem; }
  .up-next-label { font-size: 0.85rem; }
  .un-pos { font-size: 1.2rem; }
  .un-thumb { width: 56px; height: 32px; }
  .un-title { font-size: 0.95rem; }
  .un-singer { font-size: 0.85rem; }
}
