/* Le mouvement de l'appli (chantier interface, chantiers/interface-journal.md). Quatre gestes, toujours les
   mêmes : le bouton répond, l'écran arrive du côté où l'on va, la carte se présente, la récompense se fête.
   - Seuls transform et opacity sont animés : ni ombre, ni flou, ni taille (règles des performances).
   - Tout dépend de la classe `vie` sur <html>, posée par vie.js : absente si le téléphone demande de
     réduire les animations ou si la page porte `allege`. Sans vie.js, cette feuille ne fait rien.
   - Cette feuille n'est chargée que par l'appli, jamais par la page du jeu : rien ne tourne pendant un round.
   - `vie-arrive` est posée sur #vue à l'arrivée d'un écran (changement d'adresse) et retirée ensuite : un
     écran qui se redessine sur place ne rejoue rien. */
@media (prefers-reduced-motion: no-preference) {

/* ---------- 1. Le bouton répond ---------- */
.vie :is(a, button, summary) { transition: transform .18s cubic-bezier(.3,1.7,.5,1); }
.vie .appui { transform: scale(.94); transition-duration: .06s; }
.vie :is(a.defi, a.lieu, a.carte, .volet summary).appui { transform: scale(.975); }
.vie .cta { position: relative; overflow: hidden; }
.vie .cta.appui { transform: translateY(3px) scale(.985); }
/* Le grand bouton brille une fois quand l'écran est posé : un reflet le traverse. « C'est ici. » */
.vie #vue.vie-arrive .cta::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 38%; background: linear-gradient(100deg, rgba(255,255,255,0), rgba(255,255,255,.55), rgba(255,255,255,0)); transform: translateX(-140%) skewX(-18deg); animation: vie-reflet .7s ease-out 1s both; pointer-events: none; }
@keyframes vie-reflet { to { transform: translateX(330%) skewX(-18deg); } }
/* La barre du bas : l'icône choisie saute. */
.vie #onglets a.on svg { animation: vie-saut .36s cubic-bezier(.3,1.8,.5,1); }
@keyframes vie-saut { 0% { transform: scale(.7) translateY(3px); } 60% { transform: scale(1.22) translateY(-3px); } }

/* ---------- 2. L'écran arrive du côté où l'on va ---------- */
.vie #vue.vie-arrive[data-sens="avant"] > * { animation: vie-avant .34s cubic-bezier(.2,.8,.2,1) both; }
.vie #vue.vie-arrive[data-sens="retour"] > * { animation: vie-retour .3s cubic-bezier(.2,.8,.2,1) both; }
.vie #vue.vie-arrive[data-sens="onglet"] > * { animation: vie-onglet .3s cubic-bezier(.2,.8,.2,1) both; }
.vie #vue.vie-arrive[data-sens] > :nth-child(2) { animation-delay: .05s; }
.vie #vue.vie-arrive[data-sens] > :nth-child(3) { animation-delay: .1s; }
.vie #vue.vie-arrive[data-sens] > :nth-child(4) { animation-delay: .15s; }
.vie #vue.vie-arrive[data-sens] > :nth-child(n+5) { animation-delay: .2s; }
/* Un écran plein (la fiche d'une étape, l'affiche) ne glisse pas d'un bloc : il paraît, puis ses pièces se posent. */
.vie #vue.vie-arrive.plein[data-sens] > * { animation: vie-parait .3s ease-out both; }
@keyframes vie-avant { from { opacity: 0; transform: translateX(34px); } }
@keyframes vie-retour { from { opacity: 0; transform: translateX(-34px); } }
@keyframes vie-onglet { from { opacity: 0; transform: translateY(16px) scale(.985); } }
@keyframes vie-parait { from { opacity: 0; } }
@keyframes vie-pop { from { opacity: 0; transform: scale(.3); } }
@keyframes vie-monte { from { opacity: 0; transform: translateY(26px); } }
@keyframes vie-titre { from { opacity: 0; transform: translateX(-22px) skewX(-8deg); } }
@keyframes vie-remplit { from { transform: scaleX(var(--vie-de, 0)); } }

/* ---------- 3. La carte se présente ---------- */
/* L'accueil : le décor se pose, le nom glisse, la bulle d'Alloy s'ouvre, le chemin se remplit jusqu'à
   l'étape en cours, qui s'allume ; JOUER monte. */
.vie #vue.vie-arrive .quartier > img { animation: vie-decor 1.2s cubic-bezier(.2,.7,.2,1) both; }
@keyframes vie-decor { from { transform: scale(1.12); } }
.vie #vue.vie-arrive .quartier header h1, .vie #vue.vie-arrive .quartier .action h1 { animation: vie-titre .4s cubic-bezier(.2,.8,.2,1) .12s both; }
.vie #vue.vie-arrive .quartier .appel { transform-origin: 100% 100%; animation: vie-bulle .34s cubic-bezier(.3,1.6,.5,1) .3s both; }
@keyframes vie-bulle { from { opacity: 0; transform: scale(.6); } }
.vie .chemin i { transform-origin: 0 50%; }
.vie #vue.vie-arrive .chemin i { animation: vie-remplit .7s cubic-bezier(.3,.7,.2,1) .35s both; }
.vie #vue.vie-arrive .chemin .faite { animation: vie-pop .3s cubic-bezier(.3,1.8,.5,1) .45s both; }
.vie #vue.vie-arrive .chemin .ici { animation: vie-pop .42s cubic-bezier(.3,2,.5,1) .95s both; }
.vie #vue.vie-arrive .quartier .cta { animation: vie-monte .4s cubic-bezier(.3,1.5,.5,1) .4s both; }
.vie #vue.vie-arrive .defi { animation: vie-avant .4s cubic-bezier(.2,.8,.2,1) .45s both; }
.vie #vue.vie-arrive .defi:nth-child(2) { animation-delay: .55s; }
.vie #vue.vie-arrive .defi:nth-child(n+3) { animation-delay: .65s; }
/* La fiche d'une étape : la démonstration s'ouvre, le titre claque, les étoiles se posent, JOUER monte.
   Le boss : son affiche se pose d'un coup, plus lourde, et Alloy parle après. */
.vie #vue.vie-arrive .story .cadre { animation: vie-cadre .4s cubic-bezier(.2,.8,.2,1) both; }
@keyframes vie-cadre { from { opacity: 0; transform: scale(.94); } }
.vie #vue.vie-arrive .story .fond { animation: vie-boss .55s cubic-bezier(.2,.9,.2,1) both; }
@keyframes vie-boss { from { transform: scale(1.18); } }
.vie #vue.vie-arrive .story .titre { animation: vie-titre .4s cubic-bezier(.2,.8,.2,1) .2s both; }
.vie #vue.vie-arrive .story .appel { transform-origin: 0 100%; animation: vie-bulle .34s cubic-bezier(.3,1.6,.5,1) .55s both; }
.vie #vue.vie-arrive .story .cta { animation: vie-monte .42s cubic-bezier(.3,1.5,.5,1) .28s both; }
.vie #vue.vie-arrive .story .deja .etoiles i.on { animation: vie-pop .3s cubic-bezier(.3,1.8,.5,1) .45s both; }
.vie #vue.vie-arrive .story .deja .etoiles i.on:nth-child(2) { animation-delay: .55s; }
.vie #vue.vie-arrive .story .deja .etoiles i.on:nth-child(3) { animation-delay: .65s; }
/* Le classement et le profil : les tuiles sautent, la carte « toi » monte, les lignes entrent une à une,
   les barres se remplissent quand leur volet s'ouvre. */
.vie #vue.vie-arrive .tuiles div { animation: vie-pop .34s cubic-bezier(.3,1.6,.5,1) both; }
.vie #vue.vie-arrive .tuiles div:nth-child(2) { animation-delay: .08s; }
.vie #vue.vie-arrive .tuiles div:nth-child(3) { animation-delay: .16s; }
.vie #vue.vie-arrive .moi { animation: vie-monte .4s cubic-bezier(.3,1.5,.5,1) .1s both; }
.vie .liste.rangs > div:not(.attente) { animation: vie-avant .3s ease-out both; }
.vie .liste.rangs > div:nth-child(2) { animation-delay: .05s; }
.vie .liste.rangs > div:nth-child(3) { animation-delay: .1s; }
.vie .liste.rangs > div:nth-child(4) { animation-delay: .15s; }
.vie .liste.rangs > div:nth-child(n+5) { animation-delay: .2s; }
/* Changer de question : le titre glisse du côté de la flèche. */
.vie #vue[data-tourne="1"] .question .titre { animation: vie-avant .26s cubic-bezier(.2,.8,.2,1) both; }
.vie #vue[data-tourne="-1"] .question .titre { animation: vie-retour .26s cubic-bezier(.2,.8,.2,1) both; }
.vie #vue[data-tourne] .moi { animation: vie-monte .3s cubic-bezier(.3,1.5,.5,1) both; }
.vie .barre u { transform-origin: 0 50%; }
.vie .volet[open] .barre u { animation: vie-remplit .8s cubic-bezier(.3,.7,.2,1) .15s both; }
.vie .volet[open] .barre:nth-of-type(2) u { animation-delay: .22s; }
.vie .volet[open] .barre:nth-of-type(3) u { animation-delay: .29s; }
.vie .volet[open] .barre:nth-of-type(4) u { animation-delay: .36s; }
.vie .volet[open] .barre:nth-of-type(n+5) u { animation-delay: .43s; }
/* Le choix du niveau : la pastille saute sur la carte du quartier ; ses trois cartes montent l'une après l'autre. */
.vie #vue.vie-arrive .pastille-niveau { animation: vie-pop .34s cubic-bezier(.3,1.6,.5,1) .5s both; }
.vie #vue.vie-arrive .carte-niveau { animation: vie-monte .4s cubic-bezier(.3,1.5,.5,1) .1s both; }
.vie #vue.vie-arrive .carte-niveau:nth-child(2) { animation-delay: .2s; }
.vie #vue.vie-arrive .carte-niveau:nth-child(3) { animation-delay: .3s; }
/* L'affiche d'arrivée : le logo se pose (il est centré par un transform : on le garde), le titre glisse, le bouton monte. */
.vie #vue.vie-arrive .heros .marque { animation: vie-logo .5s cubic-bezier(.3,1.6,.5,1) .1s both; }
@keyframes vie-logo { from { opacity: 0; transform: translateX(-50%) scale(.4) rotate(-12deg); } }
.vie #vue.vie-arrive .heros h1 { animation: vie-titre .45s cubic-bezier(.2,.8,.2,1) .25s both; }
.vie #vue.vie-arrive .heros .cta { animation: vie-monte .42s cubic-bezier(.3,1.5,.5,1) .5s both; }
/* Le bouton de l'affiche a son halo (tunnel.css), qui déborde du bouton : pas de reflet rogné sur celui-là. */
.vie .arrivee .cta { overflow: visible; }
.vie #vue.vie-arrive .arrivee .cta::after { content: none; }
/* Une erreur : le message se secoue une fois, pour qu'on le voie. */
.vie .erreur { animation: vie-secoue .4s ease-out; }
@keyframes vie-secoue { 20% { transform: translateX(-7px); } 45% { transform: translateX(6px); } 70% { transform: translateX(-3px); } }

/* ---------- 4. La récompense se fête : gros, une seule fois ---------- */
/* Ce qui vient d'être gagné (vie.js pose `vie-neuf`) tombe à sa place de très haut, bien après le reste. */
.vie #vue.vie-arrive .chemin .faite.vie-neuf { z-index: 3; animation: vie-tombe .6s cubic-bezier(.3,1.7,.5,1) 1s both; }
.vie #vue.vie-arrive .chemin .faite.vie-neuf ~ .ici { animation-delay: 1.7s; }
.vie #vue.vie-arrive .chemin i.vie-neuf { animation-duration: .9s; animation-delay: 1.1s; }
@keyframes vie-tombe { from { opacity: 0; transform: scale(3.4) rotate(-20deg); } 60% { opacity: 1; } }
.vie .pastille.serie.vie-neuf { animation: vie-bond .7s cubic-bezier(.3,1.7,.5,1) 1.2s both; }
.vie .defi.vie-neuf { animation: vie-bond .6s cubic-bezier(.3,1.7,.5,1) 1.4s both !important; }
@keyframes vie-bond { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
/* Les éclats : des carrés aux trois couleurs du logo, lancés par vie.js, qui s'effacent d'eux-mêmes. */
.vie-eclat { position: fixed; left: 0; top: 0; width: 14px; height: 14px; border-radius: 3px; pointer-events: none; z-index: 50; animation: vie-eclat .95s cubic-bezier(.1,.7,.3,1) both; }
@keyframes vie-eclat { from { opacity: 1; transform: translate(var(--x), var(--y)) scale(1) rotate(0); } to { opacity: 0; transform: translate(calc(var(--x) + var(--dx)), calc(var(--y) + var(--dy))) scale(.4) rotate(280deg); } }

/* ---------- Ce qui vit en continu, sur l'accueil seulement (classe `vie-continu`, un interrupteur dans vie.js) ---------- */
/* L'étape en cours appelle : une onde part d'elle. La flamme de la série respire. Arrêtées quand l'écran est caché. */
.vie-continu .chemin .ici:not(.boss)::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #FFD166; opacity: 0; animation: vie-onde 2.2s ease-out 1.6s infinite; pointer-events: none; }
@keyframes vie-onde { 0% { opacity: .9; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(1.75); } }
.vie-continu .pastille.serie:not(.vie-neuf) img { transform-origin: 50% 90%; animation: vie-flamme 1.8s ease-in-out infinite; }
@keyframes vie-flamme { 50% { transform: scale(1.08) rotate(-3deg); } }
.vie-cache .chemin .ici::after, .vie-cache .pastille.serie img { animation-play-state: paused; }

}
