/* Lifted from beta_playground/css/animations.css. Proven with this exact
   child, so reused rather than rewritten. Two additions below: the confetti
   container rules, which live in that project's components.css and which
   confetti.js cannot work without, and a reduced-motion guard. */

/* === Screen transitions === */
@keyframes screenSlideIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes screenSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-40px);
  }
}

/* === Floating emoji === */
@keyframes float {
  0% {
    transform: translateY(100vh) rotate(0deg);
  }
  100% {
    transform: translateY(-100px) rotate(360deg);
  }
}

/* === Star pop animation === */
@keyframes starPop {
  0% {
    transform: scale(0);
  }
  60% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

/* === Star reveal on result === */
@keyframes starReveal {
  0% {
    opacity: 0;
    transform: scale(0) rotate(-30deg);
  }
  60% {
    transform: scale(1.3) rotate(10deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* === Correct answer pulse === */
@keyframes correctPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
  }
}

/* === Wrong answer shake === */
@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-8px);
  }
  40% {
    transform: translateX(8px);
  }
  60% {
    transform: translateX(-6px);
  }
  80% {
    transform: translateX(6px);
  }
}

/* === Bounce in === */
@keyframes bounceIn {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
  70% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
  }
}

/* === Fade in === */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* === Fade slide up === */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === Card reveal === */
@keyframes cardReveal {
  0% {
    transform: scale(0) rotateY(180deg);
    opacity: 0;
  }
  60% {
    transform: scale(1.1) rotateY(0deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotateY(0deg);
  }
}

/* === Confetti fall === */
@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg) scale(0);
    opacity: 0;
  }
}

/* === Unlock animation === */
@keyframes unlockBounce {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.2) rotate(-5deg);
  }
  60% {
    transform: scale(0.9) rotate(3deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

/* === Subtle bob for idle animals === */
@keyframes bob {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.bob {
  animation: bob 2s ease-in-out infinite;
}

/* === Spinner for loading === */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--white);
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
}

/* From beta_playground/css/components.css. launchConfetti() creates elements
   with these two class names and styles nothing else, so without these rules
   it appends invisible divs and looks like a silent failure. */
/* === Confetti container === */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-confetti);
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confettiFall linear forwards;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
