/* style.v1.css — Compagnon du Hifz — Lot 0
   Sobre et respectueux (CDC 1.2), contraste élevé, gros caractères.
   Police arabe : Amiri en sous-ensemble à partir du Lot 1
   (voir outils/sous_ensemble_police.sh) ; en attendant, pile système. */

:root {
  --fond: #0b1020;
  --carte: #141b33;
  --bord: #26304f;
  --texte: #eef2ff;
  --attenue: #9fb0d8;
  --or: #d4a92c;
  --vert: #3fae6a;
  --rouge: #d06060;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--fond);
  color: var(--texte);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.55;
}

.entete { text-align: center; padding: 2rem 1rem 1rem; }
.entete h1 { color: var(--or); font-size: 2rem; margin: 0 0 .3rem; }
.sous-titre { color: var(--attenue); margin: 0; }

.contenu { max-width: 860px; margin: 0 auto; padding: 1rem; }

.carte {
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  margin: 1rem 0;
}
.carte h2 { margin-top: 0; font-size: 1.2rem; }

.alerte {
  background: #3a2d10;
  border: 1px solid var(--or);
  color: #f5dfa0;
  border-radius: 10px;
  padding: .8rem 1rem;
  margin: 1rem 0;
}

.cachee { display: none; }

/* Onglets connexion / inscription */
.onglets { display: flex; gap: .5rem; margin-bottom: 1rem; }
.onglet {
  flex: 1;
  background: transparent;
  border: 1px solid var(--bord);
  color: var(--attenue);
  border-radius: 8px;
  padding: .55rem;
  font: inherit;
  cursor: pointer;
}
.onglet.actif { border-color: var(--or); color: var(--or); }

form label { display: block; margin: .7rem 0; }
.indice { color: var(--attenue); font-size: .85rem; }

input {
  display: block;
  width: 100%;
  margin-top: .3rem;
  padding: .6rem .7rem;
  font-size: 1.05rem;
  color: var(--texte);
  background: var(--fond);
  border: 1px solid var(--bord);
  border-radius: 8px;
}
input:focus { outline: 2px solid var(--or); border-color: var(--or); }

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--bord);
  background: var(--carte);
  color: var(--texte);
  padding: .6rem 1.1rem;
}
button.principal {
  background: var(--or);
  border-color: var(--or);
  color: #221a03;
  font-weight: bold;
  width: 100%;
  margin-top: .6rem;
}
button:focus-visible { outline: 3px solid var(--or); outline-offset: 2px; }

.message { min-height: 1.4em; }
.message.ok { color: var(--vert); }
.message.erreur { color: var(--rouge); }

/* Les trois boîtes Sabaq / Sabqi / Manzil */
.trois-cartes { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .trois-cartes { grid-template-columns: repeat(3, 1fr); }
}
.boite { text-align: center; margin: 0; }
.boite h3 { margin: 0 0 .4rem; color: var(--or); }
.ar { font-size: 1.7rem; margin: .2rem 0; }

/* Liste des niveaux */
.niveaux { padding-left: 1.4rem; margin: 0; }
.niveaux li { margin: .45rem 0; }
.niveaux .verrou { color: var(--attenue); }

.pied {
  text-align: center;
  color: var(--attenue);
  font-size: .85rem;
  padding: 1.5rem 1rem 2rem;
}

/* Accessibilité : préférence de réduction des animations respectée
   d'office (aucune animation en Lot 0). Contraste AA vérifié. */

/* ============ v2 — Lot 1 : police Amiri + exercices ============ */

@font-face {
  font-family: "Amiri Hifz";
  src: url("../polices/amiri-hifz.v1.woff2") format("woff2");
  font-display: swap;
}

.ar { font-family: "Amiri Hifz", "Amiri", "Traditional Arabic", serif; }

/* Vues */
#vue-exercice { max-width: 860px; margin: 0 auto; }

.exercice { padding: 0 .2rem; }
.ex-entete h2 { margin: .2rem 0; }
.ex-entete .lien { margin-bottom: .4rem; }

.lien {
  background: none; border: none; color: var(--attenue);
  cursor: pointer; padding: .2rem 0; font: inherit; text-decoration: underline;
}
.a-valider {
  color: #f5dfa0; background: #3a2d10; border: 1px solid var(--or);
  border-radius: 8px; padding: .35rem .6rem; font-size: .85rem; display: inline-block;
}

.basmala { text-align: center; font-size: 1.6rem; color: var(--or); margin: .6rem 0 .2rem; }

.verset-cadre {
  background: var(--carte); border: 1px solid var(--bord); border-radius: 12px;
  padding: 1.2rem 1.4rem; margin: .8rem 0; min-height: 6rem;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
}
.verset { font-size: 2.1rem; line-height: 2.2; text-align: center; margin: 0; }
@media (max-width: 640px) { .verset { font-size: 1.7rem; } }

.num-verset { color: var(--or); font-size: 1.3rem; }
.voile { color: var(--attenue); letter-spacing: .3em; }
.aide { color: var(--attenue); text-align: center; margin: .4rem 0 0; }

.centre { text-align: center; }
.consigne { font-size: 1.1rem; color: var(--or); min-height: 1.5em; }

.ex-boutons { display: flex; gap: .6rem; justify-content: center; margin: .8rem 0; flex-wrap: wrap; }
.principal-inline {
  background: var(--or); border-color: var(--or); color: #221a03; font-weight: bold;
  padding: .7rem 1.6rem; font-size: 1.05rem;
}

.ex-reglages {
  display: flex; gap: 1rem; justify-content: center; align-items: center;
  flex-wrap: wrap; color: var(--attenue); font-size: .95rem;
}
.ex-reglages select {
  margin-left: .3rem; background: var(--fond); color: var(--texte);
  border: 1px solid var(--bord); border-radius: 6px; padding: .25rem .4rem; font: inherit;
}

.barre-progression {
  height: 8px; background: var(--fond); border: 1px solid var(--bord);
  border-radius: 6px; overflow: hidden; margin: .6rem 0;
}
#mem-barre { height: 100%; width: 0; background: var(--or); transition: width .3s; }

/* Pastilles de sourates dans les niveaux */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0 .2rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .7rem; border-radius: 999px; font-size: .95rem;
}
.chip:hover { border-color: var(--or); color: var(--or); }
.chip .etat { color: var(--or); }
.ok { color: var(--vert); }

/* ============ v3 — Lot 2 : texte à trous, ordre des versets, badges ==== */

@font-face {
  font-family: "Amiri Hifz v2";
  src: url("../polices/amiri-hifz.v2.woff2") format("woff2");
  font-display: swap;
}
.ar { font-family: "Amiri Hifz v2", "Amiri Hifz", "Amiri", "Traditional Arabic", serif; }

/* Texte à trous */
.trou {
  display: inline-block; min-width: 2.2em; text-align: center;
  border-bottom: 2px dashed var(--or); color: var(--or);
}
.revele { color: var(--vert); border-bottom: 2px solid var(--vert); }
.choix {
  font-size: 1.4rem; padding: .6rem 1.2rem; border-radius: 10px;
  min-width: 6rem;
}
.choix.bon { border-color: var(--vert); color: var(--vert); }
.choix.doux { border-color: var(--rouge); color: var(--rouge); opacity: .8; }

/* Ordre des versets */
.cartes { display: flex; flex-direction: column; gap: .55rem; margin: .8rem 0; }
.carte-verset {
  text-align: center; font-size: 1.35rem; line-height: 1.9;
  padding: .7rem .9rem; border-radius: 10px; border: 1px solid var(--bord);
  background: var(--carte); color: var(--texte); cursor: pointer;
}
.carte-verset.choisi { border-color: var(--or); box-shadow: 0 0 0 2px var(--or); }
.carte-verset.bon { border-color: var(--vert); color: var(--vert); cursor: default; }

/* Badges de niveaux */
.zone-badges { display: flex; gap: .5rem; justify-content: center; margin: .4rem 0 0; }
.badge { font-size: 1.4rem; color: var(--attenue); }
.badge.gagne { filter: drop-shadow(0 0 4px var(--or)); }

/* ============ v4 — Lot 3 : trois cartes actives, auto-évaluation ====== */

@font-face {
  font-family: "Amiri Hifz v3";
  src: url("../polices/amiri-hifz.v3.woff2") format("woff2");
  font-display: swap;
}
.ar { font-family: "Amiri Hifz v3", "Amiri Hifz v2", "Amiri Hifz", "Amiri", serif; }

.boite .principal { margin-top: .6rem; }
.note-bien:hover  { border-color: var(--vert); color: var(--vert); }
.note-moyen:hover { border-color: var(--or); color: var(--or); }
.note-revoir:hover { border-color: var(--rouge); color: var(--rouge); }


/* ============ v5 — Lot 4 : mutashābihāt et attestation ============ */

.comparaison { margin: .8rem 0; }
.comparaison .ar { font-size: 1.4rem; text-align: center; }

#attestation { display: none; }

@media print {
  body > *:not(#attestation) { display: none !important; }
  #attestation { display: block !important; }
  body { background: white !important; color: #1a1a1a !important; }
  .att-cadre {
    border: 6px double #b8860b; margin: 6mm; padding: 14mm 10mm;
    text-align: center; font-family: Georgia, serif;
  }
  .att-basmala { font-size: 26pt; margin: 0 0 6mm; }
  .att-cadre h1 { font-size: 24pt; color: #b8860b; margin: 0 0 2mm; }
  .att-cadre h2 { font-size: 20pt; margin: 0 0 8mm; }
  .att-texte { font-size: 13pt; line-height: 1.6; }
  .att-nom {
    font-size: 22pt; font-weight: bold; margin: 6mm 0;
    border-bottom: 1px solid #b8860b; display: inline-block; padding: 0 12mm 2mm;
  }
  .att-note { font-size: 10pt; color: #555; margin-top: 10mm; }
  .att-pied { font-size: 10pt; color: #777; margin-top: 8mm; }
}


/* ============ v6 — index récapitulatif des sourates ============ */

.recap-parcours { color: var(--attenue); margin: .2rem 0 .6rem; text-align: center; }
.index-sourates {
  display: flex; flex-wrap: wrap; gap: .35rem; justify-content: center;
  margin: .4rem 0 1rem;
}
.puce-index {
  min-width: 2.4rem; padding: .3rem .4rem; border-radius: 8px;
  font-size: .9rem; text-align: center;
  border: 1px solid var(--bord); background: var(--fond); color: var(--attenue);
}
.puce-index:hover { border-color: var(--or); color: var(--or); }
.puce-index.p1 { border-color: var(--attenue); color: var(--texte); }
.puce-index.p2 { border-color: var(--or); color: var(--or); }
.puce-index.p3 { border-color: var(--or); color: var(--or); background: #2a2410; }
.puce-index.p4 { border-color: var(--vert); color: var(--vert); }

.onglets-exercices { flex-wrap: wrap; }
.onglets-exercices .onglet { flex: 1 1 40%; min-width: 9rem; }

/* Étude */
.etude-texte { font-size: 1.7rem; text-align: justify; }
.liste-translit { padding-left: 1.4rem; }
.liste-translit li { margin: .55rem 0; }
.translit { display: block; }
.mini-arabe { display: block; color: var(--attenue); font-size: 1.15rem; }
.basmala-tr { text-align: center; color: var(--or); font-style: italic; }
.lecon { font-size: 1.15rem; border-right: 3px solid var(--or); border-left: 3px solid var(--or);
         padding: .6rem 1rem; border-radius: 8px; background: #1a2140; }

/* ============ v7 — assiduité, rappel adulte, Quran AI ============ */
.ligne-assiduite { text-align: center; color: var(--or); margin: .2rem 0 .6rem; }
.rappel-adulte { display: flex; gap: 1rem; align-items: center; justify-content: space-between; }
.chat-fil { min-height: 14rem; max-height: 55vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: .6rem; padding: .5rem 0; }
.bulle { max-width: 85%; padding: .6rem .9rem; border-radius: 12px; line-height: 1.5; }
.bulle-question { align-self: flex-end; background: #2a2410; border: 1px solid var(--or); }
.bulle-reponse { align-self: flex-start; background: var(--carte); border: 1px solid var(--bord); white-space: pre-wrap; }
.chat-saisie { display: flex; gap: .5rem; margin-top: .5rem; }
.chat-saisie input { flex: 1; }

.bulle-erreur { border-color: var(--rouge) !important; color: #f0b9b9; }

.chat-fil-grand { min-height: 24rem; max-height: 68vh; }
.chat-actions { justify-content: flex-end; margin: 0; }
.bulle-reponse { max-width: 95%; font-size: 1.02rem; }
