/* =========================================================
   iDjems — jeux.css
   Styles partagés du hub « Jeux » (/jeux) et de L'Imposteur.
   ADN du HQ (fond indigo profond, Space Grotesk, verre) en version
   « jeu de soirée » : lumière tamisée, cartes à jouer, tampons rouges.
   Mobile d'abord : colonne ≤ 520 px, cibles ≥ 48 px, champs 16 px.
   Pas de flou en cascade (un seul backdrop-filter : l'en-tête).
   ========================================================= */

:root {
  --bg:         #0d0b17;
  --bg-2:       #161127;
  --carte:      rgba(26, 20, 44, 0.78);
  --carte-2:    rgba(34, 27, 58, 0.86);
  --surface:    rgba(255, 255, 255, 0.05);
  --surface-2:  rgba(255, 255, 255, 0.085);
  --border:     rgba(255, 255, 255, 0.10);
  --border-2:   rgba(255, 255, 255, 0.18);
  --text:       #f5f3fb;
  --muted:      rgba(245, 243, 251, 0.68);
  --dim:        rgba(245, 243, 251, 0.48);

  --violet:     #8b5cf6;
  --violet-2:   #a78bfa;
  --violet-3:   #6d28d9;
  --rouge:      #ef4444;
  --rouge-2:    #f87171;
  --vert:       #34d399;
  --vert-2:     #6ee7b7;
  --or:         #fbbf24;

  --r:          16px;
  --r-lg:       22px;
  --ombre:      0 18px 44px rgba(0, 0, 0, 0.42);
  --titre:      'Space Grotesk', system-ui, sans-serif;
  --texte:      'Inter', system-ui, sans-serif;
  --pad:        16px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--texte);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  color-scheme: dark;
}

/* Lumières de salle + grain (calques fixes : composés une seule fois) */
body::before, body::after { content: ''; position: fixed; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; z-index: -1; }
body::before {
  background:
    radial-gradient(65% 42% at 12% -6%, rgba(139, 92, 246, 0.30), transparent 70%),
    radial-gradient(52% 36% at 108% 18%, rgba(239, 68, 68, 0.15), transparent 72%),
    radial-gradient(70% 45% at 50% 112%, rgba(52, 211, 153, 0.08), transparent 72%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 55%);
}
body::after {
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
a { color: inherit; }
[hidden], .cache { display: none !important; }
:focus-visible { outline: 2px solid var(--violet-2); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
b, strong { font-weight: 600; }
.t-vert { color: var(--vert); }
.t-rouge { color: var(--rouge-2); }
.t-violet { color: var(--violet-2); }

/* ── Squelette de page ───────────────────────────────────── */
.app {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 calc(var(--pad) + env(safe-area-inset-right)) 0 calc(var(--pad) + env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
}

.entete {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  margin: 0 calc(-1 * var(--pad));
  padding: calc(8px + env(safe-area-inset-top)) var(--pad) 8px;
  background: rgba(13, 11, 23, 0.72);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.entete-titre {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  font-family: var(--titre); font-weight: 700; font-size: 1.08rem; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.entete-titre span:last-child { overflow: hidden; text-overflow: ellipsis; }
.ico-btn {
  flex: none; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%;
  color: var(--muted); background: var(--surface); border: 1px solid var(--border);
  text-decoration: none; transition: background .2s, color .2s, transform .15s;
}
.ico-btn:hover { background: var(--surface-2); color: var(--text); }
.ico-btn:active { transform: scale(.94); }

.puce-code {
  flex: none; height: 48px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px 0 12px;
  border-radius: 14px; border: 1px dashed rgba(167, 139, 250, 0.55);
  background: rgba(139, 92, 246, 0.12); color: var(--text);
  font-family: var(--titre); font-weight: 700; letter-spacing: 0.16em; font-size: 1rem;
  transition: background .2s, transform .15s;
}
.puce-code svg { color: var(--violet-2); flex: none; }
.puce-code:hover { background: rgba(139, 92, 246, 0.2); }
.puce-code:active { transform: scale(.96); }

.cnx { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--dim); transition: background .3s, box-shadow .3s; }
.cnx.rt { background: var(--vert); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18); }
.cnx.poll { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18); }
.cnx.off { background: var(--rouge); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.22); animation: clignote 1.4s ease-in-out infinite; }
@keyframes clignote { 50% { opacity: .35; } }

/* ── Écran ──────────────────────────────────────────────── */
.ecran { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 16px 0 calc(18px + env(safe-area-inset-bottom)); }
.ecran > *, .col-salon > *, .col-invite > * { min-width: 0; }
.entree > * { animation: monte .42s cubic-bezier(.2, .8, .2, 1) both; }
.entree > *:nth-child(2) { animation-delay: .05s; }
.entree > *:nth-child(3) { animation-delay: .1s; }
.entree > *:nth-child(4) { animation-delay: .15s; }
.entree > *:nth-child(n+5) { animation-delay: .2s; }
@keyframes monte { from { opacity: 0; transform: translateY(10px); } }

.tete { text-align: center; padding: 4px 0 2px; }
.kicker {
  font-family: var(--titre); font-size: 0.74rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--violet-2);
}
.titre {
  font-family: var(--titre); font-weight: 700; font-size: clamp(1.6rem, 7vw, 2.1rem); line-height: 1.12;
  letter-spacing: -0.02em; margin-top: 4px; overflow-wrap: anywhere; outline: none;
}
.sous { color: var(--muted); margin-top: 6px; font-size: 0.97rem; }
.aide { color: var(--dim); font-size: 0.86rem; line-height: 1.45; }
.centre { text-align: center; }

.bloc {
  background: var(--carte); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 16px; box-shadow: var(--ombre);
}
.bloc h2 { font-family: var(--titre); font-size: 1.02rem; font-weight: 600; letter-spacing: -0.01em; }
.bloc-tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.compteur { font-family: var(--titre); font-weight: 600; color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.etiquette { font-size: 0.78rem; color: var(--dim); }
.etiquette.ok { color: var(--vert); }

/* ── Boutons ─────────────────────────────────────────────── */
.btn {
  position: relative; min-height: 52px; padding: 12px 20px; border-radius: var(--r);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  font-family: var(--titre); font-weight: 600; font-size: 1.02rem; letter-spacing: -0.005em; text-align: center;
  text-decoration: none; transition: transform .15s, background .2s, box-shadow .2s, opacity .2s, border-color .2s;
}
.btn:active:not(:disabled) { transform: scale(.975); }
.btn:disabled { opacity: .45; }
.btn-principal {
  color: #fff; background: linear-gradient(135deg, #9b6dff, #7c3aed 60%, #6d28d9);
  box-shadow: 0 10px 28px rgba(124, 58, 237, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn-principal:hover:not(:disabled) { box-shadow: 0 12px 34px rgba(124, 58, 237, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.btn-second { color: var(--text); background: var(--surface-2); border: 1px solid var(--border-2); }
.btn-second:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); }
.btn-danger { color: #fff; background: linear-gradient(135deg, #f15050, #dc2626); box-shadow: 0 10px 26px rgba(220, 38, 38, 0.35); }
.btn-danger-doux { color: var(--rouge-2); background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.35); }
.btn-vert { color: #062a1e; background: linear-gradient(135deg, #6ee7b7, #34d399); box-shadow: 0 10px 26px rgba(52, 211, 153, 0.3); }
.btn-xl { min-height: 58px; font-size: 1.1rem; border-radius: 18px; }
.btn-mini { width: auto; min-height: 48px; padding: 8px 14px; font-size: 0.92rem; border-radius: 12px; }
.btn.charge { color: transparent !important; }
.btn.charge::after {
  content: ''; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: tourne .7s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }
.actions-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.lien-discret {
  display: flex; align-items: center; justify-content: center; min-height: 48px; color: var(--muted);
  font-size: 0.94rem; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255, 255, 255, 0.25);
}
.lien-discret:hover { color: var(--text); }

/* ── Champs ──────────────────────────────────────────────── */
.lbl { display: block; font-family: var(--titre); font-weight: 600; font-size: 0.9rem; margin-bottom: 8px; color: var(--muted); }
.champ {
  width: 100%; min-height: 54px; padding: 12px 16px; border-radius: var(--r);
  background: rgba(8, 6, 16, 0.55); border: 1px solid var(--border-2); color: var(--text);
  font-size: 16px; /* pas de zoom iOS */ outline: none; transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none; appearance: none;
}
.champ::placeholder { color: rgba(245, 243, 251, 0.34); }
.champ:focus { border-color: var(--violet-2); box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2); }
.champ-code {
  text-align: center; text-transform: uppercase; font-family: var(--titre); font-weight: 700;
  font-size: 1.45rem; letter-spacing: 0.42em; padding-left: calc(16px + 0.42em);
}
.champ-code::placeholder { letter-spacing: 0.42em; }
.zone-texte { min-height: 120px; resize: vertical; line-height: 1.45; font-family: var(--texte); }
.ligne-champ { display: flex; gap: 10px; }
.ligne-champ .champ { flex: 1; min-width: 0; }
.ligne-champ .btn { width: auto; flex: none; }
.msg-erreur { color: var(--rouge-2); font-size: 0.9rem; min-height: 0; }
.msg-erreur:not(:empty) { margin-top: 10px; }
.form-pile { display: flex; flex-direction: column; gap: 12px; }
.sep { display: flex; align-items: center; gap: 12px; color: var(--dim); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.14em; margin: 6px 0; }
.sep::before, .sep::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Avatars (16 teintes, index = avatar) ────────────────── */
.av {
  --c: #8b5cf6;
  flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-size: 1.3rem; line-height: 1;
  background: rgba(255, 255, 255, 0.08);
  background: color-mix(in srgb, var(--c) 30%, #140f24);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 75%, transparent);
}
.av[data-c="0"]  { --c: #f97316; } .av[data-c="1"]  { --c: #22c55e; } .av[data-c="2"]  { --c: #3b82f6; } .av[data-c="3"]  { --c: #eab308; }
.av[data-c="4"]  { --c: #ec4899; } .av[data-c="5"]  { --c: #14b8a6; } .av[data-c="6"]  { --c: #a855f7; } .av[data-c="7"]  { --c: #ef4444; }
.av[data-c="8"]  { --c: #06b6d4; } .av[data-c="9"]  { --c: #84cc16; } .av[data-c="10"] { --c: #f43f5e; } .av[data-c="11"] { --c: #6366f1; }
.av[data-c="12"] { --c: #d946ef; } .av[data-c="13"] { --c: #10b981; } .av[data-c="14"] { --c: #f59e0b; } .av[data-c="15"] { --c: #0ea5e9; }
.av-s { width: 30px; height: 30px; font-size: 1rem; }
.av-l { width: 56px; height: 56px; font-size: 1.8rem; }
.av-xl { width: 92px; height: 92px; font-size: 3rem; }

/* ── Joueurs ─────────────────────────────────────────────── */
.joueurs { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.joueur {
  width: 100%; min-height: 58px; display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 8px;
  border-radius: 14px; background: var(--surface); border: 1px solid transparent; text-align: left;
}
button.joueur { transition: background .2s, border-color .2s; }
button.joueur:hover { background: var(--surface-2); border-color: var(--border); }
.j-nom { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* nom long : seul le texte est tronqué, le badge « toi » reste visible */
.j-nom.avec-toi { display: flex; align-items: center; gap: 6px; }
.j-nom .j-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.toi {
  flex: none; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--violet-2);
  background: rgba(139, 92, 246, 0.16); padding: 2px 7px; border-radius: 999px; vertical-align: 2px;
}
.joueur .etiquette { flex: none; }
.couronne { flex: none; font-size: 1.05rem; filter: drop-shadow(0 2px 6px rgba(251, 191, 36, 0.45)); }
.score {
  flex: none; font-family: var(--titre); font-weight: 600; font-size: 0.86rem; color: var(--or);
  font-variant-numeric: tabular-nums;
}
.pt { flex: none; width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); }
.pt.on { background: var(--vert); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.16); }
.chevron { flex: none; color: var(--dim); }
.joueur.horsligne .av, .joueur.horsligne .j-nom { opacity: .5; }

.pastilles { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.pastille {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 4px 12px 4px 4px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); font-size: 0.9rem; transition: background .3s, border-color .3s, opacity .3s;
}
.pastille .nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pastille.attend { opacity: .5; }
.pastille.ok { background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.35); }
.pastille .coche { color: var(--vert); font-weight: 700; }
.pastille .hl { flex: none; font-size: 0.72rem; color: #fcd34d; white-space: nowrap; }
.pastille.attend.horsligne { opacity: .75; border-style: dashed; border-color: rgba(245, 158, 11, 0.45); }

/* ── Barre d'actions (collée en bas) ─────────────────────── */
.barre {
  position: sticky; bottom: 0; z-index: 6; margin: auto calc(-1 * var(--pad)) 0;
  padding: 18px var(--pad) calc(14px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px;
  background: linear-gradient(to top, rgba(13, 11, 23, 0.97) 62%, rgba(13, 11, 23, 0));
}
.barre:empty { display: none; }
.barre { pointer-events: none; } /* le fondu transparent laisse passer les touches */
.barre > * { pointer-events: auto; }
.barre:has(> .attente:only-child) { position: static; background: none; padding-top: 4px; }
.ecran:has(> .barre:not(:empty)) { padding-bottom: 0; }
/* texte trop long pour une ligne : les points passent au-dessus, centrés */
.attente { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; min-height: 52px; color: var(--muted); font-size: 0.95rem; text-align: center; }
.points-anim { display: inline-flex; gap: 4px; }
.points-anim i { width: 6px; height: 6px; border-radius: 50%; background: var(--violet-2); animation: saute 1.2s ease-in-out infinite; }
.points-anim i:nth-child(2) { animation-delay: .15s; }
.points-anim i:nth-child(3) { animation-delay: .3s; }
@keyframes saute { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.ok-attente { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; color: var(--vert); font-weight: 600; font-family: var(--titre); }
@media (pointer: coarse) { body.saisie .barre { position: static; } }

/* ── Bandeaux ────────────────────────────────────────────── */
#bandeaux { display: flex; flex-direction: column; gap: 8px; }
#bandeaux:not(:empty) { padding-top: 12px; }
.bandeau {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between;
  padding: 10px 12px 10px 14px; border-radius: 14px; font-size: 0.92rem;
  background: rgba(139, 92, 246, 0.12); border: 1px solid rgba(139, 92, 246, 0.3);
  animation: monte .35s ease both;
}
.bandeau span { flex: 1 1 180px; }
.bandeau-alerte { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.38); }
.bandeau-elimine { background: rgba(255, 255, 255, 0.05); border-color: var(--border-2); color: var(--muted); }

/* ── Accueil ─────────────────────────────────────────────── */
.hero { text-align: center; padding: 10px 0 4px; }
.hero-cartes { position: relative; height: 128px; margin: 4px auto 14px; width: 200px; }
.hero-cartes span {
  position: absolute; left: 50%; top: 8px; width: 74px; height: 104px; margin-left: -37px; border-radius: 12px;
  display: grid; place-items: center; font-family: var(--titre); font-weight: 700; font-size: 2rem; color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(167, 139, 250, 0.45);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.06) 0 2px, transparent 2px 10px),
    linear-gradient(160deg, #3b2178, #1b1236);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}
.hero-cartes span:nth-child(1) { transform: translateX(-58px) rotate(-14deg); animation: flotte1 6s ease-in-out infinite; }
.hero-cartes span:nth-child(3) { transform: translateX(58px) rotate(14deg); animation: flotte3 6.5s ease-in-out infinite; }
.hero-cartes span:nth-child(2) {
  z-index: 1; top: 0; font-size: 2.3rem; border-color: rgba(248, 113, 113, 0.65);
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 10px), linear-gradient(160deg, #7f1d1d, #2b0d18);
  box-shadow: 0 18px 40px rgba(220, 38, 38, 0.35); animation: flotte2 5.5s ease-in-out infinite;
}
@keyframes flotte1 { 50% { transform: translateX(-62px) translateY(-4px) rotate(-16deg); } }
@keyframes flotte2 { 50% { transform: translateY(-7px) rotate(2deg); } }
@keyframes flotte3 { 50% { transform: translateX(62px) translateY(-3px) rotate(16deg); } }
.hero .titre { font-size: clamp(2.3rem, 11vw, 3rem); }
.hero .sous { max-width: 400px; margin-inline: auto; }
.reprendre { display: flex; align-items: center; gap: 12px; }
.reprendre .txt { flex: 1; min-width: 0; }
.reprendre .txt b { font-family: var(--titre); letter-spacing: 0.14em; }

/* ── Règles ──────────────────────────────────────────────── */
.regles h3 { font-family: var(--titre); font-size: 0.98rem; font-weight: 600; margin: 16px 0 6px; }
.regles h3:first-child { margin-top: 0; }
.regles p, .regles li { color: var(--muted); font-size: 0.94rem; }
.regles-liste { list-style: none; counter-reset: r; display: flex; flex-direction: column; gap: 10px; }
.regles-liste li { counter-increment: r; position: relative; padding-left: 36px; }
.regles-liste li::before {
  content: counter(r); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--titre); font-weight: 700; font-size: 0.82rem; color: #fff;
  background: rgba(139, 92, 246, 0.35); border: 1px solid rgba(167, 139, 250, 0.5);
}
.regles b { color: var(--text); }

/* ── Invitation / QR ─────────────────────────────────────── */
.invite { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.qr {
  position: relative; background: #fff; border-radius: 18px; padding: 0; overflow: hidden;
  width: min(100%, 300px); aspect-ratio: 1; display: grid; place-items: center;
  box-shadow: 0 0 0 6px rgba(139, 92, 246, 0.22), 0 20px 50px rgba(0, 0, 0, 0.5);
}
.qr svg { display: block; width: 100%; height: 100%; }
.qr-moyen { width: min(100%, 260px); }
.qr-repli {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 18px;
  color: #3b3155; font-size: 0.86rem; text-align: center; line-height: 1.35;
}
.qr-repli strong { font-family: var(--titre); font-size: 2.6rem; letter-spacing: 0.18em; color: #0d0b17; padding-left: .18em; }
.qr-repli .tourne { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #ddd6fe; border-top-color: #7c3aed; animation: tourne .8s linear infinite; }
.code-geant { display: flex; justify-content: center; gap: 8px; }
.code-geant span {
  width: 52px; height: 62px; display: grid; place-items: center; border-radius: 12px;
  font-family: var(--titre); font-weight: 700; font-size: 2.1rem; line-height: 1;
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.22), rgba(139, 92, 246, 0.08));
  border: 1px solid rgba(167, 139, 250, 0.45); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25);
}
.lien { font-size: 0.95rem; color: var(--muted); overflow-wrap: anywhere; }
.lien b { color: var(--text); font-weight: 600; }
.invite .actions-2 { width: 100%; }
.invite-compact { display: flex; align-items: center; gap: 12px; text-align: left; }
.invite-compact .txt { flex: 1; min-width: 0; }
.invite-compact .txt b { font-family: var(--titre); letter-spacing: 0.16em; font-size: 1.15rem; }

.attente-hote { text-align: center; padding: 22px 16px; }
.attente-hote .grand-emoji { font-size: 2.6rem; line-height: 1; display: block; margin-bottom: 10px; }
.attente-hote h2 { font-size: 1.2rem; }
.attente-hote p { color: var(--muted); margin-top: 6px; font-size: 0.95rem; }

/* ── Réglages ────────────────────────────────────────────── */
.reg + .reg { margin-top: 16px; }
.reg-lbl { font-family: var(--titre); font-weight: 600; font-size: 0.9rem; color: var(--muted); margin-bottom: 8px; }
.reg .aide { margin-top: 8px; }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(8, 6, 16, 0.5); border: 1px solid var(--border); }
.seg-btn {
  flex: 1 1 0; min-width: 0; min-height: 48px; padding: 0 6px; border-radius: 11px; color: var(--muted);
  font-family: var(--titre); font-weight: 600; font-size: 0.92rem; white-space: nowrap;
  transition: background .2s, color .2s, box-shadow .2s;
}
.seg-btn[aria-checked="true"] { color: #fff; background: linear-gradient(135deg, #8b5cf6, #6d28d9); box-shadow: 0 6px 16px rgba(109, 40, 217, 0.4); }
.seg-btn:not([aria-checked="true"]):hover { background: var(--surface); color: var(--text); }
.puces { display: flex; flex-wrap: wrap; gap: 8px; }
.puce {
  min-height: 48px; padding: 0 14px; border-radius: 999px; display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 0.93rem; font-weight: 500;
  transition: background .2s, border-color .2s, color .2s;
}
.puce small { color: var(--dim); font-size: 0.76rem; font-variant-numeric: tabular-nums; }
.puce[aria-pressed="true"] { color: var(--text); background: rgba(139, 92, 246, 0.2); border-color: rgba(167, 139, 250, 0.7); }
.puce[aria-pressed="true"] small { color: var(--violet-2); }
.interrupteur {
  width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px; text-align: left; margin-top: 12px;
  padding: 8px 12px 8px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
}
.interrupteur .txt { flex: 1; min-width: 0; }
.interrupteur .txt b { display: block; font-family: var(--titre); font-weight: 600; font-size: 0.95rem; }
.interrupteur .txt small { display: block; color: var(--dim); font-size: 0.82rem; line-height: 1.35; }
.interrupteur .bouton {
  flex: none; position: relative; width: 48px; height: 28px; border-radius: 999px; background: rgba(255, 255, 255, 0.16); transition: background .2s;
}
.interrupteur .bouton::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); transition: transform .22s cubic-bezier(.3, .7, .3, 1.3);
}
.interrupteur[aria-checked="true"] .bouton { background: var(--violet); }
.interrupteur[aria-checked="true"] .bouton::after { transform: translateX(20px); }
.interrupteur:disabled { opacity: .45; }
.perso { margin-top: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.perso summary {
  min-height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 14px; cursor: pointer; list-style: none;
  font-family: var(--titre); font-weight: 600; font-size: 0.95rem;
}
.perso summary::-webkit-details-marker { display: none; }
.perso summary .nb { margin-left: auto; font-size: 0.82rem; color: var(--dim); font-weight: 500; }
.perso summary::after { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--dim); border-bottom: 2px solid var(--dim); transform: rotate(45deg); transition: transform .2s; margin: -4px 4px 0 0; }
.perso[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.perso-corps { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.resume { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 0.94rem; }
.resume dt { color: var(--dim); }
.resume dd { text-align: right; font-weight: 500; overflow-wrap: anywhere; }

/* ── Carte de rôle (retournable) ─────────────────────────── */
.zone-carte { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.carte {
  position: relative; width: min(100%, 330px); aspect-ratio: 4 / 5; perspective: 1200px; border-radius: 24px;
  width: min(100%, clamp(230px, calc((100dvh - 330px) * 0.8), 330px)); /* carte + boutons tiennent à l'écran */
  -webkit-user-select: none; user-select: none;
}
.carte-in {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: block; transform-style: preserve-3d; -webkit-transform-style: preserve-3d;
  transition: transform .62s cubic-bezier(.3, .75, .25, 1.15);
}
.carte.retournee .carte-in { transform: rotateY(180deg); }
.carte-dos, .carte-face {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: 24px; overflow: hidden; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; padding: 22px; text-align: center;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.carte-dos {
  border: 1px solid rgba(167, 139, 250, 0.5);
  background:
    radial-gradient(circle at 50% 42%, rgba(167, 139, 250, 0.28), transparent 46%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.045) 0 2px, transparent 2px 15px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.045) 0 2px, transparent 2px 15px),
    linear-gradient(165deg, #34206b, #160f2c 70%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.3), inset 0 0 0 10px rgba(13, 11, 23, 0.35), inset 0 0 0 11px rgba(167, 139, 250, 0.3);
}
/* « Respiration » du sceau : seuls transform et opacity sont animés (composés par le
   GPU). Animer box-shadow repeignait la carte à chaque image pendant toute la phase
   rôle (~20 % du processeur d'un téléphone d'entrée de gamme, écran gardé allumé). */
.sceau {
  position: relative; width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--titre); font-weight: 700; font-size: 3.6rem; color: #fff;
  background: radial-gradient(circle at 35% 30%, #a78bfa, #6d28d9 70%);
  animation: respire 2.8s ease-in-out infinite;
}
.sceau::before, .sceau::after { content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: inherit; pointer-events: none; }
.sceau::before { box-shadow: 0 0 0 6px rgba(13, 11, 23, 0.4), 0 0 0 7px rgba(167, 139, 250, 0.55), 0 18px 40px rgba(109, 40, 217, 0.55); animation: halo-repos 2.8s ease-in-out infinite; }
.sceau::after { box-shadow: 0 0 0 6px rgba(13, 11, 23, 0.4), 0 0 0 9px rgba(167, 139, 250, 0.4), 0 22px 48px rgba(109, 40, 217, 0.7); opacity: 0; animation: halo-plein 2.8s ease-in-out infinite; }
@keyframes respire { 50% { transform: scale(1.05); } }
@keyframes halo-repos { 50% { opacity: 0; } }
@keyframes halo-plein { 50% { opacity: 1; } }
.carte-dos .invite-txt { font-family: var(--titre); font-weight: 600; font-size: 1.1rem; margin-top: 8px; }
.carte-dos .discret { font-size: 0.84rem; color: var(--muted); }
.carte-face { transform: rotateY(180deg); border: 1px solid var(--border-2); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55); }
/* Une seule face pour les trois rôles : un voisin qui aperçoit la couleur de la
   carte (de loin, d'un coup d'œil) ne doit rien apprendre. Le rôle est dans le texte. */
.carte-civ, .carte-imp, .carte-und { border-color: rgba(167, 139, 250, 0.6); background: radial-gradient(circle at 50% 30%, rgba(139, 92, 246, 0.26), transparent 60%), linear-gradient(165deg, #241645, #0f0b1c 75%); }
.c-kicker { font-family: var(--titre); font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.c-mot { display: block; max-width: 100%; font-family: var(--titre); font-weight: 700; font-size: 2.6rem; line-height: 1.05; letter-spacing: -0.02em; overflow-wrap: anywhere; hyphens: auto; }
.c-mot.long { font-size: 2rem; }
.c-mot.tres-long { font-size: 1.55rem; }
.carte-civ .c-mot, .carte-und .c-mot { color: #ede9fe; text-shadow: 0 0 30px rgba(139, 92, 246, 0.5); }
.c-cat { display: inline-flex; padding: 5px 12px; border-radius: 999px; font-size: 0.86rem; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--border-2); }
.c-conseil { font-size: 0.86rem; color: var(--muted); max-width: 250px; line-height: 1.4; }
.tampon {
  display: inline-block; padding: 8px 16px 6px; border: 3px double var(--rouge); border-radius: 8px; transform: rotate(-8deg);
  font-family: var(--titre); font-weight: 700; font-size: 1.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--rouge-2);
  text-shadow: 0 0 18px rgba(239, 68, 68, 0.55); box-shadow: 0 0 22px rgba(239, 68, 68, 0.25), inset 0 0 14px rgba(239, 68, 68, 0.18);
}
.tampon.vert { border-color: var(--vert); color: var(--vert-2); text-shadow: 0 0 18px rgba(52, 211, 153, 0.55); box-shadow: 0 0 22px rgba(52, 211, 153, 0.22), inset 0 0 14px rgba(52, 211, 153, 0.15); }
.c-titre { font-family: var(--titre); font-weight: 700; font-size: 1.5rem; line-height: 1.15; color: #ede9fe; }
.carte.mini { aspect-ratio: auto; height: 132px; width: 100%; }
.carte.mini .carte-dos, .carte.mini .carte-face { flex-direction: row; gap: 14px; padding: 14px 18px; border-radius: 18px; }
.carte.mini .carte-in, .carte.mini { border-radius: 18px; }
.carte.mini .sceau { width: 58px; height: 58px; font-size: 1.9rem; animation: none; }
.carte.mini .sceau::before, .carte.mini .sceau::after { animation: none; }
.carte.mini .c-mot { font-size: 1.7rem; }
.carte.mini .c-mot.long, .carte.mini .c-mot.tres-long { font-size: 1.3rem; }
.carte.mini .c-conseil, .carte.mini .discret { display: none; }
.carte.mini .c-titre { font-size: 1.1rem; }
.mini-col { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; min-width: 0; max-width: 100%; }
.carte.mini .mini-col { align-items: flex-start; gap: 4px; text-align: left; }
.spectateur { text-align: center; padding: 26px 18px; }
.spectateur .grand-emoji { font-size: 2.8rem; display: block; margin-bottom: 8px; }
.spectateur p { color: var(--muted); }

/* ── Débat / chrono ──────────────────────────────────────── */
.premier { display: flex; align-items: center; gap: 14px; }
.premier .txt { min-width: 0; }
.premier-nom { font-family: var(--titre); font-weight: 700; font-size: 1.35rem; line-height: 1.2; overflow-wrap: anywhere; }
.chrono { display: flex; align-items: center; gap: 16px; }
.chrono-anneau { position: relative; width: 104px; height: 104px; flex: none; }
.chrono-anneau svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.chrono-anneau circle { fill: none; stroke-width: 8; }
.chrono-anneau .fond { stroke: rgba(255, 255, 255, 0.08); }
.chrono-anneau .arc { stroke: var(--violet); stroke-linecap: round; transition: stroke-dashoffset .3s linear, stroke .3s; }
.chrono-temps {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: grid; place-items: center;
  font-family: var(--titre); font-weight: 700; font-size: 1.6rem; font-variant-numeric: tabular-nums;
}
.chrono.alerte .arc { stroke: #f59e0b; }
.chrono.urgent .arc { stroke: var(--rouge); }
.chrono.urgent .chrono-temps { color: var(--rouge-2); animation: pulse 1s ease-in-out infinite; }
.chrono.fini .chrono-temps { font-size: 1.05rem; color: var(--rouge-2); }
@keyframes pulse { 50% { transform: scale(1.08); } }
.chrono .txt b { font-family: var(--titre); display: block; font-size: 1.05rem; }
.chrono .txt span { color: var(--muted); font-size: 0.9rem; }
.ordre { list-style: none; display: flex; flex-direction: column; gap: 6px; counter-reset: o; }
.ordre li {
  counter-increment: o; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 12px 6px 6px;
  border-radius: 14px; background: var(--surface);
}
.ordre li::before {
  content: counter(o); flex: none; width: 28px; text-align: center; font-family: var(--titre); font-weight: 700; color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.ordre li.premier-li { background: rgba(139, 92, 246, 0.14); box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.4); }
.ordre li.premier-li::before { color: var(--violet-2); }
.ordre li.moi .j-nom { color: var(--violet-2); }
.infos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tuile { padding: 14px; border-radius: var(--r); background: var(--carte); border: 1px solid var(--border); }
.tuile-n { display: block; font-family: var(--titre); font-weight: 700; font-size: 1.8rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tuile-l { font-size: 0.84rem; color: var(--muted); }
.tuile.rouge .tuile-n { color: var(--rouge-2); }
.elimines { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.role-badge { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; padding: 2px 8px; border-radius: 999px; }
.role-badge.imp { color: #fecaca; background: rgba(239, 68, 68, 0.22); }
.role-badge.civ { color: #a7f3d0; background: rgba(52, 211, 153, 0.18); }
.role-badge.parti { color: var(--muted); background: rgba(255, 255, 255, 0.08); }

/* ── Vote ────────────────────────────────────────────────── */
.progression { display: flex; flex-direction: column; gap: 8px; }
.progression .ligne { display: flex; justify-content: space-between; font-size: 0.92rem; color: var(--muted); }
.progression .ligne b { color: var(--text); font-family: var(--titre); font-variant-numeric: tabular-nums; }
.jauge { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.jauge i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--violet), var(--violet-2)); transition: width .4s ease; }
.grille { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cand {
  position: relative; min-height: 132px; padding: 28px 10px 14px; border-radius: 18px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; background: var(--carte); border: 1.5px solid var(--border);
  transition: transform .15s, border-color .2s, background .2s, box-shadow .2s;
}
.cand:active:not(:disabled) { transform: scale(.96); }
.cand:hover:not(:disabled) { border-color: var(--border-2); }
.cand-nom {
  font-weight: 600; max-width: 100%; line-height: 1.25; text-align: center; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.cand.choisi { border-color: var(--rouge); background: linear-gradient(180deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.06)); box-shadow: 0 10px 28px rgba(239, 68, 68, 0.25); }
.cand-coche {
  position: absolute; top: 7px; right: 7px; font-size: 0.64rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: #fff; background: var(--rouge); padding: 2px 7px; border-radius: 999px; animation: pop .3s cubic-bezier(.3, .7, .3, 1.5) both;
}
.cand:disabled { opacity: .55; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* ── Résultat ────────────────────────────────────────────── */
.revelation { text-align: center; padding: 22px 16px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; overflow: hidden; }
.revelation .av-xl { animation: tombeAv .6s cubic-bezier(.3, .7, .3, 1.3) both; }
.revelation .qui { font-family: var(--titre); font-weight: 600; font-size: 1.25rem; overflow-wrap: anywhere; animation: monte .5s .3s ease both; }
.revelation .tampon { font-size: 1.8rem; margin: 14px 0 12px; animation: frappe .5s 1.15s cubic-bezier(.2, .9, .3, 1.25) both; }
.revelation .apres { color: var(--muted); font-size: 0.94rem; animation: monte .5s 1.6s ease both; }
.revelation.imp { background: radial-gradient(circle at 50% 30%, rgba(239, 68, 68, 0.18), transparent 65%), var(--carte); border-color: rgba(239, 68, 68, 0.35); }
.revelation.civ { background: radial-gradient(circle at 50% 30%, rgba(52, 211, 153, 0.14), transparent 65%), var(--carte); border-color: rgba(52, 211, 153, 0.3); }
@keyframes tombeAv { from { transform: scale(.3) rotate(-25deg); opacity: 0; } }
@keyframes frappe { from { transform: scale(2.6) rotate(-14deg); opacity: 0; } 70% { transform: scale(.94) rotate(-8deg); opacity: 1; } to { transform: scale(1) rotate(-8deg); } }
.revelation .titre { font-size: clamp(1.6rem, 7vw, 2.1rem); margin: 0; }
.egalite-grand { font-size: 2.8rem; line-height: 1; animation: pop .5s cubic-bezier(.3, .7, .3, 1.4) both; }
.exaequo { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.compte { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.compte li { display: flex; flex-direction: column; gap: 6px; }
.compte .haut { display: flex; align-items: center; gap: 10px; }
.compte .haut .j-nom { font-size: 0.95rem; }
.compte .n { font-family: var(--titre); font-weight: 700; font-variant-numeric: tabular-nums; min-width: 22px; text-align: right; }
.compte .barre-v { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.compte .barre-v i {
  display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #7c3aed, #a78bfa);
  transform-origin: left; animation: remplit .8s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 0.12s + .2s);
}
.compte li.max .barre-v i { background: linear-gradient(90deg, #dc2626, #f87171); }
.compte .voteurs { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 40px; }
.compte .voteurs .pastille { gap: 6px; padding: 2px 10px 2px 2px; font-size: 0.8rem; }
.compte .voteurs .av { width: 22px; height: 22px; font-size: 0.75rem; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 75%, transparent); }
.dernier-vote .elimine-ligne { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin-bottom: 14px; color: var(--muted); font-size: 0.94rem; }
.dernier-vote .elimine-ligne b { color: var(--text); }
@keyframes remplit { from { transform: scaleX(0); } }

/* ── Chance ──────────────────────────────────────────────── */
.chance-carte { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 22px 16px; }
.chance-carte .grand-emoji { font-size: 2.8rem; line-height: 1; }
.chance-carte p { color: var(--muted); }
.cible-pulse { position: relative; margin: 16px 0 6px; }
.chance-carte h2 { font-size: 1.22rem; overflow-wrap: anywhere; }
.cible-pulse::after { content: ''; position: absolute; top: -6px; right: -6px; bottom: -6px; left: -6px; border-radius: 50%; border: 2px solid var(--rouge); animation: onde 1.6s ease-out infinite; }
@keyframes onde { from { transform: scale(.9); opacity: .9; } to { transform: scale(1.5); opacity: 0; } }

/* ── Fin ─────────────────────────────────────────────────── */
.victoire { text-align: center; padding: 24px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; overflow: hidden; }
.victoire.civils { background: radial-gradient(circle at 50% 0%, rgba(52, 211, 153, 0.25), transparent 70%), var(--carte); border-color: rgba(52, 211, 153, 0.4); }
.victoire.imposteurs { background: radial-gradient(circle at 50% 0%, rgba(239, 68, 68, 0.28), transparent 70%), var(--carte); border-color: rgba(239, 68, 68, 0.45); }
.victoire .trophee { font-size: 3.2rem; line-height: 1; animation: pop .6s cubic-bezier(.3, .7, .3, 1.5) both; }
.victoire h1 { font-family: var(--titre); font-size: clamp(1.7rem, 8vw, 2.2rem); line-height: 1.1; letter-spacing: -0.02em; }
.victoire.civils h1 { color: var(--vert-2); }
.victoire.imposteurs h1 { color: var(--rouge-2); }
.victoire .perso-res { font-family: var(--titre); font-weight: 600; font-size: 1.05rem; }
.victoire .raison { color: var(--muted); font-size: 0.95rem; }
.mots-fin { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.mots-fin .tuile { text-align: center; }
.mots-fin .tuile-n { font-size: 1.5rem; overflow-wrap: anywhere; }
.classement { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.classement li { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 6px 12px 6px 6px; border-radius: 14px; background: var(--surface); }
.classement .rang { width: 26px; flex: none; text-align: center; font-family: var(--titre); font-weight: 700; color: var(--dim); }
.classement li:first-child .rang { color: var(--or); }
.classement .gain { flex: none; font-family: var(--titre); font-weight: 700; font-size: 0.85rem; color: var(--vert); }
.classement .gain.imp { color: var(--rouge-2); }
.imposteurs-liste { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.confettis { position: fixed; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; overflow: hidden; z-index: 30; }
.confettis i {
  position: absolute; top: -24px; left: var(--x); width: 9px; height: 15px; border-radius: 2px; background: var(--c);
  opacity: 0; animation: confetti var(--d) var(--r) cubic-bezier(.25, .6, .5, 1) forwards;
}
.confettis i:nth-child(3n) { width: 7px; height: 7px; border-radius: 50%; }
@keyframes confetti {
  0% { opacity: 1; transform: translate3d(0, 0, 0) rotate(0); }
  85% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(var(--dx), 108vh, 0) rotate(var(--rot)); }
}

/* ── Chargement / erreurs ────────────────────────────────── */
.chargement { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--muted); text-align: center; min-height: 50vh; }
.anneau-charge { width: 44px; height: 44px; border-radius: 50%; border: 3px solid rgba(167, 139, 250, 0.25); border-top-color: var(--violet-2); animation: tourne .8s linear infinite; }
.perdu { text-align: center; padding: 26px 18px; }
.perdu .grand-emoji { font-size: 3rem; display: block; margin-bottom: 10px; }
.perdu p { color: var(--muted); margin-top: 6px; }

/* ── Modales ─────────────────────────────────────────────── */
.modale-fond {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(5, 4, 10, 0.66); opacity: 0; transition: opacity .22s ease;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
.modale-fond.ouverte { opacity: 1; }
.modale {
  position: relative; width: 100%; max-width: 520px; max-height: calc(100dvh - 24px - env(safe-area-inset-top)); overflow-y: auto; overscroll-behavior: contain;
  padding: 22px 18px calc(20px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #211938, #15102a); border: 1px solid var(--border-2); border-bottom: 0;
  border-radius: 26px 26px 0 0; box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
  transform: translateY(24px); transition: transform .28s cubic-bezier(.2, .8, .2, 1); outline: none;
}
.modale-fond.ouverte .modale { transform: none; }
.modale::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.2); margin: -10px auto 14px; }
.modale-x { position: absolute; top: 10px; right: 10px; width: 48px; height: 48px; font-size: 1.5rem; background: transparent; border-color: transparent; }
.modale-titre { font-family: var(--titre); font-size: 1.3rem; font-weight: 700; letter-spacing: -0.01em; padding-right: 44px; overflow-wrap: anywhere; }
.modale-texte { color: var(--muted); margin-top: 8px; }
.modale .actions-2, .modale .liste-actions { margin-top: 18px; }
.liste-actions { display: flex; flex-direction: column; gap: 8px; }
.liste-actions .aide { margin: -2px 4px 4px; }
.menu-item {
  width: 100%; min-height: 56px; display: flex; align-items: center; gap: 14px; padding: 0 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); font-weight: 500; text-align: left; text-decoration: none;
  transition: background .2s;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item .ico { width: 24px; text-align: center; font-size: 1.15rem; }
.menu-item.danger { color: var(--rouge-2); }
.fiche { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.fiche .modale-titre { padding-right: 0; }
.modale-qr { text-align: center; }
.modale-qr .invite { padding-top: 4px; }
@media (min-width: 600px) {
  .modale-fond { align-items: center; padding: 24px; }
  .modale { border-radius: 26px; border-bottom: 1px solid var(--border-2); padding-bottom: 22px; }
  .modale::before { display: none; }
}

/* ── Toasts ──────────────────────────────────────────────── */
.toasts {
  position: fixed; left: 0; right: 0; top: calc(72px + env(safe-area-inset-top)); z-index: 60; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px;
}
.toast {
  max-width: min(440px, 100%); padding: 12px 16px; border-radius: 14px; font-size: 0.94rem; font-weight: 500; text-align: center;
  background: #2a2142; border: 1px solid var(--border-2); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5); overflow-wrap: anywhere;
  opacity: 0; transform: translateY(-10px) scale(.97); transition: opacity .25s, transform .25s;
}
.toast.vu { opacity: 1; transform: none; }
.toast-ok { border-color: rgba(52, 211, 153, 0.45); }
.toast-erreur { border-color: rgba(239, 68, 68, 0.55); background: #3a1820; }

/* ── Hub /jeux ───────────────────────────────────────────── */
.hub-tete { padding: 18px 0 6px; }
.hub-tete .titre { font-size: clamp(2.2rem, 10vw, 2.8rem); text-align: left; }
.hub-tete .sous { margin-top: 4px; }
.jeu-vedette {
  position: relative; overflow: hidden; border-radius: 26px; padding: 22px 18px 18px;
  border: 1px solid rgba(167, 139, 250, 0.35);
  background:
    radial-gradient(90% 70% at 100% 0%, rgba(239, 68, 68, 0.28), transparent 60%),
    radial-gradient(80% 70% at 0% 100%, rgba(139, 92, 246, 0.35), transparent 65%),
    linear-gradient(160deg, #241845, #130e24);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
/* Codenames : rouge contre bleu */
.jeu-vedette.jeu-cn {
  border-color: rgba(96, 165, 250, 0.35);
  background:
    radial-gradient(90% 70% at 100% 0%, rgba(59, 130, 246, 0.32), transparent 60%),
    radial-gradient(80% 70% at 0% 100%, rgba(239, 68, 68, 0.28), transparent 65%),
    linear-gradient(160deg, #1a1d45, #130e24);
}
.jeu-vedette.jeu-cn .cartes-deco span:nth-child(1) { font-family: var(--titre); font-weight: 700; color: #fff; border-color: rgba(248, 113, 113, 0.6); background: linear-gradient(160deg, #dc2626, #7f1d1d); }
.jeu-vedette.jeu-cn .cartes-deco span:nth-child(2) { border-color: rgba(96, 165, 250, 0.6); background: linear-gradient(160deg, #1d4ed8, #172554); }
.jeu-vedette + .jeu-vedette { margin-top: 2px; }
.jeu-vedette .cartes-deco { position: absolute; right: -4px; top: 10px; width: 104px; height: 92px; pointer-events: none; }
.jeu-vedette .cartes-deco span {
  position: absolute; width: 50px; height: 70px; border-radius: 9px; display: grid; place-items: center; font-size: 1.35rem;
  border: 1px solid rgba(167, 139, 250, 0.45); background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.06) 0 2px, transparent 2px 9px), linear-gradient(160deg, #3b2178, #1b1236);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.45);
}
.jeu-vedette .cartes-deco span:nth-child(1) { right: 44px; top: 8px; transform: rotate(-12deg); }
.jeu-vedette .cartes-deco span:nth-child(2) { right: 14px; top: 0; transform: rotate(8deg); border-color: rgba(248, 113, 113, 0.6); background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 9px), linear-gradient(160deg, #7f1d1d, #2b0d18); }
.jeu-vedette h2 { position: relative; font-family: var(--titre); font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; margin-top: 6px; max-width: calc(100% - 110px); }
.jeu-vedette .desc { position: relative; color: var(--muted); margin: 10px 0 14px; max-width: 360px; font-size: 0.97rem; }
.tags { position: relative; display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tag { font-size: 0.8rem; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--border); color: var(--text); }
.hub .bientot {
  border: 1.5px dashed var(--border-2); border-radius: var(--r-lg); padding: 18px; display: flex; align-items: center; gap: 14px;
  color: var(--muted); background: rgba(255, 255, 255, 0.02);
}
.hub .bientot .ico { width: 48px; height: 48px; flex: none; border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem; background: var(--surface); }
.hub .bientot b { display: block; color: var(--text); font-family: var(--titre); }
.pied { text-align: center; color: var(--dim); font-size: 0.8rem; padding: 8px 0 4px; }

/* QR plus grand dès que l'écran le permet (tablette portrait : lu de plus loin ;
   la fenêtre QR, seul QR une fois la partie lancée, n'est plus plus petite que celui
   du salon). min-height : les téléphones en paysage ne changent pas. */
@media (min-width: 600px) and (min-height: 600px) {
  .qr { width: min(100%, 440px, 52vh); }
  .qr-moyen { width: min(100%, 360px, 46vh); }
}

/* ── Grand écran : salon en deux colonnes (QR projeté) ───── */
.ecran-lobby, .col-salon, .col-invite { display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 980px) {
  .app.large { max-width: 980px; }
  .app.large .ecran-lobby { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 20px; align-items: start; }
  .app.large .col-invite { position: sticky; top: 84px; }
  .app.large .col-invite .qr { width: 100%; }
  .app.large .barre { padding-left: calc(420px + var(--pad)); }
}

@media (max-width: 420px) {
  .entete:has(.puce-code:not([hidden])) .entete-titre span:last-child { display: none; }
}
@media (max-width: 370px) {
  :root { --pad: 14px; }
  .code-geant span { width: 46px; height: 56px; font-size: 1.85rem; }
  .seg-btn { font-size: 0.86rem; padding: 0 3px; }
  .puce-code { padding: 0 10px; letter-spacing: 0.12em; }
}

/* ── Accessibilité : mouvement réduit ────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: 0.001ms !important; }
  .carte-in { transition: none; }
  .carte .carte-face { transform: none; opacity: 0; }
  .carte.retournee .carte-in { transform: none; }
  .carte.retournee .carte-face { opacity: 1; }
  .carte.retournee .carte-dos { opacity: 0; }
  .confettis { display: none; }
}

/* Puissance 4 : plateau bleu, jetons rouge et jaune */
.jeu-vedette.jeu-p4 {
  border-color: rgba(96, 140, 255, 0.4);
  background:
    radial-gradient(90% 70% at 100% 0%, rgba(47, 95, 224, 0.45), transparent 60%),
    radial-gradient(70% 60% at 0% 100%, rgba(251, 191, 36, 0.16), transparent 65%),
    linear-gradient(160deg, #142060, #0d0b20);
}
.jeu-vedette.jeu-p4 .cartes-deco { width: 120px; }
.jeu-vedette.jeu-p4 .cartes-deco span {
  width: 46px; height: 46px; border-radius: 50%; border: 0; transform: none;
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.35), inset 0 2px 3px rgba(255, 255, 255, 0.3), 0 10px 22px rgba(0, 0, 0, 0.45);
}
.jeu-vedette.jeu-p4 .cartes-deco span:nth-child(1) { right: 62px; top: 12px; background: radial-gradient(circle at 33% 27%, rgba(255,255,255,.55), transparent 26%), radial-gradient(circle, transparent 50%, rgba(80,0,6,.3) 54%, transparent 59%), radial-gradient(circle at 42% 38%, #ff6b6b, #ef2f37 34%, #c4131c 70%, #8a0a12); }
.jeu-vedette.jeu-p4 .cartes-deco span:nth-child(2) { right: 18px; top: 2px; background: radial-gradient(circle at 33% 27%, rgba(255,255,255,.65), transparent 26%), radial-gradient(circle, transparent 50%, rgba(120,70,0,.3) 54%, transparent 59%), radial-gradient(circle at 42% 38%, #fff08a, #ffd23f 34%, #f2ad00 70%, #a96f00); }
.jeu-vedette.jeu-p4 .cartes-deco span:nth-child(3) { right: 34px; top: 46px; background: radial-gradient(circle at 33% 27%, rgba(255,255,255,.55), transparent 26%), radial-gradient(circle, transparent 50%, rgba(80,0,6,.3) 54%, transparent 59%), radial-gradient(circle at 42% 38%, #ff6b6b, #ef2f37 34%, #c4131c 70%, #8a0a12); }

/* Pictionary : feuille blanche, crayon, rose et ambre */
.jeu-vedette.jeu-pc {
  border-color: rgba(244, 114, 182, 0.4);
  background:
    radial-gradient(90% 70% at 100% 0%, rgba(236, 72, 153, 0.36), transparent 60%),
    radial-gradient(70% 60% at 0% 100%, rgba(245, 158, 11, 0.2), transparent 65%),
    linear-gradient(160deg, #2a1240, #120d22);
}
.jeu-vedette.jeu-pc .cartes-deco span:nth-child(1) { background: #fff; border-color: rgba(255, 255, 255, 0.7); }
.jeu-vedette.jeu-pc .cartes-deco span:nth-child(2) { font-family: var(--titre); font-weight: 700; font-size: 1.8rem; color: #fff; border-color: rgba(244, 114, 182, 0.7); background: linear-gradient(160deg, #db2777, #6b0f3a); }

/* Bouton son (ajouté par jeux-sons.js dans l'en-tête de chaque jeu) */
.btn-son { flex: none; }
.btn-son.son-coupe { opacity: .55; }

/* Navigateurs de TV (Chromium < 84) : pas de `gap` en flexbox. aspect-ratio (Chrome 88)
   sert de détecteur : ces marges ne s'appliquent qu'aux navigateurs qui n'ont ni l'un ni l'autre. */
@supports not (aspect-ratio: 1 / 1) {
  .entete > * + * { margin-left: 8px; }
  .entete-titre > * + * { margin-left: 8px; }
  .ecran > * + * { margin-top: 14px; }
  .liste-actions > * + * { margin-top: 8px; }
  .invite > * + * { margin-top: 12px; }
  .invite-compact > * + * { margin-left: 12px; }
  .puce-code > * + * { margin-left: 6px; }
  .cn-membres > * + * { margin-top: 6px; }
  .cn-membre > * + * { margin-left: 8px; }
  .cn-actions > * + * { margin-top: 10px; }
  .cn-carte { min-height: 3.4em; }
  /* QR : min() et aspect-ratio inconnus → hauteur nulle (seule l'ombre violette restait) */
  .qr { width: 300px; height: 300px; max-width: 100%; }
  .qr-moyen { width: 260px; height: 260px; }
  /* autres boîtes dimensionnées par aspect-ratio : hauteur de secours (padding en %) */
  .carte { width: 300px; height: 375px; max-width: 100%; }                 /* L'Imposteur */
  .pc-papier { height: 0; padding-top: 75%; }                              /* ardoise Pictionary (4/3) */
  .pc-papier .pc-canvas { position: absolute; top: 0; left: 0; }
  .pc-hero-papier { height: 142px; }
  .pc-coul { height: 24px; }
  .p4-cadre { height: 0; padding-top: 86.486%; }                           /* plateau Puissance 4 (7,4/6,4) */
  .p4-fantome { height: 0; padding-top: 13.514%; }                         /* 7,4/1 */
  .p4-mini i { height: 14px; }
}
@supports not (aspect-ratio: 1 / 1) {
  @media (min-width: 600px) and (min-height: 600px) {
    .qr, .qr-moyen { width: 340px; height: 340px; }
  }
}

/* Démo animée (GIF) des jeux */
.btn-demo { margin: 12px auto 0; display: block; width: auto; padding-left: 22px; padding-right: 22px; }
.bloc .btn-demo, .ecran > .btn-demo { margin-top: 10px; width: 100%; }
.demo-gif { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.12); }
.modale.modale-large { max-width: 1000px; }
@media (min-width: 900px) { .modale.modale-large { width: 92vw; } }
