:root {
  --c-red: #e21b3c;
  --c-blue: #1368ce;
  /* Jaune assombri : meilleur contraste du texte blanc (WCAG AA grand texte). */
  --c-yellow: #b8860b;
  --c-green: #26890c;
  --c-purple: #00143a;
  --c-purple-dark: #000a1f;
  --c-bg: #002a5c;
  --radius: 14px;
  --shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* Supprime le flash gris au tap sur les zones interactives (Android/iOS). */
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  /* Empêche le pull-to-refresh / rebond accidentel pendant le quiz. */
  overscroll-behavior: none;
}

/* Le dégradé est aussi posé sur <html>, fixé au viewport : il couvre les
   encoches/safe-areas et le rebond de scroll sur mobile (plus de bandes
   blanches en haut/bas). On garde un background-color SOLIDE : iOS remplit
   les safe-areas avec la couleur de fond, pas avec un dégradé. */
html {
  background-color: #002a5c;
  background-image: linear-gradient(160deg, #002a5c 0%, #00143a 100%);
  background-attachment: fixed;
}

body {
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(160deg, #002a5c 0%, #00143a 100%);
  color: #fff;
  /* dvh : tient compte de la barre d'adresse mobile (fallback vh au-dessus). */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  /* Réponses ultra-réactives : pas de délai de 300 ms ni de double-tap zoom. */
  touch-action: manipulation;
}

.wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

.brand-logo {
  width: clamp(96px, 22vw, 160px);
  height: auto;
  margin-bottom: 14px;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
}

h1 {
  font-size: clamp(28px, 6vw, 56px);
  font-weight: 800;
  letter-spacing: -1px;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
}

.subtitle {
  opacity: 0.9;
  margin-top: 8px;
  font-size: clamp(14px, 2.5vw, 20px);
}

.card {
  background: #fff;
  color: #333;
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 460px;
  margin-top: 28px;
}

input[type='text'],
input[type='number'] {
  width: 100%;
  padding: 16px;
  font-size: 20px;
  text-align: center;
  border: 3px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 14px;
  font-weight: 600;
  outline: none;
}

input:focus {
  border-color: var(--c-purple);
}

.btn {
  display: inline-block;
  width: 100%;
  padding: 16px;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  background: var(--c-purple);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.06s ease, filter 0.1s ease;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.dark {
  background: #1f2937;
}

.btn.green {
  background: var(--c-green);
}

.btn.ghost {
  background: transparent;
  border: 2px solid #fff;
  box-shadow: none;
}

.error {
  color: var(--c-red);
  font-weight: 700;
  min-height: 22px;
  margin-bottom: 8px;
}

.hidden {
  display: none !important;
}

/* PIN affichage animateur */
.pin-box {
  background: #fff;
  color: #333;
  border-radius: var(--radius);
  padding: 14px 28px;
  display: inline-block;
  margin: 16px 0;
}

.pin-box .label {
  font-size: 16px;
  font-weight: 600;
  opacity: 0.7;
}

.pin-box .pin {
  font-size: clamp(40px, 10vw, 84px);
  font-weight: 900;
  letter-spacing: 6px;
  color: var(--c-purple);
}

/* Lobby joueurs */
.players-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

.player-chip {
  background: #fff;
  color: var(--c-purple);
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 18px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
  animation: pop 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 3px solid transparent;
}

.player-chip.offline {
  opacity: 0.45;
  filter: grayscale(0.6);
}

.player-chip .chip-avatar {
  font-size: 22px;
  line-height: 1;
}

.row-avatar {
  margin-right: 10px;
  font-size: 22px;
}

.podium-avatar {
  font-size: 34px;
  margin-bottom: 2px;
}

@keyframes pop {
  from {
    transform: scale(0.5);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.counter {
  font-size: 22px;
  font-weight: 800;
  margin-top: 10px;
}

/* Question (animateur) */
.q-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 10px;
  font-weight: 700;
}

.q-text {
  background: #fff;
  color: #1f2937;
  border-radius: var(--radius);
  padding: 28px;
  font-size: clamp(20px, 3.4vw, 36px);
  font-weight: 800;
  width: 100%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.timer {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--c-purple-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 900;
  flex-shrink: 0;
}

.answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  width: 100%;
  margin-top: 18px;
}

.answer {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px;
  border-radius: var(--radius);
  font-size: clamp(16px, 2.4vw, 24px);
  font-weight: 700;
  color: #fff;
  text-align: left;
  border: none;
  cursor: default;
  box-shadow: var(--shadow);
  position: relative;
  transition: opacity 0.3s ease, transform 0.2s ease;
}

.answer .shape {
  font-size: 26px;
  flex-shrink: 0;
}

.answer .count {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 16px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 20px;
  padding: 2px 10px;
}

.a0,
.c-red {
  background: var(--c-red);
}
.a1,
.c-blue {
  background: var(--c-blue);
}
.a2,
.c-yellow {
  background: var(--c-yellow);
}
.a3,
.c-green {
  background: var(--c-green);
}

.answer.dim {
  opacity: 0.35;
}

.answer.correct {
  outline: 5px solid #fff;
  transform: scale(1.03);
}

.answer.correct::after {
  content: '✓';
  position: absolute;
  right: 16px;
  font-size: 30px;
  font-weight: 900;
}

/* Boutons réponse joueur (plein écran tactile) */
.play-answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  flex: 1;
  min-height: 60vh;
  min-height: 60dvh;
}

.play-answers button {
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  color: #fff;
  font-size: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: transform 0.06s ease, opacity 0.2s ease;
}

.play-answers button:active {
  transform: scale(0.97);
}

.play-answers button:disabled {
  opacity: 0.4;
}

/* Scoreboard */
.scoreboard {
  width: 100%;
  max-width: 560px;
  margin: 20px auto 0;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 14px 20px;
  margin-bottom: 10px;
  font-size: 20px;
  font-weight: 700;
}

.score-row .rank {
  background: #fff;
  color: var(--c-purple);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 14px;
}

.score-row .pts {
  font-weight: 900;
}

/* Podium */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  margin: 30px 0;
  width: 100%;
}

.podium .col {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px 12px 0 0;
  padding: 16px 14px;
  width: 30%;
  max-width: 160px;
  text-align: center;
}

.podium .name {
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 6px;
  word-break: break-word;
}

.podium .pts {
  font-size: 22px;
  font-weight: 900;
}

.podium .medal {
  font-size: 40px;
}

.podium .p1 {
  height: 220px;
  background: linear-gradient(180deg, #ffd700, #d4a800);
  color: #3a2c00;
}
.podium .p2 {
  height: 170px;
  background: linear-gradient(180deg, #d8d8d8, #a8a8a8);
  color: #2c2c2c;
}
.podium .p3 {
  height: 130px;
  background: linear-gradient(180deg, #cd7f32, #a05a1f);
  color: #2c1500;
}

/* Résultat joueur */
.result-big {
  font-size: clamp(40px, 12vw, 90px);
  font-weight: 900;
  margin: 10px 0;
}

.result-good {
  background: var(--c-green);
}
.result-bad {
  background: var(--c-red);
}
.result-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  border-radius: var(--radius);
  padding: 30px;
}

.modules-list {
  text-align: left;
  margin: 10px 0 18px;
}

.module-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f3f0fb;
  margin-bottom: 8px;
  cursor: pointer;
  font-weight: 600;
  color: #333;
}

.module-opt input {
  width: 20px;
  height: 20px;
}

.module-opt .meta {
  margin-left: auto;
  font-size: 14px;
  opacity: 0.6;
}

.options-title {
  text-align: left;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #888;
  margin: 0 0 10px;
  padding-top: 18px;
  border-top: 1px solid #e7e2f0;
}

.options-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 18px;
}

label.switch {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  color: #333;
  font-weight: 600;
  cursor: pointer;
  padding: 11px 14px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e7e2f0;
  line-height: 1.3;
  transition: border-color 0.15s ease, background 0.15s ease;
}

label.switch:hover {
  background: #faf9fd;
  border-color: #d6cde8;
}

label.switch input {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin: 0;
}

label.switch em {
  font-style: normal;
  opacity: 0.6;
  font-weight: 600;
}

/* Sélecteur d'avatar (écran « Rejoindre ») */
.avatar-pick-label {
  text-align: left;
  font-weight: 700;
  font-size: 14px;
  color: #555;
  margin: 4px 0 10px;
}

.avatar-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 18px;
  max-height: 184px;
  overflow-y: auto;
  padding: 2px;
}

.avatar-opt {
  aspect-ratio: 1 / 1;
  border: 2px solid #e7e2f0;
  background: #f7f5fc;
  border-radius: 12px;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.1s ease, border-color 0.12s ease, background 0.12s ease;
}

.avatar-opt:hover {
  border-color: #c9bce6;
}

.avatar-opt.selected {
  border-color: var(--c-blue);
  background: #e7f0fd;
  transform: scale(1.08);
  box-shadow: 0 2px 8px rgba(19, 104, 206, 0.25);
}

.avatar-opt.taken {
  opacity: 0.32;
  filter: grayscale(0.7);
  cursor: not-allowed;
}

@media (max-width: 380px) {
  .avatar-picker {
    grid-template-columns: repeat(5, 1fr);
  }
}

footer {
  text-align: center;
  padding: 14px;
  opacity: 0.7;
  font-size: 13px;
}

.waiting {
  font-size: 24px;
  font-weight: 700;
  margin-top: 30px;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

.timerbar {
  height: 12px;
  width: 100%;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 16px;
}

.timerbar > div {
  height: 100%;
  background: #fff;
  width: 100%;
  transition: width 0.2s linear;
}

/* Lobby : PIN + QR côte à côte */
.lobby-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
}

.qr-box {
  background: #fff;
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.qr-box canvas {
  display: block;
  border-radius: 6px;
}

.qr-label {
  color: var(--c-purple);
  font-weight: 700;
  font-size: 14px;
}

/* Bouton son flottant */
.sound-toggle {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  right: calc(14px + env(safe-area-inset-right));
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.06s ease;
}

.sound-toggle:hover {
  background: rgba(0, 0, 0, 0.4);
}

.sound-toggle:active {
  transform: scale(0.92);
}

/* Bouton « Classement » flottant, à gauche du bouton son */
.scoreboard-btn {
  right: calc(72px + env(safe-area-inset-right));
}

/* Bouton « Terminer la partie » flottant, en haut à gauche */
.end-game-btn {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  left: calc(14px + env(safe-area-inset-left));
  height: 48px;
  padding: 0 18px;
  border-radius: 24px;
  border: none;
  background: rgba(226, 27, 60, 0.85);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  box-shadow: 0 4px 14px rgba(226, 27, 60, 0.4);
  transition: background 0.15s ease, transform 0.06s ease;
}

.end-game-btn:hover {
  background: #e21b3c;
}

.end-game-btn:active {
  transform: scale(0.94);
}

/* Overlay du classement à la demande */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 10, 31, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  backdrop-filter: blur(3px);
}

.overlay-card {
  background: linear-gradient(160deg, #002a5c 0%, #00143a 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.overlay-card h2 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
}

.overlay-card .btn {
  margin-top: 20px;
}

/* Bandeau de (re)connexion (joueur) */
.net-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  background: var(--c-yellow);
  color: #1f1500;
  font-weight: 800;
  text-align: center;
  padding: 10px 14px;
  font-size: 15px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Contrôles animateur sous la question (pause / révéler) */
.host-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 18px;
  width: 100%;
  max-width: 520px;
}

.host-controls .btn {
  width: auto;
  flex: 1;
  padding: 12px 16px;
  font-size: 16px;
}

#questionView.is-paused .timerbar > div {
  opacity: 0.5;
}

/* Joueur le plus rapide (révélation animateur) */
.fastest {
  font-size: clamp(16px, 2.4vw, 22px);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 30px;
  padding: 8px 18px;
  margin: 6px auto 0;
  display: inline-block;
}

/* Overlay « En pause » côté joueur */
.paused-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 10, 31, 0.82);
  border-radius: var(--radius);
  z-index: 50;
}

.paused-card {
  font-size: clamp(28px, 8vw, 56px);
  font-weight: 900;
  text-align: center;
  line-height: 1.2;
}

/* ==========================================================================
   ANIMATIONS PREMIUM — vue animateur (grand écran) uniquement (body.host)
   ========================================================================== */

/* Fond vivant : deux halos colorés qui dérivent lentement derrière le contenu. */
body.host {
  position: relative;
  overflow-x: hidden;
}

body.host::before,
body.host::after {
  content: '';
  position: fixed;
  z-index: 0;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.45;
  pointer-events: none;
}

body.host::before {
  width: 46vw;
  height: 46vw;
  top: -12vw;
  left: -10vw;
  background: radial-gradient(circle, #1368ce 0%, transparent 70%);
  animation: orbDrift 22s ease-in-out infinite;
}

body.host::after {
  width: 40vw;
  height: 40vw;
  bottom: -14vw;
  right: -8vw;
  background: radial-gradient(circle, #00a3ff 0%, transparent 70%);
  animation: orbDrift 28s ease-in-out infinite reverse;
}

@keyframes orbDrift {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(6vw, 4vw) scale(1.12);
  }
  66% {
    transform: translate(-4vw, 7vw) scale(0.95);
  }
}

/* Le contenu passe au-dessus des halos. */
body.host .wrap,
body.host footer {
  position: relative;
  z-index: 1;
}

/* Transition d'entrée à chaque changement d'écran. */
body.host section:not(.hidden) {
  animation: sectionIn 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes sectionIn {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Logo qui flotte + halo doux. */
body.host .brand-logo {
  animation: floaty 5s ease-in-out infinite;
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Titres : léger fondu montant. */
body.host h1 {
  animation: riseIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Carte de configuration : modules en cascade. */
body.host .module-opt {
  animation: riseIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
body.host .module-opt:nth-child(1) {
  animation-delay: 0.05s;
}
body.host .module-opt:nth-child(2) {
  animation-delay: 0.12s;
}
body.host .module-opt:nth-child(3) {
  animation-delay: 0.19s;
}
body.host .module-opt:nth-child(4) {
  animation-delay: 0.26s;
}
body.host .module-opt:nth-child(5) {
  animation-delay: 0.33s;
}
body.host .module-opt:hover {
  transform: translateX(3px);
  transition: transform 0.15s ease;
}

/* PIN : respiration lumineuse pour attirer l'œil dans le lobby. */
body.host .pin-box .pin {
  animation: pinGlow 2.6s ease-in-out infinite;
}

@keyframes pinGlow {
  0%,
  100% {
    text-shadow: 0 0 0 rgba(19, 104, 206, 0);
    transform: scale(1);
  }
  50% {
    text-shadow: 0 0 26px rgba(19, 104, 206, 0.55);
    transform: scale(1.015);
  }
}

/* QR : apparition douce. */
body.host .qr-box {
  animation: pop 0.5s ease both;
}

/* Question : la carte texte glisse, les réponses arrivent en cascade. */
body.host .q-text {
  animation: riseIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

body.host .answers .answer {
  animation: answerIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
body.host .answers .answer:nth-child(1) {
  animation-delay: 0.08s;
}
body.host .answers .answer:nth-child(2) {
  animation-delay: 0.16s;
}
body.host .answers .answer:nth-child(3) {
  animation-delay: 0.24s;
}
body.host .answers .answer:nth-child(4) {
  animation-delay: 0.32s;
}

@keyframes answerIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* La forme (▲◆●■) tressaute joyeusement à l'arrivée. */
body.host .answer .shape {
  display: inline-block;
  animation: shapePop 0.6s 0.3s ease both;
}

@keyframes shapePop {
  0% {
    transform: scale(0) rotate(-30deg);
  }
  60% {
    transform: scale(1.25) rotate(8deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

/* Barre de temps : dégradé + reflet qui balaie. */
body.host .timerbar {
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

body.host .timerbar > div {
  background: linear-gradient(90deg, #00d4ff, #1368ce);
  position: relative;
  overflow: hidden;
}

body.host .timerbar > div::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 30%,
    rgba(255, 255, 255, 0.55) 50%,
    transparent 70%
  );
  transform: translateX(-100%);
  animation: shimmer 1.8s linear infinite;
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

/* Derniers instants : la barre vire au rouge et pulse. */
body.host .timerbar.low > div {
  background: linear-gradient(90deg, #ff5a5f, #e21b3c);
}
body.host .timerbar.low {
  animation: urgentPulse 0.7s ease-in-out infinite;
}

@keyframes urgentPulse {
  0%,
  100% {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 0 rgba(226, 27, 60, 0);
  }
  50% {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 18px rgba(226, 27, 60, 0.7);
  }
}

/* Révélation : la bonne réponse explose en douceur et brille. */
body.host .answer.correct {
  animation: correctCelebrate 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes correctCelebrate {
  0% {
    transform: scale(1);
    box-shadow: var(--shadow);
  }
  45% {
    transform: scale(1.12);
    box-shadow: 0 0 36px rgba(255, 255, 255, 0.8);
  }
  100% {
    transform: scale(1.03);
    box-shadow: 0 0 22px rgba(255, 255, 255, 0.55);
  }
}

/* Le ✓ qui tombe en place. */
body.host .answer.correct::after {
  animation: checkPop 0.45s 0.2s cubic-bezier(0.16, 1.6, 0.3, 1) both;
}

@keyframes checkPop {
  from {
    transform: scale(0) rotate(-25deg);
    opacity: 0;
  }
  to {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

/* Joueur le plus rapide : entrée éclatante. */
body.host .fastest:not(.hidden) {
  animation: pop 0.5s ease both;
}

/* Scoreboard : chaque ligne glisse depuis la gauche, en cascade. */
body.host .scoreboard .score-row {
  animation: rowSlide 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}
body.host .scoreboard .score-row:nth-child(1) {
  animation-delay: 0.05s;
}
body.host .scoreboard .score-row:nth-child(2) {
  animation-delay: 0.12s;
}
body.host .scoreboard .score-row:nth-child(3) {
  animation-delay: 0.19s;
}
body.host .scoreboard .score-row:nth-child(4) {
  animation-delay: 0.26s;
}
body.host .scoreboard .score-row:nth-child(5) {
  animation-delay: 0.33s;
}
body.host .scoreboard .score-row:nth-child(n + 6) {
  animation-delay: 0.4s;
}

@keyframes rowSlide {
  from {
    opacity: 0;
    transform: translateX(-26px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Podium : les colonnes montent du sol, les médailles rebondissent. */
body.host .podium .col {
  transform-origin: bottom center;
  animation: podiumRise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}
/* L'ordre du DOM est 2e, 1er, 3e → on révèle 3e, 2e, 1er pour le suspense. */
body.host .podium .col:nth-child(3) {
  animation-delay: 0.1s;
}
body.host .podium .col:nth-child(1) {
  animation-delay: 0.45s;
}
body.host .podium .col:nth-child(2) {
  animation-delay: 0.85s;
}

@keyframes podiumRise {
  from {
    opacity: 0;
    transform: scaleY(0.2) translateY(40px);
  }
  60% {
    opacity: 1;
  }
  to {
    opacity: 1;
    transform: none;
  }
}

body.host .podium .medal {
  display: inline-block;
  animation: medalBounce 0.6s 0.9s cubic-bezier(0.16, 1.7, 0.3, 1) both;
}

@keyframes medalBounce {
  0% {
    transform: scale(0) rotate(-40deg);
  }
  60% {
    transform: scale(1.35) rotate(12deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

/* Boutons : reflet qui passe au survol. */
body.host .btn {
  position: relative;
  overflow: hidden;
}

body.host .btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    100deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transform: skewX(-20deg);
  transition: left 0.5s ease;
}

body.host .btn:hover::after {
  left: 140%;
}

/* Confettis (fin de partie). Générés en JS, animés ici. */
.confetti-piece {
  position: fixed;
  top: -12px;
  z-index: 400;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  pointer-events: none;
  will-change: transform, opacity;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% {
    opacity: 1;
    transform: translateY(0) rotateZ(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(108vh) rotateZ(720deg);
  }
}

/* Respect des préférences d'accessibilité : on calme tout. */
@media (prefers-reduced-motion: reduce) {
  body.host *,
  body.host *::before,
  body.host *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
  }
  body.host::before,
  body.host::after {
    animation: none !important;
  }
}
