:root {
  color-scheme: dark;
  --fond: #0f1923; --carte: #1a2633; --carte2: #223142; --bord: #2f4155; --texte: #ece8e1; --doux: #8da0b3;
  --rouge: #ff4655; --bleu: #3aa0ff; --vert: #4cd98c; --jaune: #f5c04a;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fond) url(/fonds/fond-large.jpg) center / cover fixed no-repeat; color: var(--texte); font: 16px/1.4 system-ui, "Segoe UI", sans-serif; }
[hidden] { display: none !important; }
@media (max-width: 700px) { body { background-image: url(/fonds/fond-mobile.jpg); } }
#haut { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--bord); }
#haut .logo { font-weight: 800; letter-spacing: .04em; color: var(--rouge); text-decoration: none; font-size: 20px; }
#haut .moi { color: var(--doux); font-size: 14px; }
main { max-width: 720px; margin: 0 auto; padding: 16px; }
h1 { font-size: 24px; margin: 8px 0 16px; }
h2 { font-size: 18px; margin: 20px 0 10px; }
body::before { content: ""; position: fixed; inset: 0; background: url(/fonds/grain.png); pointer-events: none; z-index: 5; }
#haut, main { position: relative; z-index: 1; }
.carte { background-color: var(--carte); background-image: url(/fonds/coin.png), url(/fonds/hachures.png);
  background-repeat: no-repeat, repeat; background-position: top left, 0 0;
  border: 1px solid var(--bord); border-radius: 12px; padding: 16px; margin-bottom: 14px; box-shadow: 0 6px 24px #0006; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--carte); border: 1px solid var(--bord); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 26px; }
.scene { min-height: 230px; display: grid; place-items: center; margin-bottom: 14px; }
.tirage { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tirage img { width: 150px; height: 150px; border-radius: 18px; background: var(--carte); border: 2px solid var(--bord); }
.tirage b { font-size: 26px; } .tirage.fige img { border-color: var(--rouge); box-shadow: 0 0 28px #ff465566; }
.puce { display: inline-flex; align-items: center; gap: 6px; background: var(--carte2); border: 1px solid var(--bord); border-radius: 99px; padding: 3px 10px 3px 4px; font-size: 14px; }
.puce img { width: 26px; height: 26px; border-radius: 50%; }
button.reponse { display: block; width: 100%; text-align: left; margin: 8px 0; }
button.reponse.juste { background: #1f6b46; border-color: var(--vert); color: #fff; opacity: 1; }
button.reponse.faux { background: #7a2630; border-color: var(--rouge); color: #fff; opacity: 1; }
.presence { font-size: 10px; } .presence.on { color: var(--vert); } .presence.off { color: var(--doux); opacity: .6; }
details.carte > summary { margin-top: 0; }
.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.tuile { aspect-ratio: 1 / 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; padding: 20px;
  border-radius: 16px; border: 1px solid var(--bord); text-decoration: none; color: var(--texte); position: relative; overflow: hidden;
  background: url(/fonds/coin.png) top left / 96px no-repeat, url(/fonds/hachures.png), linear-gradient(160deg, #3a1c26, var(--carte) 65%);
  box-shadow: 0 8px 28px #0007; transition: transform .15s, border-color .15s; }
.tuile:hover, .tuile:focus-visible { transform: translateY(-4px); border-color: var(--rouge); outline: none; }
.tuile .icone { font-size: 64px; margin-bottom: auto; margin-top: 18px; line-height: 1; }
.tuile b { font-size: 26px; letter-spacing: .02em; }
.etiquette-jeu { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--rouge); }
.tuile .jouer { color: var(--rouge); font-weight: 800; margin-top: 6px; }
@media (max-width: 520px) {   /* telephone : deux carres par ligne */
  .tuiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tuile { aspect-ratio: auto; min-height: 210px; padding: 14px; }
  .tuile .icone { font-size: 42px; margin-top: 14px; } .tuile b { font-size: 19px; } .tuile .doux { font-size: 12px; }
}
#tirage-lancement { position: fixed; inset: 0; z-index: 20; background: #000c; display: grid; place-items: center; padding: 16px; overflow: auto; }
#tirage-lancement .carte { max-width: 560px; width: 100%; text-align: center; }
.tirages { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.tirages .tirage { width: 130px; gap: 6px; } .tirages .tirage img { width: 96px; height: 96px; } .tirages .tirage b { font-size: 18px; }
@keyframes monte { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes chute { from { top: -4vh; opacity: 1; } to { top: 104vh; opacity: .9; } }
@keyframes eclat { 0%, 100% { box-shadow: 0 0 0 #f5c04a00; } 50% { box-shadow: 0 0 22px #f5c04a66; } }
@media (prefers-reduced-motion: no-preference) {
  .podium { animation: monte .5s ease-out both; animation-delay: calc(var(--i, 0) * 140ms); }
  .podium.premier { animation: monte .5s ease-out both, eclat 2.4s ease-in-out 1s infinite; }
  .tuile { animation: monte .45s ease-out backwards; animation-delay: calc(var(--i, 0) * 90ms); }   /* « backwards » : ne bloque pas l'effet au survol */
  .carte.resultat { animation: pop .35s ease-out; }
  button:active, .bouton:active { transform: scale(.97); }
}
#confettis { position: fixed; inset: 0; z-index: 25; pointer-events: none; overflow: hidden; }
#confettis i { position: absolute; top: -4vh; width: 9px; height: 15px; border-radius: 2px; animation: chute linear forwards; }
.tuto { text-align: center; animation: monte .35s ease-out; } .tuto h1 { margin: 6px 0 12px; } .tuto p { font-size: 17px; text-align: left; }
.tuto-icone { font-size: 72px; line-height: 1; animation: pop .4s ease-out; }
.points-tuto { display: flex; gap: 8px; justify-content: center; margin: 4px 0 14px; }
.point { width: 10px; height: 10px; border-radius: 50%; background: var(--bord); cursor: pointer; transition: background .2s, transform .2s; }
.point.actif { background: var(--rouge); transform: scale(1.4); }
.map-partie { margin-top: 6px; font-size: 17px; }
#tirage-map { position: fixed; inset: 0; z-index: 20; background: #000c; display: grid; place-items: center; padding: 16px; }
#tirage-map .carte { text-align: center; min-width: 280px; }
.map-nom { font-size: 40px; font-weight: 900; letter-spacing: .06em; margin: 14px 0; color: var(--doux); transition: color .2s; }
.map-nom.fige { color: var(--jaune); text-shadow: 0 0 24px #f5c04a66; }
#ecran-neutre { position: fixed; inset: 0; z-index: 100; background: #111; color: #333; display: grid; place-items: end center; padding: 20px; font-size: 12px; cursor: pointer; }
#role-reveal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; text-align: center; cursor: pointer;
  background: #000d; transition: background .4s; }
#role-reveal.troll { background: radial-gradient(circle at 50% 40%, #7a1020, #1a0509 70%); }
#role-reveal.innocent { background: radial-gradient(circle at 50% 40%, #124a7a, #05121c 70%); }
#role-reveal .role-icone { font-size: 84px; line-height: 1; }
#role-reveal .role-titre { font-size: 30px; font-weight: 900; letter-spacing: .08em; margin: 14px 0 8px; }
#role-reveal.suspense .role-titre { animation: pulse 0.9s ease-in-out infinite alternate; color: var(--doux); font-size: 22px; }
#role-reveal.troll .role-titre, #role-reveal.innocent .role-titre { animation: pop .35s ease-out; }
#role-reveal.troll .role-titre { color: #ff98a3; text-shadow: 0 0 24px #ff4655aa; }
#role-reveal.innocent .role-titre { color: #b5e0ff; text-shadow: 0 0 24px #3aa0ffaa; }
#role-reveal.troll .role-titre, #role-reveal.innocent .role-titre { font-size: 34px; }
@keyframes pulse { from { opacity: .35; } to { opacity: 1; } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.podium { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--bord); }
.podium:last-child { border-bottom: 0; } .podium .rang { width: 38px; text-align: center; font-size: 26px; font-weight: 800; }
.podium img, .podium .vide { width: 48px; height: 48px; border-radius: 10px; flex: none; background: var(--fond); display: grid; place-items: center; }
.podium .nom-joueur { flex: 1; } .podium .pts { font-size: 22px; font-weight: 800; }
.podium.premier { background: linear-gradient(90deg, #f5c04a22, transparent); border-radius: 10px; }
#muet, #musique { background: none; border: 1px solid var(--bord); color: var(--doux); padding: 4px 9px; font-size: 16px; margin-left: 8px; }
#reglages { display: inline-block; border: 1px solid var(--bord); border-radius: 8px; color: var(--texte); padding: 4px 9px; font-size: 14px; margin-left: 8px; text-decoration: none; }
#reglages:hover { border-color: var(--rouge); }
@media (max-width: 520px) { #haut .moi { font-size: 12px; } #reglages { padding: 4px 7px; font-size: 13px; margin-left: 4px; } }
.doux { color: var(--doux); font-size: 14px; }
.erreur { color: var(--rouge); } .ok { color: var(--vert); }
input[type=text], input[type=password], input[type=tel], select, textarea {
  width: 100%; padding: 11px 12px; border-radius: 8px; border: 1px solid var(--bord); background: var(--fond);
  color: inherit; font-size: 16px; }
input.code { letter-spacing: .5em; text-align: center; }
textarea { resize: vertical; font-family: inherit; }
.choix input[type=checkbox], .choix input[type=radio] { flex: none; width: 18px; }
label { display: block; margin: 10px 0 4px; color: var(--doux); font-size: 14px; }
button, .bouton {
  display: inline-block; padding: 11px 16px; border: 0; border-radius: 8px; background: var(--rouge); color: #fff;
  font-size: 16px; font-weight: 600; cursor: pointer; text-decoration: none; }
button.second, .bouton.second { background: var(--carte2); color: var(--texte); border: 1px solid var(--bord); }
button.petit { padding: 6px 10px; font-size: 14px; }
button:disabled { opacity: .45; cursor: not-allowed; }
.rangee { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.rangee > input { flex: 1; min-width: 120px; }
.code-partie { font-size: 34px; font-weight: 800; letter-spacing: .25em; color: var(--jaune); }
.equipe-A { --e: var(--rouge); } .equipe-B { --e: var(--bleu); } .equipe-O { --e: #6b7c8f; }
.etiquette { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 13px; font-weight: 700; color: #fff; background: var(--e, var(--bord)); }
.joueur { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--bord); }
.joueur:last-child { border-bottom: 0; }
.joueur img, .agent img { width: 40px; height: 40px; border-radius: 8px; background: var(--fond); }
.joueur .vide { width: 40px; height: 40px; border-radius: 8px; background: var(--fond); display: grid; place-items: center; color: var(--doux); }
.petit-select { width: auto; padding: 4px 8px; font-size: 13px; }
.joueur .nom { font-weight: 600; } .joueur select { margin-top: 4px; padding: 6px 8px; font-size: 14px; }
.equipes { display: flex; gap: 6px; }
.equipes button { padding: 6px 12px; font-size: 14px; background: var(--carte2); color: var(--texte); border: 1px solid var(--bord); }
.equipes button.actif { background: var(--e); border-color: var(--e); color: #fff; }
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.agent { text-align: center; padding: 6px 4px; border: 2px solid transparent; border-radius: 10px; background: var(--carte2); cursor: pointer; font-size: 12px; user-select: none; }
.agent img { width: 56px; height: 56px; display: block; margin: 0 auto 2px; opacity: .45; filter: grayscale(.8); }
.agent.choisi { border-color: var(--vert); } .agent.choisi img { opacity: 1; filter: none; }
.agent.incertain { border-color: var(--jaune); }
.defi { border: 2px solid var(--e, var(--rouge)); background: linear-gradient(135deg, #2a1a22, var(--carte)); }
.carte .nom { font-size: 20px; font-weight: 800; margin: 4px 0; } .carte .secret { font-size: 12px; font-weight: 700; letter-spacing: .06em; }
.defi .nom { font-size: 22px; font-weight: 800; } .defi .secret { color: var(--jaune); font-size: 13px; font-weight: 700; letter-spacing: .08em; }
.score { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--bord); }
.score:last-child { border-bottom: 0; } .score .pts { font-weight: 800; }
.pos { color: var(--vert); } .neg { color: var(--rouge); }
.choix { display: flex; align-items: center; gap: 10px; padding: 9px 10px; margin: 6px 0; border: 2px solid var(--bord); border-radius: 10px; cursor: pointer; }
.choix.actif { border-color: var(--e, var(--vert)); background: var(--carte2); }
.choix img, .choix .vide { width: 36px; height: 36px; border-radius: 8px; flex: none; background: var(--fond); display: grid; place-items: center; }
.choix input { accent-color: var(--e, var(--rouge)); width: 18px; height: 18px; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #000d; border: 1px solid var(--bord);
  padding: 10px 16px; border-radius: 10px; max-width: 90vw; z-index: 9; }
#toast.mauvais { border-color: var(--rouge); }
details summary { cursor: pointer; color: var(--doux); margin-top: 12px; }
table { width: 100%; border-collapse: collapse; } td, th { padding: 8px 6px; border-bottom: 1px solid var(--bord); text-align: left; }
td.n, th.n { text-align: right; }
