@font-face { font-family: 'Archivo Black'; src: url(/assets/fonts/archivo-black.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Atkinson'; src: url(/assets/fonts/atkinson-400.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Atkinson'; src: url(/assets/fonts/atkinson-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --fond: #F3F6FA;
  --papier: #FFFFFF;
  --encre: #23324A;
  --encre-douce: #5A6A85;
  --ciel: #CFE2F4;
  --ciel-fort: #A9CBEB;
  --peche: #FBE1D2;
  --peche-fort: #F4BFA3;
  --menthe: #C9E6CF;
  --menthe-fort: #8CC9A0;
  --menthe-texte: #2F6B45;
  --abricot: #F5C98E;
  --brume: #E3E9F1;
  --trait: 2.5px solid var(--encre);
  --ombre: 3px 3px 0 rgba(35, 50, 74, .22);
  --ombre-forte: 5px 5px 0 rgba(35, 50, 74, .22);
  --ease: cubic-bezier(.23, 1, .32, 1);
  --titre: 'Archivo Black', 'Arial Black', sans-serif;
  --texte: 'Atkinson', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--fond); color: var(--encre);
  font: 400 18px/1.45 var(--texte); -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
.cache { display: none !important; }

.app { max-width: 520px; margin: 0 auto; padding: 12px 16px calc(28px + env(safe-area-inset-bottom)); min-height: 100dvh; display: flex; flex-direction: column; }

[data-cascade] { animation: entree .42s var(--ease) both; animation-delay: var(--d, 0ms); }
@keyframes entree { from { opacity: 0; transform: translateY(12px); } }

/* Boutons */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 18px; border: var(--trait); border-radius: 14px;
  background: var(--papier); font-weight: 700; box-shadow: var(--ombre);
  transition: transform .12s var(--ease), box-shadow .12s var(--ease); touch-action: manipulation; user-select: none;
}
.bouton:active { transform: translate(2px, 2px) scale(.98); box-shadow: 1px 1px 0 rgba(35, 50, 74, .22); }
.bouton--principal { background: var(--ciel); }
.bouton--grand { width: 100%; min-height: 60px; font-size: 20px; }
.canal--ferme { background: var(--brume); }
.canal__premium { display: inline-block; margin-top: auto; font: 700 13px/1 var(--police-titre, inherit); color: var(--encre-douce); letter-spacing: .04em; }
.parents h2 { margin: 0 0 8px; }
.parents__code { display: flex; gap: 10px; align-items: stretch; }
.parents__champ { flex: 1; min-width: 0; min-height: 48px; padding: 8px 12px; font-size: 18px; border: 2.5px solid var(--encre); border-radius: 14px; background: var(--papier); }
.parents__message { min-height: 1.4em; margin: 8px 0 0; font-weight: 700; }
.parents__note { color: var(--encre-douce); font-size: 15px; }
.bouton--lien { border: 0; box-shadow: none; background: none; text-decoration: underline; text-underline-offset: 4px; color: var(--encre-douce); min-height: 40px; padding: 6px 8px; }
.bouton--lien:active { transform: none; box-shadow: none; }
.bouton--mini { min-height: 38px; padding: 4px 12px; border-width: 2px; font-size: 16px; }

/* Porte */
.porte { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.talkie { position: relative; width: min(340px, 100%); }
.talkie__antenne { position: absolute; right: 38px; top: -46px; width: 18px; height: 60px; background: var(--encre); border-radius: 9px 9px 0 0; }
.talkie__corps { position: relative; background: var(--ciel); border: var(--trait); border-radius: 34px; padding: 30px 22px 26px; box-shadow: var(--ombre-forte); }
.porte__marque { font: 30px/1 var(--titre); margin: 0 0 22px; text-transform: uppercase; }
.porte__form { display: grid; gap: 10px; }
.porte__form label { font-weight: 700; }
.porte__form input { min-height: 54px; border: var(--trait); border-radius: 14px; padding: 10px 14px; font: 700 20px var(--texte); background: var(--papier); }
.porte__form .bouton { margin-top: 8px; background: var(--papier); }
.porte__refus { margin: 0; font-weight: 700; color: #8A3B1E; }

/* En-tête et signal */
.entete { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 10px; margin-bottom: 10px; }
.entete__retour { width: 48px; height: 48px; border: var(--trait); border-radius: 50%; background: var(--papier); font: 22px var(--titre); box-shadow: var(--ombre); }
.entete__titre { margin: 0; font: 17px/1.15 var(--titre); }
.entete__canal { font: 14px var(--titre); background: var(--ciel); border: 2px solid var(--encre); padding: 5px 10px; border-radius: 8px; }
.signal { display: flex; align-items: flex-end; gap: 4px; height: 26px; margin-bottom: 18px; }
.signal__barre { flex: 1; height: var(--h); background: var(--brume); border-radius: 3px; transition: background .3s; }
.signal__barre--ok { background: var(--menthe-fort); }
.signal__barre--ici { background: var(--ciel-fort); outline: 2px solid var(--encre); }

.scene { flex: 1; display: flex; flex-direction: column; }

/* Carte parler */
.carte-parler { display: flex; flex-direction: column; gap: 16px; flex: 1; }
.replique { background: var(--papier); border: var(--trait); border-radius: 22px; padding: 20px 18px; box-shadow: var(--ombre); text-align: center; }
.replique--question { background: var(--ciel); }
.replique__qui { margin: 0 0 6px; font-weight: 700; font-size: 15px; letter-spacing: .02em; color: var(--encre-douce); }
.replique__img { display: block; font-size: 84px; line-height: 1.1; font-family: var(--titre); }
.replique__en { margin: 0; font: clamp(26px, 7.5vw, 34px)/1.15 var(--titre); overflow-wrap: anywhere; }
.replique__fr { margin: 10px 0 0; font-size: 16px; color: var(--encre-douce); }
.mots-cliquables { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 8px; }
.mot-tap { border: 0; background: none; padding: 2px 0; font: inherit; border-bottom: 3px dotted var(--ciel-fort); }
.mot-tap:active { background: var(--ciel); border-radius: 6px; }
.ecoute { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.consigne { margin: 0; text-align: center; font-weight: 700; }

.micro-zone { position: relative; display: grid; place-items: center; padding: 8px 0; }
.parler {
  position: relative; z-index: 1; width: 128px; height: 128px; border-radius: 50%; border: 3px solid var(--encre);
  background: var(--menthe); box-shadow: 0 5px 0 rgba(35, 50, 74, .25);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  transition: transform .14s var(--ease), box-shadow .14s var(--ease), background .2s; touch-action: manipulation;
}
.parler:active { transform: translateY(3px) scale(.97); box-shadow: 0 2px 0 rgba(35, 50, 74, .25); }
.parler:disabled { background: var(--brume); cursor: default; }
.parler__icone { font-size: 38px; line-height: 1; }
.parler__texte { font: 16px var(--titre); }
.en-ecoute .parler { background: var(--peche-fort); }
.ondes { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 92px; pointer-events: none; opacity: 0; transition: opacity .2s; }
.ondes span { width: 8px; height: 30px; border-radius: 4px; background: var(--peche-fort); transform: scaleY(calc(.4 + var(--n, 0) * 2.4)); transition: transform .08s; }
.ondes span:nth-child(n+3) { display: none; }
.en-ecoute .ondes { opacity: 1; }
.en-analyse .parler { animation: capte 1s ease-in-out infinite; }
@keyframes capte { 50% { transform: scale(.95); } }

.resultat:empty { display: none; }
.resultat { background: var(--papier); border: var(--trait); border-radius: 18px; padding: 14px 16px; }
.resultat__tete { display: flex; align-items: center; gap: 10px; font: 20px var(--titre); }
.resultat__tete--ok strong { color: var(--menthe-texte); }
.resultat__mots { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; font: 20px/1.2 var(--titre); }
.mot { padding: 4px 9px; border-radius: 9px; border: 2px solid var(--encre); font: inherit; }
.mot--ok { background: var(--menthe); }
.mot--revoir { background: var(--peche); border-style: dashed; }
.resultat__astuce { margin: 8px 0 0; font-size: 15px; color: var(--encre-douce); }
.resultat__entendu, .resultat__exemple { margin: 10px 0 0; }
.resultat__entendu q { font-weight: 700; }
.resultat__exemple span { font-weight: 700; }
.resultat__erreur { margin: 0; font-weight: 700; color: #8A3B1E; }
.actions { display: flex; gap: 10px; }
.actions:empty { display: none; }
.actions .bouton { flex: 1; min-height: 56px; }

.etoiles { display: inline-flex; gap: 2px; font-size: 22px; line-height: 1; }
.etoile { color: var(--brume); }
.etoile--pleine { color: var(--abricot); -webkit-text-stroke: 1.5px var(--encre); }

/* Test : choix d'images */
.choix { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.choix__case { aspect-ratio: 1; border: var(--trait); border-radius: 22px; background: var(--papier); font-size: 64px; box-shadow: var(--ombre); touch-action: manipulation; }
.choix__case--ok { background: var(--menthe); }
.choix__case--non { background: var(--peche); animation: non .3s; }
@keyframes non { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* Bilans et intro de mission */
.bilan { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; text-align: center; padding: 10px 0; }
.bilan__sur { margin: 0; font-weight: 700; color: var(--encre-douce); }
.bilan__titre { margin: 0; font: clamp(28px, 8vw, 40px)/1.05 var(--titre); }
.bilan__texte { margin: 0; }
.bilan__etoiles .etoiles { font-size: 54px; gap: 8px; }
.bilan__lily { display: grid; place-items: center; }

/* Lily */
.lily { display: inline-block; width: 52px; height: 52px; border-radius: 50%; border: var(--trait); overflow: hidden; background: var(--peche); flex: none; transition: transform .3s var(--ease); }
.lily svg { display: block; width: 100%; height: 100%; }
.lily--grand { width: 128px; height: 128px; box-shadow: var(--ombre); }
.lily--appel { width: 64px; height: 64px; }
.lily__fond { fill: var(--peche); }
.lily--sam { background: var(--menthe); }
.lily--sam .lily__fond { fill: var(--menthe); }
.lily--sam .lily__cheveux { fill: #3B2F2A; }
.lily--sam .lily__visage { fill: #E9BF9F; }
.lily__epaules { fill: var(--ciel-fort); }
.lily__sourcils { fill: none; stroke: #3B2F2A; stroke-width: 2.4; stroke-linecap: round; }
.lily__cheveux { fill: #6B4A3A; }
.lily__visage { fill: #F7D9C4; }
.lily__yeux { fill: var(--encre); transform-box: fill-box; transform-origin: center; animation: cligne 4.2s infinite; }
.lily__joue { fill: #F2A99A; opacity: .55; }
.lily__sourire { fill: none; stroke: var(--encre); stroke-width: 2.6; stroke-linecap: round; }
.lily__bouche { fill: #8A3B3B; transform-box: fill-box; transform-origin: center; transform: scaleY(0); }
@keyframes cligne { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.lily-parle .lily__sourire { opacity: 0; }
.lily-parle .lily__bouche { animation: parle .26s ease-in-out infinite alternate; }
@keyframes parle { from { transform: scaleY(.25); } to { transform: scaleY(1); } }
.enfant-parle .lily { transform: rotate(-8deg); }

/* Accueil : le poste */
.accueil { display: flex; flex-direction: column; gap: 16px; }
.poste { background: var(--ciel); border: var(--trait); border-radius: 28px; padding: 16px 18px 18px; box-shadow: var(--ombre-forte); }
.poste__ligne { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.poste__nom { margin: 0; font-weight: 700; }
.poste__etat { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.voyant { width: 10px; height: 10px; border-radius: 50%; background: var(--menthe-fort); border: 2px solid var(--encre); animation: voyant 2.4s ease-in-out infinite; }
@keyframes voyant { 50% { opacity: .35; } }
.poste__serie { margin: 0; font: 16px var(--titre); background: var(--papier); border: 2px solid var(--encre); border-radius: 10px; padding: 6px 10px; }
.poste__titre { margin: 16px 0 14px; font: clamp(36px, 11vw, 52px)/.95 var(--titre); text-transform: uppercase; }

.semaine { background: var(--papier); border: 2px solid var(--encre); border-radius: 18px; padding: 12px; display: grid; gap: 8px; }
.semaine__jours { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.jour { aspect-ratio: 1; max-width: 40px; justify-self: center; width: 100%; display: grid; place-items: center; border-radius: 50%; background: var(--brume); font: 14px var(--titre); color: var(--encre-douce); }
.jour--fait { background: var(--menthe); color: var(--encre); }
.jour--ajd { outline: 2px solid var(--encre); outline-offset: 2px; }
.objectif__texte { margin: 0; font-size: 15px; font-weight: 700; }
.objectif__barre { height: 10px; border-radius: 5px; background: var(--brume); overflow: hidden; }
.objectif__barre span { display: block; height: 100%; background: var(--menthe-fort); transform-origin: left; transform: scaleX(var(--p)); transition: transform .6s var(--ease); }

.canal-phare {
  display: grid; gap: 4px; text-align: left; width: 100%; padding: 18px; border: var(--trait); border-radius: 22px;
  background: var(--peche); box-shadow: var(--ombre-forte); transition: transform .12s var(--ease), box-shadow .12s var(--ease);
}
.canal-phare:active { transform: translate(2px, 2px) scale(.99); box-shadow: 2px 2px 0 rgba(35, 50, 74, .22); }
.canal-phare__sur { color: var(--encre-douce); font-weight: 700; font-size: 15px; }
.canal-phare__titre { font: 26px/1.1 var(--titre); }
.canal-phare__texte { color: var(--encre-douce); }
.canal-phare--fini { background: var(--menthe); }

.canaux__titre { margin: 8px 0 0; font: 20px var(--titre); text-transform: uppercase; }
.canaux { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.canal {
  width: 100%; height: 100%; display: grid; gap: 4px; align-content: start; text-align: left; padding: 14px;
  border: var(--trait); border-radius: 20px; background: var(--papier); box-shadow: var(--ombre);
  transition: transform .12s var(--ease), box-shadow .12s var(--ease);
}
.canal:active { transform: translate(2px, 2px) scale(.98); box-shadow: 1px 1px 0 rgba(35, 50, 74, .22); }
.canal--ici { background: var(--ciel); }
.canal__num { font: 13px var(--titre); color: var(--encre-douce); }
.canal__icone { font-size: 34px; line-height: 1.1; }
.canal__titre { font: 17px/1.1 var(--titre); }
.canal__fr { font-size: 14px; color: var(--encre-douce); line-height: 1.25; }
.canal .etoiles { margin-top: 4px; font-size: 18px; }
.accueil__liens { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; }

/* Niveaux : celui en cours ouvert, les autres repliés. Le bilan prend toute la ligne : jamais
   de carte seule en fin de grille. */
.niveau { border-top: var(--trait); padding-top: 12px; }
.niveau__tete { list-style: none; display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 4px 10px; cursor: pointer; padding: 4px 0 12px; }
.niveau__tete::-webkit-details-marker { display: none; }
.niveau__nom { font: 22px var(--titre); }
.niveau__titre { font-weight: 700; color: var(--encre-douce); }
.niveau__etoiles { grid-column: 2; grid-row: 2; font-weight: 700; font-size: 15px; white-space: nowrap; }
.niveau__tete::after { content: '+'; grid-column: 3; grid-row: 1; justify-self: end; font: 22px var(--titre); transition: transform .2s var(--ease); }
.niveau[open] > .niveau__tete::after { transform: rotate(45deg); }
.niveau--reussi .niveau__etoiles { color: var(--menthe-texte); }
.canaux > li[data-bilan] { grid-column: 1 / -1; }
.canal--bilan { background: var(--menthe); grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; }
.canal--bilan .canal__num { grid-column: 1 / -1; }
.canal--bilan .canal__icone { grid-row: span 2; }

/* Choix du parcours */
.parcours { min-height: 100dvh; display: flex; flex-direction: column; gap: 18px; padding: 24px 0; }
.parcours__titre { margin: 0; font: clamp(36px, 11vw, 52px)/.95 var(--titre); text-transform: uppercase; }
.parcours__question { margin: 0; font: 22px var(--titre); }
.parcours__choix { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.parcours__carte {
  width: 100%; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto 1fr; column-gap: 16px; row-gap: 2px;
  text-align: left; padding: 18px; border: var(--trait); border-radius: 24px; background: var(--papier); box-shadow: var(--ombre-forte);
  transition: transform .12s var(--ease), box-shadow .12s var(--ease);
}
.parcours__carte:active { transform: translate(2px, 2px) scale(.99); box-shadow: 2px 2px 0 rgba(35, 50, 74, .22); }
.parcours__carte .lily { grid-row: 1 / -1; width: 92px; height: 92px; }
.parcours__carte--actuel { background: var(--ciel); }
.parcours__nom { font: 26px/1 var(--titre); text-transform: uppercase; }
.parcours__age { font-weight: 700; color: var(--encre-douce); }
.parcours__texte { margin-top: 6px; line-height: 1.35; }
.parcours__note { margin: 0; color: var(--encre-douce); font-size: 15px; }

/* L'appel avec Lily */
.appel { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.appel__tete { display: flex; align-items: center; gap: 12px; background: var(--ciel); border: var(--trait); border-radius: 20px; padding: 10px 14px; }
.appel__nom { margin: 0; font: 17px var(--titre); }
.appel__etat { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.appel__chrono { font-variant-numeric: tabular-nums; font-weight: 700; }
.fil { display: flex; flex-direction: column; gap: 10px; min-height: 180px; }
.bulle { max-width: 86%; padding: 12px 14px; border: 2px solid var(--encre); border-radius: 18px; animation: bulle .3s var(--ease) both; }
@keyframes bulle { from { opacity: 0; transform: translateY(8px) scale(.97); } }
.bulle__en { margin: 0; font-weight: 700; font-size: 19px; line-height: 1.3; }
.bulle__fr { margin: 4px 0 0; font-size: 15px; color: var(--encre-douce); }
.fil:not(.fil--fr) .bulle--lily .bulle__fr { display: none; }
.bulle--lily { align-self: flex-start; background: var(--papier); border-bottom-left-radius: 6px; }
.bulle--moi { align-self: flex-end; background: var(--menthe); border-bottom-right-radius: 6px; }
.bulle--moi .etoiles { margin-top: 6px; font-size: 18px; }
.bulle--modele { align-self: flex-start; background: var(--peche); border-style: dashed; }
.bulle--info { align-self: center; max-width: 100%; background: var(--brume); border-color: transparent; text-align: center; }
.bulle--info .bulle__en { font-weight: 400; font-size: 16px; }
.appel__pouce:empty { display: none; }
.pouce { display: flex; justify-content: center; }
.pouce__texte { margin: 0; padding: 8px 14px; border-radius: 12px; background: var(--abricot); font-weight: 700; animation: bulle .3s var(--ease) both; }
.appel__outils { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .lily__bouche { transform: scaleY(0); }
  .lily-parle .lily__bouche { transform: scaleY(.7); }
}

:focus-visible { outline: 3px solid var(--ciel-fort); outline-offset: 3px; }
.parler:focus-visible, .entete__retour:focus-visible { outline-offset: 5px; }
