/* ---------- page 1 : le son ---------- */
/* pas de justify-content:center ici : sur Safari iOS, un conteneur flex centré
   qui déborde devient partiellement inaccessible au défilement (bug connu du
   moteur). Centrage visuel par un padding haut à la place -- ça défile
   toujours correctement même quand le contenu dépasse l'écran (petit iPhone). */
#ecran-son .corps-page{ flex:1 1 auto; overflow-y:auto; display:flex; flex-direction:column; align-items:center; gap:30px; padding:24px 20px; }
.son-icone{ font-size:72px; line-height:1; }
.copain-grand{ position:relative; }
/* Médaillon plutôt qu'aplat plat : dégradé (lumière en haut à gauche,
   comme une pierre/céramique polie), anneau clair juste sous le bord
   (inset), ombre interne légère pour creuser le fond -- cohérent avec le
   thème "pigments de manuscrit" du reste de l'app. Couleurs posées par
   rendSon() via --c-fond/--c-clair/--c-bord (couleurLettre()). */
.copain-cercle{
  width:260px; height:260px; border-radius:50%; color:#fff; font-size:150px;
  display:flex; align-items:center; justify-content:center; padding-bottom:16px;
  border-width:7px; border-style:solid;
  background:radial-gradient(circle at 34% 28%, var(--c-clair, #fff) 0%, var(--c-fond, var(--accent)) 46%, var(--c-bord, var(--accent)) 100%);
  box-shadow:
    inset 0 0 0 5px rgba(255,255,255,.14),
    inset 0 -10px 18px rgba(0,0,0,.16),
    inset 0 7px 10px rgba(255,255,255,.12),
    0 10px 0 rgba(0,0,0,.16);
}
.bouton-ecoute{ border-radius:50%; border:4px solid #163A58; background:var(--accent); color:#fff; box-shadow:0 6px 0 rgba(0,0,0,.14); cursor:pointer; }

/* ---------- page 2 : formes ---------- */
#ecran-formes .corps-page{ flex:1 1 auto; overflow-y:auto; display:flex; align-items:center; padding:12px 20px 24px; }
.formes-grille{ display:flex; flex-wrap:wrap; justify-content:center; gap:16px; max-width:740px; }
.forme-carte{ display:flex; flex-direction:column; align-items:center; gap:10px; }
/* même gabarit que les tuiles de la grille : bord coloré par lettre (--tc,
   posé sur .formes-grille dans rendFormes), coins et ombre assortis. */
.forme-glyphe{ width:220px; height:210px; border-radius:28px; background:#fff; border:4px solid var(--tc, var(--accent)); box-shadow:0 7px 0 rgba(0,0,0,.12); display:flex; flex-direction:column; align-items:center; font-size:96px; color:var(--encre); padding:10px; }
/* même animation que le tap d'une tuile de la grille (@keyframes rebond-wagon). */
.forme-glyphe.rebond{ animation:rebond-wagon 420ms ease; }
/* hauteurs fixes par rangée : le mot s'aligne pareil sur les 3 cartes, même si sa hauteur réelle (diacritiques) varie légèrement d'un mot à l'autre */
.forme-glyphe .exemple-emoji{ font-size:34px; height:56px; display:flex; align-items:center; justify-content:center; }
/* pas de display:flex ici : ce span mélange texte brut et <span class="cible"> --
   flex transformerait le texte brut en item flex anonyme séparé et casserait
   le run de texte arabe (liaison des lettres, ordre visuel RTL). Centré par
   line-height/text-align à la place, qui laisse le texte en flux normal. */
.forme-glyphe .exemple-mot{ display:block; font-size:60px; height:92px; line-height:92px; text-align:center; }
/* pas de font-weight ici : une seule graisse de police arabe est embarquée
   (pas de variante grasse) -- un poids forcé déclenche un "faux gras"
   synthétique du navigateur, qui déforme les lettres arabes de façon
   inégale selon leur forme (c'est ce qui faisait paraître كَلْب plus
   "gros" que جُبْن). La couleur seule suffit à distinguer la lettre. */
.cible{ color:var(--tc, var(--copain-1)); }
.forme-legende{ font-size:20px; color:#5b4d7a; font-weight:700; }
.forme-fr{ font-size:16px; font-weight:700; color:#5b4d7a; opacity:.85; margin-top:-4px; }

/* ---------- page 2bis : écriture (tracé au doigt) ----------
   Entre « regarder la forme » (page Formes) et « glisser une lettre dans
   un mot » (page Formes-exercice) : l'enfant doit d'abord savoir ÉCRIRE la
   lettre isolée. Approche reprise de ~/projects/arabe-enfant/ (player.js,
   cours absorbé -- SPEC.md §4bis l'annonçait déjà comme référence pour ce
   mode) et adaptée au style « copain » : Pointer Events comme .fe-tuile
   plutôt que mousedown/touchstart séparés, bord et repère colorés par
   lettre (--tc) au lieu du bleu unique de l'original. Aucune validation du
   tracé (pas de reconnaissance de forme) : un canvas d'entraînement libre,
   comme l'original -- la mesure de réussite reste l'appel à la grand-mère
   (SPEC §2), jamais la qualité du tracé. */
#ecran-ecriture .corps-page{ flex:1 1 auto; overflow-y:auto; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:18px; padding:12px 20px 24px; }
.ecriture-stage{ position:relative; width:100%; max-width:340px; aspect-ratio:1/.95; margin:0 auto; border-radius:28px; background-color:#fff; background-image:
    repeating-linear-gradient(0deg, transparent 0 28px, rgba(0,0,0,.06) 28px 29px),
    repeating-linear-gradient(90deg, transparent 0 28px, rgba(0,0,0,.06) 28px 29px);
  border:4px solid var(--tc, var(--accent)); box-shadow:0 7px 0 rgba(0,0,0,.12); overflow:hidden; }
/* le repère reste DERRIÈRE le canvas -- l'enfant repasse dessus au doigt,
   un modèle affiché à côté ne sert à rien (même choix que l'original). */
.ecriture-ghost{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:min(38vw, 11rem); line-height:1; color:var(--tc, var(--accent)); opacity:.25; user-select:none; pointer-events:none; }
.ecriture-stage canvas{ position:absolute; inset:0; width:100%; height:100%; touch-action:none; cursor:crosshair; }
/* "bravo" quand l'enfant a repassé sur l'essentiel du repère -- réutilise
   @keyframes saute (page Exercice, .carte-exo.content), même geste visuel
   pour une réussite dans tout le jeu. Jamais l'inverse : aucune classe ni
   animation n'existe pour un tracé insuffisant (SPEC.md §3). */
.ecriture-stage.content{ animation:saute 250ms ease; }
.ecriture-effacer{ font-family:inherit; font-size:17px; font-weight:700; padding:12px 26px; border-radius:99px; border:4px solid var(--accent); background:#fff; color:var(--accent); cursor:pointer; box-shadow:0 5px 0 rgba(0,0,0,.12); }
/* sélecteur de forme + lecteur d'animation du tracé (modèles de ecrire.html) */
.ecriture-formes{ display:flex; flex-wrap:wrap; justify-content:center; gap:8px; }
.ecriture-forme{ font-family:inherit; font-size:14px; font-weight:700; padding:8px 14px; border-radius:99px; border:3px solid var(--tc, var(--accent)); background:#fff; color:var(--tc, var(--accent)); cursor:pointer; opacity:.65; transition:opacity .15s, transform .12s; }
.ecriture-forme.active{ opacity:1; background:var(--tc, var(--accent)); color:#fff; }
.ecriture-forme:disabled{ opacity:.35; cursor:default; }
.ecriture-anim{ position:absolute; inset:0; z-index:5; border-radius:24px; opacity:0; pointer-events:none; transition:opacity .25s ease; display:flex; align-items:center; justify-content:center; }
.ecriture-anim.on{ opacity:1; pointer-events:auto; }
.ecriture-actions{ display:flex; flex-wrap:wrap; justify-content:center; gap:12px; }
.ecriture-voir{ font-family:inherit; font-size:17px; font-weight:700; padding:12px 22px; border-radius:99px; border:4px solid var(--accent); background:var(--accent); color:#fff; cursor:pointer; box-shadow:0 5px 0 rgba(0,0,0,.12); }
.ecriture-voir:disabled{ opacity:.55; cursor:default; }
.ecriture-status{ min-height:24px; font-size:15px; font-weight:700; color:var(--accent); text-align:center; }

/* ---------- page 2ter : formes - exercice (glisser-déposer) ---------- */
#ecran-formes-exercice .corps-page, #ecran-mots-trous .corps-page{ flex:1 1 auto; overflow-y:auto; display:flex; align-items:center; justify-content:center; padding:12px 20px 24px; }
.fe-mot{ display:flex; flex-direction:column; align-items:center; gap:14px; }
.fe-emoji{ font-size:56px; line-height:1; }
.fe-fr{ font-size:18px; font-weight:700; color:#5b4d7a; }
/* pas de display:flex ici : mélange texte brut + <span> comme .exemple-mot
   (voir ce commentaire plus haut, même piège déjà payé une fois) -- flex
   transformerait .fe-blanc en item flex anonyme et casserait l'ordre visuel
   RTL du mot. Centré par line-height, jamais par flex, sur ce conteneur
   précis. direction:rtl explicite : .fe-blanc est une boîte atomique vide
   (bidi-neutre) -- sans direction de base RTL, un blanc en tout début de
   mot (avant vide) retombe sur la direction LTR du document et s'affiche du
   mauvais côté. */
.fe-ecriture{ font-size:76px; line-height:110px; white-space:nowrap; height:110px; direction:rtl; }
/* la lettre cible reste visible dans le mot (atténuée), pas remplacée par un
   cadre vide -- demande de Haythem : on voit déjà où et quelle forme va là,
   le glisser-déposer confirme plutôt que de deviner une case vide. */
.cible.muted{ opacity:.38; transition:opacity .2s ease; outline:3px dashed var(--tc, var(--accent)); outline-offset:7px; border-radius:18px; }
/* ADR-062 : un vrai emplacement. En pointillés au repos, qui pulse pendant qu'on glisse (.vise), plein et éclairé quand la lettre s'y accroche (.survole). */
.cible.muted.vise{ opacity:.55; animation:fePulseTrou 900ms ease-in-out infinite; }
.cible.muted.survole{ opacity:.85; outline-style:solid; background:rgba(184,134,42,.18); animation:none; }
@keyframes fePulseTrou{ 0%,100%{ outline-offset:7px; } 50%{ outline-offset:12px; } }
/* PAS de display:inline-block ici (ce commentaire plus haut : le blanc est un inline, sinon les lettres du mot ne se lient plus) -> halo, pas de transform */
.cible.atterri{ animation:feAtterri 520ms ease-out; }
@keyframes feAtterri{ 0%{ text-shadow:0 0 0 rgba(184,134,42,0); } 35%{ text-shadow:0 0 26px rgba(184,134,42,.95); } 100%{ text-shadow:0 0 0 rgba(184,134,42,0); } }
/* réutilise l'animation déjà définie pour les tuiles de la grille, voir
   @keyframes secoue-wagon plus haut -- mauvaise forme déposée, pas une
   mauvaise position (le dépôt touche quand même la cible). */
.cible.muted.erreur{ animation:secoue-wagon 300ms ease; }
.fe-tuiles{ display:flex; gap:16px; justify-content:center; flex-wrap:wrap; margin-top:34px; }
/* touch-action:none -- indispensable sur iPad/iPhone : sans ça, le geste de
   glisser fait défiler la page au lieu de déplacer la tuile (pointermove
   n'annule pas le scroll tactile tout seul). */
/* même taille de police que .fe-ecriture (le mot) -- la lettre glissée doit
   paraître être le même morceau que celui qui manque dans le mot, pas une
   pièce d'une autre taille. */
.fe-tuile{ width:110px; height:110px; border-radius:24px; background:#fff; border:4px solid var(--tc, var(--accent)); box-shadow:0 6px 0 rgba(0,0,0,.14); display:flex; align-items:center; justify-content:center; font-size:76px; color:var(--encre); cursor:grab; touch-action:none; user-select:none; }
.fe-tuile.glissee{ opacity:0; }
/* juste la lettre qui bouge, aucun cadre/fond -- sinon la tuile opaque cache
   l'emplacement (le mot atténué) pile au moment de viser le dépôt. */
.fe-tuile-fantome{ position:fixed; pointer-events:none; z-index:50; width:110px; height:110px; display:flex; align-items:center; justify-content:center; font-size:76px; color:var(--encre); text-shadow:0 3px 5px rgba(0,0,0,.35); transition:transform .12s ease; will-change:left, top; }
/* ADR-062 : la lettre glissée */
.fe-tuile-fantome.souleve{ transform:scale(1.2); text-shadow:0 12px 14px rgba(0,0,0,.3); }
.fe-tuile-fantome.accroche{ transform:scale(1); text-shadow:0 0 18px rgba(184,134,42,.9); }
.fe-tuile-fantome.pose{ animation:fePose 240ms cubic-bezier(.3,1.7,.5,1); }
@keyframes fePose{ 0%{ transform:scale(1.25); } 100%{ transform:scale(1); } }
.fe-tuile-fantome.retour{ transform:scale(1); transition:left .32s cubic-bezier(.3,1.5,.5,1), top .32s cubic-bezier(.3,1.5,.5,1), transform .2s ease; }
.fe-tuile.rate{ animation:secoue-wagon 300ms ease; }
.fe-etincelle{ position:fixed; width:10px; height:10px; border-radius:50%; pointer-events:none; z-index:55; animation:feEtincelle 650ms ease-out forwards; }
@keyframes feEtincelle{ 0%{ transform:translate(0,0) scale(1); opacity:1; } 100%{ transform:translate(var(--dx), var(--dy)) scale(.2); opacity:0; } }
@media (prefers-reduced-motion:reduce){
  .cible.muted.vise, .cible.atterri, .fe-tuile-fantome.pose, .fe-etincelle{ animation:none; }
  .fe-etincelle{ display:none; }
  .fe-tuile-fantome.retour{ transition:none; }
}
.maj-dispo{ position:fixed; left:16px; right:16px; bottom:calc(16px + env(safe-area-inset-bottom)); z-index:60; display:flex; align-items:center; justify-content:space-between; gap:12px; background:var(--accent); color:#fff; padding:14px 18px; border-radius:16px; box-shadow:0 6px 16px rgba(0,0,0,.25); font-size:16px; font-weight:700; }
.maj-dispo button{ flex:0 0 auto; background:#fff; color:var(--accent); border:none; border-radius:10px; padding:10px 16px; font-size:16px; font-weight:800; cursor:pointer; }

/* ---------- page 3 : mots ---------- */
#ecran-mots .corps-page{ flex:1 1 auto; overflow-y:auto; display:flex; flex-direction:column; align-items:center; gap:18px; padding:10px 24px 20px; }
.mot-carte{ width:100%; max-width:440px; border-radius:26px; background:#fff; border:5px solid var(--accent); box-shadow:0 9px 0 rgba(0,0,0,.12); display:flex; align-items:center; gap:4px; padding:12px; }
.mot-emoji{ font-size:72px; flex:0 0 auto; width:110px; text-align:center; }
.mot-texte{ flex:1 1 auto; display:flex; flex-direction:column; align-items:center; gap:4px; }
.mot-arabe{ font-size:42px; color:var(--encre); }
.mot-francais{ font-size:18px; color:var(--accent); font-weight:700; }

/* ---------- accueil : galerie "tous les mots" ---------- */
/* grille plutôt que la liste à une colonne de la page Mots d'une lettre --
   112 mots en liste verticale aurait demandé un défilement interminable. */
#ecran-tous-mots .corps-page, #ecran-theme .corps-page{ flex:1 1 auto; overflow-y:auto; display:grid; grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); gap:14px; max-width:960px; margin:0 auto; width:100%; padding:14px 20px 28px; align-content:start; }
.mot-mini{ border-radius:22px; background:#FFFFFF; border:3px solid var(--accent); box-shadow:0 6px 0 rgba(0,0,0,.12); padding:14px 8px 12px; display:flex; flex-direction:column; align-items:center; gap:4px; cursor:pointer; }
.mot-mini .mot-emoji{ font-size:42px; width:auto; }
/* image à la place d'un emoji : carrée, de la taille du texte emoji qu'elle remplace */
.img-mot{ width:1em; height:1em; object-fit:contain; vertical-align:-0.15em; display:inline-block; }
.mot-mini .mot-arabe{ font-size:26px; }
.mot-mini .mot-francais{ font-size:12px; text-align:center; line-height:1.3; }
@media (max-width:480px){
  #ecran-tous-mots .corps-page, #ecran-theme .corps-page{ grid-template-columns:repeat(2, 1fr); gap:12px; }
}

/* ---------- accueil : "compter de 1 à 20" ---------- */
#ecran-nombres .corps-page{ flex:1 1 auto; overflow-y:auto; display:grid; grid-template-columns:repeat(auto-fill, minmax(140px, 1fr)); gap:14px; max-width:900px; margin:0 auto; width:100%; padding:14px 20px 28px; align-content:start; }
.nombre-carte{ position:relative; border-radius:22px; background:#FFFFFF; border:3px solid var(--tc, var(--accent)); box-shadow:0 6px 0 rgba(0,0,0,.12); padding:14px 8px 12px; display:flex; flex-direction:column; align-items:center; gap:4px; cursor:pointer; }
.nombre-chiffre{ font-size:40px; font-weight:800; color:var(--tc, var(--accent)); line-height:1; margin-top:6px; }
.nombre-mot{ font-size:24px; font-weight:700; }
.nombre-mot-secondaire{ font-size:17px; color:#5b4d7a; }
.nombre-fr{ font-size:12px; text-align:center; line-height:1.3; color:#5b4d7a; font-weight:700; }
.nombres-onglets{ flex:0 0 auto; display:flex; justify-content:center; gap:10px; padding:4px 0 10px; }
.nombre-onglet{ font-family:inherit; font-size:18px; font-weight:700; padding:7px 22px; border-radius:99px; border:none; background:#EAE2FB; color:#5b4d7a; cursor:pointer; }
.nombre-onglet.actif{ background:var(--attention-fond); color:#fff; }
@media (max-width:480px){
  #ecran-nombres .corps-page{ grid-template-columns:repeat(2, 1fr); gap:12px; }
}


/* ---------- le voyage d'Alif (js/voyage.js) : piste, flèche verrouillée, coup de pouce ---------- */
.pagination.piste{ gap:7px; align-items:center; }
.pagination.piste .pt{ width:18px; height:18px; flex:0 0 auto; display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:800; line-height:1; color:#fff; }
.pagination.piste .pt.fait{ background:var(--reussite, #2f9e5b); }
.pagination.piste .pt.fait::after{ content:"✓"; }
.pagination.piste .pt.actif{ width:34px; height:34px; background:#fff url("../assets/img/mascotte/alif-bienvenue.webp?v=1") center/contain no-repeat; border:3px solid var(--accent); box-shadow:0 3px 0 rgba(0,0,0,.12); animation:voyageSaute 1.6s ease-in-out infinite; }
.pagination.piste .pt.actif.fait::after{ content:none; }
@keyframes voyageSaute{ 0%,100%{ transform:translateY(0); } 40%{ transform:translateY(-4px); } }

.rond44.verrou, #mots-jouer.verrou{ position:relative; background:#e9e4f1 !important; border-color:#b8aed0 !important; color:#8f84ab !important; box-shadow:none !important; }
.rond44.verrou::after, #mots-jouer.verrou::after{ content:"🔒"; position:absolute; right:-6px; top:-8px; width:26px; height:26px; border-radius:50%; background:#fff; border:2px solid #b8aed0; font-size:14px; line-height:22px; text-align:center; }
.secoue-verrou{ animation:voyageSecoue 320ms ease; }
@keyframes voyageSecoue{ 0%,100%{ transform:translateX(0); } 25%{ transform:translateX(-6px); } 75%{ transform:translateX(6px); } }
.debloque{ animation:voyageDebloque 700ms ease 2; }
@keyframes voyageDebloque{ 0%,100%{ transform:scale(1); } 50%{ transform:scale(1.18); box-shadow:0 0 0 8px rgba(184,134,42,.35); } }
.fe-tuile.indice, .carte-exo.indice{ animation:voyageIndice 900ms ease-in-out infinite; }
@keyframes voyageIndice{ 0%,100%{ box-shadow:0 0 0 0 rgba(184,134,42,0); } 50%{ box-shadow:0 0 0 9px rgba(184,134,42,.55); } }
@media (prefers-reduced-motion:reduce){
  .pagination.piste .pt.actif, .secoue-verrou, .debloque, .fe-tuile.indice, .carte-exo.indice{ animation-duration:.001s; animation-iteration-count:1; }
  .fe-tuile.indice, .carte-exo.indice{ outline:4px solid rgba(184,134,42,.8); }
}
