/* =========================================================
   BOTÓN DE MÚSICA (flotante, sigue al usuario por todo el sitio)
   ========================================================= */
.music-btn {
  position: fixed; z-index: 900;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: 52px; height: 52px; padding: 0;
  display: grid; place-items: center;
  border-radius: 50%; border: 1.5px solid rgba(255, 245, 233, .7);
  background: rgba(130, 134, 85, .92); color: #fff5e9;
  box-shadow: 0 6px 18px rgba(60, 64, 40, .28);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(4px);
  opacity: 0; scale: .6;
  transition: opacity .6s ease, scale .6s cubic-bezier(.34, 1.56, .64, 1), background-color .25s ease;
}
.music-btn[hidden] { display: none; }
.music-btn.is-in { opacity: 1; scale: 1; }
.music-btn:hover { background: #6f7347; }
.music-btn:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; }

/* Ecualizador (sonando) */
.music-btn__bars { display: flex; align-items: flex-end; gap: 3px; height: 18px; }
.music-btn__bars i { width: 3px; height: 30%; border-radius: 2px; background: currentColor; }
.music-btn.is-playing .music-btn__bars i { animation: eq 1s ease-in-out infinite alternate; }
.music-btn__bars i:nth-child(2) { animation-delay: -.4s !important; height: 60%; }
.music-btn__bars i:nth-child(3) { animation-delay: -.7s !important; height: 45%; }
.music-btn__bars i:nth-child(4) { animation-delay: -.2s !important; height: 75%; }
@keyframes eq { from { height: 20%; } to { height: 100%; } }

/* Silenciado: nota musical tachada */
.music-btn__off { display: none; width: 22px; height: 22px; }
.music-btn.is-muted .music-btn__bars { display: none; }
.music-btn.is-muted .music-btn__off { display: block; }

/* Onda suave mientras suena */
.music-btn.is-playing::after {
  content: ""; position: absolute; inset: -1.5px; border-radius: 50%;
  border: 1.5px solid rgba(255, 245, 233, .6);
  animation: ring 2.4s ease-out infinite; pointer-events: none;
}
@keyframes ring { from { scale: 1; opacity: .8; } to { scale: 1.6; opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .music-btn.is-playing .music-btn__bars i, .music-btn.is-playing::after { animation: none; }
}
