/* Plateau du quiz : commun au solo, au quiz du jour et au multijoueur.
   L'habillage général (body, #app, boutons, overlay, footer) vient de
   fichiers-partages-des-jeux/css/jeu.css ; ne redéfinir ici aucune de ses classes.

   Règle de mise en page : sur un téléphone, la question et ses quatre réponses doivent
   tenir à l'écran sans défiler, en portrait comme en paysage. Tout ce qui est au-dessus
   du plateau (bandeau, titre) se tasse donc dès que la hauteur manque. */

/* L'attribut hidden doit toujours l'emporter : .btn et les grilles posent un display. */
[hidden] {
  display: none !important;
}

/* --- En-tête de page compact ------------------------------------------------ */
.qz-tete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 6px;
}

.qz-tete h1 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.2;
  text-align: center;
  flex: 1;
}

.qz-tete .back-link {
  flex: 0 0 auto;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.qz-outils {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
  min-width: 40px;
  justify-content: flex-end;
}

.qz-outil {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-forte);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--texte);
  font-size: 1rem;
  cursor: pointer;
}

.qz-outil:hover {
  border-color: var(--color-light);
}

.qz-resume {
  margin: 0 0 12px;
  font-size: 0.8rem;
  color: var(--texte-doux);
  text-align: center;
}

.qz-message {
  margin: 28px 0;
  color: var(--texte-doux);
  text-align: center;
  line-height: 1.6;
}

.qz-message a {
  color: var(--color-light);
}

.qz-champ {
  width: 100%;
  max-width: 320px;
  padding: 12px 14px;
  border: 1px solid var(--line-forte);
  border-radius: 6px;
  background: var(--surface-0);
  color: var(--texte);
  font: inherit;
  font-size: 1rem;
}

.qz-champ:focus {
  outline: 2px solid var(--color-light);
  outline-offset: 1px;
}

/* --- Barre d'état ----------------------------------------------------------- */
.qz-barre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.qz-rang {
  color: var(--color-light);
}

.qz-score {
  color: #7ee29b;
  margin-left: auto;
}

.qz-serie {
  color: #f0b45a;
}

.qz-vies {
  letter-spacing: 1px;
}

.qz-chrono {
  color: var(--texte);
  min-width: 3.2em;
  text-align: center;
}

.qz-chrono.qz-presse {
  color: #ff8f8f;
}

.qz-jauge {
  height: 6px;
  margin: 6px 0 14px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}

.qz-jauge-barre {
  width: 100%;
  height: 100%;
  background: var(--color-mid);
  transform-origin: left center;
  will-change: transform;
}

.qz-jauge-barre.qz-presse {
  background: #e06c6c;
}

/* --- Question --------------------------------------------------------------- */
.qz-theme {
  margin: 12px 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--color-light);
  text-align: center;
}

.qz-question {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--texte);
  text-align: center;
  outline: none;
}

/* --- Réponses ---------------------------------------------------------------
   Cinq états à distinguer d'un coup d'œil, sans se fier à la couleur seule (une marque
   ✓ ou ✗ les double) : libre, choisie en attente du verdict, juste, fausse, et la bonne
   réponse montrée après une erreur. Fonds opaques : deux voiles transparents sur un
   fond sombre donnent presque la même teinte. */
.qz-reponses {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.qz-reponse {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid var(--line-forte);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--texte);
  font: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s, transform 0.08s;
}

.qz-reponse:hover:not(:disabled) {
  border-color: var(--color-light);
  background: color-mix(in srgb, var(--color-light) 12%, var(--surface-2));
}

.qz-reponse:active:not(:disabled) {
  transform: scale(0.985);
}

.qz-reponse:focus-visible {
  outline: 2px solid var(--color-light);
  outline-offset: 2px;
}

.qz-reponse:disabled {
  cursor: default;
}

.qz-lettre {
  flex: 0 0 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-0);
  border: 1px solid var(--line-forte);
  color: var(--color-light);
  font-size: 0.8rem;
  font-weight: 800;
}

.qz-texte {
  flex: 1;
  overflow-wrap: anywhere;
}

.qz-marque {
  flex: 0 0 auto;
  font-size: 1.15rem;
  font-weight: 800;
}

.qz-reponse.qz-choisie {
  border-color: var(--color-light);
  background: color-mix(in srgb, var(--color-light) 20%, var(--surface-2));
}

.qz-reponse.qz-juste {
  background: #17603a;
  border-color: #3fbf78;
  color: #eafff1;
  animation: qz-pop 0.28s ease;
}

.qz-reponse.qz-fausse {
  background: #7a2530;
  border-color: #e0596b;
  color: #ffecec;
  animation: qz-secousse 0.3s ease;
}

.qz-reponse.qz-montree {
  background: var(--surface-2);
  border: 2px solid #3fbf78;
  color: #8ff0b1;
}

.qz-reponse.qz-eteinte,
.qz-reponse.qz-ecartee {
  opacity: 0.4;
}

.qz-reponse.qz-ecartee .qz-texte {
  text-decoration: line-through;
}

.qz-reponse.qz-lecture {
  cursor: default;
}

@keyframes qz-pop {
  50% { transform: scale(1.03); }
}

@keyframes qz-secousse {
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* --- Jokers ----------------------------------------------------------------- */
.qz-jokers {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

.qz-joker {
  min-height: 40px;
  padding: 6px 16px;
  border: 1px dashed var(--color-mid);
  border-radius: 20px;
  background: transparent;
  color: var(--color-light);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.qz-joker:hover:not(:disabled) {
  background: color-mix(in srgb, var(--color-light) 14%, transparent);
}

.qz-joker:disabled {
  opacity: 0.35;
  cursor: default;
  border-style: solid;
}

.qz-attente {
  margin: 12px 0 0;
  font-size: 0.9rem;
  color: var(--texte-doux);
  text-align: center;
}

/* --- Correction ------------------------------------------------------------- */
.qz-correction {
  margin-top: 12px;
  text-align: center;
}

.qz-verdict {
  margin: 0 0 8px;
  font-weight: 800;
  font-size: 1rem;
}

.qz-verdict-bonne { color: #7ee29b; }
.qz-verdict-fausse { color: #ff9a9a; }
.qz-verdict-temps { color: #f0b45a; }
.qz-verdict-neutre { color: var(--texte-doux); }

.qz-anecdote {
  margin: 0 0 12px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--color-mid);
  border-radius: 4px;
  color: var(--texte);
  font-size: 0.92rem;
  line-height: 1.5;
  text-align: left;
}

.qz-apres .btn {
  min-height: 46px;
  min-width: 220px;
}

.qz-signaler-lien {
  display: inline-block;
  margin-top: 10px;
  min-height: 32px;
  padding: 4px 8px;
  border: 0;
  background: none;
  color: var(--texte-faible);
  font: inherit;
  font-size: 0.78rem;
  text-decoration: underline;
  cursor: pointer;
}

.qz-signaler-lien:hover {
  color: var(--texte-doux);
}

.qz-signaler {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.85rem;
}

.qz-signaler-label {
  flex: 1 0 100%;
  color: var(--texte-doux);
}

.qz-signaler-motif,
.qz-signaler-texte {
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid var(--line-forte);
  border-radius: 6px;
  background: var(--surface-0);
  color: var(--texte);
  font: inherit;
  font-size: 0.85rem;
}

.qz-signaler-texte {
  flex: 1 1 180px;
}

.qz-signaler-retour {
  flex: 1 0 100%;
  margin: 0;
  color: var(--texte-doux);
}

/* --- Écran de fin ----------------------------------------------------------- */
.overlay-box.qz-fin {
  position: relative;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.qz-fermer {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 40px;
  height: 40px;
  border: 0;
  background: none;
  color: var(--texte-doux);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.qz-fermer:hover {
  color: var(--texte);
}

.qz-fin-bien { color: #7ee29b; }
.qz-fin-moyen { color: #f0b45a; }
.qz-fin-neutre { color: var(--texte); }

.qz-fin-score {
  margin: 8px 0 4px;
  font-size: 2rem;
  font-weight: 800;
  color: var(--texte);
}

.qz-fin-detail {
  margin: 0 0 10px;
  color: var(--texte-doux);
  font-size: 0.92rem;
}

.qz-fin-rang {
  margin: 0 0 6px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 0.92rem;
  line-height: 1.45;
}

.qz-fin-lien {
  display: inline-block;
  margin: 2px 0 12px;
  padding: 6px 4px;
  color: var(--color-light);
  font-weight: 700;
  font-size: 0.9rem;
}

.cta-score-msg {
  font-size: 0.88rem;
  color: var(--texte-doux);
  margin: 4px 0 10px;
}

.cta-auth-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 12px;
}

.qz-fin-revue {
  margin: 10px 0;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.qz-fin-revue summary {
  padding: 12px 14px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--texte);
  cursor: pointer;
}

.qz-revue {
  margin: 0;
  padding: 0 12px 12px;
  list-style: none;
}

.qz-revue-item {
  padding: 10px 0 10px 10px;
  border-top: 1px solid var(--line);
  border-left: 3px solid #3fbf78;
  font-size: 0.86rem;
  line-height: 1.45;
}

.qz-revue-item.qz-revue-ko {
  border-left-color: #e0596b;
}

.qz-revue-item p {
  margin: 0 0 3px;
}

.qz-revue-question {
  font-weight: 700;
  color: var(--texte);
}

.qz-revue-num {
  color: var(--texte-faible);
}

.qz-revue-bonne { color: #8ff0b1; }
.qz-revue-choix { color: #ff9a9a; }
.qz-revue-anecdote { color: var(--texte-doux); }

.qz-rouvrir-fin {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 50;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
}

.qz-confetti {
  position: fixed;
  top: -20px;
  z-index: 300;
  pointer-events: none;
  font-size: 1.2rem;
  animation: qz-chute 3s ease-in forwards;
}

@keyframes qz-chute {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .qz-reponse.qz-juste,
  .qz-reponse.qz-fausse { animation: none; }
}

/* Sur un écran étroit, la barre de compte (fixée en haut à droite) recouvrirait la croix
   de fermeture : la boîte de fin commence sous elle. */
@media (max-width: 760px) {
  .overlay-box.qz-fin {
    margin-top: 52px;
    max-height: calc(100vh - 64px);
    max-height: calc(100dvh - 64px);
  }
}

/* --- Écrans étroits : une réponse par ligne --------------------------------- */
@media (max-width: 560px) {
  .qz-reponses { grid-template-columns: 1fr; gap: 8px; }
  .qz-reponse { min-height: 50px; padding: 8px 10px; }
  .qz-question { font-size: 1.08rem; margin-bottom: 12px; }
  .qz-tete h1 { font-size: 1rem; }
  .qz-apres .btn { width: 100%; }
}

/* --- Écrans bas : on tasse tout ce qui précède le plateau --------------------
   Téléphone en portrait de petite taille (640 px de haut) ou tenu en paysage. */
@media (max-height: 700px) {
  .qz-page-jeu .banner-deco { display: none; }
  .qz-page-jeu .jeu-banner { padding-top: 8px; padding-bottom: 8px; margin-bottom: 8px; }
  .qz-resume { margin-bottom: 8px; }
  .qz-jauge { margin-bottom: 8px; }
  .qz-theme { margin-top: 6px; }
}

@media (max-height: 520px) {
  .qz-page-jeu .jeu-banner { display: none; }
  .qz-page-jeu .qz-resume { display: none; }
  .qz-tete { margin-bottom: 4px; }
  .qz-tete h1 { font-size: 0.95rem; }
  .qz-barre { padding: 5px 10px; font-size: 0.88rem; }
  .qz-jauge { margin: 4px 0 6px; }
  .qz-theme { margin: 4px 0 2px; font-size: 0.7rem; }
  .qz-question { font-size: 1rem; margin-bottom: 8px; line-height: 1.3; }
  .qz-reponse { min-height: 44px; padding: 6px 10px; font-size: 0.9rem; }
  .qz-lettre { flex-basis: 24px; height: 24px; }
}

/* En paysage, deux colonnes de réponses même sur un téléphone */
@media (max-height: 520px) and (min-width: 480px) {
  .qz-reponses { grid-template-columns: 1fr 1fr; }
}
