/* ── Font metric fallbacks — prevent CLS (impeccable 5.3) ──────────────── */
@font-face {
  font-family: 'Baloo 2 Fallback';
  src: local('Arial Rounded MT Bold'), local('Arial');
  size-adjust: 106%;
  ascent-override: 98%;
  descent-override: 25%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Comic Neue Fallback';
  src: local('Comic Sans MS'), local('Arial');
  size-adjust: 95%;
  ascent-override: 96%;
  descent-override: 24%;
}

/* ============================================
   English Lessons - Vibrant Play Learning
   Design System: Tactile-Gamified
   ============================================ */

/* Fonts loaded via <link> in HTML for better performance */

/* --- Design Tokens --- */
:root {
  --leaf-green: #4CAF50;
  --leaf-green-dark: #388E3C;
  --leaf-green-darker: #2E7D32;
  --leaf-green-light: #C8E6C9;
  --leaf-green-bg: #E8F5E9;

  --sunny-yellow: #FFC107;
  --sunny-yellow-dark: #FFA000;
  --sunny-yellow-light: #FFF8E1;

  --playful-orange: #FF9800;
  --playful-orange-dark: #F57C00;

  --sky-blue: #03A9F4;
  --sky-blue-light: #E1F5FE;

  --ruby-red: #E74C3C;
  --ruby-red-light: #FDEDEC;

  --bg-cream: #FAFAF5;
  --bg-white: #FFFFFF;
  --text-dark: #2D3436;
  --text-medium: #636E72;
  --text-light: #B2BEC3;
  --border-soft: #E8E8E0;
  --border-card: #E0E0D8;

  /* Claymorphism shadows — outer glow + hard base */
  --shadow-card: 0 4px 0 rgba(0,0,0,0.10), 0 2px 12px rgba(0,0,0,0.08);
  --shadow-elevated: 0 8px 0 rgba(0,0,0,0.12), 0 4px 24px rgba(0,0,0,0.12);
  --shadow-btn: 0 5px 0 var(--leaf-green-dark);
  --shadow-btn-yellow: 0 5px 0 var(--sunny-yellow-dark);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-bounce: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
  /* Split easing tokens — avoids accidental duration+delay stacking */
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);

  /* Baloo 2 + Comic Neue — perfect for kids edu app (UI/UX Pro Max: Claymorphism) */
  --font-display: 'Baloo 2', 'Quicksand', sans-serif;
  --font-body: 'Comic Neue', 'Nunito Sans', sans-serif;

  /* Category Colors */
  --cat-animals: #4CAF50;
  --cat-colors: #FF9800;
  --cat-gaming: #673AB7;
  --cat-nature: #8BC34A;
  --cat-art: #E91E63;
  --cat-slang: #03A9F4;
  --cat-numbers: #FFC107;
  --cat-food: #FF7043;
  --cat-body: #AB47BC;
  --cat-clothes: #EC407A;
  --cat-family: #66BB6A;
  --cat-weather: #26C6DA;
  --cat-house: #8D6E63;
  --cat-transport: #78909C;
  --cat-school: #FFA726;
  --cat-feelings: #7E57C2;
  --cat-time: #26A69A;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* Touch: eliminate 300ms tap delay on all interactive elements */
button, .nav-item, .match-word, .match-image, .avatar-card, .reward-card, .lesson-card, .category-card, [onclick] {
  touch-action: manipulation;
  cursor: pointer;
}

/* Press scale: tactile feedback for kids */
button:active, .match-word:active, .match-image:active, .avatar-card:active, .reward-card:active {
  transform: scale(0.96);
  transition: transform 100ms ease;
}

/* Restore after press */
button, .match-word, .match-image, .avatar-card, .reward-card {
  transition: transform 200ms var(--ease-out-quart), box-shadow 200ms ease;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
  /* Excepción: float del ícono joint — animación suave permitida */
  .reward-card.major .reward-icon {
    animation-duration: 21s !important;
  }
}

body {
  font-family: var(--font-body);
  background: var(--bg-cream);
  color: var(--text-dark);
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.6;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; }

.screen {
  display: none;
  min-height: 100dvh;
  position: relative;
  z-index: 1;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 250ms var(--ease-out-quart),
              transform 250ms var(--ease-out-quart),
              display 250ms allow-discrete;
}
.screen.active {
  display: flex;
  z-index: 10;
  opacity: 1;
  transform: none;
}
@starting-style {
  .screen.active {
    opacity: 0;
    transform: translateY(10px);
  }
}

#screen-lesson.active { z-index: 2000; }
#screen-celebration.active { z-index: 3000; }

/* fadeIn keyframe removed — replaced by @starting-style */

/* --- Background Blobs --- */
.bg-blobs {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden;
}
.bg-blobs::before, .bg-blobs::after {
  content: ''; position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.15;
}
.bg-blobs::before {
  width: 400px; height: 400px; background: var(--leaf-green); top: -100px; left: -100px;
}
.bg-blobs::after {
  width: 350px; height: 350px; background: var(--sunny-yellow); bottom: -80px; right: -80px;
}

/* --- Claymorphic Button --- */
.btn-hero {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  padding: 14px 32px;
  border: 3px solid transparent;
  border-radius: var(--radius-lg);
  cursor: pointer;
  will-change: transform;
  transition: transform 150ms var(--ease-out-quart), box-shadow 150ms var(--ease-out-quart);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  letter-spacing: 0.01em;
}
.btn-hero:active { transform: translateY(4px); }

.btn-green {
  background: var(--leaf-green);
  color: white;
  border-color: var(--leaf-green-dark);
  box-shadow: var(--shadow-btn);
}
.btn-green:hover { background: #43A047; }
.btn-green:active { box-shadow: 0 1px 0 var(--leaf-green-dark); }

.btn-yellow {
  background: var(--sunny-yellow);
  color: var(--text-dark);
  border-color: var(--sunny-yellow-dark);
  box-shadow: var(--shadow-btn-yellow);
}
.btn-yellow:hover { background: #FFB300; }
.btn-yellow:active { box-shadow: 0 1px 0 var(--sunny-yellow-dark); }
.btn-sky {
  background: var(--sky-blue);
  color: white;
  border-color: #0288D1;
  box-shadow: 0 5px 0 #0288D1;
}
.btn-sky:hover { background: #039BE5; }
.btn-sky:active { box-shadow: 0 1px 0 #0288D1; }

.btn-outline {
  background: var(--bg-white);
  color: var(--text-dark);
  border: 2px solid var(--border-soft);
  box-shadow: 0 3px 0 var(--border-soft);
}
.btn-outline:active { box-shadow: 0 1px 0 var(--border-soft); }

.btn-sm { font-size: 0.9rem; padding: 8px 16px; }
.btn-xs { 
  font-size: 0.65rem !important; 
  padding: 3px 8px !important; 
  border-radius: var(--radius-sm); 
  box-shadow: 0 2px 0 var(--border-soft);
  min-width: 0;
  min-height: 44px; /* touch target ≥44px */
  white-space: nowrap;
  gap: 4px;
}
.btn-block { width: 100%; }
.flex-1 { flex: 1; }
.btn-icon { font-size: 1.2em; }

/* --- Card Claymorphism --- */
.card {
  background: var(--bg-white);
  border: 3px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-normal), transform var(--transition-fast);
}
.card:hover {
  transform: translateY(-3px);
}
.card-highlight {
  border-color: var(--sunny-yellow);
  background: var(--sunny-yellow-light);
  border-width: 3px;
}

/* --- Avatar --- */
.avatar-circle {
  width: 80px; height: 80px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem;
  border: 3px solid var(--border-card);
  background: var(--bg-white);
  transition: transform var(--transition-bounce), color var(--transition-fast);
  cursor: pointer;
}
.avatar-circle:hover { transform: scale(1.08); }
.avatar-circle.selected {
  border-color: var(--leaf-green);
  box-shadow: 0 0 0 3px var(--leaf-green-light);
}

/* --- Progress Bar --- */
.progress-bar {
  height: 20px;
  background: #E8E8E0;
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--leaf-green), #66BB6A);
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}
.progress-fill::after {
  content: ''; position: absolute;
  top: 3px; left: 8px; right: 8px; height: 6px;
  background: rgba(255,255,255,0.3);
  border-radius: var(--radius-full);
}
.progress-star {
  position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 1.2rem; z-index: 2;
}

/* --- Sidebar --- */
.layout-app { 
  display: flex; 
  flex: 1;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  position: relative;
}

.sidebar { display: none !important; }


.sidebar-profile {
  text-align: center;
  padding-bottom: 14px;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--border-soft);
}
.sidebar-profile .avatar-circle {
  margin: 0 auto 6px;
  width: 64px; height: 64px; font-size: 1.8rem;
}
.sidebar-profile h3 { font-size: 0.95rem; color: var(--text-dark); }
.sidebar-profile small { color: var(--text-medium); font-size: 0.8rem; }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-medium);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: var(--bg-cream); color: var(--text-dark); }
.nav-item.active {
  background: var(--sunny-yellow);
  color: var(--text-dark);
  font-weight: 700;
  border-radius: var(--radius-md);
}
.nav-item .nav-icon { font-size: 1.3rem; width: 24px; text-align: center; }

.content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100dvh;
  overflow: hidden;
  position: relative;
  background: var(--bg-cream);
  z-index: 1;
}

.main-content {
  flex: 1;
  padding: 20px 28px 32px;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  scroll-behavior: smooth;
}

#ptab-rewards { margin: 0 20px 20px; padding: 0; width: auto; }

/* #tab-home handled by .home-dashboard */






.progress-card {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 20px;
  border-radius: var(--radius-xl);
  border-width: 2px;
  background: var(--bg-white);
}

#map-title {
  font-weight: 800;
  color: var(--leaf-green);
  letter-spacing: -0.01em;
}



.dashboard-avatar-mini {
  border-color: var(--sunny-yellow);
  box-shadow: 0 4px 0 var(--sunny-yellow-dark);
}

/* ============================================
   TOPBAR PROFILE PILL — visible solo en tablet
   ============================================ */
.topbar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.topbar-profile .avatar-circle-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--sunny-yellow);
  border: 2px solid var(--sunny-yellow-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.topbar-profile-name {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-dark);
  line-height: 1.1;
}
.topbar-profile-level {
  font-size: 0.72rem;
  color: var(--text-medium);
}

/* Bottom nav — reemplazada por topbar-nav, siempre oculta */
.bottom-nav { display: none !important; }

/* ============================================
   TABLET (≤768px) — topbar compacto
   ============================================ */
@media (max-width: 768px) {
  .topbar { padding: 6px 12px; gap: 6px; }
  .topbar-brand { font-size: 0.9rem; }
  .topbar-daily { display: none; }
  .topbar-nav .nav-item { padding: 6px 8px; font-size: 0.75rem; }
  .main-content { padding: 14px 14px 24px; }
  #ptab-rewards { overflow-x: auto; padding: 0; }
  .home-dashboard { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .home-col-left { border-right: none; border-bottom: 2px solid var(--border-soft); max-height: 40dvh; }
}

/* ============================================
   DESKTOP (≥1025px)
   ============================================ */
@media (min-width: 1025px) {
  .main-content { padding: 24px 32px 32px; max-width: none; }
  .topbar { padding: 8px 28px; }
}

@media (min-width: 1600px) {
  .main-content { padding: 28px 40px 36px; }
}


/* --- Top Bar --- */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
  z-index: 50;
  width: 100%;
  min-height: 46px;
}

/* Brand — solo icono + texto corto */
.topbar-brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  color: var(--leaf-green-dark);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Perfil — solo avatar, sin texto */
.topbar-profile { gap: 0; }
.topbar-profile > div:last-child { display: none; } /* oculta nombre/nivel */
.topbar-profile .avatar-circle-sm {
  width: 30px;
  height: 30px;
  font-size: 1rem;
}

/* Nav inside topbar */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  justify-content: center;
}

/* Botones icon-only */
.topbar-nav .nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: var(--radius-md);
  font-size: 1.2rem;
  color: var(--text-medium);
  background: none;
  border: none;
  cursor: pointer;
  width: 50px;
  height: 50px;
  flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
  touch-action: manipulation;
}
.topbar-nav .nav-item .nav-label { display: none; } /* solo icono */
.topbar-nav .nav-item:hover {
  background: var(--bg-cream);
  color: var(--text-dark);
  transform: translateY(-1px);
}
.topbar-nav .nav-item.active {
  background: var(--sunny-yellow);
  color: var(--text-dark);
  box-shadow: 0 2px 0 var(--sunny-yellow-dark);
}

/* Stats — compactas */
.topbar-stats {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Barra de meta — compacta */
.topbar-daily {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 120px;
  margin: 0 4px;
}
.topbar-daily-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-medium);
  white-space: nowrap;
}
.topbar-daily-bar {
  flex: 1;
  height: 6px;
  background: var(--border-soft);
  border-radius: 99px;
  overflow: hidden;
}
.topbar-daily-bar .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sunny-yellow), var(--playful-orange));
  border-radius: 99px;
  transition: width 0.4s ease;
}
.stat-pill {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 10px;
  border: 2px solid var(--border-soft);
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.82rem;
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
/* "Pop" animation triggered via JS by adding .stat-pop class */
.stat-pill.stat-pop {
  animation: stat-pop 350ms var(--ease-bounce);
}
@keyframes stat-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}
/* Streak pill turns orange when racha ≥ 3 (add .streak-hot class via JS) */
#stat-streak-pill.streak-hot {
  background: rgba(255, 107, 53, 0.12);
  border-color: var(--playful-orange);
  color: var(--playful-orange);
}

/* --- Lesson Screen --- */
.lesson-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: var(--bg-white);
  border-bottom: 2px solid var(--border-soft);
}
.lesson-progress { flex: 1; }
.lesson-hearts { display: flex; align-items: center; gap: 4px; color: var(--ruby-red); font-weight: 700; }
.lesson-close {
  background: none; border: none; font-size: 1.5rem;
  cursor: pointer; color: var(--text-light);
  /* Touch target ≥44px (impeccable) */
  min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
}
.lesson-close:hover { color: var(--text-dark); }

.lesson-body {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 24px;
  text-align: center;
}

@media (min-width: 1440px) {
  .lesson-body { max-width: 1200px; padding: 60px 40px; }
  .lesson-title { font-size: 3.5rem; }
  .lesson-subtitle { font-size: 1.8rem; }
  .match-word, .match-image { padding: 40px; font-size: 2.2rem; }
  .match-image .emoji { font-size: 6rem; }
  .lesson-mascot { padding: 32px 48px; border-radius: var(--radius-xl); }
  .lesson-mascot .mascot-icon { font-size: 5rem; }
  .lesson-mascot p { font-size: 1.6rem; }
}

@media (min-width: 1900px) {
  .lesson-body { max-width: 1500px; padding: 100px 60px; }
  .match-grid { gap: 32px; }
  .lesson-title { font-size: 4.5rem; }
  .lesson-subtitle { font-size: 2.2rem; }
}
.lesson-title { font-size: 1.6rem; margin-bottom: 8px; }
.lesson-subtitle { color: var(--text-medium); margin-bottom: 32px; }

.match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 32px;
}

/* Continue & Review cards */
.continue-heading {
  font-weight: 700;
  color: #fff;
  margin: 24px 0 12px;
}

.home-cta-section {
  margin-top: 0;
}
.continue-card, .review-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  max-width: 600px;
  background: var(--leaf-green);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: transform var(--transition-bounce), box-shadow 250ms var(--ease-out-quart);
  box-shadow: 0 4px 16px rgba(76, 175, 80, 0.3);
  overflow: hidden;
}
.continue-card:hover {
  transform: translateY(-3px);
}
.continue-card:active {
  transform: translateY(0);
}
.continue-glow {
  display: none;
}
.continue-done {
  background: var(--leaf-green-dark);
  box-shadow: 0 4px 16px rgba(56, 142, 60, 0.3);
  cursor: default;
}
.continue-done:hover {
  transform: none;
  box-shadow: 0 4px 16px rgba(56, 142, 60, 0.3);
}
.continue-icon {
  font-size: 1.8rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.continue-text { flex: 1; }
.continue-title {
  font-weight: 800;
  font-size: 2.1rem;
  color: #fff;
}
.continue-sub {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
  margin-top: 2px;
}
.continue-arrow {
  font-size: 1.3rem;
  color: rgba(255,255,255,0.8);
  flex-shrink: 0;
}
.continue-card:hover .continue-arrow {
  animation: arrowPulse 1s ease-in-out infinite;
}
@keyframes arrowPulse {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(6px); }
}

.review-card {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  box-shadow: 0 4px 20px rgba(245, 87, 108, 0.3);
  border: none;
  margin-top: 12px;
}
.review-card:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 8px 30px rgba(245, 87, 108, 0.45);
}
.review-icon {
  font-size: 1.5rem;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.review-text { flex: 1; }
.review-title {
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.review-sub {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.8);
  margin-top: 2px;
}
.review-arrow {
  font-size: 1.5rem;
  color: rgba(255,255,255,0.7);
  flex-shrink: 0;
}
.review-card:hover .review-arrow {
  animation: arrowPulse 1s ease-in-out infinite;
}

.listen-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 360px;
  margin: 0 auto;
  padding: 40px 24px;
  background: var(--bg-white);
  border: 3px solid var(--border-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}
.listen-emoji {
  font-size: 5rem;
  line-height: 1;
  animation: float 2s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.listen-word {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-dark);
}
.listen-es {
  font-size: 1rem;
  color: var(--text-light);
  margin-bottom: 8px;
}
.btn-listen {
  background: var(--sky-blue-light);
  color: var(--sky-blue);
  border: 2px solid var(--sky-blue);
  font-size: 1.1rem;
  padding: 12px 32px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: transform var(--transition-bounce), background var(--transition-fast), border-color var(--transition-fast);
  font-weight: 700;
  width: 100%;
}
.btn-listen:hover {
  background: var(--sky-blue);
  color: #fff;
  transform: scale(1.03);
}
.btn-said {
  width: 100%;
}
.btn-said:disabled {
  opacity: 0.7;
  cursor: default;
  transform: none;
}
.btn-record {
  background: #7C4DFF;
  color: #fff;
  border: 2px solid #651FFF;
  font-size: 1.1rem;
  padding: 12px 32px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: transform var(--transition-bounce), background var(--transition-fast), border-color var(--transition-fast);
  font-weight: 700;
  width: 100%;
}
.btn-record:hover {
  background: #651FFF;
  transform: scale(1.03);
}
.btn-record:disabled {
  opacity: 0.7;
  cursor: default;
  transform: none;
}
.listen-feedback {
  font-size: 1rem;
  color: var(--text-medium);
  text-align: center;
  min-height: 24px;
  margin-top: 4px;
}
.match-word, .match-image {
  padding: 20px;
  min-height: 60px; /* touch target ≥44px per HIG */
  border: 3px solid var(--border-card);
  border-radius: var(--radius-lg);
  background: var(--bg-white);
  cursor: pointer;
  transition: transform var(--transition-bounce), box-shadow var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  user-select: none;
  box-shadow: 0 3px 0 var(--border-card);
}
.match-word:hover, .match-image:hover {
  border-color: var(--sky-blue);
  transform: scale(1.03) translateY(-1px);
  box-shadow: 0 5px 0 #0288D1;
}
.match-word.selected, .match-image.selected {
  border-color: var(--sky-blue);
  background: var(--sky-blue-light);
  box-shadow: 0 3px 0 #0288D1;
  animation: card-select-pop 250ms var(--ease-bounce);
}
@keyframes card-select-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(0.95); }
  70%  { transform: scale(1.06); }
  100% { transform: scale(1.02); }
}
.match-word.correct, .match-image.correct {
  border-color: var(--leaf-green);
  background: var(--leaf-green-bg);
  box-shadow: 0 3px 0 var(--leaf-green-dark);
  animation: card-correct-bounce 400ms var(--ease-bounce);
}
@keyframes card-correct-bounce {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.1) rotate(-2deg); }
  60%  { transform: scale(1.05) rotate(1deg); }
  100% { transform: scale(1); }
}
.match-word.incorrect, .match-image.incorrect {
  border-color: var(--ruby-red);
  background: var(--ruby-red-light);
  box-shadow: 0 3px 0 #c0392b;
  animation: shake 0.4s ease;
}
.match-image .emoji { font-size: 3rem; }

/* --- Speak / Pronunciación --- */
.speak-container {
  display: flex; flex-direction: column; align-items: center;
  gap: 16px; padding: 24px;
}
.speak-emoji {
  font-size: 6rem; line-height: 1;
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.speak-spanish {
  font-size: 1.5rem; font-weight: 700; color: var(--text-dark);
}
.speak-target { display: none; }
.speak-btn {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--leaf-green); border: 4px solid var(--leaf-green-dark);
  font-size: 3rem; cursor: pointer; transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(76,175,80,.3);
}
.speak-btn:hover { transform: scale(1.05); }
.speak-btn:active { transform: scale(0.95); }
.speak-btn:disabled { opacity: 0.6; cursor: default; transform: none; }
.speak-btn.listening {
  animation: pulse 1s ease-in-out infinite;
  background: var(--playful-orange);
  border-color: #E65100;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,152,0,.4); }
  50% { box-shadow: 0 0 0 24px rgba(255,152,0,0); }
}
.speak-status {
  font-size: 0.9rem; color: var(--text-light); font-weight: 600;
  text-align: center;
}
.speak-result {
  font-size: 1.1rem; font-weight: 700; padding: 12px 20px;
  border-radius: var(--radius-lg); text-align: center;
  opacity: 0; transition: opacity 0.3s;
}
.speak-result.visible { opacity: 1; }
.speak-result.correct { background: #E8F5E9; color: #2E7D32; }
.speak-result.incorrect { background: #FFEBEE; color: #C62828; }
.speak-fallback { width: 100%; max-width: 320px; }
.speak-input {
  width: 100%; padding: 14px 20px; font-size: 1.2rem;
  border: 2px solid var(--border-soft); border-radius: var(--radius-lg);
  text-align: center; font-weight: 700;
  transition: border-color 0.2s;
}
.speak-input:focus { border-color: var(--leaf-green); outline: none; }
.speak-input.correct { border-color: var(--leaf-green); background: #E8F5E9; }
.speak-input.incorrect { border-color: #E53935; background: #FFEBEE; }
.speak-input.hidden { display: none; }

.lesson-mascot {
  display: flex; align-items: center; gap: 12px;
  background: #F5F5F0; border-radius: var(--radius-xl);
  padding: 16px 20px; margin-bottom: 24px;
  text-align: left;
}
.lesson-mascot .mascot-icon { font-size: 2.5rem; }
.lesson-mascot p { color: var(--text-medium); font-size: 0.95rem; }

.lesson-actions {
  display: flex; gap: 16px; justify-content: center;
  padding: 20px 24px;
  border-top: 2px solid var(--border-soft);
  background: var(--bg-white);
  position: sticky; bottom: 0;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* --- Welcome / Login Screens --- */
.screen-center {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  position: relative;
  z-index: 1;
}
.welcome-logo {
  font-size: 5rem;
  margin-bottom: 16px;
  filter: drop-shadow(0 6px 0 rgba(0,0,0,0.15));
  animation: welcomeBounce 2s ease-in-out infinite;
}
@keyframes welcomeBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@media (prefers-reduced-motion: reduce) {
  .welcome-logo { animation: none; }
}
.welcome-title {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--leaf-green-dark);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
@media (min-width: 1440px) {
  .welcome-logo { font-size: 8rem; }
  .welcome-title { font-size: 5rem; }
  .welcome-sub { font-size: 2rem; margin-bottom: 40px; }
  .btn-hero { padding: 20px 48px; font-size: 1.4rem; }
}

/* Avatar Grid */
.avatar-grid {
  display: flex; gap: 16px; justify-content: center;
  flex-wrap: wrap; margin-bottom: 32px;
}
@media (min-width: 1440px) {
  .avatar-card { padding: 40px 60px; min-width: 280px; border-radius: var(--radius-xl); }
  .avatar-card .avatar-emoji { font-size: 7rem; }
  .avatar-card .avatar-name { font-size: 2rem; margin-top: 16px; }
}
.avatar-card {
  position: relative;
  box-shadow: 0 4px 0 var(--border-card);
}
.avatar-card:hover {
  transform: translateY(-5px) scale(1.04);
  box-shadow: 0 8px 0 var(--leaf-green);
  border-color: var(--leaf-green);
}
.avatar-card.selected {
  border-color: var(--leaf-green);
  background: var(--leaf-green-bg);
  box-shadow: 0 4px 0 var(--leaf-green-dark);
  transform: scale(1.02);
  animation: avatar-select 350ms var(--ease-bounce);
}
@keyframes avatar-select {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.08); }
  100% { transform: scale(1.02); }
}
/* Unselected avatars: subtle desaturation to focus attention */
.avatar-card:not(.selected) {
  filter: saturate(0.7);
  opacity: 0.85;
  transition: filter 200ms ease, opacity 200ms ease;
}
.avatar-card.selected,
.avatar-card:hover {
  filter: saturate(1);
  opacity: 1;
}
.avatar-card .avatar-emoji { font-size: 3.2rem; }
.avatar-card .avatar-name { font-family: var(--font-display); font-weight: 800; }
.avatar-card .avatar-check {
  position: absolute; top: -8px; right: -8px;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--leaf-green); color: white;
  border: 3px solid white;
  display: none; align-items: center; justify-content: center;
  font-size: 0.75rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.avatar-card.selected .avatar-check { display: flex; }

.avatar-card-add {
  border-style: dashed;
  color: var(--text-light);
}
.avatar-card-add .avatar-emoji { font-size: 2rem; color: var(--text-light); }

/* PIN Entry */
.pin-section {
  background: #F0F0EA;
  border-radius: var(--radius-xl);
  padding: 28px;
  max-width: 380px;
  width: 100%;
  margin-bottom: 32px;
}
.pin-section h3 { font-size: 1rem; margin-bottom: 16px; color: var(--text-medium); }
.pin-dots {
  display: flex; gap: 12px; justify-content: center; margin-bottom: 20px;
}
.pin-dot {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border-card);
  background: var(--bg-white);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  transition: transform var(--transition-bounce), background var(--transition-fast), border-color var(--transition-fast);
}
.pin-dot.filled {
  border-color: var(--leaf-green);
  background: var(--leaf-green-light);
  transform: scale(1.1);
}
.pin-icons {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  max-width: 260px; margin: 0 auto;
}
.pin-icon-btn {
  width: 72px; height: 72px;
  border: 2px solid var(--border-card);
  border-radius: var(--radius-md);
  background: var(--bg-white);
  font-size: 1.6rem;
  cursor: pointer;
  transition: transform var(--transition-bounce), border-color var(--transition-fast);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
}
.pin-icon-btn:hover { border-color: var(--leaf-green); transform: scale(1.08); }
.pin-icon-btn:active { transform: scale(0.95); }

/* --- Map Nodes --- */
.learning-map {
  position: relative;
  width: 100%;
  height: 70vh;
  max-height: 800px;
  background: #fdfdf9;
  border: 8px solid #e2e8f0;
  border-radius: 24px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  box-shadow: 
    inset 0 4px 12px rgba(0,0,0,0.05),
    0 10px 30px rgba(0,0,0,0.04);
  scroll-behavior: smooth;
}

/* Custom Scrollbar for Map */
.learning-map::-webkit-scrollbar {
  width: 12px;
}
.learning-map::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
}
.learning-map::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
  border: 3px solid #f1f5f9;
}
.learning-map::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.map-inner {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  background-image: url('/mapa-lecciones.jpg');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  aspect-ratio: 1827 / 3184;
}

.section-divider {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  margin: 9px 0;
}

#tab-home h3 {
  font-weight: 900;
  letter-spacing: 0.5px;
}

/* --- Trip Milestones Modal --- */
.trip-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.trip-modal-overlay.hidden { display: none; }

.trip-modal-content {
  background: #fff;
  border-radius: 28px;
  padding: 50px 44px 40px;
  max-width: 780px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.trip-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border: none;
  background: #f0f0f0;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  transition: background 0.15s;
}
.trip-modal-close:hover { background: #e0e0e0; }

/* Light milestone panel inside modal */
.tmi-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
}
.tmi-header h3 {
  font-size: 1.75rem;
  font-weight: 800;
  color: #2d3436;
  margin: 0;
}
.tmi-header .text-muted { font-size: 1.1rem; color: #777; }
.tmi-icon { font-size: 3.8rem; }
.tmi-done {
  margin-left: auto;
  font-weight: 800;
  color: #2ecc71;
  font-size: 1.2rem;
}

.tmi-section-title {
  font-weight: 700;
  font-size: 1.25rem;
  color: #888;
  margin-bottom: 14px;
  margin-top: 28px;
  letter-spacing: 0.5px;
}
.tmi-section-title:first-of-type { margin-top: 0; }

.tmi-profiles {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tmi-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 20px;
  padding: 18px 22px;
}
.tmi-avatar {
  font-size: 2.5rem;
  width: 62px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e9ecef;
  border-radius: 50%;
  flex-shrink: 0;
}
.tmi-info { flex: 1; min-width: 0; }
.tmi-name {
  font-weight: 700;
  font-size: 1.4rem;
  color: #2d3436;
  margin-bottom: 4px;
}
.tmi-stats {
  display: flex;
  gap: 18px;
  font-size: 1.15rem;
  color: #555;
}
.tmi-stats span { white-space: nowrap; }

.tmi-bars {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.tmi-bar-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.tmi-bar-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: #666;
  width: 180px;
  flex-shrink: 0;
}
.tmi-bar-track {
  flex: 1;
  height: 20px;
  background: #e9ecef;
  border-radius: 999px;
  overflow: hidden;
}
.tmi-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s ease;
}
.tmi-bar-stars { background: linear-gradient(90deg, #fdc830, #f37335); }
.tmi-bar-streak { background: linear-gradient(90deg, #ff6b6b, #ee5a24); }
.tmi-bar-miles { background: linear-gradient(90deg, #2ecc71, #1abc9c); }
.tmi-bar-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: #555;
  width: 220px;
  text-align: right;
  flex-shrink: 0;
}
.tmi-bar-detail {
  font-size: 0.8rem;
  color: #999;
  text-align: right;
  margin-top: -12px;
  padding-right: 2px;
}

@media (max-width: 600px) {
  .trip-modal-content { padding: 36px 20px 28px; }
  .tmi-bar-row { flex-wrap: wrap; }
  .tmi-bar-label { width: 100%; }
  .tmi-bar-value { width: auto; }
}

/* --- Reward Editor Form --- */
#reward-editor-overlay .trip-modal-content { max-width: 520px; }
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 5px;
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #ddd;
  border-radius: 12px;
  font-size: 1rem;
  background: #fafafa;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.form-input:focus {
  outline: none;
  border-color: var(--sky-blue);
  background: #fff;
}
.form-row {
  display: flex;
  gap: 14px;
}
.form-row .form-group { flex: 1; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 500;
  color: #444;
}
.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--sky-blue);
}
.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}
.form-actions .btn-hero { min-width: 120px; }

.map-svg-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.map-svg-overlay path {
  fill: none;
  stroke-width: 0.8; /* percentage-based width relative to viewBox */
  stroke-linecap: round;
  transition: stroke 0.5s ease;
}

.map-svg-overlay path.path-locked {
  stroke: #cbd5e1;
  stroke-dasharray: 0.8, 1.2;
}

.map-svg-overlay path.path-unlocked {
  stroke: #60a5fa; /* vibrant sky blue */
  stroke-width: 1.0;
}

.map-svg-overlay path.path-completed {
  stroke: #34d399; /* vibrant mint green */
  stroke-width: 1.2;
}

/* Level Badges */
.map-level-badge {
  position: absolute;
  transform: translate(-50%, 50%);
  z-index: 3;
  pointer-events: none;
}

.badge-wood-label {
  display: inline-block;
  background: linear-gradient(135deg, #78350f, #451a03); /* Rich wood textures */
  color: #fef08a; /* Golden text */
  font-family: var(--font-display), sans-serif;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 6px 12px;
  border-radius: 8px;
  border: 2px solid #fbbf24; /* gold trim */
  box-shadow: 
    inset 0 1px 3px rgba(255,255,255,0.2),
    0 4px 0 #1c0a00,
    0 6px 10px rgba(0,0,0,0.3);
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  letter-spacing: 0.5px;
}

/* Map Trophy */
.map-trophy {
  position: absolute;
  bottom: 96.5%;
  left: 50%;
  transform: translate(-50%, 50%);
  font-size: 3.5rem;
  z-index: 10;
  cursor: pointer;
  filter: drop-shadow(0 4px 10px rgba(250, 204, 21, 0.5));
  animation: bob-trophy 3s ease-in-out infinite;
  transition: transform 0.3s var(--ease-bounce), opacity 0.3s ease;
}

.map-trophy:hover {
  transform: translate(-50%, 50%) scale(1.2);
  filter: drop-shadow(0 8px 20px rgba(250, 204, 21, 0.8));
}

@keyframes bob-trophy {
  0% { transform: translate(-50%, 50%) translateY(0); }
  50% { transform: translate(-50%, 50%) translateY(-8px); }
  100% { transform: translate(-50%, 50%) translateY(0); }
}

/* Nodes Styling */
.map-nodes-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-node {
  position: absolute;
  transform: translate(-50%, 50%);
  z-index: 2;
  pointer-events: auto;
}

.map-node-btn {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: none;
  font-size: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s var(--ease-out-quart), background 0.15s ease, border-color 0.15s ease;
  position: relative;
}

/* 3D button press effect */
.map-node-btn:active:not([disabled]) {
  transform: translateY(4px);
}

/* Complete Node Styling: Gold with Crown */
.map-node-btn.node-complete {
  background: linear-gradient(145deg, #fbbf24, #d97706);
  box-shadow: 
    inset 0 3px 0 rgba(255,255,255,0.4),
    0 6px 0 #b45309,
    0 10px 16px rgba(180, 83, 9, 0.35);
  color: white;
}
.map-node-btn.node-complete:active:not([disabled]) {
  box-shadow: 
    inset 0 1px 0 rgba(255,255,255,0.2),
    0 2px 0 #b45309,
    0 4px 8px rgba(180, 83, 9, 0.35);
}

/* Active Node Styling: Vibrant Green with glowing pulse aura */
.map-node-btn.node-active {
  background: linear-gradient(145deg, #22c55e, #15803d);
  box-shadow: 
    inset 0 3px 0 rgba(255,255,255,0.4),
    0 6px 0 #166534,
    0 10px 20px rgba(22, 163, 74, 0.4);
  color: white;
}
.map-node-btn.node-active:active:not([disabled]) {
  box-shadow: 
    inset 0 1px 0 rgba(255,255,255,0.2),
    0 2px 0 #166534,
    0 4px 10px rgba(22, 163, 74, 0.4);
}

/* Active Glowing Aura Ripple */
.map-node-btn.node-active::before {
  content: '';
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border-radius: 50%;
  border: 4px solid #22c55e;
  opacity: 0;
  animation: active-pulse 2s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}

@keyframes active-pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.18); opacity: 0; }
  100% { transform: scale(1.18); opacity: 0; }
}

/* Locked Node Styling: Gray with Padlock */
.map-node-btn.node-locked {
  background: linear-gradient(145deg, #cbd5e1, #94a3b8);
  box-shadow: 
    inset 0 3px 0 rgba(255,255,255,0.2),
    0 6px 0 #64748b,
    0 4px 6px rgba(0,0,0,0.1);
  color: #f1f5f9;
  cursor: not-allowed;
}

/* Speech-Bubble Labels styling */
.map-node-label {
  position: absolute;
  top: 84px; /* sits below the 76px button */
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 6px 12px;
  color: var(--text-dark);
  font-family: var(--font-display), sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1.25;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  pointer-events: none;
  z-index: 5;
  text-align: center;
}

.map-node-label::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: white;
}

.map-node-label::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-bottom-color: #e2e8f0;
  z-index: -1;
}

#tab-map {
   display: flex;
   flex-direction: column;
   height: 100%;
   overflow: hidden; /* learning-map will handle inner scrolling now */
}

/* --- Celebration Screen --- */
.celebration-screen {
  background: var(--sunny-yellow-light);
  position: relative;
  overflow: hidden;
}
.celebration-card {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  padding: 40px;
  text-align: center;
  max-width: 420px;
  box-shadow: var(--shadow-elevated);
  z-index: 2;
  position: relative;
  transform: scale(1);
  opacity: 1;
  transition: transform 400ms var(--ease-bounce), opacity 300ms ease;
}

@starting-style {
  .celebration-card {
    transform: scale(0.7);
    opacity: 0;
  }
}


@media (min-width: 1440px) {
  .celebration-card { max-width: 700px; padding: 60px; }
  .celebration-mascot { font-size: 8rem; }
  .celebration-title { font-size: 3.5rem; }
  .celebration-sub { font-size: 1.8rem; }
  .celebration-badge { padding: 12px 24px; font-size: 1.2rem; }
}

.celebration-mascot { font-size: 5rem; margin-bottom: 16px; }
.celebration-title {
  font-size: 2rem; color: var(--leaf-green-dark); margin-bottom: 8px;
}
.celebration-sub { font-size: 1.2rem; color: var(--text-medium); margin-bottom: 20px; }
.celebration-badges { display: flex; gap: 12px; justify-content: center; margin-bottom: 24px; }
.celebration-badge {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex; align-items: center; gap: 6px;
}
.badge-xp { background: var(--sunny-yellow-light); border: 2px solid var(--sunny-yellow); color: var(--text-dark); }
.badge-streak { background: #F0F0EA; border: 2px solid var(--border-card); color: var(--text-dark); }

/* Confetti */
.confetti-piece {
  position: absolute;
  width: 10px; height: 10px;
  border-radius: 2px;
  animation: confettiFall 3s ease-in-out infinite;
}
@keyframes confettiFall {
  0% { transform: translateY(-100dvh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100dvh) rotate(720deg); opacity: 0; }
}

/* --- Palacio de Premios --- */
.palacio-container {
  padding-bottom: 40px;
}

.palacio-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
}

.palacio-title-group h2 {
  font-size: 2.2rem;
  color: var(--leaf-green-dark);
  margin-bottom: 4px;
}

.palacio-title-group p {
  color: var(--text-medium);
  font-size: 1.1rem;
}

.stars-badge-premium {
  background: linear-gradient(135deg, #8B6B00 0%, #5D4700 100%);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(255,255,255,0.1);
}

.stars-badge-premium .star-icon-circle {
  width: 40px;
  height: 40px;
  background: var(--sunny-yellow);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.stars-badge-premium .stars-label {
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  opacity: 0.8;
  display: block;
}

.stars-badge-premium .stars-value {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}

/* Major Adventure Card */
.adventure-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  color: #8B4513;
  margin-bottom: 24px;
}

.cost-pill {
  background: var(--sunny-yellow-light);
  color: #8B6B00;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-weight: 800;
  border: 2px solid var(--sunny-yellow);
  font-size: 1.1rem;
}

.requirement-grids {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.requirement-box {
  background: rgba(0, 0, 0, 0.03);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

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

.req-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-medium);
  text-transform: uppercase;
}

.req-value {
  font-weight: 800;
  color: var(--text-dark);
  font-size: 1rem;
}

.major-adventure-card {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  border: 2px solid var(--border-card);
  padding: 24px;
  display: flex;
  gap: 24px;
  margin-bottom: 32px;
  position: relative;
  box-shadow: 0 8px 0 var(--border-card);
  transition: transform 0.2s var(--ease-bounce), box-shadow 0.2s var(--ease-out-quart);
}

.major-adventure-card:hover {
  transform: translateY(-4px);
}

.major-adventure-card .adventure-image-container {
  flex-shrink: 0;
  width: 240px;
  height: 240px;
  background: #FFD700;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6rem;
  border: 6px solid #FFF;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.epic-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(139, 69, 19, 0.8);
  backdrop-filter: blur(4px);
  color: white;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.adventure-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.adventure-content h3 {
  font-size: 2rem;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.adventure-content p {
  color: var(--text-medium);
  margin-bottom: 24px;
  font-size: 1rem;
  line-height: 1.4;
}

/* Weekly Streak Progress */
.weekly-streak-container {
  background: rgba(220, 220, 210, 0.4);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  flex-grow: 1;
}

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

.streak-header .streak-title {
  font-weight: 700;
  color: var(--text-dark);
  font-size: 0.95rem;
}

.streak-header .streak-progress-text {
  font-weight: 800;
  color: #2D5A27;
  font-size: 1.1rem;
}

.streak-circles, .milestone-circles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  position: relative;
  z-index: 2;
}

.streak-circle, .milestone-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #E8E8E2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #A0A090;
  border: 3px solid #D5D5D0;
  transition: transform 0.3s var(--ease-bounce), background 0.3s var(--ease-out-quart), color 0.15s ease;
  font-size: 0.8rem;
}

.streak-circle.done {
  background: var(--leaf-green);
  border-color: var(--leaf-green-dark);
  color: white;
}

.milestone-circle.done {
  background: var(--sunny-yellow);
  border-color: #E6B400;
  color: #8B6B00;
}

.streak-circle.active, .milestone-circle.active {
  background: white;
  border-color: var(--leaf-green);
  color: var(--leaf-green);
  transform: scale(1.1);
}

/* Mini version for cards */
.mini-streak-progress {
  margin-bottom: 16px;
}

.streak-circles.mini {
  gap: 4px;
}

.streak-circles.mini .streak-circle {
  width: 24px;
  height: 24px;
  border-width: 2px;
  font-size: 0.6rem;
}

.streak-circles.mini.mega-streak {
  gap: 3px;
  max-width: 320px;
  margin: 0 auto;
}

.streak-circles.mini.mega-streak .streak-circle {
  width: 18px;
  height: 18px;
  font-size: 0.5rem;
  border-width: 1.5px;
}

/* Favorite Rewards Grid */
.favorites-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  color: #C17F00;
  margin-bottom: 20px;
}

.favorites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.palacio-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border-card);
}

.favorite-reward-card {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  border: 3px solid var(--border-card);
  padding: 8px; /* Reduced padding for more image space */
  position: relative;
  transition: transform 0.2s var(--ease-bounce), box-shadow 0.2s var(--ease-out-quart);
  display: flex;
  flex-direction: column;
  box-shadow: 0 6px 0 var(--border-card);
  min-height: 160px; /* Slightly shorter to accommodate more on screen */
  justify-content: flex-start;
  gap: 8px;
}

.favorite-reward-card.locked {
  opacity: 0.7;
  filter: grayscale(0.5);
}

.favorite-reward-card.locked::after {
  content: '🔒';
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 1.2rem;
}

.favorite-reward-card.ready::before {
  content: '¡LISTO!';
  position: absolute;
  top: -10px;
  right: -10px;
  background: #8B6B00;
  color: white;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  font-size: 0.7rem;
  font-weight: 800;
  transform: rotate(10deg);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.favorite-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #F8F8F4;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6rem; /* Base size for the emoji */
  margin-bottom: 4px;
  border: 2px solid var(--border-card);
  position: relative;
  overflow: hidden;
  line-height: 1;
}

.favorite-image span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  transform: scale(1.6); /* Increased scale to fill the 1/1 box */
  line-height: 0;
}

.favorite-reward-card.ice_cream .favorite-image { background: #FFF9C4; }
.favorite-reward-card.park .favorite-image { background: #DCFCE7; }
.favorite-reward-card.movie .favorite-image { background: #F3E8FF; }
.favorite-reward-card.game .favorite-image { background: #E1F5FE; }
.favorite-reward-card.pool .favorite-image { background: #B3E5FC; }
.favorite-reward-card.camping .favorite-image { background: #D7CCC8; }
.favorite-reward-card.theme_park .favorite-image { background: #F8BBD0; }
/* Generic background for custom rewards */
.favorite-reward-card:not([class*=" "]) .favorite-image { background: #FFF8E1; }

.favorite-info h4 {
  font-size: 1rem;
  margin-bottom: 4px;
  color: var(--text-dark);
  font-weight: 800;
  line-height: 1.2;
}

.favorite-status {
  margin-top: auto;
}

.status-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 4px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-value {
  font-weight: 800;
  color: var(--leaf-green-dark);
  font-size: 0.9rem;
}

.status-star-icon {
  width: 24px;
  height: 24px;
  background: var(--sunny-yellow);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  border: 2px solid #E6B400;
}

.favorite-reward-card.locked-streak {
  opacity: 0.8;
  border-style: dashed;
}

.favorite-reward-card.locked-stars {
  opacity: 0.7;
}

.favorite-reward-card.locked-streak .favorite-image::after {
  content: '🔥';
  position: absolute;
  font-size: 2rem;
  filter: grayscale(1) opacity(0.5);
}

.favorite-reward-card.locked-stars .favorite-image::after {
  content: '🔒';
  position: absolute;
  font-size: 2rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

/* Responsive fixes */
@media (max-width: 768px) {
  .major-adventure-card {
    flex-direction: column;
    padding: 20px;
  }
  .major-adventure-card .adventure-image-container {
    width: 100%;
    height: 180px;
  }
  .palacio-header {
    flex-direction: column;
    gap: 16px;
  }
}

/* --- Badge Grid --- */
.badge-grid { 
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}

.badge-item {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  text-align: center;
  transition: transform 0.2s var(--ease-bounce), opacity 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
}

.badge-item::before {
  content: '';
  display: block;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff9c4, #ffd54f);
  border: 3px solid #ffb300;
  box-shadow: 0 4px 0 #ff8f00, 0 6px 12px rgba(255, 179, 0, 0.3);
  transition: transform 0.2s var(--ease-bounce), opacity 0.15s ease;
}

.badge-item.locked::before {
  background: linear-gradient(145deg, #e0e0e0, #bdbdbd);
  border-color: #9e9e9e;
  box-shadow: 0 4px 0 #757575, 0 6px 12px rgba(0,0,0,0.1);
  filter: grayscale(1);
  opacity: 0.7;
}

.badge-icon {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2rem;
  z-index: 1;
  pointer-events: none;
}

.badge-item.locked .badge-icon {
  filter: grayscale(1);
  opacity: 0.6;
}

.badge-name {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.1;
  max-width: 80px;
  text-align: center;
  margin-top: 4px;
}

.badge-item.locked .badge-name {
  opacity: 0.5;
}

/* --- Suggestions Grid --- */
.suggestions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 8px;
}
.suggestion-card {
  background: var(--bg-white);
  border: 2px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  box-shadow: 0 4px 0 var(--border-card);
  transition: transform 0.2s var(--ease-bounce), box-shadow 0.2s var(--ease-out-quart);
}
.suggestion-card:nth-child(1) {
  background: linear-gradient(135deg, #ffd89b, #f7a072);
  border-color: #e8873e;
  box-shadow: 0 4px 0 #e8873e;
}
.suggestion-card:nth-child(2) {
  background: linear-gradient(135deg, #d4fc79, #96e6a1);
  border-color: #5cb85c;
  box-shadow: 0 4px 0 #5cb85c;
}
.suggestion-card:nth-child(3) {
  background: linear-gradient(135deg, #ffecd2, #fcb69f);
  border-color: #f7a072;
  box-shadow: 0 4px 0 #f7a072;
}
.suggestion-card:nth-child(4) {
  background: linear-gradient(135deg, #d4fc79, #96e6a1);
  border-color: #6bcb7a;
  box-shadow: 0 4px 0 #6bcb7a;
}
.suggestion-card:hover {
  transform: translateY(-2px);
}
.suggestion-icon {
  font-size: 2rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.4);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}
.suggestion-text {
  color: #2d3436;
  font-weight: 600;
}
.suggestion-arrow {
  color: #636e72;
}
.suggestion-body {
  flex: 1;
  min-width: 0;
}
.suggestion-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-dark);
  margin-bottom: 4px;
}
.suggestion-desc {
  font-size: 0.8rem;
  color: var(--text-medium);
  margin-bottom: 10px;
  line-height: 1.3;
}
.suggestion-body .btn-hero.btn-sm {
  padding: 5px 14px;
  font-size: 0.75rem;
}

/* Progress tab rewards grid - same style as parent dashboard */
#tab-progress .rewards-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  margin-top: 24px;
}
#tab-progress .small-prizes-title {
  font-size: 1.1rem;
  margin-bottom: 12px;
  margin-top: 32px;
}

/* --- Parent Dashboard --- */
.child-card {
  display: flex; align-items: center; gap: 16px;
  padding: 16px;
  border: 2px solid var(--border-card);
  border-radius: var(--radius-lg);
  background: var(--bg-white);
}
.child-card .avatar-circle { width: 56px; height: 56px; font-size: 1.6rem; }
.child-info h4 { font-size: 1rem; }
.child-info .child-stars { color: var(--playful-orange); font-weight: 700; font-size: 0.85rem; }

.approval-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border: 2px solid var(--border-card);
  border-radius: var(--radius-md);
  background: var(--bg-white);
  margin-bottom: 8px;
}
.approval-info { display: flex; align-items: center; gap: 10px; }
.approval-info .approval-icon { font-size: 1.5rem; }

/* Toggle Switch */
.toggle {
  width: 48px; height: 26px;
  border-radius: var(--radius-full);
  background: #D5D5D0;
  cursor: pointer;
  position: relative;
  transition: background var(--transition-fast);
  border: none;
}
.toggle.on { background: var(--leaf-green); }
.toggle::after {
  content: '';
  position: absolute;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: white;
  top: 2px; left: 2px;
  transition: transform var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle.on::after { transform: translateX(22px); }

/* --- Parent PIN Input --- */
.parent-pin-inputs {
  display: flex; gap: 12px; justify-content: center; margin: 24px 0;
}
.parent-pin-inputs input {
  width: 52px; height: 60px;
  text-align: center;
  font-size: 1.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  border: 3px solid var(--border-card);
  border-radius: var(--radius-md);
  background: var(--bg-white);
  transition: border-color var(--transition-fast);
}
.parent-pin-inputs input:focus {
  outline: none;
  border-color: var(--leaf-green-dark);
}

.parent-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (min-width: 1440px) {
  .parent-stats-grid { gap: 40px; }
}

@media (min-width: 1900px) {
  .parent-stats-grid { gap: 80px; }
}

/* --- Utility --- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: 4px; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-green { color: var(--leaf-green-dark); }
.text-muted { color: var(--text-medium); }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* --- Responsive --- */

/* Desktop / PC */
@media (min-width: 1025px) {
  .main-content {
    max-width: none;
    margin: 0;
  }
}

/* Tablet Portrait (600x960) */
@media (max-width: 768px) {
  .main-content { width: 100%; max-width: 100%; }
  .match-grid { grid-template-columns: 1fr; }
  .avatar-grid { gap: 10px; }
  .avatar-card { min-width: 90px; padding: 12px; }
  .lesson-body { padding: 24px 16px; }
  .welcome-title { font-size: 1.8rem; }
}

/* Mobile (384x900) */
@media (max-width: 480px) {
  html { font-size: 14px; } /* Scale down base font for small mobile */
  .topbar-brand { font-size: 1.1rem; }
  .topbar-daily { gap: 6px; margin: 0 12px; max-width: none; }
  .topbar-daily-label { font-size: 0.7rem; }
  .topbar-daily-bar { height: 6px; }
  .stat-pill { padding: 4px 10px; font-size: 0.8rem; }
  .btn-hero { padding: 12px 20px; font-size: 1rem; }
  .welcome-logo { font-size: 3rem; }
  .avatar-card .avatar-emoji { font-size: 2.5rem; }
  .pin-dot { width: 36px; height: 36px; }
  .pin-icon-btn { width: 60px; height: 60px; font-size: 1.4rem; }
  .map-node-btn { width: 56px; height: 56px; }
}

/* Target Specific User Resolutions */
/* PC 1920 */
@media (min-width: 1900px) {
  .main-content { max-width: 1650px; padding: 60px 80px; }
  .card { padding: 40px; border-radius: var(--radius-xl); }
  .topbar { padding: 24px 60px; }
  .topbar-brand { font-size: 2.2rem; }
  .stat-pill { padding: 12px 24px; font-size: 1.2rem; gap: 10px; }
  h2 { font-size: 2.5rem; }
  p { font-size: 1.2rem; }
}

/* Tablet 960x600 / 600x960 */
@media (width: 960px) and (height: 600px) {
  /* Specific adjustments for 960x600 landscape if needed */
}

@media (width: 600px) and (height: 960px) {
  /* Specific adjustments for 600x960 portrait if needed */
}

/* Mobile 384x900 */
@media (max-width: 384px) {
  .welcome-title { font-size: 1.6rem; }
  .welcome-sub { font-size: 1rem; }
  .main-content { padding: 12px; }
  .stat-pill { font-size: 0.75rem; padding: 4px 8px; }
  .card { padding: 16px; }
  .nav-item { padding: 12px 10px; font-size: 0.85rem; }
}

/* --- Dashboard Header --- */
.dashboard-sticky-header {
  position: sticky;
  top: 70px;
  z-index: 100;
  background: var(--bg-cream);
  padding: 12px 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-soft);
}

.card.compact {
  padding: 12px 16px;
  margin-bottom: 0;
}

/* --- Rewards UI --- */
.rewards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 300px);
  gap: 20px;
  justify-content: center;
}

#home-rewards-grid {
  grid-template-columns: repeat(5, 1fr);
}

#parent-rewards-grid,
#parent-team-rewards-overview {
  grid-template-columns: repeat(9, 1fr);
  justify-content: stretch;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

#parent-rewards-grid .reward-card,
#parent-team-rewards-overview .reward-card {
  padding: 12px;
  height: auto;
  min-height: 280px;
  min-width: 0;
}

#parent-rewards-grid .streak-circles,
#parent-team-rewards-overview .streak-circles {
  display: none;
}

.reward-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-card);
  padding: 20px;
  text-align: center;
  transition: transform 0.2s var(--ease-bounce), box-shadow 0.2s var(--ease-out-quart);
  box-shadow: 0 4px 0 var(--border-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  height: 300px;
}

.reward-card.major {
  grid-column: span 2;
  grid-row: span 2;
  height: 600px;
  background: linear-gradient(145deg, #ffffff 0%, #e3f2fd 50%, #bbdefb 100%);
  border-color: var(--sky-blue);
  box-shadow: 0 12px 0 var(--sky-blue), 0 15px 30px rgba(3, 169, 244, 0.2);
  z-index: 5;
  padding: 40px;
  cursor: pointer;
}

.reward-card.major::before {
  content: '✨ GRAN PREMIO ✨';
  display: block;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--sky-blue);
  letter-spacing: 4px;
  opacity: 0.6;
  margin-bottom: 20px;
}

.reward-card.major.joint-slider {
  position: relative;
  padding: 16px 40px 20px;
  cursor: default;
}
.reward-card.major.joint-slider::before {
  content: '👫 PREMIOS EN EQUIPO';
}
.joint-slider-body {
  position: relative;
  height: 100%;
}
.joint-slide {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  cursor: pointer;
}
.joint-slide.active {
  display: flex;
}
.joint-slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.9);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sky-blue);
  transition: transform 0.15s var(--ease-out-quart), background 0.15s ease, box-shadow 0.15s ease;
}
.joint-slider-btn:hover {
  background: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transform: translateY(-50%) scale(1.1);
}
.joint-slider-prev { left: 8px; }
.joint-slider-next { right: 8px; }
.joint-slider-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}
.joint-slider-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  border: 2px solid rgba(255,255,255,0.8);
  cursor: pointer;
  transition: transform 0.15s var(--ease-out-quart), background 0.15s ease, border-color 0.15s ease;
}
.joint-slider-dot.active {
  background: white;
  border-color: white;
  transform: scale(1.3);
}

.reward-card.major .reward-icon {
  font-size: 9rem;
  margin-top: 0;
  filter: drop-shadow(0 10px 15px rgba(0,0,0,0.1));
  animation: float 21s ease-in-out infinite;
}

.reward-card.major .reward-name {
  margin-bottom: 0;
}

.reward-card.major .reward-cost {
  margin-top: 20px;
}

.reward-card.major .text-muted + .text-muted {
  margin-top: -8px;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

.reward-card.major .reward-name {
  font-size: 2.8rem;
  margin-bottom: 12px;
  color: var(--text-dark);
  text-shadow: 2px 2px 0 white;
}

.reward-card.major .reward-cost {
  font-size: 1.8rem;
  margin-bottom: 24px;
}

.reward-card.major .btn-hero {
  font-size: 1.4rem;
  padding: 20px;
}

.joint-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--playful-orange);
  color: white;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

@media (max-width: 600px) {
  .reward-grid, .rewards-grid {
    grid-template-columns: 1fr;
  }
  .reward-card.major {
    grid-column: span 1;
    grid-row: auto;
    min-height: auto;
    padding: 30px 20px;
  }
  .reward-card.major.joint-slider {
    padding: 30px 50px;
  }
  .joint-slider-btn {
    width: 36px;
    height: 36px;
    font-size: 1.5rem;
  }
  .reward-card.major .reward-icon {
    font-size: 6rem;
  }
  .reward-card.major .reward-name {
    font-size: 1.8rem;
  }
  .reward-card.major::before {
    top: 20px;
    font-size: 0.9rem;
  }
}

.reward.btn-hero:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--leaf-green-dark);
}

.btn-hero.btn-sm {
  padding: 6px 12px;
  font-size: 0.7rem;
  box-shadow: 0 3px 0 var(--leaf-green-dark);
}
.btn-hero.btn-sm:active {
  box-shadow: 0 1px 0 var(--leaf-green-dark);
}

.reward-card:hover {
  transform: translateY(-3px);
}

.reward-card.card-highlight {
  border-color: var(--sunny-yellow);
  background: var(--sunny-yellow-light);
}
.reward-card.joint-team {
  border-color: #ce93d8;
  background: #f3e5f5;
}
.reward-card.joint-team .joint-badge {
  background: #ab47bc;
}
.reward-card.suggestion {
  opacity: 0.6;
  filter: grayscale(0.3);
  border-style: dashed;
}
.reward-card.suggestion:hover {
  opacity: 1;
  filter: none;
  border-style: solid;
}
#parent-rewards-grid .reward-card,
#parent-team-rewards-overview .reward-card {
  padding: 12px;
}

#parent-rewards-grid .reward-icon,
#parent-team-rewards-overview .reward-icon {
  font-size: 2.5rem;
  margin-bottom: 4px;
}

#parent-rewards-grid .reward-name,
#parent-team-rewards-overview .reward-name {
  font-size: 0.85rem;
  margin-bottom: 2px;
}

#parent-rewards-grid .reward-cost,
#parent-team-rewards-overview .reward-cost {
  margin-bottom: 4px;
  font-size: 0.9rem;
}

#parent-rewards-grid .reward-difficulty-wrapper,
#parent-team-rewards-overview .reward-difficulty-wrapper {
  margin: 2px 0 4px;
}

#parent-rewards-grid .reward-card .joint-badge,
#parent-team-rewards-overview .reward-card .joint-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  top: 8px;
  right: 8px;
}

.reward-icon {
  font-size: 5rem; /* Increased from 3rem */
  margin-bottom: 12px;
  line-height: 1;
}

#tab-home .reward-icon {
  margin-top: 20px;
}

.reward-name {
  font-weight: 800;
  font-size: 1.1rem;
  margin-bottom: 8px;
  word-wrap: break-word;
  line-height: 1.2;
}

.reward-cost {
  font-weight: 700;
  color: var(--playful-orange);
  margin-bottom: 16px;
}
.reward-difficulty-wrapper {
  margin: 4px 0 8px;
}
.reward-difficulty {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.3px;
}
.diff-easy { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.diff-medium { background: #fff8e1; color: #f57f17; border: 1px solid #ffe082; }
.diff-hard { background: #fbe9e7; color: #d84315; border: 1px solid #ffab91; }
.diff-extreme { background: #fce4ec; color: #c62828; border: 1px solid #ef9a9a; }

/* --- Prizes Layout (Grand Prize + Small Prizes Grid) --- */
.prizes-layout {
  display: flex;
  flex-direction: column;
  gap: 32px;
  width: 100%;
}

.grand-prize-section {
  width: 100%;
}

.grand-prize-card {
  background: linear-gradient(145deg, #ffffff 0%, #e3f2fd 50%, #bbdefb 100%);
  border: 4px solid var(--sky-blue);
  border-radius: var(--radius-xl);
  box-shadow: 0 16px 0 var(--sky-blue), 0 20px 40px rgba(3, 169, 244, 0.2);
  overflow: hidden;
  position: relative;
  width: 100%;
  margin: 0 auto;
}

.grand-prize-card.card-highlight {
  border-color: var(--sunny-yellow);
  box-shadow: 0 16px 0 var(--sunny-yellow-dark), 0 20px 40px rgba(255, 193, 7, 0.2);
  background: linear-gradient(145deg, #ffffff 0%, #fff8e1 50%, #ffecb3 100%);
}

.grand-prize-badge {
  background: var(--sky-blue);
  color: white;
  text-align: center;
  padding: 10px 24px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.2rem;
  letter-spacing: 8px;
  text-transform: uppercase;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.grand-prize-card.card-highlight .grand-prize-badge {
  background: var(--sunny-yellow-dark);
}

.grand-prize-body {
  display: flex;
  gap: 24px;
  padding: 20px 32px;
  align-items: center;
  justify-content: flex-start;
}

.grand-prize-icon {
  font-size: 15rem;
  flex-shrink: 0;
  width: 300px;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.7);
  border-radius: var(--radius-xl);
  border: 4px solid rgba(255,255,255,0.9);
  box-shadow: 0 8px 16px rgba(0,0,0,0.08);
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.grand-prize-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.grand-prize-name {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--text-dark);
  margin: 0;
  line-height: 1.1;
}

.grand-prize-cost {
  font-weight: 900;
  color: var(--playful-orange);
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.grand-prize-description {
  color: var(--text-medium);
  font-size: 1rem;
  line-height: 1.4;
  margin: 6px 0;
}

.grand-prize-streak {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin: 12px 0;
}

.grand-prize-hint {
  font-size: 0.8rem;
  color: var(--text-light);
  margin: 4px 0 0;
  text-align: center;
}

.prizes-layout {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.small-prizes-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-dark);
  margin: 0 0 16px;
  border-left: 6px solid var(--playful-orange);
  padding-left: 15px;
}

.small-prizes-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 15px;
}

#home-small-prizes, #progress-small-prizes {
  grid-template-columns: repeat(6, 1fr);
}

@media (max-width: 1024px) {
  #home-small-prizes, #progress-small-prizes, .badge-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  #home-small-prizes, #progress-small-prizes, .badge-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

#home-badges, #badges-container {
  grid-template-columns: repeat(6, 1fr);
}

@media (max-width: 600px) {
  #home-badges {
    grid-template-columns: repeat(2, 1fr);
  }
}

.reward-card.locked {
  opacity: 0.65;
  filter: grayscale(0.4);
}

@media (max-width: 1024px) {
  .grand-prize-body {
    flex-direction: column;
    text-align: center;
    padding: 24px;
  }
  .grand-prize-icon {
    font-size: 5rem;
    width: 120px;
    height: 120px;
  }
  .grand-prize-name {
    font-size: 1.8rem;
  }
  .small-prizes-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

@media (max-width: 600px) {
  .grand-prize-body {
    padding: 20px;
    gap: 16px;
  }
  .grand-prize-icon {
    font-size: 4rem;
    width: 100px;
    height: 100px;
  }
  .grand-prize-name {
    font-size: 1.4rem;
  }
  .grand-prize-badge {
    font-size: 1rem;
    letter-spacing: 3px;
    padding: 10px 16px;
  }
  .small-prizes-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}

/* Streak Circles */
.streak-circles {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.streak-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-card);
  background: var(--bg-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-light);
  transition: transform 0.3s var(--ease-bounce), background 0.3s var(--ease-out-quart), color 0.15s ease;
}

.streak-circle.active {
  border-color: var(--sunny-yellow);
  background: var(--sunny-yellow-light);
  color: var(--sunny-yellow-dark);
  transform: scale(1.1);
}

.streak-circle.done {
  background: var(--leaf-green);
  border-color: var(--leaf-green-dark);
  color: white;
}

.streak-circles.mini .streak-circle {
  width: 20px;
  height: 20px;
  font-size: 0.65rem;
  border-width: 1.5px;
}

@media (max-width: 768px) {
  .dashboard-sticky-header {
    top: 60px;
    padding: 8px 16px;
  }
}


/* --- Tree Map --- */
.tree-container {
  position: relative;
  width: 100%;
  min-height: 800px;
  overflow: visible;
}
.tree-connections {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1;
  pointer-events: none;
}
.tree-nodes {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 2;
}
.map-node-tree {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* --- Speech UI --- */
.btn-record {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--sky-blue);
  border: 6px solid var(--sky-blue-light);
  color: white;
  font-size: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-bounce), background var(--transition-fast), box-shadow 0.2s ease;
  margin: 0 auto;
  box-shadow: 0 8px 16px rgba(3, 169, 244, 0.3);
}

.btn-record:hover {
  transform: scale(1.1);
  background: #039BE5;
}

.btn-record.recording {
  background: var(--ruby-red);
  border-color: var(--ruby-red-light);
  animation: pulse-red 1.5s infinite;
  box-shadow: 0 0 0 20px rgba(231, 76, 60, 0);
}

@keyframes pulse-red {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 20px rgba(231, 76, 60, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

.speech-container {
  background: var(--bg-white);
  padding: 40px;
  border-radius: var(--radius-xl);
  border: 3px solid var(--border-soft);
  max-width: 500px;
  margin: 0 auto;
}

.sing-container {
  background: linear-gradient(135deg, #fff0f5, #ffe0ee);
  border: 3px solid var(--playful-orange);
  box-shadow: 0 0 30px rgba(255, 152, 0, 0.2);
  animation: sing-glow 2s ease-in-out infinite;
}

.song-line {
  animation: sing-bounce 1s ease-in-out infinite;
}

.song-response {
  animation: sing-pulse 1.5s ease-in-out infinite;
}

@keyframes sing-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 152, 0, 0.2); }
  50% { box-shadow: 0 0 40px rgba(255, 152, 0, 0.4); }
}

@keyframes sing-bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

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

/* --- Ultimate Prize --- */
.ultimate-prize {
  border: 3px solid var(--ruby-red) !important;
  background: linear-gradient(135deg, #fff5f5, #ffe0e0) !important;
  animation: ultimate-glow 3s ease-in-out infinite;
}

.ultimate-badge {
  background: linear-gradient(90deg, #ff6b6b, #ee5a24, #ff6b6b);
  color: white;
  padding: 6px 16px;
  border-radius: var(--radius-xl);
  font-weight: 900;
  font-size: 0.8rem;
  letter-spacing: 1px;
  margin-bottom: 8px;
  display: inline-block;
  text-transform: uppercase;
  animation: ultimate-shimmer 2s linear infinite;
  background-size: 200% 100%;
  box-shadow: 0 4px 12px rgba(238, 57, 34, 0.4);
}

.ultimate-prize .grand-prize-badge {
  background: linear-gradient(90deg, #ff6b6b, #ee5a24);
  color: white;
  font-weight: 900;
  letter-spacing: 2px;
  padding: 10px 24px;
  border-radius: var(--radius-xl);
  animation: ultimate-shimmer 2s linear infinite;
  background-size: 200% 100%;
  box-shadow: 0 4px 16px rgba(238, 57, 34, 0.5);
}

.btn-red {
  background: linear-gradient(135deg, var(--ruby-red), #c0392b);
  color: white;
  border: none;
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: 1px;
  box-shadow: 0 4px 12px rgba(192, 57, 43, 0.4);
  animation: ultimate-pulse-btn 2s ease-in-out infinite;
}

.btn-red:hover:not(:disabled) {
  background: linear-gradient(135deg, #c0392b, #a93226);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(192, 57, 43, 0.5);
}

@keyframes ultimate-glow {
  0%, 100% { box-shadow: 0 0 10px rgba(238, 57, 34, 0.3); }
  50% { box-shadow: 0 0 25px rgba(238, 57, 34, 0.6), 0 0 50px rgba(238, 57, 34, 0.3); }
}

@keyframes ultimate-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

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

.streak-circles.mega-streak {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.streak-circles.mega-streak .streak-circle {
  width: 28px;
  height: 28px;
  font-size: 0.65rem;
  border-width: 2px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================
   TREE LESSON MAP — New Duolingo-Style
   ============================================ */

/* Tab layout override — map tab takes full height */
.tab-map-full {
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  height: calc(100dvh - 130px);
  overflow: hidden;
}

.tab-map-header {
  padding: 16px 24px 10px;
  flex-shrink: 0;
}

.tab-map-header h2 {
  margin: 0;
}

/* Outer wrapper: fills remaining height */
.tree-map-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Scrollable container (vertical scroll) */
.tmap-scroll-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: #1a1235;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.tmap-scroll-container::-webkit-scrollbar { width: 6px; }
.tmap-scroll-container::-webkit-scrollbar-track { background: transparent; }
.tmap-scroll-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }

/* Image wrapper — natural image size, nodes positioned absolutely */
.tmap-image-wrap {
  position: relative;
  width: 100%;
  /* Keep aspect ratio of image (1827x3184 ≈ 1:1.742) */
  padding-bottom: 174.2%;
}

.tmap-bg-image {
  position: absolute;
  top: 0; 
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%; 
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  z-index: 10;
}

/* Level banners — horizontal ribbons on the trunk */
.tmap-level-banner {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  padding: 10px 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  letter-spacing: 0.5px;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6), 0 0 2px rgba(0,0,0,0.9);
  z-index: 20;
  pointer-events: none;
}

/* Lesson nodes */
.tmap-node {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tmap-node:hover { transform: translate(-50%, -50%) scale(1.12); }

.tmap-node-inner {
  width: clamp(44px, 7vw, 62px);
  height: clamp(44px, 7vw, 62px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  border: 3px solid rgba(255,255,255,0.5);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.3);
  transition: transform 0.2s var(--ease-out-quart), background 0.2s ease, border-color 0.15s ease;
  position: relative;
  backdrop-filter: blur(4px);
}

/* Active node — pulsing green glow */
.tmap-active .tmap-node-inner {
  background: radial-gradient(circle at 35% 35%, #6ee26a, #2ecc71);
  border-color: #fff;
  box-shadow: 0 0 0 4px rgba(46,204,113,0.35), 0 4px 16px rgba(0,0,0,0.4);
  animation: tmap-pulse 2s ease-in-out infinite;
}

@keyframes tmap-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(46,204,113,0.35), 0 4px 16px rgba(0,0,0,0.4); }
  50%       { box-shadow: 0 0 0 10px rgba(46,204,113,0.15), 0 4px 20px rgba(0,0,0,0.5); }
}

/* Completed node — golden star */
.tmap-done .t
/* Badge stagger animation on enter */
.badge-item {
  animation: badge-pop 400ms var(--ease-bounce) both;
}
.badge-item:nth-child(1) { animation-delay: 0ms; }
.badge-item:nth-child(2) { animation-delay: 60ms; }
.badge-item:nth-child(3) { animation-delay: 120ms; }
.badge-item:nth-child(4) { animation-delay: 180ms; }
.badge-item:nth-child(5) { animation-delay: 240ms; }
.badge-item:nth-child(6) { animation-delay: 300ms; }
@keyframes badge-pop {
  from { opacity: 0; transform: scale(0.6) translateY(8px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}

/* Celebration badges stagger */
.celebration-badges .celebration-badge {
  animation: badge-pop 500ms var(--ease-bounce) both;
}
.celebration-badges .celebration-badge:nth-child(1) { animation-delay: 200ms; }
.celebration-badges .celebration-badge:nth-child(2) { animation-delay: 320ms; }
.celebration-badges .celebration-badge:nth-child(3) { animation-delay: 440ms; }

/* ── Empty States (3.3) ─────────────────────────────────────────────────── */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 20px;
  border-radius: var(--radius-xl);
  border: 2px dashed var(--border-soft);
  background: rgba(255,255,255,0.6);
  text-align: center;
  animation: empty-fade-in 400ms var(--ease-out-quart) both;
}
.empty-state-inline {
  padding: 20px 16px;
}
.empty-state-icon {
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 4px;
}
.empty-state-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-dark);
  margin: 0;
}
.empty-state-sub {
  font-size: 0.85rem;
  color: var(--text-light);
  margin: 0;
  max-width: 240px;
}
@keyframes empty-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Asymmetric Category Grid (3.4) ─────────────────────────────────────── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.cat-card {
  background: color-mix(in srgb, var(--cat-color) 18%, var(--cloud-white));
  border: 2px solid color-mix(in srgb, var(--cat-color) 40%, transparent);
  border-radius: var(--radius-xl);
  padding: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--cat-color) 30%, transparent);
  transition: transform 200ms var(--ease-out-quart);
  position: relative;
  overflow: hidden;
}
.cat-card::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--cat-color) 15%, transparent);
  pointer-events: none;
}
.cat-card:hover { transform: translateY(-3px); }
.cat-card:active { transform: translateY(2px); }

.cat-card--wide {
  grid-column: span 2;
}

.cat-card-icon {
  font-size: 2rem;
  flex-shrink: 0;
  line-height: 1;
}
.cat-card--wide .cat-card-icon { font-size: 2.4rem; }

.cat-card-body {
  flex: 1;
  min-width: 0;
}
.cat-card-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-dark);
  line-height: 1.2;
}
.cat-card--wide .cat-card-name { font-size: 1.1rem; }
.cat-card-sub {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 1px;
}
.cat-card-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.cat-card-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(0,0,0,0.1);
  overflow: hidden;
}
.cat-card-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--cat-color);
  transition: width 400ms var(--ease-out-quart);
}
.cat-card-count {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-light);
  white-space: nowrap;
}

@media (max-width: 480px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-card--wide { grid-column: span 2; }
}

/* Progress bar shimmer on completion (4.3) */
.progress-fill.complete {
  animation: progress-shimmer 1.5s ease 0.3s;
}
@keyframes progress-shimmer {
  0%   { filter: brightness(1); }
  30%  { filter: brightness(1.4); }
  60%  { filter: brightness(1.2); }
  100% { filter: brightness(1); }
}

/* Mascot states (4.4) */
.lesson-mascot.state-incorrect .mascot-icon {
  animation: mascot-shake 0.5s ease;
}
@keyframes mascot-shake {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  20%       { transform: translateX(-6px) rotate(-8deg); }
  40%       { transform: translateX(6px) rotate(6deg); }
  60%       { transform: translateX(-4px) rotate(-4deg); }
  80%       { transform: translateX(4px) rotate(2deg); }
}
.lesson-mascot.state-correct .mascot-icon {
  animation: mascot-cheer 500ms var(--ease-bounce);
}
@keyframes mascot-cheer {
  0%   { transform: scale(1) rotate(0deg); }
  40%  { transform: scale(1.25) rotate(-10deg); }
  70%  { transform: scale(1.1) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); }
}

/* ============================================================
   HOME DASHBOARD — joint card sticky izquierda + grid 3 cols derecha
   Sin sidebar. Derecha hace scroll si hay muchas tarjetas.
   ============================================================ */
.home-dashboard {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* Info strip oculta — topbar ya muestra estrellas/racha/XP */
.home-info-strip { display: none; }

/* ── Área de premios: TODO el padding viene de aquí ─────── */
.home-rewards-area {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 50px;          /* ← único punto de padding perimetral */
  background: var(--bg-cream);
  display: flex;
  flex-direction: column;
}

/* ── Grid: 6 cols × 3 filas explícitas — todo cabe sin scroll ── */
#home-rewards-grid {
  display: grid !important;
  grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr;
  grid-template-rows: repeat(3, 1fr);
  gap: 14px;
  height: 790px;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

/* Joint card: columna 1, span las 3 filas completas */
#home-rewards-grid > :first-child {
  grid-column: 1 !important;
  grid-row: 1 / span 3 !important;
  position: static !important;
  height: 100% !important;
  max-height: 790px !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

/* Resto de tarjetas: auto-placed en cols 2-6, contenidas en su celda */
#home-rewards-grid > :not(:first-child) {
  grid-column: auto !important;
  grid-row: auto !important;
  max-height: 100% !important;
  overflow: hidden !important;
}

/* ── Joint slider: maximizado dentro de 790px ── */
.home-rewards-area .reward-card.major {
  height: auto !important;
  min-height: 0 !important;
  grid-column: unset;
  grid-row: unset;
  padding: 24px 28px !important;
}
.home-rewards-area .joint-slider {
  padding: 24px 28px !important;
  min-height: 0;
  justify-content: center;
}
.home-rewards-area .joint-slide {
  gap: 10px;
}
.home-rewards-area .joint-slide .joint-badge {
  font-size: 0.85rem;
  padding: 4px 14px;
}
.home-rewards-area .joint-slider .reward-icon {
  font-size: 7rem !important;
  line-height: 1;
  margin-bottom: 4px;
}
.home-rewards-area .joint-slider .reward-name {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
}
.home-rewards-area .joint-slider .reward-difficulty-wrapper {
  margin: 4px 0;
}
.home-rewards-area .joint-slider .reward-difficulty {
  font-size: 0.9rem;
  padding: 4px 14px;
}
.home-rewards-area .joint-slider .reward-cost {
  font-size: 1.1rem;
  font-weight: 700;
}
.home-rewards-area .joint-slider .text-muted {
  font-size: 0.82rem !important;
  margin-top: 2px;
  line-height: 1.4;
}
.home-rewards-area .joint-slider .streak-circles {
  display: none;
}

/* ── Tarjetas regulares: maximizadas dentro de 252px ── */
.home-rewards-area .reward-card:not(.major) {
  height: 252px !important;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 4px;
  min-height: 0;
}
.home-rewards-area .reward-card:not(.major) .reward-icon {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 2px;
}
.home-rewards-area .reward-card:not(.major) .reward-name {
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 0;
}
.home-rewards-area .reward-card:not(.major) .reward-difficulty-wrapper {
  margin: 2px 0;
}
.home-rewards-area .reward-card:not(.major) .reward-difficulty {
  font-size: 0.68rem;
  padding: 2px 8px;
}
.home-rewards-area .reward-card:not(.major) .reward-cost {
  font-size: 0.78rem;
  font-weight: 700;
  margin-top: 1px;
}
.home-rewards-area .reward-card:not(.major) .text-muted {
  font-size: 0.62rem !important;
  margin-top: 0;
  line-height: 1.3;
}
.home-rewards-area .reward-card:not(.major) .streak-circles {
  display: none;
}

/* ── RESPONSIVE HOME ─────────────────────────────────────── */

/* Desktop grande (1280px+): layout base, sin cambios */

/* Desktop medio (1024–1279px): 4 cols regulares → 3 por fila, 4 filas */
@media (max-width: 1279px) {
  .home-rewards-area { padding: 36px; }
  #home-rewards-grid {
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    grid-template-rows: repeat(4, 1fr);
    gap: 12px;
    height: 736px; /* 4 × 172 + 3 × 12 = 724 ≈ fit */
  }
  #home-rewards-grid > :first-child {
    grid-row: 1 / span 4 !important;
    max-height: 736px !important;
  }
  .home-rewards-area .reward-card:not(.major) { height: 172px !important; }
  /* Joint slider: ligeramente más compacto */
  .home-rewards-area .joint-slider .reward-icon { font-size: 2rem !important; }
}

/* Tablet landscape (768–1023px): 3 cols regulares → 2 por fila, 6 filas, scroll */
@media (max-width: 1023px) {
  .home-rewards-area {
    padding: 24px;
    overflow-y: auto; /* permite scroll en tablet */
  }
  #home-rewards-grid {
    grid-template-columns: 1.6fr 1fr 1fr;
    grid-template-rows: repeat(6, 1fr);
    gap: 10px;
    height: auto;       /* deja de ser fijo; el contenido define la altura */
    overflow: visible;
  }
  #home-rewards-grid > :first-child {
    grid-row: 1 / span 6 !important;
    max-height: none !important;
    height: 100% !important;
  }
  .home-rewards-area .reward-card:not(.major) { height: 150px !important; }
  .home-rewards-area .reward-card:not(.major) .reward-icon { font-size: 1.2rem; }
  .home-rewards-area .reward-card:not(.major) .reward-name { font-size: 0.55rem; }
  .home-rewards-area .joint-slider .reward-icon { font-size: 1.8rem !important; }
  .home-rewards-area .joint-slider { padding: 20px 18px !important; }
  .home-rewards-area .reward-card.major { padding: 20px 18px !important; }
}

/* Tablet portrait / móvil (< 768px): joint card arriba, regulares en 3 cols */
@media (max-width: 767px) {
  .home-rewards-area {
    padding: 16px;
    overflow-y: auto;
    flex-direction: column;
  }
  #home-rewards-grid {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: none;  /* auto rows */
    gap: 8px;
    height: auto;
    overflow: visible;
  }
  /* Joint card ocupa toda la fila 1 */
  #home-rewards-grid > :first-child {
    grid-column: 1 / span 3 !important;
    grid-row: 1 !important;
    height: auto !important;
    max-height: 240px !important;
    overflow: hidden !important;
  }
  /* Regulares: auto desde fila 2 */
  #home-rewards-grid > :not(:first-child) {
    grid-column: auto !important;
    grid-row: auto !important;
  }
  .home-rewards-area .reward-card:not(.major) { height: 130px !important; }
  .home-rewards-area .reward-card:not(.major) .reward-icon { font-size: 1.1rem; }
  .home-rewards-area .reward-card:not(.major) .reward-name { font-size: 0.5rem; }
  .home-rewards-area .joint-slider { padding: 16px !important; justify-content: center; }
  .home-rewards-area .reward-card.major { padding: 16px !important; }
  .home-rewards-area .joint-slider .reward-icon { font-size: 1.6rem !important; }
  .home-rewards-area .joint-slider .reward-name { font-size: 0.72rem; }
}

/* Móvil pequeño (< 480px): 2 cols para regulares */
@media (max-width: 479px) {
  #home-rewards-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  #home-rewards-grid > :first-child {
    grid-column: 1 / span 2 !important;
    max-height: 200px !important;
  }
  .home-rewards-area .reward-card:not(.major) { height: 120px !important; }
}

/* Badges / suggestions — siguen en DOM pero ocultos */
#home-badges, #home-suggestions, .home-strip-group,
.home-strip-sep, .home-strip-stars, .home-strip-label { display: none; }

/* ── Ajustes de espacio generales ────────────────────────── */
.main-content h2 { font-size: 1.3rem; margin-bottom: 12px; }
.main-content h3 { font-size: 1rem; margin-bottom: 8px; }
.card { padding: 14px 18px; }
.parent-stats-grid { gap: 14px; margin-bottom: 16px !important; }

#tab-lessons .category-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.tab-map-header { padding: 0 0 12px; }
