/* === VARIABLES === */
:root {
  --primary: #6C63FF;
  --primary-dark: #5A52E0;
  --primary-light: #EAE9FF;
  --secondary: #FF6584;
  --success: #51CF66;
  --warning: #FFD43B;
  --danger: #FF6B6B;
  --info: #74C0FC;
  --orange: #FF922B;

  --bg: #F0F4FF;
  --surface: #FFFFFF;
  --surface2: #F8F9FF;
  --border: #E8ECF8;

  --text: #1A1D2E;
  --text-secondary: #6B7280;
  --text-light: #9CA3AF;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(108,99,255,0.08);
  --shadow: 0 4px 20px rgba(108,99,255,0.12);
  --shadow-lg: 0 8px 32px rgba(108,99,255,0.18);

  --nav-h: 72px;
  --header-h: 60px;
  --font: 'Nunito', sans-serif;
  --transition: 0.25s ease;
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 21px;
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button { border: none; cursor: pointer; font-family: var(--font); }
input, textarea, select { font-family: var(--font); }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* === APP SHELL === */
#app {
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.page {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.page::-webkit-scrollbar { display: none; }

.page-with-nav { padding-bottom: calc(var(--nav-h) + 8px); }

/* === PAGE TRANSITIONS === */
.page-enter {
  animation: pageEnter 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
.page-slide-up {
  animation: slideUp 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
@keyframes pageEnter {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === BOTTOM NAVIGATION === */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px 8px;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  background: none;
  color: var(--text-light);
  font-size: 14px;
  font-weight: 700;
  min-width: 64px;
}
.nav-item .nav-icon { font-size: 22px; transition: transform 0.2s; }
.nav-item.active { color: var(--primary); }
.nav-item.active .nav-icon { transform: scale(1.15); }
.nav-item:active { transform: scale(0.92); }

/* === HEADER === */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
}
.header-title {
  font-size: 23px;
  font-weight: 800;
  color: var(--text);
}
.back-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 23px;
  cursor: pointer;
  transition: var(--transition);
  border: none;
}
.back-btn:active { transform: scale(0.9); background: var(--border); }

/* === GRADIENT HERO === */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #8B5CF6 50%, #A78BFA 100%);
  padding: 24px 20px 48px;
  position: relative;
  overflow: hidden;
  color: white;
}
.hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -40px; left: -40px;
  width: 150px; height: 150px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}
.hero-greeting { font-size: 20px; font-weight: 600; opacity: 0.85; margin-bottom: 4px; }
.hero-name { font-size: 34px; font-weight: 900; margin-bottom: 16px; }
.hero-avatar-btn {
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.3);
  backdrop-filter: blur(8px);
}

/* === CARDS === */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.card-elevated { box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }

/* === STREAK CARD === */
.streak-card {
  background: linear-gradient(135deg, #FF6584, #FF922B);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
}
.streak-flame { font-size: 42px; animation: flicker 1.5s ease infinite; }
@keyframes flicker {
  0%,100% { transform: scale(1) rotate(-3deg); }
  50%      { transform: scale(1.08) rotate(3deg); }
}
.streak-num { font-size: 36px; font-weight: 900; line-height: 1; }
.streak-label { font-size: 16px; font-weight: 600; opacity: 0.85; }

/* === XP BAR === */
.xp-bar-wrap { background: var(--surface); border-radius: var(--radius); padding: 14px 18px; }
.xp-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.xp-label { font-size: 17px; font-weight: 700; color: var(--text-secondary); }
.xp-val { font-size: 17px; font-weight: 800; color: var(--primary); }
.progress-bar {
  width: 100%;
  height: 10px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #A78BFA);
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.progress-fill.green  { background: linear-gradient(90deg, #51CF66, #82F59A); }
.progress-fill.orange { background: linear-gradient(90deg, #FF922B, #FFD43B); }

/* === CONTINUE CARD === */
.continue-card {
  border-radius: var(--radius-lg);
  padding: 18px;
  background: linear-gradient(135deg, #6C63FF, #A78BFA);
  color: white;
  position: relative;
  overflow: hidden;
}
.continue-card::after {
  content: '📖';
  position: absolute;
  right: 16px; bottom: 10px;
  font-size: 68px;
  opacity: 0.25;
}
.continue-eyebrow { font-size: 14px; font-weight: 700; opacity: 0.75; letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 4px; }
.continue-title { font-size: 23px; font-weight: 900; margin-bottom: 4px; }
.continue-sub { font-size: 16px; opacity: 0.75; margin-bottom: 14px; }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius-full);
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-family: var(--font);
}
.btn:active { transform: scale(0.95); }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 4px 14px rgba(108,99,255,0.35); }
.btn-primary:active { background: var(--primary-dark); }
.btn-secondary { background: var(--primary-light); color: var(--primary); }
.btn-danger { background: #FFE4E4; color: var(--danger); }
.btn-success { background: #E6FAF0; color: var(--success); }
.btn-white { background: white; color: var(--primary); box-shadow: var(--shadow); }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-full { width: 100%; }
.btn-sm { padding: 10px 18px; font-size: 13px; }
.btn-icon { padding: 12px; border-radius: 50%; width: 44px; height: 44px; }

/* === SUBJECT GRID === */
.subject-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px 20px;
}
.subject-card {
  border-radius: var(--radius-lg);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  min-height: 120px;
}
.subject-card:active { transform: scale(0.96); }
.subject-emoji { font-size: 42px; }
.subject-name { font-size: 18px; font-weight: 800; color: white; }
.subject-desc { font-size: 14px; color: rgba(255,255,255,0.75); font-weight: 600; }
.subject-lessons { font-size: 14px; color: rgba(255,255,255,0.6); font-weight: 700; margin-top: auto; }
.subject-card::after {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
}

/* === LESSON LIST === */
.lesson-list { padding: 0 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.lesson-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.lesson-card:active { transform: scale(0.98); background: var(--surface2); }
.lesson-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 29px;
  flex-shrink: 0;
}
.lesson-info { flex: 1; min-width: 0; }
.lesson-title { font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 3px; }
.lesson-meta { font-size: 16px; color: var(--text-light); font-weight: 600; }
.lesson-check {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.lesson-check.done { background: #E6FAF0; color: var(--success); }
.lesson-check.todo { background: var(--border); color: var(--text-light); }

/* === SECTION HEADER === */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 10px;
}
.section-title { font-size: 23px; font-weight: 900; color: var(--text); }
.section-link { font-size: 17px; font-weight: 700; color: var(--primary); }

/* === TABS === */
.tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 0 20px;
}
.tab-item {
  flex: 1;
  padding: 14px 4px;
  text-align: center;
  font-size: 17px;
  font-weight: 800;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }

/* === QUIZ === */
.quiz-wrap { padding: 20px; }
.quiz-header { margin-bottom: 20px; }
.quiz-progress-label { display: flex; justify-content: space-between; font-size: 17px; font-weight: 700; color: var(--text-secondary); margin-bottom: 8px; }
.quiz-timer { background: var(--primary-light); color: var(--primary); padding: 4px 12px; border-radius: var(--radius-full); font-size: 17px; font-weight: 800; }
.quiz-q { font-size: 23px; font-weight: 800; color: var(--text); margin-bottom: 24px; line-height: 1.45; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-option {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.quiz-option:active { transform: scale(0.98); }
.quiz-option.selected { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.quiz-option.correct  { border-color: var(--success); background: #E6FAF0; color: #2F855A; }
.quiz-option.wrong    { border-color: var(--danger); background: #FFE4E4; color: #C53030; }
.quiz-option-letter {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  font-weight: 900;
  flex-shrink: 0;
}
.quiz-option.selected .quiz-option-letter { background: var(--primary); color: white; }
.quiz-option.correct .quiz-option-letter  { background: var(--success); color: white; }
.quiz-option.wrong .quiz-option-letter    { background: var(--danger); color: white; }
.quiz-explanation {
  margin-top: 14px;
  padding: 12px 16px;
  background: #FFF9E6;
  border-radius: var(--radius);
  border-left: 3px solid var(--warning);
  font-size: 17px;
  font-weight: 600;
  color: #7D5A00;
  line-height: 1.5;
}
.quiz-next-btn { margin-top: 20px; }

/* === QUIZ RESULT === */
.result-wrap { padding: 30px 20px; text-align: center; }
.result-circle {
  width: 130px; height: 130px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #A78BFA);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 8px 32px rgba(108,99,255,0.35);
  color: white;
}
.result-pct { font-size: 49px; font-weight: 900; }
.result-sub { font-size: 12px; font-weight: 700; opacity: 0.8; }
.result-title { font-size: 31px; font-weight: 900; margin-bottom: 6px; }
.result-msg { font-size: 18px; color: var(--text-secondary); margin-bottom: 20px; font-weight: 600; }
.result-stars { font-size: 42px; margin-bottom: 20px; letter-spacing: 4px; }
.result-xp {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, #FFD43B, #FF922B);
  color: white;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 24px;
}
.result-answers { text-align: left; }
.result-answer-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 17px;
}
.result-answer-item:last-child { border-bottom: none; }
.answer-icon { font-size: 21px; flex-shrink: 0; margin-top: 1px; }
.answer-q { font-weight: 700; color: var(--text); margin-bottom: 2px; }
.answer-your { color: var(--text-secondary); font-weight: 600; }
.answer-correct { color: var(--success); font-weight: 700; }

/* === FLASHCARDS === */
.flashcard-wrap { padding: 20px; }
.flashcard-progress { margin-bottom: 20px; }
.fc-counter { font-size: 13px; font-weight: 700; color: var(--text-secondary); text-align: center; margin-bottom: 8px; }
.flashcard-scene {
  perspective: 1000px;
  margin-bottom: 24px;
  cursor: pointer;
}
.flashcard-inner {
  position: relative;
  width: 100%;
  height: 240px;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.flashcard-inner.flipped { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: var(--shadow-lg);
}
.flashcard-front {
  background: linear-gradient(135deg, var(--primary), #8B5CF6);
  color: white;
}
.flashcard-back {
  background: linear-gradient(135deg, #51CF66, #38A169);
  color: white;
  transform: rotateY(180deg);
}
.fc-label { font-size: 14px; font-weight: 800; opacity: 0.7; letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 12px; }
.fc-text { font-size: 29px; font-weight: 900; text-align: center; line-height: 1.35; }
.fc-hint { font-size: 13px; opacity: 0.7; margin-top: 12px; font-weight: 600; }
.fc-tap-hint { font-size: 16px; color: var(--text-light); text-align: center; margin-bottom: 16px; font-weight: 600; }
.fc-actions { display: flex; gap: 12px; }
.fc-actions .btn { flex: 1; }

/* === GAMES === */
.games-grid { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.game-card {
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.2s;
  color: white;
  position: relative;
  overflow: hidden;
}
.game-card:active { transform: scale(0.97); }
.game-emoji { font-size: 57px; }
.game-info { flex: 1; }
.game-name { font-size: 23px; font-weight: 900; margin-bottom: 4px; }
.game-desc { font-size: 16px; opacity: 0.8; font-weight: 600; }
.game-badge {
  background: rgba(255,255,255,0.2);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 800;
  backdrop-filter: blur(4px);
}

/* === MEMORY GAME === */
.memory-wrap { padding: 16px 20px; }
.memory-header { text-align: center; margin-bottom: 16px; }
.memory-score { font-size: 36px; font-weight: 900; color: var(--primary); }
.memory-label { font-size: 12px; color: var(--text-secondary); font-weight: 700; }
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.memory-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.memory-card {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.3s;
  position: relative;
  transform-style: preserve-3d;
}
.memory-card-inner {
  width: 100%; height: 100%;
  border-radius: var(--radius-sm);
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.memory-card.flipped .memory-card-inner,
.memory-card.matched .memory-card-inner { transform: rotateY(180deg); }
.memory-front, .memory-back {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.memory-front {
  background: linear-gradient(135deg, var(--primary), #8B5CF6);
  font-size: 22px;
}
.memory-back { background: var(--surface); box-shadow: var(--shadow-sm); font-size: 36px; transform: rotateY(180deg); }
.memory-card.matched .memory-back { background: #E6FAF0; }
.memory-card:active { transform: scale(0.93); }
.memory-card.matched { pointer-events: none; }
.memory-card.matched .memory-back::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(81,207,102,0.15);
  border-radius: var(--radius-sm);
  border: 2px solid var(--success);
}

/* === WORD SCRAMBLE === */
.scramble-wrap { padding: 20px; }
.scramble-word {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 30px 20px;
  text-align: center;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.scramble-hint { font-size: 16px; color: var(--text-secondary); font-weight: 700; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.scramble-letters { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.scramble-letter {
  width: 42px; height: 48px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  font-weight: 900;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}
.scramble-letter:active { transform: scale(0.9); }
.scramble-letter.selected { background: var(--primary); color: white; border-color: var(--primary-dark); }
.scramble-letter.used { opacity: 0.3; pointer-events: none; }
.scramble-answer { display: flex; gap: 6px; justify-content: center; margin-bottom: 20px; min-height: 56px; flex-wrap: wrap; }
.answer-slot {
  width: 42px; height: 48px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 29px;
  font-weight: 900;
  color: var(--text);
  border: 2px dashed var(--border);
  cursor: pointer;
  transition: all 0.2s;
}
.answer-slot.filled { background: var(--surface); border-style: solid; border-color: var(--primary); }
.answer-slot.correct-slot { border-color: var(--success); background: #E6FAF0; color: var(--success); }
.answer-slot.wrong-slot { border-color: var(--danger); background: #FFE4E4; color: var(--danger); }

/* === MATH BLAST === */
.math-wrap { padding: 20px; text-align: center; }
.math-timer-circle {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #A78BFA);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  font-size: 28px;
  font-weight: 900;
  color: white;
  box-shadow: 0 4px 20px rgba(108,99,255,0.35);
}
.math-equation {
  font-size: 57px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 8px;
}
.math-streak { font-size: 17px; color: var(--text-secondary); font-weight: 700; margin-bottom: 24px; }
.math-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.math-option {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  font-size: 36px;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
}
.math-option:active { transform: scale(0.95); }
.math-option.correct-ans { border-color: var(--success); background: #E6FAF0; color: var(--success); }
.math-option.wrong-ans   { border-color: var(--danger); background: #FFE4E4; color: var(--danger); }

/* === PROFILE === */
.profile-hero {
  background: linear-gradient(135deg, var(--primary), #A78BFA);
  padding: 32px 20px 48px;
  text-align: center;
  color: white;
  position: relative;
}
.profile-avatar-big { font-size: 83px; margin-bottom: 12px; }
.profile-name { font-size: 29px; font-weight: 900; margin-bottom: 4px; }
.profile-grade-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.2);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 17px;
  font-weight: 800;
}
.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 0 20px;
  margin-top: -28px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-val { font-size: 29px; font-weight: 900; color: var(--primary); }
.stat-label { font-size: 14px; color: var(--text-secondary); font-weight: 700; margin-top: 2px; }

/* === ACHIEVEMENTS === */
.achievements-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 0 20px; }
.achievement {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-align: center;
}
.achievement-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 34px;
}
.achievement-icon.earned { box-shadow: 0 3px 12px rgba(108,99,255,0.25); }
.achievement-icon.locked { filter: grayscale(1); opacity: 0.4; }
.achievement-label { font-size: 13px; font-weight: 700; color: var(--text-secondary); }

/* === MENU LIST === */
.menu-list { padding: 0 20px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}
.menu-item:last-child { border-bottom: none; }
.menu-item:active { opacity: 0.7; }
.menu-item-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.menu-item-label { flex: 1; font-size: 20px; font-weight: 700; }
.menu-item-arrow { color: var(--text-light); font-size: 21px; }

/* === SPLASH === */
.splash {
  height: 100dvh;
  background: linear-gradient(160deg, #6C63FF 0%, #8B5CF6 50%, #A78BFA 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: white;
}
.splash-logo { font-size: 94px; animation: logoIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
@keyframes logoIn {
  from { transform: scale(0.4) rotate(-15deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg); opacity: 1; }
}
.splash-title {
  font-size: 47px;
  font-weight: 900;
  animation: fadeUp 0.6s ease 0.3s both;
}
.splash-sub {
  font-size: 20px;
  opacity: 0.8;
  font-weight: 600;
  animation: fadeUp 0.6s ease 0.5s both;
}
.splash-loader {
  width: 120px; height: 5px;
  background: rgba(255,255,255,0.25);
  border-radius: var(--radius-full);
  overflow: hidden;
  animation: fadeUp 0.6s ease 0.6s both;
}
.splash-loader-fill {
  height: 100%;
  background: white;
  border-radius: var(--radius-full);
  animation: load 1.8s ease 0.7s forwards;
}
@keyframes load {
  from { width: 0; }
  to   { width: 100%; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === WELCOME (ONBOARDING) === */
.welcome-wrap { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.slides-container { flex: 1; display: flex; overflow: hidden; position: relative; }
.slide {
  min-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  text-align: center;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.slide-emoji { font-size: 114px; margin-bottom: 28px; animation: bounce 2s ease infinite; }
@keyframes bounce {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}
.slide-title { font-size: 36px; font-weight: 900; color: var(--text); margin-bottom: 12px; }
.slide-text  { font-size: 20px; color: var(--text-secondary); line-height: 1.6; font-weight: 600; }
.welcome-footer { padding: 24px 32px 40px; }
.dots { display: flex; justify-content: center; gap: 8px; margin-bottom: 24px; }
.dot {
  width: 8px; height: 8px;
  border-radius: var(--radius-full);
  background: var(--border);
  transition: all 0.3s;
  cursor: pointer;
}
.dot.active { background: var(--primary); width: 24px; }

/* === AUTH === */
.auth-wrap { min-height: 100dvh; display: flex; flex-direction: column; }
.auth-header {
  background: linear-gradient(135deg, var(--primary), #A78BFA);
  padding: 60px 24px 40px;
  text-align: center;
  color: white;
}
.auth-logo { font-size: 62px; margin-bottom: 12px; }
.auth-title { font-size: 34px; font-weight: 900; margin-bottom: 4px; }
.auth-sub { font-size: 18px; opacity: 0.8; font-weight: 600; }
.auth-tabs { display: flex; background: var(--surface); border-bottom: 2px solid var(--border); }
.auth-tab {
  flex: 1; padding: 16px; text-align: center;
  font-size: 18px; font-weight: 800; color: var(--text-light);
  cursor: pointer; border-bottom: 3px solid transparent;
  margin-bottom: -2px; transition: var(--transition);
}
.auth-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.auth-form { padding: 24px 24px 40px; flex: 1; }

/* === FORM FIELDS === */
.field { margin-bottom: 16px; }
.field-label { font-size: 17px; font-weight: 800; color: var(--text-secondary); margin-bottom: 6px; display: block; }
.field-input {
  width: 100%;
  padding: 14px 18px;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  transition: var(--transition);
  outline: none;
}
.field-input:focus { border-color: var(--primary); background: white; }
.field-input::placeholder { color: var(--text-light); }
.field-error { font-size: 16px; color: var(--danger); font-weight: 700; margin-top: 4px; display: none; }
.field.has-error .field-input { border-color: var(--danger); }
.field.has-error .field-error { display: block; }

/* === AVATAR PICKER === */
.avatar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 16px; }
.avatar-option {
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: var(--surface2);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  cursor: pointer;
  transition: all 0.2s;
}
.avatar-option.selected { border-color: var(--primary); background: var(--primary-light); transform: scale(1.08); }
.avatar-option:active { transform: scale(0.92); }

/* === GRADE PICKER === */
.grade-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grade-option {
  border-radius: var(--radius);
  padding: 16px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; transition: all 0.2s;
  background: var(--surface2);
  border: 2px solid var(--border);
  font-weight: 800;
}
.grade-option:active { transform: scale(0.95); }
.grade-option.selected { border-color: var(--primary); background: var(--primary-light); }
.grade-emoji { font-size: 31px; }
.grade-label { font-size: 16px; color: var(--text); }
.grade-num { font-size: 26px; color: var(--primary); font-weight: 900; }

/* === LESSON CONTENT === */
.lesson-content { padding: 20px; }
.lesson-content h2 { font-size: 29px; font-weight: 900; color: var(--text); margin-bottom: 12px; }
.lesson-content p  { font-size: 20px; color: var(--text-secondary); line-height: 1.7; font-weight: 600; margin-bottom: 16px; }
.lesson-content h3 { font-size: 22px; font-weight: 800; color: var(--text); margin: 20px 0 8px; }
.key-term {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 18px;
}
.fun-fact {
  background: linear-gradient(135deg, #FFF9DB, #FFF3CD);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 16px 0;
  border-left: 4px solid var(--warning);
}
.fun-fact-label { font-size: 14px; font-weight: 800; color: #D4850A; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.fun-fact-text { font-size: 18px; color: #7D5A00; font-weight: 600; line-height: 1.5; }
.lesson-nav { display: flex; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }

/* === TOAST === */
#toast-container { position: fixed; bottom: calc(var(--nav-h) + 12px); left: 50%; transform: translateX(-50%); z-index: 999; pointer-events: none; width: calc(100% - 40px); max-width: 390px; }
.toast {
  background: #1A1D2E;
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  box-shadow: var(--shadow-lg);
}
.toast.removing { animation: toastOut 0.3s ease forwards; }
.toast.success { background: #2F855A; }
.toast.error   { background: #C53030; }
.toast.warning { background: #D4850A; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(10px) scale(0.95); }
}

/* === EMPTY STATE === */
.empty-state { padding: 48px 24px; text-align: center; }
.empty-emoji { font-size: 83px; margin-bottom: 16px; }
.empty-title { font-size: 26px; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.empty-text  { font-size: 18px; color: var(--text-secondary); font-weight: 600; line-height: 1.6; }

/* === SEARCH BAR === */
.search-bar {
  margin: 0 20px 4px;
  position: relative;
}
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 21px; color: var(--text-light); pointer-events: none; }
.search-input {
  width: 100%;
  padding: 12px 16px 12px 40px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  transition: var(--transition);
}
.search-input:focus { border-color: var(--primary); }

/* === CHIP === */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: white; }
.chips-row { display: flex; gap: 8px; padding: 12px 20px; overflow-x: auto; scrollbar-width: none; }
.chips-row::-webkit-scrollbar { display: none; }

/* === DIVIDER === */
.divider { height: 1px; background: var(--border); margin: 0 20px; }
.section-gap { height: 20px; }

/* === LOADING === */
.loading { display: flex; align-items: center; justify-content: center; height: 200px; }
.spinner { width: 40px; height: 40px; border: 4px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* === UTILITY === */
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.fw-900 { font-weight: 900; }
.mt-4 { margin-top: 16px; }
.mt-3 { margin-top: 12px; }
.mb-3 { margin-bottom: 12px; }
.px-20 { padding-left: 20px; padding-right: 20px; }
.py-20 { padding-top: 20px; padding-bottom: 20px; }
.p-20 { padding: 20px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-3 { gap: 12px; }
.w-full { width: 100%; }
