/* ============================================================
   Madrasa — l'arabe du Livre · Feuille de style principale
   6 palettes × 2 modes, pilotées par variables CSS.
   ============================================================ */

/* ---------- 1. Jetons de thème ---------- */
:root {
  --police-titres: "Cormorant Garamond", Georgia, serif;
  --police-texte: "Outfit", system-ui, sans-serif;
  --police-ar: "Amiri", "Scheherazade New", "Noto Naskh Arabic", serif;
  --rayon: 16px;
  --rayon-petit: 10px;
  --transition: 0.25s cubic-bezier(.4,0,.2,1);
  --ombre: 0 2px 8px rgba(0,0,0,.06), 0 12px 32px rgba(0,0,0,.08);
  --ombre-forte: 0 4px 16px rgba(0,0,0,.12), 0 24px 48px rgba(0,0,0,.14);
}

/* Palette Émeraude & or (défaut) */
[data-theme="emeraude"] {
  --accent: #0f6a4b; --accent-2: #c9a227; --accent-doux: #e3f0ea;
  --fond: #faf7f0; --surface: #ffffff; --surface-2: #f3efe5;
  --texte: #24312b; --texte-doux: #5d6b64; --bordure: #e4ddcd;
  --ok: #1e7e4d; --ok-fond: #e5f4ec; --erreur: #b3413a; --erreur-fond: #fae9e7;
  --info-fond: #eef4f8; --motif-opacite: .05;
}
[data-theme="emeraude"][data-mode="sombre"] {
  --accent: #4dbd93; --accent-2: #d9b64a; --accent-doux: #14312a;
  --fond: #0f1613; --surface: #17211c; --surface-2: #1e2b25;
  --texte: #e6ede9; --texte-doux: #9fb0a8; --bordure: #2a3a32;
  --ok: #4dbd93; --ok-fond: #14312a; --erreur: #e08a84; --erreur-fond: #3a1f1d;
  --info-fond: #16232c; --motif-opacite: .04;
}
/* Palette Bleu nuit & cuivre */
[data-theme="nuit"] {
  --accent: #1d3a6e; --accent-2: #c07a3e; --accent-doux: #e6ecf5;
  --fond: #f5f6f8; --surface: #ffffff; --surface-2: #edf0f4;
  --texte: #1d2735; --texte-doux: #5a6577; --bordure: #dde2ea;
  --ok: #21754f; --ok-fond: #e4f2ea; --erreur: #ae4038; --erreur-fond: #f9e9e7;
  --info-fond: #edf1f7; --motif-opacite: .05;
}
[data-theme="nuit"][data-mode="sombre"] {
  --accent: #7ea1d8; --accent-2: #d99a5e; --accent-doux: #1a2740;
  --fond: #0b111d; --surface: #131c2c; --surface-2: #1a2537;
  --texte: #e3e9f2; --texte-doux: #98a6bc; --bordure: #253349;
  --ok: #55b98b; --ok-fond: #14302a; --erreur: #e08a84; --erreur-fond: #3a1f1d;
  --info-fond: #16202f; --motif-opacite: .05;
}
/* Palette Clair & minimal */
[data-theme="minimal"] {
  --accent: #2f2f2f; --accent-2: #8a7550; --accent-doux: #efece6;
  --fond: #fcfbf8; --surface: #ffffff; --surface-2: #f4f2ee;
  --texte: #262626; --texte-doux: #6d6d6d; --bordure: #e6e3dd;
  --ok: #2c7a52; --ok-fond: #e8f3ed; --erreur: #a84842; --erreur-fond: #f8ebea;
  --info-fond: #f0efec; --motif-opacite: .03;
}
[data-theme="minimal"][data-mode="sombre"] {
  --accent: #d8d3c8; --accent-2: #bfa877; --accent-doux: #2a2a28;
  --fond: #141413; --surface: #1d1d1b; --surface-2: #262624;
  --texte: #ececea; --texte-doux: #a5a5a0; --bordure: #333331;
  --ok: #6fbf97; --ok-fond: #1c312a; --erreur: #dd928d; --erreur-fond: #382220;
  --info-fond: #232322; --motif-opacite: .03;
}
/* Palette Rose poudré */
[data-theme="rose"] {
  --accent: #b34d6d; --accent-2: #caa64f; --accent-doux: #f9e9ee;
  --fond: #fdf7f7; --surface: #ffffff; --surface-2: #f8eef0;
  --texte: #392b30; --texte-doux: #7a636b; --bordure: #eedadf;
  --ok: #2c7a52; --ok-fond: #e8f3ed; --erreur: #ad3f39; --erreur-fond: #f9e9e7;
  --info-fond: #f6eef4; --motif-opacite: .05;
}
[data-theme="rose"][data-mode="sombre"] {
  --accent: #e08aa5; --accent-2: #d9bc6a; --accent-doux: #3a2029;
  --fond: #171012; --surface: #211719; --surface-2: #2b1d21;
  --texte: #f0e5e8; --texte-doux: #b899a3; --bordure: #3d282e;
  --ok: #55b98b; --ok-fond: #14302a; --erreur: #e08a84; --erreur-fond: #3a1f1d;
  --info-fond: #241a20; --motif-opacite: .05;
}
/* Palette Pourpre */
[data-theme="pourpre"] {
  --accent: #6d3a6d; --accent-2: #b08c3f; --accent-doux: #f2e7f2;
  --fond: #faf6fa; --surface: #ffffff; --surface-2: #f3ecf3;
  --texte: #322636; --texte-doux: #6e5e73; --bordure: #e6d9e6;
  --ok: #2c7a52; --ok-fond: #e8f3ed; --erreur: #ad3f39; --erreur-fond: #f9e9e7;
  --info-fond: #efeaf4; --motif-opacite: .05;
}
[data-theme="pourpre"][data-mode="sombre"] {
  --accent: #c48fc4; --accent-2: #d3b264; --accent-doux: #332033;
  --fond: #140f16; --surface: #1e1721 ; --surface-2: #291e2c;
  --texte: #ece4ee; --texte-doux: #ab97b1; --bordure: #392b3d;
  --ok: #55b98b; --ok-fond: #14302a; --erreur: #e08a84; --erreur-fond: #3a1f1d;
  --info-fond: #211a26; --motif-opacite: .05;
}
/* Palette Lavande */
[data-theme="lavande"] {
  --accent: #5f549e; --accent-2: #b89b4a; --accent-doux: #ecebf7;
  --fond: #f9f8fc; --surface: #ffffff; --surface-2: #f1effa;
  --texte: #2b2836; --texte-doux: #676178; --bordure: #e1def0;
  --ok: #2c7a52; --ok-fond: #e8f3ed; --erreur: #ad3f39; --erreur-fond: #f9e9e7;
  --info-fond: #eeedf8; --motif-opacite: .05;
}
[data-theme="lavande"][data-mode="sombre"] {
  --accent: #a89ce0; --accent-2: #d4ba69; --accent-doux: #272144;
  --fond: #100e18; --surface: #191623; --surface-2: #221e30;
  --texte: #e9e7f1; --texte-doux: #a29bb8; --bordure: #302a44;
  --ok: #55b98b; --ok-fond: #14302a; --erreur: #e08a84; --erreur-fond: #3a1f1d;
  --info-fond: #1c1928; --motif-opacite: .05;
}

/* Police arabe indo-pakistanaise : fichier fourni via DDEDITOR dans assets/fonts/ */
@font-face {
  font-family: "IndoPak";
  src: url("../fonts/indopak.woff2") format("woff2"), url("../fonts/indopak.ttf") format("truetype");
  font-display: swap;
}
[data-police="indopak"] { --police-ar: "IndoPak", "Noto Naskh Arabic", "Scheherazade New", serif; }

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--police-texte); font-size: 17px; line-height: 1.65;
  color: var(--texte); background: var(--fond);
  transition: background-color var(--transition), color var(--transition);
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; width: 100%; padding-top: 2rem; padding-bottom: 4rem; }
h1, h2, h3 { font-family: var(--police-titres); line-height: 1.2; color: var(--texte); }
h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); font-weight: 700; margin: .4em 0; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 600; }
h3 { font-size: 1.25rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: .6em 0; }
img { max-width: 100%; }
.petit { font-size: .85rem; color: var(--texte-doux); }
.conteneur { width: min(1180px, 100% - 2.5rem); margin-inline: auto; display: block; }

/* Texte arabe */
.ar, [lang="ar"] {
  font-family: var(--police-ar); direction: rtl; unicode-bidi: isolate;
  font-size: 1.35em; line-height: 1.9;
}
.ar-grand { font-size: 2rem; line-height: 2.2; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 1rem; top: 1rem; background: var(--surface); padding: .5rem 1rem; z-index: 100; }

/* Motif géométrique de fond */
.motif-fond {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: var(--motif-opacite);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23808080' stroke-width='1'%3E%3Cpath d='M48 8 L88 48 L48 88 L8 48 Z'/%3E%3Ccircle cx='48' cy='48' r='20'/%3E%3Cpath d='M48 28 L62 48 L48 68 L34 48 Z'/%3E%3C/g%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 1; }

/* ---------- 3. En-tête ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bordure);
}
.header-inner { display: flex; align-items: center; gap: 1.2rem; padding: .55rem 0; }
.logo { display: flex; align-items: center; gap: .6rem; text-decoration: none !important; }
.logo-calli { font-size: 1.9rem; color: var(--accent); line-height: 1; }
.logo-texte { font-family: var(--police-titres); font-weight: 700; font-size: 1.25rem; color: var(--texte); display: flex; flex-direction: column; line-height: 1.05; }
.logo-texte small { font-family: var(--police-texte); font-weight: 400; font-size: .68rem; color: var(--texte-doux); letter-spacing: .06em; }
.nav-principale { display: flex; gap: .2rem; flex: 1; flex-wrap: wrap; }
.nav-principale a {
  padding: .45rem .8rem; border-radius: 999px; color: var(--texte-doux);
  font-weight: 500; font-size: .95rem; text-decoration: none !important;
  transition: background var(--transition), color var(--transition);
  position: relative;
}
.nav-principale a:hover { background: var(--accent-doux); color: var(--accent); }
.nav-principale a.actif { background: var(--accent); color: var(--surface); }
.nav-admin { border: 1px dashed var(--accent-2); }
.pastille {
  position: absolute; top: -2px; right: -2px; background: var(--erreur); color: #fff;
  font-size: .65rem; border-radius: 999px; padding: 0 .35em; min-width: 1.2em; text-align: center;
}
.header-actions { display: flex; align-items: center; gap: .55rem; }
.pseudo-header { font-weight: 600; color: var(--accent); font-size: .92rem; }
.btn-icone {
  background: none; border: 1px solid var(--bordure); border-radius: 999px;
  width: 2.4rem; height: 2.4rem; cursor: pointer; font-size: 1.05rem;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform var(--transition), background var(--transition);
  color: var(--texte);
}
.btn-icone:hover { transform: scale(1.08); background: var(--accent-doux); }
.nav-burger { display: none; }

/* Panneau thèmes */
.panneau-themes {
  position: absolute; right: max(1rem, calc((100% - 1180px) / 2)); top: calc(100% + .5rem);
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon);
  box-shadow: var(--ombre-forte); padding: 1.1rem 1.3rem; width: min(340px, 92vw);
  animation: apparait .25s ease;
}
.panneau-themes h3 { margin: .6rem 0 .4rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; font-family: var(--police-texte); color: var(--texte-doux); }
.choix-themes, .choix-mode, .choix-police { display: flex; flex-wrap: wrap; gap: .45rem; }
.panneau-themes button {
  display: inline-flex; align-items: center; gap: .5rem; cursor: pointer;
  border: 1px solid var(--bordure); background: var(--surface-2); color: var(--texte);
  border-radius: 999px; padding: .35rem .8rem; font-size: .85rem; font-family: inherit;
  transition: border-color var(--transition), transform var(--transition);
}
.panneau-themes button:hover { transform: translateY(-1px); border-color: var(--accent); }
.panneau-themes button.choisi { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.choix-themes span { width: 1.1rem; height: 1.1rem; border-radius: 50%; display: inline-block; }
.note-police { font-size: .78rem; color: var(--texte-doux); margin: .6rem 0 0; }

/* ---------- 4. Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border-radius: 999px; padding: .6rem 1.4rem; font-weight: 600; font-size: .95rem;
  cursor: pointer; border: 1px solid transparent; font-family: inherit;
  text-decoration: none !important; transition: all var(--transition);
}
.btn-principal { background: var(--accent); color: var(--surface); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-principal:hover { transform: translateY(-2px); box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 45%, transparent); }
.btn-secondaire { background: var(--accent-doux); color: var(--accent); }
.btn-secondaire:hover { background: color-mix(in srgb, var(--accent-doux) 70%, var(--accent) 12%); }
.btn-discret { border-color: var(--bordure); color: var(--texte); background: transparent; }
.btn-discret:hover { border-color: var(--accent); color: var(--accent); }
.btn-or { background: var(--accent-2); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.btn-grand { padding: .85rem 2rem; font-size: 1.05rem; }

/* ---------- 5. Cartes & sections ---------- */
.carte {
  background: var(--surface); border: 1px solid var(--bordure);
  border-radius: var(--rayon); padding: 1.5rem; box-shadow: var(--ombre);
  transition: transform var(--transition), box-shadow var(--transition);
}
.carte-lien:hover { transform: translateY(-4px); box-shadow: var(--ombre-forte); text-decoration: none; }
.grille { display: flex; flex-wrap: wrap; gap: 1.2rem; }
.grille > * { flex: 1 1 280px; }
.section { margin: 3rem 0; }
.entete-section { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }

/* Étiquettes de palier */
.palier {
  display: inline-flex; align-items: center; gap: .4em; font-size: .74rem;
  font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: .2em .8em; border-radius: 999px; color: #fff;
}

/* ---------- 6. Page d'accueil ---------- */
.hero { display: flex; align-items: center; gap: 3rem; padding: 3.5rem 0 2.5rem; flex-wrap: wrap; }
.hero-texte { flex: 1 1 460px; }
.hero-texte .surtitre { color: var(--accent-2); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: .8rem; }
.hero-visuel { flex: 1 1 340px; display: flex; justify-content: center; }
.hero-calligraphie {
  font-family: var(--police-ar); font-size: clamp(4rem, 9vw, 7.5rem); color: var(--accent);
  direction: rtl; line-height: 1.6; text-align: center;
  animation: flotte 7s ease-in-out infinite;
}
.hero-calligraphie small { display: block; font-family: var(--police-texte); font-size: 1rem; color: var(--texte-doux); }
.hero-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.4rem; }
.points-forts { display: flex; flex-wrap: wrap; gap: 1.2rem; }
.points-forts .carte { flex: 1 1 240px; }
.points-forts .icone { font-size: 1.8rem; }
.bande-versets {
  text-align: center; padding: 2.5rem 1rem; margin: 3rem 0;
  background: var(--accent-doux); border-radius: var(--rayon);
}

/* ---------- 7. Tableau de bord ---------- */
.stats-bandeau { display: flex; flex-wrap: wrap; gap: 1.2rem; margin: 1.5rem 0; }
.stat { flex: 1 1 180px; background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon); padding: 1.1rem 1.3rem; box-shadow: var(--ombre); }
.stat .valeur { font-size: 2rem; font-weight: 700; font-family: var(--police-titres); color: var(--accent); }
.stat .libelle { font-size: .82rem; color: var(--texte-doux); text-transform: uppercase; letter-spacing: .07em; }
.barre-progression { background: var(--surface-2); border-radius: 999px; height: 12px; overflow: hidden; }
.barre-progression > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.flamme { font-size: 1.3rem; }

/* ---------- 8. Liste des leçons ---------- */
.groupe-tome { margin: 2.2rem 0; }
.liste-lecons { display: flex; flex-direction: column; gap: .8rem; }
.carte-lecon {
  display: flex; align-items: center; gap: 1.2rem; padding: 1rem 1.4rem;
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon);
  text-decoration: none !important; color: var(--texte);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.carte-lecon:hover { transform: translateX(6px); border-color: var(--accent); box-shadow: var(--ombre); }
.carte-lecon .numero {
  flex: 0 0 auto; width: 3rem; height: 3rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-doux); color: var(--accent); font-weight: 700; font-size: 1.1rem;
}
.carte-lecon.terminee .numero { background: var(--ok); color: #fff; }
.carte-lecon .infos { flex: 1; min-width: 0; }
.carte-lecon .titre-ar { font-family: var(--police-ar); font-size: 1.5rem; color: var(--accent); direction: rtl; }
.carte-lecon .meta { font-size: .8rem; color: var(--texte-doux); display: flex; gap: 1em; flex-wrap: wrap; }
.carte-lecon .progres { flex: 0 0 120px; }
.carte-lecon .pct { font-size: .78rem; color: var(--texte-doux); text-align: right; }

/* ---------- 9. Page de cours ---------- */
.fil-ariane { font-size: .85rem; color: var(--texte-doux); margin-bottom: 1rem; }
.entete-lecon { text-align: center; margin-bottom: 2.2rem; }
.entete-lecon .titre-ar { font-family: var(--police-ar); font-size: 3.4rem; color: var(--accent); direction: rtl; line-height: 1.6; }
.objectifs { text-align: start; max-width: 640px; margin: 1.2rem auto; background: var(--accent-doux); border-radius: var(--rayon); padding: 1.2rem 1.6rem; }
.objectifs h3 { margin-top: 0; }
.objectifs li { margin: .3em 0; }

.bloc-cours { max-width: 780px; margin: 1.6rem auto; animation: apparait .5s ease both; }
.bloc-regle, .bloc-intro, .bloc-recap {
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon);
  padding: 1.6rem 2rem; box-shadow: var(--ombre);
}
.bloc-regle h3 { color: var(--accent); margin-top: 0; }
.exemples { display: flex; flex-direction: column; gap: .7rem; margin-top: 1rem; }
.exemple {
  display: flex; flex-direction: column; gap: .15rem; padding: .8rem 1.1rem;
  background: var(--surface-2); border-radius: var(--rayon-petit);
  border-inline-start: 3px solid var(--accent-2);
}
.exemple .ar { font-size: 1.5rem; }
.exemple .translit { font-style: italic; color: var(--texte-doux); font-size: .85rem; }
.exemple .fr { font-size: .95rem; }

.bloc-dialogue { background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon); padding: 1.6rem 2rem; box-shadow: var(--ombre); }
.bloc-dialogue .contexte { font-style: italic; color: var(--texte-doux); }
.replique { display: flex; gap: .9rem; margin: 1rem 0; align-items: flex-start; }
.replique .avatar {
  flex: 0 0 auto; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  background: var(--accent-doux); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--police-ar); font-size: 1.05rem;
}
.replique:nth-child(even) .avatar { background: color-mix(in srgb, var(--accent-2) 18%, var(--surface-2)); color: var(--accent-2); }
.replique .bulle { background: var(--surface-2); border-radius: 4px 18px 18px 18px; padding: .7rem 1.1rem; flex: 1; }
.replique .bulle .ar { font-size: 1.45rem; display: block; }
.replique .bulle .fr { font-size: .9rem; color: var(--texte-doux); }
.replique .bulle .translit { font-size: .8rem; font-style: italic; color: var(--texte-doux); }

.bloc-attention, .bloc-astuce {
  border-radius: var(--rayon); padding: 1.2rem 1.6rem 1.2rem 3.4rem; position: relative;
  border: 1px solid var(--bordure);
}
.bloc-attention { background: var(--erreur-fond); }
.bloc-astuce { background: var(--info-fond); }
.bloc-attention::before, .bloc-astuce::before { position: absolute; left: 1.1rem; top: 1.05rem; font-size: 1.4rem; }
.bloc-attention::before { content: "⚠️"; }
.bloc-astuce::before { content: "💡"; }

.bloc-religieux {
  background: linear-gradient(160deg, var(--accent-doux), var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent-2) 40%, var(--bordure));
  border-radius: var(--rayon); padding: 1.8rem 2rem; text-align: center;
}
.bloc-religieux .ar { font-size: 1.9rem; display: block; margin: .6rem 0; }
.bloc-religieux .source { font-size: .82rem; color: var(--accent-2); font-weight: 700; letter-spacing: .05em; }
.bloc-religieux .commentaire { text-align: start; margin-top: 1rem; font-size: .95rem; }

.tableau-vocab { width: 100%; border-collapse: collapse; }
.tableau-vocab th, .tableau-vocab td { padding: .55rem .8rem; border-bottom: 1px solid var(--bordure); text-align: start; }
.tableau-vocab .ar { font-size: 1.45rem; }
.tableau-vocab tr:hover td { background: var(--surface-2); }
.btn-audio {
  background: var(--accent-doux); color: var(--accent); border: none; border-radius: 50%;
  width: 2.1rem; height: 2.1rem; cursor: pointer; font-size: .95rem;
  transition: transform var(--transition);
}
.btn-audio:hover { transform: scale(1.15); }
.btn-audio.joue { animation: pulse 1s infinite; }

.cta-exercices { text-align: center; margin: 3rem 0 1rem; }

/* ---------- 10. Moteur d'exercices ---------- */
.joueur { max-width: 760px; margin: 0 auto; }
.joueur-entete { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.joueur-entete .barre-progression { flex: 1; min-width: 160px; }
.compteur-questions { font-size: .85rem; color: var(--texte-doux); white-space: nowrap; }
.carte-exercice {
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon);
  padding: 2rem; box-shadow: var(--ombre); animation: glisse .35s ease both;
}
.carte-exercice .consigne { color: var(--texte-doux); font-size: .95rem; margin-top: 0; }
.question-texte { font-size: 1.15rem; font-weight: 600; margin: 1rem 0; }
.question-ar { font-size: 1.9rem; margin: .6rem 0; }

.choix-liste { display: flex; flex-direction: column; gap: .7rem; margin: 1.2rem 0; }
.choix {
  display: flex; align-items: center; gap: .8rem; width: 100%; text-align: start;
  background: var(--surface-2); border: 2px solid var(--bordure); border-radius: var(--rayon-petit);
  padding: .85rem 1.2rem; cursor: pointer; font-size: 1.02rem; font-family: inherit; color: var(--texte);
  transition: border-color var(--transition), transform var(--transition), background var(--transition);
}
.choix:hover:not(:disabled) { border-color: var(--accent); transform: translateX(4px); }
.choix .lettre {
  flex: 0 0 auto; width: 1.7rem; height: 1.7rem; border-radius: 50%; font-size: .85rem;
  background: var(--surface); border: 1px solid var(--bordure);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}
.choix.correcte { border-color: var(--ok); background: var(--ok-fond); animation: tremblote-ok .4s ease; }
.choix.fausse { border-color: var(--erreur); background: var(--erreur-fond); animation: tremblote .4s ease; }
.choix:disabled { cursor: default; }

/* Panneau d'explication (contrat de confiance) */
.explication {
  border-radius: var(--rayon-petit); padding: 1.1rem 1.4rem; margin: 1rem 0;
  animation: apparait .3s ease both; border: 1px solid;
}
.explication.ok { background: var(--ok-fond); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.explication.ko { background: var(--erreur-fond); border-color: color-mix(in srgb, var(--erreur) 35%, transparent); }
.explication .verdict { font-weight: 700; display: flex; align-items: center; gap: .5rem; margin-bottom: .3rem; }
.explication.ok .verdict { color: var(--ok); }
.explication.ko .verdict { color: var(--erreur); }
.explication p { margin: .3em 0; }

/* Champ d'écriture */
.champ-ecriture {
  width: 100%; font-family: var(--police-ar); font-size: 1.7rem; direction: rtl;
  padding: .8rem 1.2rem; border: 2px solid var(--bordure); border-radius: var(--rayon-petit);
  background: var(--surface-2); color: var(--texte);
}
.champ-ecriture:focus { outline: none; border-color: var(--accent); }
.aide-ecriture { font-size: .85rem; color: var(--texte-doux); }

/* Flashcards */
.flashcard-scene { perspective: 1200px; margin: 1.5rem auto; max-width: 430px; }
.flashcard { position: relative; width: 100%; height: 250px; cursor: pointer; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.4,0,.2,1); }
.flashcard.retournee { transform: rotateY(180deg); }
.flashcard .face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem;
  border-radius: var(--rayon); border: 1px solid var(--bordure); box-shadow: var(--ombre);
  padding: 1.4rem; text-align: center;
}
.flashcard .recto { background: linear-gradient(150deg, var(--accent), color-mix(in srgb, var(--accent) 70%, black)); color: #fff; }
.flashcard .recto .ar { font-size: 3rem; color: #fff; }
.flashcard .verso { background: var(--surface); transform: rotateY(180deg); }
.flashcard .verso .traduction { font-size: 1.5rem; font-weight: 600; }
.flashcard .verso .exemple-ar { font-size: 1.3rem; color: var(--accent); }
.flashcard-nav { display: flex; justify-content: center; gap: .8rem; margin-top: 1rem; }

/* Association */
.assoc-zone { display: flex; gap: 1.5rem; margin: 1.2rem 0; }
.assoc-col { flex: 1; display: flex; flex-direction: column; gap: .6rem; }
.assoc-item {
  padding: .7rem 1rem; border: 2px solid var(--bordure); border-radius: var(--rayon-petit);
  background: var(--surface-2); cursor: pointer; text-align: center; font-family: inherit;
  font-size: 1rem; color: var(--texte); transition: all var(--transition);
}
.assoc-item.ar-item { font-family: var(--police-ar); font-size: 1.5rem; direction: rtl; }
.assoc-item.selectionne { border-color: var(--accent); background: var(--accent-doux); transform: scale(1.03); }
.assoc-item.appariee { border-color: var(--ok); background: var(--ok-fond); opacity: .65; cursor: default; }
.assoc-item.erreur-flash { border-color: var(--erreur); background: var(--erreur-fond); animation: tremblote .4s ease; }

/* Remise en ordre */
.ordre-zone { min-height: 4.2rem; border: 2px dashed var(--bordure); border-radius: var(--rayon-petit); padding: .7rem; display: flex; flex-wrap: wrap; gap: .5rem; direction: rtl; margin: 1rem 0; align-items: center; }
.ordre-banque { display: flex; flex-wrap: wrap; gap: .5rem; direction: rtl; margin: 1rem 0; justify-content: center; }
.jeton {
  font-family: var(--police-ar); font-size: 1.5rem; padding: .3rem 1rem;
  background: var(--surface); border: 2px solid var(--accent); color: var(--texte);
  border-radius: var(--rayon-petit); cursor: pointer; transition: all var(--transition);
}
.jeton:hover { background: var(--accent-doux); transform: translateY(-2px); }
.jeton.place { border-color: var(--accent-2); }

/* Dialogue à trous */
.dialogue-jeu .replique { opacity: .45; transition: opacity .4s ease; }
.dialogue-jeu .replique.revelee { opacity: 1; }
.dialogue-jeu .replique.courante { opacity: 1; }
.dialogue-jeu .replique.courante .bulle { outline: 2px solid var(--accent); }

/* Écran de fin d'exercice */
.ecran-fin { text-align: center; padding: 2.5rem 1rem; }
.ecran-fin .score-cercle {
  width: 130px; height: 130px; margin: 0 auto 1.2rem; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--surface-2) 0);
  position: relative;
}
.ecran-fin .score-cercle::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--surface); }
.ecran-fin .score-cercle span { position: relative; font-size: 1.6rem; font-weight: 700; font-family: var(--police-titres); }
.ecran-fin .xp-gagne { color: var(--accent-2); font-weight: 700; font-size: 1.2rem; }
.recap-erreurs { text-align: start; margin: 1.6rem auto; max-width: 560px; }

/* Liste d'exercices d'une leçon */
.liste-exercices { display: flex; flex-direction: column; gap: .7rem; max-width: 760px; margin: 0 auto; }
.item-exercice {
  display: flex; align-items: center; gap: 1rem; padding: .9rem 1.3rem;
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon);
  text-decoration: none !important; color: var(--texte); transition: all var(--transition);
}
.item-exercice:hover { border-color: var(--accent); transform: translateX(5px); }
.item-exercice .type-icone { font-size: 1.4rem; }
.item-exercice .titre { flex: 1; font-weight: 600; }
.item-exercice .etat-fait { color: var(--ok); font-weight: 700; }
.item-exercice .xp-tag { font-size: .78rem; color: var(--accent-2); font-weight: 700; white-space: nowrap; }
.etiquette-niveau { font-size: .72rem; padding: .15em .7em; border-radius: 999px; background: var(--surface-2); color: var(--texte-doux); border: 1px solid var(--bordure); }
.etiquette-bonus { font-size: .72rem; padding: .15em .7em; border-radius: 999px; background: var(--accent-2); color: #fff; }

/* ---------- 11. Glossaire ---------- */
.glossaire-outils { display: flex; gap: .8rem; flex-wrap: wrap; margin: 1.4rem 0; align-items: center; }
.champ-recherche {
  flex: 1 1 320px; padding: .8rem 1.3rem; font-size: 1.05rem; font-family: inherit;
  border: 2px solid var(--bordure); border-radius: 999px; background: var(--surface); color: var(--texte);
}
.champ-recherche:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.filtres-categories { display: flex; gap: .4rem; flex-wrap: wrap; }
.filtre-cat {
  font-size: .82rem; padding: .3em .9em; border-radius: 999px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--bordure); color: var(--texte-doux); font-family: inherit;
}
.filtre-cat.actif { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.entree-dico {
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon);
  padding: 1.1rem 1.5rem; margin-bottom: .8rem; box-shadow: var(--ombre);
}
.entree-dico .ligne-1 { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.entree-dico .mot-ar { font-family: var(--police-ar); font-size: 2rem; color: var(--accent); direction: rtl; }
.entree-dico .translit { font-style: italic; color: var(--texte-doux); }
.entree-dico .genre { font-size: .72rem; background: var(--surface-2); border-radius: 4px; padding: .1em .5em; color: var(--texte-doux); border: 1px solid var(--bordure); }
.entree-dico .traduction { font-weight: 600; font-size: 1.1rem; }
.entree-dico .details { font-size: .88rem; color: var(--texte-doux); margin-top: .3rem; display: flex; gap: 1.4em; flex-wrap: wrap; }
.entree-dico .exemple-dico { margin-top: .5rem; padding-top: .5rem; border-top: 1px dashed var(--bordure); font-size: .92rem; }
.entree-dico .exemple-dico .ar { font-size: 1.35rem; }
.compte-resultats { color: var(--texte-doux); font-size: .88rem; }

/* ---------- 12. Badges & profil ---------- */
.grille-badges { display: flex; flex-wrap: wrap; gap: 1rem; }
.badge-item {
  flex: 1 1 200px; max-width: 260px; text-align: center; padding: 1.3rem 1rem;
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon);
  transition: transform var(--transition);
}
.badge-item:hover { transform: translateY(-4px) rotate(-1deg); }
.badge-item .emoji { font-size: 2.6rem; display: block; filter: grayscale(0); }
.badge-item.verrouille { opacity: .45; }
.badge-item.verrouille .emoji { filter: grayscale(1); }
.badge-item .nom { font-weight: 700; margin: .4rem 0 .15rem; }
.badge-item .desc { font-size: .8rem; color: var(--texte-doux); }
.badge-item .date { font-size: .72rem; color: var(--accent-2); }

/* ---------- 13. Formulaires ---------- */
.form-carte { max-width: 460px; margin: 2rem auto; }
.champ { margin-bottom: 1.1rem; }
.champ label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.champ input, .champ select, .champ textarea {
  width: 100%; padding: .7rem 1rem; font-size: 1rem; font-family: inherit;
  border: 2px solid var(--bordure); border-radius: var(--rayon-petit);
  background: var(--surface-2); color: var(--texte);
}
.champ input:focus, .champ select:focus, .champ textarea:focus { outline: none; border-color: var(--accent); }
.message-erreur { background: var(--erreur-fond); color: var(--erreur); border-radius: var(--rayon-petit); padding: .8rem 1.1rem; margin: 1rem 0; }
.message-ok { background: var(--ok-fond); color: var(--ok); border-radius: var(--rayon-petit); padding: .8rem 1.1rem; margin: 1rem 0; }

/* ---------- 14. Tableaux (admin) ---------- */
.tableau-defilant { overflow-x: auto; }
.tableau-admin { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--rayon); overflow: hidden; box-shadow: var(--ombre); }
.tableau-admin th { background: var(--accent); color: var(--surface); text-align: start; padding: .7rem 1rem; font-size: .85rem; letter-spacing: .04em; }
.tableau-admin td { padding: .65rem 1rem; border-bottom: 1px solid var(--bordure); font-size: .92rem; }
.tableau-admin tr:hover td { background: var(--surface-2); }
.mini-barre { width: 90px; }

/* ---------- 15. Toasts & confettis ---------- */
#zone-toasts { position: fixed; bottom: 1.4rem; right: 1.4rem; z-index: 200; display: flex; flex-direction: column; gap: .7rem; max-width: min(380px, 90vw); }
.toast {
  background: var(--surface); border: 1px solid var(--bordure); border-inline-start: 4px solid var(--accent);
  border-radius: var(--rayon-petit); padding: .9rem 1.2rem; box-shadow: var(--ombre-forte);
  display: flex; gap: .8rem; align-items: center; animation: toast-entre .4s cubic-bezier(.2,.9,.3,1.2) both;
}
.toast.badge-toast { border-inline-start-color: var(--accent-2); }
.toast .emoji { font-size: 1.8rem; }
.toast .titre { font-weight: 700; }
.toast .texte { font-size: .85rem; color: var(--texte-doux); }
.toast.sortie { animation: toast-sort .3s ease both; }
.confetti { position: fixed; top: -12px; z-index: 300; pointer-events: none; animation: confetti-chute linear both; }

/* ---------- 16. Pied de page ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--bordure); padding: 2.5rem 0 1.2rem; margin-top: auto; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 2.2rem; }
.footer-col { flex: 1 1 200px; display: flex; flex-direction: column; gap: .35rem; }
.footer-col h4 { margin: 0 0 .4rem; font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--texte-doux); }
.footer-col a { color: var(--texte); font-size: .92rem; }
.footer-bas { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .8rem; padding-top: 1.4rem; margin-top: 1.6rem; border-top: 1px solid var(--bordure); font-size: .82rem; color: var(--texte-doux); align-items: center; }

/* ---------- 17. Animations ---------- */
@keyframes apparait { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes glisse { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes flotte { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes tremblote { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes tremblote-ok { 0%,100% { transform: scale(1); } 50% { transform: scale(1.03); } }
@keyframes toast-entre { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: none; } }
@keyframes toast-sort { to { opacity: 0; transform: translateX(60px); } }
@keyframes confetti-chute { to { transform: translateY(105vh) rotate(720deg); opacity: .2; } }

.anim-en-vue { opacity: 0; transform: translateY(20px); transition: opacity .6s ease, transform .6s ease; }
.anim-en-vue.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* ---------- 18. Responsive ---------- */
@media (max-width: 900px) {
  .nav-burger { display: inline-flex; }
  .nav-principale {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--bordure);
    flex-direction: column; padding: .8rem 1.2rem; box-shadow: var(--ombre-forte);
  }
  .nav-principale.ouverte { display: flex; }
  .pseudo-header { display: none; }
  .assoc-zone { gap: .7rem; }
  .carte-exercice { padding: 1.3rem; }
  .hero { padding-top: 2rem; gap: 1.5rem; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .carte-lecon { flex-wrap: wrap; }
  .carte-lecon .progres { flex: 1 1 100%; }
  .footer-bas { flex-direction: column; text-align: center; }
  #zone-toasts { left: 1rem; right: 1rem; }
}

/* Impression (corrections imprimables) */
@media print {
  .site-header, .site-footer, .motif-fond, #zone-toasts, .btn, .joueur-entete { display: none !important; }
  body { background: #fff; color: #000; }
  .carte, .carte-exercice { box-shadow: none; border: 1px solid #ccc; }
}
