/* Invitation de Manon — papier crème, encre, brique ; le vert du terrain arrive avec la bonne réponse. */

@font-face {
  font-family: 'Caprasimo';
  src: url('/polices/caprasimo-latin.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/polices/bricolage-grotesque-latin.woff2') format('woff2');
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}

:root {
  --creme: #f4ecdf;
  --creme-2: #eadcc6;
  --papier: #fffaf2;
  --encre: #221e1a;
  --encre-2: #554b42;
  --brique: #c9431f;
  --brique-fonce: #a3341a;
  --terrain: #2c6a4d;
  --terrain-fonce: #1f4f39;
  --moutarde: #eaad3a;
  --rose: #f3c6b4;
  --accent: var(--brique-fonce);
  --titre: 'Caprasimo', 'Cooper Black', 'Georgia', serif;
  --texte: 'Bricolage Grotesque', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --ombre: 4px 4px 0 var(--encre);
  --ombre-basse: 2px 2px 0 var(--encre);
  --ressort: cubic-bezier(0.34, 1.56, 0.64, 1);
  --doux: cubic-bezier(0.22, 1, 0.36, 1);
}

body.ambiance-terrain {
  --accent: var(--terrain);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--creme);
  color: var(--encre);
  font-family: var(--texte);
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  font-size: 1.0625rem;
  line-height: 1.45;
  font-variation-settings: 'opsz' 14;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Grain de papier, très léger */
.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .36 0 0 0 0 .25 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

h1,
h2,
p {
  margin: 0;
}

h1,
h2,
.titre {
  font-family: var(--titre);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.35rem, 11vw, 3.3rem);
}

h2 {
  font-size: clamp(2rem, 9.4vw, 2.8rem);
}

:focus-visible {
  outline: 3px solid var(--brique);
  outline-offset: 3px;
}

h1:focus,
h2:focus {
  outline: none;
}

.visuellement-cache {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- En-tête ------------------------------------------------------------ */

.entete {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, 520px);
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 20px 6px;
}

.monogramme {
  font-family: var(--titre);
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}

.monogramme span {
  display: inline-block;
  margin: 0 0.12em;
  color: var(--brique);
  transform: translateY(-0.04em) rotate(-8deg);
}

.progression {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  opacity: 0;
  transition: opacity 0.4s;
}

body[data-etape]:not([data-etape='couverture']) .progression {
  opacity: 1;
}

.progression-points {
  display: flex;
  gap: 5px;
}

.progression-points i {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  border: 1.5px solid var(--encre);
  transition: width 0.35s var(--doux), background 0.35s;
}

.progression-points i.fait {
  background: var(--encre);
}

.progression-points i.actif {
  width: 22px;
  background: var(--accent);
  border-color: var(--encre);
}

.progression-nom {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.bouton-son {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-right: -8px;
  border: 0;
  border-radius: 99px;
  background: none;
  color: var(--encre);
  cursor: pointer;
}

.bouton-son svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bouton-son .son-hp {
  fill: currentColor;
}

.bouton-son .son-coupe,
.bouton-son[aria-pressed='true'] .son-ondes {
  display: none;
}

.bouton-son[aria-pressed='true'] .son-coupe {
  display: inline;
}

/* --- Écrans -------------------------------------------------------------- */

main {
  position: relative;
  z-index: 1;
  flex: 1;
  width: min(100%, 460px);
  margin: 0 auto;
  padding: 10px 20px calc(36px + env(safe-area-inset-bottom));
}

.ecran {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.ecran[hidden] {
  display: none;
}

.ecran.entre > * {
  animation: entree 0.6s var(--doux) both;
}

.ecran.entre > :nth-child(2) { animation-delay: 0.06s; }
.ecran.entre > :nth-child(3) { animation-delay: 0.12s; }
.ecran.entre > :nth-child(4) { animation-delay: 0.18s; }
.ecran.entre > :nth-child(5) { animation-delay: 0.24s; }
.ecran.entre > :nth-child(n + 6) { animation-delay: 0.3s; }

@keyframes entree {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

.ecran.sort {
  animation: sortie 0.28s ease-in both;
}

@keyframes sortie {
  to {
    opacity: 0;
    transform: translateY(-12px);
  }
}

.surtitre {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.surtitre::before {
  content: '';
  width: 22px;
  height: 2px;
  background: currentColor;
}

.chapo {
  color: var(--encre-2);
  font-size: 1.125rem;
  text-wrap: pretty;
}

.petit {
  color: var(--encre-2);
  font-size: 0.875rem;
  text-align: center;
}

/* --- Boutons -------------------------------------------------------------- */

.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 12px 26px;
  border: 2px solid var(--encre);
  border-radius: 14px;
  background: var(--papier);
  box-shadow: var(--ombre);
  color: var(--encre);
  font-family: var(--titre);
  font-size: 1.2rem;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s, box-shadow 0.12s, background 0.2s;
}

.bouton:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--encre);
}

@media (hover: hover) {
  .bouton:hover {
    transform: translate(-1px, -1px);
    box-shadow: 5px 5px 0 var(--encre);
  }
}

.bouton-principal {
  background: var(--brique);
  color: var(--papier);
}

.bouton-terrain {
  background: var(--terrain);
  color: var(--papier);
}

.bouton::after {
  content: '→';
  font-family: var(--texte);
  font-weight: 700;
  transition: transform 0.2s;
}

.bouton-valider::after,
.voile .bouton::after {
  content: none;
}

.lien-discret {
  align-self: center;
  padding: 8px 4px;
  border: 0;
  background: none;
  color: var(--encre-2);
  font: inherit;
  font-size: 0.95rem;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  cursor: pointer;
}

/* --- Billets (invitation, bon) ------------------------------------------- */

.billet {
  --encoche: 13px;
  position: relative;
  margin: 8px 6px 4px;
  border: 2px solid var(--encre);
  border-radius: 18px;
  background: var(--papier);
  box-shadow: 5px 5px 0 var(--encre);
}

.billet-haut {
  padding: 18px 20px 20px;
}

.billet-bas {
  position: relative;
  padding: 16px 20px 18px;
  border-top: 2px dashed var(--encre);
}

/* les encoches de part et d'autre de la ligne de découpe */
.billet-bas::before,
.billet-bas::after {
  content: '';
  position: absolute;
  top: calc(var(--encoche) * -1 - 1px);
  width: calc(var(--encoche) * 2);
  height: calc(var(--encoche) * 2);
  border: 2px solid var(--encre);
  border-radius: 50%;
  background: var(--creme);
}

.billet-bas::before {
  left: calc(var(--encoche) * -1 - 2px);
  clip-path: inset(0 0 0 50%);
}

.billet-bas::after {
  right: calc(var(--encoche) * -1 - 2px);
  clip-path: inset(0 50% 0 0);
}

.billet-etiquette {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.billet-etiquette span:last-child {
  color: var(--encre-2);
  font-variant-numeric: tabular-nums;
}

.billet-invitation {
  transform: rotate(-1.6deg);
  animation: posee 0.9s var(--ressort) both;
}

@keyframes posee {
  from {
    opacity: 0;
    transform: translateY(-24px) rotate(3deg) scale(0.96);
  }
}

.billet-pour {
  margin-top: 14px;
  color: var(--encre-2);
  font-size: 0.95rem;
}

.billet-nom {
  margin: -2px 0 6px -2px;
  color: var(--brique);
  font-family: var(--titre);
  font-size: clamp(3.6rem, 19vw, 4.6rem);
  line-height: 0.95;
}

.billet-quand {
  font-weight: 650;
  font-size: 1.05rem;
  line-height: 1.3;
}

.billet-infos {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 12px;
  margin: 0;
}

.billet-infos dt {
  color: var(--encre-2);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.billet-infos dd {
  margin: 2px 0 0;
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.25;
}

.mystere {
  font-family: var(--titre);
  font-weight: 400 !important;
  letter-spacing: 0.08em;
}

.billet-infos dd.devoile {
  color: var(--terrain);
  animation: tampon-encre 0.5s var(--ressort) both;
}

.tampon {
  position: absolute;
  right: 14px;
  top: 44px;
  padding: 6px 10px 5px;
  border: 2.5px solid var(--brique);
  border-radius: 8px;
  color: var(--brique);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1.15;
  text-align: center;
  text-transform: uppercase;
  transform: rotate(9deg);
  opacity: 0.82;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='t'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='2'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='discrete' tableValues='1 1 1 0 1 1 1 1'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23t)'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='t'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='2'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='discrete' tableValues='1 1 1 0 1 1 1 1'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23t)'/%3E%3C/svg%3E");
}

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

.ecran-couverture .bouton {
  margin-top: 4px;
}

/* --- Devinette ----------------------------------------------------------- */

.mot {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.tuiles {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 5px;
}

.tuile {
  width: 100%;
  min-width: 0;
  height: clamp(44px, 12.5vw, 56px);
  padding: 0;
  border: 2px solid var(--encre);
  border-radius: 8px;
  background: var(--papier);
  box-shadow: var(--ombre-basse);
  color: var(--encre);
  font-family: var(--titre);
  font-size: clamp(1.2rem, 6.4vw, 1.65rem);
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  caret-color: var(--brique);
  -webkit-appearance: none;
  appearance: none;
  transition: transform 0.15s, border-color 0.15s, background 0.2s;
}

.tuile:focus {
  outline: none;
  border-color: var(--brique);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(201, 67, 31, 0.22), 2px 4px 0 var(--encre);
  transform: translateY(-3px);
}

.tuile.bonne {
  background: var(--terrain);
  color: var(--papier);
  cursor: default;
}

.tuile.posee {
  animation: retourne 0.5s var(--ressort) both;
}

.tuile.fausse {
  border-color: var(--brique);
  background: #f9ddd2;
  color: var(--brique-fonce);
  animation: tremble 0.35s;
}

@keyframes tremble {
  25% { transform: translateX(-3px) rotate(-3deg); }
  75% { transform: translateX(3px) rotate(3deg); }
}

.tuiles.gagne .tuile {
  background: var(--terrain);
  color: var(--papier);
  animation: retourne 0.55s var(--ressort) both;
  animation-delay: calc(var(--i) * 70ms);
}

@keyframes retourne {
  0% {
    transform: rotateX(0) scale(1);
  }
  45% {
    transform: rotateX(90deg) scale(1.05);
  }
  100% {
    transform: rotateX(0) scale(1);
  }
}

.devine {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.devine.secoue {
  animation: secoue 0.42s;
}

@keyframes secoue {
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}

.bulle-ligne {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2px solid var(--encre);
  border-radius: 50%;
  background: var(--moutarde);
  font-family: var(--titre);
  font-size: 1.1rem;
}

.bulle {
  position: relative;
  padding: 9px 14px 10px;
  border: 2px solid var(--encre);
  border-radius: 4px 16px 16px 16px;
  background: var(--papier);
  font-weight: 600;
}

.bulle.parle {
  animation: parle 0.4s var(--ressort);
}

@keyframes parle {
  from {
    transform: scale(0.9);
    transform-origin: 0 0;
  }
}

.essais {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--encre-2);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.batons {
  display: flex;
  gap: 8px;
}

.groupe-batons {
  position: relative;
  display: flex;
  gap: 3px;
  height: 18px;
}

.groupe-batons i {
  width: 2.5px;
  height: 100%;
  border-radius: 2px;
  background: var(--encre);
  transform: rotate(4deg);
  animation: trait 0.25s ease-out both;
}

.groupe-batons i:nth-child(2n) {
  transform: rotate(-3deg);
}

.groupe-batons b {
  position: absolute;
  left: -3px;
  right: -3px;
  top: 50%;
  height: 2.5px;
  border-radius: 2px;
  background: var(--brique);
  transform: rotate(-24deg);
  animation: trait 0.25s ease-out both;
}

@keyframes trait {
  from {
    clip-path: inset(0 0 100% 0);
  }
}

.essais-nombre {
  display: none;
}

.indices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.indice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 10px;
  border: 2px solid var(--encre);
  border-radius: 14px;
  background: var(--papier);
  font-size: 1rem;
  line-height: 1.3;
}

.indice:not(:first-child) {
  opacity: 0.72;
  border-width: 1.5px;
}

.indice:first-child {
  box-shadow: var(--ombre-basse);
  animation: indice 0.5s var(--ressort) both;
}

@keyframes indice {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.97);
  }
}

.indice svg {
  flex: none;
  width: 40px;
  height: 40px;
  padding: 6px;
  border-radius: 10px;
  background: var(--creme-2);
  fill: none;
  stroke: var(--encre);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.indice small {
  display: block;
  color: var(--brique-fonce);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.trouve {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border: 2px solid var(--encre);
  border-radius: 18px;
  background: var(--papier);
  box-shadow: 5px 5px 0 var(--terrain);
  animation: indice 0.6s var(--ressort) both;
}

.trouve .bouton {
  margin-top: 8px;
}

/* --- Match --------------------------------------------------------------- */

.ecran-match {
  gap: 12px;
}

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

.ecran-match h2 {
  font-size: clamp(1.6rem, 7.2vw, 2.3rem);
}

.tableau {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 2px solid var(--encre);
  border-radius: 14px;
  background: var(--encre);
  color: var(--papier);
}

.camp {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: 'nom points' 'pastilles points';
  align-items: center;
  column-gap: 10px;
}

.camp-loic {
  grid-template-columns: 1fr auto;
  grid-template-areas: 'points nom' 'points pastilles';
  text-align: right;
}

.camp-nom {
  grid-area: nom;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.camp-points {
  grid-area: points;
  font-family: var(--titre);
  font-size: 2.1rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.camp-manon .camp-points {
  text-align: right;
  color: var(--rose);
}

.camp-points.bump {
  animation: bump 0.45s var(--ressort);
}

@keyframes bump {
  40% {
    transform: scale(1.35);
  }
}

.pastilles {
  grid-area: pastilles;
  display: flex;
  gap: 4px;
}

.camp-loic .pastilles {
  justify-content: flex-end;
}

.pastilles i {
  width: 9px;
  height: 9px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  opacity: 0.55;
}

.camp-manon .pastilles i.marque {
  background: var(--brique);
  border-color: var(--rose);
  opacity: 1;
}

.camp-loic .pastilles i.marque {
  background: var(--papier);
  opacity: 1;
}

.premier-a {
  color: var(--moutarde);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
}

.terrain {
  position: relative;
  align-self: center;
  overflow: hidden;
  border: 2px solid var(--encre);
  border-radius: 16px;
  background: #efe3cf;
  box-shadow: var(--ombre);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.terrain-canvas {
  display: block;
}

.piste {
  --curseur: 34px;
  position: relative;
  display: grid;
  place-items: center;
  height: 68px;
  border-top: 2px solid var(--encre);
  background:
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(255, 250, 242, 0.08) 22px 24px),
    var(--terrain-fonce);
  color: rgba(255, 250, 242, 0.85);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.voile {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  overflow-y: auto;
  background: rgba(244, 236, 223, 0.8);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.voile[hidden] {
  display: none;
}

.voile-carte {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(100%, 340px);
  padding: 18px 18px 20px;
  border: 2px solid var(--encre);
  border-radius: 16px;
  background: var(--papier);
  box-shadow: var(--ombre);
  animation: indice 0.45s var(--ressort) both;
}

.voile-titre {
  font-family: var(--titre);
  font-size: 1.6rem;
  line-height: 1.05;
}

.regles {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 6px;
  padding: 0 0 0 18px;
  font-size: 0.98rem;
  line-height: 1.35;
}

.regles li::marker {
  color: var(--brique);
}

.regles b {
  font-weight: 750;
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 0.3em;
  border: 1.5px solid var(--encre);
  border-radius: 5px;
  font: 700 0.85em var(--texte);
  text-align: center;
}

html.tactile .regle-souris,
html:not(.tactile) .regle-tactile {
  display: none;
}

.voile-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.piste-texte {
  position: absolute;
  top: 7px;
  left: 0;
  right: 0;
  font-size: 0.68rem;
  opacity: 0.8;
  text-align: center;
}

.piste-curseur {
  position: absolute;
  bottom: calc((100% - 18px - env(safe-area-inset-bottom) - var(--curseur)) / 2 + env(safe-area-inset-bottom));
  left: 0;
  width: var(--curseur);
  height: var(--curseur);
  border: 2px solid var(--encre);
  border-radius: 50%;
  background: var(--brique);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
  will-change: transform;
}

.piste-curseur::before,
.piste-curseur::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  border: solid var(--papier);
  border-width: 0 0 2.5px 2.5px;
}

.piste-curseur::before {
  left: 9px;
  transform: translateY(-50%) rotate(45deg);
}

.piste-curseur::after {
  right: 9px;
  transform: translateY(-50%) rotate(-135deg);
}

.commentaire {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  z-index: 1;
  width: fit-content;
  max-width: calc(100% - 24px);
  margin: 0 auto;
  padding: 5px 14px 6px;
  border: 2px solid var(--encre);
  border-radius: 99px;
  background: var(--papier);
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.25;
  text-align: center;
  pointer-events: none;
}

.commentaire:empty {
  display: none;
}

.commentaire.parle {
  animation: parle 0.4s var(--ressort);
}

body[data-etape='match'] {
  overscroll-behavior: none;
}

/* petits téléphones : le titre du match laisse sa place au terrain */
@media (max-height: 620px) {
  .ecran-match h2 {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .ecran-match .tableau {
    padding-block: 6px;
  }
}

/* téléphone : le match prend tout l'écran, terrain bord à bord, bande pour le pouce en bas */
@media (max-width: 719px), (pointer: coarse) and (max-height: 600px) {
  html.verrou,
  html.verrou body {
    overflow: hidden;
    overscroll-behavior: none;
  }

  html.verrou body {
    height: 100vh;
    height: -webkit-fill-available;
    height: 100dvh;
    min-height: 0;
  }

  html.verrou .grain {
    display: none;
  }

  html.verrou main {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    padding: 0;
  }

  .ecran-match {
    flex: 1;
    min-height: 0;
    gap: 8px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }

  .ecran-match .match-tete {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .ecran-match .tableau {
    margin: 0 12px;
    padding: 6px 14px;
  }

  .ecran-match .terrain {
    flex: 1;
    min-height: 0;
    width: 100%;
    border-width: 2px 0 0;
    border-radius: 0;
    box-shadow: none;
  }

  .ecran-match .terrain-canvas {
    position: absolute;
    top: 0;
    left: 0;
  }

  .ecran-match .piste {
    --curseur: 46px;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(98px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
  }

  .ecran-match .piste-texte {
    top: 10px;
    font-size: 0.72rem;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  html.verrou .entete {
    display: none;
  }

  html.verrou .ecran-match {
    padding-top: 6px;
  }

  .ecran-match .piste {
    --curseur: 34px;
    height: calc(64px + env(safe-area-inset-bottom));
  }
}

/* --- Victoire ------------------------------------------------------------ */

.billet-bon {
  transform: rotate(1.2deg);
  background: var(--papier);
}

.ecran-victoire.entre .billet-bon {
  animation: bon 0.9s var(--ressort) 0.25s both;
}

@keyframes bon {
  from {
    opacity: 0;
    transform: translateY(40px) rotate(-6deg) scale(0.9);
  }
}

.bon-titre {
  margin-top: 14px;
  color: var(--brique);
  font-family: var(--titre);
  font-size: clamp(2.1rem, 10vw, 2.7rem);
  line-height: 1;
}

.bon-avec {
  margin-top: 8px;
  font-size: 1.15rem;
  font-weight: 650;
}

.bon-avec span {
  color: var(--encre-2);
  font-weight: 500;
}

.bon-conditions {
  margin-top: 14px;
  color: var(--encre-2);
  font-size: 0.8rem;
  font-style: italic;
}

.tampon-gagne {
  top: 78px;
  right: 12px;
  opacity: 0.92;
  padding: 8px 12px 6px;
  border-color: var(--terrain);
  color: var(--terrain);
  font-size: 0.95rem;
  transform: rotate(-12deg);
}

.ecran-victoire.entre .tampon-gagne {
  animation: tamponne 0.5s cubic-bezier(0.5, 0, 0.75, 0) 1.1s both;
}

@keyframes tamponne {
  from {
    opacity: 0;
    transform: rotate(-12deg) scale(2.4);
  }
}

@keyframes tampon-encre {
  from {
    opacity: 0;
    transform: scale(1.6);
  }
}

.tampon-gagne span {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

/* --- Sac ----------------------------------------------------------------- */

.programme {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
  border: 2px solid var(--encre);
  border-radius: 14px;
  background: var(--papier);
  box-shadow: var(--ombre-basse);
}

.programme li {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 12px 16px;
}

.programme li + li {
  border-top: 2px dashed var(--encre);
}

.programme time {
  flex: none;
  width: 4.6em;
  font-family: var(--titre);
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.programme li:first-child time {
  color: var(--terrain);
}

.programme li:last-child time {
  color: var(--brique);
}

.programme span {
  color: var(--encre-2);
}

.programme b {
  display: block;
  color: var(--encre);
  font-weight: 750;
}

.decompte {
  color: var(--encre-2);
  font-weight: 600;
  text-align: center;
}

.decompte strong {
  color: var(--encre);
  font-weight: 800;
}

.liste-sac {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chose {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 2px solid var(--encre);
  border-radius: 14px;
  background: var(--papier);
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.25s, transform 0.15s;
}

.chose:active {
  transform: scale(0.985);
}

.chose input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.case {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid var(--encre);
  border-radius: 9px;
  background: var(--papier);
  transition: background 0.2s;
}

.case svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--papier);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  transition: stroke-dashoffset 0.3s ease-out 0.05s;
}

.chose input:checked + .case {
  background: var(--terrain);
}

.chose input:checked + .case svg {
  stroke-dashoffset: 0;
}

.chose input:focus-visible + .case {
  outline: 3px solid var(--brique);
  outline-offset: 2px;
}

.chose-texte {
  display: flex;
  flex-direction: column;
  font-weight: 700;
  line-height: 1.25;
}

.chose-texte small {
  color: var(--encre-2);
  font-size: 0.9rem;
  font-weight: 500;
}

.chose.cochee {
  background: #f0eadf;
}

.chose.cochee .chose-texte > span {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--brique);
}

.compteur-sac {
  color: var(--encre-2);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
}

.sac-pret {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
  border: 2px solid var(--encre);
  border-radius: 18px;
  background: var(--brique);
  box-shadow: var(--ombre);
  color: var(--papier);
  animation: indice 0.6s var(--ressort) both;
}

.sac-pret-titre {
  font-family: var(--titre);
  font-size: 2rem;
  line-height: 1;
}

.signature {
  align-self: flex-end;
  font-family: var(--titre);
  font-size: 1.4rem;
  transform: rotate(-4deg);
}

.signature::before {
  content: '— ';
}

.liens-fin {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  color: var(--encre-2);
}

/* --- Fête (confettis et volants) ------------------------------------------ */

.fete {
  position: fixed;
  inset: 0;
  z-index: 10;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.sans-js {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--creme);
  font-family: var(--titre);
  font-size: 1.6rem;
  text-align: center;
}

/* --- Grand écran ----------------------------------------------------------- */

@media (min-width: 720px) {
  main {
    width: min(100%, 520px);
    padding-top: 28px;
  }

  body[data-etape='match'] main {
    width: min(100%, 760px);
  }

  .ecran-match .match-tete,
  .ecran-match .tableau {
    width: min(100%, 520px);
    align-self: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
}
