/* ============================================================================
   Qui est l'intrus ? — le téléphone (v3, bleu nuit du dragon) : un geste par
   écran, de gros boutons en relief, le dragon qui parle dans une bulle crème,
   des tuiles avec la photo de chacun, la carte secrète sous un cadeau.
   Rien ne trahit le camp à l'écran tant qu'on ne pose pas le doigt dessus.
   ========================================================================== */
body {
  min-height: 100vh; min-height: 100dvh;
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
}
#app { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; padding-bottom: max(26px, env(safe-area-inset-bottom)); }
.chargement { text-align: center; margin-top: 30vh; color: var(--texte-2); font-family: var(--rond); }

/* --------------------------------------------------------------- en-tête */
.entete { display: grid; grid-template-columns: 50px 1fr 50px; align-items: center; gap: 6px; min-height: 54px; }
.entete .titre { display: flex; align-items: center; justify-content: center; gap: 6px; font-family: var(--rond); font-weight: 800; font-size: 24px; color: var(--or); text-shadow: 0 2px 0 var(--or-levre), 0 4px 0 var(--contour); white-space: nowrap; }
.entete .titre .emo { width: 34px; height: 34px; }
.bouton-carre { position: relative; width: 50px; height: 50px; border-radius: 16px; border: 3px solid var(--contour); background: var(--surface-2); box-shadow: inset 0 -4px 0 var(--surface), 0 3px 0 var(--contour); display: flex; align-items: center; justify-content: center; padding: 0; }
.bouton-carre:active { transform: translateY(3px); box-shadow: inset 0 -2px 0 var(--surface), 0 0 0 var(--contour); }
.bouton-carre .emo { width: 34px; height: 34px; }
.bouton-carre.coupe .emo { filter: grayscale(1) opacity(.45); }
.bouton-carre.coupe::after { content: ''; position: absolute; left: 10px; right: 10px; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: var(--rouge); transform: rotate(-40deg); box-shadow: 0 0 0 2px var(--contour); }
.connexion { justify-self: center; font-family: var(--rond); font-size: 14px; font-weight: 700; color: #3b2a00; background: var(--or); border: 2px solid var(--contour); border-radius: 999px; padding: 1px 12px; box-shadow: 0 2px 0 var(--contour); }
.connexion:empty { display: none; }

/* -------------------------------------------- textes et dragon bavard */
h1, h2, h3 { margin: 0; font-family: var(--rond); font-weight: 800; line-height: 1.1; }
h1 { font-size: 31px; }
h2 { font-size: 25px; }
h3 { font-size: 20px; }
.aide { color: var(--texte-2); margin: 0; font-size: 17px; font-weight: 700; }
.centre { text-align: center; }
/* le dragon qui parle dans une bulle crème (comme dans le kit) */
.parle { display: flex; align-items: flex-end; gap: 6px; }
.parle .dragon, .parle .emote { flex: none; margin-left: -6px; }
.bulle {
  position: relative; flex: 1; margin-bottom: 26px; padding: 13px 16px; border-radius: 22px;
  background: var(--creme); color: var(--sur-creme); border: 3px solid var(--contour); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .07), 0 4px 0 var(--contour);
  font-family: var(--rond); font-weight: 700; font-size: 21px; line-height: 1.15;
  animation: bulle-pop .45s var(--ressort) .25s both; transform-origin: 0 100%;
}
.bulle::before { content: ''; position: absolute; left: -14px; bottom: 18px; border: 12px solid transparent; border-right-color: var(--contour); border-left: 0; }
.bulle::after { content: ''; position: absolute; left: -9px; bottom: 21px; border: 9px solid transparent; border-right-color: var(--creme); border-left: 0; }
.bulle small { display: block; margin-top: 5px; font-family: var(--texte-f); font-weight: 800; font-size: 16px; line-height: 1.3; color: #4a5688; }
@keyframes bulle-pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }

/* widgets colorés (minuteur, points) : gros chiffre, icône, dragon qui dépasse */
.widget { position: relative; overflow: hidden; border-radius: 24px; padding: 15px 18px; color: #fff; min-height: 118px; display: flex; flex-direction: column; justify-content: center; border: 3px solid var(--contour); }
.widget::after { content: ''; position: absolute; left: 14px; right: 40%; top: 7px; height: 12px; border-radius: 999px; background: rgba(255, 255, 255, .22); pointer-events: none; }
.widget.bleu { background: linear-gradient(160deg, #5a8cff, var(--bleu) 55%, #2350d6); box-shadow: inset 0 -6px 0 var(--bleu-levre), 0 5px 0 var(--contour); }
.widget.or { background: linear-gradient(160deg, #ffe066, var(--or) 55%, #f5b800); box-shadow: inset 0 -6px 0 var(--or-levre), 0 5px 0 var(--contour); color: #3b2a00; }
.widget.violet { background: linear-gradient(160deg, #c49bff, var(--violet) 60%, #8a4fe6); box-shadow: inset 0 -6px 0 var(--violet-levre), 0 5px 0 var(--contour); }
.widget .gros { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; font-family: var(--rond); font-weight: 800; font-size: 44px; line-height: 1; text-shadow: 0 3px 0 rgba(0, 0, 0, .16); font-variant-numeric: tabular-nums; }
.widget.or .gros { text-shadow: 0 2px 0 rgba(255, 255, 255, .5); }
.widget .gros .emo { width: 48px; height: 48px; }
.widget .sous { position: relative; z-index: 1; margin-top: 4px; font-family: var(--rond); font-weight: 700; font-size: 18px; opacity: .96; max-width: 62%; line-height: 1.15; }
.widget .dragon, .widget .emote { position: absolute; right: -6px; bottom: -10px; z-index: 1; }
.widget .barre { position: relative; z-index: 1; margin-top: 11px; height: 16px; max-width: 62%; background: rgba(5, 12, 53, .35); }
.widget .barre > i { --c: #fff; }

/* ------------------------------------------------------- champ, puces */
input[type=text], input[type=search], input[type=tel], select {
  width: 100%; min-height: 58px; border-radius: 18px; border: 3px solid var(--contour); box-shadow: inset 0 0 0 2px var(--bord), inset 0 4px 0 rgba(0, 0, 0, .25);
  background: #0d1f63; padding: 10px 16px; font-size: 20px; font-weight: 800; color: var(--texte); font-family: var(--texte-f);
}
input:focus, select:focus { outline: none; box-shadow: inset 0 0 0 3px var(--citron), 0 0 0 3px rgba(143, 222, 2, .25); }
input::placeholder { color: #7186c9; font-weight: 700; }
.puces { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px; scrollbar-width: none; }
.puces::-webkit-scrollbar { display: none; }

/* ------------------------------------------------- la liste des prénoms */
.groupe-titre { display: flex; align-items: center; gap: 8px; font-family: var(--rond); font-weight: 700; font-size: 16px; color: var(--citron-clair); letter-spacing: .08em; text-transform: uppercase; margin: 8px 4px 0; }
.groupe-titre::after { content: ''; flex: 1; height: 3px; border-radius: 2px; background: var(--bord); opacity: .6; }
.noms { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.noms .tuile { min-height: 66px; padding: 8px 10px; }
.noms .tuile .nm { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.noms .tuile.prise .avatar { filter: grayscale(1); }
.vide { color: var(--texte-3); text-align: center; padding: 18px 0; font-family: var(--rond); }

/* --------------------------------------- la carte secrète (camp + mot)
   Neutre au repos : un cadeau qui gigote. Doigt posé : le camp et le mot. */
.secret { display: flex; flex-direction: column; gap: 10px; }
.secret .titre-secret { display: flex; align-items: center; gap: 8px; font-family: var(--rond); font-weight: 800; font-size: 21px; color: var(--or); }
.secret .titre-secret .emo { width: 30px; height: 30px; }
.mot-zone {
  position: relative; min-height: 196px; border-radius: 20px; border: 3px dashed rgba(255, 204, 26, .75); background: radial-gradient(circle at 50% 40%, rgba(255, 204, 26, .14), rgba(5, 12, 53, .35) 75%);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 14px; overflow: hidden;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: pan-y; cursor: pointer;
}
.mot-zone .cadeau { width: 110px; height: 110px; transition: transform .35s var(--ressort), opacity .25s ease; animation: gigote 3.2s ease-in-out infinite; transform-origin: 50% 85%; }
.mot-zone .invite-txt { color: var(--texte-2); font-family: var(--rond); font-weight: 700; font-size: 17px; line-height: 1.2; max-width: 290px; transition: opacity .2s ease; }
.mot-zone .revele {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px 12px;
  opacity: 0; transform: scale(.6); transition: transform .4s var(--ressort), opacity .2s ease; pointer-events: none;
}
.mot-zone .revele .camp-tete { display: flex; align-items: center; gap: 8px; }
.mot-zone .revele .camp-tete .emo { width: 48px; height: 48px; }
.mot-zone .revele .camp-tete .emote { margin: -6px 0 -10px; }
.mot-zone .revele .tu { font-family: var(--rond); font-weight: 700; font-size: 15px; color: var(--texte-2); line-height: 1; }
.mot-zone .revele .nomcamp { font-family: var(--rond); font-weight: 800; font-size: 30px; line-height: 1; letter-spacing: .03em; }
.mot-zone .revele .but { font-weight: 800; font-size: 14px; line-height: 1.25; color: var(--texte-2); max-width: 320px; }
.mot-zone .revele .lib-mot { margin-top: 4px; font-family: var(--rond); font-weight: 700; font-size: 14px; color: var(--texte-3); text-transform: uppercase; letter-spacing: .1em; }
.mot-zone .le-mot { font-family: var(--rond); font-weight: 800; font-size: 42px; line-height: 1.02; color: #fff; text-shadow: 0 3px 0 var(--contour); overflow-wrap: anywhere; }
.mot-zone .revele.invite .nomcamp { color: var(--citron); text-shadow: 0 3px 0 var(--contour); }
.mot-zone .revele.intrus .nomcamp { color: #ff6b75; text-shadow: 0 3px 0 var(--contour); }
.mot-zone.visible { border-style: solid; }
.mot-zone.visible.invite { border-color: var(--citron); background: radial-gradient(circle at 50% 40%, rgba(143, 222, 2, .22), rgba(5, 12, 53, .55) 75%); }
.mot-zone.visible.intrus { border-color: var(--rouge); background: radial-gradient(circle at 50% 40%, rgba(238, 52, 66, .25), rgba(5, 12, 53, .6) 75%); }
.mot-zone.visible .cadeau { transform: translateY(-60px) rotate(-24deg) scale(.4); opacity: 0; animation: none; }
.mot-zone.visible .invite-txt { opacity: 0; }
.mot-zone.visible .revele { opacity: 1; transform: scale(1); }
.mot-zone.petit { min-height: 92px; flex-direction: row; gap: 12px; }
.mot-zone.petit .cadeau { width: 54px; height: 54px; }
.mot-zone.petit .invite-txt { font-size: 16px; }
.mot-zone.petit .revele { flex-direction: row; gap: 12px; }
.mot-zone.petit .revele .but, .mot-zone.petit .revele .lib-mot, .mot-zone.petit .revele .tu { display: none; }
.mot-zone.petit .revele .nomcamp { font-size: 18px; }
.mot-zone.petit .revele .camp-tete { flex-direction: column; gap: 0; }
.mot-zone.petit .revele .camp-tete .emo { width: 36px; height: 36px; }
.mot-zone.petit .le-mot { font-size: 30px; }

/* -------------------------------------------------- minuteur et chiffres */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 3px solid var(--contour); box-shadow: inset 0 0 0 2px var(--bord), 0 4px 0 var(--contour); border-radius: 18px; padding: 10px 6px 8px; text-align: center; }
.stat .emo { width: 38px; height: 38px; display: block; margin: 0 auto 2px; }
.stat b { display: block; font-family: var(--rond); font-weight: 800; font-size: 30px; line-height: 1.05; }
.stat > span { font-size: 14px; color: var(--texte-3); font-weight: 800; }

/* ------------------------------------------------------------- le vote */
.bandeau-vote {
  position: sticky; top: 0; z-index: 5; margin: 0 -16px; padding: 12px 18px 14px;
  background: linear-gradient(180deg, #ff5a66, var(--rouge)); border-bottom: 3px solid var(--contour); box-shadow: inset 0 -5px 0 var(--rouge-levre), 0 6px 18px rgba(0, 0, 0, .35); color: #fff;
  border-radius: 0 0 24px 24px;
}
.bandeau-vote .ligne1 { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bandeau-vote .t { font-family: var(--rond); font-weight: 800; font-size: 23px; display: flex; align-items: center; gap: 8px; text-shadow: 0 2px 0 var(--rouge-levre); }
.bandeau-vote .t .emo { width: 36px; height: 36px; }
.bandeau-vote .r { font-family: var(--rond); font-weight: 800; font-size: 32px; font-variant-numeric: tabular-nums; text-shadow: 0 2px 0 var(--rouge-levre); }
.bandeau-vote .barre { margin-top: 8px; height: 16px; background: rgba(5, 12, 53, .35); }
.bandeau-vote .barre > i { --c: #fff; }
.vote-fait { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.vote-fait .coche { width: 84px; height: 84px; }
.vote-fait .qui { font-family: var(--rond); font-weight: 800; font-size: 30px; }

/* la barre d'action collée en bas (comme « Vérifier ») */
.barre-bas { position: sticky; bottom: 0; z-index: 4; margin: 4px -16px 0; padding: 16px 16px max(16px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(10, 20, 64, 0), var(--nuit) 34%); display: flex; flex-direction: column; gap: 10px; }

/* ------------------------------------------------------------ la photo */
.photo-scene { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.viseur {
  position: relative; width: min(74vw, 300px); aspect-ratio: 1; border-radius: 50%; overflow: hidden;
  border: 7px solid var(--or); box-shadow: 0 0 0 4px var(--contour), 0 7px 0 4px var(--contour), 0 0 0 16px rgba(255, 204, 26, .14);
  background: radial-gradient(circle, var(--surface-2), var(--surface));
  display: flex; align-items: center; justify-content: center;
}
.viseur video, .viseur img { width: 100%; height: 100%; object-fit: cover; display: block; }
.viseur video { transform: scaleX(-1); }
.viseur .emo { width: 120px; height: 120px; object-fit: contain; }
.viseur.rebondit img { animation: rebond .6s var(--ressort) both; }
.declencheur { width: 88px; height: 88px; border-radius: 50%; border: 4px solid var(--contour); background: #fff; box-shadow: inset 0 0 0 6px var(--bord), inset 0 -6px 0 var(--blanc-levre), 0 5px 0 var(--contour); padding: 0; }
.declencheur:active { transform: translateY(5px); box-shadow: inset 0 0 0 6px var(--bord), 0 0 0 var(--contour); }
.flash { position: fixed; inset: 0; z-index: 80; background: #fff; pointer-events: none; animation: flash .45s ease-out forwards; }
@keyframes flash { from { opacity: .95; } to { opacity: 0; } }
.mon-avatar { display: flex; flex-direction: column; align-items: center; gap: 8px; }

/* ------------------------------------------------------------ calques */
#calque:empty { display: none; }
#calque { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(4, 9, 36, .8); animation: fondu .2s ease both; }
#calque.bas { align-items: flex-end; padding: 0; }
.modale {
  position: relative; width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; background: var(--surface); border: 3px solid var(--contour); border-radius: 26px; padding: 24px 18px 20px;
  box-shadow: inset 0 0 0 3px var(--bord), 0 6px 0 var(--contour), 0 30px 60px rgba(0, 0, 0, .5);
  display: flex; flex-direction: column; gap: 14px; align-items: stretch; animation: rebond .5s var(--ressort) both;
}
.modale h2 { text-align: center; }
.modale .dragon, .modale .emote { align-self: center; }
.modale .grand { font-family: var(--rond); font-weight: 800; font-size: 38px; text-align: center; line-height: 1.08; }
.modale .rouge-txt { color: #ff6b75; } .modale .or-txt { color: var(--or); } .modale .vert-txt { color: var(--citron); }

/* la feuille de résultat qui monte du bas (citron : bien vu, rouge : oups) */
.feuille {
  width: 100%; max-width: 560px; border-radius: 26px 26px 0 0; padding: 20px 18px max(20px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px;
  animation: monte-fond .42s var(--ressort) both; background: var(--surface); border: 3px solid var(--contour); border-bottom: 0; box-shadow: inset 0 3px 0 var(--bord);
}
.feuille.bien { background: #173d6e; box-shadow: inset 0 5px 0 var(--citron); }
.feuille.oups { background: #4a1530; box-shadow: inset 0 5px 0 var(--rouge); }
.feuille .tete { display: flex; align-items: center; gap: 12px; }
.feuille .tete .emo { width: 52px; height: 52px; }
.feuille .tete .emote, .feuille .tete .dragon { margin: -46px 0 -4px -6px; }
.feuille .tete h2 { font-size: 30px; }
.feuille.bien h2 { color: var(--citron); text-shadow: 0 3px 0 var(--contour); }
.feuille.oups h2 { color: #ff6b75; text-shadow: 0 3px 0 var(--contour); }
.feuille .qui { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 19px; }
.feuille .gain { align-self: flex-start; display: flex; align-items: center; gap: 6px; font-family: var(--rond); font-weight: 800; font-size: 23px; color: #3b2a00; background: var(--or); border: 3px solid var(--contour); border-radius: 999px; padding: 2px 16px 2px 6px; box-shadow: inset 0 -4px 0 var(--or-levre), 0 3px 0 var(--contour); animation: rebond .6s var(--ressort) .3s both; }
.feuille .gain .emo { width: 32px; height: 32px; }

/* la mission (le lancement) et le message secret : neutres, le camp est sous le cadeau */
.mission { text-align: center; align-items: center; }
.mission .dragon { margin-top: 10px; }

#toast {
  position: fixed; left: 0; right: 0; margin: 0 auto; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 90; width: min(92vw, 480px);
  display: flex; align-items: center; gap: 10px; background: #4a1530; color: #fff; border: 3px solid var(--contour); border-radius: 20px; padding: 10px 14px 10px 8px;
  font-weight: 800; font-size: 17px; box-shadow: inset 0 0 0 2px var(--rouge), 0 4px 0 var(--contour); animation: rebond .4s var(--ressort) both;
}
#toast:empty { display: none; }
#toast .emote, #toast .dragon { margin: -26px 0 -8px; }
.code-secours { font-family: var(--rond); font-weight: 800; font-size: 48px; letter-spacing: .25em; text-align: center; color: var(--or); text-shadow: 0 3px 0 var(--or-levre), 0 5px 0 var(--contour); }
.regles { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.regles li { display: flex; gap: 10px; align-items: flex-start; font-weight: 800; }
.regles li .emo { width: 38px; height: 38px; flex: none; margin-top: -4px; }
.podium-mini { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.podium-mini li { display: flex; align-items: center; gap: 10px; }
.podium-mini .rg { font-family: var(--rond); font-weight: 800; color: var(--or); min-width: 2.3em; }
.podium-mini .nm { flex: 1; font-weight: 800; }
.podium-mini .pt { font-family: var(--rond); font-weight: 800; color: var(--or-clair); }
.sep { height: 3px; background: var(--bord); border-radius: 2px; margin: 2px 0; opacity: .55; }
body.occupe .btn, body.occupe .tuile { filter: brightness(.85); }

#tourne { display: none; }
@media (orientation: landscape) and (max-height: 520px) {
  #tourne { display: flex; position: fixed; inset: 0; z-index: 99; align-items: center; justify-content: center; text-align: center; padding: 24px; background: var(--nuit); font-family: var(--rond); font-size: 24px; font-weight: 800; color: var(--or); }
}
