/* ─── RESET & BASE ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --primary:       #F59E0B;
  --primary-dark:  #D97706;
  --primary-light: #FDE68A;
  --success:       #059669;
  --success-light: #D1FAE5;
  --error:         #DC2626;
  --error-light:   #FEE2E2;
  --info:          #2563EB;
  --info-light:    #DBEAFE;
  --bg:            #FFF8ED;
  --card:          #FFFFFF;
  --text:          #111827;
  --text-muted:    #6B7280;
  --text-light:    #9CA3AF;
  --border:        #E5D8C0;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.08);
  --shadow:        0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:     0 8px 24px rgba(0,0,0,.14);
  --radius:        12px;
  --radius-sm:     8px;
  --radius-lg:     20px;
  --font:          'Nunito', system-ui, -apple-system, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 16px;
}

#app { min-height: 100vh; }

/* ─── SPLASH ────────────────────────────────────────────────────────────────── */
.splash {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; gap: 12px;
  background: var(--bg);
}
.splash-icon { font-size: 4rem; animation: bounce 1s infinite; display: flex; align-items: center; justify-content: center; }
.splash-mascot {
  position: relative;
  width: 110px;
  height: 120px;
  animation: bounce 1.2s ease-in-out infinite;
}
.splash-lemur {
  width: 110px;
  height: 110px;
  display: block;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,.18));
}
.splash-flag {
  position: absolute;
  bottom: 0;
  right: -14px;
  width: 44px;
  height: auto;
  border-radius: 5px;
  box-shadow: 0 2px 8px rgba(0,0,0,.30);
  border: 1.5px solid rgba(255,255,255,.6);
}
.splash h1 { font-size: 1.8rem; font-weight: 900; color: var(--primary-dark); }
.splash p  { color: var(--text-muted); }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ─── BUTTONS ───────────────────────────────────────────────────────────────── */
button { cursor: pointer; border: none; outline: none; font-family: var(--font); transition: all .15s; }
button:active { transform: scale(.97); }
button:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 1rem;
  box-shadow: 0 3px 0 var(--primary-dark);
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }

.btn-secondary {
  background: var(--card);
  color: var(--text);
  font-weight: 700;
  padding: 12px 24px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  font-size: 1rem;
}
.btn-secondary:hover { background: #F9F5ED; }

.btn-danger {
  background: var(--error);
  color: #fff;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: var(--radius);
}
.btn-danger:hover { background: #B91C1C; }

.btn-back {
  background: none;
  color: var(--text-muted);
  font-size: .95rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.btn-back:hover { color: var(--text); background: #F3E8D0; }

.btn-icon-only {
  background: var(--card);
  border: 2px solid var(--border);
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
}
.btn-icon-only:hover { background: var(--primary-light); }

/* ─── MODAL ─────────────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.modal-box {
  position: relative; z-index: 1;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 380px; width: 90%;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.modal-box h3 { font-size: 1.3rem; font-weight: 900; margin-bottom: 8px; }
.modal-box p  { color: var(--text-muted); margin-bottom: 20px; }
.modal-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1.1rem;
  font-family: var(--font);
  font-weight: 700;
  text-align: center;
  outline: none;
  margin-bottom: 20px;
  transition: border-color .15s;
}
.modal-input:focus { border-color: var(--primary); }
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.modal-actions .btn-secondary,
.modal-actions .btn-primary,
.modal-actions .btn-danger {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 220px;
  font-size: .9rem;
  padding: 10px 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── PROFILE PAGE ──────────────────────────────────────────────────────────── */
.profile-page {
  min-height: 100vh;
  display: flex; flex-direction: column;
  max-width: 680px; margin: 0 auto; padding: 0 16px 40px;
}

.profile-header {
  text-align: center;
  padding: 40px 16px 24px;
}
/* ── Welcome screen (ProfileView) ─────────────────── */
.app-logo-wrap { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 2.6rem; margin-bottom: 10px; }
.app-logo-flag { filter: drop-shadow(0 2px 4px rgba(0,0,0,.15)); }
.app-logo-x { font-size: 1.2rem; color: var(--text-muted); font-weight: 300; }
.app-title { font-size: 1.9rem; font-weight: 900; color: var(--primary-dark); line-height: 1.15; }
.app-title-mg { font-size: 1.2rem; font-weight: 700; color: var(--primary); }
.app-subtitle { color: var(--text-muted); font-size: .95rem; margin-top: 8px; }
.app-subtitle-mg { color: var(--text-light); font-size: .82rem; font-style: italic; margin-top: 4px; }
.app-stats-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.app-stat-chip { background: var(--primary); color: #fff; border-radius: 20px; padding: 4px 12px; font-size: .8rem; font-weight: 700; }
/* assessment choice modal */
.choice-header { font-size: 2.5rem; text-align: center; margin-bottom: 4px; }
.choice-actions { justify-content: center; gap: 12px; }
.modal-sub { font-size: .82rem; color: var(--text-muted); margin-top: 4px; }

.profile-body { flex: 1; }
.section-title { font-size: 1.1rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 16px; }

.profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.profile-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  border: 2px solid transparent;
  transition: all .2s;
  position: relative;
}
.profile-card:hover { border-color: var(--primary); transform: translateY(-3px); box-shadow: var(--shadow); }

.profile-delete {
  position: absolute; top: 8px; right: 8px;
  background: none; color: var(--text-light);
  font-size: .8rem; width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.profile-delete:hover { background: var(--error-light); color: var(--error); }

.profile-avatar { font-size: 2.5rem; margin-bottom: 8px; }
.profile-name { font-weight: 800; font-size: 1.1rem; margin-bottom: 4px; }
.profile-level-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.level-A1 { background: #FEF3C7; color: #92400E; }
.level-A2 { background: #DBEAFE; color: #1E40AF; }
.level-B1 { background: #D1FAE5; color: #064E3B; }
.level-B1\+ { background: #EDE9FE; color: #4C1D95; }

.profile-stats { display: flex; justify-content: center; gap: 10px; margin-bottom: 4px; font-size: .85rem; }
.stat { color: var(--text-muted); }
.profile-title { font-weight: 700; font-size: .85rem; color: var(--primary-dark); }
.profile-last { font-size: .75rem; color: var(--text-light); margin-top: 4px; }

.empty-profiles { text-align: center; padding: 32px; color: var(--text-muted); background: var(--card); border-radius: var(--radius); border: 2px dashed var(--border); }
.empty-profiles strong { color: var(--primary-dark); }

.btn-new-profile {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 14px;
  background: var(--card);
  border: 2px dashed var(--primary);
  border-radius: var(--radius-lg);
  font-size: 1rem; font-weight: 800; color: var(--primary-dark);
  margin-top: 8px;
}
.btn-new-profile:hover { background: var(--primary-light); }
.btn-icon { font-size: 1.2rem; }

/* ─── DASHBOARD ─────────────────────────────────────────────────────────────── */
.dashboard-page { max-width: 680px; margin: 0 auto; padding-bottom: 60px; }

.dash-header {
  background: linear-gradient(135deg, #F59E0B, #F97316);
  color: #fff;
  padding: 20px 20px 24px;
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 10;
}
.dash-header-left { display: flex; align-items: center; gap: 12px; }
.dash-name { font-weight: 900; font-size: 1.1rem; }
.dash-title { font-size: .8rem; opacity: .85; }
.dash-header-right { display: flex; gap: 8px; }

.stat-badge {
  background: rgba(255,255,255,.25);
  backdrop-filter: blur(4px);
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 800;
  font-size: .9rem;
  color: #fff;
}
.xp-badge { background: rgba(255,255,255,.3); }

.dash-content { padding: 20px 16px; }

.xp-bar-section { margin-bottom: 20px; }
.xp-bar-label { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; }
.xp-bar-track { height: 10px; background: #E9D5A0; border-radius: 10px; overflow: hidden; }
.xp-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #F97316); border-radius: 10px; transition: width .6s ease; }


/* Learning Path */
.learning-path { display: flex; flex-direction: column; align-items: stretch; }

.topic-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: var(--shadow-sm);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all .2s;
}
.topic-card.available:hover { border-color: var(--topic-dark, var(--primary)); transform: translateX(4px); box-shadow: var(--shadow); }
.topic-card.completed { border-color: var(--success); }
.topic-card.locked { opacity: .6; cursor: default; }
.topic-card-left { display: flex; align-items: center; gap: 14px; flex: 1; }

.topic-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.topic-info { flex: 1; min-width: 0; }
.topic-name { font-weight: 800; font-size: 1rem; }
.topic-level-tag {
  display: inline-block;
  font-size: .7rem; font-weight: 800;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary-dark);
  margin-top: 2px;
}

.topic-progress-bar-wrap { margin-top: 6px; }
.topic-progress-bar { height: 6px; background: #EEE5D4; border-radius: 6px; overflow: hidden; margin-bottom: 3px; }
.topic-progress-fill { height: 100%; border-radius: 6px; transition: width .5s; }
.topic-progress-text { font-size: .72rem; color: var(--text-light); }
.topic-locked-msg { font-size: .75rem; color: var(--text-light); margin-top: 4px; }

.topic-card-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.status-icon { font-size: 1.2rem; }
.topic-theory-btn {
  background: var(--info-light); color: var(--info);
  border-radius: var(--radius-sm);
  padding: 4px 8px; font-size: .85rem;
}
.topic-theory-btn:hover { background: var(--info); color: #fff; }
.topic-arrow { font-size: 1.4rem; color: var(--text-light); font-weight: 300; }

.path-connector {
  width: 3px; height: 20px;
  background: var(--border);
  margin: 0 auto;
  border-radius: 3px;
}

/* ─── EXERCISE PAGE ─────────────────────────────────────────────────────────── */
.exercise-page { max-width: 640px; margin: 0 auto; padding-bottom: 40px; }

.ex-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.ex-topic-label { font-weight: 800; font-size: .9rem; color: var(--text-muted); }
.ex-progress-text { font-weight: 800; font-size: .9rem; color: var(--primary-dark); }

.ex-progress-track { height: 6px; background: var(--border); }
.ex-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #F97316); transition: width .4s; }

.ex-body { padding: 20px 16px; display: flex; flex-direction: column; gap: 16px; }

.ex-type-badge, .ex-level-badge {
  display: inline-block;
  font-size: .75rem; font-weight: 800;
  padding: 3px 10px; border-radius: 20px;
  margin-right: 6px;
}
.ex-type-badge { background: #FEF3C7; color: #92400E; }
.ex-level-badge { /* uses .level-A1 etc */ }

.ex-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}
.ex-instruction { font-weight: 700; color: var(--text-muted); margin-bottom: 4px; font-size: .95rem; }
.ex-instruction-mg { font-size: .78rem; color: var(--text-light); font-style: italic; margin-bottom: 14px; }
.ex-q-mg {
  font-size: .75rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 4px;
}

.ex-question { font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; line-height: 1.5; }
.blank { background: var(--primary-light); padding: 2px 12px; border-radius: 6px; color: var(--primary-dark); letter-spacing: .05em; }
.translate-q { display: flex; align-items: center; gap: 10px; }
.flag { font-size: 1.3rem; }

.answer-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem; font-family: var(--font); font-weight: 600;
  outline: none; transition: border-color .15s;
  background: var(--bg);
}
.answer-input:focus { border-color: var(--primary); background: #fff; }
.answer-input:disabled { background: #F9F5F0; color: var(--text-muted); }

/* Word order */
.word-order-q { display: flex; flex-direction: column; gap: 12px; }
.wo-answer-area {
  min-height: 44px;
  border: 2px dashed var(--primary);
  border-radius: var(--radius);
  padding: 8px 10px;
  display: flex; flex-wrap: wrap; gap: 6px;
  background: #FFFBF5;
}
.wo-bank { display: flex; flex-wrap: wrap; gap: 8px; }
.wo-word {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 800; font-size: .9rem;
}
.wo-word:hover:not(:disabled) { background: var(--primary); color: #fff; }
.wo-word.used, .wo-word:disabled { opacity: .35; cursor: default; }
.wo-chip {
  background: var(--primary);
  color: #fff;
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 800; font-size: .9rem;
}
.wo-chip:hover { background: var(--error); }

/* Listening */
.listening-q { text-align: center; }
.btn-listen {
  background: var(--primary);
  color: #fff;
  padding: 14px 28px;
  border-radius: var(--radius);
  font-size: 1rem; font-weight: 800;
  margin-bottom: 12px;
  box-shadow: 0 3px 0 var(--primary-dark);
}
.btn-listen:hover { background: var(--primary-dark); }
.listen-hint { font-size: .85rem; color: var(--text-muted); }

/* Error correct */
.error-q { }
.error-label { font-size: .85rem; font-weight: 700; color: var(--error); margin-bottom: 6px; }
.error-sentence { font-size: 1.05rem; background: var(--error-light); padding: 12px; border-radius: var(--radius-sm); border-left: 3px solid var(--error); margin-bottom: 10px; font-weight: 600; }
.error-task { font-size: .85rem; color: var(--text-muted); }

/* Actions */
.ex-actions { display: flex; gap: 10px; }
.btn-hint {
  flex: 1;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font-weight: 700; font-size: .9rem;
  color: var(--text-muted);
}
.btn-hint:hover:not(:disabled) { border-color: var(--primary); color: var(--primary-dark); }
.btn-hint:disabled { opacity: .4; cursor: default; }
.hint-cost { font-size: .75rem; opacity: .7; }

.btn-submit {
  flex: 2;
  background: var(--primary);
  color: #fff;
  padding: 13px;
  border-radius: var(--radius);
  font-weight: 800; font-size: 1rem;
  box-shadow: 0 3px 0 var(--primary-dark);
}
.btn-submit:hover { background: var(--primary-dark); }
.btn-next { background: var(--info); box-shadow: 0 3px 0 #1D4ED8; }
.btn-next:hover { background: #1D4ED8; }

/* Hint box */
.hint-box {
  background: #FFF9DB;
  border: 1px solid #FCD34D;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: .9rem;
  display: flex; gap: 8px; align-items: flex-start;
}
.hint-box.hidden { display: none; }
.hint-icon { flex-shrink: 0; }

/* Feedback */
.feedback-box {
  border-radius: var(--radius);
  padding: 16px;
  animation: slideIn .3s ease;
}
.feedback-box.hidden { display: none; }
.feedback-box.correct { background: var(--success-light); border: 2px solid var(--success); }
.feedback-box.incorrect { background: var(--error-light); border: 2px solid var(--error); }
.feedback-icon { font-size: 1.5rem; margin-bottom: 4px; }
.feedback-msg { font-weight: 800; font-size: 1rem; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.xp-gain { background: var(--primary); color: #fff; padding: 2px 10px; border-radius: 20px; font-size: .85rem; }
.feedback-answer { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; font-size: .9rem; }
.your-answer { color: var(--error); }
.correct-answer { color: var(--success); }
.also-accepted { color: var(--text-muted); font-size: .82rem; }
.also-accepted em { font-style: normal; font-weight: 600; }
.feedback-explanation { font-size: .85rem; color: var(--text-muted); border-top: 1px solid rgba(0,0,0,.08); padding-top: 8px; margin-top: 4px; }
/* Verb hint shown next to blank: ___ (go) */
.verb-hint { font-size: .85rem; color: var(--primary); font-weight: 600; margin-left: 4px; opacity: .8; }

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

/* ─── RESULTS PAGE ──────────────────────────────────────────────────────────── */
.results-page {
  max-width: 480px; margin: 0 auto;
  padding: 32px 16px;
  text-align: center;
  display: flex; flex-direction: column; gap: 20px;
}
.results-header { }
.results-emoji { font-size: 4rem; margin-bottom: 8px; }
.results-header h2 { font-size: 1.6rem; font-weight: 900; }

.results-score { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.score-circle {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) calc(var(--pct, 0) * 1%), var(--border) 0);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.score-inner {
  width: 78px; height: 78px;
  background: var(--card);
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.score-num { font-size: 1.8rem; font-weight: 900; color: var(--primary-dark); line-height: 1; }
.score-den { font-size: .8rem; color: var(--text-muted); font-weight: 700; }
.score-percent { font-weight: 800; color: var(--text-muted); }

.results-xp { background: var(--primary-light); color: var(--primary-dark); padding: 10px 20px; border-radius: 20px; font-weight: 800; font-size: 1.1rem; display: inline-block; }

.results-breakdown { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); text-align: left; }
.result-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: .85rem; }
.result-item:last-child { border-bottom: none; }
.result-item.ok { background: #F0FDF4; }
.result-item.err { background: #FEF2F2; }
.result-icon { flex-shrink: 0; }
.result-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.result-q { color: var(--text); font-weight: 600; }
.result-ans { color: var(--success); font-weight: 700; }
.result-expl { color: var(--text-muted); font-size: .78rem; font-style: italic; }

.results-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* ─── ASSESSMENT RESULT BANNER ───────────────────────────────────────────────── */
.assessment-result-banner {
  background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
  border: 2px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.arb-level-row { display: flex; align-items: center; gap: 14px; }
.arb-icon { font-size: 2.8rem; }
.arb-label { font-size: .8rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.arb-level { font-size: 1.5rem; font-weight: 900; color: var(--primary-dark); }
.arb-desc { font-size: .9rem; color: var(--text); font-weight: 600; }
.arb-score { font-size: .82rem; color: var(--text-muted); }
[data-theme="dark"] .assessment-result-banner { background: linear-gradient(135deg, #2A2000, #1E1800); border-color: var(--primary); }

/* ─── THEORY PAGE ───────────────────────────────────────────────────────────── */
.theory-page { min-height: 100vh; }
.theory-layout { display: flex; min-height: 100vh; }

/* Mobile bar for theory — hidden on desktop, shown on mobile via media query */
.theory-mobilebar { display: none; }

/* Close button inside sidebar — hidden on desktop */
.btn-sidebar-close { display: none; }

.theory-sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-back { margin-bottom: 8px; text-align: left; }
.sidebar-title { font-weight: 900; font-size: 1rem; color: var(--text); padding: 4px 8px; margin-bottom: 8px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 700; color: var(--text);
  background: none; text-align: left;
}
.sidebar-item:hover { background: var(--bg); }
.sidebar-item.active { background: var(--primary-light); color: var(--primary-dark); }
.sidebar-level { font-size: .7rem; font-weight: 800; color: var(--text-light); margin-left: auto; }

.theory-main { flex: 1; overflow-y: auto; padding: 24px; max-width: 700px; }

.vocab-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.vocab-tab {
  padding: 8px 16px;
  border-radius: 20px;
  background: var(--card);
  border: 2px solid var(--border);
  font-weight: 700; font-size: .85rem;
}
.vocab-tab:hover { border-color: var(--primary); }
.vocab-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.theory-content-inner { display: flex; flex-direction: column; gap: 20px; }
.theory-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.theory-title { font-size: 1.5rem; font-weight: 900; }
.theory-level-badge { background: var(--primary-light); color: var(--primary-dark); padding: 4px 12px; border-radius: 20px; font-size: .8rem; font-weight: 800; }
.theory-subtitle { color: var(--text-muted); font-size: 1rem; }

.malgasy-note {
  background: #F0FFF4; border-left: 4px solid var(--success);
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: .9rem; color: #065F46;
}

.theory-section { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.section-heading { font-size: 1.05rem; font-weight: 800; margin-bottom: 8px; }
.section-content { color: var(--text-muted); margin-bottom: 14px; font-size: .95rem; }

.examples-list { display: flex; flex-direction: column; gap: 10px; }
.example-row { background: var(--bg); border-radius: var(--radius-sm); padding: 10px 14px; }
.example-en { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .95rem; margin-bottom: 4px; }
.example-fr { font-size: .85rem; color: var(--text-muted); }

.tts-btn {
  width: 28px; height: 28px;
  background: var(--primary-light);
  border-radius: 50%;
  font-size: .8rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tts-btn:hover { background: var(--primary); color: #fff; }

.tips-box { background: #FFFBEB; border: 1px solid #FDE68A; border-radius: var(--radius); padding: 16px 20px; }
.tips-box h3 { font-size: 1rem; font-weight: 800; margin-bottom: 10px; }
.tips-box ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.tips-box li { font-size: .9rem; }

.theory-cta {
  display: flex; flex-wrap: wrap; gap: .6rem;
  justify-content: center; padding-top: 8px;
}

/* ─── MALGASY MANUAL (Boky fampianarana) ────────────────────────────────────── */
.sidebar-separator { height: 1px; background: var(--border); margin: 8px 0; }
.sidebar-item-mg { border-top: none; }

.mg-tabs {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px;
  padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.mg-tab {
  padding: 7px 13px; border-radius: 20px; border: 1.5px solid var(--border);
  background: var(--card); font-size: .8rem; font-weight: 600; cursor: pointer;
  color: var(--text-muted); transition: all .15s;
}
.mg-tab:hover { border-color: var(--primary); color: var(--primary); }
.mg-tab.active { background: #FFF3E0; border-color: #E65100; color: #E65100; }

.mg-disclaimer {
  background: #FFF8E1; border-left: 4px solid #FFC107;
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: .82rem; color: #795548; margin-bottom: 18px;
}
.mg-subtitle { font-size: .85rem; color: var(--text-muted); margin-bottom: 12px; font-style: italic; }
.mg-explanation {
  background: var(--primary-light); border-left: 4px solid var(--primary);
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: .92rem; line-height: 1.6; margin-bottom: 20px; color: var(--text);
}

.mg-table-wrap { overflow-x: auto; margin-bottom: 20px; }
.mg-table {
  width: 100%; border-collapse: collapse; font-size: .88rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.mg-table th {
  background: var(--primary); color: #fff; padding: 9px 12px;
  text-align: left; font-weight: 700; font-size: .82rem;
}
.mg-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.mg-table tr:last-child td { border-bottom: none; }
.mg-table tr:nth-child(even) td { background: var(--bg); }
.mg-col-label { min-width: 110px; }
.mg-col-struct { min-width: 140px; }
.mg-col-struct code {
  background: #F3F4F6; padding: 2px 6px; border-radius: 4px;
  font-size: .8rem; white-space: pre-line; display: inline-block; line-height: 1.5;
}
.mg-col-en { min-width: 150px; display: flex; align-items: flex-start; gap: 6px; }
.mg-col-mg { min-width: 150px; font-style: italic; color: #2E7D32; }
.mg-col-note { min-width: 120px; font-size: .78rem; color: var(--text-muted); }

.mg-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn-secondary {
  padding: 11px 20px; border-radius: var(--radius); border: 2px solid var(--primary);
  background: #fff; color: var(--primary); font-weight: 700; font-size: .95rem; cursor: pointer;
}
.btn-secondary:hover { background: var(--primary-light); }

/* Vocab cards */
.vocab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.vocab-card { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.vocab-card-top { margin-bottom: 8px; }
.vocab-en { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1rem; margin-bottom: 3px; }
.vocab-fr { font-size: .85rem; color: var(--text-muted); }
.vocab-mg { font-size: .8rem; color: var(--success); font-style: italic; margin-top: 2px; }
.vocab-example { font-size: .8rem; color: var(--text-light); border-top: 1px solid var(--border); padding-top: 8px; margin-top: 6px; display: flex; justify-content: space-between; align-items: center; gap: 6px; }

/* ─── VOCABULARY PAGE ───────────────────────────────────────────────────────── */
.vocabulary-page { min-height: 100vh; background: var(--bg); }
.vocab-layout { display: flex; min-height: 100vh; }
.vocab-sidebar { width: 240px; min-width: 200px; background: var(--card); border-right: 1px solid var(--border); padding: 16px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.vocab-main { flex: 1; padding: 24px; overflow-y: auto; }
/* Mobile bar — hidden on desktop */
.vocab-mobilebar { display: none; }
.vocab-search { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: var(--font); font-size: .9rem; }
.vocab-search:focus { outline: 2px solid var(--primary); border-color: transparent; }
.vocab-content { max-width: 900px; }
.vocab-title { font-size: 1.5rem; font-weight: 900; }
.vocab-count { background: var(--primary-light); color: var(--primary-dark); border-radius: 20px; padding: 3px 12px; font-size: .85rem; font-weight: 700; }
.vocab-empty { color: var(--text-muted); font-style: italic; padding: 40px; text-align: center; }
.tts-btn.playing { background: var(--primary); color: #fff; }

/* ─── QUICK ACTIONS GRID ────────────────────────────────────────────────────── */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.quick-btn { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 14px 16px; font-size: .95rem; font-weight: 700; color: var(--text); box-shadow: var(--shadow-sm); }
.quick-btn:hover { border-color: var(--primary); background: var(--primary-light); transform: translateY(-1px); }
.quick-btn.primary-btn { background: var(--primary); color: #fff; border-color: var(--primary-dark); }
.quick-btn.primary-btn:hover { background: var(--primary-dark); }
.quick-icon { font-size: 1.3rem; }

/* ─── LEGEND SECTION (collapsible) ──────────────────────────────────────────── */
.legend-section { margin-bottom: 24px; }
.legend-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
  font-size: .95rem; font-weight: 800; color: var(--text);
  box-shadow: var(--shadow-sm); margin-bottom: 0;
}
.legend-toggle:hover { border-color: var(--primary); background: var(--primary-light); }
.legend-toggle[aria-expanded="true"] { border-radius: var(--radius) var(--radius) 0 0; border-bottom-color: transparent; margin-bottom: 0; }
.legend-toggle-arrow { font-size: .85rem; color: var(--text-muted); transition: transform .2s; }
.legend-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding-top: 10px;
}
.legend-item { display: flex; align-items: flex-start; gap: 10px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow-sm); }
.legend-icon { font-size: 1.4rem; flex-shrink: 0; margin-top: 1px; }
.legend-name { font-weight: 800; font-size: .9rem; color: var(--text); margin-bottom: 2px; }
.legend-desc { font-size: .78rem; color: var(--text-muted); line-height: 1.4; }

/* ─── ASSESSMENT BANNER ─────────────────────────────────────────────────────── */
.assessment-banner {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; border-radius: var(--radius); padding: 16px 20px;
  margin-bottom: 20px; cursor: pointer; box-shadow: var(--shadow);
  border: none; width: 100%; text-align: left;
}
.assessment-banner:hover { filter: brightness(1.07); }
.assessment-banner-left { display: flex; align-items: center; gap: 14px; }
.assessment-icon { font-size: 2rem; }
.assessment-title { font-size: 1.05rem; font-weight: 800; }
.assessment-sub { font-size: .82rem; opacity: .88; margin-top: 2px; }
.assessment-arrow { font-size: 1.8rem; font-weight: 700; opacity: .8; }

/* ─── DIALOGUE LIST PAGE ────────────────────────────────────────────────────── */
.dialogue-list-page { min-height: 100vh; background: var(--bg); }
.sub-header { display: flex; align-items: center; gap: 16px; padding: 16px 20px; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.sub-header h2 { font-size: 1.3rem; font-weight: 900; }
.sub-intro { padding: 16px 20px; }
.sub-intro p { color: var(--text-muted); font-size: .9rem; }
.mg-note { font-style: italic; font-size: .85rem; color: var(--success); margin-top: 4px; }
.dialogue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; padding: 0 20px 24px; }
.dialogue-card { background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; align-items: flex-start; gap: 14px; text-align: left; box-shadow: var(--shadow-sm); }
.dialogue-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.dialogue-icon { font-size: 2.2rem; flex-shrink: 0; }
.dialogue-info { flex: 1; }
.dialogue-title { font-size: 1rem; font-weight: 800; margin-bottom: 4px; }
.dialogue-desc { font-size: .82rem; color: var(--text-muted); }
.dialogue-mg { font-size: .78rem; color: var(--success); font-style: italic; margin-top: 3px; }
.dialogue-level { background: var(--primary-light); color: var(--primary-dark); border-radius: 12px; padding: 2px 10px; font-size: .78rem; font-weight: 700; flex-shrink: 0; }
.dialogue-card.level-B1 .dialogue-level { background: #DBEAFE; color: #1D4ED8; }

/* ─── DIALOGUE SESSION ──────────────────────────────────────────────────────── */
.dialogue-page { min-height: 100vh; background: var(--bg); display: flex; flex-direction: column; }
.dialogue-intro { padding: 12px 20px; background: var(--card); border-bottom: 1px solid var(--border); }
.dialogue-intro h3 { font-size: 1rem; font-weight: 800; }
.dialogue-chat { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.chat-turn { display: flex; flex-direction: column; max-width: 85%; }
.chat-turn.other { align-self: flex-start; }
.chat-turn.user { align-self: flex-end; align-items: flex-end; }
.chat-speaker { font-size: .75rem; font-weight: 700; color: var(--text-muted); margin-bottom: 3px; }
.chat-bubble { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; box-shadow: var(--shadow-sm); }
.chat-turn.user .chat-bubble { background: var(--primary-light); border-color: var(--primary); }
.chat-en { font-size: .95rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chat-fr { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.turn-blank { background: #E5D8C0; border-radius: 6px; padding: 2px 20px; font-style: italic; color: var(--text-muted); }
#dialogue-actions { padding: 12px 20px; background: var(--card); border-top: 1px solid var(--border); }
.dialogue-task { display: flex; flex-direction: column; gap: 10px; }
.task-french { font-size: .9rem; color: var(--text-muted); }
.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice-btn { background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; text-align: left; font-size: .9rem; }
.choice-btn:hover { border-color: var(--primary); background: var(--primary-light); }
.dialogue-task-btns { display: flex; gap: 10px; }
.dialogue-complete { text-align: center; padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.results-score-line { font-size: 1.1rem; font-weight: 700; color: var(--primary-dark); }

/* Sub-header shared by multiple pages */
.sub-header .btn-back { background: none; color: var(--text-muted); font-size: .9rem; padding: 6px 10px; border-radius: var(--radius-sm); }
.sub-header .btn-back:hover { background: var(--bg); }

/* ─── ANIMATIONS ────────────────────────────────────────────────────────────── */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-6px); }
  40%,80% { transform: translateX(6px); }
}
.shake { animation: shake .4s ease; }

/* ─── RESPONSIVE ────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .theory-sidebar { display: none; }
  .vocab-sidebar  { display: none; }

  /* Vocab sidebar overlay on mobile */
  .vocab-sidebar.mobile-open {
    display: flex !important;
    position: fixed;
    top: 0; left: 0;
    width: 82vw; max-width: 300px;
    height: 100vh;
    z-index: 300;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideInLeft .22s ease;
  }
  .vocab-mobilebar {
    display: flex;
    align-items: center; gap: 10px;
    padding: 10px 16px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
  }
  .vocab-mobilebar .btn-back { flex-shrink: 0; }
  .vocab-main { padding: 14px !important; }

  /* Theory sidebar overlay on mobile */
  .theory-sidebar.mobile-open {
    display: flex !important;
    position: fixed;
    top: 0; left: 0;
    width: 82vw; max-width: 300px;
    height: 100vh;
    z-index: 300;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideInLeft .22s ease;
  }

  /* Show mobile TOC button in theory topbar */
  .theory-topbar .btn-mobile-toc,
  .theory-mobilebar .btn-mobile-toc {
    display: inline-flex;
    align-items: center; gap: 5px;
    padding: 7px 12px;
    background: var(--primary); color: #fff;
    border: none; border-radius: var(--radius-sm);
    font-weight: 800; font-size: .85rem;
    cursor: pointer; white-space: nowrap;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
  }

  /* Theory mobile bar */
  .theory-mobilebar {
    display: flex;
    align-items: center; gap: 10px;
    padding: 10px 16px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
  }
  .theory-mobilebar .btn-back { flex-shrink: 0; }
  .theory-main { padding: 16px !important; }
  .dash-header { padding: 14px 14px 18px; }
  .profiles-grid { grid-template-columns: repeat(2, 1fr); }
  .vocab-grid { grid-template-columns: 1fr; }
  .results-actions { flex-direction: column; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .dialogue-grid { grid-template-columns: 1fr; }
}

/* ─── BOKY FAMPIANARANA ─────────────────────────────────────────────────────── */
.boky-page { min-height: 100vh; background: var(--bg); }

.boky-layout {
  display: flex; min-height: 100vh;
}

/* Sidebar */
.boky-sidebar {
  width: 260px; min-width: 220px; max-width: 280px;
  background: var(--card); border-right: 1px solid var(--border);
  padding: 16px 12px; display: flex; flex-direction: column;
  gap: 10px; overflow-y: auto; position: sticky; top: 0; height: 100vh;
}
.boky-back { align-self: flex-start; }
.boky-sidebar-title {
  font-size: .9rem; font-weight: 800; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em; padding: 0 4px;
}
.boky-toc { display: flex; flex-direction: column; gap: 2px; }
.boky-toc-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border-radius: var(--radius-sm); border: none;
  background: none; text-align: left; cursor: pointer; font-size: .85rem;
  font-weight: 600; color: var(--text-muted); transition: all .12s;
}
.boky-toc-item:hover { background: var(--primary-light); color: var(--text); }
.boky-toc-item.active { background: var(--primary); color: #fff; }
.boky-toc-icon { font-size: 1rem; flex-shrink: 0; }
.boky-toc-label { flex: 1; line-height: 1.3; }
.boky-toc-level {
  font-size: .7rem; background: rgba(0,0,0,.08); padding: 2px 5px;
  border-radius: 4px; flex-shrink: 0; font-weight: 700;
}
.boky-toc-item.active .boky-toc-level { background: rgba(255,255,255,.25); color: #fff; }

/* Main */
.boky-main {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column;
}
.boky-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10; flex-wrap: wrap; gap: 10px;
}
.boky-breadcrumb {
  display: flex; align-items: center; gap: 8px; font-size: .95rem; font-weight: 700;
}
.boky-level-badge {
  font-size: .72rem; background: var(--primary-light); color: var(--primary-dark);
  padding: 2px 8px; border-radius: 10px; font-weight: 800;
}
.boky-lang-toggle {
  padding: 8px 16px; border-radius: 20px; border: 2px solid var(--primary);
  background: #fff; color: var(--primary-dark); font-weight: 800; font-size: .85rem;
  cursor: pointer; transition: all .15s;
}
.boky-lang-toggle:hover { background: var(--primary); color: #fff; }

/* Chapter content */
.boky-content { padding: 24px; max-width: 860px; }
.boky-chapter { display: flex; flex-direction: column; gap: 22px; }

.boky-mg-disclaimer {
  background: #FFF8E1; border-left: 4px solid #FFC107;
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: .82rem; color: #795548;
}
.boky-intro {
  background: var(--primary-light); border-left: 4px solid var(--primary);
  padding: 14px 18px; border-radius: var(--radius-sm);
  font-size: .95rem; line-height: 1.7; color: var(--text);
}

.boky-section { display: flex; flex-direction: column; gap: 10px; }
.boky-section-title { font-size: 1rem; font-weight: 800; color: var(--text); }
.boky-section-desc { font-size: .88rem; color: var(--text-muted); line-height: 1.6; }

.boky-table-wrap { overflow-x: auto; }
.boky-table {
  width: 100%; border-collapse: collapse; font-size: .88rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.boky-table th {
  background: #F3F4F6; color: var(--text); padding: 8px 12px;
  text-align: left; font-weight: 700; font-size: .8rem;
  border-bottom: 2px solid var(--border);
}
.boky-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.boky-table tr:last-child td { border-bottom: none; }
.boky-table tr:hover td { background: #FAFAFA; }
.boky-en { font-weight: 600; }
.boky-tr { color: var(--text-muted); }
.boky-uncertain { color: #E65100; font-style: italic; }
.boky-tts-col { width: 48px; text-align: center; }
.boky-tts-cell { text-align: center; }

.boky-errors {
  background: var(--error-light); border: 1px solid var(--error);
  border-radius: var(--radius); padding: 14px 18px;
}
.boky-errors h3 { font-size: .9rem; font-weight: 800; margin-bottom: 8px; color: var(--error); }
.boky-errors ul { padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.boky-errors li { font-size: .87rem; line-height: 1.5; color: #7F1D1D; }

.boky-tips {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
}
.boky-tips h3 { font-size: .9rem; font-weight: 800; margin-bottom: 10px; color: var(--text); }
.boky-tips ul { padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.boky-tips li { font-size: .87rem; line-height: 1.5; color: var(--text-muted); }
.boky-tips li.boky-uncertain { color: #E65100; font-style: italic; }

.boky-cta { text-align: center; padding: 8px 0 16px; }

.boky-summary {
  background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
  border-left: 4px solid #3B82F6;
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  margin: 12px 0;
}
.boky-summary h3 { font-size: .9rem; font-weight: 800; margin-bottom: 8px; color: #1D4ED8; }
.boky-summary ul { padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.boky-summary li { font-size: .87rem; line-height: 1.5; color: #1E40AF; }

.boky-qexercises {
  background: #F0FDF4;
  border-left: 4px solid #22C55E;
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  margin: 12px 0;
}
.boky-qexercises h3 { font-size: .9rem; font-weight: 800; margin-bottom: 10px; color: #15803D; }
.boky-qlist { padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.boky-qitem { font-size: .87rem; line-height: 1.6; }
.boky-q { font-weight: 600; color: var(--text); }
.boky-qhint { font-size: .8rem; color: var(--text-muted); margin-left: 4px; }
.boky-reveal-btn { font-size: .78rem; padding: 2px 8px; margin-left: 8px; background: #22C55E; color: #fff; border: none; border-radius: 4px; cursor: pointer; }
.boky-reveal-btn:hover { background: #16A34A; }
.boky-answer { margin-left: 8px; font-weight: 700; color: #15803D; }

/* Mobile TOC button — shown only on small screens */
.btn-mobile-toc {
  display: none;
}

/* Sidebar backdrop (mobile only) */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 299;
  cursor: pointer;
}
.sidebar-backdrop.active { display: block; }

/* Responsive */
@media (max-width: 640px) {
  /* Hide sidebar by default on mobile */
  .boky-sidebar { display: none; }
  .boky-content { padding: 16px; }
  .boky-topbar { padding: 10px 16px; gap: 8px; }

  /* Show mobile TOC button in topbar */
  .btn-mobile-toc {
    display: inline-flex;
    align-items: center; gap: 5px;
    padding: 7px 12px;
    background: var(--primary); color: #fff;
    border: none; border-radius: var(--radius-sm);
    font-weight: 800; font-size: .85rem;
    cursor: pointer; white-space: nowrap;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
  }
  .btn-mobile-toc:hover { background: var(--primary-dark); }

  /* Sidebar as left-side overlay */
  .boky-sidebar.mobile-open {
    display: flex !important;
    position: fixed;
    top: 0; left: 0;
    width: 82vw; max-width: 300px;
    height: 100vh;
    z-index: 300;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideInLeft .22s ease;
  }

  /* Close button inside sidebar on mobile */
  .btn-sidebar-close {
    display: inline-flex;
    align-items: center; gap: 5px;
    padding: 6px 10px;
    background: var(--bg); color: var(--text-muted);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: .8rem; font-weight: 700;
    cursor: pointer; margin-bottom: 4px; align-self: flex-end;
  }
}

/* Slide-in animation */
@keyframes slideInLeft {
  from { transform: translateX(-100%); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

/* ─── TUTOR PAGE (Ollama chatbot) ───────────────────────────────────────────── */
.tutor-page { height: 100vh; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }

.tutor-layout { display: flex; flex-direction: column; height: 100%; }

.tutor-header {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  background: var(--card); border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm); flex-shrink: 0;
}
.tutor-header-title { display: flex; align-items: center; gap: 10px; flex: 1; }
.tutor-header-icon { font-size: 1.6rem; }
.tutor-title { font-size: 1rem; font-weight: 800; }
.tutor-subtitle { font-size: .75rem; color: var(--text-muted); margin-top: 1px; }
.tutor-status-online { color: var(--success) !important; }
.tutor-status-warn   { color: #D97706 !important; }
.tutor-status-offline{ color: var(--error) !important; }
.tutor-clear-btn {
  padding: 6px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: none; cursor: pointer; font-size: 1rem; color: var(--text-muted);
}
.tutor-clear-btn:hover { background: var(--error-light); color: var(--error); }

/* Messages list */
.tutor-messages {
  flex: 1; overflow-y: auto; padding: 16px; display: flex;
  flex-direction: column; gap: 14px;
}

/* Welcome block */
.tutor-welcome {
  text-align: center; padding: 24px 16px; max-width: 520px; margin: auto;
}
.tutor-welcome-icon { font-size: 3rem; margin-bottom: 10px; }
.tutor-welcome h2 { font-size: 1.1rem; font-weight: 800; margin-bottom: 8px; }
.tutor-welcome p { font-size: .9rem; color: var(--text-muted); margin-bottom: 6px; }
.tutor-welcome-mg { font-style: italic; font-size: .82rem !important; }
.tutor-suggestions {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px;
}
.tutor-suggestion {
  padding: 7px 13px; border-radius: 20px; border: 1.5px solid #7C3AED;
  background: #F5F3FF; color: #5B21B6; font-size: .8rem; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.tutor-suggestion:hover { background: #7C3AED; color: #fff; }

/* Message bubbles */
.tutor-msg { display: flex; }
.tutor-msg-user  { justify-content: flex-end; }
.tutor-msg-assistant { justify-content: flex-start; }
.tutor-msg-error { justify-content: center; }

.tutor-msg-bubble {
  display: flex; align-items: flex-start; gap: 8px;
  max-width: 82%; padding: 11px 14px; border-radius: 16px;
  line-height: 1.55; font-size: .9rem;
}
.tutor-msg-user .tutor-msg-bubble {
  background: #7C3AED; color: #fff; border-bottom-right-radius: 4px;
}
.tutor-msg-assistant .tutor-msg-bubble {
  background: var(--card); border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.tutor-msg-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.tutor-msg-content code {
  background: rgba(0,0,0,.08); padding: 1px 5px; border-radius: 4px;
  font-size: .85em; font-family: monospace;
}
.tutor-msg-user .tutor-msg-content code { background: rgba(255,255,255,.2); }

/* Thinking animation */
.tutor-dots { display: inline-flex; gap: 4px; align-items: center; }
.tutor-dots span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted);
  animation: tutorDot 1.2s infinite ease-in-out;
}
.tutor-dots span:nth-child(2) { animation-delay: .2s; }
.tutor-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes tutorDot { 0%,80%,100% { transform: scale(.6); opacity:.4; } 40% { transform: scale(1); opacity:1; } }

/* Error box */
.tutor-error-box {
  background: var(--error-light); border: 1px solid var(--error);
  border-radius: var(--radius-sm); padding: 12px 16px; font-size: .87rem;
  color: var(--error); max-width: 480px; text-align: center;
}

/* Input area */
.tutor-input-area {
  border-top: 1px solid var(--border); background: var(--card);
  padding: 12px 16px 10px; flex-shrink: 0;
}
.tutor-input-row { display: flex; gap: 8px; align-items: flex-end; }
.tutor-input {
  flex: 1; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius); font-family: var(--font); font-size: .9rem;
  resize: none; overflow-y: hidden; line-height: 1.4; background: var(--bg);
}
.tutor-input:focus { outline: none; border-color: #7C3AED; }
.tutor-send-btn {
  width: 42px; height: 42px; border-radius: 50%; background: #7C3AED;
  color: #fff; border: none; cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .15s;
}
.tutor-send-btn:hover:not(:disabled) { background: #5B21B6; }
.tutor-send-btn:disabled { opacity: .45; cursor: not-allowed; }
.tutor-info {
  font-size: .72rem; color: var(--text-muted); text-align: center; margin-top: 6px;
}

/* ─── VOCAB HEADER (flashcards button) ─────────────────────────────────────── */
.vocab-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.vocab-header-left { display: flex; align-items: center; gap: 12px; }
.flash-start-btn { font-size: .9rem; padding: 8px 16px; white-space: nowrap; }

/* ─── FLASHCARD MODE ────────────────────────────────────────────────────────── */
.flash-wrap { display: flex; flex-direction: column; align-items: center; padding: 24px 16px; max-width: 540px; margin: 0 auto; }
.flash-topbar { display: flex; align-items: center; gap: 12px; width: 100%; margin-bottom: 24px; }
.flash-counter { font-size: .9rem; font-weight: 700; color: var(--text-light); white-space: nowrap; }
.flash-progress-track { flex: 1; height: 8px; background: var(--border); border-radius: 8px; overflow: hidden; }
.flash-progress-fill { height: 100%; background: var(--primary); border-radius: 8px; transition: width .4s; }
.flash-stop-x { background: transparent; border: none; font-size: 1.1rem; color: var(--text-muted); padding: 4px 8px; cursor: pointer; }
.flash-stop-x:hover { color: var(--text); }

/* Card 3D flip */
.flash-scene { width: 100%; max-width: 420px; perspective: 1000px; margin-bottom: 24px; }
.flash-inner {
  position: relative; width: 100%; min-height: 220px;
  transform-style: preserve-3d; transition: transform .45s ease;
}
.flash-inner.flipped { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--card); border: 2px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 32px 24px; gap: 16px;
  min-height: 220px;
}
.flash-back { transform: rotateY(180deg); }

/* Front face */
.flash-front-content { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.flash-word { font-size: 1.8rem; font-weight: 900; color: var(--text); text-align: center; }
.flash-tts { font-size: 1.1rem; background: var(--primary-light); color: var(--primary-dark); border-radius: 50%; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border: none; cursor: pointer; }
.flash-tts:hover { background: var(--primary); color: #fff; }
.flash-reveal-btn { margin-top: 8px; }

/* Back face */
.flash-back-content { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.flash-fr { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.flash-mg { font-size: .95rem; color: #2E7D32; }
.flash-example { font-size: .85rem; color: var(--text-light); display: flex; align-items: center; gap: 8px; }

/* Know/Review buttons */
.flash-btns { display: flex; gap: 16px; width: 100%; max-width: 420px; }
.flash-btn {
  flex: 1; padding: 14px; border-radius: var(--radius); font-size: 1rem; font-weight: 700;
  cursor: pointer; border: 2px solid; transition: background .15s, color .15s;
}
.flash-btn-review { background: #FFF3E0; border-color: #F57C00; color: #E65100; }
.flash-btn-review:hover { background: #F57C00; color: #fff; }
.flash-btn-known { background: #E8F5E9; border-color: #388E3C; color: #1B5E20; }
.flash-btn-known:hover { background: #388E3C; color: #fff; }

/* Summary */
.flash-summary {
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  padding: 40px 24px; max-width: 420px; margin: 0 auto; text-align: center;
}
.flash-summary-icon { font-size: 3rem; }
.flash-summary-title { font-size: 1.5rem; font-weight: 900; }
.flash-summary-stats { display: flex; gap: 24px; }
.flash-stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.flash-stat-num { font-size: 2.5rem; font-weight: 900; }
.flash-stat-known .flash-stat-num { color: #388E3C; }
.flash-stat-review .flash-stat-num { color: #F57C00; }
.flash-stat-label { font-size: .85rem; color: var(--text-light); }
.flash-retry-btn { width: 100%; }
.flash-stop-btn { width: 100%; }
.flash-perfect { font-size: 1.1rem; color: #388E3C; font-weight: 700; }

/* ─── DASHBOARD: % badge + level header ─────────────────────────────────────── */
.topic-progress-row { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }
.topic-pct-badge {
  font-size: .68rem; font-weight: 800; color: #fff;
  border-radius: 10px; padding: 2px 7px; letter-spacing: .02em;
}
.path-level-header { display: flex; align-items: center; gap: 10px; padding: 8px 0 4px; margin-top: 8px; }
.path-level-badge {
  background: var(--primary-light); color: var(--primary-dark);
  border-radius: 12px; padding: 3px 12px; font-size: .8rem; font-weight: 800;
  letter-spacing: .05em;
}

/* ─── DIFFICULTY LEVEL PICKER ──────────────────────────────────────────────── */
.level-picker { max-width: 480px; margin: 40px auto; padding: 0 16px; text-align: center; }
.level-picker-title { font-size: 1.4rem; font-weight: 900; margin-bottom: 6px; }
.level-picker-sub { font-size: .85rem; color: var(--text-light); margin-bottom: 28px; }
.level-picker-cards { display: flex; flex-direction: column; gap: 14px; }
.level-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  background: var(--card); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  cursor: pointer; transition: border-color .15s, box-shadow .15s; text-align: left;
}
.level-card:hover:not([disabled]) { border-color: var(--primary); box-shadow: var(--shadow); }
.level-card-locked { opacity: .55; cursor: not-allowed; }
.level-card-icon { font-size: 1.4rem; }
.level-card-label { font-size: 1rem; font-weight: 800; color: var(--text); }
.level-card-count { font-size: .8rem; color: var(--text-light); }
.level-card-score { font-size: .85rem; font-weight: 700; color: var(--primary-dark); }
.level-card-badge { font-size: .8rem; background: #FEF9C3; color: #92400E; border-radius: 10px; padding: 2px 8px; font-weight: 700; }
.level-card-lock-msg { font-size: .75rem; color: var(--text-muted); font-style: italic; }

.exclude-audio-toggle {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 22px; padding: 10px 16px;
  font-size: .85rem; font-weight: 600; color: var(--text-light);
  cursor: pointer; user-select: none;
}
.exclude-audio-toggle input { width: 17px; height: 17px; cursor: pointer; accent-color: var(--primary); }

/* ─── LEVEL DOTS on topic cards ─────────────────────────────────────────────── */
.lv-dots { display: flex; gap: 5px; margin-top: 4px; }
.lv-dot { font-size: .7rem; cursor: default; }
.lv-dot-locked   { color: #D1D5DB; }
.lv-dot-open     { color: #E5E7EB; }
.lv-dot-progress { color: #F59E0B; }
.lv-dot-done     { color: #10B981; }

/* ─── RESULTS: level badge + unlock banner ──────────────────────────────────── */
.results-level-badge {
  font-size: .85rem; font-weight: 700; background: var(--primary-light);
  color: var(--primary-dark); border-radius: 20px; padding: 4px 14px;
  display: inline-block; margin: 0 auto 8px;
}
.results-unlock-banner {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #fff; border-radius: var(--radius); padding: 12px 20px;
  font-weight: 800; font-size: 1rem; text-align: center; margin-bottom: 12px;
}
.results-next-lv { width: 100%; margin-bottom: 8px; }

/* ─── VOCAB: game buttons + icon ────────────────────────────────────────────── */
.vocab-game-btns { display: flex; gap: 10px; flex-shrink: 0; align-items: center; }
.vocab-icon { font-size: 1.6rem; line-height: 1; }

.quiz-diff-toggle {
  display: flex; gap: 2px; background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; padding: 2px;
}
.quiz-diff-opt {
  border: none; background: transparent; border-radius: 18px; padding: 5px 10px;
  font-size: .75rem; font-weight: 700; color: var(--text-light); cursor: pointer;
}
.quiz-diff-opt.active { background: var(--primary); color: #fff; }

/* ─── MATCH GAME ─────────────────────────────────────────────────────────────── */
.match-wrap {
  display: flex; flex-direction: column; align-items: center;
  gap: 20px; width: 100%; max-width: 680px; margin: 0 auto; padding: 20px 0;
}
.match-topbar {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; gap: 12px;
}
.match-info { font-size: .9rem; color: var(--text-light); font-weight: 600; }

.match-columns {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; width: 100%;
}
.match-col { display: flex; flex-direction: column; gap: 10px; }

.match-card {
  padding: 12px 16px; border-radius: var(--radius);
  border: 2px solid var(--border); background: var(--card);
  font-size: .95rem; font-weight: 600; color: var(--text);
  cursor: pointer; text-align: center;
  transition: border-color .15s, background .15s, transform .1s, opacity .2s;
  min-height: 52px; display: flex; align-items: center; justify-content: center;
  word-break: break-word;
}
.match-card:hover:not([disabled]):not(.matched) {
  border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark);
  transform: translateY(-1px);
}
.match-card.selected {
  border-color: var(--primary); background: var(--primary);
  color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.match-card.matched {
  border-color: #388E3C; background: #E8F5E9; color: #1B5E20;
  opacity: .7; cursor: default;
}
.match-card[disabled]:not(.matched) { opacity: .4; cursor: not-allowed; }

@media (max-width: 500px) {
  .match-columns { grid-template-columns: 1fr 1fr; gap: 8px; }
  .match-card { font-size: .82rem; padding: 10px 8px; min-height: 46px; }
  .vocab-game-btns { flex-direction: column; gap: 6px; }
}

/* ─── EXERCISE: new types ────────────────────────────────────────────────────── */
/* Multiple-choice */
.mc-q { display: flex; flex-direction: column; gap: 14px; }
.mc-sentence { font-size: 1.1rem; font-weight: 600; color: var(--text); }
.mc-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mc-option {
  padding: 12px 16px; border-radius: var(--radius);
  border: 2px solid var(--border); background: var(--card);
  font-size: 1rem; font-weight: 600; cursor: pointer; transition: all .15s;
}
.mc-option:hover:not([disabled]) { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }
.mc-option.selected { border-color: var(--primary); background: var(--primary); color: #fff; }
.mc-option[disabled] { opacity: .6; cursor: default; }

/* Free-production */
.free-prod-q { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.fp-label { font-size: .95rem; color: var(--text-light); }
.fp-keyword {
  font-size: 2rem; font-weight: 900; color: var(--primary-dark);
  background: var(--primary-light); border-radius: var(--radius);
  padding: 10px 28px; letter-spacing: .04em;
}

/* Listening comprehension */
.comp-question { font-size: 1rem; font-weight: 700; color: var(--text); margin-top: 6px; }

/* ─── UTILITY ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.empty-page { text-align: center; padding: 60px 20px; color: var(--text-muted); }

/* ─── PROFILE: cloud sync & PIN UI ─────────────────────────────────────────── */
.profile-actions-row {
  display: flex; flex-wrap: wrap; gap: 12px;
  justify-content: center; margin-top: 16px;
}

.btn-restore-cloud {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--radius);
  border: 2px solid #2563EB; background: #EFF6FF;
  color: #1D4ED8; font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: all .2s;
}
.btn-restore-cloud:hover {
  background: #2563EB; color: #fff; transform: translateY(-1px);
}

/* Cloud ☁️ badge on synced profile cards */
.profile-cloud-badge {
  position: absolute; top: 8px; left: 10px;
  font-size: 1rem; line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.2));
}

/* PIN input: digits, centered */
.pin-input {
  font-size: 1.5rem !important;
  letter-spacing: .18em !important;
  text-align: center !important;
  font-weight: 700 !important;
  max-width: 200px;
  margin: 0 auto 20px;
  box-sizing: border-box;
}
.pin-input::placeholder {
  font-size: 1rem !important;
  letter-spacing: .05em !important;
  font-weight: 500 !important;
  opacity: .5;
}

/* Restore error message */
.restore-error {
  color: var(--error); font-size: .9rem; font-weight: 600;
  background: var(--error-light); border-radius: var(--radius-sm);
  padding: 8px 12px; margin-top: 8px; text-align: center;
}

/* Modal sub-text (Malagasy translation row) */
.modal-sub { font-size: .85rem; color: var(--text-muted); margin-top: -4px; }

/* Choice header emoji */
.choice-header { font-size: 2.5rem; text-align: center; margin-bottom: 4px; }
.choice-actions { gap: 10px; }

/* ─── TUTOR: info row (shows engine) ────────────────────────────────────────── */
.tutor-info {
  font-size: .78rem; color: var(--text-muted);
  text-align: center; padding: 4px 0;
}
.tutor-info strong { color: var(--text); }
.tutor-info code {
  background: var(--primary-light); padding: 1px 5px;
  border-radius: 4px; font-size: .78rem;
}


/* ═══════════════════════════════════════════════════════════════════════════
   COMPETITIVE MODE  (.comp-*)
   ═══════════════════════════════════════════════════════════════════════════ */

.comp-page {
  min-height: 100vh; background: var(--bg);
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 16px 40px; gap: 16px;
}
.comp-back { align-self: flex-start; margin-bottom: 4px; }

/* ── SETUP ─────────────────────────────────────────────────────────────── */
.comp-setup-card {
  background: var(--card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 28px 24px 32px;
  width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 24px;
}
.comp-setup-header { text-align: center; }
.comp-setup-icon   { font-size: 3rem; line-height: 1; margin-bottom: 8px; }
.comp-setup-title  { font-size: 1.6rem; font-weight: 900; color: var(--primary-dark); }
.comp-setup-sub    { color: var(--text-muted); font-size: .95rem; margin-top: 4px; }
.comp-section      { display: flex; flex-direction: column; gap: 10px; }
.comp-section-title {
  font-size: .9rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .05em;
}
.comp-players-list { display: flex; flex-direction: column; gap: 8px; }
.comp-player-row   { display: flex; align-items: center; gap: 10px; }
.comp-player-num   { font-size: 1.3rem; width: 28px; text-align: center; }
.comp-player-input {
  flex: 1; border: 2px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: .95rem; font-family: var(--font);
  background: var(--bg); color: var(--text); transition: border-color .18s;
}
.comp-player-input:focus { outline: none; border-color: var(--primary); }
.comp-options { display: flex; flex-wrap: wrap; gap: 8px; }
.comp-opt {
  flex: 1 1 auto; min-width: 90px; padding: 10px 12px;
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); color: var(--text);
  font-size: .9rem; font-weight: 600; font-family: var(--font);
  cursor: pointer; transition: all .18s; text-align: center;
}
.comp-opt:hover  { border-color: var(--primary); background: var(--primary-light); }
.comp-opt.active { border-color: var(--primary-dark); background: var(--primary); color: #fff; }
.comp-start-btn {
  width: 100%; padding: 14px; background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius); font-size: 1.05rem; font-weight: 800;
  font-family: var(--font); cursor: pointer; transition: background .18s, transform .1s;
}
.comp-start-btn:hover  { background: var(--primary-dark); }
.comp-start-btn:active { transform: scale(.97); }
.comp-start-error { color: var(--error); font-size: .9rem; text-align: center; min-height: 1.2em; }

/* ── SCOREBOARD ────────────────────────────────────────────────────────── */
.comp-scoreboard {
  display: flex; gap: 10px; width: 100%; max-width: 560px;
  justify-content: center; flex-wrap: wrap;
}
.comp-score-card {
  flex: 1 1 100px; max-width: 130px; background: var(--card);
  border: 2px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; text-align: center; transition: border-color .18s, box-shadow .18s;
}
.comp-score-card.current { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.comp-score-name {
  font-size: .82rem; font-weight: 700; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.comp-score-pts { font-size: 1.2rem; font-weight: 900; color: var(--primary-dark); margin-top: 2px; }

/* ── GAME CARD ─────────────────────────────────────────────────────────── */
.comp-game-card {
  background: var(--card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 22px 20px 24px;
  width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 16px;
}
.comp-game-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.comp-qnum { font-size: .85rem; font-weight: 700; color: var(--text-muted); white-space: nowrap; }
.comp-timer-wrap { display: flex; align-items: center; gap: 8px; flex: 1; justify-content: flex-end; }
.comp-timer-track { flex: 1; max-width: 160px; height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.comp-timer-bar { height: 100%; background: var(--primary); border-radius: 99px; transition: width .9s linear, background .3s; }
.comp-timer-val { font-size: 1rem; font-weight: 900; color: var(--primary-dark); min-width: 24px; text-align: right; }
.comp-player-banner { background: var(--primary-light); border-radius: var(--radius-sm); padding: 10px 16px; font-size: .95rem; color: var(--primary-dark); text-align: center; }
.comp-question-area { min-height: 80px; }
.comp-vocab-q, .comp-grammar-q { display: flex; flex-direction: column; gap: 6px; }
.comp-q-label { font-size: .82rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.comp-q-word  { font-size: 1.8rem; font-weight: 900; color: var(--text); line-height: 1.2; }
.comp-q-type  { font-size: .82rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.comp-q-text  { font-size: 1.1rem; font-weight: 600; color: var(--text); }
.comp-q-hint  { font-size: .85rem; color: var(--text-muted); font-style: italic; }
.comp-answer-area { display: flex; flex-direction: column; gap: 10px; }
.comp-answer-input {
  width: 100%; padding: 12px 16px; border: 2px solid var(--border);
  border-radius: var(--radius-sm); font-size: 1rem; font-family: var(--font);
  color: var(--text); background: var(--bg); transition: border-color .18s;
}
.comp-answer-input:focus { outline: none; border-color: var(--primary); }
.comp-submit-btn {
  padding: 12px; background: var(--primary); color: #fff; border: none;
  border-radius: var(--radius-sm); font-size: 1rem; font-weight: 700;
  font-family: var(--font); cursor: pointer; transition: background .18s;
}
.comp-submit-btn:hover { background: var(--primary-dark); }
.comp-result { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px; border-radius: var(--radius); text-align: center; }
.comp-result.correct { background: var(--success-light); }
.comp-result.wrong   { background: #F3F4F6; }
.comp-result-icon { font-size: 1.8rem; }
.comp-result-text { font-size: .95rem; color: var(--text); }
.comp-result-text strong { color: var(--success); }
.comp-result.wrong .comp-result-text strong { color: var(--text); }
.comp-next-btn {
  margin-top: 4px; padding: 10px 24px; background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius-sm); font-size: .95rem; font-weight: 700;
  font-family: var(--font); cursor: pointer; transition: background .18s;
}
.comp-next-btn:hover { background: var(--primary-dark); }

/* ── END SCREEN ────────────────────────────────────────────────────────── */
.comp-end-card {
  background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 32px 24px; width: 100%; max-width: 520px;
  display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center;
}
.comp-end-trophy { font-size: 3.5rem; animation: bounce .8s infinite; }
.comp-end-title  { font-size: 1.6rem; font-weight: 900; color: var(--primary-dark); }
.comp-end-msg    { color: var(--text-muted); font-size: .95rem; }
.comp-rankings   { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.comp-rank-row   { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: var(--radius-sm); padding: 10px 14px; }
.comp-rank-row.winner { background: var(--primary-light); border: 2px solid var(--primary); }
.comp-rank-medal { font-size: 1.4rem; width: 28px; text-align: center; }
.comp-rank-name  { flex: 1; font-weight: 700; text-align: left; font-size: .95rem; }
.comp-rank-score { font-weight: 900; color: var(--primary-dark); white-space: nowrap; }
.comp-rank-bar-wrap { width: 80px; height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; }
.comp-rank-bar   { height: 100%; background: var(--primary); border-radius: 99px; }
.comp-end-stats  { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; width: 100%; }
.comp-end-stat   { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1 1 80px; }
.comp-end-stat-val   { font-size: 1.5rem; font-weight: 900; color: var(--primary-dark); }
.comp-end-stat-label { font-size: .8rem; color: var(--text-muted); }
.comp-end-actions { display: flex; gap: 12px; width: 100%; flex-wrap: wrap; }
.comp-play-again, .comp-home {
  flex: 1 1 120px; padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: .95rem; font-weight: 700; font-family: var(--font);
  cursor: pointer; border: none; transition: background .18s;
}
.comp-play-again { background: var(--primary); color: #fff; }
.comp-play-again:hover { background: var(--primary-dark); }
.comp-home { background: var(--bg); color: var(--text); border: 2px solid var(--border); }
.comp-home:hover { border-color: var(--primary); }

/* ── Dashboard competitive button ──────────────────────────────────────── */
.quick-btn-competitive {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; margin-bottom: 16px;
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  color: #fff; border: none; border-radius: var(--radius);
  padding: 16px 24px; font-size: 1.05rem; font-weight: 800;
  font-family: var(--font); box-shadow: var(--shadow); cursor: pointer;
  transition: all .15s;
}
.quick-btn-competitive:hover { background: linear-gradient(135deg, #D97706, #DC2626); transform: translateY(-1px); }
.quick-btn-competitive .quick-icon { font-size: 1.4rem; }

/* ── Quit-game button (during play) ────────────────────────────────────── */
.comp-quit-btn { align-self: flex-start; margin-bottom: 4px; }

@media (max-width: 480px) {
  .comp-setup-card, .comp-game-card, .comp-end-card { padding: 18px 14px; }
  .comp-q-word  { font-size: 1.4rem; }
  .comp-rank-bar-wrap { display: none; }
  .comp-scoreboard { gap: 6px; }
  .comp-score-card { padding: 8px; }
  .comp-score-pts  { font-size: 1rem; }
}


/* ── COMPETITIVE V2 ADDITIONS (hero icon, MCQ, select) ─────────────────── */

/* Hero icon with glow (Task 4) */
.comp-hero {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 4px 0 8px;
  height: 110px;
}
.comp-hero-icon {
  font-size: 5rem;
  line-height: 1;
  position: relative;
  z-index: 2;
  animation: bounce 2.2s ease-in-out infinite;
  filter: drop-shadow(0 6px 12px rgba(245, 158, 11, .35));
}
.comp-hero-glow {
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 158, 11, .35) 0%, rgba(245, 158, 11, 0) 70%);
  z-index: 1;
  animation: pulseGlow 2.4s ease-in-out infinite;
}
@keyframes pulseGlow {
  0%, 100% { transform: scale(1);   opacity: .8; }
  50%      { transform: scale(1.15); opacity: 1; }
}

/* Select dropdown for sub-topic / sub-theme (Task 5) */
.comp-select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: .95rem;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: border-color .18s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23D97706' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
.comp-select:focus { outline: none; border-color: var(--primary); }

/* Difficulty note */
.comp-diff-note {
  font-size: .82rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.comp-diff-note strong { color: var(--primary-dark); }

/* MCQ buttons (Task 2) */
.comp-mcq-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.comp-mcq-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text);
  cursor: pointer;
  transition: all .15s;
  text-align: left;
  width: 100%;
}
.comp-mcq-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateX(2px);
}
.comp-mcq-btn:disabled { cursor: default; }
.comp-mcq-btn.mcq-correct {
  border-color: var(--success);
  background: var(--success-light);
  color: var(--success);
}
.comp-mcq-btn.mcq-wrong {
  border-color: var(--error);
  background: var(--error-light);
  color: var(--error);
}
.comp-mcq-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 900;
  font-size: .95rem;
  flex-shrink: 0;
}
.comp-mcq-btn.mcq-correct .comp-mcq-letter { background: var(--success); color: #fff; }
.comp-mcq-btn.mcq-wrong   .comp-mcq-letter { background: var(--error);   color: #fff; }
.comp-mcq-text { flex: 1; word-break: break-word; }

/* Result hint (only shown post-answer) */
.comp-result-hint {
  font-size: .85rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 4px;
}

@media (max-width: 480px) {
  .comp-hero { height: 90px; }
  .comp-hero-icon { font-size: 4rem; }
  .comp-hero-glow { width: 110px; height: 110px; }
  .comp-mcq-btn { padding: 10px 12px; font-size: .92rem; }
  .comp-mcq-letter { width: 28px; height: 28px; font-size: .85rem; }
}

/* ─── VOCABULARY: Quiz & Spell modes ───────────────────────────────────────── */
.quiz-wrap, .spell-wrap {
  display: flex; flex-direction: column; align-items: center;
  gap: 20px; width: 100%; max-width: 540px; margin: 0 auto; padding: 20px 0;
}

/* Question card */
.quiz-question-card, .spell-question-card {
  width: 100%; background: var(--card); border: 2px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 28px 24px; display: flex; flex-direction: column;
  align-items: center; gap: 10px; text-align: center;
}
.quiz-word {
  font-size: 2rem; font-weight: 900; color: var(--text);
}
.quiz-tts, .spell-tts {
  background: var(--primary-light); color: var(--primary-dark);
  border: none; border-radius: 50%; width: 36px; height: 36px;
  font-size: 1.1rem; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
}
.quiz-tts:hover, .spell-tts:hover { background: var(--primary); color: #fff; }
.quiz-prompt { font-size: .9rem; color: var(--text-light); font-style: italic; }

/* Spell question */
.spell-fr { font-size: 1.4rem; font-weight: 800; color: var(--text); }
.spell-mg { font-size: .95rem; color: #2E7D32; }
.spell-hint { font-size: .9rem; color: var(--text-light); margin-top: 4px; }

/* Quiz options grid */
.quiz-options {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; width: 100%;
}
.quiz-option {
  padding: 14px 12px; border-radius: var(--radius);
  border: 2px solid var(--border); background: var(--card);
  font-size: .95rem; font-weight: 600; color: var(--text);
  cursor: pointer; transition: all .15s; text-align: center;
  min-height: 56px; word-break: break-word;
}
.quiz-option:hover:not([disabled]) {
  border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark);
  transform: translateY(-1px);
}
.quiz-option[disabled] { cursor: default; }
.quiz-opt-correct { border-color: #388E3C !important; background: #E8F5E9 !important; color: #1B5E20 !important; }
.quiz-opt-wrong   { border-color: #C62828 !important; background: #FFEBEE !important; color: #B71C1C !important; }

/* Feedback banner */
.quiz-feedback {
  width: 100%; padding: 12px 18px; border-radius: var(--radius);
  font-size: 1rem; font-weight: 700; text-align: center;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.quiz-fb-ok  { background: #E8F5E9; color: #1B5E20; border: 2px solid #A5D6A7; }
.quiz-fb-err { background: #FFEBEE; color: #B71C1C; border: 2px solid #FFCDD2; }

/* Spell form */
.spell-form {
  display: flex; gap: 10px; width: 100%; flex-wrap: wrap;
  justify-content: center;
}
.spell-input {
  flex: 1; min-width: 200px; padding: 12px 16px;
  border: 2px solid var(--border); border-radius: var(--radius);
  font-size: 1.1rem; font-weight: 600; background: var(--card); color: var(--text);
  outline: none; transition: border-color .15s;
}
.spell-input:focus { border-color: var(--primary); }
.spell-submit-btn { white-space: nowrap; }
.quiz-next-btn { width: 100%; }

/* Game buttons row */
.vocab-game-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.quiz-start-btn, .spell-start-btn { font-size: .9rem; padding: 8px 14px; white-space: nowrap; }

@media (max-width: 500px) {
  .quiz-options { grid-template-columns: 1fr 1fr; gap: 8px; }
  .quiz-option { font-size: .82rem; padding: 10px 8px; min-height: 48px; }
  .quiz-word { font-size: 1.5rem; }
  .spell-input { font-size: 1rem; }
}

/* ─── VOCABULARY: SM-2 Spaced Repetition ───────────────────────────────────── */

/* Sidebar progress bar under category label */
.sidebar-item-center { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.sidebar-item-right  { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.sidebar-progress-bar {
  height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; width: 100%;
}
.sidebar-progress-fill { height: 100%; background: #4CAF50; border-radius: 2px; transition: width .4s; }
.sidebar-due-badge {
  background: #E53935; color: #fff; border-radius: 10px;
  padding: 1px 6px; font-size: .72rem; font-weight: 800; min-width: 18px; text-align: center;
}

/* SM-2 progress bar below game buttons */
.vocab-sm2-bar {
  display: flex; flex-direction: column; gap: 4px;
  padding: 8px 0 4px;
}
.vocab-sm2-segments {
  display: flex; height: 6px; border-radius: 4px;
  background: var(--border); overflow: hidden; width: 100%;
}
.sm2-seg { height: 100%; transition: width .5s; }
.sm2-seg-known { background: #4CAF50; }
.sm2-seg-soon  { background: #FF9800; }
.sm2-seg-due   { background: #E53935; }
.vocab-sm2-label { font-size: .78rem; color: var(--text-light); font-weight: 600; }

/* SM-2 status dot on vocab cards */
.vocab-sm2-dot {
  position: absolute; top: 6px; right: 8px;
  font-size: .75rem; line-height: 1;
}
.vocab-card { position: relative; }

/* Review button */
.btn-review-start {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius);
  border: 2px solid #E53935; background: #FFEBEE;
  color: #C62828; font-size: .9rem; font-weight: 700;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn-review-start:hover { background: #E53935; color: #fff; }
.review-due-count {
  background: #E53935; color: #fff; border-radius: 10px;
  padding: 1px 7px; font-size: .8rem; font-weight: 800;
}
.btn-review-start:hover .review-due-count { background: #fff; color: #E53935; }

/* ─── STATISTICS VIEW ────────────────────────────────────────────────────────── */

.stats-page {
  max-width: 640px; margin: 0 auto; padding-bottom: 60px;
  font-family: var(--font);
}

/* Header */
.stats-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 16px 8px; position: sticky; top: 0;
  background: var(--bg); z-index: 10;
  border-bottom: 1px solid var(--border);
}
.stats-title { font-size: 1.2rem; font-weight: 800; margin: 0; }

/* Dashboard stats button */
.btn-stats-nav { font-size: 1.1rem; }

/* Content wrapper */
.stats-content {
  padding: 16px; display: flex; flex-direction: column; gap: 16px;
}

/* ── KPI cards ── */
.stats-kpi-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
}
.stats-kpi-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  text-align: center; box-shadow: var(--shadow-sm);
}
.kpi-icon  { font-size: 1.35rem; line-height: 1; }
.kpi-value { font-size: 1.05rem; font-weight: 800; color: var(--text); line-height: 1.1; }
.kpi-label { font-size: .62rem; color: var(--text-muted); line-height: 1.2; }

/* ── Section base ── */
.stats-section {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow-sm);
}
.stats-section-title {
  font-size: .95rem; font-weight: 800; margin: 0 0 14px; color: var(--text);
}

/* ── Level progress rows ── */
.stats-level-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.stats-level-row:last-child { margin-bottom: 0; }
.stats-level-badge {
  background: var(--primary); color: #fff;
  border-radius: 6px; padding: 3px 9px;
  font-size: .75rem; font-weight: 800; min-width: 32px; text-align: center;
}
.stats-level-bar-wrap { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.stats-level-bar {
  height: 8px; background: var(--border); border-radius: 4px; overflow: hidden;
}
.stats-level-fill {
  height: 100%; background: #4CAF50; border-radius: 4px; transition: width .5s;
}
.stats-level-label { font-size: .7rem; color: var(--text-muted); }
.stats-level-pct { font-size: .88rem; font-weight: 800; min-width: 38px; text-align: right; }

/* ── Grammar SM-2 badges ── */
.stats-sm2-row { display: flex; gap: 8px; }
.stats-sm2-badge {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  border-radius: var(--radius-sm); padding: 10px 6px;
  border: 1.5px solid; gap: 2px;
}
.sm2-num { font-size: 1.4rem; font-weight: 800; line-height: 1; }
.sm2-lbl { font-size: .68rem; font-weight: 500; }
.sm2-due   { background: #FFEBEE; border-color: #FFCDD2; color: #C62828; }
.sm2-known { background: #E8F5E9; border-color: #C8E6C9; color: #2E7D32; }
.sm2-seen  { background: #FFF8E1; border-color: #FFE082; color: #E65100; }

/* ── Vocabulary segmented bar ── */
.stats-vocab-overview { margin-bottom: 14px; }
.stats-vocab-seg {
  display: flex; height: 10px; border-radius: 6px;
  background: var(--border); overflow: hidden; margin-bottom: 8px;
}
.seg-known { background: #4CAF50; }
.seg-prog  { background: #FF9800; }

.stats-vocab-legend {
  display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .75rem;
}
.vleg { font-weight: 600; }
.vleg-known { color: #2E7D32; }
.vleg-prog  { color: #E65100; }
.vleg-due   { color: #C62828; }
.vleg-new   { color: var(--text-muted); }

/* ── Vocabulary category grid ── */
.stats-cat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.stats-cat-card {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; background: var(--bg);
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.stats-cat-icon { font-size: 1.1rem; flex-shrink: 0; }
.stats-cat-info { flex: 1; min-width: 0; }
.stats-cat-name {
  font-size: .72rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stats-cat-bar {
  display: flex; height: 4px; background: var(--border);
  border-radius: 2px; overflow: hidden; margin: 3px 0;
}
.stats-cat-fill-known { background: #4CAF50; }
.stats-cat-fill-soon  { background: #FF9800; }
.stats-cat-fill-due   { background: #E53935; }
.stats-cat-nums { font-size: .65rem; color: var(--text-muted); }
.cat-due-dot    { color: #C62828; font-weight: 700; }

/* ── Topic accuracy table ── */
.stats-topic-table { display: flex; flex-direction: column; gap: 7px; }
.stats-topic-row   { display: flex; align-items: center; gap: 8px; }
.stats-topic-icon  { font-size: .9rem; flex-shrink: 0; width: 20px; text-align: center; }
.stats-topic-name  {
  flex: 1; font-size: .78rem; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stats-topic-bar-wrap { width: 72px; flex-shrink: 0; }
.stats-topic-bar {
  height: 6px; background: var(--border); border-radius: 3px; overflow: hidden;
}
.stats-topic-fill { height: 100%; border-radius: 3px; transition: width .4s; }
.fill-good { background: #4CAF50; }
.fill-ok   { background: #FF9800; }
.fill-low  { background: #E53935; }
.stats-topic-pct { font-size: .75rem; font-weight: 800; min-width: 36px; text-align: right; }
.pct-good { color: #2E7D32; }
.pct-ok   { color: #E65100; }
.pct-low  { color: #C62828; }

/* ── Session history ── */
.stats-sessions { display: flex; flex-direction: column; gap: 6px; }
.stats-session-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; background: var(--bg);
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.session-date  { min-width: 46px; flex-shrink: 0; }
.session-day   { font-size: .75rem; font-weight: 700; }
.session-time  { font-size: .65rem; color: var(--text-muted); }
.session-topic {
  flex: 1; font-size: .76rem; color: var(--text); min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.session-right { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.session-emoji { font-size: .85rem; }
.session-pct   { font-size: .8rem; font-weight: 800; }
.score-good    { color: #2E7D32; }
.score-ok      { color: #E65100; }
.score-low     { color: #C62828; }
.session-score-detail { font-size: .68rem; color: var(--text-muted); }
.session-xp    { font-size: .72rem; color: var(--text-muted); white-space: nowrap; }

/* ── Empty state ── */
.stats-empty {
  text-align: center; padding: 32px 16px; display: flex;
  flex-direction: column; align-items: center; gap: 10px;
}
.stats-empty-icon { font-size: 2.5rem; }
.stats-empty-msg  { font-size: .9rem; color: var(--text-muted); max-width: 280px; line-height: 1.5; }

/* ── Account info ── */
.stats-account-section { padding: 12px 16px; }
.stats-account-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; border-bottom: 1px solid var(--border); font-size: .85rem;
}
.stats-account-row:last-child { border-bottom: none; padding-bottom: 0; }
.account-label { color: var(--text-muted); }
.account-value { font-weight: 700; color: var(--text); }

/* ── Responsive ── */
@media (max-width: 500px) {
  .stats-kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .stats-cat-grid { grid-template-columns: 1fr; }
  .stats-topic-bar-wrap { width: 55px; }
  .session-score-detail { display: none; }
}
@media (max-width: 360px) {
  .stats-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-value { font-size: .95rem; }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   DARK MODE  [data-theme="dark"]
   All overrides are additive — no existing rules are modified.
   ═══════════════════════════════════════════════════════════════════════════════ */

[data-theme="dark"] {
  /* ── Core palette ── */
  --bg:            #1A1612;
  --card:          #242019;
  --text:          #F2EDE4;
  --text-muted:    #8A7E70;
  --text-light:    #5C5045;
  --border:        #38322B;

  /* ── Primary (muted amber-gold for dark) ── */
  --primary:       #C4820A;
  --primary-dark:  #A36B08;
  --primary-light: #2C1E00;

  /* ── Semantic colours ── */
  --success:       #34D399;
  --success-light: #0D2B1E;
  --error:         #F87171;
  --error-light:   #3B1010;
  --info:          #60A5FA;
  --info-light:    #1A2C4A;

  /* ── Shadows (stronger on dark) ── */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.4);
  --shadow:     0 4px 12px rgba(0,0,0,.5);
  --shadow-lg:  0 8px 24px rgba(0,0,0,.6);
}

/* ── Base inputs ── */
[data-theme="dark"] input,
[data-theme="dark"] textarea { background: #1F1A12; color: var(--text); }
[data-theme="dark"] .modal-input     { background: #1F1A12; color: var(--text); }
[data-theme="dark"] .answer-input    { background: var(--bg); color: var(--text); }
[data-theme="dark"] .answer-input:focus    { background: #1F1A12; }
[data-theme="dark"] .answer-input:disabled { background: #2A2318; color: var(--text-muted); }
[data-theme="dark"] .tutor-input     { background: #1F1A12; color: var(--text); border-color: var(--border); }
[data-theme="dark"] .tutor-input:focus { border-color: #7C3AED; }
[data-theme="dark"] .spell-input     { background: #1F1A12; color: var(--text); }
[data-theme="dark"] .pin-input       { background: #1F1A12; color: var(--text); }
[data-theme="dark"] .comp-player-input,
[data-theme="dark"] .comp-answer-input { background: #1F1A12; color: var(--text); }

/* ── Buttons ── */
[data-theme="dark"] .btn-secondary        { background: var(--card); }
[data-theme="dark"] .btn-secondary:hover  { background: #2A2318; }
[data-theme="dark"] .btn-back:hover       { background: #2A2318; }

/* ── CEFR level badges ── */
[data-theme="dark"] .level-A1  { background: #3A2C00; color: #FCD34D; }
[data-theme="dark"] .level-A2  { background: #1A2940; color: #93C5FD; }
[data-theme="dark"] .level-B1  { background: #0D2B1E; color: #6EE7B7; }
[data-theme="dark"] .level-B1\+{ background: #2D1A4A; color: #C4B5FD; }

/* ── Dashboard header — dark, no vivid orange ── */
[data-theme="dark"] .dash-header {
  background: linear-gradient(160deg, #1C1A14 0%, #221E14 100%);
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
[data-theme="dark"] .stat-badge {
  background: rgba(196, 130, 10, 0.12);
  border: 1px solid rgba(196, 130, 10, 0.28);
  color: #C4820A;
  backdrop-filter: none;
}
[data-theme="dark"] .xp-badge { background: rgba(196, 130, 10, 0.18); }

/* ── Icônes des sections : pastille orange foncé pour les distinguer ── */
/* Couvre aussi le drapeau 🇲🇬 qui se rabat en lettres "MG" peu lisibles. */
[data-theme="dark"] .quick-btn:not(.quick-btn-competitive) .quick-icon,
[data-theme="dark"] .legend-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  padding: 4px;
  border-radius: 10px;
  background: #3A2A0A;
  color: #F2B33D;
  border: 1px solid rgba(242, 179, 61, 0.35);
  box-sizing: border-box;
}
[data-theme="dark"] .legend-icon {
  min-width: 2.2rem;
  min-height: 2.2rem;
}
/* Boutons icône en-tête (profil / stats / thème) : contraste accru */
[data-theme="dark"] .btn-icon-only {
  background: #2E2008;
  border: 2px solid rgba(242, 179, 61, 0.4);
  color: #F2B33D;
}
[data-theme="dark"] .btn-icon-only:hover {
  background: #3F2D0B;
  border-color: rgba(242, 179, 61, 0.65);
}
/* Texte secondaire un peu plus clair pour les descriptions */
[data-theme="dark"] .legend-desc,
[data-theme="dark"] .quick-btn .quick-desc,
[data-theme="dark"] .dash-title {
  color: #A89985;
}

/* ── XP & progress bar gradients (tone down vivid orange endpoint) ── */
[data-theme="dark"] .xp-bar-fill      { background: linear-gradient(90deg, var(--primary), #A36B08); }
[data-theme="dark"] .ex-progress-fill { background: linear-gradient(90deg, var(--primary), #A36B08); }
[data-theme="dark"] .quick-btn-competitive { background: linear-gradient(135deg, #A36B08, #B42020); }
[data-theme="dark"] .quick-btn-competitive:hover { background: linear-gradient(135deg, #875808, #8B1717); }

/* ── Dashboard ── */
[data-theme="dark"] .xp-bar-track       { background: #38322B; }
[data-theme="dark"] .assessment-banner  { background: linear-gradient(135deg, #1E1A0E, #2A2210); border: 1px solid var(--border); }

/* ── Level-unlock card gradient ── */
[data-theme="dark"] .level-unlocked-header { background: linear-gradient(135deg, #1E1A10, #2A2215); }

/* ── Flashcard stat numbers ── */
[data-theme="dark"] .flash-stat-known .flash-stat-num { color: #34D399; }
[data-theme="dark"] .flash-stat-review .flash-stat-num { color: #C4820A; }

/* ── Learning path ── */
[data-theme="dark"] .topic-progress-bar { background: #38322B; }
[data-theme="dark"] .lv-dot-locked      { color: #3A3025; }
[data-theme="dark"] .lv-dot-open        { color: #4A4035; }

/* ── Exercise ── */
[data-theme="dark"] .ex-type-badge      { background: #3A2C00; color: #FCD34D; }
[data-theme="dark"] .level-card-badge   { background: #3A2C00; color: #FCD34D; }
[data-theme="dark"] .wo-answer-area     { background: #1F1A12; }
[data-theme="dark"] .hint-box           { background: #2A2505; border-color: #4A4000; }
[data-theme="dark"] .hint-box *         { color: #FCD34D; }
[data-theme="dark"] .btn-next:hover     { background: #1D4ED8; }

/* ── Exercise results ── */
[data-theme="dark"] .result-item.ok  { background: #0D2B1E; }
[data-theme="dark"] .result-item.err { background: #3B1010; }

/* ── Theory ── */
[data-theme="dark"] .malgasy-note    { background: #0D2B1E; color: #6EE7B7; }
[data-theme="dark"] .mg-col-mg       { color: #6EE7B7; }
[data-theme="dark"] .mg-col-struct code { background: #2A2318; }
[data-theme="dark"] .mg-tab.active   { background: #2A1B05; border-color: #E65100; color: #FB923C; }
[data-theme="dark"] .mg-disclaimer   { background: #2A2505; border-left-color: #D97706; color: #FCD34D; }

/* ── Boky ── */
[data-theme="dark"] .boky-table tr:hover td { background: #2A2318; }
[data-theme="dark"] .boky-summary    { background: linear-gradient(135deg, #1A2940, #1E305A); border-left-color: #3B82F6; }
[data-theme="dark"] .boky-summary h3 { color: #93C5FD; }
[data-theme="dark"] .boky-summary li { color: #60A5FA; }
[data-theme="dark"] .boky-qexercises { background: #0D2B1E; border-left-color: #22C55E; }
[data-theme="dark"] .boky-qexercises h3 { color: #34D399; }
[data-theme="dark"] .boky-answer     { color: #34D399; }
[data-theme="dark"] .boky-errors li  { color: #F87171; }
[data-theme="dark"] .boky-uncertain  { color: #FB923C; }
[data-theme="dark"] .boky-warning    { background: #2A2505; border-left-color: #FFC107; color: #FCD34D; }

/* ── Tutor AI ── */
[data-theme="dark"] .tutor-suggestion       { background: #2D1A4A; color: #C4B5FD; border-color: #7C3AED; }
[data-theme="dark"] .tutor-suggestion:hover { background: #7C3AED; color: #fff; }

/* ── Vocabulary flashcard ── */
[data-theme="dark"] .flash-mg              { color: #6EE7B7; }
[data-theme="dark"] .flash-btn-review      { background: #2A1B05; border-color: #B45309; color: #FCD34D; }
[data-theme="dark"] .flash-btn-review:hover{ background: #B45309; color: #fff; }
[data-theme="dark"] .flash-btn-known       { background: #0D2B1E; border-color: #065F46; color: #6EE7B7; }
[data-theme="dark"] .flash-btn-known:hover { background: #065F46; color: #fff; }

/* ── Vocabulary quiz ── */
[data-theme="dark"] .quiz-opt-correct { border-color: #065F46 !important; background: #0D2B1E !important; color: #6EE7B7 !important; }
[data-theme="dark"] .quiz-opt-wrong   { border-color: #7F1D1D !important; background: #3B1010 !important; color: #F87171 !important; }
[data-theme="dark"] .quiz-fb-ok       { background: #0D2B1E; color: #6EE7B7; border-color: #065F46; }
[data-theme="dark"] .quiz-fb-err      { background: #3B1010; color: #F87171; border-color: #7F1D1D; }
[data-theme="dark"] .spell-mg         { color: #6EE7B7; }

/* ── Vocabulary SM-2 (sidebar / review) ── */
[data-theme="dark"] .btn-review-start  { background: #3B1010; border-color: #7F1D1D; color: #F87171; }
[data-theme="dark"] .btn-review-start:hover { background: #7F1D1D; color: #fff; }
[data-theme="dark"] .review-due-count  { background: #7F1D1D; }
[data-theme="dark"] .btn-review-start:hover .review-due-count { background: #fff; color: #7F1D1D; }

/* ── Dialogue ── */
[data-theme="dark"] .dialogue-card.level-B1 .dialogue-level { background: #1A2940; color: #60A5FA; }

/* ── Competitive ── */
[data-theme="dark"] .comp-result.wrong { background: #2A2318; }

/* ── Statistics — SM-2 badges ── */
[data-theme="dark"] .sm2-due   { background: #3B1010; border-color: #7F1D1D; color: #F87171; }
[data-theme="dark"] .sm2-known { background: #0D2B1E; border-color: #065F46; color: #6EE7B7; }
[data-theme="dark"] .sm2-seen  { background: #2A2505; border-color: #4A4000; color: #FCD34D; }

/* ═══════════════════════════════════════════════════════════════════════════════
   READING COMPREHENSION
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── Quick action / legend dark overrides ── */
[data-theme="dark"] .legend-toggle { background: var(--card); border-color: var(--border); }
[data-theme="dark"] .legend-toggle:hover { background: #2A2210; border-color: var(--primary); }
[data-theme="dark"] .legend-item { background: var(--card); border-color: var(--border); }

/* ── List page ── */
.reading-page { max-width: 720px; margin: 0 auto; padding-bottom: 60px; min-height: 100vh; }

.rd-list-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px; border-bottom: 1px solid var(--border);
  background: var(--bg); position: sticky; top: 0; z-index: 10;
}
.rd-list-title { font-size: 1.2rem; font-weight: 800; margin: 0; }
.rd-list-content { padding: 16px; }

.rd-level-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.rd-filter-btn {
  padding: 6px 14px; border-radius: 20px; border: 2px solid var(--border);
  background: var(--card); font-size: .82rem; font-weight: 700;
  color: var(--text-muted); cursor: pointer; transition: all .15s;
}
.rd-filter-btn:hover  { border-color: var(--primary); color: var(--primary); }
.rd-filter-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.rd-text-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.rd-text-card {
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  cursor: pointer; transition: all .15s; box-shadow: var(--shadow-sm);
}
.rd-text-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }

.rd-card-top { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.rd-card-icon { font-size: 1.4rem; }
.rd-done-badge { margin-left: auto; font-size: .9rem; }

.rd-lec-badge {
  font-size: .65rem;
  background: #D1FAE5;
  color: #065F46;
  border-radius: 4px;
  padding: 1px 5px;
  font-weight: 700;
}

.rd-level-badge {
  padding: 2px 8px; border-radius: 10px;
  font-size: .72rem; font-weight: 800;
}
.rd-card-title { font-size: .95rem; font-weight: 800; margin-bottom: 4px; }
.rd-card-meta  { font-size: .72rem; color: var(--text-muted); }
.rd-card-score { margin-top: 8px; }
.rd-card-score-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin-bottom: 3px; }
.rd-card-score-fill { height: 100%; border-radius: 2px; transition: width .4s; }
.rd-card-pct { font-size: .68rem; color: var(--text-muted); font-weight: 600; }

/* ── View header ── */
.rd-view-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg); position: sticky; top: 0; z-index: 20;
}
.rd-view-title-wrap { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.rd-view-icon  { font-size: 1.1rem; flex-shrink: 0; }
.rd-view-title { font-size: 1rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Text panel ── */
.rd-text-panel {
  background: var(--card); border-bottom: 1px solid var(--border);
  transition: max-height .3s ease;
}
.rd-text-toggle {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: none; border: none;
  font-size: .82rem; font-weight: 700; color: var(--text-muted);
  cursor: pointer; text-align: left;
}
.rd-text-toggle:hover { color: var(--text); background: var(--bg); }
.rd-gloss-hint { font-size: .72rem; font-weight: 400; color: var(--text-light); margin-left: auto; }

.rd-text-panel.collapsed .rd-text-body { display: none; }
.rd-text-body {
  padding: 0 20px 16px; position: relative;
  max-height: 45vh; overflow-y: auto;
}

.rd-text-content { font-size: .95rem; line-height: 1.8; color: var(--text); }
.rd-text-content p { margin-bottom: 10px; }
.rd-text-content p:last-child { margin-bottom: 0; }

/* Glossary highlighted word */
.gloss-word {
  border-bottom: 2px dotted var(--primary);
  cursor: pointer; font-weight: 700;
  transition: background .1s;
}
.gloss-word:hover { background: var(--primary-light); border-radius: 3px; }

/* Glossary tooltip — position:fixed set by JS so viewport coords work with scroll */
.rd-tooltip {
  position: fixed; z-index: 200;
  background: var(--card); border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm); padding: 8px 28px 8px 12px;
  font-size: .8rem; box-shadow: var(--shadow);
  max-width: 220px; line-height: 1.5;
  pointer-events: auto;
}
.rd-tooltip.hidden { display: none; }
.rd-tt-hint { font-size: .7rem; color: var(--text-muted); margin-top: 4px; font-style: italic; }
.rd-tt-close {
  position: absolute; top: 4px; right: 6px;
  background: none; border: none; cursor: pointer;
  font-size: .75rem; color: var(--text-muted);
  padding: 2px 4px; line-height: 1;
}
.rd-tt-close:hover { color: var(--text); }

/* ── Main content area ── */
.rd-main { padding: 20px 16px; max-width: 620px; margin: 0 auto; }

/* ── Reading phase ── */
.rd-reading-phase { display: flex; flex-direction: column; gap: 16px; }
.rd-read-info {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  font-size: .85rem; font-weight: 600; color: var(--text-muted);
}
.rd-gloss-tip { color: #0284C7; }
.rd-start-btn { font-size: .95rem; padding: 14px; }

/* ── Question area ── */
.rd-q-wrap { display: flex; flex-direction: column; gap: 16px; }

.rd-q-progress-bar { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.rd-q-progress-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width .4s; }

.rd-q-meta { display: flex; align-items: center; gap: 10px; font-size: .78rem; }
.rd-q-type  { background: var(--primary-light); color: var(--primary-dark); border-radius: 10px; padding: 2px 8px; font-weight: 700; }
.rd-q-count { color: var(--text-muted); font-weight: 600; margin-left: auto; }
.rd-hints-used { color: #0284C7; font-weight: 700; }

.rd-question-text { font-size: 1.05rem; font-weight: 700; line-height: 1.5; }

/* MCQ options */
.rd-options { display: flex; flex-direction: column; gap: 8px; }
.rd-option {
  text-align: left; padding: 12px 16px;
  border: 2px solid var(--border); border-radius: var(--radius);
  background: var(--card); font-size: .92rem; font-weight: 600;
  color: var(--text); cursor: pointer; transition: all .12s;
}
.rd-option:hover:not([data-answered]) { border-color: var(--primary); background: var(--primary-light); }
.rd-opt-correct { border-color: #388E3C !important; background: #E8F5E9 !important; color: #1B5E20 !important; }
.rd-opt-wrong   { border-color: #C62828 !important; background: #FFEBEE !important; color: #B71C1C !important; }

/* True/False */
.rd-tf-row { display: flex; gap: 12px; }
.rd-tf-btn {
  flex: 1; padding: 14px; border: 2px solid var(--border);
  border-radius: var(--radius); background: var(--card);
  font-size: .95rem; font-weight: 800; cursor: pointer; transition: all .12s;
}
.rd-tf-true:hover:not([data-answered])  { border-color: #388E3C; background: #E8F5E9; color: #1B5E20; }
.rd-tf-false:hover:not([data-answered]) { border-color: #C62828; background: #FFEBEE; color: #B71C1C; }

/* Short answer */
.rd-short-form { display: flex; gap: 8px; }
.rd-short-input {
  flex: 1; padding: 10px 14px; border: 2px solid var(--border);
  border-radius: var(--radius); font-size: .95rem; font-family: var(--font);
  background: var(--bg); color: var(--text); outline: none;
}
.rd-short-input:focus { border-color: var(--primary); }
.rd-short-submit { white-space: nowrap; padding: 10px 18px; }
.rd-short-hint { font-size: .78rem; color: var(--text-muted); font-style: italic; }
.rd-short-fb { padding: 8px 12px; border-radius: var(--radius-sm); font-size: .88rem; font-weight: 700; margin-top: 4px; }
.rd-fb-ok  { background: #E8F5E9; color: #1B5E20; }
.rd-fb-err { background: #FFEBEE; color: #B71C1C; }

/* Self-check */
.rd-selfcheck-wrap { display: flex; flex-direction: column; gap: 10px; }
.rd-selfcheck-input {
  width: 100%; padding: 10px 14px; border: 2px solid var(--border);
  border-radius: var(--radius); font-size: .92rem; font-family: var(--font);
  background: var(--bg); color: var(--text); outline: none; resize: vertical; min-height: 90px;
}
.rd-selfcheck-input:focus { border-color: var(--primary); }
.rd-reveal-btn { align-self: flex-start; }

.rd-model-answer {
  background: #FFF8E1; border: 1.5px solid #FFC107;
  border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.rd-model-answer.hidden { display: none; }
.rd-model-label { font-size: .78rem; font-weight: 800; color: #E65100; }
.rd-model-text  { font-size: .9rem; line-height: 1.6; color: var(--text); }

.rd-self-rate { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rd-self-rate-label { font-size: .82rem; font-weight: 700; color: var(--text-muted); }
.rd-self-btn { padding: 8px 18px; border-radius: var(--radius); font-weight: 800; font-size: .88rem; cursor: pointer; transition: all .12s; border: 2px solid; }
.rd-self-ok { border-color: #388E3C; background: #E8F5E9; color: #1B5E20; }
.rd-self-ok:hover  { background: #388E3C; color: #fff; }
.rd-self-ko { border-color: #C62828; background: #FFEBEE; color: #B71C1C; }
.rd-self-ko:hover  { background: #C62828; color: #fff; }

.rd-input-shake { animation: rd-shake .3s ease; }
@keyframes rd-shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }

/* Next button */
.rd-next-btn { padding: 13px; font-size: .95rem; }
.rd-next-btn.hidden { display: none; }

/* ── Results ── */
.rd-results { display: flex; flex-direction: column; gap: 20px; }
.rd-results-header { text-align: center; }
.rd-results-emoji  { font-size: 3rem; margin-bottom: 4px; }
.rd-results-msg    { font-size: 1.1rem; font-weight: 800; }
.rd-results-score  { font-size: .95rem; color: var(--text-muted); margin-top: 4px; }
.rd-results-pct    { font-size: 2rem; font-weight: 900; color: var(--primary-dark); }

.rd-results-xp {
  text-align: center; background: var(--primary-light);
  color: var(--primary-dark); border-radius: var(--radius);
  padding: 12px; font-size: 1.1rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
}
.rd-xp-bonus   { font-size: .8rem; background: #4CAF50; color: #fff; border-radius: 10px; padding: 2px 8px; }
.rd-xp-penalty { font-size: .8rem; background: #FF9800; color: #fff; border-radius: 10px; padding: 2px 8px; }

.rd-results-breakdown { display: flex; flex-direction: column; gap: 6px; }
.rd-result-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.rd-result-item.ok  { background: #F0FDF4; }
.rd-result-item.err { background: #FEF2F2; }
.rd-ri-icon { flex-shrink: 0; font-size: .9rem; }
.rd-ri-body { flex: 1; min-width: 0; }
.rd-ri-q    { font-size: .82rem; font-weight: 600; color: var(--text); }
.rd-ri-ans  { font-size: .78rem; color: #2E7D32; font-weight: 700; margin-top: 2px; }

.rd-results-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ── Dark mode overrides ── */
[data-theme="dark"] .rd-opt-correct { border-color: #065F46 !important; background: #0D2B1E !important; color: #6EE7B7 !important; }
[data-theme="dark"] .rd-opt-wrong   { border-color: #7F1D1D !important; background: #3B1010 !important; color: #F87171 !important; }
[data-theme="dark"] .rd-tf-true:hover:not([data-answered])  { background: #0D2B1E; border-color: #065F46; color: #6EE7B7; }
[data-theme="dark"] .rd-tf-false:hover:not([data-answered]) { background: #3B1010; border-color: #7F1D1D; color: #F87171; }
[data-theme="dark"] .rd-fb-ok   { background: #0D2B1E; color: #6EE7B7; }
[data-theme="dark"] .rd-fb-err  { background: #3B1010; color: #F87171; }
[data-theme="dark"] .rd-self-ok { background: #0D2B1E; border-color: #065F46; color: #6EE7B7; }
[data-theme="dark"] .rd-self-ok:hover  { background: #065F46; color: #fff; }
[data-theme="dark"] .rd-self-ko { background: #3B1010; border-color: #7F1D1D; color: #F87171; }
[data-theme="dark"] .rd-self-ko:hover  { background: #7F1D1D; color: #fff; }
[data-theme="dark"] .rd-model-answer { background: #2A2505; border-color: #4A4000; }
[data-theme="dark"] .rd-model-label  { color: #FCD34D; }
[data-theme="dark"] .rd-result-item.ok  { background: #0D2B1E; }
[data-theme="dark"] .rd-result-item.err { background: #3B1010; }
[data-theme="dark"] .rd-ri-ans  { color: #6EE7B7; }
[data-theme="dark"] .rd-short-input,
[data-theme="dark"] .rd-selfcheck-input { background: #1F1A12; color: var(--text); }

/* ── Responsive ── */
@media (max-width: 520px) {
  .rd-text-grid { grid-template-columns: 1fr; }
  .rd-text-body { max-height: 35vh; }
  .rd-short-form { flex-direction: column; }
  .rd-short-submit { width: 100%; }
  .rd-results-actions { flex-direction: column; }
  .rd-results-actions button { width: 100%; }
}

/* ════════════════════════════════════════════════════════
   COMPETITIVE — Malagasy sub-labels (Task 2)
════════════════════════════════════════════════════════ */
.comp-q-label-mg,
.comp-q-type-mg {
  font-size: .72rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2px;
}

/* ════════════════════════════════════════════════════════
   Global Malagasy sub-labels (shared by Reading, Dialogue, Exercise)
════════════════════════════════════════════════════════ */
/* Reading phase MG instruction */
.rd-phase-mg {
  font-size: .78rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 6px 0 10px;
}
/* Reading question type MG sub-label */
.rd-q-type-mg {
  font-size: .68rem;
  color: var(--text-muted);
  font-style: italic;
}
/* Dialogue task MG sub-instruction */
.task-mg {
  font-size: .75rem;
  color: var(--text-muted);
  font-style: italic;
  margin: -4px 0 8px;
}

/* ════════════════════════════════════════════════════════
   LECTURE MG (ComprehensionEcriteView)
════════════════════════════════════════════════════════ */
.lecture-page { min-height: 100vh; background: var(--bg); }

/* List */
.lecture-list-view { max-width: 620px; margin: 0 auto; padding: 16px; }
.lecture-list-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.lecture-list-title { font-size: 1.3rem; font-weight: 700; color: var(--text); margin: 0 0 4px; }
.lecture-list-sub { font-size: .8rem; color: var(--text-muted); margin: 0; }
.lecture-cards { display: flex; flex-direction: column; gap: 10px; }
.lecture-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border-radius: var(--radius);
  border: 1.5px solid var(--border); padding: 14px 16px;
  cursor: pointer; text-align: left; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.lecture-card:hover { border-color: #10B981; box-shadow: 0 2px 8px rgba(16,185,129,.15); }
.lecture-card-icon { font-size: 2rem; flex-shrink: 0; }
.lecture-card-body { flex: 1; }
.lecture-card-title { font-weight: 600; color: var(--text); font-size: .95rem; }
.lecture-card-meta { font-size: .75rem; color: var(--text-muted); margin-top: 3px; }
.lecture-card-arrow { font-size: 1.4rem; color: var(--text-muted); }

/* Shared header */
.lecture-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--card);
}
.lecture-title-icon { font-size: 1.3rem; }
.lecture-title-text { font-size: .95rem; font-weight: 600; color: var(--text); flex: 1; }
.lecture-badge {
  background: #D1FAE5; color: #065F46;
  font-size: .7rem; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
}

/* Text view */
.lecture-text-view { max-width: 620px; margin: 0 auto; }
.lecture-text-box {
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  margin: 16px; font-size: .95rem; line-height: 1.7; color: var(--text);
}
.lecture-text-small { font-size: .82rem; margin: 8px 16px; padding: 10px 14px; }
.lecture-instr {
  margin: 0 16px 12px; font-size: .82rem; color: var(--text-muted);
  background: #F0FDF4; border-radius: var(--radius-sm); padding: 10px 14px;
}
.lecture-instr-mg { font-style: italic; font-size: .78rem; }
.lecture-start-btn { display: block; margin: 0 16px 20px; width: calc(100% - 32px); }

/* Question view */
.lecture-q-view { max-width: 620px; margin: 0 auto; }
.lecture-q-card {
  background: var(--card); border-radius: var(--radius);
  border: 1.5px solid var(--border); margin: 12px 16px; padding: 16px;
}
.lecture-q-num { font-size: .72rem; font-weight: 700; color: #10B981; margin-bottom: 8px; }
.lecture-q-text { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 14px; }
.lecture-q-options { display: flex; flex-direction: column; gap: 8px; }
.lecture-opt-btn {
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  text-align: left; cursor: pointer; font-size: .88rem; color: var(--text);
  transition: border-color .15s;
}
.lecture-opt-btn:hover:not(:disabled) { border-color: #10B981; }
.lec-opt-correct { background: #D1FAE5 !important; border-color: #10B981 !important; font-weight: 600; }
.lec-opt-wrong   { background: #FEE2E2 !important; border-color: #EF4444 !important; }
.lecture-q-next { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.lecture-q-fb { font-size: .88rem; font-weight: 600; padding: 4px 0; }
.lec-fb-ok { color: #10B981; }
.lec-fb-no { color: #EF4444; }

/* Results + translation */
.lecture-results-view { max-width: 620px; margin: 0 auto; padding-bottom: 40px; }
.lec-score-banner {
  text-align: center; padding: 20px;
  background: linear-gradient(135deg, #D1FAE5, #A7F3D0);
  margin: 12px 16px; border-radius: var(--radius);
}
.lec-score-num { font-size: 2.4rem; font-weight: 800; color: #065F46; }
.lec-score-xp  { font-size: .9rem; color: #047857; margin-top: 4px; }
.lec-score-msg { font-size: 1.1rem; margin-top: 6px; color: #065F46; }

.lec-translation-section { margin: 16px; }
.lec-trans-title { font-size: 1rem; font-weight: 700; color: var(--text); margin: 0 0 4px; }
.lec-trans-note  { font-size: .75rem; color: var(--text-muted); margin: 0 0 14px; }

.lec-sentence-block {
  background: var(--card); border-radius: var(--radius-sm);
  border: 1px solid var(--border); padding: 12px 14px; margin-bottom: 10px;
}
.lec-sen-en  { font-size: .9rem; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.lec-sen-words { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.lec-word-pair {
  display: flex; flex-direction: column; align-items: center;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 8px;
}
.lec-w-en { font-size: .75rem; font-weight: 600; color: var(--text); }
.lec-w-mg { font-size: .7rem; color: #10B981; margin-top: 1px; }
.lec-sen-free { font-size: .82rem; color: #047857; font-style: italic; border-top: 1px solid var(--border); padding-top: 6px; margin-top: 4px; }
.lec-av-note { font-size: .72rem; color: var(--text-muted); font-style: italic; margin-top: 10px; }

.lec-end-actions { display: flex; gap: 10px; margin: 16px; }
.lec-end-actions button { flex: 1; }

[data-theme="dark"] .lecture-card:hover { border-color: #10B981; }
[data-theme="dark"] .lec-score-banner { background: linear-gradient(135deg, #064E3B, #065F46); }
[data-theme="dark"] .lec-score-num,
[data-theme="dark"] .lec-score-xp,
[data-theme="dark"] .lec-score-msg { color: #A7F3D0; }
[data-theme="dark"] .lecture-instr { background: #0F2418; }
[data-theme="dark"] .lec-sen-free { color: #6EE7B7; }

/* ── Task A: Vocabulary FR/MG language toggle ───────────────────────────── */
.vocab-lang-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: -8px 0 18px;
}
.vocab-lang-toggle {
  display: inline-flex;
  background: var(--bg-soft, #f5f5f5);
  border-radius: 8px;
  overflow: hidden;
}
.lang-toggle-btn {
  padding: 9px 22px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-muted, #888);
  transition: all 0.2s;
}
.lang-toggle-btn.active {
  background: var(--accent, #4CAF50);
  color: white;
}
.vocab-lang-caption {
  font-size: 12px;
  color: var(--text-muted, #888);
  line-height: 1.3;
}
/* Emphasise the target language in vocab cards, fade the other */
.vocab-card-lang-mg .vocab-fr {
  font-size: .72rem;
  opacity: .5;
}
.vocab-card-lang-mg .vocab-mg {
  font-size: .95rem;
  font-weight: 700;
  opacity: 1;
}
.vocab-card-lang-fr .vocab-fr {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}
.vocab-card-lang-fr .vocab-mg {
  font-size: .72rem;
  opacity: .5;
}
.spell-mg-hint {
  color: #10B981;
  font-size: 13px;
  margin-top: 4px;
  text-transform: none;
  letter-spacing: normal;
}
.quiz-prompt-mg {
  color: #10B981;
  font-size: 13px;
  margin-top: 4px;
  font-style: italic;
  text-transform: none;
  letter-spacing: normal;
}
.instr-mg {
  color: #10B981;
  font-size: 13px;
  font-style: italic;
  margin-top: 2px;
  text-transform: none;
  letter-spacing: normal;
}
/* All MG sub-labels: force normal case to distinguish from FR (often uppercase) */
.rd-phase-mg,
.rd-q-type-mg,
.task-mg,
.ex-instruction-mg,
.ex-q-mg,
.comp-q-label-mg,
.comp-q-type-mg,
.mg-note,
.lecture-instr-mg {
  text-transform: none !important;
  letter-spacing: normal !important;
}

/* ─── MG Vote Widget (Task 1) ─────────────────────────────────────── */
.mg-vote-widget {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 4px 8px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px dashed rgba(245, 158, 11, 0.4);
  border-radius: 8px;
  font-size: 13px;
  flex-wrap: wrap;
}
.mg-vote-btn {
  padding: 4px 10px;
  border: 1px solid rgba(0,0,0,0.1);
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: transform .1s ease, background .15s ease;
}
.mg-vote-btn:hover:not(:disabled) {
  transform: scale(1.05);
}
.mg-vote-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.mg-vote-up { color: #16a34a; }
.mg-vote-down { color: #dc2626; }
.mg-vote-status {
  font-size: 12px;
  color: #92400e;
  font-style: italic;
}
.mg-proposal-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.mg-proposal-modal[hidden] { display: none; }
.mg-proposal-content {
  background: white;
  padding: 24px;
  border-radius: 14px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.mg-proposal-content h3 {
  margin: 0 0 12px;
  font-size: 20px;
}
.mg-proposal-context {
  background: #f5f5f4;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 14px;
}
.mg-proposal-content label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 14px;
}
.mg-proposal-content input {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 2px solid #d6d3d1;
  border-radius: 8px;
  box-sizing: border-box;
}
.mg-proposal-content input:focus {
  outline: none;
  border-color: #10B981;
}
.mg-proposal-hint {
  font-size: 12px;
  color: #10B981;
  font-style: italic;
  margin: 6px 0 16px;
}
.mg-proposal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.mg-report-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 12px 0;
  font-size: 14px;
  flex-wrap: wrap;
  gap: 8px;
}
.mg-report-info { color: #065f46; }

/* ─── Tot Kely (Task 2) ───────────────────────────────────────────── */
.totkely-page {
  min-height: 100vh;
  padding: 16px;
  background: linear-gradient(160deg, #fef9c3 0%, #ecfccb 50%, #d1fae5 100%);
  font-size: 18px;
}
.tk-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.tk-title-wrap { flex: 1; }
.tk-title {
  font-size: 32px;
  margin: 0;
  color: #065f46;
}
.tk-sub {
  margin: 4px 0 0;
  font-size: 16px;
  color: #047857;
  font-style: italic;
}
.tk-counter {
  font-size: 18px;
  font-weight: 700;
  color: #065f46;
  background: white;
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.tk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.tk-card {
  background: white;
  border: 3px solid #a7f3d0;
  border-radius: 18px;
  padding: 16px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 3px 8px rgba(0,0,0,0.06);
  font-family: inherit;
}
.tk-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.12);
  border-color: #10b981;
}
.tk-icon {
  font-size: 48px;
  line-height: 1;
}
.tk-en {
  font-size: 20px;
  font-weight: 800;
  color: #1e293b;
}
.tk-mg {
  font-size: 16px;
  color: #047857;
  font-style: italic;
}
.tk-bigcard {
  background: white;
  border: 4px solid #10b981;
  border-radius: 22px;
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  max-width: 520px;
  margin: 0 auto;
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.15);
}
.tk-bigicon { font-size: 120px; line-height: 1; }
.tk-bigen {
  font-size: 52px;
  font-weight: 900;
  color: #064e3b;
  text-align: center;
}
.tk-listen {
  font-size: 26px;
  padding: 16px 28px;
  border-radius: 999px;
  background: #10b981;
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}
.tk-listen:hover { background: #059669; }
.tk-bigmg {
  font-size: 28px;
  color: #047857;
  font-style: italic;
  text-align: center;
}
.tk-nav {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 22px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}
.tk-navbtn {
  flex: 1;
  font-size: 18px;
  padding: 14px;
}
.tk-shortcut {
  display: inline-block;
  margin-left: 8px;
  margin-top: 6px;
  background: transparent;
  border: 1px solid rgba(16, 185, 129, 0.45);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #047857;
  white-space: nowrap;
}
.tk-shortcut:hover { background: rgba(16, 185, 129, 0.12); }
.tk-shortcut-active {
  background: #10b981;
  color: white;
  border-color: #10b981;
  font-weight: 700;
}
.tk-shortcut-active:hover { background: #059669; }

/* Tot Kely inline mode inside Vocabulary */
.vocab-grid-totkely {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
  gap: 18px !important;
}
.vocab-card-totkely {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 14px;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border: 2px solid #6ee7b7;
  border-radius: 18px;
  min-height: 180px;
  text-align: center;
}
.vocab-card-totkely .tk-icon {
  font-size: 56px;
  line-height: 1;
}
.vocab-card-totkely .tk-en {
  font-size: 24px;
  font-weight: 800;
  color: #064e3b;
  display: flex;
  align-items: center;
  gap: 6px;
}
.vocab-card-totkely .tk-mg {
  font-size: 18px;
  color: #047857;
  font-style: italic;
}
.vocab-card-totkely .tts-btn {
  background: #10b981;
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 14px;
  cursor: pointer;
}

/* ─── Page admin traductions malgaches (#mgadmin) ─────────────────────────── */
.mgadmin-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}
.mgadmin-pin-box {
  max-width: 360px;
  margin: 48px auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px 22px;
  background: var(--card, #fff);
  border: 1px solid var(--border, #eee);
  border-radius: 16px;
}
.mgadmin-pin-label { font-weight: 700; color: var(--text); }
.mgadmin-pin-sub { font-size: 14px; color: var(--text-muted, #888); }
.mgadmin-pin-input {
  font-size: 28px;
  letter-spacing: 12px;
  text-align: center;
  padding: 12px;
  border: 2px solid var(--border, #ddd);
  border-radius: 10px;
  width: 160px;
  margin: 0 auto;
}
.mgadmin-pin-input:focus { outline: none; border-color: var(--accent, #4CAF50); }
.mgadmin-pin-error { color: #dc2626; font-size: 13px; font-weight: 600; }
.mgadmin-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: #065f46;
  color: #fff;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 9999;
}
.mgadmin-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.mgadmin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.mgadmin-title {
  margin: 0;
  font-size: 1.25rem;
  text-align: center;
  flex: 1;
}
.mgadmin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.mgadmin-section {
  margin-bottom: 28px;
}
.mgadmin-section-title {
  font-size: 1.05rem;
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border, #ddd);
}
.mgadmin-card,
.mgadmin-row {
  border: 1px solid var(--border, #ddd);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  background: var(--card-bg, #fff);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mgadmin-ctx {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.92rem;
}
.mgadmin-en { color: var(--text, #222); font-weight: 600; }
.mgadmin-fr { color: var(--text-muted, #666); }
.mgadmin-orig {
  font-size: 0.92rem;
  color: var(--text-muted, #666);
  word-break: break-word;
}
.mgadmin-orig span { font-style: italic; }
.mgadmin-applied { color: #1a8a3a; }
.mgadmin-props {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mgadmin-prop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--bg-subtle, #f6f6f6);
  border-radius: 6px;
}
.mgadmin-prop-text { font-weight: 600; }
.mgadmin-prop-meta { font-size: 0.82rem; color: var(--text-muted, #888); }
.mgadmin-edit,
.mgadmin-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.mgadmin-input {
  flex: 1;
  min-width: 180px;
  padding: 8px 10px;
  border: 1px solid var(--border, #ccc);
  border-radius: 6px;
  font-size: 0.95rem;
}
.mgadmin-mini-btn {
  padding: 6px 12px;
  font-size: 0.88rem;
  flex-shrink: 0;
}
.mgadmin-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-muted, #888);
}
.mgadmin-tag {
  background: var(--bg-subtle, #eee);
  border-radius: 4px;
  padding: 1px 8px;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
}
.mgadmin-empty,
.mgadmin-empty-mini {
  text-align: center;
  color: var(--text-muted, #888);
  padding: 16px;
  font-style: italic;
}

/* ─── Dashboard MG review button ─────────────────────────────────────────── */
.dash-mgreview-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin: 12px 0 4px;
  padding: 11px 16px;
  background: none;
  border: 1.5px dashed var(--primary, #22c55e);
  border-radius: var(--radius, 12px);
  color: var(--primary-dark, #16a34a);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}
.dash-mgreview-btn:hover {
  background: var(--primary-light, #f0fdf4);
}

/* ─── MgReviewUser page ──────────────────────────────────────────────────── */
.mgreview-intro {
  max-width: 640px;
  margin: 0 auto 20px;
  padding: 0 16px;
  color: var(--text-secondary, #555);
  font-size: 0.92rem;
  line-height: 1.6;
}
.mgreview-count {
  font-weight: 600;
  color: var(--primary, #22c55e);
  margin-top: 8px;
}
.mgreview-list {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mgreview-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.mgreview-langs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 0.9rem;
}
.mgreview-en { color: var(--text-primary, #111); }
.mgreview-fr { color: var(--text-secondary, #555); }
.mgreview-current {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.88rem;
  color: var(--text-secondary, #555);
  margin-bottom: 12px;
}
.mgreview-badge {
  background: #fef3c7;
  color: #92400e;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mgreview-confirm {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  font-size: 0.85rem;
  padding: 8px 14px;
  border: 1px solid var(--primary, #22c55e);
  color: var(--primary-dark, #16a34a);
  background: transparent;
}
.mgreview-confirm:hover {
  background: rgba(34,197,94,.08);
}
.mgreview-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.mgreview-input {
  flex: 1;
  min-width: 180px;
  padding: 8px 12px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--input-bg, #f9fafb);
  color: var(--text-primary, #111);
  outline: none;
  transition: border-color 0.2s;
}
.mgreview-input:focus {
  border-color: var(--primary, #22c55e);
  box-shadow: 0 0 0 2px rgba(34,197,94,.15);
}
.mgreview-submit {
  white-space: nowrap;
  font-size: 0.85rem;
  padding: 8px 14px;
}
.mgreview-thanks {
  font-size: 0.88rem;
  color: var(--primary-dark, #16a34a);
  font-weight: 600;
  padding: 6px 0;
}
