/* ============================================================
 *  music.css — Background music mute toggle (fixed corner button)
 * ============================================================ */

#music-mute {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  background: rgba(13, 22, 48, 0.75);
  border: 1px solid #d4af37;
  color: #d4af37;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    background 0.2s ease;
}

#music-mute:hover {
  transform: scale(1.08);
  border-color: #ffd75c;
  color: #ffd75c;
  background: rgba(13, 22, 48, 0.9);
}

#music-mute:focus-visible {
  outline: 2px solid #ffd75c;
  outline-offset: 3px;
}

#music-mute:active {
  transform: scale(0.96);
}

.music-mute-icon {
  width: 22px;
  height: 22px;
  pointer-events: none;
}

/* By default, show the "on" icon and hide the "off" icon. */
.music-mute-icon--off { display: none; }

/* When muted, swap which icon is visible. */
#music-mute.is-muted .music-mute-icon--on  { display: none; }
#music-mute.is-muted .music-mute-icon--off { display: block; }

.audio-gate {
  position: fixed;
  inset: 0;
  z-index: 240;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 38%, rgba(17, 48, 118, 0.44), transparent 34%),
    rgba(2, 7, 24, 0.78);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.audio-gate.is-shown {
  display: flex;
}

.audio-gate-button {
  min-width: min(78vw, 280px);
  min-height: 112px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  padding: 20px 28px;
  border: 1px solid rgba(212, 175, 55, 0.9);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(11, 25, 63, 0.94), rgba(3, 8, 28, 0.96));
  color: #f8e7ac;
  box-shadow:
    0 0 0 1px rgba(255, 232, 156, 0.12) inset,
    0 18px 58px rgba(0, 0, 0, 0.5),
    0 0 34px rgba(212, 175, 55, 0.18);
  cursor: pointer;
}

.audio-gate-button:hover,
.audio-gate-button:focus-visible {
  border-color: #ffe185;
  outline: none;
  box-shadow:
    0 0 0 1px rgba(255, 232, 156, 0.2) inset,
    0 18px 58px rgba(0, 0, 0, 0.52),
    0 0 42px rgba(212, 175, 55, 0.28);
}

.audio-gate-button:active {
  transform: translateY(1px) scale(0.99);
}

.audio-gate-mark {
  font-size: 14px;
  color: #d4af37;
}

.audio-gate-title {
  font-family: var(--font-display, serif);
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 0 16px rgba(248, 231, 172, 0.36);
}

.audio-gate-sub {
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.12em;
  color: rgba(212, 175, 55, 0.82);
}

body.is-ending #music-mute {
  opacity: 0;
  pointer-events: none;
}

/* Mobile: slightly smaller, nudged in from the edge */
@media (max-width: 640px) {
  #music-mute {
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    right: 10px;
    width: 36px;
    height: 36px;
  }
  .music-mute-icon { width: 18px; height: 18px; }
}
