/* ======================================
   CodeKids — Custom Styles & Animations
   ====================================== */

/* ---- Fonts & Base ---- */
* { box-sizing: border-box; }
body { font-family: 'Nunito', sans-serif; }

/* ---- Keyframe Animations ---- */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-18px); }
}
@keyframes bounceDot {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes scaleIn {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0);    }
}
@keyframes wiggle {
  0%, 100% { transform: rotate(-4deg); }
  50%      { transform: rotate(4deg); }
}
@keyframes starBurst {
  0%   { transform: scale(0) rotate(0deg);   opacity: 1; }
  80%  { transform: scale(1.4) rotate(360deg); opacity: 1; }
  100% { transform: scale(1) rotate(360deg);  opacity: 1; }
}
@keyframes confettiFall {
  0%   { transform: translateY(-20px) rotate(0deg);   opacity: 1; }
  100% { transform: translateY(120px) rotate(720deg); opacity: 0; }
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.4); }
  50%      { box-shadow: 0 0 0 12px rgba(124, 58, 237, 0); }
}
@keyframes progressFill {
  from { width: 0%; }
}
@keyframes pathGlow {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

/* ---- Animation Classes ---- */
.float-anim       { animation: float 3s ease-in-out infinite; }
.bounce-dot       { animation: bounceDot 1.4s ease-in-out infinite; }
.slide-up         { animation: slideUp 0.4s ease-out; }
.scale-in         { animation: scaleIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.fade-in          { animation: fadeIn 0.5s ease-out; }
.wiggle           { animation: wiggle 0.6s ease-in-out; }
.star-burst       { animation: starBurst 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.pulse-glow       { animation: pulseGlow 2s ease-in-out infinite; }

/* ---- Buttons ---- */
.btn-primary {
  background: linear-gradient(135deg, #7C3AED, #4F46E5);
  color: white;
  font-weight: 800;
  border-radius: 16px;
  padding: 12px 28px;
  border: none;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.btn-primary:hover  { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(124,58,237,0.45); filter: brightness(1.05); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: white;
  color: #7C3AED;
  font-weight: 800;
  border-radius: 16px;
  padding: 12px 28px;
  border: 2px solid #7C3AED;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  transition: transform 0.15s, background 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.btn-secondary:hover { background: #f5f3ff; transform: translateY(-2px); }

.btn-green {
  background: linear-gradient(135deg, #22C55E, #16A34A);
  color: white;
  font-weight: 800;
  border-radius: 16px;
  padding: 12px 28px;
  border: none;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.btn-green:hover  { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(34,197,94,0.4); }

.btn-orange {
  background: linear-gradient(135deg, #F97316, #EA580C);
  color: white;
  font-weight: 800;
  border-radius: 16px;
  padding: 10px 22px;
  border: none;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  transition: transform 0.15s;
  box-shadow: 0 4px 12px rgba(249,115,22,0.35);
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-orange:hover { transform: translateY(-2px); }

.btn-ghost {
  background: transparent;
  color: #6B7280;
  font-weight: 700;
  border-radius: 12px;
  padding: 10px 20px;
  border: 2px solid #E5E7EB;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-ghost:hover { border-color: #7C3AED; color: #7C3AED; background: #f5f3ff; }

/* ---- Cards ---- */
.card {
  background: white;
  border-radius: 24px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.07);
  padding: 24px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,0,0,0.1); }

.card-colorful {
  border-radius: 24px;
  padding: 24px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.card-colorful:hover { transform: translateY(-3px); }

/* ---- Form inputs ---- */
.form-input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid #E5E7EB;
  border-radius: 16px;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
  background: white;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus { border-color: #7C3AED; box-shadow: 0 0 0 3px rgba(124,58,237,0.12); }

/* ---- Avatar Grid ---- */
.avatar-option {
  width: 60px; height: 60px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 28px;
  border: 3px solid transparent;
  cursor: pointer; transition: all 0.2s;
  background: #f3f4f6;
}
.avatar-option:hover { transform: scale(1.15); background: #ede9fe; }
.avatar-option.selected {
  border-color: #7C3AED;
  background: #ede9fe;
  transform: scale(1.1);
  box-shadow: 0 0 0 4px rgba(124,58,237,0.2);
}

/* ---- Progress Bar ---- */
.progress-track {
  background: #E5E7EB;
  border-radius: 999px;
  overflow: hidden;
  height: 14px;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7C3AED, #A855F7);
  animation: progressFill 1s ease-out;
  transition: width 0.6s ease;
}

/* ---- Level Map Path ---- */
.level-path-line {
  position: absolute;
  left: 50%; top: 100%;
  width: 3px; height: 60px;
  background: repeating-linear-gradient(
    to bottom,
    #CBD5E1 0px, #CBD5E1 8px,
    transparent 8px, transparent 16px
  );
  transform: translateX(-50%);
  animation: pathGlow 2s ease-in-out infinite;
}

/* ---- Lesson Node (level map) ---- */
.lesson-node {
  width: 72px; height: 72px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative; z-index: 1;
  border: 4px solid white;
}
.lesson-node.unlocked:hover { transform: scale(1.15); }
.lesson-node.unlocked       { box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
.lesson-node.locked         { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.6); }
.lesson-node.completed      { box-shadow: 0 6px 20px rgba(34,197,94,0.4); }

/* ---- Code Editor ---- */
.code-editor-wrap {
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid #E5E7EB;
  background: #1e1e2e;
  font-family: 'Courier New', 'Consolas', monospace;
}
.code-editor-header {
  background: #181825;
  padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.editor-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.editor-textarea {
  width: 100%;
  min-height: 200px;
  padding: 16px;
  background: #1e1e2e;
  color: #cdd6f4;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  line-height: 1.7;
  border: none;
  outline: none;
  resize: vertical;
  tab-size: 4;
}
.output-panel {
  background: #181825;
  color: #a6e3a1;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  padding: 16px;
  min-height: 80px;
  border-radius: 0 0 14px 14px;
  white-space: pre-wrap;
  word-break: break-word;
}
.output-error { color: #f38ba8; }

/* ---- Quiz Styles ---- */
.quiz-option {
  padding: 14px 20px;
  border: 2px solid #E5E7EB;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.2s;
  background: white;
  text-align: left;
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  font-family: 'Nunito', sans-serif;
}
.quiz-option:hover:not(:disabled) { border-color: #7C3AED; background: #f5f3ff; transform: translateX(4px); }
.quiz-option.correct  { border-color: #22C55E; background: #f0fdf4; color: #166534; }
.quiz-option.wrong    { border-color: #EF4444; background: #fef2f2; color: #991B1B; }
.quiz-option.correct::after { content: ' ✅'; margin-left: auto; }
.quiz-option.wrong::after   { content: ' ❌'; margin-left: auto; }

/* ---- Tabs ---- */
.tab-btn {
  padding: 10px 20px;
  border-radius: 12px 12px 0 0;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  background: transparent;
  color: #9CA3AF;
  font-family: 'Nunito', sans-serif;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
}
.tab-btn.active { color: #7C3AED; border-bottom-color: #7C3AED; background: white; }
.tab-btn:hover:not(.active) { color: #6D28D9; background: #f5f3ff; }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.3s ease-out; }

/* ---- Badge ---- */
.badge-card {
  background: white;
  border-radius: 20px;
  padding: 16px;
  text-align: center;
  border: 2px solid #E5E7EB;
  transition: transform 0.2s;
}
.badge-card.earned {
  border-color: #A855F7;
  background: linear-gradient(135deg, #faf5ff, #f5f3ff);
  box-shadow: 0 4px 16px rgba(168,85,247,0.15);
}
.badge-card:hover { transform: translateY(-3px); }

/* ---- Streak Calendar ---- */
.streak-day {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700;
}
.streak-day.active   { background: #F97316; color: white; }
.streak-day.inactive { background: #F3F4F6; color: #9CA3AF; }

/* ---- Story bubble ---- */
.mascot-bubble {
  background: white;
  border: 3px solid #7C3AED;
  border-radius: 20px;
  padding: 20px 24px;
  position: relative;
  box-shadow: 0 8px 24px rgba(124,58,237,0.12);
}
.mascot-bubble::before {
  content: '';
  position: absolute;
  left: -14px; top: 20px;
  border: 8px solid transparent;
  border-right-color: #7C3AED;
}
.mascot-bubble::after {
  content: '';
  position: absolute;
  left: -10px; top: 22px;
  border: 6px solid transparent;
  border-right-color: white;
}

/* ---- Hero gradient ---- */
.hero-gradient {
  background: linear-gradient(135deg, #7C3AED 0%, #4F46E5 40%, #0EA5E9 100%);
}
.hero-gradient-2 {
  background: linear-gradient(135deg, #F97316 0%, #EF4444 100%);
}
.hero-gradient-3 {
  background: linear-gradient(135deg, #22C55E 0%, #06B6D4 100%);
}

/* ---- Stat Card ---- */
.stat-card {
  border-radius: 20px;
  padding: 20px;
  text-align: center;
  transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-3px); }

/* ---- Level colors ---- */
.level-beginner     { background: linear-gradient(135deg, #22C55E, #16A34A); }
.level-intermediate { background: linear-gradient(135deg, #F59E0B, #D97706); }
.level-advanced     { background: linear-gradient(135deg, #3B82F6, #1D4ED8); }
.level-expert       { background: linear-gradient(135deg, #EF4444, #B91C1C); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar       { width: 8px; }
::-webkit-scrollbar-track { background: #F3F4F6; }
::-webkit-scrollbar-thumb { background: #C4B5FD; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #7C3AED; }

/* ---- Misc helpers ---- */
.text-gradient {
  background: linear-gradient(135deg, #7C3AED, #06B6D4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.glass {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.3);
}
.shadow-colorful { box-shadow: 0 8px 32px rgba(124,58,237,0.2); }

/* ---- XP Bar fill animation ---- */
.xp-fill { animation: progressFill 1.2s ease-out; }

/* ---- Confetti piece ---- */
.confetti-piece {
  position: fixed; top: -20px;
  width: 10px; height: 10px;
  border-radius: 2px;
  pointer-events: none;
  animation: confettiFall 1.5s ease-in forwards;
  z-index: 999;
}

/* ---- Lesson complete overlay ---- */
.lesson-complete-banner {
  border-radius: 20px;
  background: linear-gradient(135deg, #22C55E, #16A34A);
  color: white;
  padding: 24px;
  text-align: center;
  animation: scaleIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ---- Mobile adjustments ---- */
@media (max-width: 640px) {
  .lesson-node { width: 56px; height: 56px; font-size: 22px; }
  .card { padding: 16px; }
  .btn-primary, .btn-secondary { padding: 10px 20px; }
}

/* ---- Pyodide loading indicator ---- */
.python-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.8rem; font-weight: 700;
  padding: 4px 12px; border-radius: 999px;
}
.python-status.loading  { background: #FEF3C7; color: #92400E; }
.python-status.ready    { background: #DCFCE7; color: #14532D; }
.python-status.error    { background: #FEE2E2; color: #7F1D1D; }

/* ---- Dashboard streak row ---- */
.streak-badge {
  background: linear-gradient(135deg, #F97316, #EF4444);
  color: white;
  border-radius: 16px;
  padding: 12px 20px;
  display: flex; align-items: center; gap: 8px;
  font-weight: 800;
}

/* =====================================================
   PREMIUM / PRICING / CERTIFICATE STYLES
   ===================================================== */

/* ---- Premium lock overlay ---- */
.premium-lock-overlay {
  position: relative;
  border-radius: 20px;
  background: rgba(124, 58, 237, 0.06);
  padding: 30px;
  margin-top: 12px;
  border: 2px dashed #C4B5FD;
}

.premium-lock-card {
  text-align: center;
  background: white;
  padding: 30px 20px;
  border-radius: 20px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.1);
}

/* ---- Plan badge ---- */
.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.plan-badge.free  { background: #F1F5F9; color: #475569; }
.plan-badge.pro   { background: linear-gradient(90deg, #A855F7, #6366F1); color: white; }
.plan-badge.elite { background: linear-gradient(90deg, #FB923C, #EF4444); color: white; }

/* ---- Form input ---- */
.form-input {
  padding: 12px 16px;
  border: 2px solid #E5E7EB;
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.2s;
  background: white;
}
.form-input:focus {
  outline: none;
  border-color: #7C3AED;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

/* ---- Certificate card ---- */
.certificate-card {
  position: relative;
  font-family: 'Nunito', sans-serif;
  min-height: 600px;
  background-clip: padding-box;
  background-size: cover;
}

.certificate-card::before {
  content: '';
  position: absolute;
  inset: 12px;
  border: 2px solid currentColor;
  opacity: 0.2;
  border-radius: 20px;
  pointer-events: none;
}

/* ---- Print media query for certificates ---- */
@media print {
  body { background: white !important; }
  #navbar, #toast, #badge-modal, #cert-modal, #loading-screen,
  .print\:hidden { display: none !important; }
  .pt-20 { padding-top: 0 !important; }
  .pb-16 { padding-bottom: 0 !important; }
  .certificate-card {
    box-shadow: none !important;
    margin: 0 !important;
    page-break-inside: avoid;
  }
}

/* ---- Pricing card popular ribbon ---- */
.popular-ribbon {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: #FBBF24;
  color: #78350F;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ---- Project difficulty pills ---- */
.diff-easy   { background: #DCFCE7; color: #14532D; }
.diff-medium { background: #FEF3C7; color: #78350F; }
.diff-hard   { background: #FEE2E2; color: #7F1D1D; }

/* ---- Subtle pulse for upgrade CTA ---- */
@keyframes upgradePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 146, 60, 0.5); }
  50%      { box-shadow: 0 0 0 8px rgba(251, 146, 60, 0); }
}
.upgrade-cta {
  animation: upgradePulse 1.6s ease-in-out infinite;
}

/* =====================================================
   ANIMATED LESSON PLAYER  –  Cinematic Animation System
   ===================================================== */

/* ----- 1. Scene Background Themes ----- */
.scene-classroom  { background: linear-gradient(135deg, #FFA726 0%, #FFB74D 50%, #FFCC80 100%); }
.scene-space      { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%); }
.scene-jungle     { background: linear-gradient(135deg, #2d6a4f 0%, #40916c 50%, #52b788 100%); }
.scene-underwater { background: linear-gradient(135deg, #023e8a 0%, #0077b6 50%, #00b4d8 100%); }
.scene-playground { background: linear-gradient(135deg, #f72585 0%, #7209b7 50%, #3a0ca3 100%); }
.scene-lab        { background: linear-gradient(135deg, #2d3436 0%, #636e72 50%, #74b9ff 100%); }
.scene-castle     { background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 50%, #ffeaa7 100%); }
.scene-city       { background: linear-gradient(135deg, #2c3e50 0%, #3498db 50%, #87ceeb 100%); }

/* ----- 2a. Character Keyframes (original) ----- */
@keyframes charEntrance {
  from { opacity: 0; transform: translateY(30px) scale(0.6); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes charIdle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25%      { transform: translateY(-6px) rotate(-2deg); }
  75%      { transform: translateY(-3px) rotate(2deg); }
}
@keyframes charWave {
  0%, 100% { transform: rotate(0deg); }
  25%      { transform: rotate(15deg); }
  50%      { transform: rotate(-10deg); }
  75%      { transform: rotate(12deg); }
}
@keyframes charThink {
  0%, 100% { transform: translateX(0); }
  30%      { transform: translateX(-5px); }
  60%      { transform: translateX(5px); }
}
@keyframes charBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-18px) scale(1.08); }
}
@keyframes charCode {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); filter: brightness(1.2); }
}
@keyframes charCelebrate {
  0%       { transform: scale(1) rotate(0deg); }
  25%      { transform: scale(1.15) rotate(-8deg); }
  50%      { transform: scale(1.2) rotate(8deg); }
  75%      { transform: scale(1.1) rotate(-5deg); }
  100%     { transform: scale(1) rotate(0deg); }
}

/* ----- 2b. Character Keyframes (new) ----- */
@keyframes charSurprised {
  0%   { transform: translateY(0) scale(1); }
  30%  { transform: translateY(-22px) scale(1.18); }
  50%  { transform: translateY(-10px) scale(1.08); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes charTeach {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  25%      { transform: translateX(6px) rotate(3deg); }
  50%      { transform: translateX(0) rotate(0deg); }
  75%      { transform: translateX(-4px) rotate(-2deg); }
}
@keyframes charDance {
  0%, 100% { transform: translateX(0) rotate(0deg) scale(1); }
  20%      { transform: translateX(-10px) rotate(-6deg) scale(1.04); }
  40%      { transform: translateX(10px) rotate(6deg) scale(1.04); }
  60%      { transform: translateX(-8px) rotate(-4deg) scale(1.02); }
  80%      { transform: translateX(8px) rotate(4deg) scale(1.02); }
}
@keyframes charExit {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(80px) scale(0.6); }
}

/* ----- 2c. Bubble & Particle Keyframes ----- */
@keyframes bubblePop {
  0%   { opacity: 0; transform: scale(0.6) translateY(20px); }
  60%  { transform: scale(1.04) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes particleFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.35; }
  50%      { transform: translateY(-20px) rotate(15deg); opacity: 0.7; }
}

/* ----- 2d. Character Utility Classes ----- */
.char-entrance  { animation: charEntrance  0.5s ease-out; }
.char-idle      { animation: charIdle      3s   ease-in-out infinite; }
.char-wave      { animation: charWave      1s   ease-in-out 2; }
.char-think     { animation: charThink     2s   ease-in-out infinite; }
.char-bounce    { animation: charBounce    0.8s ease-in-out infinite; }
.char-code      { animation: charCode      1.5s ease-in-out infinite; }
.char-celebrate { animation: charCelebrate 0.8s ease-in-out 3; }
.char-surprised { animation: charSurprised 0.6s ease-out; }
.char-teach     { animation: charTeach     2.5s ease-in-out infinite; }
.char-dance     { animation: charDance     1.2s ease-in-out infinite; }
.char-exit      { animation: charExit      0.5s ease-in forwards; }

.bubble-pop { animation: bubblePop 0.45s ease-out; }

/* ----- 2e. Core Layout ----- */
.animated-lesson {
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
}

.lesson-stage {
  position: relative;
  min-height: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: background 0.7s ease;
  overflow: hidden;
}

.scene-particle {
  position: absolute;
  font-size: 1.4rem;
  opacity: 0.35;
  animation: particleFloat 4s ease-in-out infinite;
  pointer-events: none;
}

.step-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.3s;
}
.step-dot.active {
  background: #A855F7;
  border-color: #A855F7;
  transform: scale(1.5);
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.5);
}
.step-dot.done {
  background: #22C55E;
  border-color: #22C55E;
}

/* ----- 3. Scene Transition Keyframes ----- */
@keyframes sceneSlideIn {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes sceneSlideOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-100%); }
}
@keyframes sceneFadeSwitch {
  0%   { opacity: 1; }
  45%  { opacity: 0; }
  55%  { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes sceneZoomIn {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}

.scene-slide-in   { animation: sceneSlideIn   0.6s ease-out; }
.scene-slide-out  { animation: sceneSlideOut  0.5s ease-in forwards; }
.scene-fade-switch { animation: sceneFadeSwitch 0.8s ease-in-out; }
.scene-zoom-in    { animation: sceneZoomIn    0.5s ease-out; }

/* ----- 4. Code Visualization ----- */
@keyframes codeCursorBlink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}
@keyframes codeLineAppear {
  from { opacity: 0; transform: translateX(-18px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes codeLineGlow {
  0%, 100% { box-shadow: inset 0 0 0 rgba(168, 85, 247, 0); }
  50%      { box-shadow: inset 0 0 12px rgba(168, 85, 247, 0.35); }
}

.code-panel {
  background: #1e1e2e;
  border-radius: 14px;
  padding: 18px 20px;
  margin: 12px 16px;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.92rem;
  line-height: 1.7;
  color: #cdd6f4;
  overflow-x: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  position: relative;
  max-width: 100%;
}

.code-line {
  padding: 2px 8px;
  border-radius: 4px;
  animation: codeLineAppear 0.35s ease-out both;
  white-space: pre;
}
.code-line.active {
  background: rgba(168, 85, 247, 0.12);
  animation: codeLineAppear 0.35s ease-out both, codeLineGlow 1.8s ease-in-out infinite;
}
.code-line.typed {
  border-left: 3px solid #22C55E;
  padding-left: 10px;
}

.code-output {
  margin-top: 10px;
  padding: 10px 14px;
  background: #11111b;
  border-radius: 8px;
  color: #a6e3a1;
  font-size: 0.88rem;
  font-family: 'Fira Code', 'Courier New', monospace;
  border-left: 3px solid #22C55E;
}

.code-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: #f5c542;
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: codeCursorBlink 0.9s step-end infinite;
}

/* ----- 5. Interactive Quiz Panel ----- */
@keyframes optionCorrect {
  0%   { background: #22C55E; transform: scale(1); }
  40%  { transform: scale(1.08); }
  100% { background: #16a34a; transform: scale(1); box-shadow: 0 0 16px rgba(34, 197, 94, 0.4); }
}
@keyframes optionWrong {
  0%, 100% { transform: translateX(0); }
  15%      { transform: translateX(-8px); }
  30%      { transform: translateX(8px); }
  45%      { transform: translateX(-6px); }
  60%      { transform: translateX(6px); }
  75%      { transform: translateX(-3px); }
  90%      { transform: translateX(3px); }
}

.interact-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  border-radius: 16px;
  z-index: 10;
  animation: sceneZoomIn 0.4s ease-out;
}

.interact-question {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  max-width: 480px;
  line-height: 1.45;
}

.interact-option {
  min-width: 220px;
  min-height: 48px;
  padding: 12px 24px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, border-color 0.2s;
  text-align: center;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.interact-option:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: #fff;
  transform: scale(1.04);
}
.interact-option.correct {
  animation: optionCorrect 0.6s ease-out forwards;
  border-color: #22C55E;
  color: #fff;
}
.interact-option.wrong {
  animation: optionWrong 0.5s ease-out;
  background: rgba(239, 68, 68, 0.7);
  border-color: #EF4444;
}

/* ----- 6. Recap Panel ----- */
@keyframes recapSlideIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.recap-panel {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 18px;
  padding: 24px 28px;
  margin: 14px;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recap-point {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 1rem;
  color: #1e293b;
  line-height: 1.5;
  animation: recapSlideIn 0.45s ease-out both;
}
.recap-point:nth-child(1) { animation-delay: 0.1s; }
.recap-point:nth-child(2) { animation-delay: 0.25s; }
.recap-point:nth-child(3) { animation-delay: 0.4s; }
.recap-point:nth-child(4) { animation-delay: 0.55s; }
.recap-point:nth-child(5) { animation-delay: 0.7s; }

/* ----- 7. Reward / Celebration Overlay ----- */
@keyframes confettiDrop {
  0%   { opacity: 1; transform: translateY(-40px) rotate(0deg); }
  100% { opacity: 0; transform: translateY(340px) rotate(720deg); }
}
@keyframes starSparkle {
  0%, 100% { opacity: 0.6; transform: scale(0.8) rotate(0deg); }
  50%      { opacity: 1;   transform: scale(1.3) rotate(180deg); }
}
@keyframes rewardBounce {
  0%, 100% { transform: scale(1); }
  30%      { transform: scale(1.25); }
  50%      { transform: scale(0.95); }
  70%      { transform: scale(1.12); }
}

.reward-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 20;
  animation: sceneZoomIn 0.4s ease-out;
  pointer-events: none;
}
.reward-overlay > * { pointer-events: auto; }

.reward-stars {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.reward-stars span {
  position: absolute;
  font-size: 1.4rem;
  animation: starSparkle 1.6s ease-in-out infinite;
}

.reward-confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.reward-confetti span {
  position: absolute;
  top: -10px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  animation: confettiDrop 2.2s ease-in forwards;
}

.reward-text {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
  animation: rewardBounce 0.8s ease-out;
  z-index: 2;
}

/* ----- 8. Subtitle Bar ----- */
@keyframes keywordPop {
  0%   { transform: scale(1); color: inherit; }
  40%  { transform: scale(1.18); color: #facc15; }
  100% { transform: scale(1); color: #facc15; }
}

.subtitle-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 20px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  text-align: center;
  pointer-events: none;
  z-index: 8;
}

.subtitle-text {
  display: inline-block;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  line-height: 1.5;
  max-width: 560px;
}

.keyword-highlight {
  display: inline-block;
  animation: keywordPop 0.45s ease-out;
  color: #facc15;
  font-weight: 700;
}

/* ----- 9. Floating Scene Props ----- */
@keyframes propFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25%      { transform: translate(8px, -14px) rotate(8deg); }
  50%      { transform: translate(-6px, -22px) rotate(-6deg); }
  75%      { transform: translate(4px, -10px) rotate(4deg); }
}
@keyframes propBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-16px); }
}
@keyframes propSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.scene-prop {
  position: absolute;
  font-size: 1.8rem;
  opacity: 0.55;
  pointer-events: none;
  animation: propFloat 5s ease-in-out infinite;
}
.scene-prop.bounce { animation-name: propBounce; animation-duration: 2.4s; }
.scene-prop.spin   { animation-name: propSpin;   animation-duration: 4s; animation-timing-function: linear; }

/* ----- 10. Enhanced Progress Bar ----- */
.video-progress-track {
  position: relative;
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  overflow: visible;
  cursor: pointer;
}

.video-progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #f72585, #7209b7, #3a0ca3, #4361ee, #4cc9f0);
  background-size: 250% 100%;
  animation: progressShimmer 3s linear infinite;
  transition: width 0.25s ease;
  position: relative;
}
@keyframes progressShimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.video-chapter-mark {
  position: absolute;
  top: -2px;
  width: 4px;
  height: 12px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.5);
  transform: translateX(-50%);
  pointer-events: none;
}

/* ----- 11. Responsive Adjustments ----- */
@media (max-width: 640px) {
  .lesson-stage {
    min-height: 240px;
  }
  .lesson-stage .char-emoji,
  .lesson-stage [class*="char-"] {
    font-size: 3rem;
  }
  .code-panel {
    font-size: 0.8rem;
    padding: 12px 10px;
    margin: 8px 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .interact-question {
    font-size: 1.05rem;
  }
  .interact-option {
    min-width: 160px;
    min-height: 44px;
    font-size: 0.9rem;
    padding: 10px 16px;
  }
  .subtitle-text {
    font-size: 0.9rem;
    max-width: 90vw;
  }
  .recap-panel {
    padding: 16px 14px;
    margin: 8px;
  }
  .reward-text {
    font-size: 1.4rem;
  }
}

@media (max-width: 380px) {
  .lesson-stage {
    min-height: 200px;
  }
  .lesson-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .interact-option {
    min-width: 100%;
  }
}

/* =====================================================
   DONATION SECTION
   ===================================================== */
.donation-card {
  border-radius: 24px;
  padding: 32px;
  text-align: center;
  background: white;
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  transition: transform 0.2s, box-shadow 0.2s;
}
.donation-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}

.donation-tier {
  border: 2px solid #E5E7EB;
  border-radius: 20px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.25s;
  background: white;
}
.donation-tier:hover {
  border-color: #A855F7;
  background: #faf5ff;
  transform: translateY(-2px);
}
.donation-tier.selected {
  border-color: #7C3AED;
  background: linear-gradient(135deg, #faf5ff, #ede9fe);
  box-shadow: 0 4px 16px rgba(124,58,237,0.2);
}

.qr-code-container {
  background: white;
  border-radius: 20px;
  padding: 24px;
  display: inline-block;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  border: 3px solid #E5E7EB;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15%      { transform: scale(1.15); }
  30%      { transform: scale(1); }
  45%      { transform: scale(1.1); }
  60%      { transform: scale(1); }
}
.heartbeat { animation: heartbeat 2s ease-in-out infinite; }

/* =====================================================
   TESTIMONIALS
   ===================================================== */
.testimonial-card {
  background: white;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  border: 1px solid #F3F4F6;
  transition: transform 0.2s, box-shadow 0.2s;
}
.testimonial-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.1);
}

.testimonial-stars {
  color: #FBBF24;
  font-size: 0.9rem;
  letter-spacing: 2px;
}

/* =====================================================
   STATS COUNTER (animated)
   ===================================================== */
@keyframes countUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.stat-counter {
  animation: countUp 0.6s ease-out;
}

/* =====================================================
   LANDING PAGE EXTRAS
   ===================================================== */
.feature-icon-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.8rem;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border: 1px solid #E5E7EB;
}

.curriculum-badge {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 2px solid #86efac;
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  transition: transform 0.2s;
}
.curriculum-badge:hover { transform: translateY(-2px); }

/* =====================================================
   SOCIAL SHARE BUTTONS
   ===================================================== */
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 0.85rem;
  font-family: 'Nunito', sans-serif;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  color: white;
}
.share-btn:hover { transform: translateY(-2px); filter: brightness(1.1); }

.share-facebook  { background: #1877F2; }
.share-linkedin  { background: #0A66C2; }
.share-instagram { background: linear-gradient(135deg, #F58529, #DD2A7B, #8134AF); }
.share-whatsapp  { background: #25D366; color: white; }
.share-twitter   { background: #1DA1F2; }
.share-copy      { background: #6B7280; }

/* =====================================================
   MOBILE TWEAKS FOR NEW COMPONENTS
   ===================================================== */
@media (max-width: 640px) {
  .video-stage { min-height: 260px; }
  .video-character { font-size: 3.5rem; }
  .video-speech-bubble { max-width: 240px; padding: 12px 16px; font-size: 0.9rem; }
  .donation-card { padding: 20px; }
  .testimonial-card { padding: 16px; }
  .feature-icon-ring { width: 56px; height: 56px; font-size: 1.5rem; }
}

