/* ============================================================
   KAIJU CORSIVO — Stili Principali
   Compatibile con Cloudflare Pages (HTML statico puro)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Patrick+Hand&display=swap');

:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --amber: #f59e0b;
  --amber-dark: #d97706;
  --emerald: #10b981;
  --rose: #f43f5e;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-400: #94a3b8;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --white: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Nunito', sans-serif;
  background: #0f172a;
  color: #f8fafc;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #1e293b; }
::-webkit-scrollbar-thumb { background: #4f46e5; border-radius: 3px; }

/* ===================== SCREENS ===================== */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* ===================== SPLASH SCREEN ===================== */
#screen-splash {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 40%, #0f172a 100%);
  align-items: center;
  justify-content: flex-start;
  padding: 20px;
}

.splash-header {
  text-align: center;
  padding: 30px 20px 20px;
  width: 100%;
}

.splash-logo {
  font-size: 4rem;
  margin-bottom: 10px;
  animation: bounce 2s infinite;
}

.splash-title {
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 900;
  color: #f8fafc;
  text-transform: uppercase;
  letter-spacing: -1px;
  line-height: 1.1;
}

.splash-title span {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.splash-subtitle {
  font-size: 0.85rem;
  color: #94a3b8;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 8px;
}

/* Hero Cards Grid — layout 4+1 */
.heroes-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

/* Riga 1: i 3 bimbi (Elia, Auri, Dome) — span 2 colonne ciascuno */
.heroes-grid .hero-card:nth-child(1),
.heroes-grid .hero-card:nth-child(2),
.heroes-grid .hero-card:nth-child(3) { grid-column: span 2; }

/* Riga 2: Papà + Fatina centrati e affiancati */
.heroes-grid .hero-card:nth-child(4) { grid-column: 2 / span 2; }
.heroes-grid .hero-card:nth-child(5) { grid-column: 4 / span 2; }

.hero-card {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.hero-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255,255,255,0.2);
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.hero-card.selected {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.3), 0 20px 40px rgba(0,0,0,0.4);
  transform: translateY(-4px);
}

.hero-card.selected::before {
  content: '✓';
  position: absolute;
  top: 10px;
  right: 10px;
  background: #f59e0b;
  color: #0f172a;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 22px;
}

.hero-avatar {
  font-size: 3.5rem;
  margin-bottom: 8px;
  display: block;
  line-height: 1;
}

.hero-name {
  font-size: 0.85rem;
  font-weight: 900;
  color: #f8fafc;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.hero-desc {
  font-size: 0.7rem;
  color: #64748b;
  font-style: italic;
  line-height: 1.4;
  margin-bottom: 10px;
}

.hero-weapon {
  font-size: 0.65rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 3px 8px;
  color: #fbbf24;
  display: inline-block;
  margin-bottom: 10px;
}

.hero-stats {
  background: rgba(0,0,0,0.4);
  border-radius: 12px;
  padding: 8px;
  border: 1px solid rgba(255,255,255,0.05);
}

.hero-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 0;
}

.hero-stat-row .label { color: #94a3b8; }
.hero-stat-row .value { color: #fbbf24; }
.hero-stat-row .value.green { color: #34d399; }
.hero-stat-row .value.rose { color: #fb7185; }

/* Enter Button */
.btn-enter {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #0f172a;
  font-size: 1.2rem;
  font-weight: 900;
  padding: 18px 48px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 10px 30px rgba(245,158,11,0.4);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px auto;
  position: relative;
}

.btn-enter:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(245,158,11,0.5);
}

.btn-enter:active { transform: translateY(0); }

.btn-enter-badge {
  position: absolute;
  bottom: -10px;
  right: -10px;
  background: #4f46e5;
  color: white;
  font-size: 0.6rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 2px solid white;
}

/* ===================== HEADER ===================== */
#app-header {
  background: rgba(255,255,255,0.03);
  border-bottom: 2px solid rgba(255,255,255,0.08);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.header-logo-icon {
  width: 44px;
  height: 44px;
  background: #4f46e5;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 900;
  box-shadow: 0 4px 12px rgba(79,70,229,0.4);
  animation: pulse-scale 3s infinite;
}

.header-title {
  font-size: 1rem;
  font-weight: 900;
  color: #f8fafc;
  text-transform: uppercase;
  letter-spacing: -0.5px;
}

.header-badge {
  background: #f59e0b;
  color: #0f172a;
  font-size: 0.6rem;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  margin-left: 6px;
}

.header-subtitle {
  font-size: 0.65rem;
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-sm {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-sm:active { transform: scale(0.95); }
.btn-sm.primary { background: rgba(79,70,229,0.2); color: #818cf8; border: 1px solid rgba(79,70,229,0.3); }
.btn-sm.primary:hover { background: rgba(79,70,229,0.3); }
.btn-sm.danger { background: rgba(244,63,94,0.1); color: #fb7185; border: 1px solid rgba(244,63,94,0.2); }
.btn-sm.danger:hover { background: rgba(244,63,94,0.2); }

/* ===================== DASHBOARD ===================== */
#screen-dashboard {
  background: #0f172a;
}

.dashboard-content {
  flex: 1;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Stats Bar */
.stats-bar {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 900;
  color: #fbbf24;
  line-height: 1;
}

.stat-label {
  font-size: 0.6rem;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-divider {
  width: 1px;
  height: 40px;
  background: rgba(255,255,255,0.08);
}

.player-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(79,70,229,0.15);
  border: 1px solid rgba(79,70,229,0.3);
  border-radius: 16px;
  padding: 8px 16px;
  margin-left: auto;
}

.player-badge-avatar { font-size: 1.8rem; }
.player-badge-name { font-size: 0.8rem; font-weight: 900; color: #a5b4fc; text-transform: uppercase; }
.player-badge-level { font-size: 0.65rem; color: #64748b; font-weight: 700; }

/* Section Title */
.section-title {
  font-size: 1rem;
  font-weight: 900;
  color: #f8fafc;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.08);
}

/* Lessons Grid */
.lessons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.lesson-card {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 2px solid rgba(255,255,255,0.06);
  border-radius: 20px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.lesson-card:hover {
  transform: translateY(-4px);
  border-color: rgba(79,70,229,0.4);
  box-shadow: 0 15px 30px rgba(0,0,0,0.4);
}

.lesson-card.completed {
  border-color: rgba(16,185,129,0.4);
  background: linear-gradient(135deg, #0d2b1f, #0f172a);
}

.lesson-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.lesson-card.locked:hover { transform: none; }

.lesson-icon { font-size: 2.5rem; margin-bottom: 10px; display: block; }

.lesson-title {
  font-size: 0.85rem;
  font-weight: 900;
  color: #f8fafc;
  margin-bottom: 6px;
  line-height: 1.3;
}

.lesson-desc {
  font-size: 0.7rem;
  color: #64748b;
  line-height: 1.5;
  margin-bottom: 12px;
}

.lesson-difficulty {
  font-size: 0.6rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 20px;
  display: inline-block;
}

.difficulty-facile { background: rgba(16,185,129,0.2); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.difficulty-medio { background: rgba(245,158,11,0.2); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.difficulty-esperto { background: rgba(244,63,94,0.2); color: #fb7185; border: 1px solid rgba(244,63,94,0.3); }

.lesson-completed-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #10b981;
  color: white;
  font-size: 0.65rem;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
}

/* Progress Bar */
.progress-bar-container {
  background: rgba(255,255,255,0.05);
  border-radius: 20px;
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #818cf8);
  border-radius: 20px;
  transition: width 0.5s ease;
}

/* ===================== STORY SESSION ===================== */
#screen-story {
  background: #0f172a;
}

.story-content {
  flex: 1;
  padding: 20px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

/* Phase Indicator */
.phase-indicator {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  justify-content: center;
}

.phase-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  transition: all 0.3s ease;
}

.phase-dot.active { background: #4f46e5; transform: scale(1.3); }
.phase-dot.done { background: #10b981; }

/* Story Illustration */
.story-illustration {
  border-radius: 24px;
  overflow: hidden;
  margin-bottom: 20px;
  min-height: 200px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  border: 3px solid rgba(255,255,255,0.1);
}

.scene-chars {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 24px;
  flex: 1;
  padding: 10px 0;
}

.scene-char {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  animation: bounce 2s infinite;
}

.scene-char:nth-child(2) { animation-delay: 0.3s; }
.scene-char:nth-child(3) { animation-delay: 0.6s; }

.scene-char-emoji { font-size: 3.5rem; line-height: 1; }

.scene-char-label {
  font-size: 0.65rem;
  font-weight: 900;
  background: rgba(0,0,0,0.6);
  color: white;
  padding: 3px 8px;
  border-radius: 20px;
  text-align: center;
  white-space: nowrap;
}

.scene-caption {
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
  color: rgba(255,255,255,0.8);
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* Story Text */
.story-text-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 20px;
}

.story-text {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  line-height: 1.8;
  color: #e2e8f0;
  font-weight: 600;
}

.story-narrator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.narrator-icon { font-size: 1.5rem; }
.narrator-label { font-size: 0.65rem; font-weight: 900; color: #64748b; text-transform: uppercase; letter-spacing: 1px; }

/* Tracing Word */
.tracing-word-card {
  background: rgba(79,70,229,0.1);
  border: 1px solid rgba(79,70,229,0.3);
  border-radius: 16px;
  padding: 12px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.tracing-word-label { font-size: 0.65rem; font-weight: 900; color: #818cf8; text-transform: uppercase; letter-spacing: 1px; }
.tracing-word-value { font-size: 1.8rem; font-weight: 900; color: #fbbf24; font-family: 'Patrick Hand', cursive; text-decoration: underline wavy #10b981; }

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: white;
  font-size: 0.9rem;
  font-weight: 900;
  padding: 14px 32px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(79,70,229,0.4); }
.btn-primary:active { transform: translateY(0); }

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  font-size: 0.9rem;
  font-weight: 900;
  padding: 14px 32px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-success:hover { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(16,185,129,0.4); }

.btn-amber {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #0f172a;
  font-size: 1rem;
  font-weight: 900;
  padding: 16px 40px;
  border-radius: 18px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 8px 25px rgba(245,158,11,0.3);
}

.btn-amber:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(245,158,11,0.5); }

.btn-ghost {
  background: rgba(255,255,255,0.05);
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-ghost:hover { background: rgba(255,255,255,0.1); color: #f8fafc; }

.btn-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 16px;
}

/* ===================== CURSIVE CANVAS ===================== */
.canvas-container {
  background: white;
  border-radius: 24px;
  padding: 20px;
  border: 4px solid #e2e8f0;
  margin-bottom: 20px;
}

.canvas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.canvas-title {
  font-size: 1rem;
  font-weight: 900;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.canvas-word { font-size: 1.6rem; font-family: 'Patrick Hand', cursive; color: #4f46e5; text-decoration: underline wavy #10b981; }

.color-picker {
  display: flex;
  gap: 6px;
  background: #f1f5f9;
  padding: 6px;
  border-radius: 12px;
}

.color-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.color-btn.active { border-color: #1e293b; transform: scale(1.2); }

.size-picker {
  display: flex;
  gap: 4px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
}

.size-btn {
  padding: 4px 10px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 700;
  background: transparent;
  color: #64748b;
  transition: all 0.2s ease;
}

.size-btn.active { background: #4f46e5; color: white; }

.drawing-canvas {
  width: 100%;
  height: 280px;
  border: 3px dashed #c7d2fe;
  border-radius: 16px;
  background: #f8faff;
  cursor: crosshair;
  touch-action: none;
  display: block;
}

.canvas-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.canvas-score {
  background: #10b981;
  color: white;
  font-size: 0.75rem;
  font-weight: 900;
  padding: 6px 14px;
  border-radius: 20px;
  display: none;
  align-items: center;
  gap: 6px;
  animation: bounce 1s;
}

.canvas-score.visible { display: flex; }

/* ===================== QUIZ ===================== */
.quiz-container {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  padding: 24px;
  margin-bottom: 20px;
}

.quiz-speaker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.quiz-speaker-emoji { font-size: 3rem; animation: bounce 2s infinite; }

.quiz-speaker-bubble {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 12px 16px;
  flex: 1;
}

.quiz-speaker-name { font-size: 0.65rem; font-weight: 900; color: #64748b; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.quiz-question { font-size: 1rem; font-weight: 700; color: #f8fafc; line-height: 1.5; }

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.quiz-option {
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 14px 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  font-weight: 700;
  color: #e2e8f0;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
}

.quiz-option:hover { background: rgba(79,70,229,0.15); border-color: rgba(79,70,229,0.4); }
.quiz-option.selected { background: rgba(79,70,229,0.2); border-color: #4f46e5; }
.quiz-option.correct { background: rgba(16,185,129,0.2); border-color: #10b981; color: #34d399; }
.quiz-option.wrong { background: rgba(244,63,94,0.15); border-color: #f43f5e; color: #fb7185; }

.quiz-option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 900;
  flex-shrink: 0;
}

.quiz-feedback {
  background: rgba(16,185,129,0.15);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  display: none;
}

.quiz-feedback.visible { display: block; }
.quiz-feedback.wrong { background: rgba(244,63,94,0.1); border-color: rgba(244,63,94,0.3); }

.quiz-feedback-text { font-size: 0.9rem; font-weight: 700; color: #34d399; line-height: 1.5; }
.quiz-feedback.wrong .quiz-feedback-text { color: #fb7185; }

/* ===================== SUMMARY SCREEN ===================== */
.summary-container {
  text-align: center;
  padding: 40px 20px;
}

.summary-trophy { font-size: 5rem; margin-bottom: 16px; animation: bounce 1s infinite; }
.summary-title { font-size: 2rem; font-weight: 900; color: #fbbf24; margin-bottom: 8px; }
.summary-subtitle { font-size: 1rem; color: #94a3b8; margin-bottom: 32px; }

.summary-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.summary-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.summary-stat-value { font-size: 3rem; font-weight: 900; color: #fbbf24; }
.summary-stat-label { font-size: 0.7rem; font-weight: 900; color: #64748b; text-transform: uppercase; letter-spacing: 1px; }

.summary-badge {
  background: linear-gradient(135deg, rgba(16,185,129,0.2), rgba(5,150,105,0.2));
  border: 1px solid rgba(16,185,129,0.4);
  border-radius: 20px;
  padding: 20px;
  max-width: 400px;
  margin: 0 auto 32px;
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
}

.summary-badge-icon { font-size: 3rem; }
.summary-badge-title { font-size: 0.65rem; font-weight: 900; color: #34d399; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.summary-badge-name { font-size: 1.2rem; font-weight: 900; color: #f8fafc; }

/* Kong Speech Bubble */
.kong-speech {
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(244,63,94,0.3);
  border-radius: 20px;
  padding: 20px;
  max-width: 400px;
  margin: 0 auto 32px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  text-align: left;
  animation: pulse 3s infinite;
}

.kong-speech-emoji { font-size: 3rem; flex-shrink: 0; animation: bounce 2s infinite; }
.kong-speech-label { font-size: 0.65rem; font-weight: 900; color: #fb7185; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.kong-speech-text { font-size: 0.85rem; color: #e2e8f0; line-height: 1.6; }

/* ===================== GAME RUNNER ===================== */
#game-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#game-overlay.active { display: flex; }

.game-container {
  background: linear-gradient(135deg, #0f172a, #1e1b4b);
  border: 2px solid rgba(79,70,229,0.4);
  border-radius: 24px;
  padding: 24px;
  max-width: 560px;
  width: 100%;
  text-align: center;
}

.game-title { font-size: 1.2rem; font-weight: 900; color: #fbbf24; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.game-subtitle { font-size: 0.75rem; color: #64748b; margin-bottom: 16px; }

.game-canvas-wrapper {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.1);
  margin-bottom: 12px;
}

#game-canvas {
  display: block;
  width: 100%;
  background: linear-gradient(180deg, #1e3a5f 0%, #1e3a5f 60%, #2d4a1e 60%, #2d4a1e 100%);
}

.game-hud {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0,0,0,0.6);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 0.7rem;
  font-weight: 900;
  color: white;
}

.game-progress-bar {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
  margin: 0 10px;
}

.game-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #34d399);
  border-radius: 4px;
  transition: width 0.1s linear;
}

.game-state-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  border-radius: 14px;
}

.game-state-title { font-size: 1.5rem; font-weight: 900; color: #fbbf24; }
.game-state-subtitle { font-size: 0.8rem; color: #94a3b8; text-align: center; }

.lives-display { display: flex; gap: 6px; font-size: 1.2rem; }

.game-tip {
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 8px;
}

/* ===================== ANNOUNCEMENT BANNER ===================== */
#announcement-banner {
  background: linear-gradient(90deg, #059669, #0d9488);
  color: white;
  font-size: 0.85rem;
  font-weight: 900;
  padding: 12px 24px;
  text-align: center;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  animation: slide-down 0.3s ease;
}

#announcement-banner.visible { display: flex; }

/* ===================== FOOTER ===================== */
#app-footer {
  background: rgba(255,255,255,0.02);
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.7rem;
  color: #475569;
  font-weight: 700;
}

.footer-credit {
  background: rgba(79,70,229,0.1);
  border: 1px solid rgba(79,70,229,0.2);
  color: #818cf8;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 900;
}

.footer-credit a { color: #818cf8; text-decoration: none; }
.footer-credit a:hover { text-decoration: underline; }

/* ===================== ANIMATIONS ===================== */
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

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

@keyframes slide-down {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scale-in {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.animate-fade-in { animation: fade-in 0.4s ease; }
.animate-scale-in { animation: scale-in 0.3s ease; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 640px) {
  .heroes-grid { grid-template-columns: repeat(6, 1fr); gap: 8px; padding: 12px; }
  .hero-card { padding: 12px 8px; }
  .hero-avatar { font-size: 2.8rem; }
  .lessons-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stats-bar { gap: 12px; }
  .stat-divider { display: none; }
  .player-badge { margin-left: 0; }
  .summary-stats { gap: 20px; }
  .btn-enter { font-size: 1rem; padding: 14px 32px; }
}

@media (max-width: 400px) {
  .heroes-grid { grid-template-columns: repeat(6, 1fr); gap: 6px; }
  .lessons-grid { grid-template-columns: 1fr; }
}

/* ===================== CINEMA MODE ===================== */
.cinema-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 200;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.cinema-overlay.active { display: flex; }

.cinema-container {
  background: #0a0a1a;
  border: 2px solid rgba(245,158,11,0.3);
  border-radius: 24px;
  padding: 24px;
  max-width: 700px;
  width: 100%;
}

.cinema-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cinema-title { font-size: 1.1rem; font-weight: 900; color: #fbbf24; text-transform: uppercase; }
.cinema-progress { font-size: 0.7rem; color: #64748b; font-weight: 700; }

.cinema-illustration {
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
  min-height: 180px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  border: 2px solid rgba(255,255,255,0.08);
}

.cinema-text {
  font-size: 1rem;
  line-height: 1.7;
  color: #e2e8f0;
  font-weight: 600;
  margin-bottom: 16px;
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.06);
}

.cinema-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.cinema-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cinema-btn:hover { background: rgba(255,255,255,0.15); }
.cinema-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.cinema-play-btn {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #0f172a;
  font-size: 0.85rem;
  font-weight: 900;
  padding: 12px 28px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
}

.cinema-play-btn:hover { transform: scale(1.05); }
.cinema-play-btn.playing { background: linear-gradient(135deg, #f43f5e, #e11d48); color: white; }

/* ===================== VOICE CHECK ===================== */
.voice-check-card {
  background: rgba(79,70,229,0.08);
  border: 1px solid rgba(79,70,229,0.2);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  text-align: center;
}

.voice-btn {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: white;
  font-size: 0.85rem;
  font-weight: 900;
  padding: 12px 24px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto;
  transition: all 0.2s ease;
}

.voice-btn:hover { transform: scale(1.05); }
.voice-btn.listening { background: linear-gradient(135deg, #f43f5e, #e11d48); animation: pulse 1s infinite; }

/* Tooltip / Notification */
.notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 14px 20px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #f8fafc;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  z-index: 300;
  display: none;
  align-items: center;
  gap: 10px;
  max-width: 320px;
  animation: slide-up 0.3s ease;
}

.notification.visible { display: flex; }

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

/* Locked overlay for lessons */
.lesson-lock-icon {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 1.2rem;
  opacity: 0.5;
}

/* Reading phase navigation */
.slide-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.slide-counter {
  font-size: 0.7rem;
  font-weight: 900;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Speak button */
.speak-btn {
  background: rgba(79,70,229,0.15);
  border: 1px solid rgba(79,70,229,0.3);
  color: #818cf8;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.speak-btn:hover { background: rgba(79,70,229,0.25); }
.speak-btn.speaking { background: rgba(244,63,94,0.15); border-color: rgba(244,63,94,0.3); color: #fb7185; animation: pulse 1s infinite; }

/* Free write section */
.free-write-section {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 24px;
}

/* Dictionary section */
.dictionary-section {
  background: rgba(79,70,229,0.05);
  border: 1px solid rgba(79,70,229,0.15);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 24px;
}

.dict-input {
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(79,70,229,0.3);
  border-radius: 12px;
  padding: 10px 16px;
  color: #f8fafc;
  font-size: 1rem;
  font-weight: 700;
  font-family: 'Patrick Hand', cursive;
  width: 100%;
  margin-bottom: 12px;
  outline: none;
}

.dict-input:focus { border-color: #4f46e5; }

/* Story phase tabs */
.phase-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: rgba(255,255,255,0.03);
  border-radius: 14px;
  padding: 6px;
}

.phase-tab {
  flex: 1;
  padding: 8px 12px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: transparent;
  color: #64748b;
  transition: all 0.2s ease;
}

.phase-tab.active { background: #4f46e5; color: white; }
.phase-tab.done { color: #34d399; }
.phase-tab:disabled { cursor: not-allowed; }

/* ===================== NUOVI STILI v4.0 ===================== */

/* Avatar SVG */
.hero-avatar-svg {
  width: 80px;
  height: 80px;
  margin: 0 auto 10px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
}
.hero-avatar-svg svg { width: 100%; height: 100%; }

/* Hero card selected check */
.hero-selected-check {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #f59e0b;
  color: #000;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.75rem;
  z-index: 2;
}

.hero-relation {
  font-size: 0.62rem;
  color: #818cf8;
  font-weight: 700;
  margin-bottom: 6px;
  text-align: center;
}

/* Parole cliccabili */
.clickable-word {
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.15s;
  padding: 0 1px;
}
.clickable-word:hover {
  background: rgba(245,158,11,0.25);
  color: #fbbf24;
  text-decoration: underline dotted #fbbf24;
}

/* ===================== FILM OVERLAY ===================== */
#film-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.97);
  z-index: 2000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#film-overlay.active { display: flex; }

.film-header {
  width: 100%;
  max-width: 600px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

#film-title { font-size: 0.8rem; font-weight: 800; color: #fbbf24; flex: 1; }

#film-content {
  width: 100%;
  max-width: 600px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.film-scene {
  width: 100%;
  border-radius: 20px;
  padding: 30px 20px;
  text-align: center;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.film-chars { display: flex; gap: 30px; justify-content: center; flex-wrap: wrap; }
.film-char { display: flex; flex-direction: column; align-items: center; animation: bounce 1.5s infinite; }
.film-char:nth-child(2) { animation-delay: 0.3s; }
.film-char:nth-child(3) { animation-delay: 0.6s; }

.film-scene-text { font-size: 1rem; font-weight: 700; color: white; margin-top: 10px; }
.film-caption { font-size: 0.85rem; color: #fbbf24; font-weight: 900; }

.film-progress { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.film-dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,0.2); transition: all 0.3s; }
.film-dot.active { background: #fbbf24; transform: scale(1.3); }
.film-dot.done { background: #10b981; }

.film-controls {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  width: 100%;
  max-width: 600px;
  justify-content: center;
}

/* ===================== MISSING LETTERS ===================== */
#missing-letters-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 2000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#missing-letters-overlay.active { display: flex; }

.missing-letters-panel {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 2px solid rgba(139,92,246,0.5);
  border-radius: 24px;
  padding: 28px 24px;
  width: 100%;
  max-width: 520px;
  text-align: center;
}

.missing-letters-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: #fbbf24;
  margin-bottom: 4px;
}

.missing-letters-subtitle {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 20px;
}

.ml-hint {
  font-size: 0.9rem;
  color: #fbbf24;
  font-weight: 700;
  margin-bottom: 6px;
  background: rgba(245,158,11,0.1);
  border-radius: 10px;
  padding: 8px 14px;
}

.ml-instruction {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 20px;
}

.ml-word {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.ml-letter {
  font-size: 2.8rem;
  font-family: 'Patrick Hand', cursive;
  color: #f8fafc;
  font-weight: 700;
  width: 52px;
  text-align: center;
  line-height: 1;
}

.ml-letter-input {
  width: 52px;
  height: 64px;
  font-size: 2.2rem;
  font-family: 'Patrick Hand', cursive;
  text-align: center;
  background: rgba(255,255,255,0.06);
  border: 3px solid rgba(59,130,246,0.5);
  border-radius: 10px;
  color: #f8fafc;
  font-weight: 700;
  transition: all 0.2s;
  outline: none;
}
.ml-letter-input:focus { border-color: #fbbf24; background: rgba(245,158,11,0.1); }
.ml-letter-input.correct { border-color: #10b981; background: rgba(16,185,129,0.2); color: #34d399; }
.ml-letter-input.wrong { border-color: #ef4444; background: rgba(239,68,68,0.2); color: #f87171; animation: shake 0.3s; }

.ml-feedback { font-size: 0.9rem; font-weight: 800; min-height: 28px; margin-bottom: 8px; }

.ml-kaiju-reaction {
  font-size: 0.85rem;
  font-weight: 700;
  min-height: 36px;
  opacity: 0;
  transition: opacity 0.3s;
}
.ml-kaiju-reaction.visible { opacity: 1; }

.ml-godzilla-kiss {
  color: #34d399;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 10px;
  padding: 8px 14px;
  display: inline-block;
  font-size: 1rem;
}

.ml-kong-roar {
  color: #f87171;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 10px;
  padding: 8px 14px;
  display: inline-block;
  font-size: 1rem;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ===================== MAESTRI ===================== */
#maestri-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 2000;
  display: none;
  overflow-y: auto;
  padding: 16px;
}
#maestri-overlay.active { display: block; }

.maestri-panel {
  background: linear-gradient(135deg, #0f172a, #1e1b4b);
  border: 2px solid rgba(245,158,11,0.4);
  border-radius: 24px;
  max-width: 700px;
  margin: 0 auto;
  overflow: hidden;
}

.maestri-header-bar {
  background: linear-gradient(135deg, #1e1b4b, #0f172a);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.maestri-intro { text-align: center; padding: 20px 20px 10px; }
.maestri-title { font-size: 1.1rem; font-weight: 900; color: #fbbf24; margin-bottom: 4px; }
.maestri-subtitle { font-size: 0.75rem; color: #64748b; }

.maestri-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 16px;
}

.maestro-card {
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
}
.maestro-card:hover { border-color: #fbbf24; transform: translateY(-3px); box-shadow: 0 10px 30px rgba(245,158,11,0.2); }

.maestro-emoji { font-size: 3.5rem; margin-bottom: 10px; animation: bounce 2s infinite; }
.maestro-name { font-size: 0.95rem; font-weight: 900; color: #f8fafc; margin-bottom: 6px; }
.maestro-desc { font-size: 0.75rem; color: #64748b; margin-bottom: 14px; line-height: 1.4; }

.maestro-lessons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 8px;
}

.maestro-letter {
  width: 34px;
  height: 34px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Patrick Hand', cursive;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fbbf24;
  cursor: pointer;
  transition: all 0.2s;
}
.maestro-letter:hover { background: rgba(245,158,11,0.2); border-color: #fbbf24; transform: scale(1.15); }

.maestro-practice-area { padding: 0 16px 20px; }

.maestro-practice {
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(139,92,246,0.4);
  border-radius: 20px;
  padding: 20px;
  margin-top: 8px;
}

.maestro-practice-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

/* ===================== BIRTHDAYS ===================== */
#birthdays-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 2000;
  display: none;
  overflow-y: auto;
  padding: 16px;
}
#birthdays-overlay.active { display: block; }

.birthdays-panel {
  background: linear-gradient(135deg, #0f172a, #1e1b4b);
  border: 2px solid rgba(236,72,153,0.4);
  border-radius: 24px;
  max-width: 700px;
  margin: 0 auto;
  overflow: hidden;
}

.birthdays-header-bar {
  background: linear-gradient(135deg, #4a1a3a, #1e1b4b);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

#birthdays-content { padding: 0; }

.birthdays-header { text-align: center; padding: 20px 20px 10px; }
.birthdays-title { font-size: 1.1rem; font-weight: 900; color: #ec4899; margin-bottom: 4px; }
.birthdays-subtitle { font-size: 0.75rem; color: #64748b; }

.birthdays-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  padding: 16px;
}

.birthday-card {
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 16px;
  text-align: center;
  transition: all 0.3s;
}
.birthday-card:hover { transform: translateY(-3px); border-color: #ec4899; }
.birthday-card.birthday-today {
  border-color: #fbbf24;
  background: linear-gradient(135deg, rgba(245,158,11,0.1), rgba(30,27,75,0.8));
  animation: pulse 2s infinite;
}

.birthday-name { font-size: 0.8rem; font-weight: 900; color: #f8fafc; margin-bottom: 4px; }
.birthday-date { font-size: 0.7rem; color: #94a3b8; margin-bottom: 4px; }
.birthday-age { font-size: 0.72rem; color: #818cf8; font-weight: 700; margin-bottom: 8px; }

.birthday-countdown {
  font-size: 0.75rem;
  font-weight: 800;
  color: #fbbf24;
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 10px;
  padding: 5px 8px;
  margin-bottom: 4px;
}

.birthday-countdown.today {
  color: #ec4899;
  background: rgba(236,72,153,0.1);
  border-color: rgba(236,72,153,0.3);
  animation: bounce 1s infinite;
}

.birthday-relation { font-size: 0.62rem; color: #818cf8; font-weight: 700; }

/* ===================== CINEMA OVERLAY ===================== */
#cinema-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 2000;
  display: none;
  overflow-y: auto;
  padding: 16px;
}
#cinema-overlay.active { display: block; }

.cinema-panel {
  background: linear-gradient(135deg, #0f172a, #1e1b4b);
  border: 2px solid rgba(59,130,246,0.4);
  border-radius: 24px;
  max-width: 700px;
  margin: 0 auto;
  overflow: hidden;
}

.cinema-header-bar {
  background: linear-gradient(135deg, #1e3a5f, #0f172a);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.cinema-lesson-card {
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.cinema-lesson-card:hover { border-color: #3b82f6; transform: translateY(-2px); }

/* ===================== FREE WRITE OVERLAY ===================== */
#free-write-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 2000;
  display: none;
  overflow-y: auto;
  padding: 16px;
}
#free-write-overlay.active { display: block; }

.free-write-panel {
  background: linear-gradient(135deg, #0f172a, #0d2d1e);
  border: 2px solid rgba(16,185,129,0.4);
  border-radius: 24px;
  max-width: 700px;
  margin: 0 auto;
  overflow: hidden;
}

.free-write-header-bar {
  background: linear-gradient(135deg, #0d2d1e, #0f172a);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* ===================== OVERLAY CLOSE BUTTON ===================== */
.overlay-close-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 7px 14px;
  color: #94a3b8;
  font-family: 'Nunito', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.overlay-close-btn:hover { background: rgba(244,63,94,0.15); color: #fb7185; }

/* ===================== FOOTER NAV ===================== */
#app-footer {
  background: rgba(255,255,255,0.02);
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 8px 4px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  position: sticky;
  bottom: 0;
  z-index: 100;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border: none;
  background: transparent;
  color: #64748b;
  font-family: 'Nunito', sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.2s;
  min-width: 48px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.nav-btn:hover, .nav-btn.active { color: #fbbf24; background: rgba(245,158,11,0.08); }
.nav-btn .nav-icon { font-size: 1.25rem; }

/* ===================== ANNOUNCEMENT BANNER v4 ===================== */
#announcement-banner {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(-30px);
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #000;
  font-weight: 900;
  font-size: 0.8rem;
  padding: 10px 22px;
  border-radius: 24px;
  box-shadow: 0 8px 30px rgba(245,158,11,0.5);
  z-index: 9999;
  opacity: 0;
  transition: all 0.4s;
  pointer-events: none;
  white-space: nowrap;
  max-width: 92vw;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}
#announcement-banner.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===================== GAME OVERLAY v4 ===================== */
#game-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 2000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#game-overlay.active { display: flex; }

.game-header {
  width: 100%;
  max-width: 600px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.game-title { font-size: 0.9rem; font-weight: 900; color: #fbbf24; }

.game-progress-bar {
  width: 100%;
  max-width: 600px;
  padding: 6px 16px;
  background: rgba(255,255,255,0.02);
}

.game-progress-track {
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
}

#game-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #fbbf24);
  border-radius: 4px;
  transition: width 0.3s;
  width: 0%;
}

.game-canvas-wrapper {
  width: 100%;
  max-width: 600px;
  position: relative;
}

#game-canvas {
  width: 100%;
  height: 200px;
  display: block;
}

#game-state-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  text-align: center;
}

.game-state-title { font-size: 1.4rem; font-weight: 900; color: #fbbf24; }
.game-state-subtitle { font-size: 0.8rem; color: #94a3b8; }
.lives-display { font-size: 1.5rem; }
.game-dist-label { font-size: 0.65rem; color: #64748b; font-weight: 700; text-align: right; padding: 2px 16px; }

/* ===================== BOUNCE-IN ANIMATION ===================== */
@keyframes bounceIn {
  0% { opacity: 0; transform: scale(0.3); }
  60% { transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}
.animate-bounce-in { animation: bounceIn 0.5s ease-out; }

/* ===================== RESPONSIVE v4 ===================== */
@media (max-width: 480px) {
  .heroes-grid { grid-template-columns: repeat(6, 1fr) !important; gap: 8px !important; }
  .birthdays-grid { grid-template-columns: repeat(2, 1fr); }
  .maestri-grid { grid-template-columns: 1fr; }
  .ml-letter, .ml-letter-input { width: 42px; height: 52px; font-size: 1.8rem; }
}
@media (max-width: 360px) {
  .birthdays-grid { grid-template-columns: 1fr; }
  .ml-letter, .ml-letter-input { width: 36px; height: 46px; font-size: 1.5rem; }
}

/* ===================== MUSICA OVERLAY ===================== */
#musica-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1100;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 20px 10px;
}
#musica-overlay.active { display: flex; }

.musica-panel {
  background: linear-gradient(135deg, #1e1b4b, #0f172a);
  border: 2px solid rgba(167,139,250,0.3);
  border-radius: 24px;
  width: 100%;
  max-width: 680px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}

.musica-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: rgba(167,139,250,0.1);
  border-bottom: 1px solid rgba(167,139,250,0.2);
}

.musica-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.musica-intro { text-align: center; }
.musica-title {
  font-size: 1.4rem;
  font-weight: 900;
  color: #a78bfa;
  margin-bottom: 6px;
}
.musica-subtitle {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-bottom: 6px;
}
.musica-keyboard-hint {
  font-size: 0.7rem;
  color: #64748b;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 4px 10px;
  display: inline-block;
}

/* Piano */
.piano-container {
  position: relative;
  background: linear-gradient(180deg, #1e293b, #0f172a);
  border-radius: 16px;
  padding: 16px;
  border: 2px solid rgba(255,255,255,0.08);
}

.piano-keys {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.piano-key {
  background: linear-gradient(180deg, #f8fafc, #e2e8f0);
  border: 2px solid rgba(0,0,0,0.2);
  border-radius: 0 0 12px 12px;
  width: 68px;
  min-height: 130px;
  cursor: pointer;
  position: relative;
  transition: all 0.1s ease;
  box-shadow: 0 6px 0 rgba(0,0,0,0.3), 0 8px 10px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 10px;
  user-select: none;
}

.piano-key:hover {
  background: linear-gradient(180deg, #fff, #f1f5f9);
  transform: translateY(2px);
  box-shadow: 0 4px 0 rgba(0,0,0,0.3);
}

.piano-key.playing {
  background: linear-gradient(180deg, var(--note-color, #4f46e5), color-mix(in srgb, var(--note-color, #4f46e5) 70%, white));
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.3), 0 0 20px var(--note-color, #4f46e5);
}

.piano-key-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.piano-note-cursive {
  font-family: 'Patrick Hand', cursive;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1;
}

.piano-key.playing .piano-note-cursive { color: white; }

.piano-note-key {
  font-size: 0.6rem;
  font-weight: 900;
  color: #64748b;
  background: rgba(0,0,0,0.08);
  border-radius: 4px;
  padding: 1px 4px;
}

.piano-key.playing .piano-note-key { color: rgba(255,255,255,0.8); background: rgba(0,0,0,0.2); }

/* Popup nota che appare quando si suona */
.note-popup {
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Patrick Hand', cursive;
  font-size: 2.5rem;
  font-weight: 900;
  animation: notePopupAnim 0.8s ease-out forwards;
  pointer-events: none;
  z-index: 10;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

@keyframes notePopupAnim {
  0% { opacity: 1; transform: translateX(-50%) translateY(0) scale(0.8); }
  50% { opacity: 1; transform: translateX(-50%) translateY(-20px) scale(1.2); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-40px) scale(1); }
}

/* Composizione */
.musica-composition {
  background: rgba(255,255,255,0.04);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.08);
}

.musica-comp-title {
  font-size: 0.85rem;
  font-weight: 900;
  color: #a78bfa;
  margin-bottom: 10px;
}

.musica-comp-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 40px;
  margin-bottom: 12px;
  padding: 8px;
  background: rgba(0,0,0,0.3);
  border-radius: 10px;
}

.musica-empty {
  color: #475569;
  font-style: italic;
  font-size: 0.8rem;
  align-self: center;
}

.comp-note {
  font-family: 'Patrick Hand', cursive;
  font-size: 0.9rem;
  font-weight: 700;
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.comp-note:hover { transform: scale(1.1); opacity: 0.8; }

.musica-comp-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Canzoni predefinite */
.musica-songs { }
.musica-songs-title {
  font-size: 0.85rem;
  font-weight: 900;
  color: #fbbf24;
  margin-bottom: 10px;
}
.musica-songs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.musica-song-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.musica-song-card:hover {
  background: rgba(255,255,255,0.1);
  transform: translateY(-2px);
}
.musica-song-emoji { font-size: 2rem; display: block; margin-bottom: 6px; }
.musica-song-name { font-size: 0.75rem; font-weight: 900; color: #f8fafc; margin-bottom: 4px; }
.musica-song-notes { font-size: 0.6rem; color: #64748b; margin-bottom: 8px; font-family: 'Patrick Hand', cursive; }

/* ===================== FILM CANVAS ===================== */
.film-scene-wrapper {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}

.film-action-canvas {
  display: block;
  width: 100%;
  max-width: 520px;
  height: auto;
  border-radius: 12px;
}

.film-scene-text-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  padding: 20px 16px 12px;
  border-radius: 0 0 12px 12px;
}

.film-scene-text {
  font-size: 0.9rem;
  font-weight: 700;
  color: #f8fafc;
  text-align: center;
  margin-bottom: 4px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.film-caption {
  font-size: 0.75rem;
  color: #fbbf24;
  text-align: center;
  font-style: italic;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

/* Responsive piano */
@media (max-width: 600px) {
  .piano-key { width: 52px; min-height: 100px; }
  .piano-note-cursive { font-size: 0.9rem; }
}

/* ============================================================ */
/* CINEMA STORYBOARD SVG — Nuovi Stili */
/* ============================================================ */

.cinema-selector { padding: 20px; }
.cinema-selector-title { font-size: 1.1rem; font-weight: 800; color: #fbbf24; margin-bottom: 16px; text-align: center; }
.cinema-stories-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; max-height: 65vh; overflow-y: auto; }
.cinema-story-card { background: rgba(255,255,255,0.06); border: 1.5px solid rgba(255,255,255,0.12); border-radius: 14px; padding: 12px 8px; text-align: center; cursor: pointer; transition: all 0.2s ease; }
.cinema-story-card:hover { background: rgba(59,130,246,0.2); border-color: #3b82f6; transform: translateY(-3px); box-shadow: 0 8px 20px rgba(59,130,246,0.3); }
.cinema-story-icon { font-size: 2rem; margin-bottom: 6px; }
.cinema-story-title { font-size: 0.68rem; font-weight: 700; color: #e2e8f0; line-height: 1.3; margin-bottom: 4px; }
.cinema-story-badge { font-size: 0.6rem; font-weight: 700; color: #fbbf24; background: rgba(251,191,36,0.15); padding: 2px 6px; border-radius: 8px; }

.cinema-scene-view { display: flex; flex-direction: column; height: 100%; padding: 10px; gap: 8px; }
.cinema-scene-header { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; background: rgba(255,255,255,0.05); border-radius: 10px; }
.cinema-scene-info { display: flex; align-items: center; gap: 6px; }
.cinema-lesson-icon { font-size: 1.3rem; }
.cinema-lesson-name { font-size: 0.7rem; color: #94a3b8; font-weight: 700; }
.cinema-scene-counter { font-size: 0.72rem; font-weight: 700; color: #fbbf24; background: rgba(251,191,36,0.15); padding: 3px 8px; border-radius: 8px; }

.cinema-illustration { width: 100%; max-width: 580px; margin: 0 auto; border-radius: 14px; overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,0.6); flex-shrink: 0; }
.cinema-illustration svg { width: 100%; height: auto; display: block; }

.cinema-scene-text { text-align: center; padding: 0 6px; }
.cinema-scene-title { font-size: 0.95rem; font-weight: 800; color: #fbbf24; margin-bottom: 3px; }
.cinema-scene-narration { font-size: 0.78rem; color: #cbd5e1; line-height: 1.5; font-style: italic; }

.cinema-progress-bar { display: flex; justify-content: center; gap: 6px; padding: 2px 0; }
.cinema-progress-dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,0.2); transition: all 0.3s ease; }
.cinema-progress-dot.active { background: #fbbf24; transform: scale(1.4); box-shadow: 0 0 8px #fbbf24; }
.cinema-progress-dot.done { background: #22c55e; }

.cinema-controls { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; padding: 3px 0; }
.cinema-btn-back { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); color: #94a3b8; padding: 7px 12px; border-radius: 10px; font-size: 0.75rem; font-weight: 700; cursor: pointer; transition: all 0.2s; }
.cinema-btn-back:hover { background: rgba(255,255,255,0.15); color: white; }
.cinema-btn-prev, .cinema-btn-next, .cinema-btn-speak, .cinema-btn-finish { padding: 9px 16px; border-radius: 11px; font-size: 0.82rem; font-weight: 800; cursor: pointer; border: none; transition: all 0.2s ease; }
.cinema-btn-prev { background: rgba(100,116,139,0.3); color: #cbd5e1; border: 1px solid rgba(100,116,139,0.4); }
.cinema-btn-prev:disabled { opacity: 0.4; cursor: not-allowed; }
.cinema-btn-next { background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: white; box-shadow: 0 4px 12px rgba(59,130,246,0.4); }
.cinema-btn-next:hover { transform: translateY(-2px); }
.cinema-btn-speak { background: rgba(34,197,94,0.2); color: #22c55e; border: 1px solid rgba(34,197,94,0.3); }
.cinema-btn-finish { background: linear-gradient(135deg, #f59e0b, #d97706); color: white; }

/* ============================================================ */
/* MUSICA PENTAGRAMMA — Nuovi Stili */
/* ============================================================ */

.musica-new-body { display: flex; flex-direction: column; gap: 14px; padding: 14px; overflow-y: auto; max-height: 80vh; }
.musica-new-header { text-align: center; }
.musica-new-title { font-size: 1.2rem; font-weight: 900; color: #fbbf24; margin-bottom: 4px; }
.musica-new-subtitle { font-size: 0.78rem; color: #94a3b8; }

.note-palette-section { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1); border-radius: 14px; padding: 12px; }
.note-palette-label { font-size: 0.78rem; font-weight: 700; color: #a78bfa; margin-bottom: 10px; }
.note-palette { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }

.palette-note { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 7px; border-radius: 11px; cursor: pointer; background: rgba(255,255,255,0.06); border: 2px solid var(--note-color, #666); transition: all 0.2s ease; min-width: 54px; }
.palette-note:hover { transform: translateY(-4px) scale(1.05); box-shadow: 0 8px 20px rgba(0,0,0,0.3), 0 0 12px var(--note-color, #666); background: rgba(255,255,255,0.12); }
.palette-note.selected { background: var(--note-color, #666); color: white; transform: translateY(-4px) scale(1.1); box-shadow: 0 8px 24px var(--note-color, #666); }
.palette-note.playing { animation: notePulse2 0.5s ease; }
@keyframes notePulse2 { 0% { transform: scale(1); } 50% { transform: scale(1.3); box-shadow: 0 0 30px var(--note-color, #666); } 100% { transform: scale(1); } }
.palette-note-symbol { font-size: 1.6rem; color: var(--note-color, #666); line-height: 1; }
.palette-note.selected .palette-note-symbol { color: white; }
.palette-note-name { font-family: 'Dancing Script', 'Patrick Hand', cursive; font-size: 1rem; font-weight: 700; color: var(--note-color, #666); }
.palette-note.selected .palette-note-name { color: white; }
.palette-note-key { font-size: 0.6rem; color: rgba(255,255,255,0.5); background: rgba(0,0,0,0.3); padding: 1px 4px; border-radius: 4px; }
.selected-note-info { margin-top: 8px; font-size: 0.8rem; color: #cbd5e1; text-align: center; padding: 7px; background: rgba(255,255,255,0.04); border-radius: 8px; }

.pentagramma-section { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1); border-radius: 14px; padding: 12px; }
.pentagramma-label { font-size: 0.78rem; font-weight: 700; color: #fbbf24; margin-bottom: 10px; }
.pentagramma-container { background: #FFF9F0; border-radius: 12px; overflow: hidden; cursor: pointer; border: 2px solid rgba(255,255,255,0.15); transition: border-color 0.2s; }
.pentagramma-container:hover { border-color: #fbbf24; }
.pentagramma-svg { width: 100%; height: auto; display: block; }
.penta-click-area { cursor: pointer; }
.penta-click-area:hover { fill: rgba(251,191,36,0.1) !important; }

.pentagramma-controls { display: flex; gap: 7px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }
.penta-btn { padding: 9px 16px; border-radius: 11px; font-size: 0.8rem; font-weight: 800; cursor: pointer; border: none; transition: all 0.2s ease; }
.penta-btn.small { padding: 6px 11px; font-size: 0.72rem; }
.penta-btn.play { background: linear-gradient(135deg, #22c55e, #16a34a); color: white; box-shadow: 0 4px 12px rgba(34,197,94,0.3); }
.penta-btn.play:disabled { opacity: 0.4; cursor: not-allowed; }
.penta-btn.play:not(:disabled):hover { transform: translateY(-2px); }
.penta-btn.clear { background: rgba(239,68,68,0.2); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.penta-btn.save { background: linear-gradient(135deg, #f59e0b, #d97706); color: white; }
.penta-btn.load { background: rgba(99,102,241,0.2); color: #a78bfa; border: 1px solid rgba(99,102,241,0.3); }

.composition-notes-list { margin-top: 8px; }
.comp-notes-chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 7px; background: rgba(0,0,0,0.2); border-radius: 9px; min-height: 40px; }
.comp-note-chip { display: flex; align-items: center; gap: 3px; padding: 4px 9px; border-radius: 7px; cursor: pointer; transition: all 0.2s; font-size: 0.75rem; font-weight: 700; color: white; }
.comp-note-chip:hover { opacity: 0.8; transform: scale(0.95); }
.comp-note-chip.playing { transform: scale(1.2); z-index: 1; }
.comp-note-chip-name { font-family: 'Dancing Script', cursive; font-size: 0.95rem; }
.comp-note-chip-remove { opacity: 0.6; }
.comp-count { font-size: 0.7rem; color: #64748b; text-align: right; margin-top: 3px; }
.comp-empty { font-size: 0.78rem; color: #64748b; text-align: center; padding: 10px; font-style: italic; }

.kaiju-songs-section { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1); border-radius: 14px; padding: 12px; }
.kaiju-songs-title { font-size: 0.88rem; font-weight: 800; color: #fbbf24; margin-bottom: 10px; text-align: center; }
.kaiju-songs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.kaiju-song-card { background: rgba(255,255,255,0.05); border-radius: 13px; padding: 12px; border: 1.5px solid rgba(255,255,255,0.1); transition: all 0.2s; }
.kaiju-song-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.3); }
.kaiju-song-card.kaiju-song-godzilla { border-color: rgba(34,197,94,0.3); background: rgba(34,197,94,0.06); }
.kaiju-song-card.kaiju-song-kong { border-color: rgba(139,92,246,0.3); background: rgba(139,92,246,0.06); }
.kaiju-song-card.kaiju-song-elia { border-color: rgba(59,130,246,0.3); background: rgba(59,130,246,0.06); }
.kaiju-song-card.kaiju-song-fatina { border-color: rgba(236,72,153,0.3); background: rgba(236,72,153,0.06); }
.kaiju-song-emoji { font-size: 1.8rem; margin-bottom: 5px; }
.kaiju-song-name { font-size: 0.85rem; font-weight: 800; color: #e2e8f0; margin-bottom: 3px; }
.kaiju-song-desc { font-size: 0.7rem; color: #94a3b8; line-height: 1.4; margin-bottom: 7px; }
.kaiju-song-notes-preview { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 8px; }
.song-note-chip { font-size: 0.65rem; font-weight: 700; color: white; padding: 2px 6px; border-radius: 5px; font-family: 'Dancing Script', cursive; }
.kaiju-song-btns { display: flex; gap: 5px; }

@keyframes notePopupAnim {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
  30% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  70% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -80%) scale(0.8); opacity: 0; }
}

/* Pulsante game over più visibile */
.game-overlay-btn-quiz {
  font-size: 1.1rem !important;
  padding: 14px 28px !important;
  font-weight: 900 !important;
  background: linear-gradient(135deg, #f59e0b, #fbbf24) !important;
  color: #0f172a !important;
  border-radius: 16px !important;
  border: none !important;
  cursor: pointer !important;
  box-shadow: 0 0 20px rgba(245,158,11,0.5) !important;
  animation: pulseGlow2 1.5s ease-in-out infinite;
  margin-top: 12px;
}
@keyframes pulseGlow2 {
  0%, 100% { box-shadow: 0 0 20px rgba(245,158,11,0.4); }
  50% { box-shadow: 0 0 35px rgba(245,158,11,0.8); }
}

/* ============================================================ */
/* CINEMA v6 — Scene SVG animate                                 */
/* ============================================================ */
.cinema-svg { width: 100%; height: auto; max-height: 60vh; border-radius: 14px; display: block; background: #000; box-shadow: 0 8px 28px rgba(0,0,0,0.45); }
.cinema-scene-view { display: flex; flex-direction: column; gap: 14px; padding: 16px; max-width: 720px; margin: 0 auto; }
.cinema-scene-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: rgba(255,255,255,0.08); border-radius: 12px; }
.cinema-scene-info { display: flex; gap: 12px; align-items: center; }
.cinema-lesson-icon { font-size: 1.6rem; }
.cinema-lesson-name { font-weight: 900; color: #fbbf24; font-size: 1rem; }
.cinema-scene-counter { color: #93c5fd; font-weight: 700; font-size: 0.85rem; }
.cinema-illustration { width: 100%; border-radius: 14px; overflow: hidden; background: #000; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.cinema-scene-text { background: linear-gradient(135deg, #1e293b, #0f172a); border: 2px solid #fbbf24; border-radius: 14px; padding: 14px 18px; box-shadow: 0 6px 20px rgba(251,191,36,0.18); }
.cinema-scene-title { font-family: 'Patrick Hand', cursive; font-size: 1.4rem; font-weight: 900; color: #fde68a; margin-bottom: 8px; }
.cinema-scene-narration { color: #e2e8f0; font-size: 1rem; line-height: 1.55; }
.cinema-progress-bar { display: flex; gap: 8px; justify-content: center; padding: 8px 0; }
.cinema-progress-dot { width: 10px; height: 10px; border-radius: 50%; background: #475569; transition: all 0.25s ease; }
.cinema-progress-dot.active { background: #fbbf24; transform: scale(1.6); box-shadow: 0 0 8px #fbbf24; }
.cinema-progress-dot.done { background: #22c55e; }
.cinema-controls { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; padding: 8px 0 18px; }
.cinema-btn-back, .cinema-btn-prev, .cinema-btn-next, .cinema-btn-speak, .cinema-btn-finish {
  padding: 10px 18px; border-radius: 10px; border: none; font-weight: 800; font-size: 0.85rem; cursor: pointer; transition: all 0.2s ease; font-family: 'Nunito', sans-serif;
}
.cinema-btn-back { background: #475569; color: white; }
.cinema-btn-prev { background: #6366f1; color: white; }
.cinema-btn-next { background: #fbbf24; color: #1a1a1a; }
.cinema-btn-speak { background: #22c55e; color: white; }
.cinema-btn-finish { background: linear-gradient(135deg, #ec4899, #f59e0b); color: white; }
.cinema-btn-back:hover, .cinema-btn-prev:hover, .cinema-btn-next:hover, .cinema-btn-speak:hover, .cinema-btn-finish:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
.cinema-btn-prev:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ============================================================ */
/* MUSICA v6 — Pianoforte e mini scuola                          */
/* ============================================================ */
.musica-body { padding: 14px; max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.musica-header-row { text-align: center; margin-bottom: 4px; }
.musica-title { font-family: 'Patrick Hand', cursive; font-size: 1.6rem; color: #a78bfa; font-weight: 900; margin-bottom: 6px; }
.musica-subtitle { font-size: 0.9rem; color: #cbd5e1; line-height: 1.45; }

.music-lesson { background: linear-gradient(135deg, rgba(124,58,237,0.18), rgba(167,139,250,0.12)); border: 2px solid #a78bfa; border-radius: 14px; padding: 14px 18px; }
.music-lesson-header { font-weight: 900; color: #c4b5fd; font-size: 0.95rem; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.music-lesson-body { color: #f1f5f9; font-size: 1rem; line-height: 1.6; margin-bottom: 12px; }
.music-lesson-body em { color: #fbbf24; font-style: italic; }
.music-lesson-body strong { color: #fde68a; }
.music-lesson-controls { display: flex; gap: 8px; flex-wrap: wrap; }

.staff-wrap { background: #FFFDF5; border-radius: 14px; padding: 12px; box-shadow: 0 4px 14px rgba(0,0,0,0.18); }
.staff-label { font-weight: 800; color: #5d4037; font-size: 0.85rem; margin-bottom: 8px; }
.staff-svg { width: 100%; height: auto; display: block; }

.piano-wrap { background: linear-gradient(135deg, #3E2723, #5D4037); border-radius: 14px; padding: 12px; box-shadow: 0 6px 22px rgba(0,0,0,0.4); }
.piano-label { font-weight: 800; color: #FFE082; font-size: 0.85rem; margin-bottom: 8px; }
.piano-svg { width: 100%; height: auto; display: block; }
.piano-key { cursor: pointer; transition: filter 0.15s ease; }
.piano-key:hover .piano-key-bg { filter: brightness(0.94); }
.piano-key.active .piano-key-flash { opacity: 0.7 !important; animation: pianoKeyFlash 0.32s ease-out; }
@keyframes pianoKeyFlash { 0% { opacity: 0.9; } 100% { opacity: 0; } }
.piano-key-black:hover rect:first-child { fill: #3a3a3a !important; }

.piano-note-popup {
  position: fixed; top: 30%; left: 50%; transform: translate(-50%, -50%);
  background: #fbbf24; color: white; padding: 22px 32px; border-radius: 22px;
  font-size: 1.6rem; font-weight: 900; z-index: 100002; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  animation: pianoPopup 0.9s ease-out forwards;
  font-family: 'Dancing Script', cursive;
}
.piano-popup-name { font-size: 2.4rem; font-weight: 700; line-height: 1; }
.piano-popup-sym { font-size: 1.2rem; opacity: 0.8; }
@keyframes pianoPopup {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  70% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.95) translateY(-30px); }
}

.penta-controls { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; padding: 4px 0; }
.penta-btn { padding: 11px 18px; border-radius: 10px; border: none; font-weight: 800; font-size: 0.85rem; cursor: pointer; transition: all 0.2s ease; font-family: 'Nunito', sans-serif; background: #475569; color: white; }
.penta-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
.penta-btn.play { background: linear-gradient(135deg, #22c55e, #16a34a); color: white; }
.penta-btn.clear { background: #ef4444; color: white; }
.penta-btn.save { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #1a1a1a; }
.penta-btn.small { padding: 7px 12px; font-size: 0.78rem; }
.penta-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.kaiju-songs { background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(167,139,250,0.12)); border-radius: 14px; padding: 14px; border: 2px solid rgba(167,139,250,0.4); }
.kaiju-songs-title { font-weight: 900; color: #fbbf24; font-size: 1rem; margin-bottom: 12px; text-align: center; }
.kaiju-songs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.kaiju-song-card { background: rgba(15,23,42,0.65); border: 2px solid #475569; border-radius: 12px; padding: 12px; }
.kaiju-song-card.kaiju-song-godzilla { border-color: #22c55e; }
.kaiju-song-card.kaiju-song-kong { border-color: #92400e; }
.kaiju-song-card.kaiju-song-elia { border-color: #3b82f6; }
.kaiju-song-card.kaiju-song-fatina { border-color: #ec4899; }
.kaiju-song-emoji { font-size: 2rem; text-align: center; margin-bottom: 4px; }
.kaiju-song-name { font-weight: 900; color: #fbbf24; font-size: 0.95rem; text-align: center; margin-bottom: 6px; }
.kaiju-song-desc { font-size: 0.78rem; color: #cbd5e1; text-align: center; margin-bottom: 10px; line-height: 1.4; }
.kaiju-song-preview { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; margin-bottom: 10px; }
.song-chip { display: inline-block; padding: 3px 8px; border-radius: 8px; font-family: 'Dancing Script', cursive; font-weight: 700; color: white; font-size: 0.85rem; text-shadow: 0 1px 2px rgba(0,0,0,0.4); }
.kaiju-song-btns { display: flex; gap: 6px; justify-content: center; }

/* ============================================================ */
/* FESTA DI COMPLEANNO                                            */
/* ============================================================ */
#birthday-party-overlay {
  position: fixed; inset: 0; background: radial-gradient(ellipse at center, rgba(76,29,149,0.95), rgba(15,23,42,0.98));
  z-index: 100001; opacity: 0; visibility: hidden; transition: all 0.4s ease;
  display: flex; align-items: center; justify-content: center; padding: 12px;
}
#birthday-party-overlay.active { opacity: 1; visibility: visible; }
.birthday-party-panel { background: linear-gradient(180deg, #1e1b4b, #0f0a2e); border: 3px solid #ec4899; border-radius: 22px; width: 100%; max-width: 780px; max-height: 96vh; overflow-y: auto; box-shadow: 0 22px 60px rgba(236,72,153,0.6); }
.birthday-party-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 22px; background: linear-gradient(135deg, #ec4899, #f59e0b); border-radius: 19px 19px 0 0; }
.birthday-party-title { font-family: 'Dancing Script', cursive; font-size: 1.7rem; font-weight: 900; color: white; text-shadow: 0 2px 6px rgba(0,0,0,0.35); }
.birthday-party-body { padding: 18px; }
.birthday-party-scene { width: 100%; border-radius: 14px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.5); margin-bottom: 16px; }
.party-svg { width: 100%; height: auto; display: block; background: #000; }
.birthday-party-controls { text-align: center; }
.birthday-party-message { background: rgba(255,255,255,0.07); border-radius: 12px; padding: 14px 18px; color: #f1f5f9; font-size: 1.05rem; line-height: 1.55; margin-bottom: 14px; }
.birthday-party-message strong { color: #fde68a; }
.birthday-party-message em { color: #fbbf24; font-style: italic; }
.birthday-party-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.birthday-party-btn {
  background: linear-gradient(135deg, #ec4899, #f59e0b); color: white;
  border: 2px solid #fff; padding: 12px 20px; border-radius: 12px;
  font-weight: 900; font-size: 0.9rem; cursor: pointer; margin-top: 10px;
  box-shadow: 0 5px 18px rgba(236,72,153,0.55); animation: bdayPulse 1.4s ease-in-out infinite;
}
@keyframes bdayPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 5px 18px rgba(236,72,153,0.55); }
  50% { transform: scale(1.06); box-shadow: 0 7px 24px rgba(236,72,153,0.85); }
}

.birthday-banner-active {
  display: flex !important; align-items: center; justify-content: center; gap: 12px;
  background: linear-gradient(135deg, #ec4899, #f59e0b) !important;
  color: white !important; padding: 10px 16px !important;
  font-weight: 800 !important; font-size: 0.95rem !important; flex-wrap: wrap;
  animation: bdayBannerShine 2.4s ease-in-out infinite;
}
@keyframes bdayBannerShine {
  0%,100% { box-shadow: 0 2px 12px rgba(236,72,153,0.4); }
  50% { box-shadow: 0 4px 24px rgba(245,158,11,0.6); }
}
.birthday-banner-btn { background: white; color: #ec4899; border: none; padding: 6px 14px; border-radius: 8px; font-weight: 900; cursor: pointer; font-size: 0.85rem; box-shadow: 0 3px 8px rgba(0,0,0,0.2); }
.birthday-banner-btn:hover { transform: translateY(-2px); }

/* Responsive */
@media (max-width: 600px) {
  .musica-title { font-size: 1.3rem; }
  .cinema-scene-title { font-size: 1.2rem; }
  .birthday-party-title { font-size: 1.3rem; }
  .kaiju-songs-grid { grid-template-columns: 1fr; }
  .piano-popup-name { font-size: 1.8rem; }
}
