/* Qui suis-je ? Mon trésor à moi — univers enfant.
   Deux mondes, un seul système : les variables changent, la structure non. */

:root {
  --ground: #FDF4F7;
  --ground-2: #F7E6EC;
  --carte: #FFFFFF;
  --encre: #37292B;
  --encre-2: #7B6A65;
  --accent: #8B1538;
  --doux: #F9E4EA;
  --or: #B8862F;
  --or-doux: #F4E7C8;
  --urgence: #9E2B25;
  --urgence-fond: #FFF5F3;
  --rayon: 20px;
  --ombre: 0 8px 28px rgba(80, 40, 30, .10);
}
body[data-parcours="samuel"] {
  --ground: #F1F6FB;
  --ground-2: #DFEAF5;
  --encre: #2A2F36;
  --encre-2: #66707C;
  --accent: #1E4A7B;
  --doux: #DBE7F3;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  font-size: 16px; line-height: 1.6;
  color: var(--encre);
  background: linear-gradient(178deg, var(--ground) 0%, var(--ground-2) 100%);
  background-attachment: fixed;
  min-height: 100dvh;
  overflow-x: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
:focus-visible { outline: 3px solid var(--or); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.ecran { display: none; max-width: 560px; margin: 0 auto; padding: 24px 18px 110px; }
.ecran.actif { display: block; }
.cache { display: none !important; }

/* ---------------------------------------------------------- activation */

#ecran-activation { display: none; min-height: 100dvh; padding: 32px 22px; text-align: center; }
#ecran-activation.actif { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.titre-appli {
  font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic;
  font-size: clamp(30px, 9vw, 40px); font-weight: 600; color: var(--accent); line-height: 1.05;
}
.sous-titre { font-family: 'Cormorant Garamond', Georgia, serif; font-size: clamp(19px, 5.5vw, 24px); color: var(--encre-2); margin-top: 2px; }
.josue-grand { width: min(270px, 74vw); margin: 18px 0 10px; filter: drop-shadow(0 12px 28px rgba(140, 110, 40, .3)); }
.invite { font-size: 17px; margin-bottom: 14px; }
.champ-code {
  width: 100%; max-width: 300px; padding: 15px 20px; border-radius: 28px;
  border: 3px solid var(--doux); background: #fff; text-align: center;
  font-size: 19px; letter-spacing: .09em; text-transform: uppercase;
}
.champ-code:focus { outline: none; border-color: var(--accent); }
.bouton-principal {
  margin-top: 16px; padding: 15px 38px; border-radius: 28px;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 16px;
  box-shadow: 0 8px 22px rgba(139, 21, 56, .26);
}
body[data-parcours="samuel"] .bouton-principal { box-shadow: 0 8px 22px rgba(30, 74, 123, .26); }
.bouton-principal:disabled { opacity: .55; }
.pacte {
  margin-top: 26px; max-width: 330px; text-align: left;
  background: rgba(255, 255, 255, .8); border: 1px solid rgba(184, 134, 47, .34);
  border-radius: 18px; padding: 16px 18px;
}
.pacte h2 { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: 17px; color: var(--accent); margin-bottom: 7px; }
.pacte p { font-size: 13.5px; line-height: 1.55; color: var(--encre-2); }
.pacte p + p { margin-top: 6px; }
.pacte b { color: var(--encre); }
.erreur { color: var(--urgence); font-size: 14.5px; margin-top: 12px; max-width: 320px; }

/* ---------------------------------------------------------------- entête */

.entete { display: flex; align-items: flex-start; gap: 12px; padding-top: 6px; margin-bottom: 18px; }
.entete h1 { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: 27px; color: var(--accent); line-height: 1.12; }
.entete p { font-size: 14px; color: var(--encre-2); margin-top: 3px; }
.josue-perche { width: 76px; flex: none; margin-left: auto; filter: drop-shadow(0 6px 14px rgba(140, 110, 40, .26)); }

/* ----------------------------------------------------------------- carte */

.carte { background: var(--carte); border-radius: var(--rayon); padding: 22px; box-shadow: var(--ombre); margin-bottom: 16px; }
.etiquette { display: inline-block; background: var(--doux); color: var(--accent); padding: 5px 14px; border-radius: 18px; font-size: 12px; font-weight: 800; }
.carte h2 { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 23px; font-weight: 600; line-height: 1.22; margin: 12px 0 8px; }
.carte p { font-size: 15px; color: var(--encre-2); }
.bouton-large { display: block; width: 100%; margin-top: 16px; padding: 15px; border-radius: 16px; background: var(--accent); color: #fff; font-weight: 800; font-size: 15.5px; }

/* --------------------------------------------------------------- récolte */

.scene { position: relative; border-radius: var(--rayon); overflow: hidden; box-shadow: var(--ombre); margin-bottom: 14px; }
.scene img.fond { display: block; width: 100%; height: auto; }
.scene .eclot { position: absolute; right: 7%; bottom: 9%; width: 30%; filter: drop-shadow(0 10px 18px rgba(60, 20, 30, .38)); }
.scene figcaption {
  position: absolute; inset: auto 0 0 0; padding: 22px 15px 11px;
  background: linear-gradient(transparent, rgba(30, 20, 22, .68)); color: #fff;
  font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: 15px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .5);
}
.compteur { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 13px 15px; border-radius: 18px; background: rgba(255, 255, 255, .65); margin-bottom: 16px; }
.compteur img { width: 28px; height: auto; }
.compteur img.eteint { opacity: .2; filter: grayscale(1); }
.compteur b { font-size: 12.5px; font-weight: 800; color: var(--encre-2); margin-left: 5px; }

.titre-section { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: 20px; color: var(--accent); margin: 22px 0 11px; }
.espace {
  display: flex; gap: 14px; align-items: center; width: 100%; text-align: left;
  background: rgba(255, 255, 255, .75); border: 1px solid rgba(0, 0, 0, .06);
  border-radius: 18px; padding: 15px 16px; margin-bottom: 10px;
}
.espace:active { background: #fff; }
.espace .icone { width: 44px; height: 44px; flex: none; border-radius: 14px; background: var(--doux); display: grid; place-items: center; font-size: 21px; }
.espace h3 { font-size: 15px; font-weight: 800; }
.espace small { font-size: 12px; color: var(--encre-2); }
.espace.secrete { border-color: rgba(184, 134, 47, .45); background: linear-gradient(120deg, rgba(244, 231, 200, .5), rgba(255, 255, 255, .75)); }
.espace.secrete .icone { background: rgba(184, 134, 47, .2); }

/* ------------------------------------------------------------------ jour */

.bloc { background: var(--carte); border-radius: 18px; padding: 20px; margin-bottom: 14px; box-shadow: 0 4px 18px rgba(80, 40, 30, .07); }
.bloc h3 { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: 18px; color: var(--accent); margin-bottom: 12px; }
.bloc p { font-size: 15.5px; line-height: 1.72; color: var(--encre); }
.bloc p + p { margin-top: 10px; }
.bloc p.dit {
  font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: 16.5px;
  background: var(--doux); border-radius: 13px; padding: 11px 15px; color: #4E3C38;
}
.bloc li { font-size: 15px; line-height: 1.66; margin-left: 20px; }

.parole { background: linear-gradient(140deg, var(--doux), rgba(255, 255, 255, .6)); border: 1px solid rgba(184, 134, 47, .3); border-radius: 20px; padding: 22px; margin-bottom: 14px; text-align: center; }
.parole .sur-titre { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.parole p { font-size: 15px; line-height: 1.66; margin-top: 10px; }
.parole p.liberatrice { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: 20px; color: var(--accent); line-height: 1.45; }

.urgence { background: var(--urgence-fond); border: 1px solid rgba(158, 43, 37, .28); border-radius: 18px; padding: 18px; margin-bottom: 14px; }
.urgence h3 { font-size: 13.5px; font-weight: 800; color: var(--urgence); margin-bottom: 9px; }
.urgence p, .urgence li { font-size: 14px; line-height: 1.7; color: #5A3B38; }
.urgence a { color: var(--urgence); font-weight: 800; }

.validation { text-align: center; padding: 16px 0 6px; }
.validation button {
  width: 92px; height: 92px; border-radius: 50%;
  border: 3px solid var(--accent); background: #fff;
  font-size: 42px; transition: transform .25s, background .3s, box-shadow .3s;
}
.validation button:active { transform: scale(.94); }
.validation button.fait {
  background: var(--accent); color: #fff;
  box-shadow: 0 0 0 12px rgba(139,21,56,.12), 0 12px 30px rgba(139,21,56,.25);
  animation: eclot .55s ease-out;
}
body[data-parcours="samuel"] .validation button.fait {
  box-shadow: 0 0 0 12px rgba(30,74,123,.12), 0 12px 30px rgba(30,74,123,.25);
}
@keyframes eclot {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.15); }
  70%  { transform: scale(.95); }
  100% { transform: scale(1); }
}
.validation p { font-size: 13.5px; color: var(--encre-2); margin-top: 11px; font-style: italic; }

.recompense { background: linear-gradient(140deg, var(--or-doux), rgba(255, 255, 255, .7)); border: 1px solid rgba(184, 134, 47, .36); border-radius: 18px; padding: 20px; margin-bottom: 14px; text-align: center; }
.recompense img { display: block; margin: 0 auto 10px; max-height: 120px; width: auto; }
.recompense h3 { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: 17px; color: var(--or); margin-bottom: 8px; }
.recompense p { font-size: 15px; line-height: 1.66; }
.verset { text-align: center; padding: 16px 10px 0; border-top: 1px solid rgba(139, 21, 56, .14); }
.verset p { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: 14.5px; color: var(--encre-2); line-height: 1.66; }

/* ---------------------------------------------------------------- écrits */

.sceau { display: flex; gap: 12px; align-items: flex-start; background: rgba(184, 134, 47, .12); border: 1px solid rgba(184, 134, 47, .34); border-radius: 16px; padding: 14px 16px; margin-bottom: 15px; }
.sceau span { font-size: 21px; }
.sceau p { font-size: 13px; line-height: 1.6; color: #5A4A45; }
.outils { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 9px; margin-bottom: 18px; }
.outil { padding: 13px 6px; background: var(--carte); border: 1px solid rgba(0, 0, 0, .07); border-radius: 15px; text-align: center; }
.outil span { display: block; font-size: 22px; }
.outil b { font-size: 11px; font-weight: 800; color: var(--encre-2); }
.entree { background: var(--carte); border-radius: 17px; padding: 17px; margin-bottom: 11px; box-shadow: 0 3px 14px rgba(80, 40, 30, .06); }
.entree .quand { font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); }
.entree h4 { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: 16.5px; margin: 6px 0; }
.entree p { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: 14.5px; line-height: 1.66; color: #584744; }
.entree img { display: block; width: 100%; border-radius: 12px; margin-top: 10px; }
.vide { text-align: center; padding: 32px 18px; color: var(--encre-2); font-style: italic; font-size: 14.5px; }

.redaction textarea {
  width: 100%; min-height: 150px; padding: 15px; border-radius: 16px;
  border: 2px solid var(--doux); background: #fff; font-size: 16px; line-height: 1.65; resize: vertical;
}
.redaction textarea:focus { outline: none; border-color: var(--accent); }
.redaction .ligne { display: flex; gap: 10px; margin-top: 12px; }
.redaction .ligne button { flex: 1; padding: 13px; border-radius: 14px; font-weight: 800; font-size: 15px; }
.enregistrer { background: var(--accent); color: #fff; }
.annuler { background: rgba(0, 0, 0, .06); color: var(--encre-2); }
#toile { width: 100%; height: 300px; border-radius: 16px; border: 2px solid var(--doux); background: #fff; touch-action: none; display: block; }

/* ------------------------------------------------------------ navigation */

.barre {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  display: flex; justify-content: space-around; align-items: center;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px);
  border-top: 1px solid rgba(0, 0, 0, .07);
  padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
}
.barre button { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 800; color: #B39C93; padding: 5px 12px; border-radius: 12px; }
.barre button .ic { font-size: 21px; }
.barre button[aria-current="page"] { color: var(--accent); }

.message-josue {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center;
  background: rgba(40, 28, 32, .55); padding: 24px;
}
.message-josue > div { background: #fff; border-radius: 22px; padding: 26px 24px; max-width: 380px; text-align: center; }
.message-josue img { width: 130px; margin: 0 auto 14px; display: block; }
.message-josue p { font-size: 15.5px; line-height: 1.7; }
.message-josue button { margin-top: 18px; padding: 13px 30px; border-radius: 24px; background: var(--accent); color: #fff; font-weight: 800; }

.bulle {
  position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 14px);
  background: var(--encre); color: #fff; padding: 13px 22px; border-radius: 24px;
  font-size: 14.5px; font-weight: 700; opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .22s; z-index: 50; max-width: 90vw; text-align: center;
}
.bulle.visible { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 620px) { .ecran { padding-bottom: 130px; } }

/* ==================================================================== voix

   Un enfant de six ans ne lit pas : tout ce qui est écrit doit pouvoir être
   entendu. Les boutons sont grands — un doigt d'enfant ne vise pas juste —
   et celui qui lit reste allumé, pour qu'on voie qui parle. */

.coin { margin-left: auto; display: flex; align-items: flex-start; gap: 8px; flex: none; }

.ecouter-ecran {
  width: 46px; height: 46px; flex: none; border-radius: 50%;
  background: var(--carte); box-shadow: var(--ombre);
  border: 1px solid rgba(184, 134, 47, .35);
  font-size: 20px; line-height: 1; display: grid; place-items: center;
}
.ecouter-ecran:active { transform: scale(.94); }

.ecouter {
  display: inline-grid; place-items: center; vertical-align: middle;
  width: 34px; height: 34px; margin-left: 8px; border-radius: 50%;
  background: rgba(255, 255, 255, .78); border: 1px solid rgba(184, 134, 47, .4);
  font-size: 15px; line-height: 1;
}
.ecouter:active { transform: scale(.92); }

.bouton-ecoute {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 14px; margin-bottom: 14px;
  background: var(--carte); border: 1px solid rgba(184, 134, 47, .4);
  border-radius: 16px; box-shadow: var(--ombre);
  font-size: 16px; font-weight: 700; color: var(--accent);
}
.bouton-ecoute span { font-size: 20px; }

/* Ce qui lit en ce moment : un halo qui bat, sans texte à lire. */
.lit {
  background: var(--doux); border-color: var(--accent);
  animation: souffle 1.5s ease-in-out infinite;
}
@keyframes souffle {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139, 21, 56, .30); }
  50%      { box-shadow: 0 0 0 9px rgba(139, 21, 56, 0); }
}

.ligne-accueil { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 4px 0 14px; }
.bascule-langue {
  font-size: 14px; font-weight: 700; color: var(--accent);
  background: var(--carte); border: 1px solid rgba(184, 134, 47, .4);
  border-radius: 999px; padding: 9px 18px; box-shadow: var(--ombre);
}

.reglage-voix {
  display: flex; align-items: center; gap: 11px; cursor: pointer;
  background: var(--carte); border: 1px solid rgba(184, 134, 47, .34);
  border-radius: 16px; padding: 14px 16px; margin-top: 14px;
  font-size: 15px; font-weight: 600; color: var(--encre);
}
.reglage-voix input { width: 24px; height: 24px; accent-color: var(--accent); flex: none; }

/* Appareil sans synthèse vocale : on ne promet pas ce qu'on ne peut pas tenir. */
body.sans-voix .ecouter,
body.sans-voix .ecouter-ecran,
body.sans-voix .bouton-ecoute,
body.sans-voix .reglage-voix { display: none; }
.coin .josue-perche { margin-left: 0; }
.bascule-langue.petite { font-size: 12.5px; padding: 7px 12px; align-self: flex-start; }

/* La main tendue de l'enfant. Rouge doux pour attirer l'attention sans crier ;
   or pour dire "précieux" ; jamais présente hors de la zone secrète. */
.appel-adulte {
  background: linear-gradient(135deg, #FFF3EF, #FCE9DE);
  border: 2px solid rgba(158, 43, 37, 0.4);
  margin-top: 14px;
  transition: box-shadow .25s, transform .25s;
}
.appel-adulte:has(input:checked) {
  border-color: var(--urgence);
  box-shadow: 0 6px 18px rgba(158, 43, 37, .18);
  transform: translateY(-1px);
}
.appel-adulte input { accent-color: var(--urgence); }
.appel-adulte span { font-size: 13.5px; line-height: 1.5; color: #5A3B38; font-weight: 600; }
