/* Mini Fiesta — tout est « autocollant » : contours d'encre, ombres dures, boutons qui s'enfoncent. */

@font-face {
  font-family: "Poppins";
  src: url("fonts/poppins-500.woff") format("woff");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("fonts/poppins-700.woff") format("woff");
  font-weight: 700 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("fonts/poppins-700-italique.woff") format("woff");
  font-weight: 700 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --indigo: #2b1766;
  --indigo-clair: #3a2387;
  --indigo-fonce: #1f1050;
  --encre: #1b0f3b;
  --craie: #f7f4ff;
  --craie-ombre: #ddd6f5;
  --jaune: #ffc93c;
  --rose: #ff4f9a;
  --menthe: #2ee6a6;
  --ciel: #5ec8ff;
  --orange: #ff8a3d;
  --lilas: #b9a6ff;
  --rouge: #ff4d5e;
  --texte-doux: #cfc6f2;

  --police: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --t-xs: 0.78rem;
  --t-s: 0.875rem;
  --t-m: 1rem;
  --t-l: 1.25rem;
  --t-xl: 1.563rem;
  --t-2xl: 1.953rem;
  --t-3xl: 2.441rem;

  --trait: 3px;
  --rayon-s: 10px;
  --rayon-m: 16px;
  --rayon-l: 28px;
  --ombre: 0 5px 0 var(--encre);
  --ombre-petite: 0 3px 0 var(--encre);
  --marge: 16px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: var(--police);
  font-weight: 500;
  font-size: var(--t-m);
  line-height: 1.5;
  color: var(--craie);
  background: var(--indigo);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px dashed var(--jaune);
  outline-offset: 3px;
}
/* Titres focalisés par programme à chaque changement d'écran (lecteurs d'écran) : pas de contour */
[tabindex="-1"]:focus,
[tabindex="-1"]:focus-visible {
  outline: none;
}

#confettis {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

main {
  position: relative;
  z-index: 1;
}

.noscript {
  padding: 2rem;
  text-align: center;
}

/* ——— Écrans ——— */
.ecran {
  min-height: 100dvh;
  padding: max(var(--marge), env(safe-area-inset-top)) max(var(--marge), env(safe-area-inset-right)) max(var(--marge), env(safe-area-inset-bottom)) max(var(--marge), env(safe-area-inset-left));
  display: grid;
  place-items: center;
}

.titre-ecran {
  font-size: var(--t-2xl);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 1rem;
  letter-spacing: -0.01em;
}

.sous-titre {
  font-size: var(--t-l);
  font-weight: 700;
  margin: 1.25rem 0 0.5rem;
}

.panneau {
  width: min(680px, 100%);
  background: var(--indigo-clair);
  border: var(--trait) solid var(--encre);
  border-radius: var(--rayon-l);
  box-shadow: 0 8px 0 var(--encre);
  padding: clamp(18px, 4vw, 32px);
}
.panneau.etroit {
  width: min(520px, 100%);
}
.panneau.large {
  width: min(900px, 100%);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* ——— Boutons ——— */
.bouton {
  --fond: var(--craie);
  --texte: var(--encre);
  appearance: none;
  cursor: pointer;
  border: var(--trait) solid var(--encre);
  border-radius: var(--rayon-m);
  background: var(--fond);
  color: var(--texte);
  font-weight: 700;
  font-size: var(--t-m);
  line-height: 1.2;
  padding: 0.8em 1.3em;
  box-shadow: var(--ombre);
  transform: translateY(0);
  transition: transform 80ms ease, box-shadow 80ms ease;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  text-align: center;
}
.bouton:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 0 var(--encre);
}
.bouton:active,
.bouton.enfonce {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--encre);
}
.bouton:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: var(--ombre-petite);
}
.bouton.jaune { --fond: var(--jaune); }
.bouton.rose { --fond: var(--rose); }
.bouton.menthe { --fond: var(--menthe); }
.bouton.ciel { --fond: var(--ciel); }
.bouton.orange { --fond: var(--orange); }
.bouton.craie { --fond: var(--craie); }
.bouton.petit {
  font-size: var(--t-s);
  padding: 0.45em 0.9em;
  border-radius: var(--rayon-s);
  box-shadow: var(--ombre-petite);
}
.bouton.petit:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--encre);
}

.bouton.gros {
  display: grid;
  gap: 2px;
  text-align: left;
  padding: 0.9em 1.2em 0.95em;
  border-radius: 20px;
  width: 100%;
}
.bouton-titre {
  font-size: var(--t-xl);
  line-height: 1.15;
}
.bouton-sous {
  font-size: var(--t-s);
  font-weight: 500;
  opacity: 0.85;
}

/* ——— Accueil ——— */
.accueil {
  width: min(1040px, 100%);
  display: grid;
  gap: clamp(24px, 5vw, 64px);
  grid-template-columns: 1fr;
  align-items: center;
}
@media (min-width: 860px) {
  .accueil {
    grid-template-columns: 1.15fr 1fr;
  }
}
.marque {
  display: grid;
  gap: 1rem;
  justify-items: start;
}
@media (max-width: 859px) {
  .marque {
    justify-items: center;
    text-align: center;
  }
}
.logo {
  margin: 0;
  font-weight: 800;
  font-style: italic;
  font-size: clamp(3.2rem, 11vw, 6.6rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
  color: var(--jaune);
  paint-order: stroke fill;
  -webkit-text-stroke: 0.09em var(--encre);
  text-shadow: 0.05em 0.07em 0 var(--encre), 0.11em 0.14em 0 var(--rose);
  transform: rotate(-4deg);
  transform-origin: left center;
  padding: 0.1em 0.18em 0.2em 0.05em;
  overflow-wrap: anywhere;
}
@media (max-width: 859px) {
  .logo {
    transform-origin: center;
  }
}
.accroche {
  margin: 0;
  max-width: 34ch;
  font-size: var(--t-l);
  color: var(--texte-doux);
}
.pastille-pseudo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px 6px 6px;
  border: var(--trait) solid var(--encre);
  border-radius: 999px;
  background: var(--craie);
  color: var(--encre);
  box-shadow: var(--ombre-petite);
  cursor: pointer;
}
.pastille-pseudo:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--encre);
}
.mini-blob {
  width: 44px;
  height: 44px;
}
.pastille-texte {
  display: grid;
  text-align: left;
  line-height: 1.15;
}
.pastille-nom {
  font-weight: 700;
  font-size: var(--t-l);
}
.pastille-aide {
  font-size: var(--t-xs);
  opacity: 0.7;
}
.menu {
  display: grid;
  gap: 16px;
}

/* ——— Formulaires ——— */
.formulaire {
  display: grid;
  gap: 18px;
}
.champ {
  display: grid;
  gap: 6px;
}
.champ-titre {
  font-weight: 700;
}
.champ-aide {
  font-size: var(--t-s);
  color: var(--texte-doux);
}
input[type="text"] {
  width: 100%;
  border: var(--trait) solid var(--encre);
  border-radius: var(--rayon-s);
  background: var(--craie);
  color: var(--encre);
  font-weight: 700;
  font-size: var(--t-l);
  padding: 0.5em 0.7em;
  box-shadow: inset 0 3px 0 var(--craie-ombre);
}
input[aria-invalid="true"] {
  border-color: var(--rouge);
  outline: 3px solid var(--rouge);
}

.interrupteur {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  cursor: pointer;
}
.interrupteur input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.interrupteur-curseur {
  width: 58px;
  height: 34px;
  border: var(--trait) solid var(--encre);
  border-radius: 999px;
  background: var(--indigo-fonce);
  position: relative;
  transition: background 120ms ease;
}
.interrupteur-curseur::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--encre);
  background: var(--craie);
  transition: transform 120ms ease;
}
.interrupteur input:checked + .interrupteur-curseur {
  background: var(--menthe);
}
.interrupteur input:checked + .interrupteur-curseur::after {
  transform: translateX(24px);
}
.interrupteur input:focus-visible + .interrupteur-curseur {
  outline: 3px dashed var(--jaune);
  outline-offset: 3px;
}
.interrupteur:has(input:disabled) {
  cursor: not-allowed;
}
.interrupteur input:disabled + .interrupteur-curseur {
  opacity: 0.45;
}
.interrupteur-texte {
  display: grid;
  gap: 2px;
}

/* Réglages (créer / salon) */
.reglages {
  display: grid;
  gap: 18px;
}
.groupe-reglage {
  display: grid;
  gap: 8px;
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.groupe-reglage legend {
  font-weight: 700;
  padding: 0;
  margin-bottom: 8px;
}
.segments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.segment {
  position: relative;
}
.segment input,
.puce input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.segment span,
.puce span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: var(--trait) solid var(--encre);
  border-radius: 999px;
  padding: 0.45em 1em;
  background: var(--indigo-fonce);
  color: var(--craie);
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--ombre-petite);
  user-select: none;
}
.segment input:checked + span {
  background: var(--jaune);
  color: var(--encre);
}
.puce input:checked + span {
  background: var(--menthe);
  color: var(--encre);
}
.puce span::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 4px;
}
.puce input:checked + span::before {
  background: var(--encre);
  box-shadow: inset 0 0 0 2px var(--menthe);
}
.segment input:focus-visible + span,
.puce input:focus-visible + span {
  outline: 3px dashed var(--jaune);
  outline-offset: 3px;
}
.segment input:disabled + span,
.puce input:disabled + span {
  cursor: default;
  box-shadow: none;
  opacity: 0.85;
}
.compteur {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.compteur output {
  min-width: 2.2ch;
  text-align: center;
  font-weight: 800;
  font-style: italic;
  font-size: var(--t-xl);
  font-variant-numeric: tabular-nums;
}
.compteur .bouton {
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: var(--t-xl);
  line-height: 1;
}
.aide-reglage {
  font-size: var(--t-s);
  color: var(--texte-doux);
  margin: 0;
}
.lecture-seule {
  display: grid;
  gap: 6px;
  margin: 0;
}
.lecture-seule div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.lecture-seule dt {
  font-weight: 700;
}
.lecture-seule dd {
  margin: 0;
  color: var(--texte-doux);
}

/* ——— Rejoindre ——— */
.ligne-code {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}
#code-salon {
  font-size: var(--t-2xl);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-style: italic;
}
.entete-liste {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 1rem;
}
.liste-salons {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.salon-ligne {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
  padding: 12px 14px;
  border: var(--trait) solid var(--encre);
  border-radius: var(--rayon-m);
  background: var(--indigo-fonce);
}
.salon-ligne strong {
  font-size: var(--t-l);
}
.salon-ligne .detail {
  grid-column: 1;
  font-size: var(--t-s);
  color: var(--texte-doux);
}
.salon-ligne .bouton {
  grid-row: 1 / span 2;
  grid-column: 2;
}
.vide {
  color: var(--texte-doux);
  font-size: var(--t-s);
  padding: 8px 2px;
}

/* ——— Salon ——— */
.salon-entete {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.salon-statut {
  margin: -0.5rem 0 0;
  color: var(--texte-doux);
}
.ticket {
  --entaille: 14px;
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 14px;
  align-items: center;
  padding: 10px 22px;
  background: var(--jaune);
  color: var(--encre);
  border: var(--trait) solid var(--encre);
  border-radius: 12px;
  box-shadow: var(--ombre);
  transform: rotate(2deg);
  mask: radial-gradient(circle at 0 50%, transparent calc(var(--entaille) - 1px), #000 var(--entaille)) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% 50%, transparent calc(var(--entaille) - 1px), #000 var(--entaille)) right / 51% 100% no-repeat;
}
.ticket-libelle {
  font-size: var(--t-s);
  font-weight: 700;
}
.ticket-code {
  font-size: var(--t-2xl);
  font-weight: 800;
  font-style: italic;
  letter-spacing: 0.12em;
  grid-row: 2;
}
.ticket-boutons {
  grid-row: 1 / span 2;
  grid-column: 2;
  display: grid;
  gap: 8px;
}
.sieges {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 14px 8px;
}
.siege {
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
  min-width: 0;
}
.siege canvas {
  width: 72px;
  height: 72px;
}
.siege-nom {
  font-weight: 700;
  max-width: 100%;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.siege-info {
  font-size: var(--t-xs);
  color: var(--texte-doux);
}
.siege.libre .siege-rond {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px dashed var(--lilas);
  opacity: 0.45;
}
.siege.moi .siege-nom {
  color: var(--jaune);
}
.siege.absent canvas {
  opacity: 0.4;
}
.salon-reglages {
  border-top: 3px dashed var(--indigo-fonce);
  margin-top: 1rem;
  padding-top: 0.25rem;
}

/* ——— Affiche de présentation ——— */
.affiche {
  --accent: var(--jaune);
  width: min(620px, 100%);
  background: var(--craie);
  color: var(--encre);
  border: var(--trait) solid var(--encre);
  border-radius: var(--rayon-l);
  box-shadow: 0 8px 0 var(--encre), 0 8px 0 3px var(--accent);
  padding: clamp(18px, 4vw, 30px);
  display: grid;
  gap: 10px;
  text-align: center;
  justify-items: center;
}
.affiche-haut {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.progression {
  font-weight: 700;
  font-size: var(--t-s);
}
.badge-type {
  font-weight: 700;
  font-size: var(--t-s);
  border: var(--trait) solid var(--encre);
  border-radius: 999px;
  padding: 0.2em 0.9em;
  background: var(--accent);
  box-shadow: var(--ombre-petite);
}
.affiche-emoji {
  font-size: clamp(3rem, 12vw, 4.6rem);
  line-height: 1;
  margin-top: 4px;
}
.affiche-nom {
  margin: 0;
  font-size: clamp(var(--t-2xl), 7vw, var(--t-3xl));
  font-weight: 800;
  font-style: italic;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.affiche-regle {
  margin: 0;
  font-size: var(--t-l);
  max-width: 40ch;
}
.affiche-detail,
.affiche-commandes {
  margin: 0;
  font-size: var(--t-s);
  max-width: 52ch;
  color: #4b3f75;
}
.affiche-commandes strong {
  color: var(--encre);
}
.composition {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 6px 0;
}
.groupe-compo {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 2px solid var(--encre);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  background: #fff;
}
.groupe-compo.moi {
  background: #fff4cf;
}
.groupe-compo .vs {
  font-weight: 800;
  font-style: italic;
  font-size: var(--t-s);
}
.compo-joueur {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: var(--t-s);
}
.compo-joueur canvas {
  width: 28px;
  height: 28px;
}
.affiche-bas {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.decompte {
  position: relative;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-style: italic;
}
.decompte svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}
.decompte circle {
  fill: none;
  stroke-width: 5;
}
.decompte-fond {
  stroke: var(--craie-ombre);
}
.decompte-arc {
  stroke: var(--encre);
  stroke-linecap: round;
  stroke-dasharray: 106.8;
}
.prets {
  font-size: var(--t-s);
  font-weight: 700;
}
.attente {
  margin: 0;
  max-width: 46ch;
  font-size: var(--t-s);
  color: #4b3f75;
}
.attente strong {
  color: var(--encre);
}

/* ——— Entraînement ——— */
.intro-ecran {
  margin: -0.25rem 0 1rem;
  max-width: 62ch;
  color: var(--texte-doux);
}
#entrainement-familles {
  margin-bottom: 1rem;
}
.famille-arene { --pastille: var(--rose); }
.famille-simulation { --pastille: var(--jaune); }
.famille-cassetete { --pastille: var(--menthe); }
.famille-partage { --pastille: var(--ciel); }
.grille-jeux {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
}
.carte-jeu {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 12px 8px 10px;
  border: var(--trait) solid var(--encre);
  border-radius: var(--rayon-m);
  background: var(--craie);
  color: var(--encre);
  box-shadow: var(--ombre-petite);
  font: inherit;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 80ms ease, box-shadow 80ms ease;
}
.carte-jeu:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 0 var(--encre);
}
.carte-jeu:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--encre);
}
.carte-emoji {
  flex: none;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  font-size: 1.7rem;
  border: 2px solid var(--encre);
  border-radius: 50%;
  background: var(--pastille, var(--lilas));
}
.carte-texte {
  display: grid;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
}
.carte-nom {
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.carte-info {
  font-size: var(--t-xs);
  color: #4b3f75;
}
.fiche-tete {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 0.9rem;
}
.fiche-emoji {
  flex: none;
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  font-size: 2.5rem;
  border: var(--trait) solid var(--encre);
  border-radius: 50%;
  background: var(--pastille, var(--lilas));
  box-shadow: var(--ombre-petite);
}
.fiche-nom {
  margin: 0;
  font-size: clamp(var(--t-xl), 6vw, var(--t-2xl));
  font-weight: 800;
  font-style: italic;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.fiche-famille {
  margin: 4px 0 0;
  font-size: var(--t-s);
  color: var(--texte-doux);
}
.fiche-regle {
  margin: 0 0 0.6rem;
  max-width: 46ch;
  font-size: var(--t-l);
  line-height: 1.4;
}
.fiche-commandes {
  margin: 0 0 0.6rem;
  font-size: var(--t-s);
  color: var(--texte-doux);
}
.fiche-commandes strong {
  color: var(--craie);
}
.fiche-record {
  display: inline-block;
  margin: 0.2rem 0 0.6rem;
  padding: 0.2em 0.9em;
  border: 2px solid var(--encre);
  border-radius: 999px;
  background: var(--jaune);
  color: var(--encre);
  font-weight: 700;
}
.fiche-options {
  display: grid;
  gap: 16px;
  margin-top: 0.9rem;
}
.fiche-options:empty {
  display: none;
}
.fiche-resume {
  margin: 1rem 0 0;
  font-weight: 700;
}
.record {
  margin: 1rem 0 0;
  text-align: center;
  font-weight: 700;
  color: var(--texte-doux);
}
.record.nouveau {
  font-size: var(--t-l);
  color: var(--jaune);
}

/* ——— Mini-jeu ——— */
.ecran-jeu {
  position: fixed;
  inset: 0;
  min-height: 0;
  height: 100dvh;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas: "hud" "tableau" "scene" "commandes";
  gap: 6px;
  place-items: stretch;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.hud {
  grid-area: hud;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.hud-gauche {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.hud-arret {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: var(--trait) solid var(--encre);
  border-radius: 50%;
  background: var(--craie);
  color: var(--encre);
  font: inherit;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--ombre-petite);
  touch-action: manipulation;
}
.hud-arret:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--encre);
}
.hud-nom {
  font-weight: 700;
  font-size: var(--t-s);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hud-chrono {
  min-width: 3.4ch;
  text-align: center;
  font-weight: 800;
  font-style: italic;
  font-variant-numeric: tabular-nums;
  font-size: var(--t-l);
  color: var(--encre);
  background: var(--jaune);
  border: var(--trait) solid var(--encre);
  border-radius: 999px;
  padding: 0 0.7em;
  box-shadow: var(--ombre-petite);
}
.hud-chrono.urgent {
  background: var(--rose);
}
.hud-score {
  justify-self: end;
  font-weight: 800;
  font-style: italic;
  font-size: var(--t-l);
  white-space: nowrap;
}
.tableau {
  grid-area: tableau;
  list-style: none;
  margin: 0;
  padding: 0 2px 2px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tableau::-webkit-scrollbar {
  display: none;
}
.tableau li {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 3px;
  border: 2px solid var(--encre);
  border-radius: 999px;
  background: var(--indigo-fonce);
  font-size: var(--t-xs);
  font-weight: 700;
  line-height: 1.3;
}
.tableau li.moi {
  background: var(--craie);
  color: var(--encre);
}
.tableau li.hors {
  opacity: 0.5;
}
.tableau .pastille {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--encre);
}
.tableau .valeur {
  font-variant-numeric: tabular-nums;
}
.scene {
  grid-area: scene;
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
}
#toile {
  display: block;
  border: var(--trait) solid var(--encre);
  border-radius: var(--rayon-m);
  box-shadow: var(--ombre);
  background: var(--indigo-fonce);
  touch-action: none;
}
.superpose {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.annonce-jeu {
  font-weight: 800;
  font-style: italic;
  font-size: clamp(2.6rem, 14vw, 6rem);
  color: var(--jaune);
  paint-order: stroke fill;
  -webkit-text-stroke: 0.08em var(--encre);
  text-shadow: 0.05em 0.07em 0 var(--encre);
  text-align: center;
  line-height: 1;
}
.annonce-jeu.petite {
  font-size: clamp(1.8rem, 8vw, 3.2rem);
}
.anime-pop {
  animation: pop 420ms cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes pop {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Commandes */
.commandes {
  grid-area: commandes;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 10px;
  min-height: 0;
}
.commandes:empty {
  display: none;
}
.zone-joystick {
  position: relative;
  flex: 1 1 50%;
  min-height: 132px;
  border: 3px dashed var(--indigo-clair);
  border-radius: var(--rayon-l);
  touch-action: none;
}
.zone-joystick::after {
  content: "Glissez ici";
  position: absolute;
  inset: auto 0 8px;
  text-align: center;
  font-size: var(--t-xs);
  color: var(--texte-doux);
  opacity: 0.7;
  pointer-events: none;
}
.joystick-base,
.joystick-tete {
  position: absolute;
  border-radius: 50%;
  border: var(--trait) solid var(--encre);
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.joystick-base {
  width: 112px;
  height: 112px;
  background: rgba(247, 244, 255, 0.12);
}
.joystick-tete {
  width: 56px;
  height: 56px;
  background: var(--craie);
  box-shadow: var(--ombre-petite);
}
.pave-boutons {
  display: flex;
  gap: 10px;
  flex: 1 1 auto;
  justify-content: flex-end;
  align-items: stretch;
}
.pave-boutons.plein {
  justify-content: stretch;
}
.pave-boutons.plein > .bouton {
  flex: 1 1 0;
}
.bouton-jeu {
  min-height: 84px;
  min-width: 84px;
  border-radius: 22px;
  font-size: var(--t-l);
  padding: 0.4em 0.8em;
  display: grid;
  place-items: center;
  line-height: 1.1;
}
.bouton-jeu small {
  display: block;
  font-size: var(--t-xs);
  font-weight: 500;
  opacity: 0.75;
}
.bouton-rond {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  align-self: center;
}
.croix-directions {
  display: grid;
  grid-template-columns: repeat(3, 62px);
  grid-template-rows: repeat(2, 54px);
  gap: 6px;
  margin-left: auto;
}
.croix-directions .bouton {
  padding: 0;
  font-size: var(--t-xl);
  border-radius: 14px;
}
.croix-directions [data-d="0"] {
  grid-column: 2;
  grid-row: 1;
}
.croix-directions [data-d="3"] {
  grid-column: 1;
  grid-row: 2;
}
.croix-directions [data-d="2"] {
  grid-column: 2;
  grid-row: 2;
}
.croix-directions [data-d="1"] {
  grid-column: 3;
  grid-row: 2;
}
.reponses {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.reponses.une-ligne {
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}
.reponses .bouton {
  min-height: 58px;
  font-size: var(--t-l);
  padding: 0.3em 0.5em;
  overflow-wrap: break-word;
  hyphens: none;
}
.reponses .bouton.juste {
  --fond: var(--menthe);
}
.reponses .bouton.faux {
  --fond: var(--rouge);
}
.clavier-nombres {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
}
.clavier-nombres .saisie {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 800;
  font-style: italic;
  font-size: var(--t-xl);
  border: var(--trait) solid var(--encre);
  border-radius: var(--rayon-s);
  background: var(--craie);
  color: var(--encre);
  padding: 0 12px;
  min-height: 46px;
}
.clavier-nombres .bouton {
  padding: 0.35em 0;
  font-size: var(--t-l);
  border-radius: 12px;
}
.clavier-nombres .valider {
  grid-column: span 2;
}

/* Paysage court (téléphone couché) : commandes de part et d'autre de la scène */
@media (orientation: landscape) and (max-height: 560px) {
  /* Colonnes latérales de largeur fixe : la scène prend le reste (une colonne « auto » dépendrait
     de la taille du canvas, elle-même calculée d'après la scène). */
  .ecran-jeu {
    grid-template-columns: minmax(150px, 26vw) minmax(0, 1fr) minmax(150px, 26vw);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas: "hud hud hud" "tableau tableau tableau" "gauche scene droite";
  }
  .clavier-nombres {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .clavier-nombres .valider {
    grid-column: span 2;
  }
  .reponses .bouton {
    min-height: 44px;
    font-size: var(--t-m);
  }
  .bouton-jeu {
    min-height: 64px;
    min-width: 0;
  }
  .bouton-rond {
    width: 92px;
    height: 92px;
  }
  .pave-boutons.plein {
    flex-direction: column;
  }
  .commandes {
    display: contents;
  }
  .commandes > :first-child {
    grid-area: gauche;
    align-self: end;
  }
  .commandes > :last-child:not(:first-child) {
    grid-area: droite;
    align-self: end;
  }
  .commandes > :only-child {
    grid-area: droite;
  }
  .zone-joystick {
    min-height: 0;
    height: 100%;
  }
  .reponses,
  .clavier-nombres {
    align-self: center;
  }
}
@media (min-width: 900px) and (min-height: 600px) {
  .commandes {
    max-width: 900px;
    width: 100%;
    justify-self: center;
  }
}
@media (pointer: coarse) {
  .bouton-jeu small {
    display: none;
  }
}
@media (pointer: fine) {
  .zone-joystick.facultative,
  .pave-boutons.facultatif {
    display: none;
  }
}

/* ——— Résultats et fin ——— */
.resultats-blocs {
  display: grid;
  gap: 14px;
}
.bloc-resultat {
  border: var(--trait) solid var(--encre);
  border-radius: var(--rayon-m);
  background: var(--indigo-fonce);
  padding: 10px 12px;
}
.ligne-resultat {
  display: grid;
  grid-template-columns: 2.2em minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  padding: 6px 4px;
}
.ligne-resultat + .ligne-resultat {
  border-top: 2px dashed var(--indigo-clair);
}
.ligne-resultat .rang {
  font-weight: 800;
  font-style: italic;
  font-size: var(--t-l);
  text-align: center;
}
.ligne-resultat .qui {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  min-width: 0;
}
.ligne-resultat .qui canvas {
  width: 26px;
  height: 26px;
}
.ligne-resultat .val {
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.ligne-resultat .details {
  grid-column: 2 / -1;
  font-size: var(--t-xs);
  color: var(--texte-doux);
}
.ligne-resultat.gagnant {
  background: rgba(255, 201, 60, 0.14);
  border-radius: var(--rayon-s);
}
.egalite {
  margin: 6px 4px 2px;
  font-weight: 700;
  color: var(--texte-doux);
}
.etoile-gagnee {
  display: inline-block;
  color: var(--jaune);
  font-weight: 800;
}
.classement {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.classement li {
  display: grid;
  grid-template-columns: 2em 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 6px 10px;
  border-radius: var(--rayon-s);
  background: var(--indigo-fonce);
}
.classement li.moi {
  outline: 3px solid var(--jaune);
}
.classement .rang {
  font-weight: 800;
  font-style: italic;
  text-align: center;
}
.classement canvas {
  width: 30px;
  height: 30px;
}
.classement .nom {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.classement .etoiles {
  font-weight: 800;
  color: var(--jaune);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.suite {
  margin: 1rem 0 0;
  font-weight: 700;
  text-align: center;
}
.podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  margin: 0.5rem auto 1.5rem;
  max-width: 520px;
}
.marche {
  display: grid;
  justify-items: center;
  gap: 6px;
}
.marche canvas {
  width: 84px;
  height: 84px;
}
.marche .nom {
  font-weight: 700;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.marche .socle {
  width: 100%;
  border: var(--trait) solid var(--encre);
  border-radius: 12px 12px 4px 4px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-style: italic;
  font-size: var(--t-2xl);
  color: var(--encre);
  box-shadow: var(--ombre);
}
.marche.p1 .socle {
  height: 120px;
  background: var(--jaune);
}
.marche.p2 .socle {
  height: 86px;
  background: var(--craie);
}
.marche.p3 .socle {
  height: 62px;
  background: var(--orange);
}
.marche.p1 {
  order: 2;
}
.marche.p2 {
  order: 1;
}
.marche.p3 {
  order: 3;
}
.podium.anime .marche {
  animation: monte 600ms cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.podium.anime .marche.p3 {
  animation-delay: 150ms;
}
.podium.anime .marche.p2 {
  animation-delay: 450ms;
}
.podium.anime .marche.p1 {
  animation-delay: 800ms;
}
@keyframes monte {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

/* ——— Bandeaux ——— */
.bandeau {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  text-align: center;
  font-weight: 700;
  padding: 8px 12px;
  background: var(--rose);
  color: var(--encre);
  border-bottom: var(--trait) solid var(--encre);
}
.message {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  width: min(560px, calc(100% - 24px));
  background: var(--craie);
  color: var(--encre);
  font-weight: 700;
  border: var(--trait) solid var(--encre);
  border-radius: var(--rayon-m);
  box-shadow: var(--ombre);
  padding: 10px 16px;
  text-align: center;
}
.message.erreur {
  background: #ffd5da;
}

/* ——— Animations réduites ——— */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
.calme *,
.calme *::before,
.calme *::after {
  animation-duration: 1ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 1ms !important;
}
