/* Surcouche des extraits : barres du haut et du bas, téléphone d'un étudiant (à droite ou en feuille), mode d'emploi,
   bandeau du relais, écran de fin, mode héros. L'écran du cours occupe la place qui reste (essai/surcouche.js). */
html.extrait #vp {
  top: var(--xt-haut, 44px); bottom: calc(var(--xt-bas, 60px) + var(--xt-dessous, 0px)); right: var(--xt-droite, 0px);
}

.xt-barre, .xt-nav, .xt-dock, .xt-guide, .xt-feuille, .xt-repondre { font-family: Roboto, system-ui, sans-serif; }
.xt-barre button, .xt-nav button, .xt-repondre, .xt-guide button, .xt-feuille button { font: inherit; cursor: pointer; }

/* Barre du haut */
.xt-barre {
  position: fixed; left: 0; right: 0; top: 0; z-index: 200; height: 44px;
  display: flex; align-items: center; gap: 12px; padding: 0 16px 0 20px;
  background: #1d1f28; color: #ece7da; font-weight: 500; font-size: 15px; line-height: 1.2;
}
.xt-titre { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xt-mode, .xt-qr, .xt-quitter {
  color: #ece7da; background: none; text-decoration: none; white-space: nowrap; font-weight: 600; font-size: 14.5px;
  border: 1.5px solid rgba(236, 231, 218, .35); border-radius: 999px; padding: 5px 14px;
}
.xt-mode:hover, .xt-qr:hover, .xt-quitter:hover { border-color: #ece7da; }

/* Barre du bas : Précédent, où l'on en est, Suivant */
.xt-nav {
  position: fixed; left: 0; right: var(--xt-droite, 0px); bottom: 0; z-index: 200; height: 60px;
  display: flex; align-items: center; justify-content: center; gap: 22px; padding: 0 16px;
  background: #1d1f28; color: #ece7da;
}
.xt-nav button {
  min-width: 128px; padding: 10px 22px; border-radius: 999px; font-size: 16px; font-weight: 700; line-height: 1.2;
  color: #ece7da; background: none; border: 1.5px solid rgba(236, 231, 218, .35);
}
.xt-nav .xt-suivant { color: #1d1f28; background: #f09800; border-color: #f09800; }
.xt-nav .xt-suivant:hover { background: #ffaa1a; border-color: #ffaa1a; }
.xt-nav .xt-precedent:hover { border-color: #ece7da; }
.xt-nav button:disabled { opacity: .32; cursor: default; }
.xt-ou { min-width: 132px; text-align: center; font-size: 15px; font-weight: 600; color: #a7a8b1; }

/* « Répondre » : sans téléphone à droite, quand une question est posée */
.xt-repondre {
  position: fixed; left: calc((100% - var(--xt-droite, 0px)) / 2); bottom: calc(var(--xt-bas, 60px) + 16px);
  transform: translateX(-50%); z-index: 201; padding: 15px 30px; border: 0; border-radius: 999px;
  background: #f09800; color: #1d1f28; font-size: 17px; font-weight: 800; white-space: nowrap;
  box-shadow: 0 0 0 4px rgba(29, 31, 40, .9), 0 16px 34px -12px rgba(4, 5, 10, .8);
}
.xt-repondre[hidden] { display: none; }

/* Le téléphone d'un étudiant, à droite de l'écran (grand écran à la souris) */
.xt-dock {
  position: fixed; right: 0; top: var(--xt-haut, 44px); bottom: 0; z-index: 199; width: 360px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 18px 20px 16px;
  background: #1d1f28; color: #ece7da;
}
.xt-dock-titre { font-size: 16px; font-weight: 700; }
/* Les proportions d'un vrai téléphone (390 x 844), jamais étiré sur la hauteur de la fenêtre (06/11/2026 : « démesuré
   en hauteur ») : 300 px de large au plus, moins si la fenêtre est basse ; 160 px restent pour le titre et l'aide. */
.xt-dock-ecran {
  position: relative; flex: none; aspect-ratio: 390 / 844;
  width: min(300px, calc((100vh - var(--xt-haut, 44px) - 160px) * 390 / 844));
  overflow: hidden; border-radius: 30px; background: #f7f2e2;
  box-shadow: 0 0 0 9px #0d0e13, 0 0 0 10px rgba(255, 255, 255, .08), 0 30px 60px -24px rgba(0, 0, 0, .9);
}
.xt-dock-ecran iframe { position: absolute; left: 0; top: 0; width: 390px; border: 0; transform-origin: 0 0; }
.xt-dock-aide { margin: 0; max-width: 30ch; text-align: center; font-size: 14px; line-height: 1.45; color: #a7a8b1; }
/* Sous l'écran du cours (téléphone tenu en hauteur) : la page de vote à sa vraie taille, sur toute la largeur */
.xt-dock.bas {
  left: 0; right: 0; top: auto; bottom: var(--xt-bas, 60px); width: auto; padding: 0; gap: 0;
  align-items: stretch; justify-content: flex-start; background: #f7f2e2;
}
.xt-dock.bas .xt-dock-titre { padding: 7px 16px; background: #1d1f28; color: #ece7da; font-size: 14px; text-align: center; }
.xt-dock.bas .xt-dock-ecran { flex: 1; min-height: 0; width: auto; aspect-ratio: auto; border-radius: 0; box-shadow: none; }
.xt-dock.bas .xt-dock-ecran iframe { inset: 0; width: 100%; height: 100%; transform: none; }
.xt-dock.bas .xt-dock-aide { display: none; }

/* La feuille du téléphone d'un étudiant (écran tactile ou étroit) */
dialog.xt-feuille {
  width: min(100%, 520px); max-width: 100%; height: min(84vh, 780px); max-height: 100%; margin: auto auto 0;
  padding: 0; border: 0; border-radius: 18px 18px 0 0; background: #f7f2e2; overflow: hidden;
}
dialog.xt-feuille::backdrop { background: rgba(8, 9, 13, .62); }
.xt-feuille-tete {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 56px; padding: 0 12px 0 20px;
  background: #1d1f28; color: #ece7da; font-size: 16.5px;
}
.xt-feuille-fermer {
  color: #ece7da; background: none; font-size: 15px; font-weight: 650;
  border: 1.5px solid rgba(236, 231, 218, .35); border-radius: 999px; padding: 7px 16px;
}
dialog.xt-feuille iframe { display: block; width: 100%; height: calc(100% - 56px); border: 0; }

/* Mode d'emploi */
/* défilable : sur un écran bas, la carte dépasse et « Commencer » doit rester atteignable */
.xt-guide { position: fixed; inset: 0; z-index: 300; display: flex; overflow-y: auto; padding: 20px; background: rgba(12, 13, 18, .74); }
.xt-guide[hidden] { display: none; }
.xt-guide-carte {
  margin: auto; width: min(100%, 580px); padding: 32px 34px 26px; border-radius: 18px; background: #f7f2e2; color: #333644;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .9);
}
.xt-guide h2 { margin: 0 0 22px; font-size: 29px; line-height: 1.15; font-weight: 800; letter-spacing: -.01em; }
.xt-guide ol { margin: 0; padding: 0; list-style: none; counter-reset: etape; display: grid; gap: 16px; }
.xt-guide li {
  counter-increment: etape; display: grid; grid-template-columns: 34px 1fr; gap: 14px; align-items: start;
  font-size: 17.5px; line-height: 1.45; font-weight: 500;
}
.xt-guide li::before {
  content: counter(etape); display: grid; place-items: center; width: 34px; height: 34px; margin-top: -3px;
  border-radius: 50%; background: #f09800; color: #1d1f28; font-size: 17px; font-weight: 800;
}
.xt-guide-pied { margin-top: 26px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.xt-guide-duree { font-size: 15px; color: #6b6a63; }
.xt-commencer { padding: 14px 30px; border: 0; border-radius: 999px; background: #f09800; color: #1d1f28; font-size: 17px; font-weight: 800; }
.xt-commencer:hover { background: #ffaa1a; }

.xt-mode:focus-visible, .xt-qr:focus-visible, .xt-quitter:focus-visible, .xt-nav button:focus-visible,
.xt-repondre:focus-visible, .xt-commencer:focus-visible, .xt-feuille-fermer:focus-visible { outline: 2px solid #f09800; outline-offset: 3px; }
.xt-commencer:focus-visible { outline-color: #333644; }

/* Les compteurs de la salle, un peu plus gros que dans le cours : le visiteur doit voir sa réponse arriver */
html.extrait .lv-pill { font-size: 28px; padding: 8px 18px; top: -20px; }
html.extrait #dx-badge b { font-size: 40px; }
@media (pointer: coarse) {
  html.extrait .dx-mini { display: none; } /* pas de QR code à scanner sur son propre écran */
}

.xt-relais {
  position: fixed; left: 0; right: 0; top: 44px; z-index: 199; padding: 10px 20px;
  background: #f7f2e2; color: #333644; font: 500 15px/1.4 Roboto, system-ui, sans-serif;
  border-bottom: 1px solid #e2dac6;
}

@media (prefers-reduced-motion: no-preference) {
  .xt-repondre:not([hidden]) { animation: xt-appel 1.6s ease-in-out 3; }
  dialog.xt-feuille[open] { animation: xt-feuille .35s cubic-bezier(.16, 1, .3, 1); }
}
@keyframes xt-appel { 50% { box-shadow: 0 0 0 4px rgba(29, 31, 40, .9), 0 0 0 12px rgba(240, 152, 0, .35), 0 16px 34px -12px rgba(4, 5, 10, .8); } }
@keyframes xt-feuille { from { transform: translateY(40%); } }

/* Écran de fin (dans la scène de 1920 × 1080) */
.fx-fin { max-width: 1380px; }
.fx-lead { margin: 0; font-size: 46px; line-height: 1.3; font-weight: 500; color: #333644; }
.fx-btns { margin-top: 72px; display: flex; flex-wrap: wrap; gap: 28px 34px; }
.fx-btn {
  display: inline-block; padding: 24px 46px; border-radius: 999px; border: 3px solid #333644;
  font-size: 32px; font-weight: 700; color: #333644; text-decoration: none;
}
.fx-btn.fx-plein { background: #f09800; border-color: #f09800; }

/* Téléphone (06/11/2026) : l'extrait se suit à l'horizontale. Tenu en hauteur, ce message le demande, par-dessus tout,
   et disparaît dès qu'on tourne le téléphone. */
.xt-tourner { display: none; }
@media (orientation: portrait) {
  html.xt-tel .xt-tourner {
    position: fixed; inset: 0; z-index: 400; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 16px; padding: 32px 28px; background: #1d1f28; color: #ece7da; text-align: center;
  }
}
.xt-tourner b { font-size: 27px; line-height: 1.15; font-weight: 800; }
.xt-tourner p { margin: 0; max-width: 26ch; font-size: 16.5px; line-height: 1.5; color: #a7a8b1; }
.xt-tourner-retour {
  margin-top: 10px; padding: 8px 18px; border: 1.5px solid rgba(236, 231, 218, .35); border-radius: 999px;
  color: #ece7da; font-size: 15px; font-weight: 600; text-decoration: none;
}
/* le contour d'un téléphone, qui pivote à l'horizontale */
.xt-tourner-tel { width: 44px; height: 78px; margin-bottom: 10px; border: 3px solid #f09800; border-radius: 10px; }
@media (prefers-reduced-motion: no-preference) {
  .xt-tourner-tel { animation: xt-pivote 2.4s cubic-bezier(.65, 0, .35, 1) infinite; }
}
@keyframes xt-pivote { 0%, 25% { transform: rotate(0); } 55%, 100% { transform: rotate(-90deg); } }

/* Téléphone tenu à l'horizontale : ni barre ni bouton (on avance en faisant glisser l'écran, geste du moteur) ;
   l'écran du cours prend toute la hauteur, le téléphone d'un étudiant est à droite, et dessous, en petit, où l'on en
   est, le mode d'emploi et la sortie. */
html.xt-paysage .xt-barre, html.xt-paysage .xt-nav, html.xt-paysage .xt-repondre { display: none !important; }
html.xt-paysage .xt-dock { top: 0; width: clamp(220px, 34vw, 320px); padding: 8px 10px; gap: 6px; justify-content: flex-start; }
html.xt-paysage .xt-dock-titre { font-size: 12.5px; }
html.xt-paysage .xt-dock-ecran {
  flex: 1; min-height: 0; width: 100%; aspect-ratio: auto; border-radius: 14px;
  box-shadow: 0 0 0 4px #0d0e13, 0 0 0 5px rgba(255, 255, 255, .08);
}
html.xt-paysage .xt-dock-aide { display: none; }
.xt-dock-pied { display: none; }
html.xt-paysage .xt-dock-pied { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; }
.xt-ou-pied { font-size: 12px; font-weight: 600; color: #a7a8b1; white-space: nowrap; }
.xt-dock-pied .xt-mode, .xt-dock-pied .xt-quitter { padding: 3px 9px; font-size: 12px; }

/* Écran bas (téléphone tenu en largeur) : le mode d'emploi se resserre pour tenir sur l'écran */
@media (max-height: 520px) {
  .xt-guide { padding: 10px; }
  .xt-guide-carte { padding: 16px 22px 14px; }
  .xt-guide h2 { margin-bottom: 10px; font-size: 21px; }
  .xt-guide ol { gap: 7px; }
  .xt-guide li { grid-template-columns: 28px 1fr; gap: 10px; font-size: 15px; line-height: 1.35; }
  .xt-guide li::before { width: 28px; height: 28px; margin-top: -2px; font-size: 15px; }
  .xt-guide-pied { margin-top: 12px; }
  .xt-commencer { padding: 10px 24px; font-size: 16px; }
}

@media (max-width: 720px) {
  .xt-barre { gap: 8px; padding: 0 10px 0 14px; font-size: 14px; }
  .xt-titre { display: none; }
  .xt-barre .xt-mode { margin-right: auto; }
  .xt-nav { gap: 10px; padding: 0 10px; }
  .xt-nav button { min-width: 0; padding: 10px 16px; font-size: 15px; }
  .xt-ou { min-width: 0; font-size: 14px; }
  .xt-guide-carte { padding: 24px 22px 20px; }
  .xt-guide h2 { font-size: 24px; }
  .xt-guide li { font-size: 16px; }
}

/* Mode héros : la scène seule, sans clic, dans le cadre de l'accueil */
html.heros #chrome, html.heros #toc, html.heros #help, html.heros .dx-mini,
html.heros .xt-barre, html.heros .xt-relais { display: none !important; }
html.heros #vp { pointer-events: none; }
/* Dans l'accueil, le téléphone couvre le bas droit de la scène et la carte du QR code son bas gauche :
   les résultats passent au centre, le compteur juste à gauche du téléphone. */
html.heros #dx-res { left: 50%; right: auto; margin-left: -230px; }
html.heros #dx-badge { right: 330px; }
/* L'écran de l'accueil est petit : les compteurs de la salle grossissent pour qu'on voie sa réponse arriver */
html.heros .lv-pill { font-size: 40px; padding: 10px 22px; top: -28px; }
html.heros #dx-badge b { font-size: 52px; }
html.heros #dx-badge span { font-size: 24px; }
@media (prefers-reduced-motion: no-preference) {
  html.heros .lv-pill { animation: xt-pastille .6s cubic-bezier(.2, 1.5, .4, 1) both; }
}
@keyframes xt-pastille { from { opacity: 0; transform: scale(.3); } }
