/* ============================================================
   GabbyBattles PWA — App Stylesheet
   Brand: Purple #7C3AED | Gold #F59E0B | Navy #1B2A4A
   ============================================================ */

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

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

:root {
  --purple: #7C3AED;
  --purple-dark: #5B21B6;
  --purple-light: #EDE9FE;
  --gold: #F59E0B;
  --gold-dark: #D97706;
  --navy: #1B2A4A;
  --teal: #0D9488;
  --red: #EF4444;
  --green: #10B981;
  --bg: #F5F3FF;
  --white: #FFFFFF;
  --gray: #6B7280;
  --light-gray: #F3F4F6;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 20px rgba(124,58,237,0.15);
  --shadow-lg: 0 8px 32px rgba(27,42,74,0.2);
  --bottom-nav-height: 72px;
  --header-height: 60px;
}

html { height: 100%; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--navy);
  height: 100%;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#app {
  width: 100%;
  height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: var(--bg);
  box-shadow: 0 0 60px rgba(0,0,0,0.15);
}

/* ── SCREENS ── */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateX(20px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  overflow: hidden;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: translateX(0);
}

/* ── HEADER ── */
.app-header {
  height: var(--header-height);
  background: var(--purple);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 10;
}
.app-header-left { display: flex; align-items: center; gap: 8px; }
.app-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 50%; }
.app-title { font-family: 'Fredoka One', cursive; color: var(--white); font-size: 1.2rem; }
.app-header-right { display: flex; align-items: center; gap: 8px; }
.player-info { display: flex; align-items: center; gap: 4px; }
.header-avatar { font-size: 1.4rem; }
.header-name { color: rgba(255,255,255,0.9); font-weight: 700; font-size: 0.85rem; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xp-badge { background: var(--gold); color: var(--navy); font-weight: 900; font-size: 0.8rem; padding: 4px 10px; border-radius: 50px; }
.back-btn { background: rgba(255,255,255,0.2); color: var(--white); border: none; padding: 8px 12px; border-radius: 8px; font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 0.85rem; cursor: pointer; }
.back-btn:active { opacity: 0.7; }
.screen-title { font-family: 'Fredoka One', cursive; color: var(--white); font-size: 1.1rem; }

/* ── BOTTOM NAV ── */
.bottom-nav {
  height: var(--bottom-nav-height);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-around;
  border-top: 1px solid #E5E7EB;
  flex-shrink: 0;
  z-index: 10;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--gray);
  font-family: 'Nunito', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 4px;
  border-radius: 8px;
  transition: color 0.15s;
}
.nav-item:first-child { font-size: 1.3rem; }
.nav-item span { font-size: 0.65rem; }
.nav-item.active { color: var(--purple); }
.nav-item:active { transform: scale(0.93); }

/* ── MAIN SCROLL AREAS ── */
.home-main, .lessons-main, .battle-main, .tutor-main, .progress-main, .grandparent-main {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 16px;
}

/* ── ONBOARDING ── */
#screen-onboard {
  background: linear-gradient(160deg, var(--purple-dark) 0%, var(--purple) 50%, #9333EA 100%);
  overflow-y: auto;
}
.onboard-bg {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(245,158,11,0.2) 0%, transparent 70%);
  pointer-events: none;
}
.onboard-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 24px 60px;
  position: relative;
  z-index: 1;
}
.onboard-mascot {
  width: 160px;
  height: 160px;
  object-fit: contain;
  filter: drop-shadow(0 16px 32px rgba(0,0,0,0.3));
  animation: float 3s ease-in-out infinite;
}
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }
.onboard-title {
  font-family: 'Fredoka One', cursive;
  color: var(--white);
  font-size: 2.8rem;
  margin-top: 12px;
  text-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.onboard-subtitle { color: var(--gold); font-weight: 800; font-size: 1.1rem; margin-bottom: 28px; }
.onboard-form { width: 100%; max-width: 360px; }
.onboard-label { color: rgba(255,255,255,0.9); font-weight: 700; font-size: 0.9rem; margin-bottom: 8px; display: block; }
.onboard-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.15);
  color: var(--white);
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 20px;
  outline: none;
}
.onboard-input::placeholder { color: rgba(255,255,255,0.5); }
.onboard-input:focus { border-color: var(--gold); background: rgba(255,255,255,0.2); }

.avatar-picker, .grade-picker { margin-bottom: 20px; }
.avatar-grid, .grade-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.avatar-btn {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 3px solid transparent;
  background: rgba(255,255,255,0.15);
  font-size: 1.6rem;
  cursor: pointer;
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.avatar-btn.selected { border-color: var(--gold); background: rgba(245,158,11,0.25); transform: scale(1.1); }
.avatar-btn:active { transform: scale(0.9); }

.grade-btn {
  padding: 10px 16px;
  border-radius: 50px;
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
  color: var(--white);
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
}
.grade-btn.selected { background: var(--gold); color: var(--navy); border-color: var(--gold); }
.grade-btn:active { transform: scale(0.95); }

.btn-start {
  width: 100%;
  padding: 18px;
  background: var(--gold);
  color: var(--navy);
  border: none;
  border-radius: 50px;
  font-family: 'Fredoka One', cursive;
  font-size: 1.3rem;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: 0 8px 24px rgba(245,158,11,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-start:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(245,158,11,0.5); }
.btn-start:active { transform: scale(0.97); }

/* ── HOME SCREEN ── */
.streak-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #FEF3C7, #FDE68A);
  border-left: 4px solid var(--gold);
  padding: 12px 16px;
  margin: 12px 16px;
  border-radius: var(--radius-sm);
}
.streak-fire { font-size: 1.8rem; }
.streak-text { flex: 1; }
.streak-text strong { font-size: 1.1rem; color: var(--navy); }
.streak-text span { display: block; font-size: 0.8rem; color: var(--gray); }
.streak-stars { font-size: 0.9rem; }

.section-block { padding: 0 16px; margin-bottom: 20px; }
.section-heading {
  font-family: 'Fredoka One', cursive;
  font-size: 1.1rem;
  color: var(--navy);
  margin-bottom: 12px;
  margin-top: 16px;
}

.subject-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.subject-card {
  border-radius: var(--radius);
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border: none;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow);
}
.subject-card:active { transform: scale(0.95); }
.subject-card .s-emoji { font-size: 2rem; }
.subject-card .s-label { font-weight: 800; font-size: 0.8rem; color: var(--white); text-align: center; }
.subject-card .s-count { font-size: 0.7rem; color: rgba(255,255,255,0.8); font-weight: 600; }

.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick-card {
  background: var(--white);
  border: none;
  border-radius: var(--radius);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}
.quick-card:active { transform: scale(0.95); }
.quick-icon { font-size: 2rem; }
.quick-label { font-weight: 800; font-size: 0.85rem; color: var(--navy); text-align: center; }

.lesson-list { display: flex; flex-direction: column; gap: 10px; }
.lesson-list-item {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border: none;
  width: 100%;
  text-align: left;
  transition: transform 0.15s;
}
.lesson-list-item:active { transform: scale(0.98); }
.lli-emoji { font-size: 1.5rem; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 10px; flex-shrink: 0; }
.lli-info { flex: 1; min-width: 0; }
.lli-title { font-weight: 800; font-size: 0.9rem; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lli-meta { font-size: 0.75rem; color: var(--gray); margin-top: 2px; }
.lli-arrow { color: var(--purple); font-size: 1.1rem; }
.lli-done { color: var(--green); font-size: 1.1rem; }

/* ── LESSONS SCREEN ── */
.subject-filter { display: flex; gap: 8px; padding: 12px 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.subject-filter::-webkit-scrollbar { display: none; }
.filter-btn {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 50px;
  border: 2px solid #E5E7EB;
  background: var(--white);
  color: var(--gray);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-btn.active { background: var(--purple); color: var(--white); border-color: var(--purple); }

.lessons-grid { display: flex; flex-direction: column; gap: 10px; padding: 0 16px 16px; }
.lesson-grid-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
  border: none;
  width: 100%;
  text-align: left;
  transition: transform 0.15s;
  position: relative;
}
.lesson-grid-card:active { transform: scale(0.98); }
.lgc-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; flex-shrink: 0; }
.lgc-info { flex: 1; min-width: 0; }
.lgc-subject { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.lgc-title { font-weight: 800; font-size: 0.95rem; color: var(--navy); line-height: 1.3; margin-bottom: 4px; }
.lgc-grade { font-size: 0.75rem; color: var(--gray); }
.lgc-done-badge { position: absolute; top: 12px; right: 12px; background: var(--green); color: var(--white); font-size: 0.7rem; font-weight: 800; padding: 3px 8px; border-radius: 50px; }

/* ── LESSON VIEW ── */
.lesson-header { gap: 8px; }
.lesson-progress-bar { flex: 1; height: 6px; background: rgba(255,255,255,0.3); border-radius: 3px; overflow: hidden; }
.lesson-progress-fill { height: 100%; background: var(--gold); border-radius: 3px; transition: width 0.3s ease; width: 0%; }
.mini-xp { background: var(--gold); color: var(--navy); font-weight: 900; font-size: 0.75rem; padding: 4px 8px; border-radius: 50px; white-space: nowrap; }

.lesson-view-main { flex: 1; overflow-y: auto; padding: 20px 16px; display: flex; flex-direction: column; }
.lesson-card {
  background: var(--white);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  flex: 1;
  display: flex;
  flex-direction: column;
}
.lesson-card-subject { font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--purple); margin-bottom: 4px; }
.lesson-card-grade { font-size: 0.75rem; color: var(--gray); margin-bottom: 12px; }
.lesson-card-title { font-family: 'Fredoka One', cursive; font-size: 1.5rem; color: var(--navy); margin-bottom: 16px; line-height: 1.2; }
.lesson-vibe-text { flex: 1; font-size: 1rem; line-height: 1.7; color: #374151; margin-bottom: 24px; }
.lesson-card-actions { display: flex; flex-direction: column; gap: 10px; }
.btn-battle-this {
  background: var(--purple);
  color: var(--white);
  border: none;
  padding: 14px;
  border-radius: 50px;
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s;
}
.btn-battle-this:active { transform: scale(0.97); }
.btn-next-lesson {
  background: var(--light-gray);
  color: var(--navy);
  border: none;
  padding: 12px;
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.15s;
}
.btn-next-lesson:active { transform: scale(0.97); }

/* ── BATTLE SCREEN ── */
.battle-subject-select { padding: 20px 16px; }
.battle-intro { text-align: center; margin-bottom: 24px; }
.battle-mascot { width: 100px; height: 100px; object-fit: contain; margin: 0 auto 12px; }
.battle-intro h2 { font-family: 'Fredoka One', cursive; font-size: 1.6rem; color: var(--navy); }
.battle-intro p { color: var(--gray); font-size: 0.9rem; margin-top: 4px; }
.battle-subject-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.battle-subject-btn {
  border-radius: var(--radius);
  padding: 16px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border: none;
  transition: transform 0.15s;
  box-shadow: var(--shadow);
}
.battle-subject-btn:active { transform: scale(0.95); }
.battle-subject-btn .bs-emoji { font-size: 1.6rem; }
.battle-subject-btn .bs-label { font-weight: 800; font-size: 0.9rem; color: var(--white); }
.btn-random-battle {
  width: 100%;
  padding: 14px;
  background: var(--gold);
  color: var(--navy);
  border: none;
  border-radius: 50px;
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s;
}
.btn-random-battle:active { transform: scale(0.97); }

.battle-question-area { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.battle-hud { display: flex; align-items: center; justify-content: space-between; }
.battle-q-counter { font-family: 'Fredoka One', cursive; font-size: 1.1rem; color: var(--navy); }
.battle-timer-ring { width: 52px; height: 52px; position: relative; }
.timer-svg { width: 100%; height: 100%; }
.timer-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: 'Fredoka One', cursive; font-size: 1rem; color: var(--navy); }
.battle-streak-mini { font-weight: 800; font-size: 0.9rem; color: var(--navy); }

.battle-lesson-tag { display: inline-block; background: var(--purple-light); color: var(--purple); font-weight: 800; font-size: 0.75rem; padding: 4px 12px; border-radius: 50px; }
.battle-question { font-family: 'Fredoka One', cursive; font-size: 1.2rem; color: var(--navy); line-height: 1.4; }
.battle-options { display: flex; flex-direction: column; gap: 10px; }
.battle-option {
  background: var(--white);
  border: 2px solid #E5E7EB;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  text-align: left;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--navy);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
}
.battle-option:active { transform: scale(0.98); }
.battle-option.correct { background: #D1FAE5; border-color: var(--green); color: #065F46; }
.battle-option.wrong { background: #FEE2E2; border-color: var(--red); color: #991B1B; }
.battle-option.disabled { pointer-events: none; opacity: 0.6; }
.option-letter { width: 28px; height: 28px; border-radius: 50%; background: var(--purple-light); color: var(--purple); font-weight: 900; font-size: 0.8rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.battle-feedback {
  background: var(--purple-light);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--purple-dark);
  text-align: center;
}
.battle-feedback.correct-fb { background: #D1FAE5; color: #065F46; }
.battle-feedback.wrong-fb { background: #FEE2E2; color: #991B1B; }

.score-badge { background: var(--gold); color: var(--navy); font-weight: 900; font-size: 0.85rem; padding: 4px 12px; border-radius: 50px; }

.battle-results { padding: 24px 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.results-mascot img { width: 120px; height: 120px; object-fit: contain; }
.battle-results h2 { font-family: 'Fredoka One', cursive; font-size: 1.8rem; color: var(--navy); }
.results-score-ring {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), #9333EA);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(124,58,237,0.4);
}
#results-score { font-family: 'Fredoka One', cursive; font-size: 2.5rem; color: var(--white); }
.results-score-label { color: rgba(255,255,255,0.8); font-size: 0.8rem; font-weight: 700; }
.results-xp { background: var(--gold); color: var(--navy); font-weight: 900; font-size: 1rem; padding: 8px 20px; border-radius: 50px; }
.results-message { font-size: 1rem; color: var(--gray); font-weight: 600; }
.results-btns { display: flex; gap: 10px; width: 100%; }
.btn-play-again, .btn-back-home {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 50px;
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s;
}
.btn-play-again { background: var(--purple); color: var(--white); }
.btn-back-home { background: var(--light-gray); color: var(--navy); }
.btn-play-again:active, .btn-back-home:active { transform: scale(0.97); }

.hidden { display: none !important; }

/* ── TUTOR SCREEN ── */
.tutor-main { display: flex; flex-direction: column; padding: 0; }
.tutor-intro { flex: 1; padding: 20px 16px; display: flex; flex-direction: column; align-items: center; gap: 16px; overflow-y: auto; }
.tutor-mascot { width: 100px; height: 100px; object-fit: contain; }
.tutor-bubble {
  background: var(--white);
  border-radius: 16px;
  border-top-left-radius: 4px;
  padding: 16px;
  box-shadow: var(--shadow);
  max-width: 100%;
}
.tutor-bubble p { font-size: 0.95rem; line-height: 1.6; color: var(--navy); }
.tutor-bubble p + p { margin-top: 8px; }
.suggestions-label { font-weight: 800; font-size: 0.85rem; color: var(--gray); align-self: flex-start; }
.tutor-suggestions { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.suggestion-chip {
  background: var(--purple-light);
  color: var(--purple);
  border: none;
  padding: 8px 14px;
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}
.suggestion-chip:active { background: var(--purple); color: var(--white); }

.tutor-chat { flex: 1; overflow-y: auto; padding: 12px 16px; -webkit-overflow-scrolling: touch; }
.chat-messages { display: flex; flex-direction: column; gap: 12px; }
.chat-msg { display: flex; gap: 8px; align-items: flex-end; }
.chat-msg.user { flex-direction: row-reverse; }
.chat-bubble {
  max-width: 80%;
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  font-weight: 600;
}
.chat-msg.user .chat-bubble { background: var(--purple); color: var(--white); border-bottom-right-radius: 4px; }
.chat-msg.gabby .chat-bubble { background: var(--white); color: var(--navy); border-bottom-left-radius: 4px; box-shadow: var(--shadow); }
.chat-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: contain; flex-shrink: 0; }
.chat-typing { display: flex; gap: 4px; align-items: center; padding: 12px 14px; }
.typing-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gray); animation: typing 1.2s infinite; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-6px)} }

.tutor-input-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--white);
  border-top: 1px solid #E5E7EB;
  flex-shrink: 0;
}
.tutor-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #E5E7EB;
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
  color: var(--navy);
}
.tutor-input:focus { border-color: var(--purple); }
.tutor-send-btn {
  background: var(--purple);
  color: var(--white);
  border: none;
  padding: 12px 18px;
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s;
}
.tutor-send-btn:active { transform: scale(0.95); }

/* ── PROGRESS SCREEN ── */
.progress-main { padding: 0 0 16px; }
.progress-hero {
  background: linear-gradient(135deg, var(--purple), #9333EA);
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.progress-avatar { font-size: 2.5rem; }
.progress-player-info { flex: 1; }
.progress-player-info h2 { font-family: 'Fredoka One', cursive; color: var(--white); font-size: 1.3rem; }
.progress-level { color: rgba(255,255,255,0.8); font-size: 0.85rem; font-weight: 700; margin-top: 2px; }
.progress-xp-total { text-align: right; }
.progress-xp-total span:first-child { display: block; font-family: 'Fredoka One', cursive; color: var(--gold); font-size: 1.8rem; }
.xp-label { color: rgba(255,255,255,0.7); font-size: 0.75rem; font-weight: 700; }

.progress-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 16px; margin-bottom: 8px; }
.stat-card { background: var(--white); border-radius: var(--radius-sm); padding: 12px 8px; text-align: center; box-shadow: var(--shadow); }
.stat-icon { font-size: 1.3rem; margin-bottom: 4px; }
.stat-value { font-family: 'Fredoka One', cursive; font-size: 1.1rem; color: var(--purple); }
.stat-label { font-size: 0.65rem; color: var(--gray); font-weight: 700; margin-top: 2px; }

.subject-bars { display: flex; flex-direction: column; gap: 12px; }
.subject-bar-row { display: flex; flex-direction: column; gap: 4px; }
.subject-bar-label { display: flex; justify-content: space-between; font-size: 0.85rem; font-weight: 700; color: var(--navy); }
.subject-bar-track { height: 10px; background: #E5E7EB; border-radius: 5px; overflow: hidden; }
.subject-bar-fill { height: 100%; border-radius: 5px; transition: width 0.6s ease; }

.achievements-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.achievement-badge {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
  box-shadow: var(--shadow);
  opacity: 0.4;
  transition: opacity 0.3s;
}
.achievement-badge.earned { opacity: 1; }
.achievement-badge .ach-icon { font-size: 1.5rem; }
.achievement-badge .ach-label { font-size: 0.6rem; font-weight: 800; color: var(--navy); margin-top: 4px; line-height: 1.2; }

.activity-log { display: flex; flex-direction: column; gap: 8px; }
.activity-item {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.activity-icon { font-size: 1.2rem; }
.activity-text { flex: 1; font-size: 0.85rem; font-weight: 600; color: var(--navy); }
.activity-xp { font-size: 0.75rem; font-weight: 800; color: var(--purple); }
.activity-time { font-size: 0.7rem; color: var(--gray); }

.grandparent-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: var(--white);
  font-size: 1.3rem;
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ── GRANDPARENT DASHBOARD ── */
.grandparent-header { background: #065F46; }
.grandparent-main { padding: 0 0 24px; }
.gp-hero { background: linear-gradient(135deg, #065F46, #059669); padding: 20px 16px; display: flex; align-items: center; gap: 14px; }
.gp-avatar { font-size: 2.5rem; }
.gp-info h2 { font-family: 'Fredoka One', cursive; color: var(--white); font-size: 1.3rem; }
.gp-info p { color: rgba(255,255,255,0.8); font-size: 0.85rem; font-weight: 600; }

.gp-summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 16px; }
.gp-card { background: var(--white); border-radius: var(--radius-sm); padding: 14px 8px; text-align: center; box-shadow: var(--shadow); }
.gp-card-icon { font-size: 1.4rem; margin-bottom: 4px; }
.gp-card-value { font-family: 'Fredoka One', cursive; font-size: 1.2rem; color: #059669; }
.gp-card-label { font-size: 0.65rem; color: var(--gray); font-weight: 700; margin-top: 2px; }

.gp-message-box { background: var(--white); margin: 0 16px 16px; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.gp-message-box h3 { font-family: 'Fredoka One', cursive; font-size: 1rem; color: var(--navy); margin-bottom: 12px; }
.gp-message-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.gp-chip {
  background: #D1FAE5;
  color: #065F46;
  border: none;
  padding: 8px 14px;
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}
.gp-chip:active { background: #059669; color: var(--white); }
.gp-sent-msg { margin-top: 10px; background: #D1FAE5; color: #065F46; padding: 10px 14px; border-radius: 8px; font-weight: 700; font-size: 0.85rem; text-align: center; }

.gp-subject-report { padding: 0 16px; margin-bottom: 16px; }
.gp-subject-report h3 { font-family: 'Fredoka One', cursive; font-size: 1rem; color: var(--navy); margin-bottom: 12px; }

.gp-cta { background: linear-gradient(135deg, var(--purple), #9333EA); margin: 0 16px; border-radius: var(--radius); padding: 20px; text-align: center; }
.gp-cta p { color: rgba(255,255,255,0.9); font-size: 0.9rem; margin-bottom: 12px; }
.btn-gp-cta {
  display: inline-block;
  background: var(--gold);
  color: var(--navy);
  padding: 10px 20px;
  border-radius: 50px;
  font-weight: 800;
  font-size: 0.85rem;
  text-decoration: none;
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy);
  color: var(--white);
  padding: 12px 20px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.9rem;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── XP POPUP ── */
.xp-popup {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translateX(-50%) scale(0.5);
  background: var(--gold);
  color: var(--navy);
  font-family: 'Fredoka One', cursive;
  font-size: 1.8rem;
  padding: 12px 28px;
  border-radius: 50px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.23,1,0.32,1);
}
.xp-popup.show { opacity: 1; transform: translateX(-50%) scale(1) translateY(-20px); }

/* ── INSTALL BANNER ── */
.install-banner {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  z-index: 9998;
  max-width: 360px;
  width: calc(100% - 32px);
  animation: slideUp 0.3s ease;
}
@keyframes slideUp { from{transform:translateX(-50%) translateY(20px);opacity:0} to{transform:translateX(-50%) translateY(0);opacity:1} }
.install-banner img { width: 40px; height: 40px; object-fit: contain; border-radius: 10px; }
.install-banner-text { flex: 1; }
.install-banner-text strong { display: block; font-size: 0.9rem; color: var(--navy); }
.install-banner-text span { font-size: 0.75rem; color: var(--gray); }
.install-banner-btn {
  background: var(--purple);
  color: var(--white);
  border: none;
  padding: 8px 14px;
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}
.install-banner-close {
  background: none;
  border: none;
  color: var(--gray);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
}

/* ── DESKTOP WRAPPER ── */
@media (min-width: 500px) {
  body { background: #1B2A4A; display: flex; align-items: center; justify-content: center; min-height: 100vh; }
  #app { border-radius: 32px; height: min(900px, 95vh); }
}
