/* ============================================================
   Emma's English Academy — Premium CSS Design System
   ============================================================ */

/* ── Google Font ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Poppins:wght@700;800;900&display=swap');

/* ── CSS Variables ──────────────────────────────────────── */
:root {
  --bg-0:       #080812;
  --bg-1:       #0f0f1e;
  --bg-2:       #161628;
  --bg-3:       #1e1e38;
  --bg-card:    #1a1a30;
  --bg-surface: #222240;

  --primary:    #7c3aed;
  --primary-l:  #9f5ffc;
  --primary-d:  #5b21b6;
  --accent:     #06b6d4;
  --accent-l:   #22d3ee;
  --gold:       #f59e0b;
  --gold-l:     #fbbf24;
  --success:    #10b981;
  --success-l:  #34d399;
  --danger:     #ef4444;
  --danger-l:   #f87171;
  --warning:    #f97316;

  --text:       #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim:   #64748b;
  --border:     rgba(255,255,255,0.08);
  --border-l:   rgba(255,255,255,0.15);

  --col-a1: #10b981;
  --col-a2: #3b82f6;
  --col-b1: #8b5cf6;

  --radius-sm:  8px;
  --radius:     16px;
  --radius-lg:  24px;
  --radius-xl:  32px;

  --shadow:     0 8px 32px rgba(0,0,0,0.4);
  --shadow-lg:  0 16px 64px rgba(0,0,0,0.6);
  --shadow-glow:0 0 40px rgba(124,58,237,0.25);

  --transition: 0.22s cubic-bezier(0.4,0,0.2,1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-0);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }

/* ── Animated background gradient ──────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background: radial-gradient(ellipse 80% 60% at 20% 10%, rgba(124,58,237,0.12) 0%, transparent 60%),
              radial-gradient(ellipse 60% 50% at 80% 80%, rgba(6,182,212,0.08) 0%, transparent 60%),
              var(--bg-0);
}

/* ══════════════════════════════════════════════════════════
   SCREENS
   ══════════════════════════════════════════════════════════ */
.screen { display: none; }
.screen.active { display: flex; }

/* ══════════════════════════════════════════════════════════
   BROWSER WARNING
   ══════════════════════════════════════════════════════════ */
#browser-warning {
  display: none;
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.9);
  align-items: center; justify-content: center;
  flex-direction: column; gap: 16px; text-align: center; padding: 32px;
}
#browser-warning h2 { color: var(--warning); font-size: 1.5rem; }
#browser-warning p  { color: var(--text-muted); max-width: 400px; }

/* ══════════════════════════════════════════════════════════
   ONBOARDING SCREEN
   ══════════════════════════════════════════════════════════ */
#screen-onboarding {
  min-height: 100vh;
  flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px;
  position: relative; overflow: hidden;
}

.onboarding-bg-orb {
  position: absolute; border-radius: 50%; filter: blur(80px); pointer-events: none;
}
.orb-1 { width: 500px; height: 500px; top: -100px; left: -100px; background: rgba(124,58,237,0.2); animation: float 8s ease-in-out infinite; }
.orb-2 { width: 400px; height: 400px; bottom: -80px; right: -80px; background: rgba(6,182,212,0.15); animation: float 10s ease-in-out infinite reverse; }
.orb-3 { width: 300px; height: 300px; top: 50%; left: 60%; background: rgba(245,158,11,0.1); animation: float 12s ease-in-out infinite 2s; }

@keyframes float {
  0%,100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-30px) scale(1.05); }
}

.onboarding-card {
  background: rgba(26,26,48,0.85);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-l);
  border-radius: var(--radius-xl);
  padding: 48px;
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  position: relative; z-index: 1;
}

.onboarding-logo {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 8px;
}
.onboarding-logo-icon {
  font-size: 2.8rem;
  background: linear-gradient(135deg, var(--primary-l), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 20px rgba(124,58,237,0.5));
  animation: pulse-glow 3s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%,100% { filter: drop-shadow(0 0 20px rgba(124,58,237,0.5)); }
  50%      { filter: drop-shadow(0 0 40px rgba(159,95,252,0.8)); }
}

.onboarding-logo-text { font-family: 'Poppins', sans-serif; }
.onboarding-logo-text .app-name  { font-size: 1.6rem; font-weight: 800; line-height: 1; background: linear-gradient(135deg, #fff 30%, var(--primary-l)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.onboarding-logo-text .app-sub   { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; }

.onboarding-tagline {
  color: var(--text-muted); font-size: 0.95rem; margin-bottom: 36px;
  padding-bottom: 24px; border-bottom: 1px solid var(--border);
}

.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }

.input-wrap { position: relative; }
.form-input {
  width: 100%; padding: 14px 18px;
  background: var(--bg-3); border: 1.5px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: 'Inter', sans-serif; font-size: 1rem;
  transition: var(--transition); outline: none;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124,58,237,0.18); }
.form-input::placeholder { color: var(--text-dim); }

.input-suffix {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 1.1rem;
  color: var(--text-dim); padding: 4px;
}
.input-suffix:hover { color: var(--text-muted); }

.form-hint { font-size: 0.78rem; color: var(--text-dim); margin-top: 6px; }

.error-text { color: var(--danger-l); font-size: 0.85rem; min-height: 20px; margin-bottom: 12px; }

.btn-primary {
  width: 100%; padding: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-d));
  border: none; border-radius: var(--radius); color: #fff;
  font-family: 'Inter', sans-serif; font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: var(--transition); letter-spacing: 0.02em;
  box-shadow: 0 4px 20px rgba(124,58,237,0.4);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(124,58,237,0.55);
  background: linear-gradient(135deg, var(--primary-l), var(--primary));
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.onboarding-features {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border);
}
.feature-chip {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.8rem; color: var(--text-muted);
}
.feature-chip span:first-child { font-size: 1.1rem; }

/* ══════════════════════════════════════════════════════════
   DASHBOARD SCREEN
   ══════════════════════════════════════════════════════════ */
#screen-dashboard {
  flex-direction: column; min-height: 100vh;
}

/* Header */
.dash-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 32px;
  background: rgba(15,15,30,0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.dash-logo {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Poppins', sans-serif; font-weight: 800; font-size: 1.1rem;
  background: linear-gradient(135deg, var(--primary-l), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.dash-logo-icon { font-size: 1.6rem; -webkit-text-fill-color: initial; }

.dash-stats {
  display: flex; align-items: center; gap: 20px;
}
.stat-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: 100px; font-size: 0.85rem; font-weight: 600;
}
.stat-chip .stat-icon { font-size: 1rem; }
.stat-chip .stat-val  { color: var(--text); }

.stat-chip.streak-chip { border-color: rgba(245,158,11,0.3); background: rgba(245,158,11,0.08); }
.stat-chip.streak-chip .stat-val { color: var(--gold-l); }
.stat-chip.xp-chip { border-color: rgba(124,58,237,0.3); background: rgba(124,58,237,0.08); }
.stat-chip.xp-chip .stat-val { color: var(--primary-l); }

.btn-icon {
  background: var(--bg-card); border: 1px solid var(--border);
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; transition: var(--transition); color: var(--text-muted);
}
.btn-icon:hover { background: var(--bg-surface); color: var(--text); border-color: var(--border-l); }

/* Dashboard main content */
.dash-content { flex: 1; max-width: 1100px; width: 100%; margin: 0 auto; padding: 32px 24px; }

/* Progress overview */
.progress-overview {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px 32px; margin-bottom: 32px;
  display: flex; align-items: center; gap: 32px;
  box-shadow: var(--shadow);
}
.progress-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; flex-shrink: 0;
  box-shadow: 0 0 30px rgba(124,58,237,0.4);
}
.progress-info { flex: 1; min-width: 0; }
.progress-name { font-size: 1.4rem; font-weight: 700; margin-bottom: 2px; }
.progress-level-line { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 12px; }
.progress-level-line strong { color: var(--primary-l); }
.xp-bar-wrap { background: var(--bg-surface); border-radius: 100px; height: 10px; overflow: hidden; margin-bottom: 4px; }
.xp-bar-fill {
  height: 100%; border-radius: 100px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 0 12px rgba(124,58,237,0.5);
}
.xp-bar-text { font-size: 0.75rem; color: var(--text-dim); }

.progress-badges { display: flex; gap: 12px; flex-shrink: 0; }
.level-badge-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 20px; min-width: 80px;
}
.level-badge-card.a1 { border-color: rgba(16,185,129,0.3); }
.level-badge-card.a2 { border-color: rgba(59,130,246,0.3); }
.level-badge-card.b1 { border-color: rgba(139,92,246,0.3); }
.level-badge-label { font-size: 1rem; font-weight: 800; }
.level-badge-card.a1 .level-badge-label { color: var(--col-a1); }
.level-badge-card.a2 .level-badge-label { color: var(--col-a2); }
.level-badge-card.b1 .level-badge-label { color: var(--col-b1); }
.level-badge-count { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }

/* Level tabs */
.level-tabs {
  display: flex; gap: 8px; margin-bottom: 24px;
}
.level-tab {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 24px; border-radius: var(--radius);
  background: var(--bg-card); border: 1.5px solid var(--border);
  color: var(--text-muted); font-weight: 600; font-size: 0.9rem;
  cursor: pointer; transition: var(--transition); position: relative; overflow: hidden;
  font-family: 'Inter', sans-serif;
}
.level-tab::before {
  content: ''; position: absolute; inset: 0;
  opacity: 0; transition: var(--transition);
}
.level-tab:hover { border-color: var(--border-l); color: var(--text); }

.level-tab[data-level="A1"].active  { border-color: var(--col-a1); color: var(--col-a1); background: rgba(16,185,129,0.1); }
.level-tab[data-level="A2"].active  { border-color: var(--col-a2); color: var(--col-a2); background: rgba(59,130,246,0.1); }
.level-tab[data-level="B1"].active  { border-color: var(--col-b1); color: var(--col-b1); background: rgba(139,92,246,0.1); }

.tab-dot { width: 10px; height: 10px; border-radius: 50%; }
.level-tab[data-level="A1"] .tab-dot { background: var(--col-a1); }
.level-tab[data-level="A2"] .tab-dot { background: var(--col-a2); }
.level-tab[data-level="B1"] .tab-dot { background: var(--col-b1); }

/* Lesson grid */
.lesson-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.lesson-card {
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px 20px;
  text-align: center; transition: var(--transition);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.lesson-card::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(135deg, rgba(124,58,237,0.05), rgba(6,182,212,0.03));
  opacity: 0; transition: var(--transition);
}
.lesson-card.available::after { opacity: 1; }

.lesson-card.available {
  border-color: rgba(124,58,237,0.3);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3), 0 0 0 1px rgba(124,58,237,0.1);
}
.lesson-card.available:hover {
  transform: translateY(-4px);
  border-color: var(--primary-l);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4), 0 0 20px rgba(124,58,237,0.2);
}

.lesson-card.done {
  border-color: rgba(16,185,129,0.3);
  background: linear-gradient(135deg, rgba(16,185,129,0.05), var(--bg-card));
}
.lesson-card.done:hover {
  transform: translateY(-4px);
  border-color: var(--success);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4), 0 0 20px rgba(16,185,129,0.2);
}

.lesson-card.locked {
  opacity: 0.45; cursor: not-allowed;
}

.lesson-card-icon { font-size: 2.2rem; margin-bottom: 4px; }
.lesson-card-number { font-size: 0.7rem; color: var(--text-dim); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.lesson-card-title { font-size: 0.9rem; font-weight: 600; color: var(--text); line-height: 1.3; }
.lesson-card-stars { font-size: 1.1rem; letter-spacing: 2px; min-height: 22px; }
.lesson-card-xp { font-size: 0.75rem; color: var(--success-l); font-weight: 700; }

.star-filled { color: var(--gold-l); }
.star-empty  { color: var(--bg-surface); }
.star-placeholder { color: var(--bg-surface); font-size: 1rem; }

/* ══════════════════════════════════════════════════════════
   LESSON SCREEN
   ══════════════════════════════════════════════════════════ */
#screen-lesson {
  flex-direction: column; min-height: 100vh;
}

.lesson-header {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 28px;
  background: rgba(15,15,30,0.8); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}

.btn-back {
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 10px 16px; border-radius: var(--radius);
  color: var(--text-muted); cursor: pointer; font-size: 0.85rem; font-weight: 600;
  transition: var(--transition); display: flex; align-items: center; gap: 6px;
  font-family: 'Inter', sans-serif;
}
.btn-back:hover { border-color: var(--border-l); color: var(--text); }

.lesson-header-info { flex: 1; }
.lesson-title { font-size: 1.1rem; font-weight: 700; }
.lesson-description { font-size: 0.8rem; color: var(--text-muted); }

.level-badge {
  padding: 5px 14px; border-radius: 100px; font-size: 0.75rem; font-weight: 800;
  letter-spacing: 0.06em;
}
.level-badge.level-a1 { background: rgba(16,185,129,0.15); color: var(--col-a1); border: 1px solid rgba(16,185,129,0.3); }
.level-badge.level-a2 { background: rgba(59,130,246,0.15);  color: var(--col-a2); border: 1px solid rgba(59,130,246,0.3); }
.level-badge.level-b1 { background: rgba(139,92,246,0.15);  color: var(--col-b1); border: 1px solid rgba(139,92,246,0.3); }

/* Phase progress dots */
.phase-progress {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 20px; flex-shrink: 0;
}
.phase-dot-wrap { display: flex; align-items: center; gap: 8px; }
.phase-dot {
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid var(--border); background: var(--bg-card);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; transition: var(--transition); flex-shrink: 0;
}
.phase-dot.active {
  border-color: var(--primary); background: rgba(124,58,237,0.15);
  box-shadow: 0 0 16px rgba(124,58,237,0.4);
  transform: scale(1.15);
}
.phase-dot.done { border-color: var(--success); background: rgba(16,185,129,0.15); }
.phase-connector { width: 40px; height: 2px; background: var(--border); border-radius: 1px; }
.phase-connector.done { background: var(--success); }

/* Lesson body */
.lesson-body { flex: 1; display: flex; flex-direction: column; padding: 0 24px 32px; max-width: 760px; width: 100%; margin: 0 auto; }

/* Exercise phases */
.exercise-phase { display: none; flex-direction: column; gap: 20px; animation: slideUp 0.4s ease; }
.exercise-phase.active { display: flex; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Phase header shared ── */
.phase-header { text-align: center; padding: 8px 0 4px; }
.phase-title { font-size: 1.3rem; font-weight: 800; margin-bottom: 4px; }
.phase-subtitle { font-size: 0.85rem; color: var(--text-muted); }
.phase-counter { font-size: 0.8rem; color: var(--text-dim); font-weight: 600; margin-top: 4px; }

/* ── Feedback shared ── */
.feedback-text {
  padding: 14px 20px; border-radius: var(--radius); font-size: 0.9rem;
  min-height: 48px; text-align: center; font-weight: 500;
  transition: var(--transition); white-space: pre-line;
  border: 1px solid transparent;
}
.feedback-text.correct {
  background: rgba(16,185,129,0.1); color: var(--success-l);
  border-color: rgba(16,185,129,0.3);
}
.feedback-text.wrong {
  background: rgba(239,68,68,0.08); color: var(--danger-l);
  border-color: rgba(239,68,68,0.2);
}
.feedback-text.listening {
  background: rgba(6,182,212,0.08); color: var(--accent-l);
  border-color: rgba(6,182,212,0.25);
}

/* ══════════════════════════════════════════════════════════
   VOCABULARY PHASE
   ══════════════════════════════════════════════════════════ */
.vocab-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 40px 32px; text-align: center;
  box-shadow: var(--shadow);
  background-image: linear-gradient(135deg, rgba(124,58,237,0.05), rgba(6,182,212,0.03));
}
.vocab-word-en {
  font-family: 'Poppins', sans-serif; font-size: 3rem; font-weight: 800;
  background: linear-gradient(135deg, #fff, var(--primary-l));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 12px; line-height: 1.1;
}
.vocab-word-es { font-size: 1.3rem; color: var(--text-muted); font-weight: 500; margin-bottom: 24px; }
.vocab-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.btn-listen {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-surface); border: 1px solid var(--border);
  padding: 12px 24px; border-radius: var(--radius);
  color: var(--text-muted); cursor: pointer; font-size: 0.9rem; font-weight: 600;
  transition: var(--transition); font-family: 'Inter', sans-serif;
}
.btn-listen:hover { border-color: var(--accent); color: var(--accent-l); background: rgba(6,182,212,0.08); }

/* ── Microphone button ── */
.btn-mic {
  position: relative; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  width: 88px; height: 88px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-d));
  border: none; cursor: pointer; font-size: 2rem;
  box-shadow: 0 8px 24px rgba(124,58,237,0.45);
  transition: var(--transition); margin: 0 auto; color: #fff;
}
.btn-mic:hover:not(:disabled) {
  transform: scale(1.06);
  box-shadow: 0 12px 36px rgba(124,58,237,0.6);
}
.btn-mic:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-mic .mic-label { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; -webkit-text-fill-color: white; }

.btn-mic.listening {
  background: linear-gradient(135deg, var(--danger), #b91c1c);
  box-shadow: 0 8px 24px rgba(239,68,68,0.5);
  animation: mic-pulse 1.2s ease-in-out infinite;
}
.btn-mic.listening::before {
  content: ''; position: absolute; inset: -8px; border-radius: 50%;
  border: 3px solid rgba(239,68,68,0.5);
  animation: mic-ring 1.2s ease-in-out infinite;
}
.btn-mic.listening::after {
  content: ''; position: absolute; inset: -16px; border-radius: 50%;
  border: 2px solid rgba(239,68,68,0.25);
  animation: mic-ring 1.2s ease-in-out infinite 0.3s;
}

@keyframes mic-pulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}
@keyframes mic-ring {
  0%   { opacity: 1; transform: scale(0.85); }
  100% { opacity: 0; transform: scale(1.4); }
}

.btn-mic.speaking {
  background: linear-gradient(135deg, var(--accent), #0891b2);
  box-shadow: 0 8px 24px rgba(6,182,212,0.5);
}

/* ══════════════════════════════════════════════════════════
   MULTIPLE CHOICE PHASE
   ══════════════════════════════════════════════════════════ */
.mc-question-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px; text-align: center;
  font-size: 1.2rem; font-weight: 600; line-height: 1.5;
  box-shadow: var(--shadow);
}

.mc-options {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}

.mc-option-btn {
  padding: 18px 16px; border-radius: var(--radius);
  background: var(--bg-card); border: 2px solid var(--border);
  color: var(--text); font-family: 'Inter', sans-serif;
  font-size: 0.95rem; font-weight: 500; cursor: pointer;
  transition: var(--transition); text-align: center; line-height: 1.4;
}
.mc-option-btn:hover:not(:disabled) {
  border-color: var(--primary); background: rgba(124,58,237,0.08);
  color: var(--primary-l); transform: translateY(-2px);
}
.mc-option-btn:disabled { cursor: not-allowed; }
.mc-option-btn.correct { border-color: var(--success); background: rgba(16,185,129,0.12); color: var(--success-l); }
.mc-option-btn.wrong   { border-color: var(--danger);  background: rgba(239,68,68,0.10);  color: var(--danger-l); }

/* ══════════════════════════════════════════════════════════
   FILL IN THE BLANK PHASE
   ══════════════════════════════════════════════════════════ */
.fill-sentence-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px; text-align: center;
  font-size: 1.3rem; font-weight: 500; line-height: 1.8;
  box-shadow: var(--shadow); position: relative;
}
.blank {
  display: inline-block; min-width: 80px; border-bottom: 3px solid var(--primary);
  padding: 0 8px; color: var(--primary-l); font-weight: 700;
}
.correct-fill { color: var(--success-l); border-bottom-color: var(--success); }
.wrong-fill   { color: var(--danger-l); border-bottom-color: var(--danger); }

.fill-hint { text-align: center; color: var(--text-dim); font-size: 0.85rem; }

.fill-target-hint {
  text-align: center; color: var(--gold-l); font-size: 0.85rem;
  font-weight: 600; min-height: 20px;
}

.fill-or-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-dim); font-size: 0.8rem; font-weight: 600;
}
.fill-or-divider::before, .fill-or-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.fill-text-row {
  display: flex; gap: 10px;
}
.fill-text-input {
  flex: 1; padding: 12px 18px;
  background: var(--bg-surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: 'Inter', sans-serif; font-size: 0.95rem;
  transition: var(--transition); outline: none;
}
.fill-text-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124,58,237,0.15); }

.btn-secondary {
  padding: 12px 20px; border-radius: var(--radius);
  background: var(--bg-surface); border: 1.5px solid var(--border);
  color: var(--text); font-family: 'Inter', sans-serif;
  font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: var(--transition);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary-l); background: rgba(124,58,237,0.08); }

/* ══════════════════════════════════════════════════════════
   CONVERSATION PHASE
   ══════════════════════════════════════════════════════════ */
.convo-scenario-card {
  background: rgba(124,58,237,0.08); border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--radius); padding: 16px 20px;
  font-size: 0.88rem; color: var(--text-muted); line-height: 1.5;
  display: flex; align-items: flex-start; gap: 10px;
}
.convo-scenario-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }

.chat-window {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  flex: 1; display: flex; flex-direction: column; min-height: 320px;
  box-shadow: var(--shadow);
}
.chat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; background: var(--bg-surface); border-bottom: 1px solid var(--border);
}
.chat-header-avatar { font-size: 1.3rem; }
.chat-header-name { font-weight: 700; font-size: 0.9rem; }
.chat-header-status { font-size: 0.75rem; color: var(--success); }

.convo-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.convo-status {
  padding: 10px 18px; font-size: 0.8rem; color: var(--text-muted);
  text-align: center; border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

.chat-msg { display: flex; align-items: flex-end; gap: 8px; animation: slideUp 0.3s ease; }
.chat-msg-user { flex-direction: row-reverse; }

.chat-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}

.chat-bubble {
  max-width: 70%; padding: 12px 16px; border-radius: 18px;
  font-size: 0.9rem; line-height: 1.5;
}
.chat-msg-emma .chat-bubble {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-msg-user .chat-bubble {
  background: linear-gradient(135deg, var(--primary), var(--primary-d));
  color: #fff; border-bottom-right-radius: 4px;
}

.convo-mic-row { display: flex; align-items: center; justify-content: center; gap: 16px; }
.convo-mic-hint { font-size: 0.8rem; color: var(--text-dim); text-align: center; }

/* ══════════════════════════════════════════════════════════
   COMPLETION SCREEN
   ══════════════════════════════════════════════════════════ */
#screen-completion {
  flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; padding: 32px;
  background: radial-gradient(ellipse 60% 50% at 50% 40%, rgba(124,58,237,0.15), transparent 70%);
}

.completion-card {
  background: var(--bg-card); border: 1px solid var(--border-l);
  border-radius: var(--radius-xl); padding: 52px 48px; text-align: center;
  max-width: 480px; width: 100%; box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.completion-emoji { font-size: 4rem; margin-bottom: 12px; animation: bounce 0.6s ease 0.3s both; }
@keyframes bounce {
  0%  { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); }
  100%{ transform: scale(1);  opacity: 1; }
}

.completion-title { font-family: 'Poppins', sans-serif; font-size: 2rem; font-weight: 800; margin-bottom: 4px; }
.completion-lesson { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 28px; }

.completion-stars { display: flex; gap: 12px; justify-content: center; margin-bottom: 28px; }
.big-star { font-size: 3rem; color: var(--bg-surface); transition: color 0.3s, transform 0.3s; }
.big-star.star-filled { color: var(--gold-l); }
.big-star.star-pop { animation: star-pop 0.4s cubic-bezier(0.175,0.885,0.32,1.275) both; }
@keyframes star-pop {
  0%  { transform: scale(0) rotate(-20deg); }
  100%{ transform: scale(1) rotate(0); color: var(--gold-l); }
}

.completion-stats {
  display: flex; gap: 16px; justify-content: center; margin-bottom: 32px;
}
.completion-stat {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 24px; min-width: 120px;
}
.completion-stat-val { font-size: 1.5rem; font-weight: 800; color: var(--primary-l); margin-bottom: 2px; }
.completion-stat-label { font-size: 0.75rem; color: var(--text-muted); }

.completion-buttons { display: flex; flex-direction: column; gap: 12px; }
.btn-completion-primary {
  padding: 16px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary), var(--primary-d));
  border: none; color: #fff; font-family: 'Inter', sans-serif;
  font-size: 1rem; font-weight: 700; cursor: pointer; transition: var(--transition);
  box-shadow: 0 4px 20px rgba(124,58,237,0.4);
}
.btn-completion-primary:hover {
  transform: translateY(-2px); box-shadow: 0 8px 32px rgba(124,58,237,0.5);
}
.btn-completion-secondary {
  padding: 14px; border-radius: var(--radius);
  background: transparent; border: 1.5px solid var(--border);
  color: var(--text-muted); font-family: 'Inter', sans-serif;
  font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: var(--transition);
}
.btn-completion-secondary:hover { border-color: var(--border-l); color: var(--text); }

/* ══════════════════════════════════════════════════════════
   ACHIEVEMENT TOAST
   ══════════════════════════════════════════════════════════ */
.achievement-toast {
  position: fixed; bottom: 32px; right: 32px; z-index: 9000;
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-card); border: 1px solid rgba(245,158,11,0.4);
  border-radius: var(--radius-lg); padding: 16px 20px;
  box-shadow: var(--shadow-lg), 0 0 30px rgba(245,158,11,0.2);
  transform: translateX(120%); transition: transform 0.4s cubic-bezier(0.175,0.885,0.32,1.275);
  min-width: 280px; max-width: 340px;
}
.achievement-toast.show { transform: translateX(0); }
.achievement-icon { font-size: 2rem; flex-shrink: 0; }
.achievement-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--gold); margin-bottom: 2px; }
.achievement-name { font-weight: 700; font-size: 0.95rem; }

/* ══════════════════════════════════════════════════════════
   COST INFO BANNER & MODEL SELECTOR
   ══════════════════════════════════════════════════════════ */
.cost-info-banner {
  display: flex; align-items: flex-start; gap: 12px;
  background: rgba(16,185,129,0.07); border: 1px solid rgba(16,185,129,0.25);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 20px;
  font-size: 0.83rem; line-height: 1.5; color: var(--text-muted);
}
.cost-info-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }
.cost-info-banner strong { color: var(--success-l); }
.cost-info-link {
  display: inline-block; margin-top: 4px; font-size: 0.78rem;
  color: var(--accent-l); text-decoration: none; font-weight: 600;
}
.cost-info-link:hover { text-decoration: underline; }

.form-select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 36px; cursor: pointer;
}
.form-select option { background: #1e1e38; color: var(--text); }

/* ══════════════════════════════════════════════════════════
   WRITING PHASE
   ══════════════════════════════════════════════════════════ */
.writing-exercise-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px;
  box-shadow: var(--shadow);
  background-image: linear-gradient(135deg, rgba(139,92,246,0.04), rgba(6,182,212,0.02));
}

.writing-block { display: flex; flex-direction: column; gap: 12px; }

.writing-label {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-dim);
}

.writing-source {
  font-size: 1.6rem; font-weight: 700; color: var(--text);
  padding: 16px 0; border-bottom: 1px solid var(--border);
  font-family: 'Poppins', sans-serif;
}

.writing-sentence {
  font-size: 1.2rem; font-weight: 500; line-height: 1.8;
  padding-bottom: 12px;
}

.writing-hint-badge {
  display: inline-block; background: rgba(124,58,237,0.1);
  border: 1px solid rgba(124,58,237,0.2); border-radius: 100px;
  padding: 6px 16px; font-size: 0.8rem; color: var(--primary-l);
  font-weight: 500; align-self: flex-start;
}

.writing-input-area {
  display: flex; flex-direction: column; gap: 12px;
}

.writing-textarea {
  width: 100%; padding: 16px 18px; resize: vertical; min-height: 90px;
  background: var(--bg-surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: 'Inter', sans-serif; font-size: 1rem; line-height: 1.6;
  transition: var(--transition); outline: none;
}
.writing-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}
.writing-textarea::placeholder { color: var(--text-dim); }

.writing-actions {
  display: flex; gap: 10px; align-items: center;
}

.writing-ai-feedback {
  background: rgba(124,58,237,0.06); border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--radius); padding: 16px 20px;
  animation: slideUp 0.3s ease;
}
.ai-feedback-header {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--primary-l); margin-bottom: 6px;
}
.ai-feedback-text {
  font-size: 0.9rem; color: var(--text-muted); line-height: 1.6;
}


/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .dash-header { padding: 14px 16px; }
  .dash-stats  { gap: 10px; }
  .stat-chip   { padding: 6px 10px; font-size: 0.78rem; }
  .progress-overview { flex-direction: column; gap: 20px; padding: 20px; }
  .progress-badges   { justify-content: center; }
  .dash-content      { padding: 16px; }
  .lesson-grid       { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .lesson-card       { padding: 18px 14px; }
  .mc-options        { grid-template-columns: 1fr; }
  .onboarding-card   { padding: 32px 24px; }
  .completion-card   { padding: 36px 24px; }
  .onboarding-features { grid-template-columns: 1fr; }
  .fill-text-row     { flex-direction: column; }
  .level-tabs        { flex-wrap: wrap; }
  .level-tab         { flex: 1; min-width: 100px; justify-content: center; }
}

@media (max-width: 480px) {
  .lesson-grid { grid-template-columns: 1fr 1fr; }
  .vocab-word-en { font-size: 2.2rem; }
  .chat-bubble   { max-width: 85%; }
}
