:root {
  --fond: #F7F1E6;
  --fond-carte: #FFFFFF;
  --fond-doux: #F0E7D6;
  --bord: #E4D8C1;
  --orange: #D8623A;
  --orange-fonce: #BB4E29;
  --encre: #333334;
  --encre-doux: #75726C;
  --blanc: #FFFFFF;
  --rayon: 12px;
  --rayon-badge: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

/* Un seul écran visible à la fois. Doit rester après les règles de mise en page. */
[hidden] { display: none !important; }

body {
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--fond);
  color: var(--encre);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.app {
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 32px 22px 56px;
  display: flex;
  flex-direction: column;
}

.app > section {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 { font-weight: 700; line-height: 1.15; letter-spacing: -0.2px; }

/* Badge orange incliné, signature de la direction artistique */
.badge {
  display: inline-block;
  background: var(--orange);
  color: var(--blanc);
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 7px 14px 6px;
  border-radius: var(--rayon-badge);
  transform: rotate(-2.2deg);
}

.loupe { display: block; margin: 0 auto; color: var(--orange); }

.signature-bloc {
  margin-top: auto;
  padding-top: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.signature-bloc span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--orange);
}

/* Accueil */
.titre-accueil { font-size: 2.5rem; font-weight: 800; color: var(--encre); text-align: center; }
.sous-titre {
  margin-top: 4px;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--orange);
}
.accroche {
  margin-top: 28px;
  font-size: 1.02rem;
  text-align: justify;
  hyphens: auto;
  color: var(--encre);
}
.accroche strong { font-weight: 700; }

.encadre-indicatif {
  margin-top: 24px;
  padding: 16px 18px;
  border: 2px solid var(--encre);
  border-radius: var(--rayon);
  background: var(--fond-carte);
  font-size: 0.92rem;
  text-align: justify;
  hyphens: auto;
}

.champ-case {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 22px;
  font-size: 0.96rem;
  cursor: pointer;
  user-select: none;
}
.champ-case input {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 2px;
  border: 2px solid var(--encre);
  border-radius: 7px;
  background: var(--fond-carte);
  display: grid;
  place-content: center;
  cursor: pointer;
}
.champ-case input::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 3px;
  transform: scale(0);
  transition: transform 0.12s ease;
  background: var(--orange);
}
.champ-case input:checked { border-color: var(--orange); }
.champ-case input:checked::before { transform: scale(1); }
.champ-case input:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

.bouton-primaire {
  display: block;
  width: 100%;
  margin-top: 24px;
  padding: 16px 20px;
  font: inherit;
  font-weight: 700;
  font-size: 1.04rem;
  color: var(--blanc);
  background: var(--orange);
  border: none;
  border-radius: var(--rayon);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}
.bouton-primaire:hover { background: var(--orange-fonce); }
.bouton-primaire:active { transform: translateY(1px); }
.bouton-primaire:disabled { background: var(--bord); color: #A79E8C; cursor: not-allowed; }
.bouton-primaire:focus-visible { outline: 3px solid var(--encre); outline-offset: 2px; }

.bouton-choix {
  width: 100%;
  padding: 14px 20px;
  font: inherit;
  font-weight: 700;
  font-size: 1.04rem;
  color: var(--encre);
  background: transparent;
  border: 2px solid var(--encre);
  border-radius: var(--rayon);
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
  .bouton-choix:hover:not(:disabled) { border-color: var(--orange); color: var(--orange); }
}
.bouton-choix:disabled { opacity: 0.35; cursor: not-allowed; }
.bouton-choix:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.bouton-note {
  display: block;
  margin-top: 3px;
  font-weight: 500;
  font-size: 0.8rem;
  opacity: 0.8;
}

.bouton-secondaire {
  padding: 11px 15px;
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--encre);
  background: transparent;
  border: 2px solid var(--encre);
  border-radius: var(--rayon);
  cursor: pointer;
}
.bouton-secondaire:disabled { opacity: 0.28; cursor: not-allowed; }
.bouton-secondaire:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

.erreur {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--rayon);
  background: #FBE4DD;
  border: 1px solid #E0A794;
  font-size: 0.9rem;
}

/* Questionnaire */
.barre-fond {
  height: 8px;
  background: var(--fond-doux);
  border-radius: 999px;
  overflow: hidden;
}
.barre-remplissage {
  height: 100%;
  width: 0;
  background: var(--orange);
  border-radius: 999px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.progression-texte {
  margin-top: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--encre-doux);
}

.zone-categorie { margin-top: 30px; display: flex; align-items: center; gap: 9px; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Bouton "?" : contexte factuel de la question, neutre, avant de répondre. */
.bouton-contexte {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--encre-doux);
  background: transparent;
  color: var(--encre-doux);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
  .bouton-contexte:hover { border-color: var(--orange); color: var(--orange); }
}
.bouton-contexte:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.bouton-contexte.ouvert { background: var(--orange); border-color: var(--orange); color: var(--blanc); }

#bloc-question.entree { animation: entree-question 0.22s ease both; }
@keyframes entree-question {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.question-texte {
  margin-top: 16px;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.3;
  text-wrap: balance;
}

/* Contexte factuel, neutre et sourcé, repliable sous la question. */
.zone-contexte {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--fond-carte);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
}
.contexte-texte {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--encre-doux);
  text-align: justify;
  hyphens: auto;
}
.contexte-source {
  margin-top: 8px;
  font-size: 0.78rem;
}
.contexte-source a {
  color: var(--orange);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.reponses {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.reponse {
  width: 100%;
  min-height: 54px;
  padding: 14px 18px;
  font: inherit;
  font-weight: 500;
  font-size: 1rem;
  text-align: left;
  color: var(--encre);
  background: var(--fond-carte);
  border: 2px solid var(--bord);
  border-radius: var(--rayon);
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
}
/* Survol seulement sur les appareils avec une vraie souris.
   Sur mobile, un tap laissait sinon un contour orange collé sur le bouton
   de la question suivante. */
@media (hover: hover) and (pointer: fine) {
  .reponse:hover { border-color: var(--orange); }
}
.reponse:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.reponse.choisie {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--blanc);
  font-weight: 600;
}

.ligne-actions {
  margin-top: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}
.lien-passer {
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--encre-doux);
  background: none;
  border: none;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.lien-passer:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* Étape « classe tes priorités » */
.priorites-choisies {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.priorites-choisies:empty { margin-top: 0; }
.priorite-choisie {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 10px 18px;
  background: var(--orange);
  border-radius: var(--rayon);
  color: var(--blanc);
  font-weight: 600;
}
.priorite-rang {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  font-weight: 700;
}
.priorites-dispo {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.priorite {
  width: 100%;
  min-height: 54px;
  padding: 14px 18px;
  font: inherit;
  font-weight: 500;
  font-size: 1rem;
  text-align: left;
  color: var(--encre);
  background: var(--fond-carte);
  border: 2px solid var(--bord);
  border-radius: var(--rayon);
  cursor: pointer;
  transition: border-color 0.14s ease;
}
@media (hover: hover) and (pointer: fine) {
  .priorite:hover { border-color: var(--orange); }
}
.priorite:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* Résultat */
.titre-resultat { text-align: center; margin-top: 6px; }
.titre-resultat h2 { font-size: 1.7rem; font-weight: 800; text-wrap: balance; margin-top: 2px; }

/* Ta position à toi sur chaque thème, avant les partis. */
.mes-positions {
  margin-top: 22px;
  padding: 16px 18px;
  background: var(--fond-carte);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
}
.mes-positions-titre {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--orange);
  margin-bottom: 12px;
}
.mes-positions-liste { display: flex; flex-direction: column; gap: 12px; }
.mes-positions-ligne { display: flex; align-items: center; gap: 12px; }
.mes-positions-nom {
  flex: 0 0 38%;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--encre);
  line-height: 1.25;
}
.mes-positions-barre {
  position: relative;
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--fond-doux);
}
.mes-positions-barre::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -3px;
  width: 2px;
  height: 14px;
  background: var(--bord);
  transform: translateX(-50%);
}
.mes-positions-repere {
  position: absolute;
  top: 50%;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--orange);
  border: 2px solid var(--fond-carte);
  transform: translate(-50%, -50%);
}
.mes-positions-legende {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  padding-left: calc(38% + 12px);
  font-size: 0.72rem;
  color: var(--encre-doux);
}

.liste-resultats {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bouton-autres-partis { margin-top: 18px; }
.liste-autres-partis { margin-top: 14px; }

.carte-parti {
  border: 2px solid var(--bord);
  border-left: 8px solid var(--couleur-parti, var(--orange));
  border-radius: var(--rayon);
  background: var(--fond-carte);
  overflow: hidden;
}
.carte-parti--premier {
  border: none;
  background: var(--orange);
  color: var(--blanc);
  box-shadow: 0 14px 30px rgba(216, 98, 58, 0.3);
}

.parti-entete {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "photo nom"
    "photo tete"
    "photo jauge"
    "photo action";
  column-gap: 14px;
  row-gap: 3px;
  align-items: center;
  padding: 15px 16px;
  font: inherit;
  text-align: left;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
}
.parti-entete:focus-visible { outline: 3px solid var(--encre); outline-offset: -3px; }
.carte-parti--premier .parti-entete:focus-visible { outline-color: var(--blanc); }

/* Pastille photo du chef de file */
.parti-photo {
  grid-area: photo;
  align-self: center;
  position: relative;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--blanc);
  background: var(--fond-doux);
}
.parti-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.parti-photo--vide { background: var(--couleur-parti, var(--orange)); }

/* Deux chefs de file : deux ronds qui se chevauchent */
.parti-photo--duo { background: transparent; overflow: visible; }
.parti-photo-mini {
  position: absolute;
  width: 70%;
  height: 70%;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--fond-carte);
  background: var(--couleur-parti, var(--orange));
  display: grid;
  place-items: center;
  color: var(--blanc);
  font-size: 0.72rem;
  font-weight: 700;
}
.parti-photo-mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.parti-photo-mini:first-child { top: -2px; left: -2px; z-index: 1; }
.parti-photo-mini:last-child { bottom: -2px; right: -2px; z-index: 2; }
.carte-parti--premier .parti-photo-mini { border-color: var(--orange); }

.parti-rang {
  position: absolute;
  right: -4px;
  bottom: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--encre);
  color: var(--blanc);
  font-size: 0.7rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--fond-carte);
  font-variant-numeric: tabular-nums;
}
/* Sur une pastille à deux photos, le rang passe en haut à droite (coin libre). */
.parti-photo--duo .parti-rang { bottom: auto; top: -6px; right: -6px; }

.parti-nom { grid-area: nom; min-width: 0; overflow-wrap: anywhere; font-weight: 700; font-size: 1.06rem; line-height: 1.24; }
.parti-tete { grid-area: tete; min-width: 0; font-size: 0.82rem; font-weight: 500; line-height: 1.3; color: var(--encre-doux); margin-top: 1px; }
.parti-action { grid-area: action; font-size: 0.82rem; font-weight: 600; opacity: 0.72; margin-top: 4px; }

/* Niveau de correspondance + jauge, à la place du pourcentage */
.parti-jauge-zone { grid-area: jauge; min-width: 0; margin-top: 5px; }
.parti-niveau {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--orange);
}
.parti-jauge {
  display: block;
  margin-top: 4px;
  height: 8px;
  border-radius: 999px;
  background: var(--fond-doux);
  overflow: hidden;
}
.parti-jauge-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--orange);
}

.carte-parti--premier .parti-photo { width: 64px; height: 64px; }
.carte-parti--premier .parti-rang { border-color: var(--orange); }
.carte-parti--premier .parti-nom { font-size: 1.32rem; line-height: 1.18; }
.carte-parti--premier .parti-tete { color: rgba(255, 255, 255, 0.9); font-size: 0.86rem; }
.carte-parti--premier .parti-action { opacity: 0.85; }
.carte-parti--premier .parti-niveau { color: var(--blanc); font-size: 0.92rem; }
.carte-parti--premier .parti-jauge { background: rgba(255, 255, 255, 0.28); }
.carte-parti--premier .parti-jauge-fill { background: var(--blanc); }

.parti-detail {
  padding: 2px 18px 16px;
  background: var(--fond-carte);
  color: var(--encre);
}
.detail-resume {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--fond);
  border-radius: var(--rayon);
  border: 1px solid var(--bord);
}
.detail-resume-titre {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--orange);
  margin-bottom: 6px;
}
.detail-resume-texte {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--encre);
  text-align: justify;
  hyphens: auto;
}
.detail-resume-score {
  margin-top: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--encre-doux);
}

/* Détail par thème : les 4 scores d'axe qui composent le score final. */
.detail-axes {
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--fond-carte);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
}
.detail-axes-titre {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--orange);
  margin-bottom: 8px;
}
.detail-axe-ligne {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--fond-doux);
}
.detail-axe-ligne:last-child { border-bottom: none; }
.detail-axe-ligne span:first-child { color: var(--encre); }
.detail-axe-ligne span:last-child { font-weight: 700; color: var(--encre); flex-shrink: 0; }

.detail-categorie {
  margin-top: 18px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--orange);
}
.detail-ligne { padding: 12px 0; border-bottom: 1px solid var(--fond-doux); }
.detail-ligne:last-child { border-bottom: none; }
.detail-question { font-weight: 600; font-size: 0.94rem; }
.detail-meta { font-size: 0.87rem; margin-top: 4px; color: var(--encre-doux); }
.detail-compat { font-size: 0.87rem; font-weight: 700; margin-top: 6px; color: var(--encre); }

/* Sondage facultatif, anonyme, sur l'accueil et après le résultat. */
.sondage {
  margin-top: 26px;
  padding: 16px 18px;
  background: var(--fond-carte);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
}
.sondage-debut { margin-top: 22px; }
.sondage-titre {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--orange);
  margin-bottom: 16px;
}
.sondage-question + .sondage-question { margin-top: 18px; }
.sondage-label { font-size: 0.9rem; font-weight: 600; color: var(--encre); margin-bottom: 8px; }
.sondage-options { display: flex; flex-wrap: wrap; gap: 8px; }
.sondage-option {
  padding: 8px 14px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--encre);
  background: var(--fond);
  border: 2px solid var(--bord);
  border-radius: 999px;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
  .sondage-option:hover { border-color: var(--orange); }
}
.sondage-option:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.sondage-option.choisie { background: var(--orange); border-color: var(--orange); color: var(--blanc); }

.rappel-indicatif {
  margin-top: 26px;
  padding: 14px 16px;
  border-radius: var(--rayon);
  background: var(--fond-carte);
  border: 1px solid var(--bord);
  font-size: 0.86rem;
  color: var(--encre-doux);
  text-align: justify;
  hyphens: auto;
}

/* Pied de page, prêt pour plus tard */
.pied {
  min-height: 0;
  margin-top: 40px;
  padding: 20px 22px 40px;
  border-top: 1px solid var(--bord);
  font-size: 0.85rem;
}

@media (min-width: 540px) {
  .app { padding-top: 52px; }
  .titre-accueil { font-size: 3rem; }
  .question-texte { font-size: 1.58rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
