/*
  Procimex — page « Quiz punaises de lit », chargée seulement là.

  Reprise de Test design/quiz-punaises-v1.html (24/09). Couleurs, polices et
  boutons viennent de base.css : rien n'est redéfini ici, seules deux nuances
  dérivées propres au quiz sont posées sur .quiz.
*/

.quiz {
  /* Fond d'une bonne réponse : l'accent très dilué dans du blanc. */
  --ok-bg: color-mix(in oklab, var(--accent) 9%, var(--white));
  /* Fond d'une mauvaise réponse : la pastille rosée déjà utilisée pour la température. */
  --ko-bg: var(--badge-bg);
}

.quiz-wrap { max-width: 46rem; margin: 0 auto; padding-left: var(--gut); padding-right: var(--gut); }

/* Les titres de base.css sont dimensionnés pour des pages de contenu ; le quiz
   est une carte de jeu, plus resserrée. */
.quiz h1 { font-size: clamp(1.875rem, 4.4vw, 2.75rem); line-height: 1.1; outline: none; }
.quiz h1 .hl { color: var(--hl); }
.quiz h2 { font-size: clamp(1.375rem, 3vw, 1.75rem); line-height: 1.25; outline: none; }
.quiz .btn-row { margin-top: 2rem; }
.quiz .btn { cursor: pointer; }

/* .btn--ghostDark est pensé pour un fond sombre ; surchargé ici comme sur les
   autres pages pour rester lisible sur la carte blanche. */
.quiz .btn--ghostDark { background: var(--pale); color: var(--ink); border-color: var(--border-dk); }
.quiz .btn--ghostDark:hover { background: var(--btn-hover); color: var(--white); border-color: var(--btn-hover); }

/* ---------- En-tête du quiz ---------- */
.quiz-intro { text-align: center; }
.quiz-presente { margin: 0.75rem auto 0; max-width: 34rem; font-size: 0.9375rem; font-weight: 600; line-height: 1.6; color: var(--accent); }
.quiz-lead { margin: 1rem auto 0; max-width: 34rem; }
.quiz-sans-js { margin-top: 2rem; text-align: center; }
.quiz-sans-js a { color: var(--accent); text-decoration: underline; }

/* ---------- Carte à coin coupé (reprise des cartes de certification) ---------- */
.quiz-frame {
  background: var(--border); padding: 1px;
  clip-path: polygon(0 0, calc(100% - var(--chamfer)) 0, 100% var(--chamfer), 100% 100%, 0 100%);
  filter: drop-shadow(var(--shadow-card));
}
.quiz-card {
  background: var(--white); padding: 2.25rem 2rem 2rem;
  clip-path: polygon(0 0, calc(100% - var(--chamfer)) 0, 100% var(--chamfer), 100% 100%, 0 100%);
}

/* ---------- Liste des niveaux ---------- */
/* base.css ne remet à zéro que les <ul> : les deux listes numérotées du quiz
   garderaient sinon leurs numéros et leur retrait. */
.parcours, .segments { list-style: none; padding: 0; }
.parcours { margin-top: 2.75rem; display: grid; gap: 1rem; }
.station { position: relative; }
/* Trait vertical qui relie les niveaux, comme un chemin à suivre */
.station + .station::before {
  content: ""; position: absolute; left: calc(2.75rem - 1px); top: -1rem; height: 1rem; width: 2px;
  background: var(--border);
}
.station.ouvert + .station.ouvert::before { background: var(--accent); }
.station-btn {
  width: 100%; display: grid; grid-template-columns: 3rem 1fr auto; align-items: center; gap: 1rem;
  padding: 1.125rem 1.25rem; text-align: left; font: inherit; line-height: 1.5; color: inherit;
  background: var(--white); border: 1px solid var(--border); border-radius: 0.375rem;
  box-shadow: var(--shadow-card); cursor: pointer;
  transition: border-color .16s ease;
}
.station-btn:hover:not(:disabled) { border-color: var(--accent); }
.station-btn:disabled { cursor: not-allowed; background: var(--paper); box-shadow: none; }
.pastille {
  width: 3rem; height: 3rem; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-head); font-weight: 600; font-size: 1.25rem;
  background: var(--btn); color: var(--white);
}
.station-btn:disabled .pastille { background: var(--pale); color: var(--mute); border: 1px solid var(--border); }
.station.fait .pastille { background: var(--accent); }
.station-titre { display: block; font-family: var(--font-head); font-weight: 600; color: var(--ink); font-size: 1.0625rem; line-height: 1.3; }
.station-sous { display: block; font-size: 0.875rem; color: var(--mute); margin-top: 0.125rem; }
.station-btn:disabled .station-titre { color: var(--mute); }
.station-etat { display: flex; align-items: center; gap: 0.125rem; }
.station-etat svg { width: 1.125rem; height: 1.125rem; }
.cadenas { color: var(--mute); }
.nowrap { white-space: nowrap; }

/* Étoile éteinte dans la teinte des bordures : pas de nouvelle couleur à créer. */
.etoile { fill: var(--border); }
.etoile.on { fill: var(--star); }

.regle { margin-top: 1.5rem; text-align: center; font-size: 0.9375rem; line-height: 1.6; color: var(--mute); }

/* ---------- Question ---------- */
.hud { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.hud-niveau { font-size: 0.875rem; font-weight: 600; color: var(--ink); }
.hud-niveau span { color: var(--mute); font-weight: 400; }
.hud-droite { display: flex; align-items: center; gap: 0.625rem; }
.points {
  font-family: var(--font-head); font-weight: 600; color: var(--ink); font-size: 1.125rem;
  font-variant-numeric: tabular-nums; position: relative; white-space: nowrap;
}
.points small { font-family: var(--font-body); font-size: 0.75rem; color: var(--mute); font-weight: 600; margin-left: 0.25rem; }
.serie {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: 0.8125rem; font-weight: 700; line-height: 1.4; color: var(--badge-text); background: var(--badge-bg);
  padding: 0.25rem 0.625rem; border-radius: 0.375rem;
}
.serie svg { width: 1rem; height: 1rem; fill: currentColor; }
.serie[hidden] { display: none; }
.gain {
  position: absolute; right: 0; top: -0.25rem; white-space: nowrap;
  font-family: var(--font-body); font-size: 0.875rem; font-weight: 700; color: var(--accent);
  animation: quiz-monte 1.1s ease-out forwards; pointer-events: none;
}
@keyframes quiz-monte { from { opacity: 0; transform: translateY(0); } 20% { opacity: 1; } to { opacity: 0; transform: translateY(-1.75rem); } }

.segments { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.375rem; margin: 0.875rem 0 1.5rem; }
.segments li { height: 0.4375rem; border-radius: 1rem; background: var(--white); border: 1px solid var(--border); }
.segments li.encours { border-color: var(--accent); background: var(--ok-bg); }
.segments li.ok { background: var(--accent); border-color: var(--accent); }
.segments li.ko { background: var(--danger); border-color: var(--danger); }

.question-num { font-size: 0.8125rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.quiz-question h2 { margin-top: 0.5rem; }

.choix-liste { margin-top: 1.75rem; display: grid; gap: 0.75rem; }
.choix {
  width: 100%; display: grid; grid-template-columns: 2.25rem 1fr 1.5rem; align-items: center; gap: 0.875rem;
  padding: 0.875rem 1rem; text-align: left; font: inherit; font-size: 1rem; line-height: 1.45; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--border); border-radius: 0.375rem; cursor: pointer;
  transition: border-color .16s ease, background .16s ease, opacity .16s ease;
}
.choix:hover:not(:disabled) { border-color: var(--accent); background: var(--white); }
.choix:disabled { cursor: default; }
.lettre {
  width: 2.25rem; height: 2.25rem; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 0.875rem; color: var(--btn); background: var(--white); border: 1.5px solid var(--border);
}
.choix .icone { width: 1.5rem; height: 1.5rem; }
.choix.juste { border-color: var(--accent); background: var(--ok-bg); }
.choix.juste .lettre { background: var(--accent); border-color: var(--accent); color: var(--white); }
.choix.faux { border-color: var(--danger); background: var(--ko-bg); }
.choix.faux .lettre { background: var(--danger); border-color: var(--danger); color: var(--white); }
.choix.eteint { opacity: .5; }
.choix.juste .icone { color: var(--accent); }
.choix.faux .icone { color: var(--danger); }
.choix.juste, .choix.faux { animation: quiz-pop .28s ease-out; }
@keyframes quiz-pop { 50% { transform: scale(1.015); } }

.retour { margin-top: 1.5rem; }
.retour-titre { font-family: var(--font-head); font-weight: 600; font-size: 1.1875rem; color: var(--ink); }
.retour-titre.ko { color: var(--danger); }
.retour-titre .pts { font-family: var(--font-body); font-size: 0.9375rem; font-weight: 700; color: var(--accent); margin-left: 0.375rem; white-space: nowrap; }
.retour strong { color: var(--ink); }
.savoir {
  margin-top: 1rem; padding: 1.125rem 1.25rem; background: var(--pale);
  border-left: 3px solid var(--accent); border-radius: 0 0.25rem 0.25rem 0;
}
.savoir .label { margin-bottom: 0.375rem; font-size: 0.75rem; }
.savoir p { font-size: 1rem; line-height: 1.65; }
.source { display: inline-block; margin-top: 0.625rem; font-size: 0.875rem; font-weight: 600; color: var(--accent); text-decoration: underline; text-underline-offset: 0.15em; }
.source:hover { color: var(--btn-hover); }
.retour .btn-row { margin-top: 1.5rem; justify-content: flex-end; }

/* ---------- Fin de niveau / badge ---------- */
.bilan { text-align: center; }
.grandes-etoiles { display: flex; justify-content: center; gap: 0.5rem; margin: 1.5rem 0 0.5rem; }
.grandes-etoiles svg { width: 3rem; height: 3rem; }
.grandes-etoiles .on { animation: quiz-etoile .5s cubic-bezier(.3,1.6,.5,1) backwards; }
.grandes-etoiles .on:nth-child(2) { animation-delay: .25s; }
.grandes-etoiles .on:nth-child(3) { animation-delay: .5s; }
.grandes-etoiles .on:nth-child(4) { animation-delay: .75s; }
.grandes-etoiles .on:nth-child(5) { animation-delay: 1s; }
@keyframes quiz-etoile { from { transform: scale(0) rotate(-40deg); opacity: 0; } to { transform: none; opacity: 1; } }
.bilan-score { font-family: var(--font-head); font-weight: 600; font-size: 1.125rem; color: var(--ink); }
.bilan-texte { margin: 0.75rem auto 0; max-width: 32rem; }
.bilan .regle { margin-top: 0.25rem; }
.deblocage {
  display: inline-flex; align-items: center; gap: 0.625rem; margin-top: 1.5rem;
  padding: 0.625rem 1rem; background: var(--ok-bg); border: 1px solid var(--accent); border-radius: 0.375rem;
  font-weight: 600; color: var(--ink); font-size: 0.9375rem; line-height: 1.4;
}
.deblocage svg { width: 1.125rem; height: 1.125rem; flex: none; color: var(--accent); }
.deblocage.ko { background: var(--ko-bg); border-color: var(--danger); }
.deblocage.ko svg { color: var(--danger); }

.medaille {
  width: 9rem; height: 9rem; margin: 1.75rem auto 0; border-radius: 50%;
  background: var(--white); box-shadow: var(--shadow-medallion); display: grid; place-items: center;
  animation: quiz-etoile .6s cubic-bezier(.3,1.6,.5,1) backwards;
}
.medaille svg { width: 8rem; height: 8rem; }
.badge-nom { margin-top: 1.25rem; }
.recap { margin: 1.75rem auto 0; max-width: 26rem; display: grid; gap: 0.5rem; text-align: left; }
.recap li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.625rem 1rem; background: var(--pale); border-radius: 0.25rem; font-size: 0.9375rem; line-height: 1.5; }
.recap .station-etat svg { width: 1rem; height: 1rem; }

/* Actions du jeu : de simples liens, pour ne pas concurrencer les boutons du bas. */
.actions-jeu { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 1.75rem; margin-top: 1rem; }
.bilan-score + .actions-jeu { margin-top: 0.5rem; }
.lien-action {
  display: inline-flex; align-items: center; gap: 0.4375rem; min-height: 2.75rem; padding: 0 0.25rem;
  background: none; border: 0; cursor: pointer;
  font-family: var(--font-body); font-size: 0.9375rem; font-weight: 600; color: var(--accent);
  text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 1px;
}
.lien-action:hover { color: var(--btn-hover); text-decoration-thickness: 2px; }
.lien-action svg { width: 1.0625rem; height: 1.0625rem; flex: none; }
.share-msg { font-size: 0.875rem; color: var(--mute); }
.share-msg:empty { display: none; }
.suite-site { margin-top: 1.5rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.suite-site .bilan-texte { margin-top: 0; }
.suite-site .btn-row { margin-top: 1.5rem; }

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

@media (max-width: 40rem) {
  .quiz-card { padding: 1.75rem 1.25rem 1.5rem; }
  .quiz .btn { width: 100%; line-height: 1.3; padding-top: 0.875rem; padding-bottom: 0.875rem; }
  .grandes-etoiles svg { width: 2.5rem; height: 2.5rem; }
  .hud { flex-wrap: nowrap; }
  .hud-niveau span { display: none; }
  /* Étoiles sous le texte plutôt qu'à droite : cinq étoiles écrasaient le titre. */
  .station-btn { grid-template-columns: 2.5rem 1fr; gap: 0.375rem 0.875rem; padding: 1rem; }
  .station-etat { grid-column: 2; }
  .station-etat:empty { display: none; }
  .station-btn:disabled { grid-template-columns: 2.5rem 1fr auto; }
  .station-btn:disabled .station-etat { grid-column: auto; }
  .pastille { width: 2.5rem; height: 2.5rem; font-size: 1.125rem; }
  .station + .station::before { left: calc(2.25rem - 1px); }
  .station-etat svg { width: 0.9375rem; height: 0.9375rem; }
  .actions-jeu { flex-direction: column; align-items: center; gap: 0; }
}
