/* ═══════════════════════════════════════════════
   FARSI QUEST — Duolingo-style CSS
   Mobile-first, bright, gamified
═══════════════════════════════════════════════ */

/* ── Variables ────────────────────────────── */
:root {
  --primary:      #6C63FF;
  --primary-dark: #4B44CC;
  --secondary:    #FF6584;
  --accent:       #FFD93D;
  --success:      #43D98F;
  --success-dark: #2EBF77;
  --danger:       #FF4757;
  --danger-dark:  #CC2E3D;
  --warning:      #FFBE3D;
  --info:         #2ED9FF;

  --bg:           #F0F4FF;
  --card-bg:      #FFFFFF;
  --text:         #2D2D44;
  --text-muted:   #7B7BA0;
  --border:       #E2E8FF;

  --diff-beginner:     #43D98F;
  --diff-intermediate: #FFD93D;
  --diff-advanced:     #FF6584;

  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 4px 20px rgba(108,99,255,0.12);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);

  --font: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-fa: 'Vazirmatn', 'Tahoma', 'Arial Unicode MS', sans-serif;
}

/* ── Reset ────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button { cursor: pointer; border: none; outline: none; font-family: inherit; }
input  { font-family: inherit; }

/* ── Screen System ────────────────────────── */
.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  overflow-x: hidden;
}
.screen.active { display: flex; }
.hidden { display: none !important; }

/* ═══════════════════════════════════════════
   SPLASH SCREEN
═══════════════════════════════════════════ */
#screen-splash {
  background: linear-gradient(145deg, #6C63FF 0%, #FF6584 100%);
  align-items: center;
  justify-content: center;
  text-align: center;
}
.splash-content { padding: 2rem; }
.splash-mascot {
  font-size: 6rem;
  display: block;
  animation: float 3s ease-in-out infinite;
  margin-bottom: 1rem;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
}
.splash-title {
  font-size: 3rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 3px 10px rgba(0,0,0,0.2);
  letter-spacing: -0.5px;
}
.splash-subtitle {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.9);
  margin-top: 0.5rem;
}
.splash-persian {
  font-family: var(--font-fa);
  font-size: 1.4rem;
  color: rgba(255,255,255,0.8);
  margin-top: 0.25rem;
  direction: rtl;
}

/* ═══════════════════════════════════════════
   TOP BAR
═══════════════════════════════════════════ */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--card-bg);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.top-bar-left { display: flex; align-items: center; gap: 0.4rem; }
.mascot-small { font-size: 1.5rem; }
.app-name { font-weight: 900; font-size: 1.1rem; color: var(--primary); }

.top-bar-stats { display: flex; gap: 0.4rem; align-items: center; }
.stat-pill {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.3rem 0.6rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 800;
  background: var(--border);
  color: var(--text);
}
.stat-pill.streak { background: #FFF3E0; color: #E65100; }
.stat-pill.xp     { background: #FFFDE7; color: #F57F17; }
.stat-pill.hearts { background: #FCE4EC; color: #C62828; }

.screen-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
}

.icon-btn {
  background: transparent;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 1.2rem;
  color: var(--text-muted);
  font-weight: 700;
  transition: background 0.15s;
}
.icon-btn:hover { background: var(--border); }

/* ═══════════════════════════════════════════
   DAILY BANNER
═══════════════════════════════════════════ */
.daily-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #6C63FF22, #FF658422);
  border: 2px solid #6C63FF44;
  border-radius: var(--radius);
}
.daily-icon { font-size: 1.5rem; }
.daily-text { flex: 1; line-height: 1.3; }
.daily-text strong { font-size: 0.9rem; color: var(--primary); display: block; }
.daily-text span { font-size: 0.8rem; color: var(--text-muted); }
.daily-mini-streak { font-size: 1.1rem; letter-spacing: 2px; }

/* ═══════════════════════════════════════════
   CURRICULUM / LESSON TREE
═══════════════════════════════════════════ */
.curriculum-container {
  padding: 0 1rem 6rem;
  flex: 1;
  overflow-y: auto;
}

.loading-spinner {
  text-align: center;
  padding: 3rem 1rem;
  font-size: 2rem;
  color: var(--text-muted);
  animation: float 2s ease-in-out infinite;
}

.difficulty-section { margin-bottom: 2rem; }

.difficulty-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-weight: 900;
  font-size: 0.85rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.diff-beginner     { background: #E8FAF3; color: #1B7A4E; border-left: 4px solid var(--diff-beginner); }
.diff-intermediate { background: #FFFDE7; color: #7A5E00; border-left: 4px solid var(--diff-intermediate); }
.diff-advanced     { background: #FDE8EF; color: #7A1530; border-left: 4px solid var(--diff-advanced); }

.diff-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.diff-beginner .diff-dot     { background: var(--diff-beginner); }
.diff-intermediate .diff-dot { background: var(--diff-intermediate); }
.diff-advanced .diff-dot     { background: var(--diff-advanced); }

/* Lesson Cards Grid */
.lesson-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.lesson-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1rem;
  border: 3px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  position: relative;
  overflow: hidden;
  text-align: center;
  box-shadow: var(--shadow-sm);
  min-height: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}
.lesson-card:active { transform: scale(0.96); }
.lesson-card.unlocked:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.lesson-card.locked {
  opacity: 0.55;
  cursor: not-allowed;
  background: #F5F5F5;
}
.lesson-card.completed { border-color: var(--success); }
.lesson-card.completed::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(67,217,143,0.06), transparent);
}

.lesson-emoji { font-size: 2.2rem; display: block; line-height: 1; }
.lesson-name {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}
.lesson-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.lesson-stars {
  display: flex;
  gap: 2px;
  justify-content: center;
  margin-top: 0.2rem;
}
.star { font-size: 0.7rem; }
.star.filled { color: var(--accent); }
.star.empty  { color: var(--border); filter: grayscale(1); }

.locked-badge {
  position: absolute;
  top: 6px; right: 6px;
  font-size: 1rem;
}

.diff-tag {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 3px 0;
  font-size: 0.6rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.lesson-card.beginner     .diff-tag { background: #E8FAF3; color: var(--diff-beginner); }
.lesson-card.intermediate .diff-tag { background: #FFFDE7; color: #B7861E; }
.lesson-card.advanced     .diff-tag { background: #FDE8EF; color: var(--diff-advanced); }

/* ═══════════════════════════════════════════
   LESSON SCREEN
═══════════════════════════════════════════ */
#screen-lesson { background: var(--bg); }

.lesson-top-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--card-bg);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.progress-bar-wrap { flex: 1; }
.progress-bar-track {
  height: 12px;
  background: var(--border);
  border-radius: 20px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 20px;
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 0%;
}
.progress-bar-fill.xp-fill {
  background: linear-gradient(90deg, var(--accent), #FF9C3D);
}

.lives-display {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--danger);
  background: #FCE4EC;
  padding: 0.3rem 0.6rem;
  border-radius: 20px;
  min-width: 52px;
  justify-content: center;
}

.streak-banner {
  background: linear-gradient(135deg, #FF6584, #FFD93D);
  color: white;
  text-align: center;
  padding: 0.5rem;
  font-weight: 800;
  font-size: 0.9rem;
  animation: slideDown 0.3s ease;
}

/* ═══════════════════════════════════════════
   QUESTION AREA
═══════════════════════════════════════════ */
.question-area {
  flex: 1;
  padding: 1.25rem 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-bottom: 6rem;
}

.question-type-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--primary);
  background: #EEF0FF;
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  align-self: flex-start;
}

.question-prompt {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  text-align: center;
  line-height: 1.35;
  padding: 0 0.5rem;
}
.question-prompt.farsi {
  font-family: var(--font-fa);
  direction: rtl;
  font-size: 2rem;
}
.question-transliteration {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-style: italic;
  margin-top: -0.5rem;
}
.question-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.4rem 1rem;
  background: #F7F7FF;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}

/* ── Choice Buttons ───────────────────────── */
.choices-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.choices-grid.single-col {
  grid-template-columns: 1fr;
}

.choice-btn {
  background: var(--card-bg);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 0.75rem;
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: 72px;
  box-shadow: 0 3px 0 var(--border);
  text-align: center;
  line-height: 1.3;
}
/* Transliteration = primary (big, bold); Farsi script = secondary (small, muted) */
.choice-btn .translit-text {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  font-style: normal;
}
.choice-btn .fa-text {
  font-family: var(--font-fa);
  direction: rtl;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}
.choice-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--border); }
.choice-btn:hover  { border-color: var(--primary); background: #F0EEFF; }

.choice-btn.selected    { border-color: var(--primary); background: #EEF0FF; box-shadow: 0 3px 0 var(--primary-dark); }
.choice-btn.correct     { border-color: var(--success); background: #EDFAF4; box-shadow: 0 3px 0 var(--success-dark); color: var(--success-dark); animation: correctPop 0.3s ease; }
.choice-btn.wrong       { border-color: var(--danger);  background: #FFF0F0; box-shadow: 0 3px 0 var(--danger-dark);  color: var(--danger-dark);  animation: shakeMild 0.4s ease; }
.choice-btn:disabled    { cursor: not-allowed; }

/* ── True/False Buttons ───────────────────── */
.tf-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.5rem;
}
.tf-btn {
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 3px solid var(--border);
  font-size: 1.4rem;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  background: var(--card-bg);
  transition: all 0.15s;
  box-shadow: 0 3px 0 var(--border);
}
.tf-btn span { font-size: 0.75rem; font-weight: 800; letter-spacing: 0.5px; }
.tf-btn.true-btn:hover  { border-color: var(--success); background: #EDFAF4; }
.tf-btn.false-btn:hover { border-color: var(--danger);  background: #FFF0F0; }
.tf-btn.correct { border-color: var(--success); background: #EDFAF4; animation: correctPop 0.3s; }
.tf-btn.wrong   { border-color: var(--danger);  background: #FFF0F0; animation: shakeMild 0.4s; }

/* ── Tap Pairs ────────────────────────────── */
.pairs-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
.pair-tile {
  background: var(--card-bg);
  border: 3px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.5rem;
  text-align: center;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.15s;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  box-shadow: 0 2px 0 var(--border);
  line-height: 1.3;
}
/* Transliteration = primary (big); Farsi script = secondary (small) */
.pair-tile .translit-text {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text);
  font-style: normal;
}
.pair-tile .fa-text {
  font-family: var(--font-fa);
  font-size: 0.68rem;
  direction: rtl;
  color: var(--text-muted);
}
.pair-tile:hover  { border-color: var(--primary); transform: translateY(-1px); }
.pair-tile.selected { border-color: var(--primary); background: #EEF0FF; }
.pair-tile.matched  {
  border-color: var(--success); background: #EDFAF4; 
  color: var(--success-dark);
  animation: correctPop 0.3s ease;
  pointer-events: none;
}
.pair-tile.wrong    {
  border-color: var(--danger); background: #FFF0F0;
  animation: shakeMild 0.4s ease;
}
.pair-tile.invisible { visibility: hidden; pointer-events: none; }

.pairs-progress {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 700;
}

/* ── Arrange Words ────────────────────────── */
.arrange-sentence-en {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}
.arrange-drop-zone {
  min-height: 60px;
  background: #F7F7FF;
  border: 2px dashed var(--primary);
  border-radius: var(--radius);
  padding: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: center;
  direction: ltr;
}
.arrange-drop-zone.correct-zone {
  border-color: var(--success);
  background: #EDFAF4;
  animation: correctPop 0.3s ease;
}
.arrange-drop-zone.wrong-zone {
  border-color: var(--danger);
  background: #FFF0F0;
  animation: shakeMild 0.4s ease;
}
.arrange-word-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  direction: ltr;
}
.word-tile {
  background: var(--card-bg);
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.7rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 2px 0 var(--primary-dark);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
/* Transliteration = primary (big); Farsi script = secondary (small) */
.word-tile .tile-translit {
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  font-style: normal;
  line-height: 1.2;
}
.word-tile .tile-fa {
  font-family: var(--font-fa);
  direction: rtl;
  font-size: 0.6rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text-muted);
}
.word-tile:active { transform: translateY(1px); box-shadow: none; }
.word-tile.placed {
  background: var(--primary);
  color: white;
  border-color: var(--primary-dark);
}
.word-tile.placed .tile-translit { color: rgba(255,255,255,0.75); }
.word-tile.empty-slot {
  background: transparent;
  border-style: dashed;
  color: transparent;
  cursor: pointer;
}

.btn-check-arrange {
  margin-top: 0.5rem;
  align-self: center;
}

/* ── Transliteration Match ────────────────── */
.translit-word-display {
  text-align: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--primary)15, var(--secondary)15);
  border-radius: var(--radius);
  border: 2px solid var(--primary)33;
}
.translit-word-display .fa-big {
  font-family: var(--font-fa);
  font-size: 3rem;
  font-weight: 700;
  direction: rtl;
  display: block;
  color: var(--text);
}
.translit-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ── Fill Sentence ───────────────────────── */
/* Primary display: now shows transliteration (LTR, regular font) */
.fill-sentence-display {
  text-align: center;
  font-family: var(--font);
  font-size: 1.4rem;
  font-weight: 700;
  direction: ltr;
  line-height: 1.8;
  padding: 1rem;
  background: #F7F7FF;
  border-radius: var(--radius);
  border: 2px solid var(--border);
}
.fill-blank {
  display: inline-block;
  border-bottom: 3px solid var(--primary);
  min-width: 80px;
  padding: 0 0.5rem;
  color: var(--primary);
  margin: 0 0.25rem;
  font-weight: 900;
}
.fill-sentence-en {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.25rem;
}
/* Secondary: Farsi script reference (small, RTL, muted) */
.fill-sentence-fa-ref {
  text-align: center;
  font-family: var(--font-fa);
  direction: rtl;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 0.15rem 0.5rem;
  margin-top: -0.5rem;
}

/* True/False — transliteration primary display */
.translit-big {
  font-size: 2.5rem;
  font-weight: 900;
  display: block;
  color: var(--text);
  margin-bottom: 0.1rem;
}
.fa-secondary {
  display: block;
  font-family: var(--font-fa);
  font-size: 0.95rem;
  direction: rtl;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 0.1rem;
}

/* ═══════════════════════════════════════════
   FEEDBACK BAR
═══════════════════════════════════════════ */
.feedback-bar {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-top: 3px solid;
  animation: slideUp 0.25s ease;
  z-index: 200;
}
.feedback-bar.correct-fb {
  background: #EDFAF4;
  border-color: var(--success);
}
.feedback-bar.wrong-fb {
  background: #FFF0F0;
  border-color: var(--danger);
}
.feedback-icon { font-size: 2rem; flex-shrink: 0; }
.feedback-content { flex: 1; }
.feedback-title {
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.2;
}
.feedback-bar.correct-fb .feedback-title { color: var(--success-dark); }
.feedback-bar.wrong-fb  .feedback-title  { color: var(--danger-dark); }
.feedback-detail {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  line-height: 1.4;
}

.btn-continue {
  padding: 0.7rem 1.25rem;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 900;
  color: white;
  flex-shrink: 0;
}
.correct-fb .btn-continue { background: var(--success); box-shadow: 0 3px 0 var(--success-dark); }
.wrong-fb   .btn-continue { background: var(--danger);  box-shadow: 0 3px 0 var(--danger-dark); }

/* ═══════════════════════════════════════════
   RESULTS SCREEN
═══════════════════════════════════════════ */
#screen-results {
  align-items: center;
  justify-content: flex-start;
  padding-top: 0;
  background: var(--bg);
  overflow-y: auto;
}
.results-content {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}
.results-mascot { font-size: 5rem; animation: float 2.5s ease-in-out infinite; }
.results-title {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--text);
  text-align: center;
}
.stars-display {
  display: flex;
  gap: 0.5rem;
  font-size: 2.5rem;
}
.results-stats {
  display: flex;
  gap: 1rem;
  width: 100%;
  justify-content: center;
}
.result-stat {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  flex: 1;
}
.result-stat-icon { font-size: 1.5rem; }
.result-stat-value { font-size: 1.4rem; font-weight: 900; color: var(--text); }
.result-stat-label { font-size: 0.7rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; }

.new-badges-area {
  width: 100%;
  background: linear-gradient(135deg, #FFFDE7, #FFF8E1);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.new-badges-area h3 { font-size: 1rem; margin-bottom: 0.75rem; color: #7A5E00; }
.new-badges-list { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; }
.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  background: white;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  border: 2px solid var(--accent);
  animation: bounceIn 0.5s ease;
}
.badge-item .badge-emoji { font-size: 1.8rem; }
.badge-item .badge-name  { font-size: 0.7rem; font-weight: 800; color: var(--text); text-align: center; }

.results-actions {
  display: flex;
  gap: 0.75rem;
  width: 100%;
}

/* ═══════════════════════════════════════════
   PROFILE SCREEN
═══════════════════════════════════════════ */
.profile-content {
  padding: 1rem 1rem 5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.profile-card {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  color: white;
  box-shadow: var(--shadow);
}
.profile-avatar { font-size: 3rem; }
.profile-info { flex: 1; }
.profile-name { font-size: 1.3rem; font-weight: 900; }
.level-badge {
  display: inline-block;
  background: rgba(255,255,255,0.25);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 800;
  margin-top: 0.25rem;
}
.edit-name-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 50%;
  width: 36px; height: 36px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s;
}
.edit-name-btn:hover { background: rgba(255,255,255,0.35); }

.xp-progress-wrap {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1rem;
  border: 2px solid var(--border);
}
.xp-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  border: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.stat-card-icon { font-size: 1.5rem; }
.stat-card-value { font-size: 1.5rem; font-weight: 900; color: var(--text); margin: 0.15rem 0; }
.stat-card-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; }

.section-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1rem;
  border: 2px solid var(--border);
}
.section-title {
  font-size: 0.9rem;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

/* Week Grid */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.3rem;
}
.week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}
.week-day-label { font-size: 0.6rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; }
.week-day-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
}
.week-day-dot.active { background: var(--primary); color: white; }
.week-day-dot.today { outline: 3px solid var(--primary); outline-offset: 2px; }

/* Difficulty Stats */
.difficulty-stats { display: flex; flex-direction: column; gap: 0.6rem; }
.diff-stat-row { display: flex; flex-direction: column; gap: 0.3rem; }
.diff-stat-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
}
.diff-stat-bar-track {
  height: 8px;
  background: var(--border);
  border-radius: 20px;
  overflow: hidden;
}
.diff-stat-bar-fill {
  height: 100%;
  border-radius: 20px;
  transition: width 0.8s ease;
}
.fill-beginner     { background: var(--diff-beginner); }
.fill-intermediate { background: var(--diff-intermediate); }
.fill-advanced     { background: var(--diff-advanced); }

/* Badges Grid */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}
.badge-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.5rem;
  text-align: center;
  border: 2px solid var(--border);
}
.badge-card.earned { background: #FFFDE7; border-color: var(--accent); }
.badge-card .b-emoji { font-size: 1.8rem; display: block; }
.badge-card .b-name  { font-size: 0.65rem; font-weight: 800; color: var(--text); margin-top: 0.2rem; line-height: 1.2; }
.badge-card.locked .b-emoji { filter: grayscale(1) opacity(0.4); }
.badge-card.locked .b-name  { color: var(--text-muted); }

.no-data-msg {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 1rem 0;
}

/* ═══════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem 1.5rem;
  border-radius: 30px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  flex: 1;
  letter-spacing: 0.3px;
}
.btn:active { transform: translateY(2px); }

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 0 var(--primary-dark);
}
.btn-primary:hover { background: #7B74FF; }
.btn-primary:active { box-shadow: 0 1px 0 var(--primary-dark); }

.btn-secondary {
  background: var(--border);
  color: var(--text);
  box-shadow: 0 4px 0 #C5CEFF;
}
.btn-secondary:hover { background: #D8DCFF; }
.btn-secondary:active { box-shadow: 0 1px 0 #C5CEFF; }

.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 0 var(--danger-dark);
}
.btn-danger:active { box-shadow: 0 1px 0 var(--danger-dark); }

.btn-success {
  background: var(--success);
  color: white;
  box-shadow: 0 4px 0 var(--success-dark);
}

.btn-lg { font-size: 1.2rem; padding: 1.1rem 2rem; }
.btn-sm { font-size: 0.85rem; padding: 0.6rem 1rem; flex: 0; }

/* ═══════════════════════════════════════════
   MODALS
═══════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}
.modal {
  background: var(--card-bg);
  border-radius: 24px;
  padding: 2rem 1.5rem;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.modal-mascot { font-size: 4rem; display: block; margin-bottom: 0.75rem; }
.modal h2 { font-size: 1.6rem; font-weight: 900; color: var(--text); margin-bottom: 0.5rem; }
.modal h3 { font-size: 1.2rem; font-weight: 900; color: var(--text); margin-bottom: 0.5rem; }
.modal p  { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem; line-height: 1.5; }
.modal-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }
.celebrate-emojis { font-size: 1.8rem; letter-spacing: 4px; margin: 0.75rem 0; animation: float 2s ease-in-out infinite; }

.name-input {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  margin: 0.75rem 0;
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
}
.name-input:focus { border-color: var(--primary); }

/* ═══════════════════════════════════════════
   CONFETTI CANVAS
═══════════════════════════════════════════ */
.confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
}

/* ═══════════════════════════════════════════
   ANIMATIONS
═══════════════════════════════════════════ */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes correctPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

@keyframes shakeMild {
  0%, 100% { transform: translateX(0); }
  20%  { transform: translateX(-5px); }
  40%  { transform: translateX(5px); }
  60%  { transform: translateX(-4px); }
  80%  { transform: translateX(4px); }
}

@keyframes bounceIn {
  0%   { transform: scale(0.5); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}

@keyframes bounce-in {
  0%   { transform: scale(0.3); opacity: 0; }
  50%  { transform: scale(1.1); }
  70%  { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}

.bounce-in { animation: bounce-in 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97); }

/* ═══════════════════════════════════════════
   SCROLLBAR STYLING (webkit)
═══════════════════════════════════════════ */
*::-webkit-scrollbar { width: 4px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ═══════════════════════════════════════════
   RESPONSIVE — TABLET / DESKTOP
═══════════════════════════════════════════ */
@media (min-width: 481px) {
  body { background: linear-gradient(135deg, #6C63FF22, #FF658422); }
  .screen { border-radius: 24px; margin: 1rem auto; min-height: calc(100vh - 2rem); box-shadow: 0 8px 40px rgba(0,0,0,0.15); overflow: hidden; }
  .feedback-bar { border-radius: 0 0 24px 24px; }
  .modal-overlay { border-radius: 24px; }
}

/* ═══════════════════════════════════════════
   TTS SPEAKER BUTTON
═══════════════════════════════════════════ */
.tts-speaker-btn {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--card-bg);
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s, border-color 0.15s;
  box-shadow: var(--shadow-sm);
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}
.tts-speaker-btn:hover {
  background: #EEF0FF;
  border-color: var(--primary);
  transform: scale(1.08);
}
.tts-speaker-btn:active { transform: scale(0.94); }
.tts-speaker-btn.tts-speaking {
  background: #EEF0FF;
  border-color: var(--primary);
  animation: ttsPulse 0.6s ease;
}
@keyframes ttsPulse {
  0%   { box-shadow: 0 0 0 0 rgba(108,99,255,0.4); }
  50%  { box-shadow: 0 0 0 8px rgba(108,99,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(108,99,255,0); }
}
.translit-word-display .tts-speaker-btn {
  display: flex;
  margin: 0.75rem auto 0;
}

@media (min-width: 768px) {
  body { display: flex; align-items: flex-start; justify-content: center; padding: 1.5rem; }
  .screen { width: 100%; }
}
