/* Page du test PAC (v p4, 26/11 : questions de la page anglaise) : le questionnaire d'abord. Police système, aucune ressource externe, rendu lumineux. */
:root {
  color-scheme: light;
  --bg: #FAF8F4;
  --surface: #FFFFFF;
  --ink: #17212B;
  --muted: #5A6470;
  --line: #E7E1D6;
  --accent: #1D5C45;
  --accent-hover: #164A37;
  --accent-soft: #E9F2EC;
  --gold: #9A7428;
  --gold-soft: #FBF3E2;
  --danger: #B42318;
  --wa: #128C4A;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(23, 33, 43, .04), 0 10px 30px rgba(23, 33, 43, .08);
  --fr-h: 0px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); }
h1, h2, h3 { font-weight: 750; letter-spacing: -.02em; color: var(--ink); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
sup { font-size: .62em; line-height: 0; vertical-align: super; }

/* ─── Barre du haut : logo discret ─── */
.barre { max-width: 560px; margin: 0 auto; padding: 10px 16px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.logo svg { flex: none; }
.essai-badge { display: none; font-size: 12px; font-weight: 600; color: #7A5300; background: var(--gold-soft); border: 1px solid #EBD7A8; border-radius: 999px; padding: 2px 10px; }
body.mode-essai .essai-badge { display: inline-block; }

main { max-width: 560px; margin: 0 auto; padding: 0 16px; }

/* ─── Premier écran ─── */
#intro { padding: 10px 0 10px; }
#intro h1 { font-size: clamp(25px, 7.1vw, 36px); line-height: 1.12; margin: 0 0 6px; text-wrap: balance; }
.cond { font-size: 12.5px; line-height: 1.4; color: var(--muted); margin: 0 0 8px; }
.promesse { font-size: 15.5px; line-height: 1.35; text-wrap: balance; font-weight: 650; color: var(--accent); margin: 0; }
body:not([data-etape="1"]) #intro, body:not([data-ecran="test"]) #intro { display: none; }

/* ─── Carte du test ─── */
.carte-test { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 16px 18px; }
body:not([data-etape="1"]) .carte-test { margin-top: 14px; }
body:not([data-ecran="test"]) .carte-test { display: none; }
.test-haut { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 28px; }
.btn-retour { font: inherit; font-size: 15px; background: none; border: 0; color: var(--muted); padding: 6px 4px; min-height: 36px; cursor: pointer; }
.test-nom { font-size: 12.5px; color: var(--muted); margin-left: auto; }
.progression { height: 6px; background: #EFEAE1; border-radius: 99px; overflow: hidden; margin: 2px 0 14px; }
.progression span { display: block; height: 100%; width: 6%; background: var(--accent); border-radius: 99px; transition: width .3s ease; }
.question { min-height: 196px; }
.question.entree { animation: entree .22s ease both; }
@keyframes entree { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .question.entree { animation: none; } .progression span { transition: none; } }
.q-num { margin: 0; font-size: 13px; font-weight: 600; color: var(--gold); }
.q-titre { font-size: clamp(21px, 5.8vw, 26px); line-height: 1.2; margin: 4px 0 14px; outline: none; }
.q-aide { font-size: 13px; color: var(--muted); margin: -8px 0 12px; line-height: 1.4; }
.options { display: grid; gap: 10px; }
.options-2 { grid-template-columns: 1fr 1fr; }
.options-2 .opt { padding: 12px 12px; align-content: center; }
.options-3 { grid-template-columns: repeat(3, 1fr); }
/* Question 1 (5 réponses) : un peu plus serrée, pour tenir au premier écran avec le bandeau cookies ouvert */
.options-serre { gap: 6px; }
.options-serre .opt { min-height: 44px; padding: 8px 12px; align-content: center; }
.options-serre .opt-t { font-size: 15.5px; line-height: 1.25; }
/* Question 1 : pas de ligne « Retour / Sans engagement » (Retour est caché), carte un peu plus serrée, pour garder les
   5 réponses au premier écran d'un téléphone 375 × 667, bandeau cookies ouvert compris */
body[data-etape="1"] .test-haut { display: none; }
body[data-etape="1"] .carte-test { padding: 12px 12px 14px; }
body[data-etape="1"] .progression { margin-bottom: 10px; }
body[data-etape="1"] .q-titre { margin-bottom: 10px; }
.q-aide-bas { margin: 8px 0 0; }
.opt { font: inherit; text-align: left; background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); border-radius: 14px; padding: 13px 16px; min-height: 56px; cursor: pointer; display: grid; gap: 1px; transition: border-color .12s, background .12s; }
@media (hover: hover) { .opt:hover { border-color: #B9CFC3; background: #FBFDFB; } } /* pas d'effet « survol » collé après un toucher */
.opt.choisi { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.opt-t { font-weight: 650; font-size: 17px; }
.opt-s { font-size: 14px; color: var(--muted); }
.opt-court { text-align: center; justify-items: center; padding: 12px 6px; }
.q-form { display: grid; gap: 12px; margin-top: 12px; }
.q-form label:not(.sr) { font-weight: 600; font-size: 15px; }
input[type=text], input[type=tel], input[type=email], input[type=number], textarea {
  font: inherit; font-size: 17px; width: 100%; color: var(--ink); background: var(--surface);
  border: 1.5px solid #D9D2C5; border-radius: 12px; padding: 13px 14px; min-height: 54px; -webkit-appearance: none; appearance: none;
}
input[aria-invalid=true] { border-color: var(--danger); background: #FFF8F7; }
.erreur { color: var(--danger); font-size: 14px; margin: 2px 0 0; }
.note-cp { font-size: 13.5px; line-height: 1.4; color: #6A4A00; background: var(--gold-soft); border: 1px solid #EBD7A8; border-radius: 10px; padding: 8px 10px; margin: 2px 0 0 !important; }

/* ─── Boutons ─── */
.btn { font: inherit; font-weight: 650; border-radius: 14px; border: 1px solid transparent; padding: 14px 20px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; transition: background .12s; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .opt:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(29, 92, 69, .35); outline-offset: 2px; }
.btn-principal { background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(29, 92, 69, .2); }
.btn-principal:hover { background: var(--accent-hover); }
.btn-principal:disabled { background: #9DB5AA; box-shadow: none; cursor: not-allowed; }
.btn-grand { width: 100%; font-size: 18px; min-height: 56px; }
.btn-secondaire { background: var(--surface); color: var(--accent); border-color: #C9D9CF; }
.btn-secondaire:hover { background: var(--accent-soft); }
.btn-lien { background: none; border: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; min-height: 44px; padding: 8px; font-weight: 500; }
.btn-whatsapp { background: var(--surface); color: var(--wa); border: 1.5px solid #9FD3B5; width: 100%; }
.btn-whatsapp:hover { background: #EFF9F3; }
.btn.en-cours { opacity: .85; }

/* ─── Résultat ─── */
.zone-resultat { padding: 14px 0 4px; }
.carte-resultat { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 20px 18px 16px; position: relative; overflow: hidden; }
.carte-resultat::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--accent); }
.carte-resultat h2 { font-size: clamp(24px, 6.6vw, 30px); line-height: 1.15; margin: 4px 0 8px; outline: none; }
.carte-resultat p { margin: 0 0 8px; font-size: 16.5px; }
.carte-resultat .petite { font-size: 12.5px; margin: 6px 0 0; }
.carte-bleu::before { background: #2D5BD7; }
.carte-au_dessus::before { background: #2F7A5C; }
.carte-non_adapte::before, .carte-sans_circuit::before { background: #9AA3AD; }
.carte-resultat .btn-secondaire { width: 100%; font-size: 15px; padding: 12px; }
.actions-resultat { display: grid; gap: 4px; margin: 14px 0 2px; justify-items: center; }
.actions-resultat .btn-principal { width: 100%; }
.carte-resultat .participation { margin: 4px 0 0; text-align: left; justify-self: stretch; }
.pastille { display: inline-flex; align-items: center; line-height: 1.3; gap: 8px; font-size: 12.5px; font-weight: 600; border-radius: 999px; padding: 4px 12px 4px 8px; margin: 0 0 4px !important; }
.pastille span { flex: none; width: 12px; height: 12px; border-radius: 50%; }
.pastille-bleu { background: #EAF0FF; color: #1F3F99; } .pastille-bleu span { background: #2D5BD7; }
.petite { font-size: 12.5px; color: var(--muted); line-height: 1.45; margin: 8px 0 0; }

.bloc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px; margin-top: 12px; box-shadow: var(--shadow); }
.bloc h2, .bloc h3 { font-size: 21px; line-height: 1.2; margin: 0 0 6px; outline: none; }
.bloc p { margin: 0 0 10px; }
.bloc-locataire p { font-size: 15px; color: var(--muted); }
.bloc-locataire textarea { font-size: 15px; line-height: 1.5; min-height: 200px; resize: vertical; background: #FBFAF7; margin: 4px 0 12px; }
.bloc-locataire .btn { width: 100%; }
.delai { color: var(--accent); font-weight: 600; font-size: 15.5px; margin: 0 0 14px !important; }
.champs { display: grid; gap: 12px; }
.champ { display: grid; gap: 5px; }
.champ label { font-weight: 600; font-size: 15px; }
.facultatif { font-weight: 400; color: var(--muted); }
.mention-tel { font-size: 12.5px; color: var(--muted); margin: 0 !important; line-height: 1.45; }
.piege { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.case { display: flex; gap: 12px; align-items: flex-start; margin: 16px 0 6px; padding: 12px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; background: #FBFAF7; font-size: 15.5px; }
.case input { flex: none; width: 24px; height: 24px; margin: 0; accent-color: var(--accent); }
#envoyer { margin-top: 10px; }
.envoi-statut { color: var(--danger); background: #FFF4F2; border: 1px solid #F5C9C3; border-radius: 12px; padding: 10px 12px; margin: 10px 0 0 !important; font-size: 15px; }
.donnees { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 12px 0 0 !important; }
.bloc-whatsapp { margin-top: 12px; text-align: center; }
.bloc-whatsapp .petite { margin: 6px 0 0; }
.modifier { text-align: center; margin: 8px 0 0; }

/* ─── Pied : deux petits liens ─── */
.pied { max-width: 560px; margin: 0 auto; padding: 18px 16px 16px; font-size: 12px; color: var(--muted); text-align: center; }
.pied p { margin: 4px 0; }
.pied .liens a { color: var(--muted); }

/* ─── Bandeau France Rénov' fixe (toutes les pages) ─── */
.fr-bandeau { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #fff; box-shadow: 0 -4px 16px rgba(23, 33, 43, .08); padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); }
.fr-bandeau a { display: block; max-width: 560px; margin: 0 auto; }
.fr-bandeau img { width: 100%; }

/* ─── Bandeau cookies compact (au-dessus du bandeau France Rénov'), Refuser et Accepter au même niveau ─── */
.bandeau-cookies { position: fixed; left: 8px; right: 8px; bottom: calc(var(--fr-h) + 6px); z-index: 50; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 30px rgba(23, 33, 43, .16); padding: 8px 10px; max-width: 560px; margin: 0 auto; }
.bandeau-cookies p { margin: 0 0 6px; font-size: 12px; line-height: 1.35; color: var(--ink); }
.bandeau-boutons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-cookie { min-height: 38px; padding: 5px 12px; font-size: 15px; background: var(--surface); color: var(--ink); border-color: #CFC8BB; }
.btn-cookie:hover { background: #F4F1EA; }

/* ─── Page merci, conditions et notices ─── */
.page-simple { padding: 18px 0 4px; }
.merci-carte h1 { font-size: clamp(28px, 7.6vw, 36px); line-height: 1.1; margin: 0 0 10px; }
.merci-carte .btn { width: 100%; margin-top: 6px; font-size: 17px; padding: 14px 12px; }
.coche { width: 52px; height: 52px; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; margin-bottom: 10px; }
.essai-note { margin-top: 12px !important; font-size: 13px; background: var(--gold-soft); border: 1px solid #EBD7A8; border-radius: 10px; padding: 8px 10px; color: #6A4A00; }
.apercu { font-size: 12px; background: #F6F4EF; border-radius: 10px; padding: 10px; overflow: auto; max-height: 280px; white-space: pre-wrap; word-break: break-word; }
.notice h1 { font-size: clamp(26px, 7vw, 34px); line-height: 1.12; margin: 0 0 12px; }
.notice h2 { font-size: 20px; margin: 26px 0 8px; }
.notice p, .notice li { font-size: 16px; }
.notice ul { padding-left: 1.2em; }
.notice .intro { color: var(--muted); }
body[data-ecran="notice"] main, body[data-ecran="notice"] .barre, body[data-ecran="notice"] .pied { max-width: 720px; }

/* ─── Grand écran : même colonne, un peu plus d'air ─── */
@media (min-width: 900px) {
  .barre { padding-top: 22px; }
  #intro { padding: 30px 0 18px; }
  .carte-test { padding: 12px 28px 26px; }
  .carte-resultat, .bloc { padding: 26px 28px; }
  .champs { grid-template-columns: 1fr 1fr; }
  .champ-large { grid-column: span 2; }
  .notice, .page-simple { max-width: 680px; }
}

/* ─── Compteur d'aides et jauge d'éligibilité (p5, 27/11 : comme la page anglaise de Michelle) ─── */
.compteur { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: linear-gradient(135deg, #FBF3E2 0%, #FFFCF5 70%); border: 1px solid #EBD7A8; border-radius: 14px; padding: 8px 12px; margin: 0 0 10px; }
.cpt-lib { margin: 0; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6B5A35; }
.cpt-val { margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 5px; line-height: 1.15; }
.cpt-jusqua { font-size: 13px; font-weight: 600; color: var(--muted); }
.cpt-montant { font-size: 25px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.cpt-max { font-size: 12px; color: var(--muted); }
.cpt-d { text-align: right; flex: none; }
.cpt-score { margin: 0; line-height: 1.15; }
#cpt-score { font-size: 21px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.cpt-sur { font-size: 12px; color: var(--muted); margin-left: 1px; }
.compteur.cpt-sans-montant .cpt-jusqua, .compteur.cpt-sans-montant .cpt-max { display: none; }
.compteur.cpt-sans-montant .cpt-montant { font-size: 16px; font-weight: 700; color: var(--accent); }
.compteur.cpt-hausse .cpt-montant { animation: cpt-hausse .7s ease; }
@keyframes cpt-hausse { 0% { color: var(--ink); } 30% { color: var(--accent); transform: scale(1.06); } 100% { color: var(--ink); transform: none; } }
.cpt-montant { display: inline-block; transform-origin: left center; }
@media (prefers-reduced-motion: reduce) { .compteur.cpt-hausse .cpt-montant { animation: none; } }

/* Résultat : anneau de score, niveau, montant « jusqu'à » en grand (comme « Your estimated grant ») */
.bloc-aides { display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, #FBF3E2 0%, #FFFCF5 70%); border: 1px solid #EBD7A8; border-radius: 16px; padding: 12px 14px; margin: 6px 0 12px; }
.ba-anneau { position: relative; flex: none; width: 72px; height: 72px; }
.ba-anneau svg { display: block; }
.ba-arc { transition: stroke-dashoffset 1s ease-out; }
@media (prefers-reduced-motion: reduce) { .ba-arc { transition: none; } }
.ba-score { position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center; padding-top: 22px; font-size: 22px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.ba-sur { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 1px; }
.carte-resultat .ba-cond { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.ba-texte { min-width: 0; }
.carte-resultat .ba-niveau { margin: 0 0 4px; font-size: 13.5px; font-weight: 700; color: var(--accent); line-height: 1.25; }
.carte-resultat .ba-lib { margin: 0; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6B5A35; }
.carte-resultat .ba-montant { margin: 0; font-size: 15px; font-weight: 600; color: var(--muted); line-height: 1.2; }
.ba-euros { font-size: 27px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.carte-resultat .ba-calcul { margin: 0; font-size: 16px; font-weight: 700; color: var(--ink); }
.carte-resultat .ba-source { margin: 6px 0 0; }
/* Téléphones étroits : le montant tient sur une ligne (le « max » est sur /conditions), réponses du revenu un peu plus basses */
@media (max-width: 400px) {
  .cpt-max { display: none; }
  .compteur { padding: 7px 11px; }
  .cpt-montant { font-size: 23px; }
}
body[data-q="revenu"] .opt { min-height: 50px; padding-top: 10px; padding-bottom: 10px; }
/* Téléphone 375 × 667, bandeau cookies ouvert : la question du revenu (titre de 4 lignes) et ses 3 réponses restent
   au-dessus du bandeau malgré le compteur d'aides (mesuré : bas des réponses = haut du bandeau au pixel près). */
@media (max-width: 400px) {
  body[data-q="revenu"] .q-titre { font-size: 19.5px; margin-bottom: 10px; }
  body[data-q="revenu"] .options { gap: 8px; }
  body[data-q="revenu"] .opt { min-height: 46px; padding-top: 8px; padding-bottom: 8px; }
  body[data-q="revenu"] .q-aide-bas { font-size: 12.5px; line-height: 1.3; margin-top: 6px; }
  body:not([data-etape="1"]) .progression { margin-bottom: 10px; }
  .compteur { margin-bottom: 8px; padding: 6px 11px; }
}

/* Numéro d'où M. Talbi appelle (29/11) : en clair, appelable, et « Enregistrer son numéro » (fiche contact /m-talbi.vcf) */
.numero-talbi { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; font-size: 14.5px; background: var(--accent-soft); border: 1px solid #C9D9CF; border-radius: 12px; padding: 8px 10px 8px 12px; margin: 0 0 12px; }
.numero-lien { font-weight: 700; color: var(--accent); white-space: nowrap; text-decoration: none; }
.btn-numero { font-size: 14px; font-weight: 650; color: var(--accent); background: var(--surface); border: 1px solid #9FC2AE; border-radius: 10px; padding: 7px 12px; min-height: 36px; display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; }
.btn-numero:hover { background: #F4FAF6; }
.numero-merci { margin: 8px 0 12px; text-align: left; }

/* Case facultative (29/11) : même forme que la case de rappel, plus discrète */
.case-facultative { margin-top: 8px; background: var(--surface); font-size: 14.5px; color: var(--muted); }

/* Bouton WhatsApp plus visible (Medhi, 29/11) : vert plein, texte blanc (contraste 4,6:1), un peu plus grand */
.btn-whatsapp { background: var(--wa); color: #fff; border: 1.5px solid var(--wa); font-size: 18px; font-weight: 700; min-height: 58px; box-shadow: 0 6px 16px rgba(18, 140, 74, .28); }
.btn-whatsapp:hover { background: #0F7A40; border-color: #0F7A40; }
.btn-whatsapp svg { width: 24px; height: 24px; }
.bloc-whatsapp .petite { font-size: 14px; color: var(--ink); }

/* Résultat « très modestes » (29/11) : « jusqu'à 100 % » en très grand, « sous conditions » juste dessous */
.carte-resultat h2.h-100 { display: grid; gap: 2px; margin: 4px 0 10px; }
.h-100-avant { font-size: 17px; font-weight: 650; letter-spacing: -.01em; color: var(--ink); line-height: 1.3; }
.h-100-gros { font-size: 22px; font-weight: 750; color: var(--accent); line-height: 1.15; }
.h-100-gros strong { display: block; font-size: clamp(58px, 17vw, 76px); font-weight: 850; letter-spacing: -.04em; line-height: 1; color: var(--accent); }
.h-100-apres { font-size: 15px; font-weight: 650; color: var(--muted); }
@media (max-width: 400px) {
  .h-100-avant { font-size: 15.5px; line-height: 1.28; }
  .h-100-gros { font-size: 20px; }
  .h-100-gros strong { font-size: clamp(52px, 15vw, 64px); }
  .carte-resultat h2.h-100 { margin-bottom: 8px; }
  .bloc-aides { padding: 10px 12px; margin-bottom: 10px; }
}
.carte-resultat .apres-bouton { margin: 8px 0 0; font-size: 15.5px; }
