/* ==========================================================================
   English Journey AI — Design Tokens
   Signature concept: the learner's progress reads like a passport/boarding
   pass — stamps for milestones, a perforated stub on pack cards, a dashed
   "flight path" for lesson progress. Ties directly to the travel-pack theme
   without leaning on generic AI-default palettes.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Almarai:wght@400;700;800&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  /* Color */
  --ink:        #16302A;   /* near-black green-ink, body text */
  --paper:      #F6F5EF;   /* warm paper background, not cream-#F4F1EA */
  --paper-raised: #FFFFFF;
  --teal:       #1C6B5E;   /* primary — passport-cover green */
  --teal-deep:  #123F37;
  --gold:       #C98A2E;   /* accent — stamp/seal gold */
  --gold-soft:  #F0D9A8;
  --coral:      #C1502E;   /* rare — errors / locked emphasis */
  --line:       #D8D2C2;   /* hairline / perforation color */
  --success:    #2E7D4F;
  --whatsapp:   #25A35A;   /* muted toward --teal, not the raw brand green */
  --whatsapp-soft: #E4F3EA;

  /* Type */
  --font-ar: 'Almarai', system-ui, sans-serif;
  --font-en: 'Manrope', system-ui, sans-serif;

  /* Layout */
  --radius-card: 20px;
  --radius-sm: 10px;
  --shadow-card: 0 2px 14px rgba(22,48,42,0.08);
  --shadow-raised: 0 8px 24px rgba(22,48,42,0.14);
  --nav-height: 64px;
  --max-width: 480px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--paper);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
/* Direction and base typeface both flip with the active UI language.
   Set on <html> (via app.js) so every inherited value in the document
   mirrors correctly — Arabic reads RTL in Almarai, English reads LTR
   in Manrope. */
html[dir="rtl"] { direction: rtl; font-family: var(--font-ar); }
html[dir="ltr"] { direction: ltr; font-family: var(--font-en); }
body {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}
.icon-wrap { display: inline-flex; align-items: center; justify-content: center; line-height: 0; vertical-align: middle; }
.icon-wrap svg { display: block; }
#app {
  width: 100%;
  max-width: var(--max-width);
  min-height: 100dvh;
  position: relative;
  padding-bottom: calc(var(--nav-height) + 16px);
}
/* Inline-safe language isolation: use to embed a fragment of one
   language inside a paragraph/UI written in the other, regardless of
   which direction the page is currently in (e.g. an English pack name
   shown as a subtitle inside an Arabic UI, or vice versa). */
.en { font-family: var(--font-en); direction: ltr; unicode-bidi: isolate; }
.ar { font-family: var(--font-ar); direction: rtl; unicode-bidi: isolate; }
/* Hausa is Latin-script/LTR like English; browsers fall back to a font
   with glyph coverage for ɓ/ɗ/ƙ automatically if --font-en lacks them,
   via the system-ui/sans-serif fallbacks already in that font stack. */
.ha { font-family: var(--font-en); direction: ltr; unicode-bidi: isolate; }
button { font-family: inherit; }
a { color: inherit; }

/* The Arabic target sentence in a lesson is always Arabic, independent
   of the current interface language — unlike UI chrome and bilingual
   content notes (pack descriptions, explain boxes, quiz text), which
   follow whichever language is active and get their direction from the
   inline .ar/.en isolate classes applied where they're rendered. */
.ar-sentence {
  direction: rtl;
  font-family: var(--font-ar);
  unicode-bidi: isolate;
}
.pack-desc { opacity: .8; font-size: 14px; line-height: 1.6; margin: 0; }

/* Focus visibility */
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- App header (persistent, professional brand bar) ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--paper-raised);
  border-bottom: 1px solid var(--line);
}
.app-header__brand {
  display: flex;
  align-items: center;
  gap: 9px;
}
.app-header__mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: linear-gradient(155deg, var(--teal), var(--teal-deep));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(22,48,42,0.25);
}
.app-header__word {
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.01em;
  color: var(--teal-deep);
}
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 800;
  font-family: var(--font-en);
  color: var(--teal-deep);
  cursor: pointer;
}
.lang-toggle--inline { font-size: 13px; }
.lang-toggle--inline .chev { transform: rotate(90deg); opacity: 0.6; }

/* ---------- Top bar ---------- */
.topbar {
  padding: 20px 20px 8px;
}
.topbar h1 {
  font-size: 22px;
  margin: 0 0 2px;
}
.topbar p {
  margin: 0;
  color: var(--teal-deep);
  opacity: 0.75;
  font-size: 14px;
}
.screen-title {
  padding: 20px 20px 4px;
  font-size: 20px;
  font-weight: 800;
}

/* ---------- Section heading ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 24px 20px 10px;
}
.section-head h2 {
  font-size: 15px;
  letter-spacing: 0.02em;
  margin: 0;
  color: var(--teal-deep);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---------- Boarding-pass style pack card ---------- */
.pass-card {
  margin: 0 20px 14px;
  background: var(--paper-raised);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  display: flex;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(22,48,42,0.06);
}
.pass-card__main {
  flex: 1;
  padding: 16px 16px;
  min-width: 0;
}
.pass-card__stub {
  width: 64px;
  background: var(--teal);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
}
.pass-card__stub::before {
  content: "";
  position: absolute;
  inset-inline-start: -6px;
  top: 0; bottom: 0;
  width: 0;
  border-inline-start: 2px dashed rgba(255,255,255,0.55);
}
.pass-card__stub .icon { font-size: 22px; }
.pass-card__stub .pct { font-size: 12px; font-weight: 800; font-family: var(--font-en); }
.pass-card--locked .pass-card__stub { background: #8A8578; }

.pass-card__top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pass-card__icon { font-size: 26px; line-height: 1; }
.pass-card__title { font-weight: 800; font-size: 16px; margin: 0; }
.pass-card__title .en,
.pass-card__title .ar { display: block; font-size: 12.5px; font-weight: 600; color: var(--teal-deep); opacity: 0.7; margin-top: 1px; }
.pass-card__desc { font-size: 13px; margin: 8px 0 10px; opacity: 0.8; line-height: 1.5; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
}
.badge--new { background: var(--gold-soft); color: #7A5311; }
.badge--locked { background: #F1EEE2; color: #7A6F4E; }
.badge--free { background: #E1EEE7; color: var(--teal-deep); }
.badge--price { background: var(--teal-deep); color: #fff; margin-inline-start: 6px; }

.price-callout {
  margin-top: 12px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  background: #F1EEE2;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.price-callout__amount { font-size: 22px; font-weight: 800; color: var(--teal-deep); font-family: var(--font-en); direction: ltr; }
.price-callout__note { font-size: 12.5px; opacity: 0.7; }
.modal-price { font-size: 14px; margin: 4px 0 0; }
.modal-price strong { font-family: var(--font-en); direction: ltr; unicode-bidi: isolate; }

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: #EDEAE0;
  overflow: hidden;
  margin: 6px 0;
  position: relative;
}
.progress-track::after {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.6) 1px, transparent 1.5px);
  background-size: 8px 8px;
  opacity: 0.4;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  border-radius: 999px;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  opacity: 0.75;
  margin-top: 2px;
}

.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--teal); color: #fff; }
.btn--gold { background: var(--gold); color: #fff; }
.btn--outline { background: transparent; color: var(--teal); border: 1.5px solid var(--teal); }
.btn--block { width: 100%; }
.btn--sm { padding: 7px 12px; font-size: 12.5px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- Continue Learning hero ---------- */
.continue-card {
  margin: 4px 20px 4px;
  background: linear-gradient(155deg, var(--teal) 0%, var(--teal-deep) 100%);
  color: #fff;
  border-radius: var(--radius-card);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-raised);
  position: relative;
  overflow: hidden;
}
.continue-card::after {
  content: "";
  position: absolute;
  inset-inline-end: -30px; top: -30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}
.continue-card .eyebrow { font-size: 12px; opacity: 0.8; margin: 0 0 4px; }
.continue-card h3 { margin: 0 0 10px; font-size: 18px; }
.continue-card .progress-track { background: rgba(255,255,255,0.18); }
.continue-card .progress-track::after { display: none; }
.continue-card .progress-fill { background: var(--gold); }
.continue-card .progress-meta { color: rgba(255,255,255,0.85); }
.continue-card .btn--gold { margin-top: 12px; }

.empty-hero {
  margin: 4px 20px 4px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-card);
  padding: 22px 18px;
  text-align: center;
}
.empty-hero p { margin: 0 0 12px; opacity: 0.75; font-size: 14px; }

/* ---------- New this month banner ---------- */
.new-banner {
  margin: 4px 20px 4px;
  background: var(--paper-raised);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 16px;
  border: 1px solid rgba(22,48,42,0.06);
}
.new-banner__row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.new-banner__row .pass-card__icon { font-size: 30px; }
.new-banner ul { margin: 8px 0 12px; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.new-banner li { font-size: 12.5px; opacity: 0.75; }

/* ---------- Category grid ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 20px;
}
.cat-card {
  background: var(--paper-raised);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  box-shadow: var(--shadow-card);
  text-align: center;
  border: 1px solid rgba(22,48,42,0.06);
  cursor: pointer;
}
.cat-card .icon { font-size: 26px; display: block; margin-bottom: 6px; }
.cat-card .name { font-size: 13px; font-weight: 700; }

/* ---------- Bottom nav ---------- */
.bottomnav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  height: var(--nav-height);
  background: var(--paper-raised);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 40;
}
.navbtn {
  flex: 1;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  color: #8A8578;
  cursor: pointer;
  font-weight: 700;
}
.navbtn .icon { font-size: 20px; }
.navbtn[aria-current="true"] { color: var(--teal); }

/* ---------- Lesson screen ---------- */
.lesson-wrap { padding: 16px 20px 20px; }
.lesson-progress-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.lesson-progress-header .progress-track { flex: 1; margin: 0; }
.lesson-progress-header span { font-size: 12px; opacity: 0.7; white-space: nowrap; }

.sentence-card {
  background: var(--paper-raised);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 22px 18px;
  text-align: center;
  border: 1px solid rgba(22,48,42,0.06);
}
.sentence-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 12px;
}
.sentence-card .ar-sentence {
  font-size: 22px;
  font-weight: 800;
  color: var(--teal-deep);
  margin: 0;
  line-height: 1.6;
}
.mini-listen {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--teal);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.mini-listen:active { transform: scale(0.94); }
.sentence-card .en-sentence {
  font-size: 15.5px;
  font-weight: 600;
  opacity: 0.75;
  margin: 0;
  direction: ltr;
  font-family: var(--font-en);
}
.audio-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.meaning-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 6px 0 0;
}
.sentence-card .ha-sentence {
  font-size: 13.5px;
  font-weight: 500;
  opacity: 0.6;
  margin: 0;
  direction: ltr;
  font-family: var(--font-en);
  font-style: italic;
}
.meaning-row--ha { margin: 3px 0 0; }
.practice-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}
.practice-toggle {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
}
.practice-toggle button {
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.practice-toggle button[aria-pressed="true"] {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.explain-box {
  margin-top: 16px;
  background: #F1EEE2;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.7;
}
.explain-box p, .quiz-explain-wrap p { margin: 0; }
.explain-box p + p { margin-top: 10px; } /* spacing between paragraphs of a multi-paragraph lesson note — see app.js#explainNote */
.explain-lang-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.explain-lang-toggle button {
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-en);
  letter-spacing: 0.02em;
  cursor: pointer;
  opacity: 0.65;
}
.explain-lang-toggle button[aria-pressed="true"] {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  opacity: 1;
}
.speak-feedback {
  margin-top: 12px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  min-height: 20px;
}
.speak-feedback.ok { color: var(--success); }
.speak-feedback.retry { color: var(--coral); }

.lesson-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ---------- Listen & Read (trilingual listening pack) ---------- */
.lr-hidden-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 10px;
  color: var(--teal);
  opacity: 0.75;
}
.lr-hidden-placeholder span {
  font-size: 13px;
  font-weight: 600;
  max-width: 220px;
  line-height: 1.5;
}
.lr-reveal-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 10px auto 0;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.lr-reveal-toggle[aria-pressed="true"] {
  background: #F1EEE2;
  border-color: transparent;
}
.lr-lang-buttons {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.lr-lang-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--teal-deep);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  min-width: 74px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}
.lr-lang-btn:active { transform: scale(0.96); }
.lr-lang-btn--unavailable {
  color: #8A8578;
  opacity: 0.6;
  cursor: default;
}
.lr-lang-btn--unavailable small {
  font-size: 9.5px;
  font-weight: 600;
  opacity: 0.85;
}
.lr-slow-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 12px auto 0;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0.7;
}
.lr-slow-toggle[aria-pressed="true"] {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  opacity: 1;
}
.quiz-listen-again-label {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  opacity: 0.65;
  margin: 0 0 8px;
}

/* ---------- Word Bank (spaced-repetition flashcards) ---------- */
.wb-stats-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.wb-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 4px;
}
.wb-stat__num {
  font-size: 19px;
  font-weight: 800;
  color: var(--teal-deep);
}
.wb-stat__label {
  font-size: 10.5px;
  font-weight: 700;
  opacity: 0.65;
  text-align: center;
}
.wb-flashcard {
  margin-top: 16px;
  background: #fff;
  border-radius: var(--radius);
  border: 1.5px solid var(--line);
  padding: 22px 18px;
  text-align: center;
}
.wb-flip-divider {
  border-top: 1.5px dashed var(--line);
  margin: 16px 0;
}
.wb-grade-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.wb-grade-row .btn { flex: 1; }

/* ---------- Quiz ---------- */
.quiz-q { font-size: 17px; font-weight: 700; margin: 4px 0 16px; text-align: center; }
.quiz-opts { display: flex; flex-direction: column; gap: 10px; }
.quiz-opt {
  background: var(--paper-raised);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  font-family: var(--font-ar);
  direction: rtl;
}
.quiz-opt[aria-pressed="true"] { border-color: var(--teal); background: #EAF3F0; }
.quiz-opt.correct { border-color: var(--success); background: #E4F4EA; }
.quiz-opt.incorrect { border-color: var(--coral); background: #FBEAE4; }
.quiz-result { margin-top: 14px; text-align: center; font-weight: 800; }
.quiz-result.ok { color: var(--success); }
.quiz-result.no { color: var(--coral); }
.quiz-explain { margin-top: 8px; font-size: 13px; text-align: center; opacity: 0.75; }

/* ---------- Dialogue ---------- */
.dlg-transcript {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.dlg-turn {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--paper-raised);
  border: 1.5px solid var(--line);
}
.dlg-turn--them { align-self: flex-start; border-bottom-left-radius: 4px; }
.dlg-turn--you { align-self: flex-end; border-bottom-right-radius: 4px; background: #E1EEE7; border-color: var(--teal); }
.dlg-turn--current { box-shadow: 0 0 0 2px var(--teal); }
.dlg-turn__ar {
  font-family: var(--font-ar);
  direction: rtl;
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  line-height: 1.6;
}
.dlg-turn__en {
  font-family: var(--font-en);
  direction: ltr;
  font-size: 13px;
  opacity: 0.7;
  margin: 4px 0 0;
}
.dlg-choice { display: flex; flex-direction: column; gap: 10px; }
.dlg-role-toggle { text-align: center; margin-bottom: 16px; }
.dlg-role-toggle__label { display: block; font-size: 12px; font-weight: 700; opacity: 0.7; margin-bottom: 8px; }
.dlg-role-toggle__btns { display: flex; gap: 8px; justify-content: center; }
.dlg-role-toggle button {
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.dlg-role-toggle button[aria-pressed="true"] {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.dlg-prompt { text-align: center; font-size: 14px; opacity: 0.75; margin: 0 0 14px; }
.dlg-mic-btn {
  display: block;
  width: 76px; height: 76px;
  margin: 0 auto;
  border-radius: 50%;
  border: none;
  background: var(--teal);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(28,107,94,0.35);
}
.dlg-mic-btn:active { transform: scale(0.96); }
.dlg-mic-btn--listening { background: var(--coral); animation: dlg-pulse 1.1s ease-in-out infinite; }
@keyframes dlg-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(180,68,46,0.35); }
  50% { box-shadow: 0 0 0 14px rgba(180,68,46,0); }
}
.dlg-feedback {
  text-align: center;
  margin-top: 14px;
  font-weight: 700;
  font-size: 14px;
  opacity: 0.8;
}
.dlg-feedback.correct { color: var(--success); opacity: 1; }
.dlg-feedback.retry, .dlg-feedback.reveal { color: var(--coral); opacity: 1; }
.dlg-complete {
  text-align: center;
  padding: 30px 10px;
}
.dlg-complete__icon { color: var(--gold); margin-bottom: 10px; }
.dlg-complete__score { font-size: 16px; font-weight: 700; margin: 6px 0 24px; }

/* ---------- Unlock modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(22,48,42,0.5);
  display: flex; flex-direction: column;
  z-index: 100;
}
.modal-backdrop .spacer { flex: 1; }
.modal-sheet {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  background: var(--paper-raised);
  border-radius: 22px 22px 0 0;
  padding: 22px 20px 28px;
}
.modal-sheet h3 { margin: 0 0 4px; font-size: 18px; }
.modal-sheet p { margin: 0 0 16px; font-size: 13.5px; opacity: 0.75; }
.code-input {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  font-size: 16px;
  font-family: var(--font-en);
  direction: ltr;
  text-align: center;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}
.modal-msg { font-size: 13.5px; margin-bottom: 10px; min-height: 18px; }
.modal-msg.err { color: var(--coral); }
.modal-msg.ok { color: var(--success); }
.modal-close {
  display: block;
  margin: 14px auto 0;
  background: none; border: none;
  font-size: 13px; opacity: 0.6; cursor: pointer;
}

/* ---------- WhatsApp distributor CTA + drawer ---------- */
.whatsapp-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 16px;
  padding: 11px 14px;
  border: 1.5px solid var(--whatsapp);
  border-radius: var(--radius-sm);
  background: var(--whatsapp-soft);
  color: var(--whatsapp);
  font-size: 13px;
  cursor: pointer;
}
.whatsapp-cta strong { font-weight: 700; }
.whatsapp-cta .icon-wrap { flex-shrink: 0; }

.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(22,48,42,0.55);
  display: flex; flex-direction: column;
  z-index: 110;
}
.drawer-backdrop .spacer { flex: 1; }
.drawer-sheet {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  background: var(--paper-raised);
  border-radius: 22px 22px 0 0;
  padding: 22px 20px 28px;
}
.drawer-sheet h3 { margin: 0 0 4px; font-size: 18px; }
.drawer-sub { margin: 0 0 16px; font-size: 13.5px; opacity: 0.75; }
.distributor-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column;
  gap: 8px;
}
.distributor-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink);
}
.distributor-row__icon {
  flex-shrink: 0;
  color: var(--whatsapp);
}
.distributor-row__text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.distributor-row__name { font-size: 14.5px; font-weight: 600; }
.distributor-row__phone {
  font-size: 12.5px; opacity: 0.65;
  font-family: var(--font-en); direction: ltr; unicode-bidi: isolate;
}
.distributor-row__go { opacity: 0.4; flex-shrink: 0; }

/* ---------- Progress dashboard ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 4px 20px 8px;
}
.stat-card {
  background: var(--paper-raised);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(22,48,42,0.06);
}
.stat-card .val { font-size: 22px; font-weight: 800; color: var(--teal-deep); }
.stat-card .val .xp-label { font-size: 14px; font-weight: 700; opacity: 0.8; }
.stat-card .lbl { font-size: 12px; opacity: 0.7; margin-top: 2px; }

.badges-row { display: flex; gap: 10px; padding: 8px 20px 4px; flex-wrap: wrap; }
.stamp {
  width: 62px; height: 62px;
  border-radius: 50%;
  border: 2px dashed var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  background: var(--gold-soft);
  opacity: 1;
}
.stamp.locked { opacity: 0.3; border-style: solid; border-color: var(--line); background: transparent; filter: grayscale(1); }

/* ---------- Settings ---------- */
.settings-list { padding: 4px 20px; display: flex; flex-direction: column; gap: 10px; }
.settings-row {
  background: var(--paper-raised);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(22,48,42,0.06);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px;
}
.settings-row small { display: block; opacity: 0.6; font-size: 12px; margin-top: 2px; }

/* ---------- Header w/ back ---------- */
.subhead {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px 4px;
}
.backbtn {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px;
}
/* The chevron glyph is drawn pointing left ("<"), which is correct for
   "back" in an LTR (English) layout. In RTL (Arabic), "back" reads as
   pointing right, so flip it only when the page is RTL. */
html[dir="rtl"] .backbtn .icon-wrap svg { transform: scaleX(-1); }
.subhead h2 { font-size: 16px; margin: 0; }

/* Toast */
#toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 14px);
  left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 999px;
  font-size: 13px; z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
#toast.show { opacity: 1; }
