/* ==========================================================================
   Elena Minna - Piattaforma Educativa per Bambini
   Stili Principali & UI Touch-Friendly
   ========================================================================== */

:root {
  --bg-primary: #f0f7ff;
  --bg-card: #ffffff;
  --color-text: #2d3748;
  --color-muted: #718096;
  
  /* Joyful Educational Colors */
  --c-yellow: #feca57;
  --c-yellow-dark: #f39c12;
  --c-blue: #48dbfb;
  --c-blue-dark: #2e86de;
  --c-green: #1dd1a1;
  --c-green-dark: #10ac84;
  --c-red: #ff6b6b;
  --c-red-dark: #ee5253;
  --c-purple: #a29bfe;
  --c-purple-dark: #6c5ce7;
  --c-wood: #d35400;
  --c-wood-bg: #fdf5e6;
  --c-wood-border: #d4a373;
  
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-btn: 0 6px 0 rgba(0, 0, 0, 0.15);
  --shadow-btn-active: 0 2px 0 rgba(0, 0, 0, 0.15);
}

html {
  box-sizing: border-box;
  width: 100%;
  overflow-x: hidden;
}

*, *:before, *:after {
  box-sizing: inherit;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: 'Lexend', 'Comic Neue', 'Fredoka', 'Quicksand', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-primary);
  background-image: radial-gradient(#e0edff 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  color: var(--color-text);
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  touch-action: manipulation;
  margin: 0;
  padding: 0;
}

/* ================= Top Bar ================= */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 24px;
  background: #ffffff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--color-text);
  cursor: pointer;
  flex-shrink: 0;
}

.brand-icon {
  font-size: 1.8rem;
  animation: bounce 2s infinite;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 900px) {
  .top-bar {
    padding: 8px 14px;
  }
  .brand {
    font-size: 1.15rem;
    gap: 6px;
  }
  .top-bar-actions {
    gap: 6px;
  }
  .btn-parents-privacy span:last-child {
    display: none;
  }
  .btn-parents-privacy {
    padding: 6px 10px;
  }
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  padding: 6px 14px;
  border-radius: 50px;
  font-weight: 700;
}

.star-counter {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff9db;
  color: #d97706;
  border: 2px solid #fde047;
  padding: 6px 14px;
  border-radius: 50px;
  font-weight: 800;
  font-size: 1.1rem;
}

.btn-icon {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  font-size: 1.3rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
}

.btn-icon:hover {
  background-color: #f1f5f9;
  transform: scale(1.08);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.btn-icon:active {
  transform: scale(0.92);
}

/* ================= Prominent & Colorful Back-to-Hub Button ================= */
.btn-back-hub {
  background: linear-gradient(135deg, #ff5722 0%, #f43f5e 50%, #e11d48 100%);
  color: #ffffff !important;
  border: 2.5px solid #ffffff;
  border-radius: 50px;
  padding: 8px 18px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
  flex-shrink: 0;
  user-select: none;
  outline: none;
  position: relative;
  overflow: hidden;
}

.btn-back-hub::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.6s ease;
}

.btn-back-hub:hover::after {
  left: 100%;
}

.btn-back-hub .btn-back-icon {
  font-size: 1.25rem;
  display: inline-block;
  transition: transform 0.2s ease;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

.btn-back-hub .btn-back-text {
  font-weight: 800;
  font-size: 0.95rem;
}

.btn-back-hub:hover {
  transform: translateY(-2px) scale(1.06);
  background: linear-gradient(135deg, #ff6e3d 0%, #fb7185 50%, #e11d48 100%);
  box-shadow: 0 6px 20px rgba(244, 63, 94, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.btn-back-hub:hover .btn-back-icon {
  transform: translateX(-4px) scale(1.1);
}

.btn-back-hub:active {
  transform: translateY(1px) scale(0.97);
  box-shadow: 0 2px 6px rgba(244, 63, 94, 0.35);
}

@media (max-width: 600px) {
  .btn-back-hub {
    padding: 6px 12px;
    font-size: 0.85rem;
    gap: 5px;
  }
  .btn-back-hub .btn-back-icon {
    font-size: 1.05rem;
  }
}

/* ================= Layout Containers ================= */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 20px 36px 20px;
  width: 100%;
  box-sizing: border-box;
  flex: 1;
}

.screen {
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.screen.active {
  display: block;
  opacity: 1;
}

/* ================= Unified Accessible Button Design System ================= */
.btn-fun {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: 'Lexend', 'Comic Neue', 'Fredoka', system-ui, sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  border-radius: var(--radius-lg);
  border: 2px solid transparent;
  cursor: pointer;
  color: #ffffff;
  box-shadow: var(--shadow-btn);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease, border-color 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

.btn-fun:hover {
  transform: translateY(-2px);
}

.btn-fun:active {
  transform: translateY(3px);
  box-shadow: var(--shadow-btn-active);
}

/* Semantics & High-Contrast Colors (WCAG AAA Guaranteed) */
.btn-primary { 
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%); 
  color: #ffffff !important;
  border-color: #1e40af;
  box-shadow: 0 5px 0 #1e40af, 0 8px 16px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover {
  box-shadow: 0 7px 0 #1e40af, 0 10px 20px rgba(37, 99, 235, 0.35);
}

.btn-secondary { 
  background: #f1f5f9; 
  color: #1e293b !important; 
  border: 2px solid #cbd5e1;
  box-shadow: 0 4px 0 #94a3b8;
}
.btn-secondary:hover { 
  background: #e2e8f0; 
  border-color: #94a3b8;
  color: #0f172a !important;
}

.btn-white { 
  background: #ffffff; 
  color: #1e293b !important; 
  border: 2px solid #cbd5e1;
  box-shadow: 0 4px 0 #cbd5e1;
}
.btn-white:hover { 
  background: #f8fafc; 
  border-color: #94a3b8;
  color: #0f172a !important;
}

.btn-success, .btn-green { 
  background: linear-gradient(135deg, #10b981 0%, #059669 100%); 
  color: #ffffff !important;
  border-color: #047857;
  box-shadow: 0 5px 0 #047857, 0 8px 16px rgba(16, 185, 129, 0.25);
}
.btn-success:hover, .btn-green:hover {
  box-shadow: 0 7px 0 #047857, 0 10px 20px rgba(16, 185, 129, 0.35);
}

.btn-warning, .btn-orange { 
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); 
  color: #ffffff !important;
  border-color: #b45309;
  box-shadow: 0 5px 0 #b45309, 0 8px 16px rgba(245, 158, 11, 0.25);
}
.btn-warning:hover, .btn-orange:hover {
  box-shadow: 0 7px 0 #b45309, 0 10px 20px rgba(245, 158, 11, 0.35);
}

.btn-purple { 
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); 
  color: #ffffff !important;
  border-color: #6d28d9;
  box-shadow: 0 5px 0 #6d28d9, 0 8px 16px rgba(139, 92, 246, 0.25);
}
.btn-purple:hover {
  box-shadow: 0 7px 0 #6d28d9, 0 10px 20px rgba(139, 92, 246, 0.35);
}

.btn-coral, .btn-red { 
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); 
  color: #ffffff !important;
  border-color: #b91c1c;
  box-shadow: 0 5px 0 #b91c1c, 0 8px 16px rgba(239, 68, 68, 0.25);
}
.btn-coral:hover, .btn-red:hover {
  box-shadow: 0 7px 0 #b91c1c, 0 10px 20px rgba(239, 68, 68, 0.35);
}

.btn-blue { 
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%); 
  color: #ffffff !important;
  border-color: #075985;
  box-shadow: 0 5px 0 #075985, 0 8px 16px rgba(2, 132, 199, 0.25);
}
.btn-blue:hover {
  box-shadow: 0 7px 0 #075985, 0 10px 20px rgba(2, 132, 199, 0.35);
}

/* ================= Level Difficulty Selectors (Livelli) ================= */
.btn-level-pill, 
.math-lvl-btn, 
.cruci-level-pill, 
.braingym-sublevel-btn, 
.level-pill, 
.logic-pill-btn, 
.maze-diff-btn, 
.tangram-model-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  font-family: 'Lexend', 'Comic Neue', system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  border-radius: 999px;
  border: 2px solid #cbd5e1;
  background: #f8fafc;
  color: #1e293b !important;
  box-shadow: 0 3px 0 #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.btn-level-pill:hover,
.math-lvl-btn:hover,
.cruci-level-pill:hover,
.braingym-sublevel-btn:hover,
.level-pill:hover,
.logic-pill-btn:hover,
.maze-diff-btn:hover,
.tangram-model-pill:hover {
  background: #ffffff;
  border-color: #94a3b8;
  transform: translateY(-2px);
  box-shadow: 0 5px 0 #94a3b8;
}

.btn-level-pill:active,
.math-lvl-btn:active,
.cruci-level-pill:active,
.braingym-sublevel-btn:active,
.level-pill:active,
.logic-pill-btn:active,
.maze-diff-btn:active,
.tangram-model-pill:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #cbd5e1;
}

/* Level 1 / Facile / Base -> Emerald Green */
.btn-level-pill.level-1.active,
.btn-level-pill.diff-easy.active,
.maze-diff-btn.diff-easy.active,
.maze-diff-btn.active[data-diff="easy"],
.math-lvl-btn.active:nth-child(1),
.cruci-level-pill.active-level-pill:nth-child(1),
.braingym-sublevel-btn.active:nth-child(1),
.level-pill.active:nth-child(1),
.logic-pill-btn.active:nth-child(1) {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  border-color: #047857 !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4), 0 3px 0 #047857 !important;
}

/* Level 2 / Medio / Intermedio -> Amber Gold */
.btn-level-pill.level-2.active,
.btn-level-pill.diff-medium.active,
.maze-diff-btn.diff-medium.active,
.maze-diff-btn.active[data-diff="medium"],
.math-lvl-btn.active:nth-child(2),
.cruci-level-pill.active-level-pill:nth-child(2),
.braingym-sublevel-btn.active:nth-child(2),
.level-pill.active:nth-child(2),
.logic-pill-btn.active:nth-child(2) {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  color: #ffffff !important;
  border-color: #b45309 !important;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4), 0 3px 0 #b45309 !important;
}

/* Level 3 / Difficile / Avanzato -> Purple Violet */
.btn-level-pill.level-3.active,
.btn-level-pill.diff-hard.active,
.maze-diff-btn.diff-hard.active,
.maze-diff-btn.active[data-diff="hard"],
.math-lvl-btn.active:nth-child(3),
.cruci-level-pill.active-level-pill:nth-child(3),
.braingym-sublevel-btn.active:nth-child(3),
.level-pill.active:nth-child(3),
.logic-pill-btn.active:nth-child(3) {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%) !important;
  color: #ffffff !important;
  border-color: #6d28d9 !important;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4), 0 3px 0 #6d28d9 !important;
}

/* Level 4+ / Master / Sfida -> Coral Red */
.btn-level-pill.level-4.active,
.braingym-sublevel-btn.active:nth-child(n+4),
.level-pill.active:nth-child(n+4),
.logic-pill-btn.active:nth-child(n+4) {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  color: #ffffff !important;
  border-color: #b91c1c !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4), 0 3px 0 #b91c1c !important;
}

/* Infinite / Random / Sorpresa Level */
.btn-level-pill.level-infinite.active,
.math-lvl-btn.level-infinite.active,
.math-lvl-btn.active:last-child {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%) !important;
  color: #ffffff !important;
  border-color: #78350f !important;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4), 0 3px 0 #78350f !important;
}

/* ================= Game / Mode Switchers (Cambio Gioco / Modalità) ================= */
.btn-mode-tab,
.mode-tab-btn,
.math-cat-btn,
.logic-mode-tab-btn,
.planets-mode-tab-btn,
.english-tab-btn,
.geo-tab-btn,
.skills-type-btn,
.braingym-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: 'Lexend', 'Comic Neue', 'Fredoka', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 800;
  border-radius: 50px;
  border: 2px solid #cbd5e1;
  background: #f1f5f9;
  color: #1e293b !important;
  box-shadow: 0 3px 0 #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-mode-tab:hover,
.mode-tab-btn:hover,
.math-cat-btn:hover,
.logic-mode-tab-btn:hover,
.planets-mode-tab-btn:hover,
.english-tab-btn:hover,
.geo-tab-btn:hover,
.skills-type-btn:hover,
.braingym-tab-btn:hover {
  background: #ffffff;
  border-color: #3b82f6;
  color: #1d4ed8 !important;
  transform: translateY(-2px);
  box-shadow: 0 5px 0 #93c5fd;
}

.btn-mode-tab.active,
.mode-tab-btn.active,
.math-cat-btn.active,
.logic-mode-tab-btn.active,
.planets-mode-tab-btn.active,
.english-tab-btn.active,
.geo-tab-btn.active,
.skills-type-btn.active,
.braingym-tab-btn.active {
  background: var(--cat-color, linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%)) !important;
  color: #ffffff !important;
  border-color: #1e40af !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35), 0 3px 0 #1e40af !important;
  transform: translateY(-1px);
}

/* ================= Clean & Beautiful Landing Hero ================= */
.hero-clean-section {
  text-align: center;
  padding: 24px 16px 20px;
  position: relative;
  max-width: 820px;
  margin: 0 auto;
  min-height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
}

.hero-floating-badge {
  position: absolute;
  font-size: 2.2rem;
  opacity: 0.85;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
  pointer-events: none;
  animation: hero-float-gentle 4s ease-in-out infinite alternate;
}

.badge-pos-1 { top: 6%; left: 8%; animation-delay: 0s; font-size: 2.5rem; }
.badge-pos-2 { top: 10%; right: 10%; animation-delay: 1.5s; font-size: 2.8rem; }
.badge-pos-3 { bottom: 16%; left: 6%; animation-delay: 2.3s; font-size: 2.4rem; }
.badge-pos-4 { bottom: 12%; right: 8%; animation-delay: 0.8s; font-size: 2.6rem; }
.badge-pos-5 { top: 46%; left: 2%; animation-delay: 3s; font-size: 2rem; opacity: 0.6; }
.badge-pos-6 { top: 50%; right: 3%; animation-delay: 1.8s; font-size: 2.2rem; opacity: 0.6; }

@keyframes hero-float-gentle {
  0% { transform: translateY(0) rotate(0deg) scale(1); }
  100% { transform: translateY(-16px) rotate(8deg) scale(1.08); }
}

.hero-cta-wrapper {
  z-index: 2;
  display: flex;
  justify-content: center;
  width: 100%;
}

.hero-cta-top {
  margin-top: 6px;
  margin-bottom: 24px;
}

.hero-title {
  font-size: 2.6rem;
  font-weight: 900;
  color: #1e293b;
  margin-bottom: 14px;
  line-height: 1.25;
  letter-spacing: -0.5px;
  z-index: 2;
}

.hero-title-line {
  display: block;
}

.no-break {
  white-space: nowrap;
}

.hero-title-highlight {
  background: linear-gradient(135deg, #ef4444 0%, #f97316 50%, #eab308 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.hero-subtitle {
  font-size: 1.12rem;
  font-weight: 600;
  color: #64748b;
  max-width: 640px;
  margin: 0 auto 28px;
  line-height: 1.65;
  z-index: 2;
}

.hero-cta-wrapper {
  z-index: 2;
  display: flex;
  justify-content: center;
  width: 100%;
}

.hero-guest-btn {
  font-size: 1.35rem;
  padding: 16px 44px;
  border-radius: 40px;
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  color: #ffffff;
  border: 3px solid #ffffff;
  box-shadow: 0 10px 25px rgba(234, 88, 12, 0.35), inset 0 2px 4px rgba(255, 255, 255, 0.4);
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}

.hero-guest-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 14px 30px rgba(234, 88, 12, 0.45);
}

.hero-guest-btn:active {
  transform: translateY(1px) scale(0.98);
}

/* ================= Compact Auth Modal & Anti-Bot ================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 12px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.auth-modal {
  background: #ffffff;
  width: 100%;
  max-width: 380px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 20px;
  padding: 18px 20px 14px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
  position: relative;
  border: 3px solid #e2e8f0;
  box-sizing: border-box;
}

.auth-close-x {
  position: absolute;
  top: 10px;
  right: 12px;
  background: #f1f5f9;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: 800;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  z-index: 10;
}

.auth-close-x:hover {
  background: #fee2e2;
  color: #ef4444;
}

.auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 12px;
  margin-top: 4px;
}

.auth-tab {
  flex: 1;
  padding: 6px 10px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.95rem;
  border-radius: 9px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s;
}

.auth-tab.active {
  background: #ffffff;
  color: #0284c7;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.form-group {
  margin-bottom: 10px;
  text-align: left;
}

.form-group label {
  display: block;
  font-weight: 800;
  margin-bottom: 3px;
  font-size: 0.85rem;
  color: #334155;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid #cbd5e1;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.form-control:focus {
  border-color: #0284c7;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-top: 4px;
}

.avatar-option {
  font-size: 1.45rem;
  padding: 4px 2px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  background: #f8fafc;
}

.avatar-option.selected {
  border-color: #f59e0b;
  background: #fef9c3;
  transform: scale(1.1);
}

/* Compact Anti-Bot Box */
.antibot-box {
  background: #eff6ff;
  border: 2px dashed #93c5fd;
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 12px;
}

.antibot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.antibot-label {
  font-weight: 800;
  color: #1e40af;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.antibot-input {
  max-width: 100px;
  padding: 6px 10px;
  font-size: 0.9rem;
  text-align: center;
  background: #ffffff;
}

.auth-submit-btn {
  width: 100%;
  padding: 10px 16px;
  font-size: 1.05rem;
  border-radius: 12px;
}

.auth-cancel-link {
  background: none;
  border: none;
  color: #94a3b8;
  font-weight: 700;
  margin-top: 8px;
  font-size: 0.82rem;
  width: 100%;
  cursor: pointer;
}

.auth-cancel-link:hover {
  color: #64748b;
  text-decoration: underline;
}

.auth-error {
  color: #dc2626;
  background: #fee2e2;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 10px;
  display: none;
}

/* ================= Adventure Islands Hub ================= */
.hub-header {
  text-align: center;
  margin-bottom: 32px;
}

.hub-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: #1e293b;
}

.islands-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.island-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 30px 20px;
  text-align: center;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  border: 4px solid transparent;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.island-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.12);
}

.island-card.island-italian     { border-color: var(--c-red); }
.island-card.island-orthography { border-color: #38bdf8; }
.island-card.island-math        { border-color: var(--c-blue-dark); }
.island-card.island-reading     { border-color: var(--c-green); }
.island-card.island-logic       { border-color: var(--c-purple-dark); }
.island-card.island-planets     { border-color: #8b5cf6; }
.island-card.island-skills      { border-color: #f59e0b; }
.island-card.island-english     { border-color: #0284c7; }
.island-card.island-geography   { border-color: #059669; }
.island-card.island-geometry    { border-color: #d946ef; }
.island-card.island-mazes       { border-color: #0d9488; }
.island-card.island-braingym    { border-color: #ec4899; }

.island-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

.island-name {
  font-size: 1.5rem;
  font-weight: 900;
  margin-bottom: 8px;
  color: #0f172a;
}

.island-desc {
  font-size: 1rem;
  color: #1e293b;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 16px;
  flex: 1;
}

.island-badge {
  background: #f8fafc;
  padding: 6px 16px;
  border-radius: 50px;
  font-weight: 800;
  font-size: 0.88rem;
  color: #0f172a;
  border: 1.5px solid #cbd5e1;
}

/* ================= Game Screens ================= */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  background: #ffffff;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.game-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.game-title {
  font-size: 1.4rem;
  font-weight: 800;
}

/* ================= 🛡️ Area Genitori & Privacy Modal ================= */
.privacy-modal {
  background: #ffffff;
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
  position: relative;
  border: 4px solid #38bdf8;
  box-sizing: border-box;
  overflow: hidden;
}

.privacy-modal-header {
  padding: 18px 24px 14px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.privacy-modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.privacy-tabs-bar {
  display: flex;
  gap: 6px;
  padding: 10px 18px;
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

.privacy-tab {
  padding: 8px 14px;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  border-radius: 9999px;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.85rem;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.privacy-tab:hover {
  background: #e0f2fe;
  border-color: #38bdf8;
  color: #0369a1;
}

.privacy-tab.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 3px 8px rgba(2, 132, 199, 0.3);
}

.privacy-body {
  padding: 20px 24px;
  overflow-y: auto;
  font-size: 0.95rem;
  line-height: 1.65;
  color: #334155;
}

.privacy-panel {
  display: none;
}

.privacy-card {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 14px;
}

.privacy-card-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.privacy-law-badge {
  display: inline-block;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.privacy-highlight-box {
  background: #ecfdf5;
  border: 2px solid #a7f3d0;
  border-radius: 12px;
  padding: 12px 16px;
  color: #065f46;
  font-weight: 700;
  margin: 12px 0;
}

.privacy-modal-footer {
  padding: 12px 20px;
  background: #f8fafc;
  border-top: 2px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* ================= 🛡️ Kid-Safe App Footer ================= */
.app-kid-footer {
  margin-top: 30px;
  padding: 16px 12px 24px;
  text-align: center;
  width: 100%;
}

.footer-safety-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  color: #14532d;
  padding: 6px 16px;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.footer-link-btn {
  background: none;
  border: none;
  color: #0369a1;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}

.footer-link-btn:hover {
  background: #e0f2fe;
  color: #0284c7;
  text-decoration: underline;
}

.footer-dot {
  color: #cbd5e1;
  font-weight: 900;
}

.footer-copy {
  font-size: 0.82rem;
  color: #64748b;
  font-weight: 700;
}

/* Header Privacy Button */
.btn-parents-privacy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  color: #15803d;
  border: 2px solid #86efac;
  border-radius: 9999px;
  padding: 6px 14px;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.12);
}

.btn-parents-privacy:hover {
  transform: translateY(-2px);
  background: #bbf7d0;
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.2);
}


/* Canvas Tracing */

/* ================= GLOBAL 3D TACTILE BOTTOM NAVIGATION CONTROLS ================= */
.math-bottom-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  width: 100%;
}

.btn-wb-action,
.btn-player-ctrl {
  font-family: 'Lexend', 'Comic Neue', 'Fredoka', system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  padding: 10px 20px;
  min-height: 44px;
  border-radius: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.12s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  user-select: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
}

.btn-wb-prev, .ctrl-prev {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff !important;
  box-shadow: 0 5px 0 #075985, 0 8px 16px rgba(2, 132, 199, 0.3);
}

.btn-wb-prev:hover, .ctrl-prev:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 #075985, 0 10px 20px rgba(2, 132, 199, 0.4);
}

.btn-wb-prev:active, .ctrl-prev:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #075985;
}

.btn-wb-play, .ctrl-play {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff !important;
  box-shadow: 0 5px 0 #047857, 0 8px 16px rgba(16, 185, 129, 0.3);
}

.btn-wb-play:hover, .ctrl-play:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 #047857, 0 10px 20px rgba(16, 185, 129, 0.4);
}

.btn-wb-play:active, .ctrl-play:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #047857;
}

.btn-wb-shuffle, .btn-wb-random, .ctrl-shuffle {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: #ffffff !important;
  box-shadow: 0 5px 0 #6d28d9, 0 8px 16px rgba(139, 92, 246, 0.3);
}

.btn-wb-shuffle:hover, .btn-wb-random:hover, .ctrl-shuffle:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 #6d28d9, 0 10px 20px rgba(139, 92, 246, 0.4);
}

.btn-wb-shuffle:active, .btn-wb-random:active, .ctrl-shuffle:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #6d28d9;
}

.btn-wb-next, .ctrl-next {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff !important;
  box-shadow: 0 5px 0 #b45309, 0 8px 16px rgba(245, 158, 11, 0.3);
}

.btn-wb-next:hover, .ctrl-next:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 #b45309, 0 10px 20px rgba(245, 158, 11, 0.4);
}

.btn-wb-next:active, .ctrl-next:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #b45309;
}

.btn-wb-reset, .ctrl-reset {
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
  color: #ffffff !important;
  box-shadow: 0 5px 0 #334155, 0 8px 16px rgba(100, 116, 139, 0.3);
}

.btn-wb-reset:hover, .ctrl-reset:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 #334155, 0 10px 20px rgba(100, 116, 139, 0.4);
}

.btn-wb-reset:active, .ctrl-reset:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #334155;
}

.btn-wb-sound, .ctrl-sound {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: #ffffff !important;
  box-shadow: 0 5px 0 #0e7490, 0 8px 16px rgba(6, 182, 212, 0.3);
}

.btn-wb-sound:hover, .ctrl-sound:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 #0e7490, 0 10px 20px rgba(6, 182, 212, 0.4);
}

.btn-wb-sound:active, .ctrl-sound:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #0e7490;
}

/* ==========================================================================
   PWA & Offline UI Components
   ========================================================================== */

.btn-pwa-install {
  background: linear-gradient(135deg, #ec4899 0%, #d946ef 50%, #8b5cf6 100%);
  color: #ffffff !important;
  border: 2px solid #ffffff;
  border-radius: 50px;
  padding: 8px 18px;
  font-family: var(--font-family-base, 'Nunito', sans-serif);
  font-weight: 900;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.35);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: pulse 2.5s infinite;
}

.btn-pwa-install:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 6px 18px rgba(236, 72, 153, 0.5);
}

.btn-pwa-install:active {
  transform: translateY(2px) scale(0.98);
}

.network-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 800;
  transition: all 0.3s ease;
}

.network-badge.online {
  background: #dcfce7;
  color: #15803d;
  border: 1.5px solid #86efac;
}

.network-badge.offline {
  background: #fef3c7;
  color: #b45309;
  border: 1.5px solid #fcd34d;
  animation: pulse 2s infinite;
}

/* PWA Toast Notification */
.pwa-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: #1e1b4b;
  color: #ffffff;
  padding: 14px 28px;
  border-radius: 50px;
  font-family: var(--font-family-base, 'Nunito', sans-serif);
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  pointer-events: none;
}

.pwa-toast.active {
  transform: translateX(-50%) translateY(0);
}

.pwa-toast-success {
  background: #065f46;
  border-color: #34d399;
}

.pwa-toast-info {
  background: #1e1b4b;
  border-color: #818cf8;
}

/* PWA Installation Modal */
.pwa-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.pwa-modal-overlay.active {
  display: flex;
  animation: fadeIn 0.25s ease;
}

.pwa-modal-card {
  background: #ffffff;
  border-radius: 28px;
  max-width: 480px;
  width: 100%;
  padding: 32px 28px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  text-align: center;
  border: 4px solid #818cf8;
  position: relative;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pwa-modal-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  border-radius: 20px;
  box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
}

.pwa-modal-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: #1e1b4b;
  margin-bottom: 8px;
}

.pwa-modal-desc {
  font-size: 0.95rem;
  color: #475569;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 20px;
}

.pwa-step-list {
  text-align: left;
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 18px;
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pwa-step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e293b;
}

.pwa-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #4f46e5;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 900;
  flex-shrink: 0;
}
