/* Custom Scrollbar & Animations */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #0f172a; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

.glow-pink { box-shadow: 0 0 15px rgba(236, 72, 153, 0.5); }
.glow-green { box-shadow: 0 0 15px rgba(16, 185, 129, 0.5); }
.glow-blue { box-shadow: 0 0 15px rgba(59, 130, 246, 0.5); }
.glow-red { box-shadow: 0 0 15px rgba(239, 68, 68, 0.5); }

@keyframes pulse-fast {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.animate-pulse-fast { animation: pulse-fast 0.6s infinite; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
.animate-shake { animation: shake 0.3s ease-in-out; }

/* Overdrive Mode: pulsing neon pink frenzy state */
@keyframes overdrive-pulse {
  0%, 100% {
    border-color: #ec4899;
    box-shadow: 0 0 18px rgba(236, 72, 153, 0.55), inset 0 0 26px rgba(236, 72, 153, 0.18);
  }
  50% {
    border-color: #f472b6;
    box-shadow: 0 0 42px rgba(236, 72, 153, 0.9), inset 0 0 60px rgba(236, 72, 153, 0.35);
  }
}
.overdrive-glow {
  animation: overdrive-pulse 1s ease-in-out infinite;
  background-image: radial-gradient(circle at 50% 0%, rgba(236, 72, 153, 0.22), transparent 65%);
}
.overdrive-intensity-panel {
  box-shadow: 0 0 24px rgba(236, 72, 153, 0.35), inset 0 0 18px rgba(236, 72, 153, 0.12);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}
.overdrive-intensity-panel.overdrive-critical {
  animation: overdrive-critical 0.4s ease-in-out infinite;
  border-color: #ef4444;
}
@keyframes overdrive-critical {
  0%, 100% {
    box-shadow: 0 0 22px rgba(236, 72, 153, 0.5), inset 0 0 20px rgba(236, 72, 153, 0.2);
  }
  50% {
    box-shadow: 0 0 48px rgba(239, 68, 68, 0.95), inset 0 0 40px rgba(239, 68, 68, 0.45);
  }
}
#overdrive-intensity-fill { transition: width 100ms linear; }

/* Speed Bonus countdown: the window shrinks 6s → 2.5s */
.overdrive-countdown-panel {
  box-shadow: 0 0 24px rgba(236, 72, 153, 0.4), inset 0 0 18px rgba(236, 72, 153, 0.15);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.overdrive-countdown-panel.overdrive-countdown-critical {
  animation: overdrive-countdown-critical 0.35s ease-in-out infinite;
  border-color: #ef4444;
}
@keyframes overdrive-countdown-critical {
  0%, 100% { box-shadow: 0 0 20px rgba(236, 72, 153, 0.55), inset 0 0 16px rgba(236, 72, 153, 0.2); }
  50% { box-shadow: 0 0 48px rgba(239, 68, 68, 0.95), inset 0 0 34px rgba(239, 68, 68, 0.4); }
}
#overdrive-countdown-fill { transition: width 100ms linear; }

/* Speed Bonus glow — levels 1-3 pulse the border instead of shaking the card.
   No motion of the numbers keeps them easy to read for every learner. */
@keyframes overdrive-bonus-glow-1 {
  0%, 100% { box-shadow: 0 0 10px rgba(236, 72, 153, 0.35), inset 0 0 0 rgba(236, 72, 153, 0); }
  50% { box-shadow: 0 0 26px rgba(236, 72, 153, 0.65), inset 0 0 18px rgba(236, 72, 153, 0.15); }
}
@keyframes overdrive-bonus-glow-2 {
  0%, 100% { box-shadow: 0 0 16px rgba(244, 114, 182, 0.5), inset 0 0 0 rgba(244, 114, 182, 0); }
  50% { box-shadow: 0 0 38px rgba(244, 114, 182, 0.85), inset 0 0 26px rgba(244, 114, 182, 0.22); }
}
@keyframes overdrive-bonus-glow-3 {
  0%, 100% { box-shadow: 0 0 22px rgba(251, 191, 36, 0.55), inset 0 0 0 rgba(251, 191, 36, 0); }
  50% { box-shadow: 0 0 52px rgba(251, 191, 36, 0.95), inset 0 0 34px rgba(251, 191, 36, 0.28); }
}
.overdrive-pulse-1 { animation: overdrive-bonus-glow-1 1.1s ease-in-out infinite; }
.overdrive-pulse-2 { animation: overdrive-bonus-glow-2 0.9s ease-in-out infinite; }
.overdrive-pulse-3 { animation: overdrive-bonus-glow-3 0.7s ease-in-out infinite; }
/* Keep the neon glow pulsing while the bonus glow ramps up */
.overdrive-glow.overdrive-pulse-1 { animation: overdrive-pulse 1s ease-in-out infinite, overdrive-bonus-glow-1 1.1s ease-in-out infinite; }
.overdrive-glow.overdrive-pulse-2 { animation: overdrive-pulse 1s ease-in-out infinite, overdrive-bonus-glow-2 0.9s ease-in-out infinite; }
.overdrive-glow.overdrive-pulse-3 { animation: overdrive-pulse 1s ease-in-out infinite, overdrive-bonus-glow-3 0.7s ease-in-out infinite; }

/* +1.5s time-bank flash on the Overdrive meter */
@keyframes overdrive-extension-flash {
  0% { border-color: #fde047; box-shadow: 0 0 46px rgba(253, 224, 71, 0.9), inset 0 0 30px rgba(253, 224, 71, 0.3); }
  100% { border-color: #ec4899; box-shadow: 0 0 24px rgba(236, 72, 153, 0.35), inset 0 0 18px rgba(236, 72, 153, 0.12); }
}
.overdrive-intensity-panel.overdrive-extension-flash { animation: overdrive-extension-flash 0.5s ease-out; }

/* Overtime Rush: crimson vignette warning for the final 15 seconds */
@keyframes overtime-pulse {
  0%, 100% { box-shadow: inset 0 0 60px rgba(239, 68, 68, 0.28); }
  50% { box-shadow: inset 0 0 120px rgba(239, 68, 68, 0.55); }
}
.overtime-rush {
  animation: overtime-pulse 0.9s ease-in-out infinite;
  border-color: #ef4444 !important;
  background-image: radial-gradient(circle at 50% 120%, rgba(239, 68, 68, 0.28), transparent 70%);
}
.timer-warning {
  color: #ef4444 !important;
  font-size: 2rem !important;
  animation: pulse-fast 0.8s infinite;
  text-shadow: 0 0 14px rgba(239, 68, 68, 0.7);
}

/* Boss Battle */
.turkey-panel {
  padding: clamp(0.75rem, 2vw, 1.5rem);
  border: 2px solid #d97706;
  border-radius: 1.5rem;
  background: linear-gradient(160deg, #451a03, #1c1917 65%, #422006);
  color: #fef3c7;
}
.turkey-heading { display: flex; justify-content: space-between; gap: 1rem; font-weight: bold; }
.turkey-power-track { height: 1.25rem; margin-top: 0.6rem; border-radius: 1rem; background: #1c1917; overflow: hidden; }
.turkey-power-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #dc2626, #f59e0b, #fde047); transition: width 0.3s; }
.turkey-arena {
  position: relative;
  height: clamp(320px, 60vh, 700px);
  overflow: hidden;
  background: radial-gradient(ellipse at center, #fbbf24 0%, #b45309 45%, #451a03 100%);
  border-radius: 1rem;
  margin-top: 0.8rem;
}
.turkey-art {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 50%;
  height: 60%;
  filter: drop-shadow(0 1rem 1rem #451a03);
  animation: turkey-bob 0.9s ease-in-out infinite;
  transition: left 0.45s ease-in-out, top 0.45s ease-in-out;
}
.turkey-pilgrim {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 1;
  font-size: clamp(1.3rem, 3vw, 2.4rem);
  line-height: 1;
  text-align: center;
  transform: translate(-50%, -10%);
  transform-origin: center;
}
.turkey-pilgrim::after {
  content: '🙂';
  display: block;
  margin-top: -0.3em;
}
.turkey-pilgrim.gobbling { animation: turkey-gobble 0.45s 0.3s ease-in forwards; }
.turkey-feathers, .turkey-beak, .turkey-wattle, .turkey-feet { transform-box: fill-box; transform-origin: center bottom; }
.turkey-feathers { animation: turkey-feathers-flap 0.6s ease-in-out infinite alternate; }
.turkey-beak { animation: turkey-beak-chomp 0.32s ease-in-out infinite alternate; }
.turkey-wattle { animation: turkey-wattle-wobble 0.28s ease-in-out infinite alternate; }
.turkey-feet { animation: turkey-feet-stomp 0.4s ease-in-out infinite alternate; }
.turkey-arena.buildup { box-shadow: inset 0 0 80px #dc2626; }
.turkey-arena.buildup .turkey-art { animation-duration: 0.65s; }
.turkey-arena.rampage .turkey-art { animation: turkey-rampage 0.28s ease-in-out infinite alternate; }
.turkey-status { margin: 0.75rem 0 0; text-align: center; font-weight: bold; }
@keyframes turkey-bob {
  0%, 100% { transform: translate(-50%, -50%) rotate(-5deg) scale(0.98); }
  50% { transform: translate(-50%, -57%) rotate(5deg) scale(1.05); }
}
@keyframes turkey-feathers-flap { to { transform: rotate(7deg) scaleX(1.12); } }
@keyframes turkey-beak-chomp { to { transform: scaleY(1.4) rotate(5deg); } }
@keyframes turkey-wattle-wobble { to { transform: rotate(18deg); } }
@keyframes turkey-feet-stomp { to { transform: translateY(8px) rotate(4deg); } }
@keyframes turkey-gobble { to { opacity: 0; transform: translate(-50%, -10%) scale(0.05); } }
@keyframes turkey-rampage {
  from { transform: translate(-50%, -50%) rotate(-5deg) scale(1.03); }
  to { transform: translate(-50%, -50%) rotate(5deg) scale(1.08); }
}
.student-turkey-scene {
  position: fixed;
  z-index: 45;
  pointer-events: none;
  font-size: clamp(2rem, 7vw, 3.5rem);
  line-height: 1;
  transform: translate(-50%, -50%);
  transition: left 0.45s ease-in-out, top 0.45s ease-in-out;
}
.student-turkey, .student-turkey-pilgrim { display: inline-block; }
.student-turkey { animation: student-turkey-strut 0.45s ease-in-out infinite alternate; }
.student-turkey-pilgrim { font-size: 0.45em; text-align: center; vertical-align: middle; }
.student-turkey-scene:not(.snatching) .student-turkey-pilgrim { opacity: 0; }
.student-turkey-scene.snatching .student-turkey { animation: student-turkey-snatch 0.8s ease-in-out; }
.student-turkey-scene.snatching .student-turkey-pilgrim { animation: student-turkey-eaten 0.8s ease-in forwards; }
@keyframes student-turkey-strut { to { transform: translateY(-0.15em) rotate(12deg) scale(1.1); } }
@keyframes student-turkey-snatch {
  25% { transform: translate(-0.2em, -0.3em) rotate(-20deg) scale(1.15); }
  60% { transform: translateX(0.5em) rotate(25deg) scale(1.35); }
}
@keyframes student-turkey-eaten {
  45% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-1em) scale(0.1); }
}
/* Big Turkey crimson tint mirrors the Boss Battle enrage vignette. It lives in its
   own fixed layer so the full student viewport is tinted while the gameplay panel
   shakes: faint for the round, deeper from 15 seconds, saturated in the rampage. */
/* A gobbled student is out for the round: this covers the game so taps and
   Enter cannot score, and it names the reason. */
.turkey-eaten-overlay {
  position: fixed;
  inset: 0;
  z-index: 46;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(circle at 50% 40%, rgba(120, 20, 20, 0.82), rgba(12, 8, 8, 0.96));
  animation: turkey-eaten-fade 0.35s ease-out;
}
.turkey-eaten-overlay.active { display: flex; }
.turkey-eaten-card {
  max-width: 24rem;
  text-align: center;
  color: #fee2e2;
  border: 2px solid #dc2626;
  border-radius: 1.25rem;
  padding: 2rem 1.5rem;
  background: rgba(28, 12, 12, 0.92);
  box-shadow: 0 0 40px rgba(220, 38, 38, 0.55);
}
.turkey-eaten-icon { display: block; font-size: 3.5rem; line-height: 1; animation: turkey-eaten-bob 0.9s ease-in-out infinite alternate; }
.turkey-eaten-card h2 {
  margin-top: 0.75rem;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #fca5a5;
}
.turkey-eaten-card p { margin-top: 0.75rem; font-size: 0.9rem; line-height: 1.5; }
.turkey-eaten-card .turkey-eaten-hint { color: #fdba74; font-size: 0.8rem; }
@keyframes turkey-eaten-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes turkey-eaten-bob { to { transform: translateY(-0.4rem) rotate(8deg) scale(1.08); } }

.student-turkey-tint {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(220, 38, 38, 0) 42%, rgba(220, 38, 38, 0.34) 100%);
  animation: turkey-crimson-breathe 2.4s ease-in-out infinite;
}
.student-turkey-tint.turkey-tint-buildup {
  background: radial-gradient(circle at 50% 50%, rgba(220, 38, 38, 0) 30%, rgba(220, 38, 38, 0.55) 100%);
  animation-duration: 1.4s;
}
.student-turkey-tint.turkey-tint-rampage {
  background: radial-gradient(circle at 50% 50%, rgba(220, 38, 38, 0.1) 20%, rgba(185, 28, 28, 0.85) 100%);
  animation-duration: 0.7s;
}
@keyframes turkey-crimson-breathe {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
.turkey-buildup { box-shadow: inset 0 0 90px rgba(239, 68, 68, 0.45), 0 0 30px rgba(239, 68, 68, 0.3); }
.turkey-screen-shake { animation: turkey-student-shake 0.5s ease-in-out; }
.turkey-screen-rampage {
  box-shadow: inset 0 0 140px rgba(220, 38, 38, 0.8), 0 0 60px rgba(220, 38, 38, 0.55);
  animation: turkey-student-rampage 0.2s ease-in-out infinite;
}
@keyframes turkey-student-shake {
  20%, 60% { transform: translate(-36px, 12px) rotate(-2.1deg); }
  40%, 80% { transform: translate(36px, -12px) rotate(2.1deg); }
}
@keyframes turkey-student-rampage {
  0%, 100% { transform: translate(-48px, 18px) rotate(-2.7deg); }
  50% { transform: translate(48px, -18px) rotate(2.7deg); }
}
@media (prefers-reduced-motion: reduce) {
  .turkey-art, .turkey-arena.rampage .turkey-art {
    animation: none;
    transform: translate(-50%, -50%);
    transition: none;
  }
  .turkey-pilgrim.gobbling { animation-duration: 0.01ms; animation-delay: 0s; }
  .turkey-feathers, .turkey-beak, .turkey-wattle, .turkey-feet { animation: none; }
  .student-turkey-scene { display: none; }
  .turkey-screen-shake, .turkey-screen-rampage { animation: none; }
  .turkey-eaten-overlay { animation: none; }
  .turkey-eaten-icon { animation: none; }
  .student-turkey-tint { animation: none; opacity: 0.6; }
  .student-turkey-tint.turkey-tint-buildup { opacity: 0.8; }
  .student-turkey-tint.turkey-tint-rampage { opacity: 1; }
  .overdrive-pulse-1, .overdrive-pulse-2, .overdrive-pulse-3,
  .overdrive-glow.overdrive-pulse-1, .overdrive-glow.overdrive-pulse-2, .overdrive-glow.overdrive-pulse-3 {
    animation: none;
    box-shadow: 0 0 24px rgba(236, 72, 153, 0.55);
  }
}
@keyframes boss-idle {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.02); }
}
.boss-idle { animation: boss-idle 2.4s ease-in-out infinite; }
.boss-enraged {
  background-image: linear-gradient(160deg, rgba(69, 10, 10, 0.95), rgba(15, 23, 42, 0.98));
  border-color: #ef4444 !important;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.45);
}
.boss-hit { animation: shake 0.35s ease-in-out; }

/* Class takes a boss hit: full-screen red flash that fades back to normal */
@keyframes boss-damage-flash {
  0% { box-shadow: inset 0 0 0 9999px rgba(239, 68, 68, 0.6); }
  100% { box-shadow: inset 0 0 0 9999px rgba(239, 68, 68, 0); }
}
.boss-damage-flash {
  animation: boss-damage-flash 0.9s ease-out forwards !important;
}

.boss-damage-flash-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: rgba(239, 68, 68, 0);
  opacity: 0;
  z-index: 40;
}
.boss-damage-flash-overlay.active {
  animation: boss-damage-overlay-flash 0.9s ease-out forwards;
}
@keyframes boss-damage-overlay-flash {
  0% { background: rgba(239, 68, 68, 0.55); opacity: 1; }
  100% { background: rgba(239, 68, 68, 0); opacity: 0; }
}

/* Boss verdict sting: full-screen flash that settles into a red wash */
.boss-winner-flash-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  z-index: 60;
}
@keyframes boss-winner-sting-boss {
  0% { opacity: 1; background: rgba(255, 255, 255, 0.96); }
  5% { background: rgba(248, 113, 113, 0.92); }
  14% { background: rgba(153, 27, 27, 0.9); }
  65% { opacity: 1; background: rgba(127, 29, 29, 0.75); }
  100% { opacity: 0; background: rgba(127, 29, 29, 0); }
}
@keyframes boss-winner-sting-boss-red {
  0% { opacity: 1; background: rgba(255, 255, 255, 0.96); }
  5% { background: rgba(248, 113, 113, 0.94); }
  12% { background: rgba(185, 28, 28, 0.92); }
  45% { opacity: 1; background: rgba(127, 29, 29, 0.82); }
  100% { opacity: 1; background: rgba(69, 10, 10, 0.6); }
}
@keyframes boss-winner-sting-class {
  0% { opacity: 1; background: rgba(255, 255, 255, 0.96); }
  6% { background: rgba(110, 231, 183, 0.85); }
  16% { background: rgba(6, 78, 59, 0.85); }
  65% { opacity: 1; background: rgba(6, 78, 59, 0.6); }
  100% { opacity: 0; background: rgba(6, 78, 59, 0); }
}
.boss-winner-flash-overlay.active.boss-won {
  animation: boss-winner-sting-boss 4.2s ease-out forwards;
}
.boss-winner-flash-overlay.active.boss-won.fade-red {
  animation: boss-winner-sting-boss-red 4.6s ease-out forwards;
}
.boss-winner-flash-overlay.active.class-won {
  animation: boss-winner-sting-class 3.4s ease-out forwards;
}

.boss-winner-flash-text {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(1.6rem, 7vw, 4.5rem);
  letter-spacing: 0.12em;
  color: #ffffff;
  text-align: center;
  text-shadow: 0 0 18px rgba(0, 0, 0, 0.85), 0 0 42px rgba(248, 113, 113, 0.9);
  opacity: 0;
  transform: scale(0.6);
}
.boss-winner-flash-overlay.class-won .boss-winner-flash-text {
  text-shadow: 0 0 18px rgba(0, 0, 0, 0.8), 0 0 42px rgba(16, 185, 129, 0.95);
}
.boss-winner-flash-overlay.active .boss-winner-flash-text {
  animation: boss-winner-text 2.6s ease-out forwards;
}
@keyframes boss-winner-text {
  0% { opacity: 0; transform: scale(0.5); }
  10% { opacity: 1; transform: scale(1.18); }
  22% { transform: scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.04); }
}

/* Loss tint that lingers under the final screen on student devices */
body.boss-defeat-red {
  background-color: #2b0a0a !important;
  background-image: radial-gradient(circle at 50% -10%, rgba(239, 68, 68, 0.35), transparent 60%) !important;
}

/* Class victory pulse around the projector room */
@keyframes boss-victory-glow {
  0%, 100% { box-shadow: 0 0 0 rgba(16, 185, 129, 0); }
  40% { box-shadow: 0 0 90px rgba(16, 185, 129, 0.55); }
}
.boss-victory-glow { animation: boss-victory-glow 2.4s ease-out; }

/* Projector headline above the final results: one clear winner per round */
.boss-results-winner {
  border-radius: 0.75rem;
  border: 2px solid transparent;
  padding: 0.75rem 1rem;
  text-align: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.boss-results-winner--boss {
  border-color: #dc2626;
  background: rgba(69, 10, 10, 0.8);
  color: #fecaca;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.35);
}
.boss-results-winner--class {
  border-color: #10b981;
  background: rgba(6, 78, 59, 0.8);
  color: #a7f3d0;
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.35);
}

/* Boss roar screen shake — intensity scales 1 (light) to 3 (ferocious) */
@keyframes boss-roar-shake-1 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  20%, 60% { transform: translate(-4px, 2px) rotate(-0.4deg); }
  40%, 80% { transform: translate(4px, -2px) rotate(0.4deg); }
}
@keyframes boss-roar-shake-2 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  20%, 60% { transform: translate(-9px, 3px) rotate(-0.7deg); }
  40%, 80% { transform: translate(9px, -3px) rotate(0.7deg); }
}
@keyframes boss-roar-shake-3 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  15%, 45%, 75% { transform: translate(-14px, 4px) rotate(-1.1deg); }
  30%, 60%, 90% { transform: translate(14px, -4px) rotate(1.1deg); }
}
.boss-roar-1 { animation: boss-roar-shake-1 0.55s ease-in-out; }
.boss-roar-2 { animation: boss-roar-shake-2 0.8s ease-in-out; }
.boss-roar-3 { animation: boss-roar-shake-3 1.05s ease-in-out; }

/* Knight sword strike against the boss */
@keyframes knight-slash {
  0% { transform: translateX(0) rotate(0deg); }
  25% { transform: translateX(16px) rotate(-22deg); }
  55% { transform: translateX(22px) rotate(-8deg); }
  100% { transform: translateX(0) rotate(0deg); }
}
.knight-slash { animation: knight-slash 0.45s ease-in-out; }
@keyframes boss-struck {
  0%, 100% { filter: brightness(1); transform: translateX(0); }
  30% { filter: brightness(1.7); transform: translateX(6px) rotate(1deg); }
  65% { filter: brightness(1.15); transform: translateX(-4px) rotate(-1deg); }
}
.boss-struck { animation: boss-struck 0.5s ease-in-out; }

/* Crimson vignette when the boss is below its enrage threshold */
@keyframes boss-vignette-pulse {
  0%, 100% { box-shadow: inset 0 0 55px rgba(239, 68, 68, 0.28), 0 0 22px rgba(239, 68, 68, 0.2); }
  50% { box-shadow: inset 0 0 110px rgba(239, 68, 68, 0.6), 0 0 40px rgba(239, 68, 68, 0.4); }
}
.boss-crimson-vignette {
  animation: boss-vignette-pulse 1.4s ease-in-out infinite;
}

/* Roar screen shake lasts the full 3-second roar window */
@keyframes boss-screen-shake-1 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  10%, 30%, 50%, 70%, 90% { transform: translate(-3px, 2px) rotate(-0.25deg); }
  20%, 40%, 60%, 80% { transform: translate(3px, -2px) rotate(0.25deg); }
}
@keyframes boss-screen-shake-2 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  10%, 30%, 50%, 70%, 90% { transform: translate(-6px, 3px) rotate(-0.5deg); }
  20%, 40%, 60%, 80% { transform: translate(6px, -3px) rotate(0.5deg); }
}
@keyframes boss-screen-shake-3 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  10%, 30%, 50%, 70%, 90% { transform: translate(-10px, 4px) rotate(-0.8deg); }
  20%, 40%, 60%, 80% { transform: translate(10px, -4px) rotate(0.8deg); }
}
.boss-screen-shake-1 { animation: boss-screen-shake-1 3s ease-in-out; }
.boss-screen-shake-2 { animation: boss-screen-shake-2 3s ease-in-out; }
.boss-screen-shake-3 { animation: boss-screen-shake-3 3s ease-in-out; }

/* Class gets struck: red flash fading back to normal plus a short recoil shake */
@keyframes boss-hit-shake {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  15% { transform: translate(-11px, 4px) rotate(-0.75deg); }
  30% { transform: translate(10px, -4px) rotate(0.75deg); }
  45% { transform: translate(-8px, 3px) rotate(-0.5deg); }
  60% { transform: translate(7px, -3px) rotate(0.5deg); }
  80% { transform: translate(-3px, 1px) rotate(-0.2deg); }
}
.boss-class-hit {
  animation: boss-damage-flash 0.9s ease-out forwards, boss-hit-shake 0.55s ease-in-out;
}

/* The Big Freeze */
@keyframes frozen-chatter {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  20% { transform: translate(-3px, 1.5px) rotate(-0.35deg); }
  40% { transform: translate(3px, -1.5px) rotate(0.35deg); }
  60% { transform: translate(-1.5px, -1.5px) rotate(-0.2deg); }
  80% { transform: translate(1.5px, 1.5px) rotate(0.2deg); }
}
.frozen-screen {
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.4) 0px, rgba(255, 255, 255, 0.4) 1.5px, transparent 3px),
    radial-gradient(circle at 78% 22%, rgba(165, 243, 252, 0.35) 0px, rgba(165, 243, 252, 0.35) 2.5px, transparent 4.5px),
    radial-gradient(circle at 45% 68%, rgba(255, 255, 255, 0.3) 0px, rgba(255, 255, 255, 0.3) 1.5px, transparent 3px),
    radial-gradient(circle at 85% 72%, rgba(165, 243, 252, 0.3) 0px, rgba(165, 243, 252, 0.3) 2px, transparent 4px),
    radial-gradient(circle at 30% 42%, rgba(255, 255, 255, 0.22) 0px, rgba(255, 255, 255, 0.22) 1.5px, transparent 3px),
    linear-gradient(160deg, rgba(8, 145, 178, 0.88), rgba(2, 6, 23, 0.96));
  -webkit-backdrop-filter: blur(12px) saturate(150%) contrast(1.08) brightness(0.88);
  backdrop-filter: blur(12px) saturate(150%) contrast(1.08) brightness(0.88);
  border: 2px solid rgba(6, 182, 212, 0.75);
  box-shadow: 0 0 55px rgba(6, 182, 212, 0.6), inset 0 0 120px rgba(6, 182, 212, 0.5), inset 0 0 35px rgba(255, 255, 255, 0.15);
  animation: frozen-chatter 0.12s linear infinite;
}
@keyframes snow-fall {
  0% { transform: translateY(-20%) rotate(0deg); opacity: 0; }
  20% { opacity: 0.9; }
  100% { transform: translateY(720px) rotate(320deg); opacity: 0; }
}
.snowflake {
  position: absolute;
  top: -24px;
  color: #a5f3fc;
  font-size: 18px;
  animation: snow-fall linear infinite;
  pointer-events: none;
}

@keyframes thaw-shiver {
  0%, 100% { transform: translateX(-4px) rotate(-0.6deg); }
  25% { transform: translateX(4px) rotate(0.6deg); }
  50% { transform: translateX(-3px) rotate(-0.5deg); }
  75% { transform: translateX(3px) rotate(0.5deg); }
}
.thaw-shiver {
  animation: thaw-shiver 0.22s linear infinite;
  will-change: transform;
}

/* Floating arcade toast (overdrive / boss damage) */
#arcade-toast {
  opacity: 0;
  transform: translate(-50%, 14px) scale(0.94);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}
#arcade-toast.arcade-toast--show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.student-view body > header,
.student-view body > footer { display: none !important; }
.student-view body > main { padding-top: 1.5rem; }

/* Treehouse Stacker */
#treehouse-build-countdown-fill { transition: width 100ms linear; }
#treehouse-showcase-gallery { scrollbar-width: thin; scrollbar-color: #10b981 #1e293b; }
#treehouse-showcase-gallery::-webkit-scrollbar { height: 8px; }
#treehouse-showcase-gallery::-webkit-scrollbar-track { background: #1e293b; }
#treehouse-showcase-gallery::-webkit-scrollbar-thumb { background: #10b981; border-radius: 4px; }
