/* === ANIMATIONS === */

/* Entrance animations */
@keyframes fadeIn { 
  from { opacity: 0; } 
  to { opacity: 1; } 
}

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

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

@keyframes slideInRight { 
  from { transform: translateX(100%); } 
  to { transform: translateX(0); } 
}

@keyframes slideOutRight { 
  from { transform: translateX(0); } 
  to { transform: translateX(100%); } 
}

/* Loading */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes spin { 
  to { transform: rotate(360deg); } 
}

/* Pulse for warnings */
@keyframes pulse { 
  0%, 100% { opacity: 1; } 
  50% { opacity: 0.5; } 
}

@keyframes pulseBorder { 
  0%, 100% { box-shadow: 0 0 0 0 rgba(232,92,76,0.4); } 
  50% { box-shadow: 0 0 0 8px rgba(232,92,76,0); } 
}

/* Gold glow for streaks */
@keyframes goldGlow {
  0%, 100% { box-shadow: 0 0 5px rgba(201,168,76,0.3); }
  50% { box-shadow: 0 0 20px rgba(201,168,76,0.6), 0 0 40px rgba(201,168,76,0.3); }
}

/* Progress fill */
@keyframes progressFill {
  from { width: 0%; }
  to { width: var(--progress-width, 0%); }
}

/* Flip card */
@keyframes flipIn {
  from { transform: rotateY(-90deg); opacity: 0; }
  to { transform: rotateY(0); opacity: 1; }
}

/* Score reveal */
@keyframes scoreReveal {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

/* Page transition */
@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Utility Classes */
.animate-fade-in { animation: fadeInUp 0.4s ease both; }
.animate-page { animation: pageIn 0.35s ease-out; }
.animate-score { animation: scoreReveal 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.animate-pulse { animation: pulse 2s infinite; }
.animate-glow { animation: goldGlow 2s ease-in-out infinite; }
.animate-spin { animation: spin 1s linear infinite; }

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.10s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.20s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.30s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.40s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.45s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.50s; }
.stagger-children > * { animation-fill-mode: both; }

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--gold);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 22, 41, 0.9);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
