/* ============================================
   花馍传奇 - Animations
   ============================================ */

/* --- Core Keyframes --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

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

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

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

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

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

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes bounceIn {
  0%   { transform: scale(0.3); opacity: 0; }
  50%  { transform: scale(1.05); opacity: 1; }
  70%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 10px rgba(212,168,67,0.3); }
  50%      { box-shadow: 0 0 25px rgba(212,168,67,0.6); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

@keyframes shimmer {
  0%   { background-position: -200px 0; }
  100% { background-position: 200px 0; }
}

@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 0.6;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

@keyframes steam-rise {
  0% {
    transform: translateY(0) scale(1);
    opacity: 0.6;
  }
  100% {
    transform: translateY(-80px) scale(2);
    opacity: 0;
  }
}

@keyframes brush-stroke {
  0%   { width: 0; }
  100% { width: 100%; }
}

/* --- Floating Particles --- */
@keyframes particle-float {
  0% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }
  10% { opacity: 0.8; }
  90% { opacity: 0.8; }
  100% {
    transform: translateY(-10vh) rotate(360deg);
    opacity: 0;
  }
}

.floating-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  font-size: 1.5rem;
  animation: particle-float linear infinite;
  opacity: 0;
}

/* --- Stagger Animations --- */
.stagger-in > * {
  opacity: 0;
  animation: slideUp 0.5s ease forwards;
}

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

/* --- Transition Helpers --- */
.fade-enter {
  animation: fadeIn 0.4s ease forwards;
}

.fade-exit {
  animation: fadeOut 0.3s ease forwards;
}

.slide-enter {
  animation: slideUp 0.5s ease forwards;
}

.bounce-enter {
  animation: bounceIn 0.5s ease forwards;
}

.scale-enter {
  animation: scaleIn 0.4s ease forwards;
}

/* --- Interactive States --- */
.hover-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px var(--shadow);
}

.hover-glow {
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(212,168,67,0.4);
}

.click-ripple {
  position: relative;
  overflow: hidden;
}

.click-ripple::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  transform: scale(0);
  pointer-events: none;
}

.click-ripple:active::after {
  animation: ripple 0.6s ease-out;
}

/* --- Steam Effect --- */
.steam-container {
  position: relative;
}

.steam-particle {
  position: absolute;
  width: 20px;
  height: 20px;
  background: radial-gradient(circle, rgba(255,255,255,0.6), transparent);
  border-radius: 50%;
  animation: steam-rise 2s ease-out infinite;
}

/* --- Progress bar animation --- */
.progress-fill {
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Card reveal --- */
.card-reveal {
  animation: scaleIn 0.4s ease forwards;
  transform-origin: center bottom;
}

/* --- Score popup --- */
@keyframes score-popup {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-60px) scale(1.5);
  }
}

.score-popup {
  position: absolute;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--gold);
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  animation: score-popup 1s ease-out forwards;
  pointer-events: none;
}

/* --- Shake (for wrong answer) --- */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-5px); }
  80%      { transform: translateX(5px); }
}

.shake {
  animation: shake 0.4s ease;
}
