/* Propriétaire : agent « Écrans — nuit et jour ». Écrans de la partie : briefing, nuit, aube, jour, vote, verdict.
   Tout est sous .jeu (aucune règle globale). Un écran = une étape, sans scroll ; cibles ≥ 44 px ; texte ≥ 11 px. */
.jeu {
  --fond: #0e1017; --fond-2: #171b29; --trait: #2c3248; --texte: #ece9e1; --discret: #9a9fb2;
  --lampe: #e6a947; --lampe-dim: #a97d35; --alerte: #d4604a; --ok: #86c296;
  position: relative; width: 100%; height: 100%; overflow: hidden;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
  background: var(--fond); color: var(--texte);
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.jeu *,
.jeu *::before,
.jeu *::after { box-sizing: border-box; }
.jeu [hidden] { display: none !important; }
.jeu button { font: inherit; color: inherit; }
/* La nuit : presque noir, texte et traits discrets. Identique pour tous les rôles. */
.jeu[data-ecran="NIGHT"] {
  --fond: #03040a; --fond-2: #090b13; --trait: #1a1f30; --texte: #8e94a8; --discret: #7a8096;
  --lampe: #8d7140; --lampe-dim: #6c5a38;
}

/* ───── Cadre ───── */
.jeu-bord {
  position: absolute; inset: 0; z-index: 5; pointer-events: none; opacity: 0;
  box-shadow: inset 0 0 34px 8px rgba(230, 169, 71, .9); transition: opacity .14s ease-out;
}
.jeu-ombre {
  flex: none; min-height: 30px; padding: 5px 16px; text-align: center; font-size: 13px; font-weight: 600;
  letter-spacing: .04em; background: #1c2033; color: #b9bdd0; border-bottom: 1px solid var(--trait);
}
.jeu-entete { flex: none; display: flex; align-items: center; justify-content: space-between; min-height: 36px; padding: 8px 16px 0; }
.jeu-etape { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--discret); }
.jeu-minuteur { font-size: 15px; font-variant-numeric: tabular-nums; color: var(--discret); min-width: 44px; text-align: right; }
.jeu-barre { flex: none; height: 2px; margin: 6px 16px 0; background: var(--trait); border-radius: 2px; overflow: hidden; }
.jeu-barre i { display: block; height: 100%; background: var(--lampe-dim); transform-origin: left; transform: scaleX(0); transition: transform .25s linear; }
.jeu-corps { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 14px 16px 30px; position: relative; } /* 30 px sous l'action principale (la zone sûre basse est dans le padding de .jeu) */
.jeu .conteneur { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.jeu .ecran { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; position: relative; }
.jeu .ecran-vide { align-items: center; justify-content: center; }
.jeu .consigne { margin: 0; font-size: 24px; line-height: 1.15; font-weight: 700; text-align: center; letter-spacing: .01em; }
.jeu .message-centre { margin: 0; text-align: center; font-size: 20px; color: var(--discret); }
.jeu .etiquette { margin: 0; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; color: var(--discret); }
.jeu .etiquette.vide,
.jeu .pastilles.vide { display: none; }
.jeu .compte { margin: 0; text-align: center; font-size: 13px; color: var(--discret); min-height: 18px; }

/* ───── Boutons ───── */
.jeu .bouton {
  flex: none; min-height: 52px; padding: 10px 18px; border: 0; border-radius: 14px; cursor: pointer;
  background: var(--lampe); color: #1a1305; font-size: 17px; font-weight: 700; letter-spacing: .02em;
}
.jeu .bouton.secondaire { background: transparent; color: var(--texte); border: 2px solid var(--trait); }
.jeu .bouton:disabled { opacity: .4; cursor: default; }
.jeu .bouton.cachee { visibility: hidden; }
.jeu .ecran-jour .bouton.cachee { display: none; }
.jeu .actions { flex: none; display: flex; gap: 10px; }
.jeu .actions .bouton { flex: 1; }

/* ───── Grille de noms (nuit, vote) ───── */
.jeu .grille { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(52px, 66px); gap: 10px; align-content: start; flex: none; }
.jeu .case {
  position: relative; display: flex; align-items: center; min-width: 0; min-height: 52px; padding: 8px 30px 8px 12px;
  text-align: left; cursor: pointer; border-radius: 12px; background: var(--fond-2); border: 2px solid var(--trait); font-weight: 600;
}
.jeu .case .nom { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jeu .case .toi { flex: none; margin-left: 6px; font-size: 11px; font-weight: 500; color: var(--discret); }
.jeu .case .coche { position: absolute; right: 10px; top: 8px; font-size: 15px; color: var(--lampe); opacity: 0; }
.jeu .case.choisie { border-color: var(--lampe); background: color-mix(in srgb, var(--lampe) 14%, var(--fond-2)); }
.jeu .case.choisie .coche { opacity: 1; }
.jeu .case:disabled { cursor: default; }
.jeu .case:disabled:not(.choisie) { opacity: .55; }
.jeu .case .marques { position: absolute; right: 8px; bottom: 5px; display: flex; gap: 3px; }
.jeu .case .marque {
  width: 17px; height: 17px; border-radius: 50%; font-size: 11px; line-height: 17px; text-align: center; font-weight: 700;
  background: #5a2a24; color: #e7b9b0; opacity: .75;
}
.jeu .recu { margin: 0; flex: none; min-height: 28px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; color: var(--discret); visibility: hidden; }
.jeu .recu.visible { visibility: visible; }
.jeu .recu-coche { color: var(--ok); }

/* ───── Nuit : respiration lente ───── */
.jeu .souffle {
  position: absolute; left: -16px; right: -16px; top: -14px; bottom: -22px; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 55%, rgba(70, 90, 150, .22), rgba(0, 0, 0, 0) 68%);
  animation: respire 8s ease-in-out infinite;
}
@keyframes respire { 0%, 100% { opacity: .15; transform: scale(.94); } 50% { opacity: .75; transform: scale(1.05); } }
.jeu .ecran-nuit > :not(.souffle) { position: relative; z-index: 1; }
.jeu .ecran-nuit { gap: 14px; }
.jeu .ecran-nuit .consigne { font-weight: 500; font-size: 22px; margin-top: 4px; }

/* ───── Briefing : la carte ───── */
.jeu .carte {
  flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 18px 16px; text-align: center; border-radius: 20px; border: 2px solid var(--trait); touch-action: none;
  background: repeating-linear-gradient(135deg, #12162a 0 14px, #0f1322 14px 28px); cursor: pointer; outline: none;
}
.jeu .carte:focus-visible { border-color: var(--lampe); }
.jeu .carte.lecture { border-color: var(--lampe); background: linear-gradient(170deg, #26202a, #14121a); }
.jeu .carte-motif { width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--trait); box-shadow: inset 0 0 0 10px #12162a, inset 0 0 0 12px var(--trait); }
.jeu .carte-dos { margin: 0; font-size: 17px; color: var(--discret); max-width: 220px; }
.jeu .carte-role { margin: 0; font-size: clamp(28px, 9vw, 40px); line-height: 1.1; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--lampe); }
.jeu .carte-camp { margin: 0; font-size: 15px; color: var(--discret); }
.jeu .carte-but { margin: 0; font-size: 16px; max-width: 260px; }
.jeu .carte-complices { margin: 4px 0 0; font-size: 17px; font-weight: 700; color: var(--alerte); }
.jeu .aide { margin: 0; flex: none; text-align: center; font-size: 13px; color: var(--discret); }
.jeu .aide.cachee { visibility: hidden; }
.jeu .pastilles { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; flex: none; }
.jeu .pastille { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 28px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--trait); font-size: 13px; color: var(--discret); }
.jeu .pastille.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--trait)); }
.jeu .pastille-nom { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 110px; }
.jeu .pret-liste { justify-content: center; }

/* ───── Aube ───── */
.jeu .ecran-aube { gap: 10px; }
.jeu .aube-titre { font-size: 26px; flex: none; }
.jeu .aube-zone { position: relative; flex: 1; min-height: 120px; perspective: 900px; }
.jeu .carte3d { position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateY(180deg); transition: transform .8s cubic-bezier(.3, .7, .2, 1); }
.jeu .aube-zone.retournee .carte3d { transform: rotateY(0deg); }
.jeu .face {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  border-radius: 20px; border: 2px solid var(--trait); backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.jeu .face-avant { background: linear-gradient(170deg, #26202a, #14121a); border-color: var(--lampe); }
.jeu .face-arriere { background: repeating-linear-gradient(135deg, #12162a 0 14px, #0f1322 14px 28px); transform: rotateY(180deg); }
.jeu .aube-lune { display: none; position: absolute; left: 50%; top: 50%; width: 86px; height: 86px; margin: -43px 0 0 -43px; border-radius: 50%; box-shadow: inset -22px -6px 0 0 #3a4260; opacity: .8; }
.jeu .aube-zone.vide .carte3d { display: none; }
.jeu .aube-zone.vide .aube-lune { display: block; }
.jeu .souffle-ombres { flex: none; margin: 0; height: 44px; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 14px; color: #b9bdd0; font-style: italic; overflow: hidden; }
.jeu .souffle-ombres.vide { visibility: hidden; }
.jeu .ligne-privee {
  flex: none; margin: 0; height: 68px; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 6px 14px;
  border-radius: 12px; border: 1px dashed var(--trait); background: var(--fond-2); overflow: hidden;
}
.jeu .prive-etiquette { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--discret); }
.jeu .prive-texte { font-size: 16px; font-weight: 600; line-height: 1.2; }

/* ───── Jour : le plus vide possible ───── */
.jeu .ecran-jour { gap: 10px; }
.jeu[data-ecran="DAY"] .jeu-minuteur { font-size: 34px; font-weight: 300; color: var(--texte); }
.jeu[data-ecran="DAY"] .jeu-entete { min-height: 48px; }
.jeu .jour-liste { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
.jeu .jour-liste > * { flex: none; }
.jeu .pastille.moi { color: var(--texte); border-color: var(--discret); }
.jeu .pastille.ombre { border-style: dashed; opacity: .85; }
.jeu .pastille-role { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--lampe); }
.jeu .bouton-indices { touch-action: none; }
.jeu .jour-liste { position: relative; }
.jeu .indices { display: none; position: absolute; inset: 0; z-index: 2; padding: 4px 2px; background: var(--fond); overflow: hidden; }
.jeu .indices.ouvert { display: block; }
.jeu .indice { margin: 0 0 6px; font-size: 16px; }

/* ───── Vote ───── */
.jeu .ecran-vote { gap: 12px; }
.jeu .ecran-vote .grille { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.jeu .ecran-vote .recu { margin-top: auto; }

/* ───── Verdict ───── */
.jeu .ecran-verdict { gap: 10px; }
.jeu .verdict-titre { font-size: 24px; flex: none; }
.jeu .verdict-carte { flex: none; padding: 14px; border-radius: 16px; border: 2px solid var(--lampe); background: linear-gradient(170deg, #26202a, #14121a); text-align: center; }
.jeu .verdict-carte.vide { display: none; }
.jeu .verdict-carte .carte-role { font-size: 28px; }
.jeu .votes { list-style: none; margin: 0; padding: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 4px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
.jeu .votes > li { flex: none; }
.jeu .vote-ligne { min-height: 28px; padding: 4px 12px; border-radius: 8px; font-size: 15px; background: var(--fond-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jeu .vote-ligne.vise { border-left: 3px solid var(--lampe); }

/* ───── Petits écrans (320×568, 375×667) ───── */
@media (max-height: 700px) {
  .jeu .pastille { min-height: 26px; padding: 2px 9px; }
  .jeu .pastilles { gap: 5px; }
  .jeu .jour-liste { gap: 6px; }
  .jeu-corps { padding: 8px 16px 30px; }
  .jeu .consigne { font-size: 21px; }
  .jeu .ecran { gap: 8px; }
  .jeu .grille { gap: 8px; grid-auto-rows: minmax(48px, 56px); }
  .jeu .case { min-height: 48px; }
  .jeu .carte-dos { font-size: 16px; }
  .jeu .aube-titre { font-size: 22px; }
  .jeu[data-ecran="DAY"] .jeu-minuteur { font-size: 28px; }
  .jeu .ligne-privee { height: 62px; }
  .jeu .vote-ligne { min-height: 26px; padding: 3px 12px; font-size: 14px; }
  .jeu .souffle-ombres { height: 38px; }
}
@media (max-height: 600px) {
  .jeu .pastille { min-height: 24px; padding: 1px 8px; font-size: 12px; }
  .jeu .pastille-role { font-size: 11px; }
  .jeu .pastilles { gap: 4px; }
  .jeu .ecran-jour { gap: 6px; }
  .jeu .ecran-jour .bouton { min-height: 46px; padding-top: 6px; padding-bottom: 6px; }
  .jeu .souffle-ombres { height: 34px; }
  .jeu-corps { padding: 4px 14px 30px; }
  .jeu-entete { min-height: 30px; padding-top: 4px; }
  .jeu .carte-role { font-size: 28px; }
  .jeu .carte-but { font-size: 14px; }
  .jeu .verdict-carte { padding: 8px; }
  .jeu .verdict-carte .carte-role { font-size: 22px; }
  .jeu .aube-zone { min-height: 100px; }
  .jeu .votes { gap: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  .jeu .souffle { animation: none; opacity: .4; }
  .jeu .carte3d { transition: none; }
  .jeu-bord { transition: none; }
}
