@font-face { font-family: "Inter"; src: url("/static/fonts/inter-400.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/static/fonts/inter-500.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/static/fonts/inter-600.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/static/fonts/inter-700.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Source Serif"; src: url("/static/fonts/source-serif-4.woff2") format("woff2"); font-weight: 200 900; font-display: swap; }

:root {
  --papier: #FCFBF9;
  --blanc: #FFFFFF;
  --encre: #14213D;
  --texte: #2E3A4E;
  --gris: #5A6472;
  --gris-clair: #8A939F;
  --accent: #2E5C8A;
  --accent-fonce: #234A70;
  --accent-pale: #F1F5FA;
  --filet: #E3E7ED;
  --filet-fort: #C9D1DB;
  --or: #B8975A;
  --or-clair: #D9C29A;
  --vert: #2F6B4F;
  --vert-pale: #EEF6F1;
  --alerte: #9A3B26;
  --alerte-pale: #FBF1EE;
  --rayon: 4px;
  --duree: 220ms;
  --courbe: cubic-bezier(0.2, 0.7, 0.2, 1);
  --serif: "Source Serif", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--papier);
  color: var(--encre);
  font: 400 16px/1.6 "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.serif { font-family: var(--serif); font-weight: 500; letter-spacing: -0.012em; }
a { color: var(--accent); }
.visuellement-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sur { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }

/* ---------- Accueil ---------- */
.accueil { flex: 1; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); min-height: 100vh; }
.accueil-gauche { padding: clamp(40px, 8vh, 96px) clamp(24px, 6vw, 88px) 48px; display: flex; flex-direction: column; justify-content: center; }
.accueil h1 { font-size: clamp(36px, 5.2vw, 60px); line-height: 1.05; margin: 22px 0 24px; max-width: 11em; }
.chapeau { font-size: clamp(16px, 1.4vw, 18.5px); color: var(--texte); margin: 0; max-width: 31em; }
.donnees { margin: 22px 0 0; padding-left: 14px; border-left: 2px solid var(--filet); color: var(--gris); font-size: 14px; max-width: 34em; }
.signature { margin-top: clamp(32px, 7vh, 72px); display: flex; gap: 14px; align-items: center; }
.signature .trait { width: 36px; height: 1px; background: var(--or); }
.signature strong { display: block; font-weight: 600; }
.signature span:not(.trait) { display: block; color: var(--gris); font-size: 14px; }

.accueil-droite { background: var(--encre); color: var(--blanc); padding: clamp(40px, 8vh, 96px) clamp(24px, 4.5vw, 64px) 48px; display: flex; flex-direction: column; justify-content: center; }
.accueil-droite .sur { color: #B9C9DC; }
.parties { list-style: none; margin: 24px 0 0; padding: 0; }
.parties li { display: grid; grid-template-columns: 44px 1fr; padding: 18px 0; border-top: 1px solid rgba(255, 255, 255, 0.16); }
.parties li:last-child { border-bottom: 1px solid rgba(255, 255, 255, 0.16); }
.parties .n { font-size: 24px; line-height: 1.15; color: var(--or-clair); }
.parties strong { display: block; font-weight: 600; margin-bottom: 2px; }
.parties span:not(.n) { color: #C3CDDA; font-size: 14.5px; }
.meta { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 30px; }
.meta div { font-size: 13.5px; color: #C3CDDA; line-height: 1.45; }
.meta strong { display: block; font-size: 28px; color: var(--blanc); margin-bottom: 4px; }
.accueil-action { margin-top: 40px; }
.erreur.claire { color: #F2C9BE; }

/* ---------- Boutons ---------- */
.bouton { font: inherit; font-weight: 600; font-size: 15px; border: 0; border-radius: var(--rayon); cursor: pointer; padding: 14px 24px;
  background: var(--encre); color: var(--blanc); display: inline-flex; gap: 10px; align-items: center;
  transition: background var(--duree), transform var(--duree), box-shadow var(--duree); }
.bouton:hover { background: #0B1528; box-shadow: 0 6px 18px rgba(20, 33, 61, 0.18); }
.bouton:active { transform: translateY(1px); }
.bouton.clair { background: var(--blanc); color: var(--encre); }
.bouton.clair:hover { background: #F1F4F8; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); }
.bouton span { transition: transform var(--duree) var(--courbe); }
.bouton:hover span { transform: translateX(3px); }
.bouton[disabled] { opacity: 0.6; cursor: wait; }
.lien-retour { font: inherit; font-size: 14.5px; background: none; border: 0; color: var(--gris); cursor: pointer; padding: 10px 0; }
.lien-retour:hover { color: var(--encre); }
.lien-retour[hidden] { display: inline-block !important; visibility: hidden; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Parcours ---------- */
.parcours { flex: 1; display: flex; flex-direction: column; }
.parcours-haut { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--filet); background: var(--papier); position: sticky; top: 0; z-index: 5; }
.partie { margin: 0; font-size: 13px; font-weight: 600; color: var(--encre); letter-spacing: 0.02em; }
.partie .numero { color: var(--or); margin-right: 8px; font-family: var(--serif); font-size: 15px; }
.compteur { margin: 0; font-size: 13px; color: var(--gris); font-variant-numeric: tabular-nums; }
.avancement { height: 2px; background: var(--filet); position: sticky; top: 57px; z-index: 5; }
.avancement span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 500ms var(--courbe); }
.parcours-corps { width: 100%; max-width: 700px; margin: 0 auto; padding: clamp(32px, 7vh, 72px) 20px 56px; }

.bloc { outline: none; }
.bloc-sur:focus, .bloc-titre:focus, .titre-resultat:focus { outline: none; }
.bloc-sur { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--accent); letter-spacing: 0.06em; }
.bloc-titre { font-size: clamp(26px, 3.4vw, 34px); line-height: 1.18; margin: 0 0 10px; outline: none; }
.bloc-intro { color: var(--gris); margin: 0 0 30px; font-size: 15.5px; }
.bloc > .question:first-of-type { margin-top: 6px; }

@keyframes entreeAvant { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: none; } }
@keyframes entreeArriere { from { opacity: 0; transform: translateX(-22px); } to { opacity: 1; transform: none; } }
@keyframes monter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.bloc.entree-avant { animation: entreeAvant 380ms var(--courbe) both; }
.bloc.entree-arriere { animation: entreeArriere 380ms var(--courbe) both; }
.bloc.entree-avant .option, .bloc.entree-arriere .option { animation: monter 380ms var(--courbe) both; }
.bloc .option:nth-child(2) { animation-delay: 50ms; }
.bloc .option:nth-child(3) { animation-delay: 100ms; }
.bloc .option:nth-child(4) { animation-delay: 150ms; }
.bloc .option:nth-child(n+5) { animation-delay: 200ms; }

/* ---------- Questions ---------- */
.question { margin: 0 0 34px; padding: 0; border: 0; min-width: 0; }
.question legend, .question .libelle { display: block; padding: 0; margin: 0 0 6px; font-weight: 600; font-size: 16.5px; line-height: 1.4; color: var(--encre); }
.question legend { float: left; width: 100%; }
.question legend ~ * { clear: both; }
.question.grande legend, .question.grande .libelle { font-family: var(--serif); font-weight: 500; font-size: clamp(22px, 2.8vw, 27px); line-height: 1.25; letter-spacing: -0.01em; margin-bottom: 22px; }
.question.grande legend + .aide, .question.grande .libelle + .aide { margin-top: -12px; }
.aide { color: var(--gris); font-size: 14.5px; margin: 0 0 16px; }
.question.manque legend, .question.manque .libelle { color: var(--alerte); }
.question.manque .option, .question.manque .segments, .question.manque input[type="text"], .question.manque textarea { border-color: #D9A898; }

/* Choix avec lettres */
.options { display: grid; gap: 10px; }
.options.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.options.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 560px) { .options.cols-2, .options.cols-3 { grid-template-columns: 1fr; } }
.option { position: relative; display: grid; grid-template-columns: 30px 1fr; gap: 14px; align-items: center; padding: 15px 18px;
  border: 1px solid var(--filet-fort); border-radius: var(--rayon); background: var(--blanc); cursor: pointer; line-height: 1.4;
  transition: border-color var(--duree) var(--courbe), background var(--duree) var(--courbe), box-shadow var(--duree) var(--courbe); }
.option:hover { border-color: var(--accent); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option .lettre { width: 28px; height: 28px; border: 1px solid #B7C0CC; border-radius: 3px; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 600; color: var(--gris); transition: all var(--duree) var(--courbe); }
.option.case .lettre::after { content: ""; width: 10px; height: 6px; border: solid transparent; border-width: 0 0 2px 2px; transform: rotate(-45deg) translate(1px, -1px); }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-pale); box-shadow: inset 3px 0 0 var(--accent); }
.option:has(input:checked) .lettre { background: var(--accent); border-color: var(--accent); color: var(--blanc); }
.option.case:has(input:checked) .lettre::after { border-color: var(--blanc); }
.option:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.option.choisie { animation: choisie 420ms var(--courbe); }
@keyframes choisie { 40% { transform: scale(0.992); } 100% { transform: none; } }
.option .texte-option { color: var(--encre); }

/* Segments : fréquence et durée */
.segments { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--filet-fort); border-radius: var(--rayon); overflow: hidden; background: var(--blanc); }
.segment { position: relative; display: grid; place-items: center; text-align: center; padding: 10px 8px; font-size: 13.5px; cursor: pointer; min-height: 46px;
  border-left: 1px solid var(--filet); line-height: 1.25; transition: background var(--duree) var(--courbe), color var(--duree); }
.segment:first-child { border-left: 0; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment:hover { background: var(--accent-pale); }
.segment:has(input:checked) { background: var(--encre); color: var(--blanc); font-weight: 500; }
.segment:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: -3px; }
.segment:has(input:disabled) { opacity: 0.35; cursor: not-allowed; background: var(--papier); }

.livrable { padding: 22px 0 24px; border-top: 1px solid var(--filet); margin: 0; }
.livrable:last-of-type { border-bottom: 1px solid var(--filet); }
.livrable legend { font-family: var(--serif); font-weight: 500; font-size: 20px; margin-bottom: 2px; }
.livrable .aide { margin-bottom: 14px; }
.livrable-grille { display: grid; grid-template-columns: 130px 1fr; gap: 10px 16px; align-items: center; }
.livrable-etiquette { color: var(--gris); font-size: 13.5px; }
.livrable-grille.sans-duree > :nth-child(3), .livrable-grille.sans-duree > :nth-child(4) { opacity: 0.4; }

/* Champs */
input[type="text"] { width: 100%; font: 400 21px/1.4 "Inter", sans-serif; color: var(--encre); padding: 8px 0 10px; border: 0; border-bottom: 1.5px solid var(--filet-fort);
  background: transparent; border-radius: 0; transition: border-color var(--duree); }
input[type="text"]:focus { outline: none; border-bottom-color: var(--accent); }
input[type="text"]::placeholder, textarea::placeholder { color: #A3ACB8; }
textarea { width: 100%; min-height: 150px; font: inherit; font-size: 16px; line-height: 1.6; color: var(--encre); padding: 14px 16px; border: 1px solid var(--filet-fort);
  border-radius: var(--rayon); background: var(--blanc); resize: vertical; transition: border-color var(--duree), box-shadow var(--duree); }
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-pale); }
.compte-caracteres { margin: 6px 0 0; text-align: right; font-size: 12.5px; color: var(--gris-clair); font-variant-numeric: tabular-nums; }

/* Navigation */
.navigation { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--filet); }
.astuce { flex: 1; text-align: right; color: var(--gris-clair); font-size: 13px; }
.erreur { color: var(--alerte); font-weight: 500; font-size: 14.5px; min-height: 1.4em; margin: 10px 0 0; }

/* ---------- Résultat ---------- */
.resultat .titre-resultat { font-size: clamp(34px, 4.6vw, 48px); line-height: 1.08; margin: 16px 0 12px; outline: none; }
.chapeau-resultat { color: var(--texte); font-size: 17px; margin: 0 0 32px; }
.score { padding: 28px 0 30px; border-top: 1px solid var(--filet); border-bottom: 1px solid var(--filet); margin-bottom: 40px; }
.score-chiffre { font-size: 64px; line-height: 1; margin: 0; color: var(--encre); }
.score-chiffre small { font-size: 28px; color: var(--gris); }
.score-texte { margin: 8px 0 16px; color: var(--gris); }
.score-piste { height: 4px; background: var(--filet); border-radius: 2px; overflow: hidden; }
.score-piste span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 1100ms var(--courbe); }
.sous-titre { font-size: 24px; margin: 0 0 18px; }
.corrections { list-style: none; margin: 0; padding: 0; counter-reset: c; }
.corrections li { padding: 20px 0 22px; border-top: 1px solid var(--filet); animation: monter 480ms var(--courbe) both; }
.corrections li:last-child { border-bottom: 1px solid var(--filet); }
.corrections .theme { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--or); }
.corrections .question-texte { margin: 0 0 12px; font-weight: 600; }
.corrections .votre { margin: 0 0 4px; color: var(--gris); font-size: 14.5px; }
.corrections .bonne { margin: 0 0 8px; color: var(--vert); font-size: 14.5px; font-weight: 500; }
.corrections .explication { margin: 0; color: var(--texte); font-size: 15px; }
.sans-faute { padding: 18px 20px; background: var(--vert-pale); color: var(--vert); border-radius: var(--rayon); }
.suite { margin-top: 40px; padding: 24px 26px; background: var(--encre); color: var(--blanc); border-radius: var(--rayon); }
.suite .sur { color: #B9C9DC; margin-bottom: 8px; }
.suite p:last-child { margin: 0; color: #DCE3EC; }

.pied { text-align: center; color: var(--gris-clair); font-size: 12.5px; padding: 22px 16px 28px; }
.accueil:not([hidden]) ~ .pied { display: none; }

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  .accueil { grid-template-columns: 1fr; min-height: 0; }
  .accueil-gauche, .accueil-droite { padding: 40px 22px; }
  .accueil-droite { padding-bottom: 44px; }
  .accueil:not([hidden]) ~ .pied { display: block; }
}
@media (max-width: 560px) {
  .meta { grid-template-columns: 1fr; gap: 16px; }
  .parcours-haut { padding: 14px 16px; }
  .avancement { top: 49px; }
  .livrable-grille { grid-template-columns: 1fr; gap: 6px; }
  .livrable-etiquette { margin-top: 6px; }
  .segments { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
  .segment { border-left: 0; border-top: 1px solid var(--filet); }
  .segment:nth-child(-n+2) { border-top: 0; }
  .segment:nth-child(even) { border-left: 1px solid var(--filet); }
  .option { padding: 13px 14px; gap: 12px; }
  .astuce { display: none; }
  .score-chiffre { font-size: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Administration ---------- */
.admin { background: #F6F7F9; }
.admin-tete { background: var(--encre); color: var(--blanc); padding: 40px 16px 36px; }
.admin-tete-texte { max-width: 1120px; margin: 0 auto; }
.admin-tete .sur { color: #B9C9DC; }
.admin-tete h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.1; margin: 12px 0 0; }
.admin-corps { flex: 1; width: 100%; max-width: 1152px; margin: 0 auto; padding: 32px 16px 48px; }
.admin h2.serif { font-size: 26px; margin: 40px 0 14px; }
.admin-grille { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.bloc-admin { background: var(--blanc); border: 1px solid var(--filet); border-radius: 6px; padding: 22px 24px; }
.bloc-admin.large { grid-column: 1 / -1; }
.bloc-admin.double { grid-column: span 2; }
.bloc-admin.fonce { background: var(--encre); color: var(--blanc); border: 0; }
.bloc-admin.fonce .sur { color: #B9C9DC; }
.bloc-admin.fonce p { color: #DCE3EC; }
.bloc-admin.fonce h2 { font-size: 26px; line-height: 1.2; margin: 10px 0 8px; color: var(--blanc); }
.bloc-admin.accent { border-left: 3px solid var(--or); }
.bloc-admin p { margin: 8px 0 0; }
.bloc-admin ul, .bloc-admin ol { margin: 10px 0 0; padding-left: 20px; }
.bloc-admin li + li { margin-top: 6px; }
.espace { margin-top: 18px !important; }
.chiffre { font-size: 44px; line-height: 1; margin: 12px 0 12px !important; color: var(--encre); }
.chiffre small { font-size: 20px; color: var(--gris); }
.petit { font-size: 13.5px; color: var(--gris); }
.jauge { display: block; height: 4px; background: var(--filet); border-radius: 2px; overflow: hidden; }
.jauge-valeur { display: block; height: 100%; background: var(--accent); }
.liste-comptes { list-style: none; padding: 0 !important; }
.liste-comptes li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--filet); margin: 0 !important; }
.liste-comptes li:first-child { border-top: 0; }
.compte { color: var(--gris); font-size: 13.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.poste { list-style: none; padding: 0 !important; }
.poste li { position: relative; padding-left: 24px; }
.poste li::before { position: absolute; left: 0; top: 0; font-weight: 700; }
.poste-ok::before { content: "✓"; color: var(--vert); }
.poste-alerte { color: var(--alerte); }
.poste-alerte::before { content: "!"; color: var(--alerte); left: 5px !important; }
.reperes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.repere { display: grid; grid-template-columns: 130px 1fr; gap: 16px; background: var(--blanc); border: 1px solid var(--filet); border-radius: 6px; padding: 16px 18px; }
.repere p { margin: 4px 0 0; }
.repere .etat { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.repere.ok .etat { color: var(--vert); }
.repere.ko .etat { color: var(--alerte); }
.repere.nsp .etat { color: var(--gris); }
.tableau { overflow-x: auto; background: var(--blanc); border: 1px solid var(--filet); border-radius: 6px; }
.admin table { border-collapse: collapse; width: 100%; font-size: 14px; }
.admin th { background: var(--encre); color: var(--blanc); text-align: left; padding: 11px 14px; font-weight: 500; }
.admin td { padding: 11px 14px; border-top: 1px solid var(--filet); vertical-align: top; }
.admin details { background: var(--blanc); border-radius: 6px; padding: 12px 16px; margin: 10px 0; border: 1px solid var(--filet); }
.admin summary { cursor: pointer; font-weight: 500; }
.admin dt { font-weight: 500; margin-top: 10px; }
.admin dd { margin: 2px 0 0; color: var(--gris); white-space: pre-wrap; }
.admin blockquote { margin: 10px 0; padding: 16px 20px; background: var(--blanc); border-left: 3px solid var(--or); border-radius: 0 6px 6px 0; }
.admin blockquote p:last-child { margin: 6px 0 0; white-space: pre-wrap; }
.retour { margin: 0 0 18px; }
.vide, .note, .exports { color: var(--gris); font-size: 14px; }
@media (max-width: 860px) {
  .admin-grille { grid-template-columns: 1fr; }
  .bloc-admin.double { grid-column: auto; }
  .repere { grid-template-columns: 1fr; gap: 4px; }
}
.v-0 { width: 0; } .v-5 { width: 5%; } .v-10 { width: 10%; } .v-15 { width: 15%; } .v-20 { width: 20%; } .v-25 { width: 25%; } .v-30 { width: 30%; }
.v-35 { width: 35%; } .v-40 { width: 40%; } .v-45 { width: 45%; } .v-50 { width: 50%; } .v-55 { width: 55%; } .v-60 { width: 60%; } .v-65 { width: 65%; }
.v-70 { width: 70%; } .v-75 { width: 75%; } .v-80 { width: 80%; } .v-85 { width: 85%; } .v-90 { width: 90%; } .v-95 { width: 95%; } .v-100 { width: 100%; }

@media print {
  .admin-tete { padding: 16px; background: none; color: var(--encre); border-bottom: 2px solid var(--encre); }
  .admin-tete .sur { color: var(--accent); }
  .retour, .exports, .pied { display: none; }
  .bloc-admin, details, .repere { break-inside: avoid; }
  .bloc-admin.fonce { background: none; color: var(--encre); border: 1px solid var(--encre); }
  .bloc-admin.fonce p, .bloc-admin.fonce h2, .bloc-admin.fonce .sur { color: var(--encre); }
  details { display: block; } details > * { display: block; }
}
