:root { color-scheme: dark; --fond: #14161a; --carte: #1f232a; --bord: #3a3f47; --texte: #ece9e2; --doux: #a9adb4;
  --accent: #e0a526; --alerte: #ff8a66; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--fond); color: var(--texte);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", sans-serif; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
main.etroit { max-width: 660px; }
h1 { font-size: 1.4rem; margin: .3em 0; }
a { color: var(--accent); }
.sous { color: var(--doux); }
.drapeaux { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 14px; margin-top: 18px; }
.drapeau { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px; background: var(--carte);
  border: 2px solid transparent; border-radius: 12px; color: var(--texte); text-decoration: none; font-weight: 600; }
.drapeau:hover, .drapeau:focus-visible { border-color: var(--accent); }
.drapeau svg { border-radius: 4px; box-shadow: 0 1px 5px rgba(0, 0, 0, .55); }
.etapes { background: #2b2410; border: 1px solid var(--accent); border-radius: 10px; padding: 6px 12px; }
.etapes summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.etapes ol { margin: 6px 0 2px; padding-inline-start: 1.4em; }
.etapes li { margin: 3px 0; }
.avert { color: var(--alerte); font-weight: 700; font-size: .92rem; margin: 6px 0; }
button, .bouton { font: inherit; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--bord); background: var(--carte);
  color: var(--texte); cursor: pointer; text-decoration: none; display: inline-block; }
.principal { background: var(--accent); border-color: var(--accent); color: #1a1300; font-weight: 700; }
.grand { width: 100%; padding: 14px 16px; font-size: 1.1rem; }
.petit { padding: 5px 10px; font-size: .88rem; align-self: flex-start; }
#budget-zero-btn { margin-top: 8px; max-width: 100%; white-space: normal; }
.discret { background: transparent; }
button:disabled { opacity: .5; cursor: default; }
/* LA PAGE DE VISITE TIENT DANS L'ÉCRAN : aucun défilement de la page */
body[data-page=visite] main { max-width: none; height: 100vh; height: 100dvh; padding: 8px; display: flex; flex-direction: column; }
body[data-page=visite] main > section { flex: 1 1 auto; min-height: 0; overflow: auto; }
body[data-page=visite] main > section.jeu { overflow: hidden; }
.jeu { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "jeu haut" "jeu bas"; }
.zone-jeu { grid-area: jeu; min-height: 0; min-width: 0; display: flex; }
.haut { grid-area: haut; min-width: 0; }
.bas { grid-area: bas; min-width: 0; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; }
.cadre { position: relative; flex: 1 1 auto; min-height: 0; min-width: 0; display: flex; justify-content: center;
  align-items: center; background: #000; border-radius: 8px; overflow: hidden; }
#ecran { display: block; max-width: 100%; max-height: 100%; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; cursor: crosshair; }
#attente-ecran { position: absolute; margin: 0; }
/* LE CHAMP DE SAISIE SAUTE AUX YEUX : étiquette, cadre CLAIR et contrasté, bouton Envoyer en évidence */
.etiquette { font-weight: 700; color: #fff; font-size: .98rem; overflow-wrap: anywhere; }
.saisie { display: flex; gap: 6px; padding: 6px; border: 2px solid #5aa9ff; border-radius: 10px; background: #13233a; }
.saisie input { flex: 1 1 auto; min-width: 0; font: inherit; font-size: 1.05rem; padding: 10px 12px; border-radius: 7px;
  border: 2px solid #ffffff; background: #ffffff; color: #111; }
.saisie input::placeholder { color: #6b7280; }
.saisie input:focus { outline: 3px solid #5aa9ff; outline-offset: 1px; }
.envoi { background: #2f7de1; border-color: #2f7de1; color: #fff; font-weight: 700; padding: 10px 16px; }
.saisie #effacer, .saisie #entree { padding: 10px 11px; }
/* (06/10) fond intégralement opaque, sans arrondi ni marge laissant reparaître le popup Android.
   Le JS aligne cette bande sur l'image affichée. Au besoin elle dépasse les 11 % vers le haut :
   pas de hauteur fixe qui couperait le label traduit ou réduirait les cibles sur téléphone. */
#bande-saisie { position: absolute; z-index: 2; background: #13233a; padding: 4px;
  display: flex; flex-direction: column; gap: 3px; container-type: inline-size; }
#bande-saisie .etiquette { font-size: .9rem; line-height: 1.2; }
#bande-saisie .saisie { gap: 3px; padding: 2px; border-radius: 5px; }
#bande-saisie .saisie input { font-size: 16px; padding: 4px; min-height: 36px; }
#bande-saisie .saisie button { font-size: .8rem; padding: 4px; min-width: 32px; min-height: 36px; }
#bande-saisie #vider { font-size: .8rem; padding: 4px 8px; min-height: 32px; }
/* Une image étroite garde un champ utilisable : les trois boutons passent sur une seconde ligne. */
@container (max-width: 240px) {
  #bande-saisie .saisie { flex-wrap: wrap; }
  #bande-saisie .saisie input { flex-basis: 100%; }
  #bande-saisie .saisie button { flex: 1; }
}
.repere-toucher { position: absolute; z-index: 1; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid #fff; background: #e0a526; box-shadow: 0 0 0 2px #111;
  transform: translate(-50%, -50%); pointer-events: none; animation: toucher 1s linear forwards; }
@keyframes toucher { from { opacity: .9; } to { opacity: 0; } }
.aide { color: var(--doux); font-size: .88rem; margin: 0; }
.budget-note { color: var(--texte); font-size: 1rem; font-weight: 600; margin: 10px 0; }
.etat-kiosque { border-inline-start: 4px solid var(--accent); padding: 10px 14px; font-weight: 600; }
/* (12/10, indicateur d'etat) pastille de couleur + mot court + detail, en haut de la page des langues et de l'accueil.
   Vert = pret ; orange = occupe ou en preparation ; rouge = hors ligne. La couleur n'est jamais le seul signal : le mot, et un
   symbole dans la pastille (coche, trois points, croix). Les couleurs des trois etats ne dependent que de ces trois variables. */
.etat { display: flex; align-items: center; gap: 14px; margin: 12px 0 14px; padding: 12px 16px; border-radius: 12px;
  border: 2px solid var(--etat); background: var(--etat-fond); }
.etat-vert { --etat: #3ddc84; --etat-fond: #0e3b23; --etat-mot: #a6ffcb; }
.etat-orange { --etat: #ff9a2e; --etat-fond: #3d2309; --etat-mot: #ffd2a0; }
.etat-rouge { --etat: #ff5c5c; --etat-fond: #431414; --etat-mot: #ffb8b8; }
.pastille { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--etat); color: #111;
  display: flex; align-items: center; justify-content: center; font-size: 1.45rem; font-weight: 800; line-height: 1; }
.etat-vert .pastille::before { content: "\2713"; }
.etat-orange .pastille::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #111; box-shadow: -9px 0 #111, 9px 0 #111; }
.etat-rouge .pastille::before { content: "\00D7"; font-size: 1.9rem; }
.etat-texte { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.etat-mot { font-size: 1.45rem; line-height: 1.2; color: var(--etat-mot); }
.etat-detail { font-size: .95rem; font-weight: 400; overflow-wrap: anywhere; }
.etat-autres { font-size: .9rem; color: var(--doux); overflow-wrap: anywhere; }
.etat-detail:empty, .etat-autres:empty { display: none; }
.alerte { color: var(--alerte); margin: 0; }
.alerte:empty { display: none; }
@media (max-width: 899px), (max-aspect-ratio: 1/1) {
  .jeu { gap: 6px; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "haut" "jeu" "bas"; }
  .etapes { padding: 4px 10px; font-size: .9rem; }
  .avert { margin: 4px 0 0; font-size: .85rem; }
  .grand { padding: 12px; font-size: 1.05rem; }
}
.attente::after { content: ""; display: inline-block; width: 12px; height: 12px; margin-inline-start: 8px; vertical-align: middle;
  border: 2px solid var(--accent); border-top-color: transparent; border-radius: 50%; animation: tour 1s linear infinite; }
@keyframes tour { to { transform: rotate(360deg); } }
form label[for], legend { display: block; margin-top: 14px; font-weight: 600; }
form input[type=text] { width: 100%; font: inherit; padding: 10px; border-radius: 8px; border: 1px solid var(--bord);
  background: #0f1114; color: var(--texte); }
fieldset { margin-top: 14px; border: 1px solid var(--bord); border-radius: 8px; }
fieldset label { display: inline-flex; align-items: center; gap: 6px; margin: 6px 16px 6px 0; }
form button[type=submit] { margin-top: 16px; }
.barre { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
#fiche { width: 100%; height: calc(100% - 56px); min-height: 300px; border: 0; border-radius: 8px; background: #fff; }
.grand-texte, .grand { }
p.grand { font-size: 1.3rem; }
/* (08/10, surbrillance) fonds opaques : le popup Android reste intégralement masqué. */
#bande-saisie.champ-ouvert { background: #0e3b23;
  box-shadow: inset 0 0 0 4px #3ddc84, 0 0 14px 3px rgba(61, 220, 132, .75);
  animation: pouls-champ 1.2s ease-in-out infinite; }
#bande-saisie.champ-ouvert .etiquette { font-weight: 700; color: #9bffc4; font-size: .95rem; }
#bande-saisie.champ-ouvert .saisie input { border: 2px solid #3ddc84; }
#bande-saisie.champ-ferme { background: #202228; animation: none; }
#bande-saisie.champ-ferme .etiquette { color: #ffb86b; font-weight: 700; font-size: .9rem; }
#bande-saisie.champ-ferme .saisie input { border: 2px solid #6b7280; }
#bande-saisie.champ-avertit .etiquette { color: var(--alerte); font-weight: 700; }
@keyframes pouls-champ {
  0%, 100% { box-shadow: inset 0 0 0 4px #3ddc84, 0 0 14px 3px rgba(61, 220, 132, .75); }
  50% { box-shadow: inset 0 0 0 4px #3ddc84, 0 0 10px 2px rgba(61, 220, 132, .5); }
}
#bande-saisie.champ-secousse { animation: secousse-champ .45s ease-in-out; opacity: 1; }
@keyframes secousse-champ {
  0%, 100% { transform: translateX(0); }
  14% { transform: translateX(-8px); }
  28% { transform: translateX(8px); }
  42% { transform: translateX(-6px); }
  56% { transform: translateX(6px); }
  70% { transform: translateX(-3px); }
  84% { transform: translateX(3px); }
}
@media (prefers-reduced-motion: reduce) {
  #bande-saisie.champ-ouvert { animation: none; }
  #bande-saisie.champ-secousse { animation: none; box-shadow: inset 0 0 0 4px #ff8a66; background: #3a1d17; }
}
[hidden] { display: none !important; }

/* (24/10, LE GUIDE DES FLECHES) le calque sur l'image : il LAISSE PASSER les touchers (seuls ses boutons les prennent) ; positions PHYSIQUES (left / top en px,
   calculees par le JS sur le rectangle de l'image : jamais mirorees en arabe) ; la bulle ne couvre jamais la cible ; l'animation est coupee si le visiteur
   demande moins de mouvement. */
.guide { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.guide[hidden] { display: none; }
.g-anneau { position: absolute; border: 3px solid var(--accent); border-radius: 50%; box-shadow: 0 0 0 2px #111; pointer-events: none;
  animation: g-pouls 1.3s ease-out infinite; }
.g-fleche { position: absolute; width: 24px; height: 24px; line-height: 24px; text-align: center; font-size: 22px; color: var(--accent);
  text-shadow: 0 0 3px #000, 0 0 3px #000; pointer-events: none; animation: g-rebond 1s ease-in-out infinite; }
.g-bulle { position: absolute; background: #2b2410; border: 2px solid var(--accent); border-radius: 10px; padding: 7px 9px; color: var(--texte);
  font-size: .86rem; line-height: 1.3; pointer-events: none; }
.g-etiq { display: inline-block; font-weight: 700; color: var(--accent); margin-bottom: 2px; unicode-bidi: plaintext; }
.g-texte { margin: 0; overflow-wrap: anywhere; }
.g-rang { display: flex; gap: 6px; margin-top: 6px; pointer-events: none; }
.g-btn { padding: 4px 10px; font-size: .8rem; min-height: 30px; pointer-events: auto; }
@keyframes g-pouls { 0% { transform: scale(.85); opacity: 1; } 100% { transform: scale(1.35); opacity: 0; } }
@keyframes g-rebond { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .g-anneau, .g-fleche { animation: none; } }
/* (24/10, D4 et D5) les messages du bouton jaune (a la place du confirm natif) */
.avis { background: #2b2410; border: 2px solid var(--accent); border-radius: 10px; padding: 8px 10px; }
.avis p { margin: 0 0 6px; font-weight: 600; overflow-wrap: anywhere; }
.avis .rang { display: flex; gap: 6px; flex-wrap: wrap; }
.avis[hidden] { display: none; }
/* (25/10, bandeau) La saisie ne recouvre JAMAIS l'image : l'image garde seulement un cache OPAQUE et VIDE de 11 % (le popup Android),
   et la bande (etiquette, champ, boutons, « Vider le champ ») est SOUS l'image, sur toute la largeur de la zone : aucun bouton tronque. */
.zone-jeu { flex-direction: column; gap: 6px; }
#cache-popup { position: absolute; z-index: 2; background: #13233a; }
#bande-saisie { position: static; flex: none; width: 100%; box-sizing: border-box; flex-direction: row; flex-wrap: wrap;
  align-items: center; gap: 4px 6px; padding: 4px; border-radius: 8px; }
#bande-saisie .etiquette { order: 1; flex: 1 1 0; min-width: 0; }
#bande-saisie #vider { order: 2; flex: none; white-space: nowrap; }
#bande-saisie .saisie { order: 3; flex: 1 0 100%; box-sizing: border-box; }
#bande-saisie .saisie input { flex: 1 1 0; min-width: 0; }
#bande-saisie .saisie button { flex: none; white-space: nowrap; padding: 4px 10px; }
/* (25/10, animation des fleches) La BULLE et la FLECHE sont FIXES ; seul un HALO autour de l'anneau pulse, doucement (1,5 s, jamais jusqu'a disparaitre) ;
   rien ne pulse si le visiteur demande moins de mouvement (le halo reste allume, fixe). La bulle est opaque : son texte reste lisible sur l'image. */
.g-bulle { animation: none; transition: none; opacity: 1; }
.g-fleche { animation: none; }
.g-anneau { animation: g-halo 1.5s ease-in-out infinite; }
@keyframes g-halo {
  0%, 100% { box-shadow: 0 0 0 2px #111, 0 0 6px 1px rgba(224, 165, 38, .35); }
  50% { box-shadow: 0 0 0 2px #111, 0 0 18px 7px rgba(224, 165, 38, .95); }
}
@media (prefers-reduced-motion: reduce) { .g-anneau { animation: none; box-shadow: 0 0 0 2px #111, 0 0 12px 4px rgba(224, 165, 38, .7); } }
/* (25/10, le cache) Le cache de 11 % de l'image masque le popup Android ; il doit etre INDISCERNABLE du fond qui l'entoure : le meme noir que le cadre (.cadre { background: #000 }),
   ni bordure, ni ombre, ni contour : on ne voit pas de « reste d'un champ ». Il reste OPAQUE (c'est sa fonction). */
#cache-popup { background: #000; border: 0; outline: 0; box-shadow: none; }
/* (25/10, les deux boutons du bas) Sur TELEPHONE (la largeur ou ils sont l'un sous l'autre : les memes conditions que la mise en page de la visite), « Je suis sur mon compte » et
   « Recommencer » sont COTE A COTE, de meme hauteur, pour rendre la place a l'IMAGE du jeu. Police 16 px au moins, texte sur deux lignes permis mais jamais coupe au milieu d'un mot
   ni tronque, zone de toucher d'au moins 48 px de haut, ecart net de 14 px entre eux. L'ordre du code est inchange : « continuer » en premier (a gauche ; a droite en arabe, ou la page
   est de droite a gauche). Les avis (« rien tape », « pas encore »...) et le message d'erreur gardent toute la largeur, au-dessus des boutons. Sur grand ecran : rien ne change. */
@media (max-width: 899px), (max-aspect-ratio: 1/1) {
  .bas { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 14px; row-gap: 6px; align-items: stretch; align-content: end; }
  .bas > :not(#cest-bon):not(#quitter2) { grid-column: 1 / -1; }
  #cest-bon, #quitter2 { width: auto; min-width: 0; min-height: 52px; padding: 6px 8px; font-size: 16px; line-height: 1.2; text-align: center; white-space: normal;
    overflow-wrap: normal; word-break: normal; hyphens: manual; display: flex; align-items: center; justify-content: center; }
}

/* (26/10, prepa_boutons) ACCUEIL ANGLAIS, les deux boutons : « Start » (ambre, --accent, inchange) et « Migration score » (VERT du score du jeu, #84E380, texte fonce) bien SEPARES :
   le bouton score passe sous Start, a la largeur de la colonne, avec 48 px d'ecart (56 px sur telephone) et une ligne fine au milieu de l'ecart. Les six autres accueils n'ont qu'UN bouton : rien ne change pour eux
   (la regle de Start ne vaut que s'il est SUIVI du bouton score). Les etats hidden et disabled restent ceux du script : un display de cette feuille ne doit jamais rouvrir un bouton cache. */
#commencer:has(+ #commencer-score) { display: block; width: 100%; }
#commencer:has(+ #commencer-score)[hidden] { display: none; }
#commencer-score { display: block; width: 100%; position: relative; margin-top: 48px; background: #84e380; border-color: #84e380; color: #0b2a0b; font-weight: 700; }
#commencer-score::before { content: ""; position: absolute; left: 0; right: 0; top: -25px; border-top: 1px solid var(--bord); }
#commencer-score[hidden] { display: none; }
@media (max-width: 899px), (max-aspect-ratio: 1/1) {
  #commencer-score { margin-top: 56px; }
  #commencer-score::before { top: -29px; }
}

/* (26/10, prepa_boutons2) ACCUEIL ANGLAIS, les deux boutons COTE A COTE sur UNE ligne : meme largeur (la moitie de la colonne moins l'ecart), meme hauteur (72 px au moins : « Migration score » peut tenir sur deux lignes
   sur un telephone de 375 px, jamais coupe), un ECART horizontal de 44 px avec une ligne fine verticale (1 px) en son milieu. Les couleurs ne changent pas (Start ambre, score vert #84e380, texte #0b2a0b : regles de
   prepa_boutons) ; ce bloc REDEFINIT seulement la mise en page de prepa_boutons (le bouton score n'est plus sous Start). Meme regle de portee : Start n'est touche que s'il est SUIVI du bouton score ; les etats
   hidden et disabled restent ceux d'avant (la regle hidden est reaffirmee apres les display de ce bloc). Largeur : (100 % - 44 px) / 2 - 1 px : 1 px de jeu pour que l'arrondi ne renvoie jamais le second bouton a la ligne. */
#commencer:has(+ #commencer-score), #commencer-score { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; width: calc((100% - 44px) / 2 - 1px); min-height: 72px; vertical-align: top;
  text-align: center; white-space: normal; overflow-wrap: normal; word-break: normal; line-height: 1.2; }
#commencer-score { margin-top: 0; margin-inline-start: 44px; }
#commencer-score::before { top: 0; bottom: 0; left: -22px; right: auto; width: 0; border-top: 0; border-left: 1px solid var(--bord); }
#commencer:has(+ #commencer-score)[hidden], #commencer-score[hidden] { display: none; }

/* (29/10, cases) LE BUDGET EN TROIS CASES : un montant par case, la 1re a 100, les deux autres vides. UNE case par ligne (son rang, la case, son message d'erreur dessous) : a 375 px aucune case ne
   deborde et « 250000 » tient en entier. Les cases sont TOUJOURS de gauche a droite (dir="ltr" dans la page ; direction ltr ici), meme dans la page arabe, qui reste de droite a gauche. */
.budget-case { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; margin-top: 8px; }
.budget-rang { flex: none; width: 1.6em; text-align: center; font-weight: 600; color: var(--doux); }
.budget-case input[type=text] { flex: 1 1 0; width: auto; min-width: 0; max-width: 16em; direction: ltr; text-align: left; }
.budget-case .alerte { flex: 1 0 100%; padding-inline-start: calc(1.6em + 10px); font-size: .92rem; }
