/* ============================================================
   TYPING KID — ANIMATIONS
   ============================================================ */

/* ─── Mascot ─────────────────────────────────────────────── */
@keyframes mascotFloat {
  0%,100% { transform: translateY(0)   rotate(0deg);   }
  25%     { transform: translateY(-8px) rotate(-3deg); }
  75%     { transform: translateY(-4px) rotate(3deg);  }
}

@keyframes mascotCelebrate {
  0%   { transform: scale(1)   rotate(0deg);    }
  25%  { transform: scale(1.4) rotate(-15deg);  }
  50%  { transform: scale(1.5) rotate(15deg);   }
  75%  { transform: scale(1.3) rotate(-5deg);   }
  100% { transform: scale(1.1) rotate(0deg);    }
}

@keyframes mascotWiggle {
  0%,100% { transform: rotate(0deg); }
  25%     { transform: rotate(-8deg); }
  75%     { transform: rotate(8deg); }
}

/* ─── Key Press Animations ───────────────────────────────── */
@keyframes keyCorrect {
  0%   { transform: scale(1); }
  40%  { transform: scale(0.88); }
  80%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}
@keyframes keyWrong {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-6px) rotate(-2deg); }
  40%     { transform: translateX(6px)  rotate(2deg); }
  60%     { transform: translateX(-4px) rotate(-1deg); }
  80%     { transform: translateX(4px)  rotate(1deg); }
}
@keyframes keyHighlight {
  0%,100% { box-shadow: 0 0 0px transparent; }
  50%     { box-shadow: 0 0 16px rgba(255,215,0,0.8); }
}

.key-press-correct { animation: keyCorrect 0.25s cubic-bezier(0.34,1.56,0.64,1) forwards !important; }
.key-press-wrong   { animation: keyWrong   0.4s ease forwards !important; }

/* ─── Char bounce on correct ─────────────────────────────── */
@keyframes charBounce {
  0%   { transform: translateY(0) scale(1); }
  40%  { transform: translateY(-6px) scale(1.15); }
  100% { transform: translateY(0) scale(1); }
}
.char.just-correct { animation: charBounce 0.3s cubic-bezier(0.34,1.56,0.64,1) forwards; }

/* ─── Wrong char flash ───────────────────────────────────── */
@keyframes charShake {
  0%,100% { transform: translateX(0); }
  33%     { transform: translateX(-5px); }
  66%     { transform: translateX(5px); }
}
.char.just-wrong { animation: charShake 0.25s ease forwards; }

/* ─── Confetti ───────────────────────────────────────────── */
#confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  width: 10px; height: 10px;
  top: -20px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(-20px) rotate(0deg) scale(1); opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg) scale(0.5); opacity: 0; }
}

/* ─── Star Rating Animation ──────────────────────────────── */
@keyframes starPop {
  0%   { transform: scale(0) rotate(-30deg); opacity: 0; }
  60%  { transform: scale(1.4) rotate(10deg);  opacity: 1; }
  100% { transform: scale(1.2) rotate(0deg);   opacity: 1; }
}
.result-star.lit { animation: starPop 0.5s cubic-bezier(0.34,1.56,0.64,1) forwards; }
.result-star:nth-child(2).lit { animation-delay: 0.15s; }
.result-star:nth-child(3).lit { animation-delay: 0.30s; }

/* ─── Level Card Hover Glow ──────────────────────────────── */
@keyframes cardGlow {
  0%,100% { box-shadow: 0 0 0 0 rgba(0,212,255,0); }
  50%     { box-shadow: 0 0 24px 4px rgba(0,212,255,0.25); }
}

/* ─── WPM increase flash ─────────────────────────────────── */
@keyframes statPop {
  0%  { transform: scale(1); }
  50% { transform: scale(1.2); color: var(--cyan); }
  100%{ transform: scale(1); }
}
.stat-pop { animation: statPop 0.3s cubic-bezier(0.34,1.56,0.64,1) both; }

/* ─── Loading pulse ──────────────────────────────────────── */
@keyframes pulsate {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.4; }
}
.loading { animation: pulsate 1.2s ease infinite; }

/* ─── Fade In / Up ───────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.4s cubic-bezier(0.34,1.2,0.64,1) both; }
.fade-up-1 { animation-delay: 0.08s; }
.fade-up-2 { animation-delay: 0.16s; }
.fade-up-3 { animation-delay: 0.24s; }
.fade-up-4 { animation-delay: 0.32s; }
.fade-up-5 { animation-delay: 0.40s; }

/* ─── Glow Text Pulse ────────────────────────────────────── */
@keyframes glowPulse {
  0%,100% { text-shadow: 0 0 10px rgba(0,212,255,0.4); }
  50%     { text-shadow: 0 0 30px rgba(0,212,255,0.9), 0 0 60px rgba(0,212,255,0.4); }
}
.glow-cyan  { animation: glowPulse 2.5s ease-in-out infinite; color: var(--cyan); }

/* ─── Background Orbit ───────────────────────────────────── */
@keyframes orbit {
  from { transform: rotate(0deg) translateX(60px) rotate(0deg); }
  to   { transform: rotate(360deg) translateX(60px) rotate(-360deg); }
}
.orbiting {
  position: absolute;
  animation: orbit 8s linear infinite;
  opacity: 0.35;
  font-size: 1.5rem;
  pointer-events: none;
}

/* ─── Ripple on key press ────────────────────────────────── */
@keyframes ripple {
  0%   { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(2.5); opacity: 0; }
}
.key-ripple {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  animation: ripple 0.4s ease forwards;
  pointer-events: none;
  background: currentColor;
}
