/* ══════════════════════════════════════════════════════════════════
   Jukebox · reproductor/descarga gateado por email ("INSERT COIN")
   Modular y autocontenido. Estética arcade · azul/teal · dark.
   ══════════════════════════════════════════════════════════════════ */
#jukebox {
  position: relative; overflow: hidden;
  padding: 80px 48px;
  border-top: 1px solid var(--border);
  scroll-margin-top: 56px;
}
.jb-glow { position: absolute; z-index: 0; pointer-events: none; width: 54vw; max-width: 520px; aspect-ratio: 1; border-radius: 50%; filter: blur(80px); will-change: transform; }
.jb-glow.g1 { background: radial-gradient(circle, rgba(59,130,246,.16), transparent 70%); top: -14%; left: -8%; }
.jb-glow.g2 { background: radial-gradient(circle, rgba(0,212,180,.14), transparent 70%); bottom: -16%; right: -10%; }
#jukebox > *:not(.jb-glow) { position: relative; z-index: 1; }

.jb-cabinet {
  max-width: 720px; margin: 32px auto 0; position: relative; overflow: hidden;
  background: linear-gradient(180deg, rgba(17,20,33,.92), rgba(9,12,20,.96));
  border: 1.5px solid rgba(99,150,255,.32); border-radius: 18px;
  box-shadow: 0 0 0 1px rgba(79,141,255,.08) inset, 0 18px 50px rgba(0,0,0,.45), 0 0 46px rgba(59,130,246,.12);
  transform-style: preserve-3d; transition: transform .3s cubic-bezier(.22,.61,.36,1); will-change: transform;
}
.jb-cabinet::before { /* scanlines */
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: .45;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.16) 0 1px, transparent 1px 3px); mix-blend-mode: multiply;
}
.jb-cabinet > * { position: relative; z-index: 1; }
/* barra superior tipo marquesina */
.jb-marq {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  padding: 12px; border-bottom: 1px solid rgba(99,150,255,.18);
  font-family: 'Press Start 2P', monospace; font-size: 9px; letter-spacing: .14em; color: var(--teal);
  text-shadow: 0 0 12px rgba(0,212,180,.5);
}
.jb-marq .jb-eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.jb-marq .jb-eq i { width: 3px; background: var(--teal); border-radius: 1px; animation: jbEq 1s ease-in-out infinite; }
.jb-marq .jb-eq i:nth-child(2){ animation-delay: .15s } .jb-marq .jb-eq i:nth-child(3){ animation-delay: .3s } .jb-marq .jb-eq i:nth-child(4){ animation-delay: .45s }
@keyframes jbEq { 0%,100%{ height: 3px } 50%{ height: 12px } }

/* ── GATE (bloqueado): INSERT COIN ── */
.jb-gate { padding: 40px 26px 44px; text-align: center; }
.jb-coin {
  width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%;
  background: linear-gradient(145deg, #ffd966, #f5a623); color: #3a2a06;
  display: grid; place-items: center; font-size: 30px; font-weight: 800;
  box-shadow: 0 0 0 4px rgba(245,166,35,.18), 0 8px 22px rgba(245,166,35,.35);
  animation: jbCoinPulse 1.6s ease-in-out infinite;
}
@keyframes jbCoinPulse { 0%,100%{ transform: translateY(0) rotate(-8deg) } 50%{ transform: translateY(-6px) rotate(8deg) } }
.jb-insert {
  font-family: 'Press Start 2P', monospace; font-size: 16px; color: #fff; letter-spacing: .06em;
  margin-bottom: 10px; text-shadow: 0 0 16px rgba(79,141,255,.7);
  animation: jbBlink 1.1s steps(1) infinite;
}
@keyframes jbBlink { 0%,55%{ opacity: 1 } 56%,100%{ opacity: .35 } }
.jb-gate p { font-size: 13px; color: var(--text-2); max-width: 380px; margin: 0 auto 20px; line-height: 1.6; }
.jb-form { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 440px; margin: 0 auto; }
.jb-row { display: flex; gap: 10px; width: 100%; flex-wrap: wrap; justify-content: center; }
.jb-hp { position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.jb-consent {
  display: flex; align-items: flex-start; gap: 8px; max-width: 420px;
  font-size: 12px; color: var(--text-2); line-height: 1.5; cursor: pointer; text-align: left;
}
.jb-consent input { margin-top: 2px; width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--teal); cursor: pointer; }
.jb-consent span { color: var(--text-3); }
.jb-input {
  flex: 1; min-width: 200px; appearance: none;
  font-family: 'Inter', sans-serif; font-size: 16px; color: var(--text);
  background: rgba(6,10,20,.85); border: 2px solid rgba(99,150,255,.3); border-radius: 10px; padding: 13px 15px;
  transition: border-color .18s, box-shadow .18s;
}
.jb-input:focus { outline: none; border-color: var(--blue-tv); box-shadow: 0 0 0 3px rgba(59,130,246,.22); }
.jb-input[aria-invalid="true"] { border-color: #e5484d; }
.jb-btn {
  appearance: none; cursor: pointer; white-space: nowrap;
  font-family: 'Press Start 2P', monospace; font-size: 11px; color: #fff; letter-spacing: .04em;
  padding: 0 20px; border: 2px solid #82b0ff; border-radius: 10px;
  background: linear-gradient(180deg, #4f8dff, #1d4ed8);
  box-shadow: 0 5px 0 #112a63, 0 0 22px rgba(59,130,246,.6);
  transition: transform .08s, filter .2s;
}
.jb-btn:hover { filter: brightness(1.08); }
.jb-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #112a63, 0 0 22px rgba(59,130,246,.6); }
.jb-msg { min-height: 16px; margin-top: 12px; font-size: 12px; color: var(--text-3); }
.jb-msg.err { color: #ff7a7d; } .jb-msg.ok { color: var(--teal); }

/* Animación de "moneda insertada / power on" */
.jb-cabinet.jb-powering .jb-gate { animation: jbPower .7s ease forwards; }
@keyframes jbPower { 0%{ opacity:1 } 60%{ opacity:.2; filter: brightness(2) } 100%{ opacity:0; transform: scale(.96) } }

/* ── LISTA (desbloqueado) · panel con scroll arcade (≈3 pistas visibles) ── */
.jb-list {
  display: none; padding: 14px;
  max-height: 250px; overflow-y: auto; overscroll-behavior: contain;   /* exactamente 3 pistas, resto en scroll */
  scrollbar-width: thin; scrollbar-color: rgba(0,212,180,.55) rgba(255,255,255,.05);
  /* sombra interior abajo: pista visual de que hay más temas (scroll) */
  box-shadow: inset 0 -26px 22px -22px rgba(0,0,0,.7);
}
.jb-list::-webkit-scrollbar { width: 9px; }
.jb-list::-webkit-scrollbar-track { background: rgba(255,255,255,.04); border-radius: 9px; margin: 6px 0; }
.jb-list::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--teal), var(--blue-tv)); border-radius: 9px; border: 2px solid rgba(9,12,20,.9); }
#jukebox.jb-unlocked .jb-gate { display: none; }
#jukebox.jb-unlocked .jb-list { display: block; animation: jbIn .5s ease both; }
@keyframes jbIn { from{ opacity:0; transform: translateY(10px) } to{ opacity:1; transform:none } }
.jb-track {
  display: flex; align-items: center; gap: 13px; padding: 11px 13px; margin-bottom: 9px; border-radius: 12px;
  background: rgba(8,12,22,.55); border: 1px solid rgba(99,150,255,.14);
  transition: background .2s, border-color .2s, box-shadow .2s, transform .12s;
  animation: jbTrackIn .5s cubic-bezier(.22,.61,.36,1) both;
}
@keyframes jbTrackIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
/* ── RULETA: gira al entrar y para en un tema aleatorio ── */
.jb-list.jb-spinning { overflow: hidden; }
.jb-reel { will-change: transform; }
.jb-reel .jb-track { animation: none !important; }
.jb-list.jb-no-entrance .jb-track { animation: none; }
.jb-track.is-selected { border-color: var(--teal); background: rgba(0,212,180,.13); box-shadow: 0 0 0 1px var(--teal), 0 0 24px rgba(0,212,180,.3); }
.jb-track.is-selected .jb-num { color: #fff; text-shadow: 0 0 12px var(--teal); }
.jb-list.jb-no-entrance .jb-track.is-selected { animation: jbWin 1.5s ease both; }
@keyframes jbWin {
  0% { box-shadow: 0 0 0 2px var(--teal), 0 0 40px rgba(0,212,180,.65); transform: scale(1.015); }
  100% { box-shadow: 0 0 0 1px var(--teal), 0 0 24px rgba(0,212,180,.3); transform: none; }
}
.jb-track:hover { background: rgba(79,141,255,.1); border-color: rgba(0,212,180,.42); box-shadow: 0 0 16px rgba(0,212,180,.14); transform: translateX(3px); }
.jb-num {
  flex-shrink: 0; width: 30px; text-align: center;
  font-family: 'Press Start 2P', monospace; font-size: 12px; color: var(--teal);
  text-shadow: 0 0 10px rgba(0,212,180,.55); letter-spacing: .02em;
}
.jb-cover { width: 48px; height: 48px; border-radius: 8px; flex-shrink: 0; object-fit: cover; background: #0a0d14; box-shadow: 0 0 0 1px rgba(255,255,255,.06); }
.jb-meta { flex: 1; min-width: 0; }
.jb-title { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jb-year { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.jb-actions { display: flex; gap: 8px; flex-shrink: 0; }
.jb-play, .jb-dl {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-size: 11px; font-weight: 600; letter-spacing: .02em; border-radius: 8px; padding: 8px 11px;
  background: none; transition: background .2s, border-color .2s, color .2s, box-shadow .2s;
}
.jb-play { color: var(--teal); border: 1px solid rgba(0,212,180,.35); }
.jb-play:hover { background: rgba(0,212,180,.14); border-color: var(--teal); box-shadow: 0 0 12px rgba(0,212,180,.35); }
.jb-play.is-on { background: var(--teal); color: #04130f; }
.jb-dl { color: var(--blue-tv); border: 1px solid rgba(59,130,246,.35); }
.jb-dl:hover { background: rgba(59,130,246,.14); border-color: var(--blue-tv); box-shadow: 0 0 12px rgba(59,130,246,.35); }
.jb-play svg, .jb-dl svg { width: 13px; height: 13px; }
.jb-embed { padding: 4px 12px 10px; }
.jb-embed iframe { width: 100%; border: 0; border-radius: 12px; display: block; }

@media (max-width: 600px) {
  #jukebox { padding: 56px 16px 64px; }
  .jb-gate { padding: 32px 16px 36px; }
  .jb-insert { font-size: 14px; }
  .jb-track { flex-wrap: wrap; }
  .jb-actions { width: 100%; }
  .jb-play, .jb-dl { flex: 1; justify-content: center; }
  .jb-title { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  .jb-coin, .jb-insert, .jb-marq .jb-eq i, .jb-track, .jb-list.jb-no-entrance .jb-track.is-selected { animation: none; }
}
