/* =========================================================
   Pomelia : la démo animée « Voyez la formation en action »
   (page /formation/)
   ---------------------------------------------------------
   Même mécanique que la démo de l'accueil : la mise en page,
   la barre de chapitres et les apparitions (.ap, .gl, .d1 à
   .d16) viennent de /css/demo.css, le minuteur de /js/site.js.
   Ce fichier ne dessine que les six scènes du serious game.

   Comme dans demo.css :
   - chaque scène est un plateau (.st) de 40 × 32 em ;
   - les règles décrivent d'abord l'ÉTAT FINAL de la scène,
     ce que voient les visiteurs sans animation ;
   - le mouvement n'existe qu'avec la classe .anim, posée par
     /js/site.js sauf si « réduire les animations » est activé.
   Toutes les règles commencent par .sf1 à .sf6 (une par scène)
   ou visent une classe .fx-, pour ne rien toucher d'autre.
   Les écrans dessinés restent clairs en mode sombre, comme le jeu.
   ========================================================= */

/* ---------- Éléments communs aux six scènes ---------- */
/* Les largeurs comprennent la bordure et la marge intérieure */
.sf1 *, .sf2 *, .sf3 *, .sf4 *, .sf5 *, .sf6 * { box-sizing: border-box; }
.st .fx-tag { font-size: .72em; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: #C2394A; }
.st .fx-logo { display: flex; align-items: center; gap: .5em; font-family: var(--titre); font-weight: 600; font-size: 1.15em; color: #1F4A3A; }
.st .fx-logo::before { content: ""; width: 1.4em; height: 1.4em; border-radius: 50%; background: #E8606E; box-shadow: inset 0 0 0 .2em #F6B5BC; }
.st .fx-bien { font-family: var(--titre); font-weight: 600; font-size: 1.2em; color: #2B7350; }
.st .fx-opts { display: grid; gap: .45em; }
.st .fx-opts p { position: relative; display: flex; justify-content: space-between; align-items: center; gap: .8em; background: #FFFFFF; border: 1px solid #E6DCD3; border-radius: .6em; padding: .55em .8em; font-size: .85em; line-height: 1.3; }
.st .fx-opts b { flex: none; font-size: .9em; color: #5E6B65; }
.st .fx-opts .fx-choix { background: #E2F1E8; border-color: #2B7350; box-shadow: inset 0 0 0 .1em #2B7350; }
.st .fx-res { background: #E2F1E8; border: 1px solid #BFDCCB; border-radius: .9em; box-shadow: var(--ombre); padding: 1em; display: grid; gap: .4em; line-height: 1.35; }
.st .fx-res > p:not(.fx-bien) { font-size: .9em; }
/* Le doigt qui touche l'écran : un cercle qui apparaît et s'efface */
.st .fx-tap { position: absolute; right: 1em; top: 50%; width: 2.2em; height: 2.2em; margin-top: -1.1em; border-radius: 50%; background: rgba(227,233,140,.8); opacity: 0; pointer-events: none; }
/* Un nombre qui change : les deux valeurs l'une sur l'autre ; « avant » est cachée (état final) */
.st .fx-nb { display: inline-grid; }
.st .fx-nb em { grid-area: 1 / 1; font-style: normal; }
.st .fx-nb .avant { visibility: hidden; }
/* Jauges et rails */
.st .fx-rail { position: relative; height: .8em; border-radius: .4em; background: #E6DCD3; }
.st .fx-rail u { position: absolute; inset: 0 auto 0 0; border-radius: .4em; background: #2B7350; }
.st .fx-cible { position: absolute; top: -.35em; bottom: -.35em; width: .2em; border-radius: .1em; background: #1F4A3A; }

/* ---------- Étape 1 : rejoindre la salle ---------- */
.sf1 .fx-proj { left: 0; top: 0; width: 24em; height: 20.5em; background: #1F4A3A; color: #FBF5F0; border-radius: .9em; box-shadow: var(--ombre); padding: 1.3em; display: flex; flex-direction: column; gap: .6em; }
.sf1 .fx-proj .dm-pt { color: #B9CBC2; }
.sf1 .fx-proj .dm-h { color: #FBF5F0; font-size: 1.45em; }
.sf1 .fx-salle { display: flex; gap: 1.2em; align-items: flex-start; margin-top: .4em; }
.sf1 .fx-salle img { width: 8em; height: auto; background: #FFFFFF; border-radius: .4em; padding: .4em; image-rendering: pixelated; }
.sf1 .fx-equipes { list-style: none; margin: 0; padding: 0; display: grid; gap: .5em; flex: 1; }
.sf1 .fx-equipes li { display: flex; align-items: center; gap: .5em; background: rgba(251,245,240,.1); border-radius: .5em; padding: .45em .7em; font-weight: 700; font-size: .95em; }
.sf1 .fx-equipes li::before { content: ""; width: .6em; height: .6em; border-radius: 50%; background: #9FD8B4; }
.sf1 .fx-tel1 { left: 25.5em; top: 0; width: 14.5em; height: 31.5em; padding: 2em 1em; display: flex; flex-direction: column; gap: .8em; }
.sf1 .fx-champ { background: #FFFFFF; border: 1px solid #1F4A3A; border-radius: .6em; padding: .65em .8em; font-weight: 700; min-height: 2.6em; }
.sf1 .fx-frappe { display: inline-block; overflow: hidden; white-space: nowrap; vertical-align: bottom; border-right: .1em solid transparent; }
.sf1 .fx-b1 { position: relative; align-self: stretch; justify-content: center; text-align: center; }
.sf1 .fx-b1 > span { justify-content: center; }
.sf1 .fx-b1 .fx-tap { right: auto; left: 50%; margin-left: -1.1em; }
.sf1 .fx-direct { display: inline-flex; align-items: center; gap: .45em; align-self: flex-start; font-size: .8em; font-weight: 700; color: #1F4A3A; border: 1px solid #1F4A3A; border-radius: 999px; padding: .35em .8em; }
.sf1 .fx-direct::before { content: ""; width: .6em; height: .6em; border-radius: 50%; background: #2B7350; }
.sf1 .fx-chap { margin-top: .4em; display: grid; gap: .45em; }
.sf1 .fx-chap p { display: flex; justify-content: space-between; align-items: center; gap: .5em; background: #FFFFFF; border: 1px solid #E6DCD3; border-radius: .6em; padding: .55em .7em; font-size: .8em; line-height: 1.25; }
.sf1 .fx-chap b { flex: none; font-size: .9em; border-radius: .5em; padding: .3em .6em; background: #1F4A3A; color: #FBF5F0; }
.sf1 .fx-chap .ferme { color: #5E6B65; }
.sf1 .fx-chap .ferme b { background: #F4ECE5; color: #5E6B65; }
.sf1 .fx-ok1 { left: 0; top: 22.4em; }
.sf1 .fx-ok2 { left: 0; top: 26.2em; }

/* ---------- Étape 2 : une mission ---------- */
.sf2 .fx-tel2 { left: 1em; top: 0; width: 16em; height: 31.5em; padding: 2em 1em 1em; display: flex; flex-direction: column; gap: .65em; }
.sf2 .fx-tel2 .dm-h { font-size: 1.35em; }
.sf2 .fx-prog { display: flex; align-items: center; gap: .6em; font-size: .75em; color: #5E6B65; }
.sf2 .fx-prog i { flex: 1; height: .45em; border-radius: .25em; background: #E6DCD3; position: relative; overflow: hidden; }
.sf2 .fx-prog i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 9%; background: #E8606E; }
.sf2 .fx-carte { background: #FFFFFF; border: 1px solid #E6DCD3; border-radius: .8em; padding: .9em; display: grid; gap: .6em; }
.sf2 .fx-cap { font-size: .72em; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: #5E6B65; }
.sf2 .fx-enonce { font-size: .95em; line-height: 1.35; }
.sf2 .fx-vf { display: grid; grid-template-columns: 1fr 1fr; gap: .5em; }
.sf2 .fx-vf span { position: relative; text-align: center; font-weight: 700; border: 1px solid #E6DCD3; background: #F4ECE5; border-radius: .6em; padding: .7em; }
.sf2 .fx-vf .fx-sel { background: #E2F1E8; border-color: #2B7350; }
.sf2 .fx-vf .fx-tap { right: auto; left: 50%; margin-left: -1.1em; }
.sf2 .fx-retour { position: static; background: #E2F1E8; border-radius: .8em; padding: .8em; display: grid; gap: .3em; font-size: .85em; line-height: 1.35; }
.sf2 .fx-art { font-size: .85em; color: #5E6B65; }
.sf2 .fx-xp { left: 20.5em; top: 0; font-weight: 700; font-size: .95em; color: #17201C; background: #E3E98C; border-radius: 999px; padding: .45em 1em; }
.sf2 .fx-liste { left: 19.5em; top: 3.6em; width: 20.5em; background: #FFFFFF; border: 1px solid #E6DCD3; border-radius: 1em; box-shadow: var(--ombre); padding: 1.1em; display: grid; gap: .55em; }
.sf2 .fx-liste p:not(.dm-pt) { display: grid; grid-template-columns: 4em 1fr; gap: .6em; align-items: baseline; border-top: 1px solid #F0E7DF; padding-top: .55em; font-size: .88em; line-height: 1.3; }
.sf2 .fx-liste b { font-size: .85em; color: #C2394A; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Étape 3 : un imprévu ---------- */
.sf3 .fx-imp { left: 0; top: 0; width: 25.5em; gap: .6em; padding: 1.1em; }
.sf3 .fx-imp .dm-h { font-size: 1.4em; }
.sf3 .fx-txt { font-size: .88em; line-height: 1.35; color: #3D4843; }
.sf3 .fx-heures { align-self: flex-start; font-size: .82em; font-weight: 700; background: #E3E98C; border-radius: 999px; padding: .35em .9em; }
.sf3 .fx-b3 { position: relative; margin-top: .3em; background: #E2F1E8; }
.sf3 .fx-b3 .fx-tap { right: auto; left: 50%; margin-left: -1.1em; }
.sf3 .fx-jauges { left: 26.5em; top: 0; width: 13.5em; background: #FFFFFF; border: 1px solid #E6DCD3; border-radius: 1em; box-shadow: var(--ombre); padding: 1em; display: grid; gap: .8em; }
.st .fx-j { display: grid; grid-template-columns: 1fr auto; gap: .3em .5em; font-size: .85em; }
.st .fx-j b { font-family: var(--titre); font-weight: 600; color: #1F4A3A; }
.st .fx-j i { grid-column: 1 / -1; height: .55em; border-radius: .3em; background: #E6DCD3; position: relative; overflow: hidden; }
.st .fx-j u { position: absolute; inset: 0 auto 0 0; background: #2B7350; border-radius: .3em; }
.st .fx-j .j50 { width: 50%; } .st .fx-j .j52 { width: 52%; } .st .fx-j .j58 { width: 58%; }
.sf3 .fx-res { left: 26.5em; top: 13.6em; width: 13.5em; }
.st .fx-gains { display: flex; flex-wrap: wrap; gap: .35em; }
.st .fx-gains span { font-size: .85em; font-weight: 700; color: #2B7350; background: #FFFFFF; border-radius: 999px; padding: .2em .6em; }

/* ---------- Étape 4 : la réunion avec la direction ---------- */
.sf4 .fx-reu { left: 0; top: 0; width: 25.5em; gap: .6em; padding: 1.1em; }
.sf4 .fx-reu .dm-h { font-size: 1.4em; }
.sf4 .fx-dir { display: flex; gap: .7em; align-items: flex-start; background: #FFFFFF; border: 1px solid #E6DCD3; border-radius: .8em; padding: .8em; font-size: .88em; line-height: 1.35; }
.sf4 .fx-dir small { display: block; font-size: .85em; font-weight: 700; color: #5E6B65; margin-bottom: .2em; }
.sf4 .fx-avatar { flex: none; display: grid; place-items: center; width: 2.6em; height: 2.6em; border-radius: 50%; background: #1F4A3A; color: #FBF5F0; font-family: var(--titre); font-weight: 600; }
.sf4 .fx-reflexes { left: 26.5em; top: 0; width: 13.5em; background: #FFFFFF; border: 1px solid #E6DCD3; border-radius: 1em; box-shadow: var(--ombre); padding: 1em; display: grid; gap: .45em; }
.sf4 .fx-reflexes p:not(.dm-pt) { position: relative; padding-left: 1.5em; font-size: .82em; line-height: 1.3; }
.sf4 .fx-reflexes p:not(.dm-pt)::before { content: ""; position: absolute; left: 0; top: .1em; width: 1em; height: 1em; border-radius: 50%; background: #2B7350; }
.sf4 .fx-reflexes .fx-avenir { color: #5E6B65; }
.sf4 .fx-reflexes p.fx-avenir:not(.dm-pt)::before { background: transparent; box-shadow: inset 0 0 0 .12em #E6DCD3; }
.sf4 .fx-res4 { left: 26.5em; top: 15.6em; width: 13.5em; }
.sf4 .fx-role { left: 0; top: 31.6em; display: inline-flex; align-items: center; gap: .45em; font-size: .85em; font-weight: 700; color: #FFFFFF; background: #A3262A; border-radius: 999px; padding: .5em .9em; }

/* ---------- Étape 5 : la mise en commun (vue du formateur) ---------- */
.sf5 .fx-bilan { left: 0; top: 0; width: 40em; gap: .7em; padding: 1.3em 1.5em 1.5em; }
.sf5 .fx-barres { display: grid; gap: .7em; margin-top: .3em; }
.sf5 .fx-barres p { display: grid; grid-template-columns: 17em 1fr 5.5em; gap: .8em; align-items: center; font-size: .9em; }
.sf5 .fx-barres span { line-height: 1.3; }
.sf5 .fx-barres em { display: inline-block; font-style: normal; font-size: .8em; font-weight: 700; color: #2B7350; background: #E2F1E8; border-radius: 999px; padding: .15em .6em; margin-top: .2em; }
.sf5 .fx-barres i { height: 1.5em; border-radius: .4em; background: #F4ECE5; position: relative; overflow: hidden; }
.sf5 .fx-barres u { position: absolute; inset: 0 auto 0 0; border-radius: .4em; background: #C9B8A6; }
.sf5 .fx-barres .b1e { width: 20%; } .sf5 .fx-barres .b3e { width: 60%; }
.sf5 .fx-meilleure u { background: #2B7350; }
.sf5 .fx-risque u { background: #E8606E; }
.sf5 .fx-barres b { font-size: .9em; color: #5E6B65; }
.sf5 .fx-suivi { left: 0; top: 18.5em; width: 19.5em; background: #FFFFFF; border: 1px solid #E6DCD3; border-radius: 1em; box-shadow: var(--ombre); padding: 1em; display: grid; gap: .45em; }
.sf5 .fx-suivi p:not(.dm-pt) { display: flex; justify-content: space-between; gap: .5em; font-size: .88em; }
.sf5 .fx-suivi span { font-size: .85em; font-weight: 700; border-radius: 999px; padding: .1em .6em; }
.sf5 .fx-suivi .ok { color: #2B7350; background: #E2F1E8; }
.sf5 .fx-suivi .re { color: #9A5B0F; background: #FBEFDC; }
.st .fx-toast { display: flex; gap: .8em; align-items: center; background: #17201C; color: #FBF5F0; border-radius: .9em; box-shadow: var(--ombre); padding: 1em; line-height: 1.35; }
.st .fx-toast p { font-size: .9em; }
.st .fx-toast b { display: block; }
.st .fx-toast .ico { width: 2.4em; height: 2.4em; padding: .5em; border-radius: 50%; background: #E3E98C; color: #17201C; }
.sf5 .fx-toast { left: 21em; top: 20.5em; width: 19em; }

/* ---------- Étape 6 : classement, badges et défi de la salle ---------- */
.sf6 .fx-class { left: 0; top: 0; width: 25.5em; gap: .6em; }
.sf6 .fx-tab { display: grid; grid-template-columns: 2.5em 1fr 3.8em 7.5em; gap: 0; align-items: center; font-size: .9em; }
.sf6 .fx-tab .col { font-size: .75em; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #5E6B65; padding-bottom: .3em; border-bottom: 1px solid #E6DCD3; }
.sf6 .fx-tab > *:not(.col) { padding: .6em .3em .6em 0; border-bottom: 1px solid #F0E7DF; }
.sf6 .fx-tab > :nth-child(-n+8):nth-child(n+5) { background: #E2F1E8; }
.sf6 .fx-tab b { font-family: var(--titre); font-weight: 600; font-size: 1.2em; color: #1F4A3A; }
.sf6 .fx-badge { left: 26.5em; top: 0; width: 13.5em; }
.sf6 .fx-medaille { flex: none; width: 2.4em; height: 2.4em; border-radius: 50%; background: #E3E98C; box-shadow: inset 0 0 0 .35em #C9CF6A; }
.sf6 .fx-badges { left: 26.5em; top: 7.8em; width: 13.5em; background: #FFFFFF; border: 1px solid #E6DCD3; border-radius: 1em; box-shadow: var(--ombre); padding: 1em; display: grid; gap: .7em; }
.sf6 .fx-badges div { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5em; }
.sf6 .fx-badges i { aspect-ratio: 1; border-radius: 50%; border: .15em dashed #E6DCD3; }
.sf6 .fx-badges i.on { border: 0; background: #1F4A3A; box-shadow: inset 0 0 0 .3em #3E7A62; }
.sf6 .fx-defi { left: 0; top: 20.5em; width: 40em; height: 11em; background: #FBEFDC; border-radius: 1em; box-shadow: var(--ombre); padding: 1.2em 1.4em; display: grid; gap: .8em; align-content: center; }
.sf6 .fx-defi-t { font-family: var(--titre); font-weight: 600; font-size: 1.35em; color: #9A5B0F; }
.sf6 .fx-defi-t b { font-size: 1.3em; }
.sf6 .fx-rail-defi { height: 1em; background: #F1DDBF; }
.sf6 .fx-rail-defi u { width: 71%; background: #C98A1B; }
.sf6 .fx-rail-defi .fx-cible { left: 70%; }
.sf6 .fx-gagne { justify-self: start; font-weight: 700; color: #FBF5F0; background: #2B7350; border-radius: 999px; padding: .4em 1em; }

/* ---------- Le mouvement (seulement avec .anim) ---------- */
@keyframes df-frappe { from { width: 0; } }
@keyframes df-curseur { 50% { border-right-color: #1F4A3A; } }
@keyframes df-de50 { from { width: 50%; } }
@keyframes df-de64 { from { width: 64%; } }
@keyframes df-montre-nb { from { opacity: 0; } }

/* Étape 1 : le nom s'écrit, l'équipe touche « Commencer », elle apparaît dans la salle */
.anim .demo-ecran:not([hidden]) .fx-frappe { animation: df-frappe 1.4s 1.2s steps(10) both, df-curseur .7s 1.2s 3 step-end; }
.anim .demo-ecran:not([hidden]) .fx-b1 { animation: dm-bouton .3s 3.4s both; }
.anim .demo-ecran:not([hidden]) .fx-b1 .avant { visibility: visible; animation: dm-efface .2s 3.4s both; }
.anim .demo-ecran:not([hidden]) .fx-b1 .apres { animation: dm-fondu .4s 3.6s both; }
.anim .demo-ecran:not([hidden]) .fx-b1 .fx-tap { animation: dm-tap .8s 3s both; }

/* Étape 2 : « Vrai » touché à 4 s, puis la correction */
.anim .demo-ecran:not([hidden]) .fx-sel { animation: df-choix .35s 4.3s both; }
.anim .demo-ecran:not([hidden]) .fx-vf .fx-tap { animation: dm-tap .8s 3.9s both; }
@keyframes df-choix { from { background: #F4ECE5; border-color: #E6DCD3; box-shadow: none; } }

/* Étape 3 : l'équipe choisit (5 s), confirme (7 s), les jauges bougent (8,5 s) */
.anim .demo-ecran:not([hidden]) .fx-opts .fx-choix { animation: df-choix-opt .35s 5.3s both; }
@keyframes df-choix-opt { from { background: #FFFFFF; border-color: #E6DCD3; box-shadow: none; } }
.anim .demo-ecran:not([hidden]) .fx-opts .fx-choix .fx-tap { animation: dm-tap .8s 4.9s both; }
.anim .demo-ecran:not([hidden]) .sf3 .fx-b3 { animation: dm-bouton .3s 7.4s both; }
.anim .demo-ecran:not([hidden]) .sf3 .fx-b3 .avant { visibility: visible; animation: dm-efface .2s 7.4s both; }
.anim .demo-ecran:not([hidden]) .sf3 .fx-b3 .apres { animation: dm-fondu .4s 7.6s both; }
.anim .demo-ecran:not([hidden]) .sf3 .fx-b3 .fx-tap { animation: dm-tap .8s 7s both; }
.anim .demo-ecran:not([hidden]) .sf3 .fx-j .j52, .anim .demo-ecran:not([hidden]) .sf3 .fx-j .j58 { animation: df-de50 1.2s 8.6s ease both; }

/* Étape 4 : la réponse choisie (6 s), le rapport de force monte (8 s) */
.anim .demo-ecran:not([hidden]) .sf4 .fx-opts .fx-choix { animation-delay: 6.3s; }
.anim .demo-ecran:not([hidden]) .sf4 .fx-opts .fx-choix .fx-tap { animation-delay: 5.9s; }
.anim .demo-ecran:not([hidden]) .sf4 .fx-acquis { animation: dm-apparait .6s 7.6s both; }

/* Étape 5 : les barres des réponses de la salle se remplissent */
.anim .demo-ecran:not([hidden]) .sf5 .fx-barres p:nth-child(1) u { animation: dm-remplit 1s 2s ease both; }
.anim .demo-ecran:not([hidden]) .sf5 .fx-barres p:nth-child(2) u { animation: dm-remplit 1.2s 3s ease both; }
.anim .demo-ecran:not([hidden]) .sf5 .fx-barres p:nth-child(3) u { animation: dm-remplit 1s 4s ease both; }

/* Étape 6 : le défi passe de 64 à 71 (13 s), puis la salle gagne (15 s) */
.anim .demo-ecran:not([hidden]) .sf6 .fx-rail-defi u { animation: df-de64 1.5s 13s ease both; }
.anim .demo-ecran:not([hidden]) .sf6 .fx-gagne { animation: dm-apparait .6s 15s both; }

/* Les nombres qui changent : l'ancien jusqu'au moment voulu, puis le nouveau */
.anim .demo-ecran:not([hidden]) .fx-nb .avant { visibility: visible; }
.anim .demo-ecran:not([hidden]) .sf3 .fx-nb .avant { animation: dm-efface .2s 8.6s both; }
.anim .demo-ecran:not([hidden]) .sf3 .fx-nb .apres { animation: dm-fondu .4s 8.7s both; }
.anim .demo-ecran:not([hidden]) .sf6 .fx-nb .avant { animation: dm-efface .2s 13s both; }
.anim .demo-ecran:not([hidden]) .sf6 .fx-nb .apres { animation: dm-fondu .4s 13.1s both; }
