/* =====================================================================
   CIR Play — écran élève (v0.2)
   Conçu d'abord pour le téléphone : gros boutons, aucun texte superflu.
   ===================================================================== */

html, body { height: 100%; }
body { min-height: 100dvh; }

.ecran { min-height: 100dvh; }

/* ---------- Accueil : PIN et pseudo ---------- */
.ecran-accueil {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 0;
}

.accueil-carte {
  width: 100%;
  max-width: 400px;
  margin: auto 0;
  padding: 28px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: 18px;
  box-shadow: var(--ombre);
}

.accueil-logo { display: block; margin: 0 auto 8px; height: 75px; width: auto; }
.accueil-titre { margin: 0 0 22px; font-size: 2.6rem; line-height: 1; }
.accueil-titre-petit { margin: 0 0 20px; font-size: 1.5rem; font-weight: 800; color: var(--marine); }

.accueil-form { display: grid; gap: 12px; }

.champ-geant {
  height: 60px;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.12em;
}
.champ-geant::placeholder { letter-spacing: normal; font-weight: 600; color: #a2a7c2; font-size: 1.2rem; }
.champ-pseudo { letter-spacing: 0.02em; }

.accueil-pied {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  width: 100%;
  margin-top: 24px;
  padding: 14px 8px calc(14px + env(safe-area-inset-bottom));
  font-size: 0.78rem;
  color: var(--texte-doux);
}

/* ---------- En-tête de partie ---------- */
.ecran-jeu {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background-color: var(--fond);
}

.jeu-entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--marine);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}
.jeu-pseudo { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.jeu-progression { font-size: 0.8rem; font-weight: 600; opacity: .8; }
.jeu-score {
  padding: 4px 10px;
  background: rgba(255, 255, 255, .14);
  border-radius: 999px;
  white-space: nowrap;
}

.jeu-alerte {
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  color: #7a4b00;
  background: #fff3d6;
}

.jeu-contenu {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  min-height: 0;
}

/* ---------- Écrans d'attente ---------- */
.attente {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.attente-surtitre {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--orange);
}
.attente-titre { margin: 0; font-size: 1.7rem; font-weight: 800; color: var(--marine); }
.attente-pseudo {
  margin: 4px 0;
  padding: 10px 22px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--marine);
  background: var(--surface);
  border: 2px solid var(--marine);
  border-radius: 999px;
}
.attente-texte { margin: 0; max-width: 320px; color: var(--texte-doux); }
.attente .roue { margin-top: 14px; }
.attente-alerte .attente-titre { color: var(--alerte); }
.attente-info .attente-titre { color: var(--marine); }

.rang-geant {
  margin: 0;
  font-size: 4.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--marine);
}
.podium-1 .rang-geant { color: #c69214; }
.podium-2 .rang-geant { color: #7d8597; }
.podium-3 .rang-geant { color: #a8642f; }
.bravo { margin: 6px 0 0; font-weight: 700; color: var(--orange); }

.nouvelle-partie { display: flex; justify-content: center; margin-top: 28px; }

.choix-rappel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 92px; height: 92px;
  color: #fff;
  background: var(--rep);
  border-radius: 20px;
  margin-bottom: 6px;
}

/* ---------- Boutons de réponse ---------- */
.jeu-contenu-question { justify-content: stretch; padding: 10px; }

.chrono-ligne { display: flex; justify-content: center; margin-bottom: 8px; }
.chrono {
  min-width: 52px;
  padding: 4px 12px;
  font-size: 1.1rem;
  font-weight: 800;
  text-align: center;
  color: var(--marine);
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: 999px;
}

.grille-reponses {
  flex: 1;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  min-height: 0;
}
.grille-2 { grid-template-columns: 1fr 1fr; }
.grille-3 .bouton-reponse:nth-child(3) { grid-column: 1 / -1; }

.bouton-reponse {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 120px;
  padding: 12px;
  font-family: inherit;
  color: #fff;
  background: var(--rep);
  border: 0;
  border-radius: 16px;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .18);
  cursor: pointer;
  transition: transform .06s, filter .15s;
  -webkit-tap-highlight-color: transparent;
}
.bouton-reponse:active { transform: scale(.97); filter: brightness(1.08); }
.bouton-reponse:focus-visible { outline: 4px solid #ffd27a; outline-offset: 2px; }
.bouton-reponse-texte { font-size: 1.6rem; font-weight: 800; }

/* En portrait sur téléphone : boutons Vrai/Faux l'un au-dessus de l'autre */
@media (max-width: 520px) and (orientation: portrait) {
  .grille-vf { grid-template-columns: 1fr; }
}

/* ---------- Résultat de la question ---------- */
.resultat-juste { background: var(--ok); }
.resultat-faux { background: var(--erreur); }
.resultat-absent { background: #8a6d1f; }

.resultat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  color: #fff;
}
.resultat-symbole {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 96px; height: 96px;
  font-size: 3.2rem;
  font-weight: 800;
  background: rgba(255, 255, 255, .18);
  border-radius: 50%;
  animation: apparait .35s ease-out;
}
.resultat-titre { margin: 4px 0 0; font-size: 2.2rem; font-weight: 800; }
.resultat-detail {
  margin: 0;
  padding: 6px 16px;
  font-size: 1.15rem;
  font-weight: 700;
  background: rgba(0, 0, 0, .16);
  border-radius: 999px;
}
.resultat-rang { margin: 10px 0 0; font-weight: 600; opacity: .92; }

@keyframes apparait { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* =====================================================================
   v0.3 — avatars, reprise, séries, champion
   ===================================================================== */

/* Avatars : animations */
.avatar { display: block; overflow: visible; }
.avatar-saute { animation: saute .45s ease-out; }
.avatar-danse { animation: danse 1.6s ease-in-out infinite; transform-origin: 50% 90%; }
.avatar-pret { animation: pret .9s ease-in-out infinite alternate; }
.avatar-champion { animation: champion 1.2s ease-out both; filter: drop-shadow(0 0 18px rgba(242, 183, 5, .65)); }
.avatar-champion .avatar-couronne { animation: couronne-tombe 1s .5s cubic-bezier(.2, 1.4, .4, 1) both; transform-origin: 60px 0; }

@keyframes saute { 0% { transform: scale(.85); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes danse { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg) translateY(-4px); } }
@keyframes pret { from { transform: translateY(0); } to { transform: translateY(-8px); } }
@keyframes champion { from { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.12); opacity: 1; } to { transform: scale(1); } }
@keyframes couronne-tombe { from { transform: translateY(-70px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Écran de reprise */
.reprise-avatar { display: flex; justify-content: center; margin-bottom: 4px; }
.reprise-texte { margin: -8px 0 18px; color: var(--texte-doux); }
.reprise-texte strong { color: var(--marine); }

/* Écran de choix d'avatar */
.ecran-avatar {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.avatar-apercu { display: flex; flex-direction: column; align-items: center; padding: 6px 0 10px; }
.avatar-grand { height: 150px; }
.avatar-pseudo {
  margin: 4px 0 0;
  padding: 6px 18px;
  font-size: 1.2rem; font-weight: 800;
  color: var(--marine);
  background: var(--surface);
  border: 2px solid var(--marine);
  border-radius: 999px;
}
.avatar-choix { flex: 1; }
.avatar-titre { margin: 12px 0 8px; font-size: .85rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--orange); }
.grille-choix { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.choix {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px 8px;
  font-family: inherit; font-size: .68rem; font-weight: 700;
  line-height: 1.15;
  color: var(--texte-doux);
  background: var(--surface);
  border: 2px solid var(--bordure);
  border-radius: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.choix span { min-height: 2.3em; display: flex; align-items: center; text-align: center; }
.choix[aria-checked="true"] { color: var(--marine); border-color: var(--orange); background: var(--orange-doux); }
.choix:active { transform: scale(.96); }
.avatar-actions { position: sticky; bottom: 0; display: grid; gap: 8px; padding-top: 14px; background: linear-gradient(transparent, var(--fond) 30%); }

/* En-tête de partie avec avatar */
.jeu-identite { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 45%; }
.jeu-avatar { flex: none; display: flex; background: #fff; border-radius: 50%; padding: 1px; }
.jeu-identite .jeu-pseudo { max-width: none; }

.lobby-avatar { margin-bottom: -4px; }
.attente #btn-changer-avatar { margin-top: 10px; }

.chrono-urgent { color: #fff; background: var(--orange); border-color: var(--orange); animation: bat .5s ease-in-out infinite alternate; }
@keyframes bat { to { transform: scale(1.12); } }

.serie {
  margin: 4px 0 0;
  padding: 6px 14px;
  font-weight: 800;
  color: #b8431c;
  background: #fff1e0;
  border-radius: 999px;
}
.serie-claire { color: #fff; background: rgba(0, 0, 0, .18); }

/* Podium sur l'appareil */
.podium-avatar { margin: 6px 0 2px; }
.podium-titre { margin: 0; font-size: 2.3rem; font-weight: 800; color: var(--marine); }
.podium-or .podium-titre { color: #b8860b; }
.podium-argent .podium-titre { color: #6b7385; }
.podium-bronze .podium-titre { color: #a8642f; }
.jeu-champion {
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 221, 120, .75), transparent 55%),
    linear-gradient(180deg, #fff8dc 0%, #ffe8a3 100%);
}
.jeu-champion .podium-titre {
  font-size: 3rem;
  letter-spacing: .02em;
  background: linear-gradient(180deg, #f7c843, #b8860b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: champion 1s .3s both;
}


/* =====================================================================
   v0.4 — question sur l'appareil, nouveaux types, annonces, réactions
   ===================================================================== */
.ecran-jeu { background-attachment: fixed; }
.jeu-contenu { overflow-y: auto; }

/* Cartes lisibles sur les thèmes illustrés */
.carte-attente {
  width: min(440px, 100%);
  margin: 0 auto;
  padding: 22px 18px;
  background: rgba(255, 255, 255, .93);
  border-radius: 22px;
  box-shadow: 0 8px 28px rgba(10, 15, 51, .12);
}
.theme-cir .carte-attente { background: transparent; box-shadow: none; }

/* Annonce du type de question */
.annonce-type {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  margin: 6px 0;
  font-size: 1.4rem; font-weight: 800; color: var(--marine);
  animation: apparait .4s ease-out;
}
.annonce-type .icone-type { color: var(--orange); }
.badge-x2 {
  display: flex; flex-direction: column; align-items: center;
  width: 108px; height: 108px;
  justify-content: center;
  font-size: 2.6rem; font-weight: 800; line-height: 1;
  color: var(--marine);
  background: #fff;
  border: 7px solid var(--orange);
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(224, 90, 43, .2);
  animation: x2 .6s cubic-bezier(.2, 1.6, .4, 1) both;
}
.badge-x2 span { margin-top: 4px; font-size: .62rem; letter-spacing: .04em; color: var(--orange); }
@keyframes x2 { from { transform: scale(.2) rotate(-25deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* Question affichée sur l'appareil */
.chrono-ligne { justify-content: space-between; align-items: center; }
.type-mini {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  font-size: .78rem; font-weight: 700;
  color: var(--marine);
  background: rgba(255, 255, 255, .92);
  border-radius: 999px;
}
.type-mini .icone-type { color: var(--orange); }
.question-carte {
  margin-bottom: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, .96);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(10, 15, 51, .1);
  text-align: center;
}
.question-image { display: block; max-width: 100%; max-height: 26vh; margin: 0 auto 8px; border-radius: 10px; object-fit: contain; }
.question-texte { margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--texte); line-height: 1.3; }

.avec-texte .grille-reponses { flex: 1; grid-auto-rows: minmax(70px, 1fr); }
.bouton-reponse { position: relative; }
.bouton-reponse.avec-texte { flex-direction: row; justify-content: flex-start; gap: 10px; min-height: 70px; padding: 10px 12px; text-align: left; }
.bouton-reponse.avec-texte .bouton-reponse-texte { font-size: 1.02rem; font-weight: 800; line-height: 1.2; }
.grille-vf .bouton-reponse.avec-texte { justify-content: center; }
.grille-vf .bouton-reponse.avec-texte .bouton-reponse-texte { font-size: 1.5rem; }
.case-multi {
  position: absolute; top: 8px; right: 8px;
  width: 24px; height: 24px;
  border: 3px solid rgba(255, 255, 255, .9);
  border-radius: 7px;
}
.bouton-reponse[aria-pressed="true"] { outline: 5px solid #ffd27a; outline-offset: -5px; transform: scale(.97); }
.bouton-reponse[aria-pressed="true"] .case-multi { background: #fff; }
.bouton-reponse[aria-pressed="true"] .case-multi::after { content: "✓"; position: absolute; inset: -4px 0 0 2px; font-weight: 900; color: var(--ok); }
.btn-valider { margin-top: 10px; }

/* Réponse libre */
.zone-saisie { display: grid; gap: 12px; margin-top: 6px; }
.champ-libre { letter-spacing: .02em; font-size: 1.3rem; }

/* Curseur */
.zone-curseur { display: grid; gap: 12px; margin-top: 6px; padding: 16px; background: rgba(255, 255, 255, .96); border-radius: 18px; }
.valeur-curseur { margin: 0; text-align: center; font-size: 3rem; font-weight: 800; color: var(--marine); line-height: 1; }
.valeur-curseur small { font-size: 1.1rem; color: var(--texte-doux); }
.ligne-curseur { display: grid; grid-template-columns: 44px 1fr 44px; gap: 10px; align-items: center; }
.ligne-curseur .btn { font-size: 1.4rem; padding: 0; }
.ligne-curseur input[type="range"] { width: 100%; height: 36px; accent-color: var(--orange); }
.bornes-curseur { display: flex; justify-content: space-between; font-size: .85rem; font-weight: 700; color: var(--texte-doux); }

/* Puzzle */
.consigne { margin: 0 0 8px; text-align: center; font-weight: 800; color: var(--marine); background: rgba(255, 255, 255, .9); border-radius: 999px; padding: 4px 12px; }
.liste-puzzle { margin: 0 0 10px; padding: 0; list-style: none; display: grid; gap: 8px; }
.piece {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px;
  padding: 10px;
  color: #fff;
  background: var(--rep);
  border-radius: 14px;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18);
  animation: apparait .25s ease-out;
}
.piece-num { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; font-weight: 800; color: var(--marine); background: #fff; border-radius: 50%; }
.piece-texte { font-weight: 800; line-height: 1.2; }
.piece-fleches { display: flex; gap: 6px; }
.piece-fleches button {
  width: 40px; height: 40px;
  font-size: 1rem; font-weight: 800;
  color: var(--marine); background: #fff;
  border: 0; border-radius: 10px;
  cursor: pointer;
}
.piece-fleches button:disabled { opacity: .35; }

/* Rappels de réponse envoyée */
.choix-rappels { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.choix-rappels .choix-rappel { width: 72px; height: 72px; }
.rappel-texte { margin: 0; font-size: 1.3rem; font-weight: 800; color: var(--marine); }

/* Résultats */
.resultat-sondage { background: var(--marine); }
.resultat-solution { margin: 4px 0 0; max-width: 320px; padding: 8px 14px; font-size: .95rem; background: rgba(255, 255, 255, .16); border-radius: 12px; }
.encouragement { margin: 6px 0 0; font-weight: 700; color: var(--orange); }

/* Réactions */
.barre-reactions {
  display: flex; justify-content: center; gap: 6px; flex-wrap: wrap;
  margin: 18px auto 0;
  padding: 8px;
  max-width: 400px;
  background: rgba(255, 255, 255, .92);
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(10, 15, 51, .12);
}
.reaction {
  width: 46px; height: 46px;
  font-size: 1.5rem;
  background: transparent; border: 0; border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .1s;
}
.reaction:active { transform: scale(.85); }
.reaction.envoyee { animation: envol .6s ease-out; }
@keyframes envol { 50% { transform: translateY(-14px) scale(1.4); } }

/* Page Tester : l'appareil simulé n'a pas besoin du pied de page */
.mode-test .accueil-pied { display: none; }

/* v0.4.1 — mots d'encouragement */
.encouragements { display: grid; gap: 6px; justify-items: center; margin: 10px auto 0; max-width: 340px; }
.encouragements .encouragement {
  margin: 0; padding: 7px 14px;
  font-size: .95rem; font-weight: 800; line-height: 1.3; text-align: center;
  color: var(--marine); background: rgba(255, 255, 255, .94);
  border-radius: 14px; box-shadow: 0 3px 10px rgba(20, 28, 80, .15);
  animation: enc-pop .5s cubic-bezier(.2, 1.5, .4, 1) both;
}
.encouragements .encouragement:nth-child(2) { animation-delay: .25s; }
.encouragements .encouragement:nth-child(3) { animation-delay: .5s; }
.encouragements .encouragement:nth-child(4) { animation-delay: .75s; }
.enc-bravo { font-size: 1.05rem !important; }
.enc-monte { color: #fff !important; background: var(--ok) !important; }
.enc-descend { color: var(--erreur) !important; }
.enc-tete { color: #7a5600 !important; background: #ffe79a !important; }
.enc-podium { color: var(--orange-fonce) !important; }
.enc-eclair { color: #fff !important; background: #7a3fa3 !important; }
.enc-serie { color: #fff !important; background: var(--orange) !important; }
@keyframes enc-pop { from { opacity: 0; transform: scale(.6) translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .encouragements .encouragement { animation: none; } }

/* v0.4.2 — puzzle : la couleur suit l'élément quand il bouge */
.liste-puzzle.deja-affiche .piece { animation: none; }
.liste-puzzle.deja-affiche .piece-arrive-bas { animation: piece-du-bas .28s cubic-bezier(.3, .9, .4, 1); position: relative; z-index: 2; }
.liste-puzzle.deja-affiche .piece-arrive-haut { animation: piece-du-haut .28s cubic-bezier(.3, .9, .4, 1); }
@keyframes piece-du-bas { from { transform: translateY(calc(100% + 8px)) scale(1.04); } }
@keyframes piece-du-haut { from { transform: translateY(calc(-100% - 8px)); } }
@media (prefers-reduced-motion: reduce) { .liste-puzzle.deja-affiche .piece-arrive-bas, .liste-puzzle.deja-affiche .piece-arrive-haut { animation: none; } }
