/* ── Phase Transition Animations ── */

:root {
  --scene-transition-duration: 600ms;
  --scene-transition-easing: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Background changes are instant — the overlay provides the smooth visual bridge */

/* ── Phase Overlay ── */

.phase-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 280ms ease;
}

.phase-overlay.active {
  opacity: 1;
}

.phase-overlay.to-night {
   background: radial-gradient(ellipse at 50% 40%, rgba(10, 14, 32, 0.92) 0%, rgba(3, 5, 12, 0.97) 100%);
 }
 
 .phase-overlay.to-day {
   background: radial-gradient(ellipse at 50% 50%, rgba(255, 200, 80, 0.25) 0%, rgba(255, 255, 255, 0.08) 100%);
 }
 
 .phase-overlay.to-finished {
   background: radial-gradient(ellipse at 50% 50%, rgba(201, 164, 106, 0.3) 0%, rgba(0, 0, 0, 0.2) 100%);
 }

.phase-overlay-label {
  font-family: "Acme", sans-serif;
  font-size: 3.2rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  color: #c8d8ff;
  text-shadow: 0 0 24px rgba(100, 150, 255, 0.7), 0 2px 8px rgba(0,0,0,0.6);
  opacity: 0;
  transform: translateY(14px) scale(0.96);
  transition: opacity 450ms ease 150ms, transform 450ms cubic-bezier(0.22, 1, 0.36, 1) 150ms;
}

.phase-overlay.active .phase-overlay-label {
  opacity: 1;
  transform: none;
}

.phase-overlay.to-day .phase-overlay-label {
  color: #fff3d4;
  text-shadow: 0 0 28px rgba(255, 200, 80, 0.8), 0 2px 8px rgba(0,0,0,0.4);
}

/* ── Panel Entrance Animation ── */

@keyframes panel-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.phase-transitioning .hybrid-stage-player,
.phase-transitioning .legacy-panel {
  animation: panel-fade-in 350ms ease both;
}

.phase-transitioning .hybrid-stage-player:nth-child(2) { animation-delay: 50ms; }
.phase-transitioning .hybrid-stage-player:nth-child(3) { animation-delay: 100ms; }
.phase-transitioning .hybrid-stage-player:nth-child(4) { animation-delay: 150ms; }

/* ── Role Card Flip ── */

@keyframes card-flip {
  0% {
    transform: rotateY(180deg) scale(0.85);
    opacity: 0.6;
  }
  60% {
    transform: rotateY(20deg) scale(1.02);
    opacity: 1;
  }
  100% {
    transform: rotateY(0) scale(1);
    opacity: 1;
  }
}

.reveal-card-container.is-revealing .role-reveal-card-inner {
  animation: card-flip 500ms var(--scene-transition-easing) forwards;
}

/* ── Scene-Specific Ambient Glow ── */

@keyframes night-ambient {
  0%, 100% { box-shadow: inset 0 0 120px 40px rgba(15, 20, 50, 0.12); }
  50% { box-shadow: inset 0 0 120px 40px rgba(15, 20, 50, 0.22); }
}

body.hybrid-scene-night .shell {
  animation: night-ambient 8s ease-in-out infinite;
}

/* ── Reduced Motion ── */

@media (prefers-reduced-motion: reduce) {
  .phase-overlay {
    transition: none !important;
    display: none !important;
  }

  .phase-transitioning .hybrid-stage-player,
  .phase-transitioning .legacy-panel {
    animation: none !important;
  }

  .reveal-card-container.is-revealing .role-reveal-card-inner {
    animation: none !important;
  }

  body.hybrid-scene-night .shell {
    animation: none !important;
  }
}
