/* ============================================================
   tunnel.css — la page d'atterrissage /routine/
   Elle réutilise les jetons, la police et les boutons de style.css.
   Ici, seulement ce qui lui est propre : les étapes plein écran,
   les grands choix, la carte de prix et la feuille de paiement.

   Mobile d'abord : le trafic payant arrive au téléphone. Les zones
   sûres de l'iPhone sont respectées en haut comme en bas, sinon le
   bouton principal se retrouve sous la barre d'accueil.
   ============================================================ */

/* Une règle d'auteur qui pose `display` l'emporte sur le `[hidden]` du
   navigateur : `.depart { display: flex }` laissait une barre grise vide à
   l'écran chaque fois que la phrase du jour de départ était tue. On rétablit
   la règle une fois pour toutes, plutôt que par sélecteur. */
[hidden] { display: none !important; }

:root { --danger-ink: #C31D41; }

.tunnel {
  /* La hauteur du bandeau de consentement, réservée tant qu'il est affiché —
     voir reserverLaPlaceDuBandeau() dans tunnel.js. Sans elle, un élément
     en bas de page reste sous le bandeau à tout défilement. */
  padding-bottom: var(--h-bandeau, 0px);
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ---------- 1. En-tête réduit à l'essentiel ---------- */
.tunnel__header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(14px + env(safe-area-inset-top)) max(18px, env(safe-area-inset-left)) 14px
           max(18px, env(safe-area-inset-right));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.tunnel__deja {
  font-size: .9rem; font-weight: 700; color: var(--blue-deep);
  text-decoration: underline; text-underline-offset: 3px;
}

/* ---------- 2. Barre de progression ---------- */
.progres { height: 4px; background: var(--surface-sunken); }
.progres i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--blue), var(--purple));
  transition: width .32s cubic-bezier(.22, .61, .36, 1);
}
@media (prefers-reduced-motion: reduce) { .progres i { transition: none; } }

/* ---------- 3. Une étape ---------- */
main { flex: 1; display: flex; }
.etape { display: none; flex: 1; }
.etape.est-visible { display: flex; }
.etape__corps {
  width: 100%; max-width: 560px; margin-inline: auto;
  padding: clamp(24px, 5vw, 44px) max(20px, env(safe-area-inset-left))
           calc(28px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-right));
  display: flex; flex-direction: column;
}
.etape--centre .etape__corps { justify-content: center; align-items: center; text-align: center; }

.etape__compteur {
  font-size: .82rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); padding: 0; margin-bottom: 10px;
}
.etape__titre {
  font-size: clamp(1.55rem, 6vw, 2.1rem); line-height: 1.22; margin-bottom: 10px;
  text-wrap: balance;
}
.etape__aide { color: var(--text-muted); font-size: 1rem; margin-bottom: 4px; }
/* Le rouge du texte d'erreur, pas celui des bordures.
   `--danger` (#E23A5E) donne 3,88:1 sur le fond du tunnel et 4,20:1 sur blanc —
   sous la règle de la maison, et précisément sur les phrases qu'un parent gêné
   a le plus besoin de lire. Même teinte, assombrie juste assez : 5,43:1 et
   5,88:1. La bordure garde `--danger`, elle n'a pas de texte à porter. */
.etape__erreur { color: var(--danger-ink); font-weight: 700; font-size: .95rem; margin-top: 14px; }

.etape__pied { margin-top: auto; padding-top: 26px; }
.btn--bloc { width: 100%; }
.pied-mention {
  text-align: center; font-size: .88rem; color: var(--text-muted); margin-top: 12px;
}

fieldset { border: 0; padding: 0; margin: 0; }

/* ---------- 4. Les choix du questionnaire ---------- */
.choix { display: grid; gap: 11px; margin-top: 22px; }
.choix button {
  display: flex; align-items: center; gap: 14px; width: 100%;
  font: inherit; font-weight: 700; font-size: 1.05rem; text-align: left;
  color: var(--text); background: var(--surface);
  border: 2px solid var(--border-strong); border-radius: 18px;
  padding: 17px 18px; cursor: pointer;
  transition: border-color .16s, background .16s, transform .16s;
}
.choix button:hover { border-color: var(--blue); background: var(--surface-muted); }
.choix button:active { transform: scale(.985); }
.choix button[aria-pressed="true"] {
  border-color: var(--blue-deep); background: var(--surface-sunken);
}
.choix .emoji { font-size: 1.5rem; line-height: 1; flex: none; }
@media (prefers-reduced-motion: reduce) { .choix button { transition: none; } }

.lien-retour {
  align-self: flex-start; margin-top: 20px;
  font: inherit; font-size: .95rem; font-weight: 700; color: var(--text-muted);
  background: none; border: 0; padding: 8px 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.lien-retour:hover { color: var(--text); }

/* ---------- 5. La roue ----------
   Elle ne tourne que si l'assemblage dure assez pour qu'on la voie.
   Aucun minuteur ne la retient : voir tunnel.js. */
.roue {
  width: 54px; height: 54px; margin-bottom: 22px;
  border: 5px solid var(--surface-sunken); border-top-color: var(--blue);
  border-radius: 50%; animation: roue 720ms linear infinite;
}
@keyframes roue { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .roue { animation-duration: 2.4s; } }

/* ---------- 6. La routine proposée ---------- */
.missions { list-style: none; display: grid; gap: 10px; margin: 22px 0 18px; }
.missions li {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 14px 16px;
}
.missions .emoji { font-size: 1.45rem; line-height: 1; flex: none; }
.missions b { font-weight: 800; font-size: 1rem; }
.missions .minutes {
  margin-left: auto; flex: none;
  font-size: .85rem; font-weight: 800; color: #065536;
  background: var(--mint-soft); border-radius: var(--r-pill); padding: 5px 11px;
}
.note-modif { font-size: .93rem; color: var(--text-muted); }

/* Le jour de départ. Cinq routines sur douze ne tournent pas tous les jours ;
   quand ce n'est pas aujourd'hui, on le dit ici plutôt que de laisser le
   parent ouvrir l'application le soir même sur une liste vide. */
.depart {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface-sunken); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 14px;
  font-size: .93rem; line-height: 1.5; color: var(--text);
}
.depart .emoji { font-size: 1.15rem; line-height: 1.3; flex: none; }
.depart b { font-weight: 900; }

/* ---------- 7. Les champs ---------- */
.champ { display: block; margin-top: 20px; }
.champ__nom { display: block; font-weight: 800; font-size: .95rem; margin-bottom: 7px; }
.champ input {
  width: 100%; font: inherit; font-size: 1.05rem; color: var(--text);
  background: var(--surface); border: 2px solid var(--border-control);
  border-radius: 14px; padding: 14px 15px;
}
.champ input:focus-visible { outline: 3px solid var(--blue-deep); outline-offset: 2px; border-color: var(--blue-deep); }
.champ input[aria-invalid="true"] { border-color: var(--danger); }
/* Quatre chiffres se lisent mieux espacés, et le champ ne doit pas suggérer
   qu'on y écrit une phrase. */
/* Assez large pour quatre chiffres ESPACÉS : à 8ch le texte débordait de 11 px
   et le champ défilait, si bien que le premier chiffre sortait de vue à la
   frappe du quatrième. Le décalage de padding compense l'espacement que la
   dernière lettre traîne derrière elle, sinon le texte n'est pas centré. */
.champ input.champ--code {
  width: 8.5rem; letter-spacing: .4em; font-size: 1.3rem; font-weight: 800;
  text-align: center; padding-left: calc(15px + .4em);
}

.champ__note { display: block; font-size: .86rem; color: var(--text-muted); margin-top: 6px; }
.champ__erreur { display: block; font-size: .88rem; font-weight: 700; color: var(--danger-ink); margin-top: 6px; }

/* ---------- 8. La carte de prix ----------
   Ce qui est gros : le zéro d'aujourd'hui, puis le coût mensuel.
   Ce qui est lisible sans être gros : la somme annuelle et sa date.
   Elle reste sur la carte, au-dessus du bouton, jamais dans un repli. */
.offre {
  background: var(--surface); border: 2px solid var(--blue-soft);
  border-radius: var(--r-lg, 24px); padding: 24px 22px; margin-top: 22px;
  text-align: center;
}
.offre__gratuit {
  font-size: clamp(1.6rem, 7vw, 2.15rem); font-weight: 900; line-height: 1.15;
  color: var(--navy);
}
.offre__mensuel { font-size: 1.18rem; font-weight: 700; color: var(--text); margin-top: 6px; }
.offre__mensuel b { font-weight: 900; }
.offre__ligne {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--border);
}
.offre__etiquette { font-size: .92rem; font-weight: 800; color: var(--text-muted); }
/* Vert assombri par rapport à --green-deep : sur la menthe claire, le jeton
   du site donne 4,98:1, et la règle de la maison est 5:1 partout. */
.offre__remise {
  font-size: .82rem; font-weight: 900; color: #065536;
  background: var(--mint-soft); border-radius: var(--r-pill); padding: 4px 10px;
}
.offre__detail {
  font-size: .92rem; line-height: 1.55; color: var(--text-muted); margin-top: 10px;
}

.offre__bascule {
  display: block; width: 100%; margin-top: 14px;
  font: inherit; font-size: .97rem; color: var(--blue-deep);
  background: none; border: 0; padding: 10px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.offre__bascule b { font-weight: 900; }

/* ---------- 9. La feuille de paiement ---------- */
/* Le bloc d'installation : le code à scanner d'un côté, les boutons de
   l'autre. Sur téléphone il s'empile, le code d'abord — c'est lui qui sert,
   puisqu'on ne scanne pas l'écran qu'on tient. */
.installer {
  display: flex; gap: clamp(18px, 3vw, 30px); align-items: center; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: clamp(18px, 3vw, 26px); margin-top: 26px;
}
.installer__qr { text-align: center; flex: none; }
.installer__qr img {
  display: block; width: 160px; height: 160px; border-radius: 12px;
  border: 1px solid var(--border);
}
.installer__legende {
  font-size: .86rem; line-height: 1.45; color: var(--text-muted);
  margin-top: 10px; max-width: 170px;
}
.installer__liens { flex: 1 1 220px; min-width: 0; }
.installer__titre { font-weight: 800; font-size: .97rem; margin-bottom: 12px; }
.installer__note { font-size: .86rem; color: var(--text-muted); margin-top: 10px; }
.installer .btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

@media (max-width: 520px) {
  .installer { flex-direction: column; align-items: stretch; }
  .installer__qr { align-self: center; }
  .installer__legende { max-width: none; }
}

.feuille {
  margin-top: 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 20px; padding: 18px;
  min-height: 96px;
}
.feuille-attente {
  margin-top: 16px; padding: 16px; text-align: center;
  font-size: .93rem; color: var(--text-muted);
  background: var(--surface-sunken); border-radius: 16px;
}
.feuille__attente {
  font-size: .93rem; color: var(--text-muted); text-align: center; padding: 14px 4px;
}

/* ---------- 10. La case des conditions ---------- */
.cgv { display: flex; gap: 12px; align-items: flex-start; margin-top: 20px; font-size: .93rem; line-height: 1.5; }
.cgv input {
  flex: none; width: 24px; height: 24px; margin-top: 1px;
  accent-color: var(--blue-deep); cursor: pointer;
}
.cgv a { color: var(--blue-deep); text-decoration: underline; text-underline-offset: 3px; }

.vendeur {
  margin-top: 22px; font-size: .82rem; line-height: 1.6; color: var(--text-muted);
}
.vendeur a { color: var(--blue-deep); text-decoration: underline; }

/* ---------- 11. Pied de page ---------- */
.tunnel__pied {
  display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: center;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border); background: var(--surface);
  font-size: .86rem;
}
.tunnel__pied a { color: var(--text-muted); text-decoration: underline; text-underline-offset: 3px; }
.tunnel__pied a:hover { color: var(--text); }

/* ---------- 12. Bandeau cookies ---------- */
.cookies {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 60; max-width: 520px; margin-inline: auto;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 20px; box-shadow: var(--sh-lg); padding: 18px 18px 16px;
  font-size: .9rem; line-height: 1.55; color: var(--text-muted);
}
.cookies p + p { margin-top: 7px; }
.cookies b { color: var(--text); }
.cookies__boutons { display: flex; gap: 10px; margin-top: 14px; }
.cookies__boutons .btn { flex: 1 1 0; min-width: 0; }   /* voir style.css : même raison */

/* ---------- 13. Écrans larges ---------- */
@media (min-width: 720px) {
  .etape__corps { padding-top: 52px; }
  .choix { gap: 13px; }
}


/* ---------- 17. Le code famille ----------
   Affiché dès que la famille existe, avant le paiement. C'est la seule chose
   de cet écran que le parent devra recopier ailleurs : elle se lit de loin,
   se sélectionne d'un geste, et ne se perd pas dans la page. */
.code-famille {
  background: var(--mint-soft); border: 2px solid var(--mint);
  border-radius: 20px; padding: 20px; margin-bottom: 24px; text-align: center;
}
.code-famille__titre { font-weight: 900; color: #065536; font-size: 1.02rem; }
.code-famille__code {
  font-size: clamp(1.5rem, 7vw, 1.95rem); font-weight: 900; letter-spacing: .06em;
  color: var(--navy); margin: 8px 0 10px; user-select: all;
}
.code-famille__note { font-size: .88rem; line-height: 1.55; color: var(--text-muted); }
