/* =======================================================================
   Questio — feuille de style unique.
   Une ambiance de plateau : bleu nuit, or, et un gros buzzer rouge.
   Pensé pour un téléphone posé au milieu de la table.
   ===================================================================== */

:root {
  --fond:        #111a33;
  --fond-haut:   #1d2a4a;
  --carte:       #1b2646;
  --carte-claire:#25325a;
  --bord:        #2f3d68;
  --texte:       #f5f1e6;
  --doux:        #a3aecb;
  --or:          #f2c14e;
  --or-fonce:    #c9971f;
  --rouge:       #e4572e;
  --rouge-fonce: #a8341a;
  --vert:        #43b581;
  --rayon:       18px;

  --titre: ui-rounded, "SF Pro Rounded", "Nunito", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --sans:  -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;

  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: radial-gradient(120% 80% at 50% 0%, var(--fond-haut) 0%, var(--fond) 70%) fixed, var(--fond);
  color: var(--texte);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}

/* ------------------------------------------------------------- accueil --- */

.app--accueil { position: relative; }

.rond--reglages {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: 16px;
  font-size: 1.35rem;
}

/* — écran Réglages — */

.entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 20px;
}

.entete__titre { margin: 0; font-family: var(--titre); font-size: 1.5rem; font-weight: 800; }
.entete__vide { width: 42px; }

.volume { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 1.1rem; }
.volume__valeur { font-weight: 700; color: var(--or); }

.volume__curseur {
  flex: 1;
  height: 32px;
  accent-color: var(--or);
  background: transparent;
}

.bascule.bascule--seule { padding-top: 0; border-top: 0; }
.bascule--seule + .voix { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--bord); }

.marque { text-align: center; margin: 18px 0 26px; }

.marque__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 84px; height: 84px;
  border: 9px solid var(--or);
  border-radius: 50%;
  position: relative;
}

.marque__logo span {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--rouge);
  font-size: 0;
}

.marque__logo::after {
  content: '';
  position: absolute;
  right: -14px; bottom: -8px;
  width: 30px; height: 10px;
  border-radius: 6px;
  background: var(--or);
  transform: rotate(45deg);
}

.marque__nom {
  margin: 14px 0 4px;
  font-family: var(--titre);
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.05;
}

.marque__devise { margin: 0 auto; max-width: 340px; color: var(--doux); }

.carte {
  margin: 0 0 14px;
  padding: 16px;
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  background: var(--carte);
}

.carte__tete { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

.carte__titre {
  margin: 0 0 12px;
  font-family: var(--titre);
  font-size: 1.1rem;
  font-weight: 700;
}

.carte__tete .carte__titre { margin: 0; }

.carte__sous-titre { margin: 0 0 8px; font-size: .82rem; font-weight: 600; color: var(--doux); }

.pas { display: inline-flex; align-items: center; gap: 10px; }

.pas__bouton {
  width: 40px; height: 40px;
  border: 1px solid var(--bord);
  border-radius: 50%;
  background: var(--carte-claire);
  font-size: 1.4rem;
  line-height: 1;
}

.pas__bouton:disabled { opacity: .35; }

.pas__valeur {
  min-width: 26px;
  font-family: var(--titre);
  font-size: 1.4rem;
  font-weight: 800;
  text-align: center;
  color: var(--or);
}

.joueurs { display: flex; flex-direction: column; gap: 8px; }

.joueur { display: flex; align-items: center; gap: 10px; }

.joueur__rang {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--or);
  color: #1d2a4a;
  font-weight: 800;
  font-size: .9rem;
}

.champ {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--bord);
  border-radius: 12px;
  background: var(--fond);
  color: var(--texte);
  font: inherit;
  font-size: 1rem; /* jamais moins : iOS zoome sous 16px */
}

.champ::placeholder { color: #6f7a99; }

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

.choix { display: flex; gap: 8px; margin-bottom: 14px; }

.choix__bouton {
  flex: 1;
  padding-inline: 6px;
  padding: 10px 0;
  border: 1px solid var(--bord);
  border-radius: 12px;
  background: var(--fond);
  font-weight: 700;
}

.choix__bouton--actif { background: var(--or); border-color: var(--or); color: #1d2a4a; }

.bascule {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--bord);
}

.bascule__texte { display: flex; flex-direction: column; gap: 2px; font-weight: 600; }
.bascule__aide { font-size: .82rem; font-weight: 400; color: var(--doux); }

.bascule input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  position: relative;
  width: 52px; height: 32px;
  margin: 0;
  border-radius: 16px;
  background: var(--bord);
  transition: background .2s;
  cursor: pointer;
}

.bascule input::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
}

.bascule input:checked { background: var(--vert); }
.bascule input:checked::after { transform: translateX(20px); }

.voix { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

.voix__ligne { display: flex; align-items: center; gap: 12px; }

.voix__etiquette { flex: none; width: 62px; font-size: .88rem; font-weight: 600; color: var(--doux); }

.voix__menu {
  padding: 10px 12px;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--or) 50%), linear-gradient(135deg, var(--or) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 12px) 55%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.choix--petit { flex: 1; margin: 0; gap: 6px; }
.choix--petit .choix__bouton { padding: 8px 0; font-size: .88rem; }

.lien-bouton {
  margin-top: 10px;
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--or);
  font-weight: 600;
}

.lien-bouton--discret { display: block; margin: 0 auto; padding-top: 0; color: var(--doux); font-weight: 500; font-size: .9rem; }

.lien-bouton--centre { display: block; margin: 12px auto 0; }

.lancer {
  display: block;
  width: 100%;
  margin: 22px 0 10px;
  padding: 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #f6cf6b, var(--or));
  box-shadow: 0 6px 0 var(--or-fonce), 0 14px 28px rgba(0, 0, 0, .35);
  color: #1d2a4a;
  font-family: var(--titre);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: .01em;
  transition: transform .08s, box-shadow .08s;
}

.lancer:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--or-fonce), 0 8px 18px rgba(0, 0, 0, .35); }

.pied { text-align: center; font-size: .8rem; color: var(--doux); }

/* -------------------------------------------------------------- partie --- */

.app--partie {
  max-width: none;
  height: 100vh;
  height: 100dvh;
  padding: 0;
  overflow: hidden;
}

/*
 * Le plateau : le téléphone est au milieu de la table, un buzzer par joueur
 * sur le bord qui lui fait face, écrit dans son sens.
 */
.table {
  display: grid;
  height: 100%;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "haut   haut   haut"
    "gauche centre droite"
    "bas    bas    bas";
  gap: 10px;
  padding:
    max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  --epaisseur: 96px;
}

.table--foule { --epaisseur: 78px; }

.cote { display: flex; justify-content: center; gap: 10px; min-width: 0; min-height: 0; }
.cote:empty { display: none; }

.cote--bas    { grid-area: bas; }
.cote--haut   { grid-area: haut; transform: rotate(180deg); }
/* Sur les côtés, le texte se lit depuis le bord : écriture verticale. */
.cote--gauche { grid-area: gauche; writing-mode: vertical-rl; }
.cote--droite { grid-area: droite; writing-mode: vertical-rl; transform: rotate(180deg); }

.centre {
  grid-area: centre;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.poste {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1 1 0;
  min-inline-size: 0;
  max-inline-size: 340px;
  block-size: var(--epaisseur);
  padding: 8px;
  border: 0;
  border-radius: 26px;
  background: radial-gradient(circle at 50% 30%,
    color-mix(in srgb, var(--couleur) 65%, white) 0%,
    var(--couleur) 55%,
    color-mix(in srgb, var(--couleur) 72%, black) 100%);
  box-shadow:
    0 7px 0 color-mix(in srgb, var(--couleur) 55%, black),
    0 12px 24px rgba(0, 0, 0, .4);
  color: #fff;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform .06s, box-shadow .06s, opacity .2s, filter .2s;
}

/* À un ou deux, de vrais gros buzzers ronds. */
.table--1 .poste, .table--2 .poste {
  flex: none;
  inline-size: min(58vw, 30vh, 270px);
  block-size: min(58vw, 30vh, 270px);
  border-radius: 50%;
}

.poste__nom {
  max-inline-size: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--titre);
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: .01em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .25);
}

.table--1 .poste__nom, .table--2 .poste__nom { font-size: 1.6rem; }

/* Sur les côtés, nom et score s'alignent dans la longueur du bouton. */
.cote--gauche .poste, .cote--droite .poste { flex-direction: row; gap: 10px; }

/* La couronne du joueur en tête, sur le coin du bouton, dans son sens
   (propriétés logiques : elles suivent l'écriture tournée des côtés). */
.poste { position: relative; }

.poste__couronne {
  position: absolute;
  inset-block-start: -16px;
  inset-inline-end: -6px;
  font-size: 1.7rem;
  line-height: 1;
  text-orientation: sideways;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .45));
  transform: rotate(18deg) scale(0);
  transition: transform .35s cubic-bezier(.3, 1.6, .5, 1);
  pointer-events: none;
}

.poste--meneur .poste__couronne { transform: rotate(18deg) scale(1); }

.table--1 .poste__couronne, .table--2 .poste__couronne {
  inset-block-start: 2%;
  inset-inline-end: 6%;
  font-size: 2.2rem;
}

.poste__points {
  min-inline-size: 34px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  color: color-mix(in srgb, var(--couleur) 70%, black);
  font-weight: 900;
  text-align: center;
}

.poste:active, .poste--presse {
  transform: scale(.94);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--couleur) 55%, black), 0 6px 14px rgba(0, 0, 0, .4);
}

.poste--bloque { filter: grayscale(1) brightness(.5); }
.poste--bloque .poste__nom { text-decoration: line-through; }
.poste:disabled:not(.poste--bloque) { opacity: .55; }

.barre { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.barre__numero {
  font-size: .85rem;
  white-space: nowrap;
  text-align: center;
  font-family: var(--titre);
  font-weight: 700;
  color: var(--doux);
  letter-spacing: .02em;
}

.rond {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  border: 1px solid var(--bord);
  border-radius: 50%;
  background: var(--carte);
  font-size: 1.05rem;
}

.rond--eteint { opacity: .6; }

.scene {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  padding: 16px 4px;
  overflow-y: auto;
}

.scene__theme {
  align-self: center;
  margin-bottom: 14px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(242, 193, 78, .15);
  color: var(--or);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.scene__texte { font-family: var(--serif); }

.indice {
  margin: 0 0 12px;
  font-size: 1.12rem;
  line-height: 1.45;
  color: var(--doux);
  animation: apparaitre .35s ease-out;
}

.indice--courant { color: var(--texte); font-size: 1.24rem; }

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

/* — pendant la lecture à voix haute : rien à lire, juste l'écoute — */

.ecoute { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 10px 0; }

.ecoute__ondes { display: flex; align-items: center; gap: 6px; height: 46px; }

.ecoute__ondes span {
  width: 7px;
  height: 100%;
  border-radius: 4px;
  background: var(--or);
  animation: onde 1s ease-in-out infinite;
}

.ecoute__ondes span:nth-child(2) { animation-delay: .15s; }
.ecoute__ondes span:nth-child(3) { animation-delay: .3s; }
.ecoute__ondes span:nth-child(4) { animation-delay: .45s; }
.ecoute__ondes span:nth-child(5) { animation-delay: .6s; }

@keyframes onde {
  0%, 100% { transform: scaleY(.25); }
  50%      { transform: scaleY(1); }
}

.ecoute--fin .ecoute__ondes span { animation: none; transform: scaleY(.25); background: var(--doux); }

.ecoute__etat {
  margin: 0;
  font-family: var(--titre);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--doux);
}

.ecoute--fin .ecoute__etat { color: var(--or); }

.jauge {
  height: 8px;
  margin-top: 10px;
  border-radius: 4px;
  background: var(--carte-claire);
  overflow: hidden;
}

.jauge--reponse { margin: -4px 0 14px; }
.jauge--urgente .jauge__barre { background: var(--rouge); }
.jauge--arretee { opacity: .35; }
.jauge--arretee .jauge__barre { background: var(--doux); }

.jauge__barre { height: 100%; width: 100%; background: var(--or); transition: width .1s linear; }

/* — panneau superposé (qui, réponse, résultat) — */

.panneau {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  background: rgba(8, 12, 26, .72);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: fondu .15s ease-out;
}

@keyframes fondu { from { opacity: 0; } to { opacity: 1; } }

.panneau__boite, .modale__boite {
  width: 100%;
  max-width: 480px;
  padding: 22px 18px 18px;
  border: 1px solid var(--bord);
  border-radius: 24px;
  background: var(--carte);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
  text-align: center;
  animation: monter .2s ease-out;
}

/* Tournée vers le joueur qui a buzzé (propriété rotate : l'animation
   d'entrée, qui joue sur transform, ne la contrarie pas). */
.panneau__boite--haut   { rotate: 180deg; }
.panneau__boite--gauche { rotate: 90deg; }
.panneau__boite--droite { rotate: -90deg; }

/* Sur le côté, la largeur de la fenêtre s'étend dans la hauteur de l'écran. */
.panneau__boite--gauche, .panneau__boite--droite {
  flex: none;
  width: min(440px, calc(100vh - 40px));
  width: min(440px, calc(100dvh - 40px));
  max-width: none;
}

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

.panneau__surtitre {
  margin: 0;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--doux);
}

.panneau__titre {
  margin: 4px 0 14px;
  font-family: var(--titre);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.2;
}

.panneau__texte { margin: -6px 0 14px; color: var(--doux); }

.reponse { display: flex; gap: 10px; margin-bottom: 12px; }

.champ--reponse { flex: 1; min-width: 0; font-size: 1.2rem; text-align: center; }

.micro {
  flex: none;
  width: 56px;
  border: 2px solid var(--or);
  border-radius: 14px;
  background: var(--carte-claire);
  font-size: 1.5rem;
}

.micro--ecoute {
  border-color: var(--rouge);
  background: var(--rouge);
  animation: ecoute 1s ease-in-out infinite;
}

@keyframes ecoute {
  0%, 100% { box-shadow: 0 0 0 0 rgba(228, 87, 46, .6); }
  50%      { box-shadow: 0 0 0 10px rgba(228, 87, 46, 0); }
}

.reponse__etat { margin: -4px 0 12px; font-size: .9rem; color: var(--doux); }
.reponse__etat--erreur { color: #ff9a7a; }

.bouton-plein {
  display: block;
  width: 100%;
  padding: 15px;
  border: 0;
  border-radius: 14px;
  background: var(--or);
  color: #1d2a4a;
  font-family: var(--titre);
  font-size: 1.1rem;
  font-weight: 800;
}

.bouton-plein--danger { background: var(--rouge); color: #fff; }

.bouton-discret {
  padding: 15px;
  border: 1px solid var(--bord);
  border-radius: 14px;
  background: transparent;
  font-weight: 700;
}

.verdict {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px; height: 64px;
  border-radius: 50%;
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
}

.verdict--juste { background: var(--vert); animation: rebond .45s ease-out; }
.verdict--faux { background: var(--rouge); animation: secouer .4s ease-out; }
.verdict--personne { background: var(--bord); }

@keyframes rebond { 0% { transform: scale(.4); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes secouer { 0%, 100% { transform: none; } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

.solution {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 16px;
  padding: 14px;
  border-radius: 14px;
  background: var(--fond);
}

.solution__etiquette { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--doux); }
.solution__mot { font-family: var(--titre); font-size: 1.6rem; font-weight: 800; color: var(--or); }
.solution__references {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}

.reference {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--bord);
  border-radius: 999px;
  background: var(--carte);
  font-size: .85rem;
  color: var(--doux);
  overflow: hidden;
}

.reference > span, .reference:not(:has(a)) { padding: 5px 10px; }

.reference__lien {
  padding: 5px 8px 5px 12px;
  color: var(--or);
  font-weight: 700;
  text-decoration: none;
}

.reference__web {
  padding: 5px 10px 5px 8px;
  border-left: 1px solid var(--bord);
  color: var(--doux);
  text-decoration: none;
}

.reference__lien:active, .reference__web:active { background: var(--carte-claire); }

.modale {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(8, 12, 26, .72);
}

.modale__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* -------------------------------------------------------- fin de partie --- */

.trophee { font-size: 4rem; line-height: 1; animation: rebond .6s ease-out; }

.classement { margin: 0 0 8px; padding: 0; list-style: none; }

.classement__ligne {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding: 12px 14px;
  border: 1px solid var(--bord);
  border-radius: 16px;
  background: var(--carte);
}

.classement__ligne--premier { border-color: var(--or); background: linear-gradient(90deg, rgba(242, 193, 78, .18), var(--carte)); }

.classement__place {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--carte-claire);
  font-weight: 800;
}

.classement__ligne--premier .classement__place { background: var(--or); color: #1d2a4a; }

.classement__nom { flex: 1; font-family: var(--titre); font-size: 1.1rem; font-weight: 700; }
.classement__points { color: var(--doux); font-weight: 600; }

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