/* ============================================================
   Palette fondée sur la recherche en psychologie des couleurs :
   - Bleu : associé à une meilleure concentration / performance
     cognitive sur tâches soutenues.
   - Vert : réduit la fatigue visuelle, favorise le calme et la
     mémorisation, idéal pour de longues sessions.
   - Fond crème / blanc cassé (et non blanc pur) : réduit
     l'éblouissement et le contraste agressif -> meilleur confort.
   - Texte ardoise (et non noir pur) : contraste élevé mais doux.
   ============================================================ */
/* Accessibilité : contenu réservé aux lecteurs d'écran / SEO (H1 sémantique) */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:root {
  --bg: #f4f1ea;            /* crème doux */
  --surface: #fbfaf6;       /* carte */
  --surface-2: #f0ede4;
  --ink: #243137;           /* ardoise foncée (pas noir pur) */
  --ink-soft: #51616a;
  --muted: #7c8a90;
  --line: #e2ddd1;
  --teal: #2a7f8e;          /* bleu-sarcelle : focus */
  --teal-deep: #1f6470;
  --green: #4f9d7d;         /* vert apaisant : apprentissage */
  --green-soft: #e7f1ea;
  --amber: #c98a2b;
  --red: #c5544a;
  --shadow: 0 6px 22px rgba(36, 49, 55, 0.08);
  --shadow-sm: 0 2px 8px rgba(36, 49, 55, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --ar-font: "Noto Naskh Arabic", "Amiri", "Segoe UI", serif;
}

[data-theme="dark"] {
  --bg: #161d20;
  --surface: #1e272b;
  --surface-2: #232e33;
  --ink: #e9efee;
  --ink-soft: #b3c0c2;
  --muted: #859799;
  --line: #2c383d;
  --teal: #54b6c4;
  --teal-deep: #7fd0db;
  --green: #6dc09c;
  --green-soft: #1f3b32;
  --shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background .3s ease, color .3s ease;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand { display: flex; flex-direction: column; line-height: 1.1; }
.brand-ar {
  font-family: var(--ar-font);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--teal-deep);
}
.brand-fr { font-size: .82rem; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }

.header-tools { display: flex; align-items: center; gap: 10px; }
.voice-label { font-size: .78rem; color: var(--muted); }
.voice-select, .filter-select {
  font-family: inherit;
  font-size: .85rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  max-width: 220px;
  cursor: pointer;
}
.theme-toggle {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 50%;
  width: 38px; height: 38px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform .2s ease, background .2s;
}
.theme-toggle:hover { transform: scale(1.08); }

/* ---------- Tabs ----------
   Les onglets passent à la ligne au lieu de déborder horizontalement.
   Avec « overflow-x: auto » + scrollbar masquée, les derniers onglets
   devenaient invisibles et inatteignables dès qu'ils dépassaient la
   largeur du conteneur. Le retour à la ligne garantit qu'aucun onglet
   ne peut plus être caché, quelle que soit la largeur de l'écran. */
.tabs {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 2px;
  overflow: visible;
}
.tab {
  font-family: inherit;
  font-size: .84rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 11px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .2s, border-color .2s;
}
.tab:hover { color: var(--teal); }
.tab.active { color: var(--teal-deep); border-bottom-color: var(--teal); }

/* ---------- Layout ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }
.panel { animation: fade .35s ease; }
.panel[hidden] { display: none; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.panel-head { margin-bottom: 18px; }
.panel-head h2 { font-size: 1.5rem; font-weight: 700; color: var(--ink); }
.muted { color: var(--muted); font-size: .92rem; margin-top: 4px; }
.muted strong { color: var(--ink-soft); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.search {
  flex: 1 1 260px;
  font-family: inherit;
  font-size: .95rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
}
.search:focus, .voice-select:focus, .filter-select:focus, .quiz-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 22%, transparent);
}

/* ---------- Alphabet grid ---------- */
.alpha-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.alpha-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 14px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s;
  position: relative;
}
.alpha-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--teal); }
.alpha-letter {
  font-family: var(--ar-font);
  font-size: 3.1rem;
  line-height: 1;
  color: var(--teal-deep);
  margin-bottom: 8px;
}
.alpha-name { font-weight: 600; font-size: .98rem; }
.alpha-translit { color: var(--green); font-weight: 600; font-size: .88rem; }
.alpha-forms {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-family: var(--ar-font);
  font-size: 1.3rem;
  color: var(--ink-soft);
  display: flex;
  justify-content: space-around;
  direction: rtl;
}
.alpha-forms span { position: relative; }
.alpha-pronounce { font-size: .8rem; color: var(--muted); margin-top: 8px; }

/* ---------- Card lists (vocab + phrases) ---------- */
.card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.word-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.word-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--teal) 50%, var(--line)); }
.word-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.word-ar {
  font-family: var(--ar-font);
  font-size: 1.85rem;
  font-weight: 600;
  color: var(--teal-deep);
  direction: rtl;
  line-height: 1.4;
}
.word-card.phrase .word-ar { font-size: 1.5rem; }
.word-translit { color: var(--green); font-weight: 600; font-size: .95rem; font-style: italic; }
.word-fr { color: var(--ink); font-size: 1rem; }
.word-cat { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }

.audio-btn {
  flex: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--teal-deep);
  border-radius: 50%;
  width: 40px; height: 40px;
  font-size: 1.05rem;
  cursor: pointer;
  transition: background .2s, transform .15s, color .2s;
  display: inline-flex; align-items: center; justify-content: center;
}
.audio-btn:hover { background: var(--teal); color: #fff; transform: scale(1.06); }
.audio-btn.speaking { background: var(--green); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 50%, transparent); } 50% { box-shadow: 0 0 0 7px transparent; } }

/* ---------- Practice ---------- */
.practice-controls { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; }
.seg-btn {
  font-family: inherit; font-size: .85rem; font-weight: 600;
  color: var(--ink-soft); background: none; border: none;
  padding: 7px 13px; border-radius: 9px; cursor: pointer; transition: all .2s;
}
.seg-btn.active { background: var(--teal); color: #fff; box-shadow: var(--shadow-sm); }

.practice-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.stat-pill { font-size: .85rem; font-weight: 600; padding: 6px 12px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--line); }
.stat-pill.ok { color: var(--green); }
.stat-pill.bad { color: var(--red); }
.stat-pill.streak { color: var(--amber); }

.quiz-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 28px;
  text-align: center;
  max-width: 580px;
  margin: 0 auto;
}
.quiz-prompt-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 12px; }
.quiz-prompt { font-family: var(--ar-font); font-size: 3rem; font-weight: 700; color: var(--teal-deep); line-height: 1.4; }
.quiz-prompt.latin { font-family: "Inter", sans-serif; font-size: 2rem; direction: ltr; }
.quiz-sub { color: var(--muted); font-size: .95rem; margin-top: 6px; min-height: 1.2em; }
.quiz-audio { width: auto; border-radius: 22px; padding: 9px 18px; margin: 16px auto 4px; font-size: .9rem; font-weight: 600; gap: 6px; }
.quiz-input {
  width: 100%;
  font-family: inherit;
  font-size: 1.25rem;
  text-align: center;
  color: var(--ink);
  background: var(--surface-2);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin: 20px 0 6px;
}
.quiz-feedback { min-height: 2.4em; font-weight: 600; margin: 6px 0; }
.quiz-feedback.good { color: var(--green); }
.quiz-feedback.bad { color: var(--red); }
.quiz-feedback .answer { display: block; font-weight: 700; color: var(--ink); margin-top: 4px; }
.quiz-feedback .answer .ar { font-family: var(--ar-font); font-size: 1.3rem; }

.quiz-actions { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
.btn {
  font-family: inherit; font-size: .92rem; font-weight: 600;
  color: #fff; background: var(--teal);
  border: none; border-radius: 11px; padding: 11px 22px; cursor: pointer;
  transition: background .2s, transform .15s;
}
.btn:hover { background: var(--teal-deep); transform: translateY(-1px); }
.btn.ghost { background: none; color: var(--ink-soft); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }

kbd {
  font-family: ui-monospace, monospace; font-size: .8em;
  background: var(--surface-2); border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px;
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 22px 20px; }
.site-footer p { max-width: 1100px; margin: 0 auto; color: var(--muted); font-size: .82rem; text-align: center; }

.empty { text-align: center; color: var(--muted); padding: 40px; grid-column: 1 / -1; }

/* ---------- Slider vitesse audio ---------- */
.rate-range { width: 90px; accent-color: var(--teal); cursor: pointer; }

/* ---------- Cours (accordéon) ---------- */
.course-actions { display: flex; gap: 10px; margin-bottom: 16px; }
.course-list { display: flex; flex-direction: column; gap: 10px; }
.course-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.course-item.open { border-color: var(--teal); }
.course-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  padding: 16px 18px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.course-head:hover { background: var(--surface-2); }
.course-emoji { font-size: 1.4rem; flex: none; }
.course-title { flex: 1; }
.course-chevron { color: var(--teal); transition: transform .25s ease; flex: none; }
.course-item.open .course-chevron { transform: rotate(180deg); }
.course-body { padding: 4px 22px 22px; color: var(--ink-soft); line-height: 1.7; animation: fade .3s ease; }
.course-body p { margin: 10px 0; }
.course-body ul, .course-body ol { margin: 10px 0; padding-inline-start: 22px; }
.course-body li { margin: 6px 0; }
.course-body .key {
  background: var(--green-soft);
  border-inline-start: 4px solid var(--green);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 14px 0;
}
.ex-ar {
  font-family: var(--ar-font);
  font-size: 1.5rem;
  color: var(--teal-deep);
  font-weight: 600;
  vertical-align: middle;
}
.mini-audio {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--teal-deep);
  border-radius: 50%;
  width: 26px; height: 26px;
  font-size: .8rem;
  cursor: pointer;
  vertical-align: middle;
  padding: 0;
  transition: background .2s, transform .15s, color .2s;
}
.mini-audio:hover { background: var(--teal); color: #fff; transform: scale(1.1); }

/* En-tête de module */
.course-module {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 28px 0 8px;
  padding: 16px 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--teal) 16%, var(--surface)), var(--surface));
  border: 1px solid var(--line);
  border-inline-start: 5px solid var(--teal);
  border-radius: var(--radius);
}
.course-module:first-child { margin-top: 0; }
.course-module-emoji { font-size: 1.9rem; flex: none; line-height: 1.2; }
.course-module-title { font-size: 1.18rem; font-weight: 700; color: var(--teal-deep); }
.course-module-intro { color: var(--ink-soft); font-size: .92rem; margin-top: 4px; line-height: 1.55; }

/* Encadrés conseil / exercice */
.course-body .tip,
.course-body .exo {
  border-radius: 10px;
  padding: 11px 15px;
  margin: 14px 0;
  font-size: .92rem;
}
.course-body .tip { background: color-mix(in srgb, var(--amber) 14%, var(--surface)); border-inline-start: 4px solid var(--amber); }
.course-body .exo { background: color-mix(in srgb, var(--teal) 12%, var(--surface)); border-inline-start: 4px solid var(--teal); }

/* Tableaux de conjugaison / vocabulaire */
.course-body table.ctab {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: .95rem;
  background: var(--surface);
  border-radius: 10px;
  overflow: hidden;
}
.course-body .ctab th,
.course-body .ctab td {
  text-align: start;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}
.course-body .ctab thead th {
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 700;
  font-size: .85rem;
}
.course-body .ctab tbody tr:last-child td { border-bottom: none; }
.course-body .ctab tbody tr:hover { background: var(--surface-2); }
.course-body .ctab td[lang="ar"],
.course-body .ctab td span[lang="ar"] { font-family: var(--ar-font); font-size: 1.35rem; color: var(--teal-deep); font-weight: 600; }

/* ---------- Cours : progression & exercices ---------- */
.level-badge {
  display: inline-block;
  margin-inline-start: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  vertical-align: middle;
}
.course-module-main { flex: 1; min-width: 0; }
.module-progress { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.module-bar {
  flex: 1;
  height: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.module-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--teal), var(--green));
  border-radius: 999px;
  transition: width .4s ease;
}
.module-count { font-size: .8rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.course-module.module-complete { border-inline-start-color: var(--green); }
.course-check { flex: none; font-size: 1rem; min-width: 22px; text-align: center; }
.course-item.done { border-inline-start: 4px solid var(--green); }

.lesson-objectives {
  background: color-mix(in srgb, var(--teal) 10%, var(--surface));
  border: 1px dashed var(--teal);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 12px 0 16px;
  font-size: .93rem;
}
.lesson-objectives ul { margin: 6px 0 0; padding-inline-start: 20px; }
.lesson-objectives li { margin: 3px 0; }

.lesson-exercises {
  margin-top: 22px;
  border-top: 2px dashed var(--line);
  padding-top: 16px;
}
.lesson-ex-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 12px; color: var(--ink); }
.lesson-ex-score {
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  margin-inline-start: 8px;
  vertical-align: middle;
}
.lesson-exercises.all-solved .lesson-ex-score { background: var(--green-soft); color: var(--green); border-color: var(--green); }

.exq-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 12px 0;
}
.exq-card.solved { border-color: var(--green); background: color-mix(in srgb, var(--green) 6%, var(--surface)); }
.exq-q { font-weight: 600; margin-bottom: 10px; line-height: 1.6; }
.exq-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: var(--teal); color: #fff;
  border-radius: 50%; font-size: .78rem; font-weight: 700;
  margin-inline-end: 4px;
}
.exq-kind { font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.exq-q [lang="ar"] { font-family: var(--ar-font); font-size: 1.4rem; color: var(--teal-deep); }

.exq-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.exq-choice {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 10px;
  padding: 9px 14px;
  font-family: inherit;
  font-size: .95rem;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
}
.exq-choice [lang="ar"], .exq-choice[lang="ar"] { font-family: var(--ar-font); font-size: 1.25rem; }
.exq-choice:hover:not(:disabled) { border-color: var(--teal); transform: translateY(-1px); }
.exq-choice.correct { border-color: var(--green); background: var(--green-soft); color: var(--green); font-weight: 700; }
.exq-choice.wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 12%, var(--surface)); color: var(--red); }
.exq-choice:disabled { cursor: default; opacity: .85; }

.exq-writeform { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.exq-input {
  flex: 1;
  min-width: 180px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 10px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: .95rem;
}
.exq-input:focus { outline: 2px solid var(--teal); border-color: var(--teal); }

.exq-feedback { margin-top: 10px; font-size: .92rem; line-height: 1.6; }
.exq-feedback.good { color: var(--green); font-weight: 600; }
.exq-feedback.bad { color: var(--red); font-weight: 600; }
.exq-explain {
  display: block;
  margin-top: 6px;
  font-weight: 400;
  color: var(--ink-soft);
  background: var(--surface);
  border-inline-start: 3px solid var(--teal);
  border-radius: 8px;
  padding: 8px 12px;
}

.exq-match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.exq-match-col { display: flex; flex-direction: column; gap: 8px; }
.exq-match-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 10px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: .95rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.exq-match-btn.ar { font-family: var(--ar-font); font-size: 1.3rem; color: var(--teal-deep); }
.exq-match-btn.selected { border-color: var(--teal); background: color-mix(in srgb, var(--teal) 12%, var(--surface)); }
.exq-match-btn.matched { border-color: var(--green); background: var(--green-soft); opacity: .7; cursor: default; }
.exq-match-btn.wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 12%, var(--surface)); }

.exq-order-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.exq-chip {
  border: 1px solid var(--teal);
  background: var(--surface);
  color: var(--teal-deep);
  border-radius: 999px;
  padding: 7px 14px;
  font-family: var(--ar-font);
  font-size: 1.2rem;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.exq-chip:hover:not(:disabled) { background: color-mix(in srgb, var(--teal) 12%, var(--surface)); transform: translateY(-1px); }
.exq-chip:disabled { opacity: .3; cursor: default; }
.exq-order-line {
  min-height: 44px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  background: var(--surface);
}
.exq-placed { font-family: var(--ar-font); font-size: 1.3rem; color: var(--teal-deep); font-weight: 600; }
.exq-order-actions { margin-top: 8px; }

.lesson-done-btn { margin-top: 14px; width: 100%; }
.lesson-done-btn.is-done { background: var(--green); border-color: var(--green); }

@media (max-width: 560px) {
  .exq-match { grid-template-columns: 1fr; }
}

/* ---------- Islam ---------- */
.islam-nav { margin-bottom: 16px; flex-wrap: wrap; }
.names-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.name-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 14px 14px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s;
}
.name-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--teal); }
.name-num {
  position: absolute; top: 8px; inset-inline-start: 10px;
  font-size: .72rem; font-weight: 700; color: #fff;
  background: var(--teal); border-radius: 20px; padding: 1px 8px;
}
.name-ar { font-family: var(--ar-font); font-size: 2rem; font-weight: 700; color: var(--teal-deep); margin: 10px 0 4px; }
.name-tr { color: var(--green); font-weight: 600; font-size: .95rem; }
.name-fr { color: var(--ink-soft); font-size: .86rem; margin-top: 2px; }
.name-audio { width: 34px; height: 34px; margin-top: 10px; font-size: .9rem; }

.islam-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s;
}
.islam-card:hover { border-color: color-mix(in srgb, var(--teal) 45%, var(--line)); box-shadow: var(--shadow); }
.islam-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.islam-ar { font-family: var(--ar-font); font-size: 1.7rem; font-weight: 600; color: var(--teal-deep); line-height: 1.9; }
.islam-card.hadith .islam-ar, .islam-card.dua .islam-ar { font-size: 1.5rem; }
.islam-tr { color: var(--green); font-weight: 600; font-style: italic; margin-top: 6px; }
.islam-fr { color: var(--ink); margin-top: 6px; }
.islam-src { color: var(--muted); font-size: .8rem; margin-top: 8px; font-weight: 600; }

.islam-card.surah { padding: 20px 22px; }
.surah-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.surah-name-ar { font-family: var(--ar-font); font-size: 1.7rem; font-weight: 700; color: var(--teal-deep); margin-inline-end: 10px; }
.surah-name-fr { color: var(--ink-soft); font-size: .9rem; }
.surah-play { font-size: .85rem; padding: 9px 16px; }
.surah-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.surah-text[hidden] { display: none; }
.surah-text .loading { font-family: "Inter", sans-serif; color: var(--muted); font-size: .95rem; font-weight: 600; }
.surah-about { color: var(--muted); font-size: .88rem; margin-bottom: 14px; }
.surah-text {
  font-family: var(--ar-font);
  font-size: 1.85rem;
  line-height: 2.4;
  color: var(--ink);
  background: var(--green-soft);
  border-radius: 12px;
  padding: 16px 20px;
  text-align: justify;
}
.ayah { white-space: normal; }
.ayah-num {
  display: inline-block;
  font-family: "Inter", sans-serif;
  font-size: .7rem;
  font-weight: 700;
  color: var(--teal-deep);
  background: color-mix(in srgb, var(--teal) 20%, transparent);
  border-radius: 50%;
  width: 22px; height: 22px; line-height: 22px;
  text-align: center;
  margin: 0 4px;
  vertical-align: middle;
}
mark { background: color-mix(in srgb, var(--amber) 35%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }

@media (max-width: 560px) {
  .brand-ar { font-size: 1.4rem; }
  .quiz-prompt { font-size: 2.3rem; }
  .header-tools .voice-label { display: none; }
  .rate-range { width: 64px; }
  .surah-text { font-size: 1.55rem; line-height: 2.1; }
}

/* ============================================================
   AVERTISSEMENT SANS JAVASCRIPT
   ============================================================ */
.noscript-warn {
  background: color-mix(in srgb, var(--amber) 14%, var(--surface));
  border: 1px solid var(--amber);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 20px;
  color: var(--ink);
  font-size: .95rem;
}

/* ============================================================
   RAILS PUBLICITAIRES LATÉRAUX (AdSense)
   Masqués tant que la fenêtre n'est pas assez large pour les
   accueillir sans comprimer le contenu (conteneur = 1100 px).
   ============================================================ */
.ad-rail {
  display: none;
  position: fixed;
  top: 140px;
  width: 160px;
  min-height: 600px;
  z-index: 5;
}
.ad-rail-left  { left: max(12px, calc(50vw - 550px - 176px)); }
.ad-rail-right { right: max(12px, calc(50vw - 550px - 176px)); }

@media (min-width: 1500px) {
  .ad-rail:not(:empty) { display: block; }
}

/* ============================================================
   HEURES DE PRIÈRE
   ============================================================ */
.prayer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 18px;
}
.prayer-field { display: flex; flex-direction: column; gap: 6px; min-width: 200px; }
.prayer-field.wide { flex: 1 1 380px; }
.prayer-field-btn { justify-content: flex-end; }
.prayer-field label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: .01em;
}
.prayer-select {
  max-width: none;
  width: 100%;
  padding: 10px 12px;
  font-size: .95rem;
}
.prayer-hint { font-size: .78rem; color: var(--muted); }

.prayer-advanced {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 20px;
}
.prayer-advanced summary {
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.prayer-advanced summary:hover { color: var(--teal); }
.prayer-advanced .prayer-controls { margin: 14px 0 4px; }

.prayer-status {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  margin-bottom: 18px;
  background: var(--surface-2);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.prayer-status.error {
  background: color-mix(in srgb, var(--red) 12%, var(--surface));
  border-color: var(--red);
  color: var(--ink);
}

.prayer-place-head { margin-bottom: 14px; }
.prayer-place { font-size: 1.35rem; font-weight: 700; color: var(--ink); }
.prayer-date { font-size: .92rem; color: var(--muted); margin-top: 2px; }

.prayer-next {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 18px;
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-deep) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.prayer-next-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  opacity: .85;
  width: 100%;
}
.prayer-next-name { font-size: 1.5rem; font-weight: 700; }
.prayer-next-time { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.prayer-next-in { font-size: .95rem; opacity: .95; margin-left: auto; }
.prayer-next-in strong { font-variant-numeric: tabular-nums; }

.prayer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.prayer-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 14px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, border-color .18s ease;
}
.prayer-card:hover { transform: translateY(-2px); }
.prayer-card.secondary { opacity: .78; }
.prayer-card.is-current { border-color: var(--green); background: var(--green-soft); }
.prayer-card.is-next {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--teal) 30%, transparent), var(--shadow-sm);
}
.prayer-emoji { font-size: 1.7rem; display: block; line-height: 1; }
.prayer-names { display: flex; flex-direction: column; gap: 1px; margin: 8px 0 6px; }
.prayer-name-fr { font-weight: 600; color: var(--ink); font-size: .98rem; }
.prayer-name-ar { font-family: var(--ar-font); font-size: 1.15rem; color: var(--ink-soft); }
.prayer-time {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--teal-deep);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.prayer-card.is-current .prayer-time { color: var(--green); }
.prayer-note { font-size: .74rem; color: var(--muted); margin-top: 3px; }

.prayer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 40px;
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 30px;
}
.prayer-extra { list-style: none; font-size: .9rem; color: var(--ink-soft); }
.prayer-extra li { margin-bottom: 5px; }
.prayer-extra strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.prayer-source { font-size: .86rem; color: var(--ink-soft); line-height: 1.7; }
.prayer-source .muted { font-size: .82rem; }

.prayer-seo { max-width: 780px; line-height: 1.75; color: var(--ink-soft); }
.prayer-seo h3 { font-size: 1.15rem; color: var(--ink); margin-bottom: 10px; }
.prayer-seo p { margin-bottom: 12px; font-size: .95rem; }
.prayer-seo ul { margin: 0 0 14px 20px; font-size: .95rem; }
.prayer-seo li { margin-bottom: 6px; }
.prayer-seo strong { color: var(--ink); }

/* ============================================================
   DONS
   ============================================================ */
.donate-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  align-items: start;
}
.donate-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.donate-card h3 { font-size: 1.2rem; color: var(--ink); margin-bottom: 12px; }
.donate-card p { color: var(--ink-soft); line-height: 1.7; margin-bottom: 12px; font-size: .95rem; }
.donate-list { list-style: none; margin: 0 0 14px; }
.donate-list li {
  color: var(--ink-soft);
  font-size: .95rem;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}
.donate-list li:last-child { border-bottom: none; }
.donate-thanks {
  background: var(--green-soft);
  border-left: 3px solid var(--green);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--ink) !important;
  margin-bottom: 0 !important;
}
.donate-thanks [lang="ar"] { font-family: var(--ar-font); font-size: 1.2rem; }

.donate-action h3, .donate-action p { text-align: left; }
.paypal-form { margin: 20px 0 12px; text-align: center; }
.paypal-form input[type="image"] {
  cursor: pointer;
  max-width: 100%;
  height: auto;
  transition: transform .18s ease, filter .18s ease;
}
.paypal-form input[type="image"]:hover { transform: translateY(-2px); filter: brightness(1.04); }
.paypal-form input[type="image"]:focus-visible { outline: 3px solid var(--teal); outline-offset: 4px; }
.donate-alt { font-size: .88rem; text-align: center; }
.donate-alt a { color: var(--teal); font-weight: 600; text-decoration: none; }
.donate-alt a:hover { text-decoration: underline; }
.donate-note { font-size: .82rem !important; text-align: center; margin-top: 14px; }

.footer-links { margin-top: 10px; font-size: .88rem; }
.footer-links a { color: var(--teal); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* ============================================================
   PAGES LÉGALES
   ============================================================ */
.legal { max-width: 780px; margin: 0 auto; color: var(--ink-soft); line-height: 1.8; }
.legal h1 { font-size: 1.8rem; color: var(--ink); margin-bottom: 6px; }
.legal h2 { font-size: 1.15rem; color: var(--ink); margin: 30px 0 10px; }
.legal p { margin-bottom: 14px; font-size: .96rem; }
.legal ul { margin: 0 0 16px 22px; font-size: .96rem; }
.legal li { margin-bottom: 7px; }
.legal a { color: var(--teal); }
.legal code {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: .88em;
}
.legal-date { font-size: .85rem; color: var(--muted); margin-bottom: 24px !important; }
.legal-todo {
  background: color-mix(in srgb, var(--amber) 22%, transparent);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--ink);
  font-weight: 600;
}
.legal-back { margin-top: 36px; }

@media (max-width: 700px) {
  .prayer-field { min-width: 100%; }
  .prayer-next-in { margin-left: 0; width: 100%; }
  .prayer-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
  .prayer-time { font-size: 1.5rem; }
}
