/* ==========================================================================
   Institut Attamayouz — feuille de style
   Identité issue du logo : orange chaleureux, jaune doré, bleu-vert profond,
   blanc crème. Signature : les deux arcs du logo servent de jauge de
   progression (arc orange = parties terminées, arc doré = parties commencées).
   Polices sous licence OFL : Lexend (interface, conçue pour la lisibilité)
   et Noto Naskh Arabic (texte arabe vocalisé).
   ========================================================================== */
@font-face { font-family: 'Lexend'; src: url('fonts/lexend.woff2') format('woff2'); font-weight: 300 700; font-display: swap; }
@font-face { font-family: 'Naskh'; src: url('fonts/naskh-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Naskh'; src: url('fonts/naskh-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --paper: #FFFDF8; --sand: #F7F0E3; --sand-2: #EEE3CF; --line: #E4D6BE;
  --ink: #122B36; --muted: #55666C;
  --teal: #17675F; --teal-deep: #0E4741; --teal-ink: #0F524B; --teal-wash: #E4F0EC;
  --orange: #E76C2E; --orange-ink: #A8461A; --orange-wash: #FCEBDF;
  --gold: #F4B64B; --gold-ink: #8A5A06; --gold-wash: #FDF2D9;
  --err: #B3261E; --err-wash: #FBEAE7;
  --ui: 'Lexend', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ar: 'Naskh', 'Noto Naskh Arabic', 'Geeza Pro', 'Traditional Arabic', serif;
  --r-card: 20px; --r-small: 12px;
  --shadow: 0 1px 0 rgba(18, 43, 54, .04), 0 10px 30px -18px rgba(18, 43, 54, .35);
  --rail: 288px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.55 var(--ui); }
img { max-width: 100%; height: auto; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--teal-ink); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.012em; }
h1 { font-size: 31px; font-weight: 600; }
h2 { font-size: 22px; font-weight: 600; }
h3 { font-size: 17px; font-weight: 600; }
p { margin: 0; }
.chargement { padding: 40px; color: var(--muted); }
.ar { font-family: var(--ar); direction: rtl; unicode-bidi: isolate; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 22px; border-radius: 999px; border: 1.5px solid transparent; background: var(--teal); color: #fff; font-weight: 500; font-size: 15px; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--teal-deep); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.clair { background: transparent; color: var(--teal-ink); border-color: var(--line); }
.btn.clair:hover { border-color: var(--teal); background: var(--teal-wash); }
.btn.orange { background: var(--orange); color: #fff; }
.btn.orange:hover { background: var(--orange-ink); }
.btn.petit { min-height: 38px; padding: 0 16px; font-size: 14px; }
.lien { background: none; border: 0; padding: 0; color: var(--teal-ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 14px; }

/* ---------- jauge en arcs (signature) ---------- */
.arcs { display: block; }
.arcs .piste { fill: none; stroke: var(--sand-2); }
.arcs .commence { fill: none; stroke: var(--gold); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.arcs .termine { fill: none; stroke: var(--orange); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.sur-sombre .arcs .piste { stroke: rgba(255, 253, 248, .16); }
.jauge { display: flex; align-items: center; gap: 14px; }
.jauge .chiffre { font-size: 26px; font-weight: 600; line-height: 1; }
.jauge .chiffre small { font-size: 14px; font-weight: 400; color: var(--muted); }
.sur-sombre .jauge .chiffre small { color: rgba(255, 253, 248, .75); }
.legende { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legende i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

/* ---------- connexion ---------- */
.connexion { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, 1fr); }
.connexion .visuel { position: relative; overflow: hidden; background: var(--teal-deep) url('img/medina.webp') 30% center / cover no-repeat; }
.connexion .visuel::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(14, 71, 65, 0) 45%, rgba(14, 71, 65, .82)); }
.connexion .visuel p { position: absolute; z-index: 2; left: 40px; right: 40px; bottom: 36px; max-width: 420px; color: var(--paper); font-size: 20px; line-height: 1.45; font-weight: 300; }
.connexion form { align-self: center; justify-self: center; width: min(420px, 100% - 32px); padding: 40px 0; }
.embleme { position: relative; width: 300px; height: 176px; margin: 0 0 26px -8px; }
.embleme svg { position: absolute; left: 0; top: 0; width: 176px; height: 176px; }
.embleme .marque { position: absolute; left: 58px; top: 34px; width: 236px; }
.connexion h1 { font-size: 27px; margin-bottom: 8px; }
.connexion .intro { color: var(--muted); margin-bottom: 26px; }
.champ { display: block; margin-bottom: 16px; }
.champ span { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.champ input, .champ textarea, .champ select { width: 100%; min-height: 50px; padding: 12px 16px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; font-size: 16px; }
.champ input:focus, .champ textarea:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 4px var(--teal-wash); }
.erreur { color: var(--err); font-size: 14px; min-height: 20px; margin: 4px 0 12px; }
.connexion .btn { width: 100%; }
.connexion .aide { margin-top: 22px; font-size: 13px; color: var(--muted); }

/* ---------- coquille de l'application ---------- */
.entete { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px clamp(16px, 4vw, 40px); background: rgba(255, 253, 248, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.entete .marque { width: 132px; }
.entete .liens { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.entete .liens a { padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--ink); font-size: 14px; font-weight: 500; white-space: nowrap; }
.entete .liens a.actif { background: var(--teal-wash); color: var(--teal-ink); }
.entete .compte { display: flex; align-items: center; gap: 10px; padding-left: 14px; border-left: 1px solid var(--line); }
.entete .qui { font-size: 13px; color: var(--muted); }
.pastille { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--orange); color: #fff; font-size: 12px; font-weight: 600; margin-left: 4px; }
.page { width: min(1160px, 100%); margin: 0 auto; padding: 32px clamp(16px, 4vw, 40px) 80px; }

/* ---------- accueil élève ---------- */
.salut { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.salut p { color: var(--muted); margin-top: 6px; }
.formule { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--gold-wash); color: var(--gold-ink); }
.formule.avec { background: var(--teal-wash); color: var(--teal-ink); }
.accueil { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.reprendre { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 26px 28px; border-radius: var(--r-card); background: var(--teal-deep); color: var(--paper); margin-bottom: 34px; }
.reprendre h2 { font-size: 24px; margin: 4px 0 6px; }
.reprendre p { color: rgba(255, 253, 248, .78); font-size: 15px; }
.reprendre .btn { background: var(--gold); color: var(--ink); flex-shrink: 0; }
.reprendre .btn:hover { background: #f7c56c; }
.reprendre .gauche { display: flex; align-items: center; gap: 20px; min-width: 0; }
.titre-section { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 16px; }
.titre-section p { color: var(--muted); font-size: 14px; }

/* dossiers d'apprentissage */
.dossiers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.dossier { position: relative; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 6px var(--r-card) var(--r-card) var(--r-card); box-shadow: var(--shadow); text-decoration: none; color: inherit; margin-top: 30px; transition: transform .18s ease, box-shadow .18s ease; }
.dossier:hover { transform: translateY(-2px); box-shadow: 0 1px 0 rgba(18,43,54,.04), 0 18px 36px -20px rgba(18,43,54,.45); }
.dossier .onglet { position: absolute; top: -30px; left: -1px; height: 31px; padding: 7px 18px 0; background: #fff; border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; font-size: 13px; font-weight: 600; color: var(--orange-ink); }
.dossier .couverture { height: 168px; background: var(--sand) center / cover no-repeat; border-radius: 0 calc(var(--r-card) - 1px) 0 0; }
.dossier .corps { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.dossier .titre-ar { font-size: 26px; line-height: 1.6; text-align: right; color: var(--teal-ink); }
.dossier .titre-fr { font-size: 18px; font-weight: 600; }
.dossier .note { font-size: 13px; color: var(--orange-ink); background: var(--orange-wash); padding: 8px 12px; border-radius: 10px; }
.dossier .pied { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 6px; }
.dossier .pied .etat { font-size: 13px; color: var(--muted); }
.a-venir { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 26px; }
.a-venir div { padding: 14px 16px; border: 1.5px dashed var(--line); border-radius: 14px; color: var(--muted); font-size: 13px; }
.a-venir b { display: block; color: var(--ink); font-weight: 500; font-size: 14px; }
.colonne { display: flex; flex-direction: column; gap: 18px; }
.panneau { background: #fff; border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px 22px; }
.panneau h2 { font-size: 18px; margin-bottom: 10px; }
.panneau p { font-size: 15px; color: var(--muted); }
.panneau .btn { margin-top: 14px; }
.panneau.sable { background: var(--sand); border-color: transparent; }
.devoir { padding: 12px 0; border-top: 1px solid var(--line); }
.devoir:first-of-type { border-top: 0; }
.apercu { margin-top: 10px; padding: 12px 14px; background: var(--sand); border-radius: 12px; font-size: 14px; color: var(--ink); }

/* ---------- page de leçon ---------- */
.lecon { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; background: linear-gradient(to right, var(--teal-deep) var(--rail), var(--paper) var(--rail)); }
.rail { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; background: var(--teal-deep); color: var(--paper); padding: 20px 16px 30px; display: flex; flex-direction: column; gap: 18px; scrollbar-width: thin; }
.rail .retour { color: rgba(255, 253, 248, .85); text-decoration: none; font-size: 14px; padding: 6px 8px; border-radius: 8px; align-self: flex-start; }
.rail .retour:hover { background: rgba(255, 255, 255, .08); }
.rail .tete { padding: 4px 8px; }
.rail .num { font-size: 13px; color: var(--gold); font-weight: 500; }
.rail .tete .ar { display: block; font-size: 27px; line-height: 1.7; text-align: right; margin: 2px 0; }
.rail .tete .fr { font-size: 15px; color: rgba(255, 253, 248, .85); }
.rail .groupe { font-size: 12px; color: rgba(255, 253, 248, .6); padding: 10px 10px 4px; font-weight: 500; }
.rail ol { list-style: none; margin: 0; padding: 0; }
.rail li a, .rail li span.inactif { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--paper); text-decoration: none; font-size: 14px; line-height: 1.35; }
.rail li a:hover { background: rgba(255, 255, 255, .07); }
.rail li a.ici { background: var(--paper); color: var(--ink); }
.rail li span.inactif { color: rgba(255, 253, 248, .45); cursor: default; }
.rail li span.inactif small { margin-left: auto; font-size: 11px; border: 1px solid rgba(255, 253, 248, .25); border-radius: 999px; padding: 1px 8px; }
.rail .point { width: 18px; height: 18px; flex-shrink: 0; border-radius: 50%; border: 2px solid rgba(255, 253, 248, .35); display: grid; place-items: center; }
.rail .point.ouvert { border-color: var(--gold); }
.rail .point.fini { border-color: var(--orange); background: var(--orange); }
.rail .point.fini::after { content: ''; width: 7px; height: 4px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.rail li a.ici .point { border-color: var(--teal); }
.rail li a.ici .point.fini { border-color: var(--orange); }
.contenu { min-width: 0; padding: 0 clamp(16px, 4vw, 56px) 80px; }
.barre-lecon { display: none; }
.tete-partie { padding: 34px 0 22px; border-bottom: 1px solid var(--line); margin-bottom: 26px; max-width: 820px; }
.tete-partie .etape { font-size: 13px; color: var(--orange-ink); font-weight: 500; margin-bottom: 6px; }
.tete-partie p { color: var(--muted); margin-top: 8px; max-width: 62ch; }
.corps-partie { max-width: 820px; }
.navigation-parties { max-width: 820px; display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line); }
.navigation-parties .btn:only-child { margin-left: auto; }

/* lecteur audio unique */
.lecteur { position: sticky; top: 12px; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 12px 16px; margin-bottom: 26px; border-radius: 16px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.lecteur .jouer { width: 48px; height: 48px; flex-shrink: 0; border-radius: 50%; border: 0; background: var(--teal); color: #fff; display: grid; place-items: center; cursor: pointer; }
.lecteur .jouer svg { width: 20px; height: 20px; fill: currentColor; }
.lecteur .saut { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; height: 36px; padding: 0 10px; font-size: 13px; cursor: pointer; flex-shrink: 0; }
.lecteur .piste-audio { flex: 1; min-width: 80px; display: flex; flex-direction: column; gap: 4px; }
.lecteur input[type=range] { width: 100%; accent-color: var(--orange); }
.lecteur .temps { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lecteur .vitesses { display: flex; gap: 4px; flex-shrink: 0; }
.lecteur .vitesses button { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; height: 32px; min-width: 50px; font-size: 12px; cursor: pointer; }
.lecteur .vitesses button[aria-pressed=true] { background: var(--gold-wash); border-color: var(--gold); font-weight: 600; }
.lecteur.attente { position: static; box-shadow: none; background: var(--sand); border-style: dashed; }
.lecteur.attente .icone { width: 44px; height: 44px; border-radius: 50%; background: var(--paper); display: grid; place-items: center; flex-shrink: 0; }
.lecteur.attente .icone svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; }
.lecteur.attente b { display: block; font-weight: 500; }
.lecteur.attente span { font-size: 14px; color: var(--muted); }

/* texte de base */
.scene { margin: 0 0 30px; }
.scene h3 { font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.scene h3::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.replique { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 12px 0; }
.replique .ar { font-size: 29px; line-height: 2.05; text-align: right; }
.locuteur { font-family: var(--ar); font-size: 17px; line-height: 1; padding: 9px 12px 11px; border-radius: 999px; white-space: nowrap; margin-top: 10px; direction: rtl; }
.locuteur.l0 { background: var(--teal-wash); color: var(--teal-ink); }
.locuteur.l1 { background: var(--orange-wash); color: var(--orange-ink); }
.astuce { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 14px; background: var(--gold-wash); color: var(--gold-ink); font-size: 14px; margin-bottom: 24px; max-width: 820px; }
.mot { cursor: pointer; border-radius: 6px; text-decoration: underline dotted var(--gold); text-decoration-thickness: 2px; text-underline-offset: 10px; }
.mot:hover, .mot.choisi { background: var(--gold-wash); }
.fiche-mot { position: fixed; z-index: 60; width: min(320px, calc(100vw - 32px)); background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 50px -20px rgba(18, 43, 54, .5); padding: 16px 18px; }
.fiche-mot .ar { font-size: 30px; line-height: 1.7; text-align: right; display: block; color: var(--teal-ink); }
.fiche-mot .sens { font-size: 18px; font-weight: 600; margin-top: 2px; }
.fiche-mot dl { margin: 10px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; }
.fiche-mot dt { color: var(--muted); }
.fiche-mot dd { margin: 0; }
.fiche-mot dd .ar { font-size: 22px; line-height: 1.5; display: inline; color: var(--ink); }
.fiche-mot .fermer { position: absolute; top: 8px; left: 8px; width: 32px; height: 32px; border: 0; background: none; border-radius: 50%; cursor: pointer; font-size: 18px; color: var(--muted); }
.fiche-mot .fermer:hover { background: var(--sand); }

/* vocabulaire */
.categorie { margin-bottom: 26px; }
.categorie h3 { font-size: 14px; font-weight: 500; color: var(--muted); margin-bottom: 10px; text-transform: none; }
.mots { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.carte-mot { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 2px; }
.carte-mot .ar { font-size: 30px; line-height: 1.75; text-align: right; color: var(--teal-ink); }
.carte-mot .sens { font-weight: 600; font-size: 16px; }
.carte-mot .pl { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; align-items: baseline; gap: 8px; border-top: 1px solid var(--sand-2); margin-top: 8px; padding-top: 8px; }
.carte-mot .pl .ar { font-size: 20px; line-height: 1.6; color: var(--ink); }

/* tournures */
.tournure { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 20px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.tournure .fonction { font-size: 15px; color: var(--muted); }
.tournure .fonction b { display: block; color: var(--ink); font-weight: 500; font-size: 13px; color: var(--orange-ink); margin-bottom: 2px; }
.tournure .ar { font-size: 27px; line-height: 1.9; text-align: right; }

/* lectures */
.lecture-carte { background: #fff; border: 1px solid var(--line); border-radius: var(--r-card); padding: 22px 26px; margin-bottom: 22px; }
.lecture-carte h3 { font-size: 16px; margin-bottom: 8px; color: var(--teal-ink); }
.lecture-carte .ar { font-size: 28px; line-height: 2.15; text-align: justify; text-align-last: right; }

/* partie pas encore intégrée / fin */
.encart { padding: 26px 28px; border-radius: var(--r-card); background: var(--sand); max-width: 820px; }
.encart h2 { font-size: 20px; margin-bottom: 8px; }
.encart p { color: var(--muted); }
.encart .btn { margin-top: 18px; }

/* ---------- messagerie ---------- */
.fil { display: flex; flex-direction: column; gap: 12px; max-height: 58vh; overflow-y: auto; padding: 4px 2px 12px; }
.bulle { max-width: min(560px, 86%); padding: 12px 16px; border-radius: 18px 18px 18px 6px; background: var(--sand); white-space: pre-wrap; overflow-wrap: anywhere; }
.bulle.moi { align-self: flex-end; border-radius: 18px 18px 6px 18px; background: var(--teal-wash); }
.bulle small { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }
.ecrire { display: flex; gap: 10px; align-items: flex-end; margin-top: 12px; }
.ecrire textarea { flex: 1; min-height: 52px; max-height: 200px; resize: vertical; padding: 12px 16px; border: 1.5px solid var(--line); border-radius: 16px; background: #fff; font-size: 16px; }
.ecrire textarea:focus { border-color: var(--teal); outline: none; }

/* ---------- espace professeur ---------- */
.tableau { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.tableau th { text-align: left; font-size: 13px; font-weight: 500; color: var(--muted); padding: 14px 16px; background: var(--sand); }
.tableau td { padding: 14px 16px; border-top: 1px solid var(--line); vertical-align: middle; font-size: 15px; }
.tableau tr.lien-ligne { cursor: pointer; }
.tableau tr.lien-ligne:hover td { background: #FFFBF2; }
.tableau .nom { font-weight: 600; }
.mini { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 24px 0 22px; overflow-x: auto; }
.onglets a { padding: 10px 16px; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 2.5px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.onglets a.actif { color: var(--ink); border-bottom-color: var(--orange); }
.parties-eleve { display: grid; gap: 8px; }
.ligne-partie { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; font-size: 14px; }
.ligne-partie .point { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); }
.ligne-partie .point.ouvert { border-color: var(--gold); }
.ligne-partie .point.fini { border-color: var(--orange); background: var(--orange); }
.ligne-partie .quand, .ligne-partie .duree { color: var(--muted); font-size: 13px; white-space: nowrap; }
.journal { list-style: none; margin: 0; padding: 0; }
.journal li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.journal time { color: var(--muted); }
.fiche-eleve { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.fiche-eleve .infos { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; color: var(--muted); font-size: 14px; }

/* ---------- message flottant ---------- */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; z-index: 80; background: var(--ink); color: var(--paper); padding: 12px 20px; border-radius: 999px; font-size: 14px; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); }
#toast.vu { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.erreur { background: var(--err); }

/* ---------- tablette et téléphone ---------- */
@media (max-width: 1020px) {
  .accueil { grid-template-columns: minmax(0, 1fr); }
  .a-venir { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .connexion { grid-template-columns: minmax(0, 1fr); }
  .connexion .visuel { min-height: 190px; }
  .connexion .visuel p { left: 20px; right: 20px; bottom: 16px; font-size: 16px; }
  .embleme { transform: scale(.82); transform-origin: left top; margin-bottom: 0; height: 150px; }
  .connexion form { padding: 28px 0 40px; }
  .lecon { grid-template-columns: minmax(0, 1fr); background: var(--paper); }
  .rail { position: fixed; z-index: 50; inset: 0 auto 0 0; width: min(320px, 88vw); transform: translateX(-102%); transition: transform .25s ease, visibility .25s; visibility: hidden; }
  .rail.ouvert { transform: none; visibility: visible; box-shadow: 20px 0 60px rgba(0, 0, 0, .3); }
  .voile { position: fixed; inset: 0; z-index: 40; background: rgba(18, 43, 54, .45); }
  .barre-lecon { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; gap: 10px; padding: 10px 16px; background: rgba(255, 253, 248, .96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); margin: 0 calc(-1 * clamp(16px, 4vw, 56px)); }
  .barre-lecon .btn { min-height: 40px; padding: 0 14px; font-size: 14px; }
  .barre-lecon .ou { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
  .lecteur { top: 66px; }
}
@media (max-width: 640px) {
  h1 { font-size: 25px; }
  .entete { flex-wrap: wrap; row-gap: 6px; padding: 8px 16px 6px; }
  .entete .marque { width: 100px; }
  .entete .qui { display: none; }
  .entete .compte { border: 0; padding: 0; }
  .entete .liens { order: 3; width: 100%; margin: 0 -6px; overflow-x: auto; }
  .entete .liens a { padding: 7px 12px; }
  .ecrire { flex-direction: column; align-items: stretch; }
  .page { padding: 22px 16px 70px; }
  .reprendre { flex-direction: column; align-items: stretch; padding: 20px; }
  .reprendre .btn { width: 100%; }
  .dossiers { grid-template-columns: minmax(0, 1fr); }
  .dossier .couverture { height: 136px; }
  .a-venir { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .replique { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .replique .locuteur { justify-self: end; order: -1; margin-top: 0; font-size: 15px; padding: 6px 10px 8px; }
  .replique .ar { font-size: 25px; line-height: 2; }
  .tournure { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .lecture-carte { padding: 18px; }
  .lecture-carte .ar { font-size: 24px; text-align: right; }
  .lecteur { flex-wrap: wrap; gap: 10px; }
  .lecteur .piste-audio { order: 5; flex-basis: 100%; }
  .tableau thead { display: none; }
  .tableau, .tableau tbody, .tableau tr, .tableau td { display: block; width: 100%; }
  .tableau tr { border-top: 1px solid var(--line); padding: 10px 6px; }
  .tableau tr:first-child { border-top: 0; }
  .tableau td { border: 0; padding: 4px 12px; }
  .journal li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .ligne-partie { grid-template-columns: 20px minmax(0, 1fr); }
  .ligne-partie .quand, .ligne-partie .duree { grid-column: 2; }
  .navigation-parties { flex-direction: column-reverse; }
  .navigation-parties .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ==========================================================================
   Version 1.1 — texte de base en blocs, lecteur A–B et mot par mot.
   Mise en page et fonctionnement repris d'exercices-arabe (style.css,
   « lecteur audio synchronisé ») ; seules les couleurs sont celles de l'institut.
   ========================================================================== */
.scene h3 small { font-size: 12px; color: var(--orange-ink); font-weight: 500; }
.cue { display: grid; grid-template-columns: 108px minmax(0, 1fr); border: 1px solid var(--line); border-radius: 18px; margin-bottom: 14px; background: #fff; transition: background .2s, box-shadow .2s; }
.cue-side { border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 18px 8px; }
.cue-side .tc { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--gold-ink); font-weight: 500; }
.tc.sautable { background: none; border: 0; cursor: pointer; padding: 2px 4px; border-radius: 6px; font: 500 13px var(--ui); color: var(--gold-ink); font-variant-numeric: tabular-nums; }
.tc.sautable:hover { color: var(--orange-ink); text-decoration: underline; }
.play { width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; background: var(--teal-deep); display: grid; place-items: center; transition: transform .12s, background .15s; }
.play:hover:not(:disabled) { background: var(--teal); transform: scale(1.05); }
.play svg { width: 15px; height: 15px; fill: #fff; }
.play.on { background: var(--gold); }
.play.on svg { fill: var(--ink); }
.rate { font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--muted); background: var(--sand); border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; cursor: pointer; }
.rate:hover:not(:disabled) { border-color: var(--gold); color: var(--gold-ink); }
.cue-side .repeat, .cue-side .adjust { font-size: 12px; display: block; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; }
.cue-side .repeat:hover:not(:disabled), .cue-side .adjust:hover:not(:disabled) { border-color: var(--teal); background: var(--teal-wash); }
.cue-side .repeat.on { background: var(--teal-deep); color: #fff; border-color: var(--teal-deep); }
.cue-side button:disabled { opacity: .42; cursor: not-allowed; }
.cue-body { padding: 18px 26px 20px; min-width: 0; }
.cue-role { display: inline-flex; gap: 5px; align-items: baseline; font-size: 12.5px; font-weight: 500; padding: 2px 11px 4px; border-radius: 999px; }
.cue-role [lang=ar] { font-family: var(--ar); font-size: 15px; }
.cue-role.l0 { background: var(--teal-wash); color: var(--teal-ink); }
.cue-role.l1 { background: var(--orange-wash); color: var(--orange-ink); }
.cue-body .ar { font-size: 29px; line-height: 2.1; text-align: right; color: var(--ink); }
.cue-body .fr { font-size: 15px; color: var(--muted); line-height: 1.6; margin-top: 10px; padding-top: 12px; border-top: 1px dashed var(--line); }
.cue.selected { outline: 2px solid var(--gold); outline-offset: -2px; }
.cue.lit { background: #FFFAEE; box-shadow: inset 4px 0 0 var(--gold); }
.cue.lit .tc { color: var(--orange-ink); font-weight: 700; }
.cue-body .ar .w.dit { background: var(--gold); color: var(--ink); border-radius: 6px; box-shadow: 0 0 0 3px var(--gold); }

/* tous les mots sont cliquables ; les mots du vocabulaire de la leçon restent soulignés */
.w { cursor: pointer; border-radius: 5px; padding: 0 1px; transition: background .12s; }
.w:hover, .w.choisi { background: var(--gold-wash); }
.w.choisi { box-shadow: 0 0 0 1px var(--gold) inset; }
.w.mot-lecon { text-decoration: underline dotted var(--gold); text-decoration-thickness: 2px; text-underline-offset: 10px; }

/* barre de lecture */
.audiowrap { margin: 0 0 26px; }
.audiobar { display: flex; align-items: center; gap: 10px; background: var(--teal-deep); color: #fff; border-radius: 16px; padding: 10px 14px; box-shadow: 0 8px 22px -10px rgba(14, 71, 65, .55); }
.audiobar button { background: transparent; border: 0; color: #fff; font: 600 13px var(--ui); cursor: pointer; padding: 6px 9px; border-radius: 9px; flex: none; line-height: 1; }
.audiobar button:hover:not(:disabled) { background: rgba(255, 255, 255, .12); }
.audiobar button:disabled { cursor: not-allowed; }
.audiobar .ab-play { background: var(--gold); color: var(--ink); width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; padding: 0; }
.audiobar .ab-play:hover:not(:disabled) { background: #F8C66A; }
.audiobar .ab-play svg { width: 17px; height: 17px; fill: currentColor; }
.audiobar .ab-mid { flex: 1; min-width: 0; }
.ab-rail { display: block; width: 100%; height: 12px; margin: 0; accent-color: var(--gold); }
.ab-time { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; color: rgba(255, 253, 248, .72); margin-top: 4px; font-variant-numeric: tabular-nums; }
.ab-cue { color: var(--gold); font-weight: 600; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-rate { min-width: 55px; }
.ab-suivi { opacity: .45; font-size: 15px !important; }
.ab-suivi.on { opacity: 1; color: var(--gold) !important; }
.audiobar.flottante { position: fixed; left: 50%; transform: translateX(-50%) translateY(120%); bottom: max(14px, env(safe-area-inset-bottom)); width: min(660px, calc(100vw - 24px)); z-index: 45; opacity: 0; pointer-events: none; transition: transform .25s ease, opacity .25s ease; }
.audiobar.flottante.visible { transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto; }
@media (min-width: 861px) { .audiobar.flottante { left: calc(50% + var(--rail) / 2); } }
.audiowrap.en-attente .audiobar > *:not(.ab-mid), .audiowrap.en-attente .ab-rail { opacity: .45; }

/* écouter un passage et le répéter */
.repeat-box { padding: 18px 20px; background: #fff; border: 1px solid var(--line); border-radius: 16px; margin-top: 12px; }
.repeat-box strong { font-size: 16px; font-weight: 600; }
.repeat-note { font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.repeat-row { display: flex; align-items: flex-end; gap: 10px 12px; flex-wrap: wrap; margin: 12px 0; }
.repeat-box label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.repeat-box input { width: 110px; }
.repeat-box input, .repeat-box select { padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; min-height: 42px; font-size: 15px; }
.repeat-box button { padding: 9px 13px; min-height: 42px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); cursor: pointer; font-size: 14px; }
.repeat-box button:hover:not(:disabled) { border-color: var(--teal); background: var(--teal-wash); }
.repeat-box .primary { background: var(--teal-deep); color: #fff; border-color: var(--teal-deep); }
.repeat-box .primary:hover:not(:disabled) { background: var(--teal); color: #fff; }
.repeat-box button:disabled, .repeat-box input:disabled, .repeat-box select:disabled { opacity: .5; cursor: not-allowed; }
.repeat-status { min-height: 1.5em; font-size: 14px; color: var(--teal-ink); font-weight: 500; }
.audiowrap.en-attente .repeat-status { color: var(--orange-ink); }

/* cartouches d'aide */
.helpers { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }
.helper { display: flex; gap: 14px; align-items: flex-start; background: var(--sand); border-radius: 16px; padding: 16px 18px; }
.helper .ic { width: 42px; height: 42px; border-radius: 50%; background: var(--paper); display: grid; place-items: center; flex: none; }
.helper .ic svg { width: 20px; height: 20px; stroke: var(--gold-ink); }
.helper h4 { margin: 0; font-size: 14.5px; font-weight: 600; }
.helper p { font-size: 13.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }

/* tournures : traduction exacte sous l'arabe */
.tournure .phrase { min-width: 0; }
.tournure .trad { font-size: 15.5px; color: var(--ink); text-align: right; margin-top: 2px; }

/* questions des lectures complémentaires */
.qcm { background: var(--sand); border-radius: var(--r-card); padding: 20px 22px; margin: -8px 0 32px; }
.qcm h4 { margin: 0 0 2px; font-size: 16px; color: var(--teal-ink); }
.qcm .consigne { font-size: 14px; color: var(--muted); }
.question { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px 18px 12px; margin-top: 12px; }
.q-ar { font-family: var(--ar); direction: rtl; font-size: 25px; line-height: 2; text-align: right; }
.q-ar .num { font-family: var(--ui); font-size: 15px; color: var(--muted); margin-left: 6px; unicode-bidi: isolate; }
.q-fr { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.choix { display: grid; gap: 8px; }
.choix-btn { font-family: var(--ar); direction: rtl; text-align: right; font-size: 22px; line-height: 1.8; padding: 6px 16px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); cursor: pointer; transition: border-color .15s, background .15s; }
.choix-btn:hover:not(:disabled):not(.faux) { border-color: var(--teal); background: var(--teal-wash); }
.choix-btn.faux { border-color: var(--err); background: var(--err-wash); color: var(--err); cursor: default; }
.choix-btn.juste { border-color: #1B7A5A; background: #E6F4EC; color: #145C43; }
.choix-btn:disabled { cursor: default; }
.question.finie .choix-btn:not(.juste):not(.faux) { opacity: .5; }
.q-pied { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; min-height: 30px; flex-wrap: wrap; }
.resultat { font-size: 14px; font-weight: 600; }
.resultat.ok { color: #145C43; }
.resultat.non { color: var(--err); }
.resultat.montre { color: var(--gold-ink); }
.qcm-pied { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.qcm-score { font-size: 14px; font-weight: 500; }

@media (max-width: 640px) {
  .cue { grid-template-columns: 76px minmax(0, 1fr); }
  .cue-side { padding: 14px 4px; gap: 8px; }
  .play { width: 40px; height: 40px; }
  .cue-side .repeat, .cue-side .adjust { font-size: 11px; padding: 7px 5px; white-space: normal; text-align: center; line-height: 1.25; }
  .cue-body { padding: 12px 14px 14px; }
  .cue-body .ar { font-size: 24px; line-height: 2; }
  .helpers { grid-template-columns: 1fr; }
  .audiobar { gap: 6px; padding: 9px 10px; }
  .audiobar .ab-back { display: none; }
  .repeat-box { padding: 14px; }
  .repeat-row label { flex: 1 1 130px; }
  .repeat-box input { width: 100%; }
  .qcm { padding: 16px 14px; }
  .question { padding: 10px 12px; }
  .q-ar { font-size: 22px; }
  .choix-btn { font-size: 20px; padding: 6px 12px; }
}

/* ==========================================================================
   Version 2.0 — règles, exercices, évaluation, bilan, devoirs, abonnements
   ========================================================================== */
.erreur { color: var(--err); }
.entrainement { font-size: 18px; margin: 34px 0 6px; }
.rappel-revision { margin-bottom: 22px; background: var(--orange-wash); }
.rappel-revision a { margin-left: 8px; font-weight: 600; color: var(--orange-ink); }

/* exercices */
.ex-entete { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; font-size: 14px; }
.ex-entete .compteur { font-weight: 600; color: var(--teal-ink); background: var(--teal-wash); padding: 5px 12px; border-radius: 999px; }
.note-eval { font-weight: 600; color: var(--orange-ink); }
.exercice { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 14px 20px 12px; margin-bottom: 14px; transition: border-color .2s; }
.exercice.finie { border-color: #BFDCCD; }
.exercice header { display: flex; gap: 10px; align-items: baseline; }
.exercice .num { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--sand); display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--muted); }
.exercice.finie .num { background: #E6F4EC; color: #145C43; }
.ex-consigne { font-size: 14px; color: var(--muted); }
.ex-ar { font-family: var(--ar); direction: rtl; text-align: right; font-size: 26px; line-height: 2; margin: 4px 0 2px; }
.ex-mot-fr, .ex-consigne-fr { font-size: 17px; font-weight: 600; margin: 8px 0 6px; }
.ex-image { margin: 10px 0 12px; position: relative; max-width: 420px; }
.ex-image img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); background: var(--sand); }
.ex-image figcaption { position: absolute; left: 10px; bottom: 10px; font-size: 12px; font-weight: 600; background: rgba(255, 253, 248, .92); padding: 3px 10px; border-radius: 999px; }
.ex-image figcaption:empty { display: none; }
.choix.fr .choix-btn { font-family: var(--ui); direction: ltr; text-align: left; font-size: 16px; line-height: 1.5; padding: 10px 16px; }
.choix.deux { grid-template-columns: 1fr 1fr; }
.vf-fr { font-family: var(--ui); font-size: 13px; color: var(--muted); }
.choix-btn.juste .vf-fr, .choix-btn.faux .vf-fr { color: inherit; }
.ex-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.ex-aide { font-size: 14px; color: var(--muted); }
.ex-ecrire { display: block; margin-top: 8px; }
.ex-ecrire span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.ex-ecrire textarea { width: 100%; font-family: var(--ar); font-size: 22px; line-height: 1.8; padding: 8px 14px; border: 1.5px solid var(--line); border-radius: 12px; resize: vertical; }
.ex-modele { margin-top: 12px; padding: 10px 16px; border-radius: 14px; background: var(--teal-wash); }
.ex-modele .etiquette { font-size: 12px; font-weight: 600; color: var(--teal-ink); }
.montage { min-height: 58px; border: 1.5px dashed var(--line); border-radius: 14px; padding: 6px 16px; font-family: var(--ar); font-size: 24px; line-height: 2; text-align: right; background: var(--paper); margin: 8px 0; }
.montage.juste { border-style: solid; border-color: #1B7A5A; background: #E6F4EC; color: #145C43; }
.montage.faux { border-style: solid; border-color: var(--err); background: var(--err-wash); }
.jetons { display: flex; flex-wrap: wrap; gap: 8px; direction: rtl; }
.jeton { font-family: var(--ar); font-size: 22px; line-height: 1.6; padding: 4px 16px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; }
.jeton:hover:not(:disabled) { border-color: var(--teal); background: var(--teal-wash); }
.jeton.pris { opacity: .3; }
.fin-partie { margin-top: 20px; padding: 18px 22px; border-radius: 18px; background: var(--teal-wash); }
.fin-partie h3 { margin-bottom: 4px; color: var(--teal-ink); }

/* relier par un trait */
.relier { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 16px 56px; }
.relier .col { display: flex; flex-direction: column; gap: 10px; position: relative; z-index: 2; }
.relier .traits { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; overflow: visible; pointer-events: none; }
.trait { fill: none; stroke-width: 3; stroke-linecap: round; }
.trait.juste { stroke: #1B7A5A; }
.trait.faux { stroke: var(--err); stroke-dasharray: 6 6; }
.pastille-q, .pastille-r { font-family: var(--ar); font-size: 19px; line-height: 1.7; text-align: right; padding: 8px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; min-height: 52px; }
.pastille-q.choisie { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-wash); }
.pastille-q.juste, .pastille-r.juste { border-color: #1B7A5A; background: #E6F4EC; color: #145C43; }
.pastille-q:hover:not(:disabled), .pastille-r:hover { border-color: var(--teal); }
.pastille-r.secoue { border-color: var(--err); background: var(--err-wash); animation: secoue .35s; }
@keyframes secoue { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.relier-aide { font-size: 13.5px; color: var(--muted); margin-top: 10px; }

/* schémas des règles */
.schema { background: #fff; border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px 22px; margin-bottom: 20px; }
.schema-titre { font-size: 15px; margin-bottom: 6px; }
.schema-titre [lang=ar] { font-family: var(--ar); font-size: 30px; color: var(--teal-ink); }
.schema-titre small { font-size: 13px; color: var(--muted); font-weight: 400; }
.schema-explication { color: var(--ink); margin-bottom: 14px; max-width: 64ch; }
.ar-inline { font-family: var(--ar); font-size: 1.25em; color: var(--teal-ink); }
.objets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.objet, .plan { position: relative; border: 2px solid var(--line); border-radius: 16px; padding: 0; overflow: hidden; background: var(--sand); cursor: pointer; }
.objet img, .plan img, .mt-item img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.objet.actif, .plan.actif { border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-wash); }
.objet .rayon { position: absolute; left: 50%; bottom: 0; width: 4px; height: 0; background: var(--gold); border-radius: 4px; transition: height .3s; }
.objet.actif .rayon { height: 34%; }
.phrase-schema { text-align: center; margin: 16px 0 4px; padding: 10px; border-radius: 14px; background: var(--paper); }
.ar-grand { font-family: var(--ar); font-size: 32px; line-height: 1.9; direction: rtl; }
.fr-petit { font-size: 14px; color: var(--muted); }
.mise { color: var(--orange-ink); background: var(--gold-wash); border-radius: 8px; padding: 0 6px; }
.mise.loin { color: var(--teal-ink); background: var(--teal-wash); }
.profondeur { display: grid; grid-template-columns: 1fr 1.6fr; gap: 14px; align-items: end; }
.plan.loin img { aspect-ratio: 4 / 3; filter: saturate(.8); }
.plan.loin { transform: scale(.88); transform-origin: bottom right; }
.repere { position: absolute; left: 8px; top: 8px; font-size: 12px; font-weight: 600; background: rgba(255, 253, 248, .92); padding: 2px 10px; border-radius: 999px; }
.mini-test-titre { font-size: 15px; margin: 22px 0 10px; }
.mini-test { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.mt-item { position: relative; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--paper); }
.mt-item.loin img { transform: scale(.82); transform-origin: center 70%; }
.mt-choix { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px; }
.mt-choix button { font-family: var(--ar); font-size: 20px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; padding: 2px 0; }
.mt-choix button.juste { border-color: #1B7A5A; background: #E6F4EC; }
.mt-choix button.faux { border-color: var(--err); background: var(--err-wash); }
.mt-res { font-family: var(--ar); font-size: 20px; text-align: center; min-height: 1.6em; padding-bottom: 6px; color: #145C43; }
.paires { display: grid; gap: 14px; }
.paire { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
.carte-n, .carte-m { position: relative; border: 1.5px solid var(--line); border-radius: 16px; padding: 10px 14px 14px; text-align: center; background: var(--paper); min-height: 120px; }
.carte-m { opacity: .35; transition: opacity .35s, border-color .35s; }
.paire.montre .carte-m { opacity: 1; border-color: var(--teal); background: var(--teal-wash); }
.etiq { display: block; font-family: var(--ar); font-size: 15px; color: var(--muted); }
.mot-g { display: block; font-family: var(--ar); font-size: 34px; line-height: 1.8; }
.al-mis { color: var(--orange-ink); transition: background .35s; border-radius: 6px; }
.paire.montre .al-mis { background: var(--gold-wash); }
.pile { display: flex; gap: 4px; justify-content: center; }
.pile i { width: 18px; height: 22px; border-radius: 3px; background: var(--sand-2); }
.pile.un i { background: var(--teal); width: 22px; }
.jarr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.jarr-ex { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--paper); }
.jarr-ex img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.jarr-phrase { position: relative; padding: 26px 14px 10px; text-align: center; }
.jarr-phrase .fr-petit { direction: ltr; }
.fleche { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.harf { font-family: var(--ar); font-size: 32px; line-height: 1.6; border: 2px dashed var(--orange); border-radius: 10px; background: var(--orange-wash); color: var(--orange-ink); padding: 0 8px; cursor: pointer; }
.jarr-phrase.actif .harf { border-style: solid; }
.jarr-phrase.actif .kasra { color: var(--orange-ink); background: var(--gold-wash); border-radius: 6px; }

/* évaluation et bilan */
.eval-accueil { background: #fff; border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px 22px; }
.eval-accueil .btn { margin-top: 14px; }
.eval-accueil h3, .bilan h3 { font-size: 16px; margin: 24px 0 10px; }
.historique { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.historique li { background: var(--sand); border-radius: 999px; padding: 5px 12px; font-size: 14px; }
.bil-ligne { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--sand-2); font-size: 14px; }
.bil-barre { position: relative; height: 10px; border-radius: 999px; background: var(--sand-2); overflow: hidden; }
.bil-barre i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; }
.bil-barre .faits { background: var(--teal); }
.bil-barre .premier { background: var(--orange); }
.bil-chiffres { color: var(--muted); white-space: nowrap; }
.bil-erreurs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bil-erreur { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--err); border-radius: 14px; padding: 10px 16px; font-size: 14px; }
.bil-erreur.corrigee { border-left-color: var(--gold); }
.bil-erreur .ar { font-size: 22px; line-height: 1.9; text-align: right; }
.bil-partie { font-size: 12px; font-weight: 600; color: var(--muted); }
.bil-faux { color: var(--err); }
.bil-bonne { color: #145C43; }
.bil-faux [lang=ar], .bil-bonne [lang=ar] { font-family: var(--ar); font-size: 19px; }
.bil-etat { font-size: 12px; color: var(--muted); }
.bil-vide { color: var(--muted); }

/* espace professeur et formule */
.outils-prof { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 18px; }
.form-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; align-items: end; }
.form-grille .champ { margin: 0; }
.carte-blanche { background: #fff; border: 1px solid var(--line); border-radius: var(--r-card); padding: 18px 22px; margin-bottom: 18px; }
.carte-blanche h2 { font-size: 18px; margin-bottom: 10px; }
.liste-simple { list-style: none; margin: 0; padding: 0; }
.liste-simple li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--sand-2); font-size: 14px; }
.statut { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--sand); }
.statut.fait, .statut.valide, .statut.actif { background: #E6F4EC; color: #145C43; }
.statut.declare, .statut.attente, .statut.a_faire { background: var(--gold-wash); color: var(--gold-ink); }
.statut.refuse, .statut.suspendu { background: var(--err-wash); color: var(--err); }
.iban { font-family: ui-monospace, monospace; letter-spacing: .04em; background: var(--sand); padding: 6px 10px; border-radius: 8px; word-break: break-all; }
.devoir a { font-weight: 600; }
.verrou { padding: 18px 22px; border-radius: var(--r-card); background: var(--orange-wash); margin-bottom: 18px; }

@media (max-width: 640px) {
  .exercice { padding: 12px 14px; }
  .ex-ar { font-size: 23px; }
  .choix.deux { grid-template-columns: 1fr; }
  .relier { gap: 10px 26px; }
  .pastille-q, .pastille-r { font-size: 16px; padding: 6px 8px; }
  .objets { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .profondeur { grid-template-columns: 1fr 1.3fr; gap: 8px; }
  .mini-test { grid-template-columns: 1fr 1fr; }
  .paire { grid-template-columns: 1fr; }
  .paire .al { justify-self: center; }
  .jarr { grid-template-columns: 1fr; }
  .bil-ligne { grid-template-columns: minmax(0, 1fr) auto; }
  .bil-ligne .bil-barre { grid-column: 1 / -1; grid-row: 2; }
  .bil-erreur { flex-direction: column; }
}

/* ==========================================================================
   Version 2.1 — suivi du professeur et dialogue avec l'élève, photos
   ========================================================================== */
@media (max-width: 1240px) and (min-width: 641px) {
  .entete { flex-wrap: wrap; row-gap: 4px; }
  .entete .liens { order: 3; width: 100%; margin-left: 0; overflow-x: auto; padding-bottom: 2px; }
}
.pastille.aide { background: var(--gold); color: var(--ink); }
/* présence en direct */
.direct { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; border-radius: 14px; background: var(--teal-wash); color: var(--teal-ink); font-size: 14px; margin: -8px 0 18px; }
.point-direct { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex-shrink: 0; margin-right: 6px; vertical-align: 1px; }
.point-direct.actif { background: #1B9A63; box-shadow: 0 0 0 4px rgba(27, 154, 99, .18); }
.en-ligne { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: #145C43; font-size: 14px; }
.en-ligne::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: #1B9A63; box-shadow: 0 0 0 3px rgba(27, 154, 99, .18); }
.activite-direct { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.tableau tr.est-en-ligne td:first-child { box-shadow: inset 4px 0 0 #1B9A63; }
.tableau td.presence { min-width: 150px; }
.groupe-chip { white-space: nowrap; display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 10px; border-radius: 999px; background: var(--sand); color: var(--ink); margin: 4px 6px 0 0; }
.reussite { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.reussite .barre { position: relative; width: 70px; height: 8px; border-radius: 999px; background: var(--sand-2); overflow: hidden; }
.reussite .barre i { position: absolute; inset: 0 auto 0 0; background: var(--orange); border-radius: 999px; }
.reussite.grand { font-size: 22px; }
.reussite.grand .barre { width: 140px; height: 10px; }
.reussite + small, .tableau td small.muted { display: block; font-size: 12px; }
.filtres { display: flex; gap: 12px 16px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filtres .champ { margin: 0; min-width: 200px; }
.filtres .champ input, .filtres .champ select { min-height: 44px; padding: 8px 14px; }
.champ.large { grid-column: 1 / -1; }
.champ textarea { min-height: 64px; resize: vertical; }
/* fenêtre « Modifier l'élève » */
dialog.fenetre { border: 0; border-radius: var(--r-card); padding: 24px 26px; width: min(460px, calc(100vw - 32px)); box-shadow: 0 30px 80px -30px rgba(18, 43, 54, .6); }
dialog.fenetre::backdrop { background: rgba(18, 43, 54, .45); }
dialog.fenetre h2 { margin-bottom: 16px; }
/* messagerie centralisée */
.boite { display: grid; grid-template-columns: 320px minmax(0, 1fr); background: #fff; border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; min-height: 520px; }
.conversations { border-right: 1px solid var(--line); background: var(--paper); overflow-y: auto; max-height: 72vh; }
.conv-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; padding: 13px 16px; border-bottom: 1px solid var(--sand-2); text-decoration: none; color: inherit; }
.conv-item:hover { background: #FFFBF2; }
.conv-item.ici { background: var(--teal-wash); }
.conv-nom { font-weight: 600; display: flex; align-items: center; gap: 4px; min-width: 0; }
.conv-groupe { grid-column: 2; grid-row: 1; font-size: 11px; color: var(--muted); align-self: center; }
.conv-dernier { grid-column: 1 / -1; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-quand { grid-column: 1 / -1; font-size: 11px; color: var(--muted); }
.conv-sans, .conv-pad { padding: 14px 16px; font-size: 13px; color: var(--muted); }
.conversation { display: flex; flex-direction: column; padding: 16px 20px 18px; min-width: 0; }
.conversation .fil { flex: 1; max-height: 60vh; }
.conv-tete { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.conv-tete h2 { font-size: 19px; margin-right: auto; }
.retour-convs { display: none; flex-basis: 100%; }
.conv-vide { margin: auto; text-align: center; color: var(--muted); max-width: 300px; }
.etiquette-lecon { display: inline-block; font-size: 11px; font-weight: 600; color: var(--orange-ink); background: var(--orange-wash); border-radius: 999px; padding: 1px 8px; margin-bottom: 6px; }
.bulle .etiquette-lecon { display: table; }
/* devoirs */
.form-devoir fieldset { border: 0; padding: 0; margin: 0 0 14px; }
.form-devoir legend { font-size: 14px; font-weight: 500; margin-bottom: 8px; padding: 0; }
.type-devoir { display: grid; gap: 8px; }
.type-devoir label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; font-size: 14px; }
.type-devoir label:has(input:checked) { border-color: var(--teal); background: var(--teal-wash); }
.type-devoir input { margin-top: 4px; accent-color: var(--teal); }
.destinataires { margin-top: 14px !important; }
.outils-dest { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.outils-dest select { min-height: 38px; padding: 6px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; }
.cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 14px; max-height: 260px; overflow-y: auto; padding: 4px 2px; }
.cases label { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.cases input { accent-color: var(--teal); width: 17px; height: 17px; }
.form-devoir .btn[type=submit] { margin-top: 6px; }
.type-ecrit, .type-ligne { display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 6px; background: var(--gold-wash); color: var(--gold-ink); margin-right: 4px; }
.type-ligne { background: var(--teal-wash); color: var(--teal-ink); }
.consigne-ecrit { display: block; color: var(--ink); white-space: pre-wrap; margin-top: 4px; }
.note-aide { display: block; margin-top: 6px; padding: 8px 12px; border-radius: 10px; background: var(--gold-wash); color: var(--gold-ink); font-size: 14px; }
.ecrit-ligne > span:first-child { flex: 1 1 380px; }
.statut.aide { background: var(--gold); color: var(--ink); }
.mini-onglets { margin: 0; border: 0; gap: 2px; }
.mini-onglets a { padding: 6px 12px; font-size: 14px; }
.cartes-devoirs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.carte-devoir { background: #fff; border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.carte-devoir.aide { border-color: var(--gold); }
.carte-devoir.fait { background: var(--paper); }
.carte-devoir-tete { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.carte-devoir h3 { font-size: 17px; }
.carte-devoir .outils-prof { margin: 6px 0 0; }
.aide-form { margin-top: 6px; }
details.faits { margin-top: 26px; }
details.faits > summary { cursor: pointer; font-weight: 600; margin-bottom: 14px; }
/* séances */
.bandeau-photo { position: relative; min-height: 210px; border-radius: var(--r-card); background: var(--teal-deep) center 60% / cover no-repeat; display: flex; align-items: flex-end; overflow: hidden; margin-bottom: 22px; }
.bandeau-photo::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(14, 71, 65, .05) 20%, rgba(14, 71, 65, .85)); }
.bandeau-photo > div { position: relative; padding: 22px 26px; color: var(--paper); max-width: 640px; }
.bandeau-photo p { color: rgba(255, 253, 248, .85); margin-top: 6px; }
.titre-bloc { font-size: 19px; margin: 26px 0 12px; }
.cartes-seances { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.carte-seance { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--orange); border-radius: var(--r-card); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.carte-seance.passee { border-left-color: var(--line); opacity: .85; }
.quand-seance { font-size: 14px; font-weight: 600; color: var(--orange-ink); }
.carte-seance h3 { font-size: 17px; }
.lieu-seance { font-size: 14px; overflow-wrap: anywhere; }
.details-seance { font-size: 14px; color: var(--muted); white-space: pre-wrap; }
.reponses-seance { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.reponse-actuelle { font-size: 14px; color: var(--teal-ink); }
.repondre-seance.choisi { box-shadow: 0 0 0 3px var(--gold-wash); }
.carte-seance .outils-prof { margin: 4px 0 0; }
.carte-seance .lien { align-self: flex-start; }
/* résultats */
.tableau.resultats td { vertical-align: top; }
.erreurs-res summary { cursor: pointer; color: var(--err); font-weight: 600; font-size: 13px; margin-top: 4px; }
.err-res { border-left: 3px solid var(--err); padding: 4px 0 4px 10px; margin: 8px 0; font-size: 13px; }
.err-res .ar { font-size: 20px; line-height: 1.8; text-align: right; }
.resume-reussite { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
/* question au professeur depuis une partie de leçon */
.question-prof { max-width: 820px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 34px; padding: 14px 18px; border-radius: 16px; background: var(--sand); font-size: 15px; }
/* photos : vocabulaire, lectures, règle حُرُوفُ الْجَرِّ */
.carte-mot.avec-photo { position: relative; padding-left: 112px; min-height: 118px; }
.photo-mot { position: absolute; left: 12px; top: 12px; width: 88px; height: calc(100% - 24px); max-height: 120px; border-radius: 12px; object-fit: cover; background: var(--sand); }
.photo-lecture { width: calc(100% + 52px); max-width: none; margin: -22px -26px 16px; height: 190px; object-fit: cover; border-radius: var(--r-card) var(--r-card) 0 0; }
.bandeau-regle { width: 100%; aspect-ratio: 1280 / 418; object-fit: cover; border-radius: 16px; margin: 0 0 16px; border: 1px solid var(--line); }
@media (max-width: 860px) {
  .boite { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .conversations { border-right: 0; max-height: none; }
  .boite.avec-fil .conversations { display: none; }
  .boite:not(.avec-fil) .conversation { display: none; }
  .retour-convs { display: inline-block; }
}
@media (max-width: 640px) {
  .tableau td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
  .filtres .champ { min-width: 0; flex: 1 1 100%; }
  .photo-lecture { width: calc(100% + 36px); margin: -18px -18px 14px; height: 150px; }
  .bandeau-photo { min-height: 170px; }
  .bandeau-photo > div { padding: 18px; }
  .cartes-devoirs, .cartes-seances { grid-template-columns: minmax(0, 1fr); }
  .resume-reussite { align-items: flex-start; }
  .question-prof { flex-direction: column; align-items: stretch; }
}
.ex-entete .refaire { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }
