/* =========================================================================
   QCM Moniteur de conduite — feuille de style
   Aucune dépendance externe. Variables CSS pour la thématisation.
   ========================================================================= */
:root {
  --rouge: #d52b1e;
  --rouge-fonce: #a51b12;
  --encre: #1a1a1a;
  --gris: #5b6470;
  --fond: #f5f6f8;
  --carte: #ffffff;
  --bord: #e2e5ea;
  --vert: #1f7a43;
  --vert-fond: #e8f5ee;
  --rouge-fond: #fdecea;
  --jaune-fond: #fff7e0;
  --jaune-bord: #e6c34a;
  --rayon: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--encre);
  background: var(--fond);
  line-height: 1.55;
}

/* ----- En-tête ----------------------------------------------------------- */
.entete {
  background: linear-gradient(135deg, var(--rouge), var(--rouge-fonce));
  color: #fff;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.entete h1 { margin: 0; font-size: 1.25rem; }
.retour {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  padding: .35rem .6rem;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.5);
}
.retour:hover, .retour:focus-visible { background: rgba(255,255,255,.15); outline: none; }
.select-langue-wrap { margin-left: auto; }
.select-langue {
  font: inherit;
  padding: .3rem .5rem;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.6);
  background: rgba(255,255,255,.12);
  color: #fff;
  cursor: pointer;
}
.select-langue option { color: #1a1a1a; }
.aid-note {
  max-width: 48rem;
  margin: .6rem auto -.4rem;
  padding: 0 1.25rem;
  font-size: .82rem;
  color: var(--gris);
  text-align: center;
}

/* ----- Mise en page ------------------------------------------------------ */
main {
  max-width: 48rem;
  margin: 1.5rem auto;
  padding: 0 1.25rem;
}
.ecran { display: none; }
.ecran.actif { display: block; }

h2 { font-size: 1.4rem; }

/* ----- Formulaire de configuration -------------------------------------- */
fieldset {
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  margin: 0 0 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--carte);
}
legend { font-weight: 600; padding: 0 .4rem; }
label { display: block; margin-bottom: .35rem; }
input[type="number"] {
  font-size: 1rem;
  padding: .5rem .6rem;
  border: 1px solid var(--bord);
  border-radius: 8px;
  width: 8rem;
}
.themes { display: flex; flex-wrap: wrap; gap: .6rem 1.25rem; }
.themes label {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin: 0;
  cursor: pointer;
}

.info { color: var(--gris); }
.avertissement {
  background: var(--jaune-fond);
  border: 1px solid var(--jaune-bord);
  border-radius: var(--rayon);
  padding: .75rem 1rem;
}

/* ----- Boutons ----------------------------------------------------------- */
.btn {
  font: inherit;
  cursor: pointer;
  padding: .6rem 1.1rem;
  border: 1px solid var(--bord);
  background: var(--carte);
  border-radius: 10px;
  color: var(--encre);
  transition: background .12s ease, border-color .12s ease, transform .08s ease;
}
.btn:hover, .btn:focus-visible { border-color: var(--rouge); outline: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primaire {
  background: var(--rouge);
  border-color: var(--rouge);
  color: #fff;
}
.btn-primaire:hover, .btn-primaire:focus-visible { background: var(--rouge-fonce); border-color: var(--rouge-fonce); }

/* ----- Barre du quiz ----------------------------------------------------- */
.barre-quiz {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--bord);
}
.progression { margin: 0; font-weight: 600; }
.minuteur {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-size: 1.2rem;
  font-weight: 700;
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: 10px;
  padding: .25rem .7rem;
}
.minuteur.urgent { color: var(--rouge); border-color: var(--rouge); }

/* ----- Question ---------------------------------------------------------- */
.zone-question .enonce {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 1rem;
}
.zone-question .theme-tag {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--rouge);
  background: var(--rouge-fond);
  padding: .15rem .55rem;
  border-radius: 999px;
  margin-bottom: .6rem;
}
.choix { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.choix li { margin: 0; }
.choix label {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  padding: .8rem 1rem;
  border: 1px solid var(--bord);
  border-radius: 10px;
  background: var(--carte);
  cursor: pointer;
}
.choix label:hover { border-color: var(--rouge); }
.choix input { margin-top: .2rem; }
.choix input:focus-visible + .texte-choix { text-decoration: underline; }

/* Image illustrant une question (optionnelle) */
.question-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: .25rem 0 1rem;
  border: 1px solid var(--bord);
  border-radius: 10px;
  background: #fff;
}
.carte-resultat .question-image { max-width: 360px; }

/* Étiquette de niveau (Débutant / Intermédiaire / Avancé / Expert) */
.niveau-tag {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: .12rem .55rem;
  border-radius: 999px;
  margin: 0 .4rem .6rem 0;
  vertical-align: middle;
}
.niveau-debutant { background: #e8f5ee; color: #1f7a43; }
.niveau-intermediaire { background: #e7f0fb; color: #1456a0; }
.niveau-avance { background: #fff1e0; color: #9a5a00; }
.niveau-expert { background: #fdecea; color: #a51b12; }

/* Pourcentage de répartition par loi */
.pct { color: var(--gris); font-size: .85rem; font-variant-numeric: tabular-nums; }

/* Navigateur de questions (repérer / atteindre les questions sans réponse) */
.navigateur { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0; }
.nav-cell {
  min-width: 2.1rem;
  height: 2.1rem;
  padding: 0 .25rem;
  font: inherit;
  font-size: .85rem;
  color: var(--encre);
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: 8px;
  cursor: pointer;
}
.nav-cell:hover, .nav-cell:focus-visible { border-color: var(--rouge); outline: none; }
.nav-cell.repondue { background: var(--vert-fond); border-color: var(--vert); color: var(--vert); font-weight: 700; }
.nav-cell.courante { outline: 2px solid var(--rouge); outline-offset: 1px; }

/* ----- Navigation -------------------------------------------------------- */
.navigation {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin: 1.25rem 0;
}
.navigation .btn-primaire { margin-left: auto; }

/* ----- Résultats --------------------------------------------------------- */
.resume {
  text-align: center;
  padding: 1.5rem;
  border-radius: var(--rayon);
  border: 1px solid var(--bord);
  background: var(--carte);
  margin-bottom: 1rem;
}
.resume .score { font-size: 2.4rem; font-weight: 800; margin: .25rem 0; }
.resume.reussi { background: var(--vert-fond); border-color: var(--vert); }
.resume.echoue { background: var(--rouge-fond); border-color: var(--rouge); }
.resume .verdict { font-size: 1.2rem; font-weight: 700; }
.resume.reussi .verdict { color: var(--vert); }
.resume.echoue .verdict { color: var(--rouge-fonce); }

.detail { display: grid; gap: 1rem; margin: 1.25rem 0; }
.carte-resultat {
  border: 1px solid var(--bord);
  border-left-width: 5px;
  border-radius: var(--rayon);
  background: var(--carte);
  padding: 1rem 1.25rem;
}
.carte-resultat.juste { border-left-color: var(--vert); }
.carte-resultat.faux { border-left-color: var(--rouge); }
.carte-resultat .enonce-res { font-weight: 600; margin: 0 0 .6rem; }
.carte-resultat ul { list-style: none; margin: 0 0 .6rem; padding: 0; display: grid; gap: .35rem; }
.carte-resultat li { padding: .4rem .6rem; border-radius: 8px; }
.carte-resultat li.bonne { background: var(--vert-fond); }
.carte-resultat li.choisie-fausse { background: var(--rouge-fond); }
.carte-resultat .explication {
  font-size: .95rem;
  color: var(--encre);
  background: var(--fond);
  border-radius: 8px;
  padding: .6rem .75rem;
  margin: .4rem 0 0;
}
.carte-resultat .source { font-size: .85rem; margin-top: .5rem; }
.carte-resultat .source a { color: var(--rouge); }
.badge {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  padding: .1rem .5rem;
  border-radius: 999px;
}
.badge.juste { background: var(--vert-fond); color: var(--vert); }
.badge.faux { background: var(--rouge-fond); color: var(--rouge-fonce); }

/* ----- Pied -------------------------------------------------------------- */
.pied {
  text-align: center;
  color: var(--gris);
  font-size: .85rem;
  padding: 1.5rem;
}

/* ----- Accessibilité ----------------------------------------------------- */
.visuellement-cache {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ----- Mouvement réduit -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ----- Responsive -------------------------------------------------------- */
@media (max-width: 30rem) {
  .navigation .btn { flex: 1 1 auto; }
  .navigation .btn-primaire { margin-left: 0; }
}
