/* ============================================
   OTD GAMES — ANIMATIONS
   ============================================ */

/* === SCREEN TRANSITIONS === */
@keyframes screenIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes screenOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-12px); }
}

/* === LOADING === */
@keyframes loadingCircle {
  0% { stroke-dashoffset: 352; }
  50% { stroke-dashoffset: 88; }
  100% { stroke-dashoffset: 352; }
}

@keyframes loadingBar {
  0% { width: 0%; }
  30% { width: 40%; }
  60% { width: 70%; }
  100% { width: 100%; }
}

/* === TOAST === */
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-20px) scale(0.95); }
}

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

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* === PULSE === */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 10px rgba(var(--accent-primary-rgb), 0.3); }
  50% { box-shadow: 0 0 30px rgba(var(--accent-primary-rgb), 0.6); }
}

@keyframes pulseDanger {
  0%, 100% { box-shadow: 0 0 10px rgba(var(--color-danger-rgb), 0.3); }
  50% { box-shadow: 0 0 30px rgba(var(--color-danger-rgb), 0.6); }
}

@keyframes pulseSuccess {
  0%, 100% { box-shadow: 0 0 10px rgba(var(--color-success-rgb), 0.3); }
  50% { box-shadow: 0 0 30px rgba(var(--color-success-rgb), 0.6); }
}

/* === SHAKE === */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

@keyframes shakeHard {
  0%, 100% { transform: translateX(0) rotate(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-8px) rotate(-1deg); }
  20%, 40%, 60%, 80% { transform: translateX(8px) rotate(1deg); }
}

/* === SCALE === */
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes scaleOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.5); }
}

@keyframes popIn {
  0% { opacity: 0; transform: scale(0); }
  60% { transform: scale(1.15); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes bounceIn {
  0% { opacity: 0; transform: scale(0.3); }
  40% { transform: scale(1.1); }
  60% { transform: scale(0.95); }
  80% { transform: scale(1.02); }
  100% { opacity: 1; transform: scale(1); }
}

/* === SLIDE === */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

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

/* === SHIMMER === */
@keyframes shimmer {
  0% { opacity: 0; transform: translateX(-100%); }
  50% { opacity: 1; }
  100% { opacity: 0; transform: translateX(100%); }
}

/* === GLOW === */
@keyframes glowPulse {
  0%, 100% { filter: drop-shadow(0 0 5px rgba(var(--accent-primary-rgb), 0.4)); }
  50% { filter: drop-shadow(0 0 20px rgba(var(--accent-primary-rgb), 0.8)); }
}

/* === ROTATE === */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* === NUMBER COUNT === */
@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === XP GAIN === */
@keyframes xpFloat {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-60px) scale(1.5); }
}

/* === STREAK FIRE === */
@keyframes fireFlicker {
  0%, 100% { transform: scale(1) rotate(0); }
  25% { transform: scale(1.1) rotate(-3deg); }
  50% { transform: scale(0.95) rotate(2deg); }
  75% { transform: scale(1.05) rotate(-1deg); }
}

/* === CONFETTI === */
@keyframes confettiDrop {
  0% { opacity: 1; transform: translateY(0) rotate(0); }
  100% { opacity: 0; transform: translateY(100vh) rotate(720deg); }
}

/* === CHART LINE === */
@keyframes drawLine {
  from { stroke-dashoffset: 1000; }
  to { stroke-dashoffset: 0; }
}

/* === RIPPLE === */
@keyframes ripple {
  0% { transform: scale(0); opacity: 0.5; }
  100% { transform: scale(4); opacity: 0; }
}

/* === ENTRANCE DELAYS === */
.anim-delay-1 { animation-delay: 0.05s; }
.anim-delay-2 { animation-delay: 0.1s; }
.anim-delay-3 { animation-delay: 0.15s; }
.anim-delay-4 { animation-delay: 0.2s; }
.anim-delay-5 { animation-delay: 0.25s; }
.anim-delay-6 { animation-delay: 0.3s; }
.anim-delay-7 { animation-delay: 0.35s; }
.anim-delay-8 { animation-delay: 0.4s; }

/* Common animation classes */
.anim-slide-up {
  animation: slideUp var(--duration-slow) var(--ease-out) both;
}

.anim-pop-in {
  animation: popIn var(--duration-slow) var(--ease-spring) both;
}

.anim-bounce-in {
  animation: bounceIn 0.6s var(--ease-out) both;
}

.anim-shake {
  animation: shake 0.5s var(--ease-out);
}

.anim-shake-hard {
  animation: shakeHard 0.6s var(--ease-out);
}

.anim-pulse {
  animation: pulse 1.5s infinite;
}

.anim-glow {
  animation: pulseGlow 2s infinite;
}

.anim-fire {
  animation: fireFlicker 0.8s infinite;
}

/* === STAGGER CHILDREN === */
.stagger > * {
  opacity: 0;
  animation: slideUp var(--duration-slow) var(--ease-out) forwards;
}

.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.3s; }
.stagger > *:nth-child(7) { animation-delay: 0.35s; }
.stagger > *:nth-child(8) { animation-delay: 0.4s; }
.stagger > *:nth-child(9) { animation-delay: 0.45s; }
.stagger > *:nth-child(10) { animation-delay: 0.5s; }

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
