/* Famille Zwiiip : styles communs des pages participant (accueil, entrée, en-tête de jeu, fenêtres). */
@font-face {
  font-family: "Bricolage"; src: url("bricolage.woff2") format("woff2");
  font-weight: 200 800; font-display: swap;
}
:root {
  /* Couleurs de la famille ; chaque jeu définit en plus --marque, --marque-nuit et --vif. */
  --encre: #1b1340; --vrai: #1fdd9b; --faux: #ff4f6e; --papier: #fffdf7;
  --sortie: cubic-bezier(.23, 1, .32, 1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* L'appli occupe exactement l'écran : le document lui-même ne défile jamais et ne rebondit pas (iPhone compris). */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  margin: 0; background: var(--marque); color: #fff; overflow: hidden;
  font-family: "Bricolage", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none; touch-action: manipulation;
}
.ecran {
  position: relative; z-index: 1; height: 100%; height: 100dvh; display: flex; flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  max-width: 520px; margin: 0 auto;
}

/* Le nom, en autocollant */
.marque {
  display: inline-block; align-self: flex-start; background: var(--vif); color: var(--encre);
  font-weight: 800; font-size: 64px; line-height: 1; letter-spacing: -3px; padding: 6px 18px 12px;
  border: 3px solid var(--encre); border-radius: 18px; box-shadow: 7px 7px 0 var(--encre);
  transform: rotate(-5deg); margin: 0;
}

/* Entrée */
/* Accueil : deux portes côte à côte. « Je participe » passe en premier (c'est le cas le plus fréquent),
   « J'anime » est posée à côté comme une seconde carte. Avec un lien ou un QR code de salle, seule la première reste. */
/* La zone qui défile occupe toute la largeur de la fenêtre : ainsi rien ne rogne l'autocollant quand il se balance.
   Le contenu, lui, est centré dans .accueil. */
#ecran-entree { max-width: none; padding-inline: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
#ecran-entree.fige { overflow-y: hidden; }      /* tout tient à l'écran : aucun défilement possible, rien ne bouge */
/* Appli installée : un peu d'air sous la barre d'état du téléphone, pour que rien ne vienne s'y coller */
@media (display-mode: standalone) { .ecran { padding-top: max(20px, calc(env(safe-area-inset-top) + 8px)); } }
.accueil { flex: 1 0 auto; width: 100%; max-width: 940px; margin: 0 auto; padding-inline: 18px; display: flex; flex-direction: column; gap: 24px; }
#ecran-entree.invite .accueil { max-width: 520px; }
/* Par défaut l'en-tête est centré : l'autocollant a la même place pour se balancer des deux côtés. */
.entete { margin-top: auto; flex: none; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.entete .marque { align-self: center; }
.portes { flex: none; display: grid; gap: 22px; padding: 0 8px 8px 0; }
.porte {
  display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 20px 20px 22px; color: var(--encre);
  border: 3px solid var(--encre); border-radius: 26px; box-shadow: 8px 8px 0 var(--encre);
  animation: pose .45s var(--sortie) backwards;
}
.porte h2 { margin: 0; font-size: 30px; line-height: 1.05; letter-spacing: -.025em; }
.porte .aide { margin: 0 0 4px; font-size: 16px; line-height: 1.35; font-weight: 500; }
.participer { background: var(--papier); }
.animer { background: var(--vif); transform: rotate(1.4deg); animation-delay: .08s; transition: transform .28s var(--sortie), box-shadow .28s var(--sortie); }
.animer .principal {
  display: block; margin-top: auto; text-align: center; text-decoration: none;
  background: var(--encre); color: #fff; box-shadow: 5px 5px 0 var(--marque);
}
.animer .principal:active { box-shadow: 2px 2px 0 var(--marque); }
.animer .atouts { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 15px; font-weight: 600; }
.animer .atouts li { display: flex; gap: 8px; align-items: baseline; }
.animer .atouts li::before { content: ""; flex: none; width: 9px; height: 9px; border-radius: 3px; background: var(--encre); transform: rotate(45deg) translateY(-1px); }
#ecran-entree.invite .animer { display: none; }
@keyframes pose { from { opacity: 0; transform: translateY(18px) rotate(-3deg) scale(.97); } }
@media (min-width: 860px) {
  #ecran-entree:not(.invite) .portes { grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); align-items: stretch; gap: 28px; }
  /* Logo et accroche côte à côte, centrés : l'autocollant a de la place des deux côtés, et l'écart évite qu'il couvre le texte. */
  #ecran-entree:not(.invite) .entete { flex-direction: row; align-items: center; justify-content: center; gap: 150px; }
  #ecran-entree:not(.invite) .accroche { align-items: flex-start; text-align: left; }
  .porte { padding: 24px 24px 26px; }
}
@media (max-width: 859px) {      /* téléphone et tablette à la verticale : une colonne, carte animateur en bande compacte */
  .accueil { max-width: 560px; }
  .animer { flex-direction: row; align-items: center; gap: 14px; padding: 14px 16px 16px; transform: rotate(.8deg); }
  .animer h2 { font-size: 22px; flex: 1; }
  .animer .aide, .animer .atouts { display: none; }
  .animer .principal { margin: 0; font-size: 17px; padding: 10px 16px 12px; white-space: nowrap; box-shadow: 4px 4px 0 var(--marque); }
}
@media (max-width: 480px) {      /* téléphone : on resserre pour que tout tienne sans défiler */
  .accueil { gap: 12px; }
  .entete { gap: 18px; }       /* assez d'écart pour que l'autocollant incliné ne touche pas le texte */
  #ecran-entree .marque { font-size: 48px; padding: 4px 14px 9px; box-shadow: 6px 6px 0 var(--encre); }
  .accroche { font-size: 18px; line-height: 1.25; gap: 0; }
  .portes { gap: 14px; }
  .porte { padding: 14px 16px 16px; gap: 8px; }
  .porte h2 { font-size: 25px; }
  .porte .aide { font-size: 15px; margin: 0; }
  #ecran-entree form { gap: 10px; }
  #ecran-entree label { gap: 4px; font-size: 14px; }
  #ecran-entree input { font-size: 20px; padding: 10px 14px; }
  #ecran-entree .participer .principal { font-size: 19px; padding: 12px; margin-top: 2px; }
  .animer { padding: 11px 14px 13px; }
  .installer button { font-size: 14px; padding: 5px 14px 7px; }
  .signature { padding-top: 2px; font-size: 13px; line-height: 1.4; }
}
@media (hover: hover) and (pointer: fine) {
  #ecran-entree .principal:hover { transform: translate(-1px, -1px); }
  .animer:hover { transform: rotate(0deg) translate(-2px, -3px); box-shadow: 11px 12px 0 var(--encre); }   /* la carte se redresse et se soulève */
}
@media (prefers-reduced-motion: reduce) { .porte { animation: none; } }
.signature { margin: auto 0 0; padding-top: 18px; flex: none; text-align: center; font-size: 14px; line-height: 1.5; color: rgba(255, 255, 255, .85); }
.signature a { color: #fff; font-weight: 700; text-underline-offset: 3px; }
.accroche { margin: 0; font-size: 21px; line-height: 1.3; font-weight: 500; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
/* Chaque ligne de l'accroche s'allume quand l'autocollant part de son côté */
.accroche span { padding: 0 8px 2px; border-radius: 10px; border: 2px solid transparent;
  transition: background-color .14s ease, color .14s ease, border-color .14s ease, transform .2s var(--sortie); }
#ecran-entree .marque { touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; will-change: transform; }
#ecran-entree .marque:active { cursor: grabbing; }
form { display: flex; flex-direction: column; gap: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 15px; font-weight: 600; }
input {
  font: inherit; font-size: 22px; font-weight: 600; padding: 13px 16px; width: 100%;
  border: 3px solid var(--encre); border-radius: 14px; background: var(--papier); color: var(--encre);
}
input:focus { outline: 3px solid var(--vif); outline-offset: 2px; }
button:focus-visible { outline: 3px solid var(--vif); outline-offset: 3px; }
#code { text-transform: uppercase; letter-spacing: 10px; font-weight: 800; text-align: center; }
#code::placeholder { color: rgba(27, 19, 64, .22); }
.principal {
  font: inherit; font-size: 21px; font-weight: 800; padding: 15px; cursor: pointer; margin-top: 4px;
  border: 3px solid var(--encre); border-radius: 14px; background: var(--vif); color: var(--encre);
  box-shadow: 5px 5px 0 var(--encre); transition: transform .1s ease-out, box-shadow .1s ease-out;
}
.principal:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--encre); }
.principal:disabled { opacity: .55; }
#erreur-entree { margin: 0; font-size: 15px; font-weight: 600; color: #c2183a; }
#erreur-entree:empty { display: none; }

/* Reprise : la partie en cours reste à un geste */
.reprise { display: flex; flex-direction: column; gap: 10px; }
.reprise-qui { margin: 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 16px; font-weight: 500; }
.reprise-qui b { font-weight: 800; overflow-wrap: anywhere; }
.reprise-code { font-size: 22px; font-weight: 800; letter-spacing: .18em; padding: 4px 8px 6px 12px; background: var(--vif);
  border: 2.5px solid var(--encre); border-radius: 12px; }
.lien-clair { align-self: center; font: inherit; font-size: 15px; font-weight: 700; color: var(--encre); background: none; border: 0;
  padding: 4px 8px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
#ecran-entree.reprend #form-entree { display: none; }
.reprise[hidden], .apres[hidden] { display: none; }

/* Jeu */
#btn-accueil { flex: none; width: 40px; height: 40px; padding: 0; display: grid; place-items: center; cursor: pointer;
  color: #fff; background: var(--marque-nuit); border: 2px solid rgba(255, 255, 255, .55); border-radius: 50%; transition: transform .1s ease-out, background-color .15s ease; }
#btn-accueil:active { transform: scale(.92); }
#btn-accueil svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) and (pointer: fine) { #btn-accueil:hover { background: var(--encre); } }
.apres { display: flex; justify-content: center; padding-right: 6px; }
.apres button { flex: 1; max-width: 420px; font: inherit; font-size: 21px; font-weight: 800; padding: 16px 8px; cursor: pointer; color: var(--encre);
  background: var(--vif); border: 3px solid var(--encre); border-radius: 16px; box-shadow: 5px 5px 0 var(--encre); transition: transform .1s ease-out, box-shadow .1s ease-out; }
.apres button:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--encre); }
#ecran-jeu.fini .choix { display: none; }
.tete { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 18px; }
#moi-prenom { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#moi-score {
  background: var(--vif); color: var(--encre); font-weight: 800; white-space: nowrap;
  padding: 4px 12px; border: 2px solid var(--encre); border-radius: 999px;
}
/* Bouton du son : jaune avec des ondes quand il est actif, sombre avec une croix quand il est coupé */
#btn-son { flex: none; width: 40px; height: 40px; padding: 0; display: grid; place-items: center; cursor: pointer;
  color: var(--encre); background: var(--vif); border: 2px solid var(--encre); border-radius: 50%;
  transition: background-color .15s ease, color .15s ease, transform .1s ease-out; }
#btn-son:active { transform: scale(.92); }
#btn-son svg { width: 24px; height: 24px; display: block; overflow: visible; }
#btn-son .ondes, #btn-son .croix { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round;
  transform-box: fill-box; transform-origin: left center; transition: opacity .15s ease, transform .18s var(--sortie); }
#btn-son .croix { opacity: 0; transform: scale(.5); transform-origin: center; }
#btn-son[aria-pressed="false"] { background: var(--marque-nuit); color: rgba(255, 255, 255, .8); }
#btn-son[aria-pressed="false"] .ondes { opacity: 0; transform: scale(.6); }
#btn-son[aria-pressed="false"] .croix { opacity: 1; transform: none; }
#barre { height: 14px; border-radius: 999px; background: var(--marque-nuit); border: 2px solid var(--encre); margin: 14px 0 6px; overflow: hidden; }
#barre-in { height: 100%; background: var(--vif); transform-origin: left center; transform: scaleX(0); will-change: transform; }
#barre-in.urgent { background: var(--faux); }
#barre-in.libre { background: repeating-linear-gradient(-45deg, var(--vif) 0 10px, #f6ff9a 10px 20px); }   /* sans limite : rien ne presse */
#podium .temps { flex: none; white-space: nowrap; font-size: 14px; opacity: .7; font-variant-numeric: tabular-nums; align-self: center; }
#podium .nom { flex: 1; min-width: 0; text-align: left; overflow: hidden; overflow-wrap: anywhere; line-height: 1.2;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
#podium .score { flex: none; white-space: nowrap; font-variant-numeric: tabular-nums; align-self: center; }
#btn-partir { align-self: center; margin-top: 12px; font: inherit; font-size: 14px; font-weight: 600; color: rgba(255, 255, 255, .85);
  background: none; border: 0; padding: 4px 10px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
#sortie, #aide-installer { width: min(380px, calc(100vw - 36px)); padding: 22px 22px 20px; color: var(--encre); background: var(--papier);
  border: 3px solid var(--encre); border-radius: 24px; box-shadow: 8px 8px 0 var(--encre); font-family: inherit; }
#sortie::backdrop, #aide-installer::backdrop { background: rgba(27, 19, 64, .72); }
#sortie h2, #aide-installer h2 { margin: 0 0 10px; font-size: 26px; letter-spacing: -.02em; }
#sortie p, #aide-installer p { margin: 0 0 18px; font-size: 17px; line-height: 1.4; }
#sortie .actions, #aide-installer .actions { display: flex; gap: 12px; }
#sortie button, #aide-installer button { flex: 1; font: inherit; font-size: 17px; font-weight: 800; padding: 12px 8px 14px; cursor: pointer; color: var(--encre);
  border: 3px solid var(--encre); border-radius: 14px; box-shadow: 4px 4px 0 var(--encre); transition: transform .1s ease-out, box-shadow .1s ease-out; }
#sortie button:active, #aide-installer button:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--encre); }
#sortie-non, #installer-ok { background: var(--vif); }
#aide-installer ol { margin: 0 0 18px; padding-left: 22px; font-size: 17px; line-height: 1.5; }
#aide-installer li { padding-left: 4px; }
/* Invitation à installer : un simple lien sous les cartes, absent quand l'appli est déjà installée ou qu'on arrive par un QR code */
.installer { margin: 0; flex: none; text-align: center; }
.installer button { font: inherit; font-size: 15px; font-weight: 700; color: #fff; background: rgba(27, 19, 64, .28); cursor: pointer;
  border: 2px solid rgba(255, 255, 255, .55); border-radius: 999px; padding: 6px 16px 8px; transition: background-color .15s ease, transform .1s ease-out; }
.installer button:active { transform: scale(.97); }
#ecran-entree.invite .installer { display: none; }
@media (hover: hover) and (pointer: fine) { .installer button:hover { background: rgba(27, 19, 64, .5); } }
#sortie-oui { background: var(--faux); }
#podium { list-style: none; margin: 4px 0 0; padding: 0; width: 100%; max-width: 300px; font-size: 19px; }
#podium li { display: flex; gap: 12px; padding: 6px 0; border-bottom: 2px solid rgba(27, 19, 64, .15); }
#podium li.moi { font-weight: 800; }
#podium li:nth-child(n+4):not(.moi) { display: none; }     /* le podium, plus sa propre ligne si on n'y est pas */
@media (max-height: 640px) {
  #podium li:nth-child(n+4) { display: none; }
  .accueil { gap: 16px; }
  .entete { gap: 12px; }
  .porte { padding: 14px 16px 16px; gap: 8px; }
  .porte h2 { font-size: 24px; }
  .porte .aide { font-size: 15px; margin: 0; }
  .marque { font-size: 46px; padding: 4px 14px 9px; }
  .accroche { font-size: 17px; }
  form { gap: 10px; }
  input { font-size: 20px; padding: 9px 14px; }
  .principal { padding: 11px; }
  .signature { padding-top: 8px; font-size: 13px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  #podium { display: none; }
  .marque { font-size: 44px; }
  .accueil { gap: 16px; }
}
#hors-ligne { position: fixed; z-index: 3; left: 0; right: 0; bottom: 0; background: var(--encre); text-align: center; padding: 8px; font-size: 14px; }
/* Très petit téléphone (320 px) : la carte « J'anime » garde son bouton à l'intérieur */
@media (max-width: 360px) {
  .animer { gap: 10px; }
  .animer h2 { font-size: 20px; }
  .animer .principal { font-size: 15px; padding: 9px 12px 11px; }
}
