/* ==========================================================================
   FNF Reiya — background music controller
   Fixed bottom-right pill. 56px glass circle, thin progress ring,
   icon swaps between play and pause. Matches the frames' dark surfaces.
   ========================================================================== */

.player {
  position: fixed;
  right: var(--nav-pad);
  bottom: var(--nav-pad);
  z-index: 60;
  /* keep the control clear of the iOS home indicator */
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.player__btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 50%;
  background: rgba(18, 18, 22, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--ink);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  transition: border-color 0.28s var(--ease), transform 0.28s var(--ease-spring),
    background-color 0.28s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.player__btn:hover {
  border-color: rgba(254, 19, 176, 0.6);
  background: rgba(26, 26, 32, 0.86);
  transform: translateY(-2px);
}

.player__btn:active {
  transform: scale(0.94);
}

/* ---- progress ring ---- */
.player__ring {
  position: absolute;
  inset: -1px;
  width: calc(100% + 2px);
  height: calc(100% + 2px);
  transform: rotate(-90deg);
  pointer-events: none;
}

.player__ring circle {
  fill: none;
  stroke-width: 2;
}

.player__ring-bg {
  stroke: rgba(255, 255, 255, 0.1);
}

.player__ring-fg {
  stroke: var(--magenta);
  stroke-linecap: round;
  stroke-dasharray: 163.4;
  stroke-dashoffset: 163.4;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

/* the ring only shows once audio is actually running, or on hover/focus */
.player[data-state="playing"] .player__ring-fg,
.player__btn:hover .player__ring-fg,
.player__btn:focus-visible .player__ring-fg {
  opacity: 1;
}

/* duration still unknown — no arc to draw, so don't pretend with 0% */
.player[data-progress="none"] .player__ring-fg {
  opacity: 0;
}

/* ---- icons ---- */
.player__icon {
  position: relative;
  width: 20px;
  height: 20px;
  fill: currentColor;
  transition: opacity 0.22s var(--ease), transform 0.28s var(--ease-spring);
}

.player__icon--pause {
  opacity: 0;
  transform: scale(0.7);
  position: absolute;
}

.player[data-state="playing"] .player__icon--play {
  opacity: 0;
  transform: scale(0.7);
}

.player[data-state="playing"] .player__icon--pause {
  opacity: 1;
  transform: none;
}

/* a slow breathing halo while the track runs — reads as "live", not decoration */
.player[data-state="playing"] .player__btn::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid rgba(254, 19, 176, 0.5);
  animation: player-halo 2.8s var(--ease) infinite;
  pointer-events: none;
}

@keyframes player-halo {
  0% {
    transform: scale(1);
    opacity: 0.55;
  }
  70% {
    transform: scale(1.34);
    opacity: 0;
  }
  100% {
    transform: scale(1.34);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .player[data-state="playing"] .player__btn::after {
    animation: none;
    opacity: 0;
  }

  .player__btn,
  .player__icon {
    transition: none;
  }
}

@media (max-width: 640px) {
  .player {
    right: 16px;
    bottom: 16px;
  }

  .player__btn {
    width: 50px;
    height: 50px;
  }

  .player__icon {
    width: 18px;
    height: 18px;
  }
}
