:root {
  --fond: #0e1220;
  --panneau: rgba(18, 22, 38, 0.9);
  --bord: rgba(255, 255, 255, 0.13);
  --texte: #eeeadd;
  --discret: #a3a8b8;
  --accent: #e8a33d;
  --accent-fonce: #b9761b;
  --danger: #e25b4b;
  --ok: #7cc96b;
  --loup: #ff6b5b;
  --ia: #7fd3ff;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--fond); color: var(--texte);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-user-select: none; user-select: none; }
canvas#jeu { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.cache { display: none !important; }
a { color: var(--accent); }

.ecran { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(ellipse at 50% 20%, rgba(60, 60, 110, 0.75), rgba(8, 10, 20, 0.96)); overflow-y: auto; z-index: 10; }
.ecran.voile { background: rgba(5, 7, 15, 0.72); z-index: 20; }
.ecran.visible { display: flex; }
.carte-ui { background: var(--panneau); border: 1px solid var(--bord); border-radius: 16px; padding: 22px; width: min(450px, 100%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); display: flex; flex-direction: column; gap: 12px; margin: auto; }
.carte-ui.large { width: min(620px, 100%); }
h1 { margin: 0; font-size: 46px; letter-spacing: 6px; text-align: center; color: var(--accent);
  text-shadow: 0 4px 0 #5a1f12, 0 8px 22px rgba(0, 0, 0, 0.7); line-height: 1.05; }
h2, h3 { margin: 0; }
.sous-titre { margin: -4px 0 4px; text-align: center; color: var(--discret); font-style: italic; }
.discret { color: var(--discret); font-size: 13px; margin: 0; text-align: center; }
.champ { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--discret); }
input { font: inherit; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--bord); background: rgba(0, 0, 0, 0.35);
  color: var(--texte); outline: none; min-width: 0; -webkit-user-select: text; user-select: text; }
input:focus { border-color: var(--accent); }
.ligne { display: flex; gap: 8px; }
.ligne > * { flex: 1; }
.btn { font: inherit; font-weight: 600; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--bord); cursor: pointer;
  background: rgba(255, 255, 255, 0.08); color: var(--texte); transition: transform 0.08s, background 0.15s; touch-action: manipulation; }
.btn:hover { background: rgba(255, 255, 255, 0.15); }
.btn:active { transform: scale(0.97); }
.btn.principal { background: linear-gradient(var(--accent), var(--accent-fonce)); color: #2b1600; border-color: #f5c06f; }
.btn.petit { padding: 8px 10px; font-size: 13px; flex: none; }
.btn.pour { background: #7a2a22; border-color: #e25b4b; } .btn.contre { background: #23532e; border-color: #7cc96b; }
.btn.choisi { outline: 3px solid #fff; }
.btn.enorme { font-size: 28px; padding: 18px; letter-spacing: 3px; }
.btn.rond { width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 19px; background: var(--panneau); }
.btn.actif { background: var(--ok); color: #102a0b; } .btn.coupe { background: var(--danger); color: #fff; }
.case { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.case input { width: 18px; height: 18px; flex: none; }
.case-ia { background: rgba(127, 211, 255, 0.08); border: 1px dashed rgba(127, 211, 255, 0.45); border-radius: 10px; padding: 10px; }
.case-ia small { color: var(--discret); }
.discret-case { color: var(--discret); font-size: 13px; }
.regles { font-size: 14px; color: var(--discret); }
.regles summary { cursor: pointer; color: var(--texte); }
.regles ul { padding-left: 18px; margin: 8px 0 0; display: flex; flex-direction: column; gap: 5px; }
.regle-accueil b { color: var(--accent); }
.ia { color: var(--ia); }

/* ---------------- HUD ---------------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { pointer-events: auto; }
#hud-haut, #annonce, #toasts, #journal, #hud-regle, #bandeau, #barre-tache { pointer-events: none !important; }
#hud-haut { position: absolute; top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; gap: 12px; align-items: center;
  background: var(--panneau); border: 1px solid var(--bord); border-radius: 12px; padding: 7px 14px; font-weight: 700; white-space: nowrap; font-size: 15px; }
#hud-minuteur { color: var(--accent); font-variant-numeric: tabular-nums; }
#hud-compte { font-size: 13px; color: var(--discret); font-weight: 600; }
#hud-regle { position: absolute; top: calc(48px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--discret);
  background: rgba(0,0,0,.4); padding: 2px 9px; border-radius: 10px; white-space: nowrap; }
.role-carte { position: absolute; top: calc(8px + env(safe-area-inset-top)); left: calc(8px + env(safe-area-inset-left)); background: var(--panneau);
  border: 1px solid var(--bord); border-radius: 12px; padding: 6px 10px; color: var(--texte); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer;
  display: flex; gap: 6px; align-items: center; max-width: 220px; text-align: left; }
.role-carte.loup { border-color: var(--loup); color: #ffd2cc; }
.role-carte small { display: block; font-weight: 500; font-size: 11px; color: var(--discret); }
#colonne-droite { position: absolute; top: calc(8px + env(safe-area-inset-top)); right: calc(8px + env(safe-area-inset-right)); display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
#minicarte { width: 150px; height: 150px; border: 1px solid var(--bord); border-radius: 50%; background: #0b0f0a; }
#hud-boutons { display: flex; gap: 6px; }
#panneau-vote { position: absolute; top: calc(70px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(420px, calc(100% - 24px));
  background: rgba(60, 20, 18, 0.92); border: 1px solid #e25b4b; border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; text-align: center;
  box-shadow: 0 0 24px rgba(226, 91, 75, 0.35); }
#panneau-vote h4 { margin: 0; font-size: 16px; }
#panneau-vote .jauge { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: rgba(255,255,255,.12); }
#panneau-vote .jauge i { background: #e25b4b; } #panneau-vote .jauge b { background: #7cc96b; margin-left: auto; }
#panneau-vote .info { font-size: 13px; color: #f3d2cc; }
#panneau-vote.verdict { background: rgba(20, 20, 30, 0.95); }
#bandeau { position: absolute; top: calc(70px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(480px, calc(100% - 24px));
  text-align: center; background: rgba(60, 40, 100, 0.88); border-radius: 10px; padding: 8px 12px; font-size: 14px; }
#panneau-vote:not(.cache) ~ #bandeau { top: calc(190px + env(safe-area-inset-top)); }
#journal { position: absolute; left: calc(10px + env(safe-area-inset-left)); bottom: calc(14px + env(safe-area-inset-bottom)); width: min(430px, calc(100% - 20px));
  display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
#journal div { background: rgba(0,0,0,.5); padding: 3px 8px; border-radius: 8px; text-shadow: 0 1px 2px #000; animation: fondu 14s forwards; overflow-wrap: anywhere; }
#journal div.alerte { color: #ffb36b; } #journal div.mort, #journal div.grand { color: #ff8f80; font-weight: 600; } #journal div.vote { color: #ffd479; }
#journal div.role { color: #9fe0ff; } #journal div.phase { color: #fff; font-weight: 700; }
@keyframes fondu { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
#selection { position: absolute; bottom: calc(14px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: var(--panneau);
  border: 1px solid var(--bord); border-radius: 12px; padding: 8px 10px; display: flex; gap: 8px; align-items: center; font-size: 14px; max-width: calc(100% - 24px); flex-wrap: wrap; justify-content: center; }
#selection .nom { font-weight: 700; }
#barre-tache { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); width: 120px; height: 8px; background: rgba(0,0,0,.6); border-radius: 4px; overflow: hidden; }
#barre-tache i { display: block; height: 100%; width: 0; background: var(--accent); }
#aide-touches { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 6; font-size: 14px; }
#aide-touches p { margin: 0; line-height: 1.5; }
#annonce { position: absolute; top: 28%; left: 0; right: 0; text-align: center; font-size: 40px; font-weight: 900; color: var(--accent);
  text-shadow: 0 3px 0 #3a1508, 0 6px 22px #000; opacity: 0; transition: opacity 0.5s; padding: 0 16px; }
#annonce.visible { opacity: 1; }
#annonce small { display: block; font-size: 18px; color: var(--texte); font-weight: 600; margin-top: 6px; }
#toasts { position: absolute; bottom: calc(120px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column;
  align-items: center; gap: 6px; width: min(420px, calc(100% - 32px)); }
.toast { background: var(--panneau); border: 1px solid var(--bord); border-radius: 8px; padding: 6px 12px; font-size: 14px; animation: toast 3s forwards; text-align: center; }
.toast.erreur { border-color: var(--danger); }
@keyframes toast { 0% { opacity: 0; transform: translateY(8px); } 10%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }
#menu-jeu { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(320px, calc(100% - 32px)); z-index: 6; }

/* Popup de manche */
#pm-role { text-align: center; }
#pm-role .emoji { font-size: 54px; line-height: 1.1; }
#pm-role h2 { font-size: 28px; }
#pm-role h2.loup { color: var(--loup); }
#pm-role p { margin: 6px 0 0; color: var(--discret); }
.rappel-ia { background: rgba(127, 211, 255, 0.08); border: 1px solid rgba(127, 211, 255, 0.4); border-radius: 12px; padding: 12px; font-size: 14px; }
.rappel-ia h3 { font-size: 16px; color: var(--ia); margin-bottom: 6px; }
.rappel-ia p { margin: 6px 0 0; line-height: 1.45; }
/* Fin */
#fin-titre { text-align: center; font-size: 32px; }
#fin-titre.victoire { color: var(--ok); } #fin-titre.defaite { color: var(--danger); }
#fin-resume { text-align: center; margin: 0; color: var(--discret); }
#fin-table { max-height: 42vh; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px; font-size: 13px; }
#fin-table div { background: rgba(255,255,255,.05); border-radius: 6px; padding: 4px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#fin-table div.loup { background: rgba(226, 91, 75, 0.2); } #fin-table div.mort { opacity: 0.6; } #fin-table div.moi { outline: 1px solid var(--accent); }

/* Commandes tactiles */
.tactile { display: none; position: absolute; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 2; }
body.tactile-on .tactile { display: flex; }
body.tactile-on #actions { display: grid; }
#stick { left: calc(22px + env(safe-area-inset-left)); width: 130px; height: 130px; border-radius: 50%; background: rgba(255,255,255,.1);
  border: 2px solid rgba(255,255,255,.3); align-items: center; justify-content: center; touch-action: none; }
#nub { width: 54px; height: 54px; border-radius: 50%; background: rgba(255,255,255,.45); pointer-events: none; }
#actions { right: calc(16px + env(safe-area-inset-right)); grid-template-columns: repeat(2, 62px); gap: 9px; direction: rtl; }
.act { direction: ltr; width: 62px; height: 62px; border-radius: 50%; border: 2px solid rgba(255,255,255,.45); background: rgba(18,22,38,.8); color: #fff;
  font-size: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; touch-action: manipulation; padding: 0; font-family: inherit; }
.act small { font-size: 9px; font-weight: 600; margin-top: 3px; opacity: .9; max-width: 58px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.act.dispo { background: rgba(232,163,61,.85); color: #2b1600; border-color: #f5c06f; }
.act.inactif { opacity: .45; }
.act.actif { background: var(--ok); } .act.coupe { background: var(--danger); }
#act-voter.urgent { background: rgba(226,91,75,.9); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }
body.gaucher #stick { left: auto; right: calc(22px + env(safe-area-inset-right)); }
body.gaucher #actions { right: auto; left: calc(16px + env(safe-area-inset-left)); direction: ltr; }
body.tactile-on .pc-seulement { display: none; }
body.tactile-on #journal { bottom: calc(240px + env(safe-area-inset-bottom)); width: min(380px, calc(100% - 20px)); font-size: 12px; }
body.tactile-on #selection { bottom: auto; top: calc(170px + env(safe-area-inset-top)); }
body.tactile-on #toasts { bottom: calc(380px + env(safe-area-inset-bottom)); }

@media (max-width: 700px), (max-height: 500px) {
  h1 { font-size: 34px; letter-spacing: 3px; }
  #hud-haut { font-size: 13px; gap: 7px; padding: 5px 9px; top: calc(54px + env(safe-area-inset-top)); left: calc(8px + env(safe-area-inset-left)); transform: none; }
  #hud-regle { display: none; }
  .role-carte { font-size: 13px; padding: 5px 8px; max-width: calc(100% - 140px); }
  #minicarte { width: 104px; height: 104px; }
  #panneau-vote { top: calc(96px + env(safe-area-inset-top)); }
  #bandeau { top: calc(96px + env(safe-area-inset-top)); font-size: 13px; }
  #annonce { font-size: 30px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  #hud-haut { top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); }
  #panneau-vote, #bandeau { top: calc(46px + env(safe-area-inset-top)); }
  body.tactile-on #journal { bottom: calc(10px + env(safe-area-inset-bottom)); left: 170px; width: calc(100% - 340px); }
  body.tactile-on #selection { bottom: calc(120px + env(safe-area-inset-bottom)); }
}

#ecran-micro { background: rgba(0, 0, 0, 0.45); z-index: 30; }
#ecran-micro h2 { text-align: center; }
.micro-choix { display: flex; gap: 8px; }
.micro-choix .btn { flex: 1; }

/* ---------------- Accueil : jeu de village illustre chaleureux (parchemin, bois, cire) ---------------- */
#ecran-accueil {
  padding: 0;
  overflow: hidden;
  align-items: stretch;
  justify-content: stretch;
  background:
    radial-gradient(ellipse 72% 66% at 50% 48%, rgba(20, 14, 10, 0) 44%, rgba(20, 14, 10, 0.56) 100%),
    linear-gradient(180deg, rgba(22, 15, 10, 0.62) 0%, rgba(22, 15, 10, 0) 24%, rgba(22, 15, 10, 0) 70%, rgba(22, 15, 10, 0.68) 100%);
  transition: background 0.3s ease;
}
#ecran-accueil.choix-ouverts {
  background: rgba(18, 13, 10, 0.66);
}

.accueil-v3 {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding:
    max(18px, env(safe-area-inset-top))
    max(22px, env(safe-area-inset-right))
    max(22px, env(safe-area-inset-bottom))
    max(22px, env(safe-area-inset-left));
  pointer-events: none;
  overflow-y: auto;
}

/* Bandeau superieur : titre + embleme a gauche, acces rapide a droite */
.acc-haut {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.acc-marque {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(480px, 60vw);
}
.acc-embleme {
  width: 68px;
  height: 68px;
  flex: none;
  border-radius: 50%;
  background: #232d45;
  box-shadow: 0 4px 0 #3e2615, 0 10px 20px rgba(16, 10, 5, 0.5);
}
.acc-embleme svg { display: block; width: 100%; height: 100%; }

.acc-titre-bloc {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}
.accueil-v3 h1 {
  margin: 0;
  font-family: Georgia, "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: clamp(28px, 3.8vw, 46px);
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1;
  text-align: left;
  white-space: nowrap;
  color: #fff6e5;
  text-shadow: 0 3px 0 #3e2615, 0 6px 16px rgba(16, 10, 5, 0.72);
  position: relative;
  padding-bottom: 6px;
}
.accueil-v3 h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 78%;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, #c84630 0%, #8a5630 72%, transparent 100%);
}

.acc-sous-titre {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
}
.acc-accroche {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff4df;
  background: #3e2615;
  border: 2px solid #6e472b;
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: 0 2px 0 #26160c;
}

/* Barre d acces rapide en haut a droite : pastilles solides bois et creme */
.acc-outils {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.acc-statut {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  background: #3e2615;
  border: 2px solid #754b2c;
  box-shadow: 0 3px 0 #24140a, 0 6px 14px rgba(16, 10, 5, 0.35);
  color: #f7eedc;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.acc-statut::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #67c976;
  box-shadow: 0 0 0 2px rgba(103, 201, 118, 0.28);
  flex: none;
}
.acc-outil-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 11px;
  border: 2px solid #5c3a21;
  background: linear-gradient(180deg, #faf2e2 0%, #ede0c4 100%);
  color: #2b1d12;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 0 #3e2615, 0 6px 14px rgba(16, 10, 5, 0.32);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
}
.acc-outil-btn:hover, .acc-outil-btn:focus-visible {
  background: linear-gradient(180deg, #fffaf0 0%, #f5e8ce 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 0 #3e2615, 0 9px 18px rgba(16, 10, 5, 0.38);
  outline: none;
}
.acc-outil-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #3e2615;
}
.acc-outil-principal {
  border-color: #162238;
  background: linear-gradient(180deg, #2b3d61 0%, #1f2b44 100%);
  color: #fff5e4;
  box-shadow: 0 3px 0 #131b2c, 0 6px 14px rgba(16, 10, 5, 0.38);
}
.acc-outil-principal:hover, .acc-outil-principal:focus-visible {
  background: linear-gradient(180deg, #344a74 0%, #253452 100%);
  box-shadow: 0 4px 0 #131b2c, 0 9px 18px rgba(16, 10, 5, 0.44);
}
.acc-outil-principal:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #131b2c;
}

/* Zone basse (entree) et centrale (selection de village) */
.acc-corps {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  min-height: 0;
  padding-top: 16px;
}

.acc-entree {
  pointer-events: auto;
  width: min(356px, 100%);
  padding: 18px;
  border-radius: 16px;
  background: linear-gradient(180deg, #faf2e2 0%, #ede0c4 100%);
  border: 3px solid #5c3a21;
  box-shadow:
    0 6px 0 #3e2615,
    0 18px 36px rgba(16, 10, 5, 0.54),
    inset 0 1px 0 #fffbf2;
  color: #2b1d12;
  display: flex;
  flex-direction: column;
  gap: 13px;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.acc-identite .champ { gap: 6px; color: #543b24; }
.acc-champ-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5c3a21;
}
.acc-identite input {
  width: 100%;
  font-size: 16px;
  font-weight: 700;
  padding: 12px 14px;
  border-radius: 11px;
  border: 2px solid #9d7750;
  background: #fffcf5;
  color: #2b1d12;
  box-shadow: inset 0 2px 4px rgba(62, 38, 21, 0.1);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.acc-identite input::placeholder { color: #8c735a; font-weight: 500; }
.acc-identite input:focus {
  border-color: #c84630;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(200, 70, 48, 0.2), inset 0 1px 3px rgba(62, 38, 21, 0.08);
}

/* Gros bouton JOUER 3D arcade rouge cire / terracotta */
#acc-ouvrir {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  padding: 14px 18px;
  border-radius: 13px;
  border: 2px solid #8f2d1d;
  background: linear-gradient(180deg, #dc5942 0%, #c84630 58%, #b33824 100%);
  color: #fff8ee;
  box-shadow:
    0 5px 0 #7a2618,
    0 11px 22px rgba(42, 16, 8, 0.4),
    inset 0 1px 0 rgba(255, 224, 210, 0.45);
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.16s ease;
}
#acc-ouvrir::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 28%, rgba(255, 245, 232, 0.26) 50%, transparent 72%);
  transform: translateX(-130%);
  transition: transform 0.6s ease;
}
#acc-ouvrir:hover, #acc-ouvrir:focus-visible {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow:
    0 6px 0 #7a2618,
    0 14px 26px rgba(42, 16, 8, 0.46),
    inset 0 1px 0 rgba(255, 234, 222, 0.58);
  outline: none;
}
#acc-ouvrir:hover::after { transform: translateX(130%); }
#acc-ouvrir:active {
  transform: translateY(4px);
  box-shadow:
    0 1px 0 #7a2618,
    0 4px 10px rgba(42, 16, 8, 0.34);
}
.acc-jouer-lib {
  font-family: Georgia, "Palatino Linotype", serif;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1.05;
  text-shadow: 0 2px 0 rgba(94, 24, 12, 0.55);
}
.acc-jouer-sous {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffe9dc;
}

.acc-bc { display: none; flex-direction: column; gap: 8px; }
body.avec-bc .acc-bc { display: flex; }
body.avec-bc #acc-ouvrir, body.avec-bc #acc-choix { display: none; }
.acc-bc #btn-jouer {
  border: 2px solid #8f2d1d;
  background: linear-gradient(180deg, #dc5942 0%, #c84630 100%);
  color: #fff8ee;
  box-shadow: 0 4px 0 #7a2618;
}
.acc-bc #btn-jouer:active { transform: translateY(3px); box-shadow: 0 1px 0 #7a2618; }
.acc-bc .discret { color: #5e4631; font-weight: 600; }

.acc-erreur {
  margin: 0;
  padding: 9px 11px;
  border-radius: 10px;
  background: #fdeae6;
  border: 2px solid #c84630;
  color: #7a2015;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

/* Etat ouvert : selection du village centree, 2 colonnes sur grand ecran */
#ecran-accueil.choix-ouverts .acc-corps {
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
}
#ecran-accueil.choix-ouverts .acc-entree {
  width: min(860px, 100%);
  padding: 12px 18px;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
}
#ecran-accueil.choix-ouverts .acc-identite { flex: 1 1 240px; }
#ecran-accueil.choix-ouverts .acc-identite .champ {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}
#ecran-accueil.choix-ouverts .acc-identite input { padding: 9px 12px; }
#ecran-accueil.choix-ouverts .acc-erreur { flex: 1 1 100%; }

#acc-choix {
  pointer-events: auto;
  width: min(860px, 100%);
  padding: 20px 22px;
  border-radius: 18px;
  background: linear-gradient(180deg, #faf2e2 0%, #ebdcb9 100%);
  border: 3px solid #5c3a21;
  box-shadow:
    0 7px 0 #3e2615,
    0 24px 48px rgba(14, 9, 4, 0.62),
    inset 0 1px 0 #fffbf2;
  color: #2b1d12;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: acc-apparition 0.22s ease-out;
}
@keyframes acc-apparition {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.acc-entete { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.acc-entete h2 { font-size: 16px; font-weight: 800; color: #2b1d12; }
.acc-choix-entete {
  justify-content: flex-start;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 2px solid #d5bf99;
}
.acc-choix-titre { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acc-choix-titre h2 {
  font-family: Georgia, "Palatino Linotype", serif;
  font-size: 22px;
  letter-spacing: 0.03em;
  color: #2b1d12;
}
.acc-choix-sous { margin: 0; font-size: 12px; font-weight: 600; color: #664c34; }
.acc-retour-btn {
  border: 2px solid #5c3a21;
  background: #fffaf0;
  color: #2b1d12;
  padding: 8px 14px;
  font-weight: 700;
  box-shadow: 0 3px 0 #3e2615;
}
.acc-retour-btn:hover { background: #ffffff; transform: translateY(-1px); }
.acc-retour-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #3e2615; }

.acc-choix-grille {
  display: grid;
  grid-template-columns: 1.18fr 0.92fr;
  gap: 18px;
  align-items: start;
}
.acc-col-modes { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.acc-section-titre {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7c4625;
}

/* Cartes de modes de village : vraies cartes de jeu de societe illustrees */
.acc-types { display: flex; flex-direction: column; gap: 11px; }
.acc-type {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 74px;
  padding: 12px 14px;
  color: #2b1d12;
  background: linear-gradient(180deg, #fffdf8 0%, #f8eedb 100%);
  border: 2px solid #6b4628;
  border-radius: 14px;
  box-shadow:
    0 4px 0 #5c3a21,
    0 6px 14px rgba(45, 28, 14, 0.16),
    inset 0 1px 0 #ffffff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.15s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.15s ease;
}
.acc-type:hover, .acc-type:focus-visible {
  background: linear-gradient(180deg, #ffffff 0%, #fcf4e4 100%);
  border-color: #c84630;
  box-shadow:
    0 8px 0 #5c3a21,
    0 14px 24px rgba(45, 28, 14, 0.24),
    inset 0 1px 0 #ffffff;
  transform: translateY(-4px);
  outline: none;
}
.acc-type:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #5c3a21;
}
.acc-visuel-cadre {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #f3e0c2;
  border: 2px solid #8a5e3b;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
}
.acc-type[data-mode="bots"] .acc-visuel-cadre {
  background: #f9e3dc;
  border-color: #b85643;
}
.acc-type[data-mode="bots"] .acc-visuel { color: #a83926; }
.acc-type[data-mode="joueurs"] .acc-visuel-cadre {
  background: #e1f0e3;
  border-color: #3c7b50;
}
.acc-type[data-mode="joueurs"] .acc-visuel { color: #245c36; }
.acc-type[data-mode="bagatchat"] .acc-visuel-cadre {
  background: #e3ebf7;
  border-color: #3a5c8c;
}
.acc-type .acc-visuel {
  width: 30px;
  height: 28px;
  object-fit: contain;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5c3a21;
}
.acc-description { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.acc-description b { font-size: 15px; font-weight: 800; color: #2b1d12; }
.acc-description small { color: #644c36; font-size: 12px; font-weight: 500; }
.acc-enligne {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 6px 9px;
  border-radius: 10px;
  background: #e1f2e4;
  border: 2px solid #448a59;
  color: #1d5731;
}
.acc-type[data-mode="bagatchat"] .acc-enligne {
  background: #e3ecf8;
  border-color: #466ca3;
  color: #1c3a66;
}
.acc-enligne b { font-size: 15px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.acc-enligne small { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.85; white-space: nowrap; }

/* Bloc Entre amis : encadre taverne chaleureux */
.acc-salons {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 15px;
  border-radius: 14px;
  background: #efe0c1;
  border: 2px solid #7d5434;
  box-shadow: inset 0 2px 6px rgba(62, 38, 21, 0.12);
  color: #2b1d12;
  min-width: 0;
}
.acc-salons.invite {
  border-color: #c84630;
  box-shadow: 0 0 0 3px rgba(200, 70, 48, 0.22);
}
.acc-creer-btn {
  background: linear-gradient(180deg, #2b3d61 0%, #1f2b44 100%);
  border: 2px solid #162238;
  color: #fff6e6;
  font-weight: 700;
  box-shadow: 0 3px 0 #131b2c;
}
.acc-creer-btn:hover {
  background: linear-gradient(180deg, #354b76 0%, #263656 100%);
  transform: translateY(-1px);
}
.acc-creer-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #131b2c; }
.acc-invitation {
  margin: 0;
  padding: 8px 10px;
  border-radius: 9px;
  background: #fff7e6;
  border: 2px solid #c84630;
  font-size: 12px;
  font-weight: 700;
  color: #7c2718;
}
.acc-code { display: flex; gap: 7px; min-width: 0; }
.acc-code input {
  flex: 1;
  min-width: 0;
  text-transform: uppercase;
  letter-spacing: 3px;
  font-weight: 800;
  font-size: 15px;
  padding: 9px 11px;
  background: #fffcf5;
  border: 2px solid #9d7750;
  color: #2b1d12;
}
.acc-code input::placeholder { letter-spacing: 0; font-weight: 500; text-transform: none; font-size: 12px; color: #8c735a; }
.acc-code input:focus { border-color: #c84630; }
.acc-code .btn {
  flex: none;
  background: #5c3a21;
  border: 2px solid #3e2615;
  color: #fff6e6;
  font-weight: 700;
  box-shadow: 0 3px 0 #2b180c;
}
.acc-code .btn:hover { background: #6e4628; }
.acc-code .btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #2b180c; }
#acc-publics summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  color: #5c3a21;
  padding: 4px 0;
}
.liste-salons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 138px;
  overflow-y: auto;
  margin-top: 6px;
}
.liste-salons .discret { text-align: left; font-size: 12px; color: #644c36; }
.acc-salon {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fffaf0;
  border: 2px solid #c3a47b;
  color: #2b1d12;
  font-size: 12px;
}
.acc-salon .btn {
  background: #5c3a21;
  border-color: #3e2615;
  color: #fff6e6;
}
.acc-salon-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.acc-salon-txt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #2b1d12; }
.acc-salon-txt small { color: #644c36; font-size: 10px; font-weight: 600; }
.etat-attente { color: #1f6438; }
.etat-cours { color: #b5452a; }

/* Modale Options et regles : parchemin creme encadre bois */
#acc-options { z-index: 23; background: rgba(18, 13, 10, 0.72); }
.acc-options-carte {
  width: min(510px, 100%);
  background: linear-gradient(180deg, #faf2e2 0%, #ede0c4 100%);
  border: 3px solid #5c3a21;
  box-shadow:
    0 7px 0 #3e2615,
    0 24px 48px rgba(14, 9, 4, 0.65),
    inset 0 1px 0 #fffbf2;
  color: #2b1d12;
  gap: 14px;
}
.acc-options-carte #acc-options-fermer {
  background: #fffaf0;
  border: 2px solid #5c3a21;
  color: #2b1d12;
  box-shadow: 0 2px 0 #3e2615;
}
.acc-options-carte #acc-options-fermer:hover { background: #ffffff; }
.acc-options-bloc { display: flex; flex-direction: column; gap: 10px; }
.acc-options-carte .case { color: #2b1d12; font-weight: 600; }
.acc-options-carte .discret-case { color: #543d29; }
.acc-options-carte .case-ia {
  background: #e5eef8;
  border: 2px dashed #3d6394;
  color: #1b365d;
  font-weight: 700;
}
.acc-regles-bloc {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 13px 15px;
  border-radius: 12px;
  background: #fffaf0;
  border: 2px solid #cbb28a;
}
.acc-regles-bloc h3 { font-family: Georgia, "Palatino Linotype", serif; font-size: 15px; color: #7a331e; }
.acc-regles-bloc p { margin: 0; font-size: 13px; line-height: 1.5; color: #3a291b; }
.acc-options-carte .regle-accueil { text-align: left; font-size: 13px; line-height: 1.45; color: #543d29; }
.acc-options-carte .regle-accueil b { color: #9c341f; }
.acc-options-carte .regle-accueil:empty { display: none; }
.acc-options-pied {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.acc-options-pied a {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fffaf0;
  border: 2px solid #5c3a21;
  color: #2b1d12;
  box-shadow: 0 3px 0 #3e2615;
}
.acc-options-pied a:hover { background: #ffffff; }
.acc-options-pied #acc-options-ok {
  border: 2px solid #8f2d1d;
  background: linear-gradient(180deg, #dc5942 0%, #c84630 100%);
  color: #fff8ee;
  box-shadow: 0 3px 0 #7a2618;
  padding: 9px 18px;
}
.acc-options-pied #acc-options-ok:hover { filter: brightness(1.06); }
.acc-options-pied #acc-options-ok:active { transform: translateY(2px); box-shadow: 0 1px 0 #7a2618; }

/* Responsive Accueil : tablette & mobile portrait */
@media (max-width: 859px) {
  .acc-choix-grille { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 760px) {
  .accueil-v3 {
    padding:
      max(12px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(14px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }
  .acc-haut { gap: 8px; align-items: center; }
  .acc-marque { gap: 9px; max-width: none; flex: 1; min-width: 0; }
  .acc-embleme { width: 46px; height: 46px; }
  .accueil-v3 h1 { font-size: 22px; letter-spacing: 0.08em; padding-bottom: 4px; }
  .acc-accroche { display: none; }
  .acc-outils { gap: 6px; flex-wrap: nowrap; }
  .acc-statut { display: none; }
  .acc-outil-btn { padding: 8px 10px; font-size: 12px; }
  .acc-outil-btn span { display: none; }
  .acc-outil-principal span { display: inline; }
  .acc-corps { align-items: stretch; }
  .acc-entree { width: 100%; padding: 14px; gap: 10px; }
  .acc-jouer-lib { font-size: 23px; }
  #ecran-accueil.choix-ouverts .acc-corps { justify-content: flex-start; padding-top: 10px; }
  #ecran-accueil.choix-ouverts .acc-entree { padding: 10px 12px; }
  #ecran-accueil.choix-ouverts .acc-identite .champ { flex-direction: column; align-items: stretch; gap: 4px; }
  #acc-choix { padding: 14px; gap: 12px; }
  .acc-choix-entete { padding-bottom: 9px; }
  .acc-choix-titre h2 { font-size: 18px; }
  .acc-choix-sous { font-size: 11px; }
  .acc-type { min-height: 62px; padding: 10px 11px; gap: 10px; }
  .acc-visuel-cadre { width: 40px; height: 40px; }
  .acc-description b { font-size: 14px; }
  .acc-description small { font-size: 11px; }
  .acc-salons { padding: 12px; gap: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  #acc-ouvrir::after, #acc-choix { animation: none; transition: none; }
}
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.segment { display: flex; gap: 6px; }
.segment label { flex: 1; min-width: 0; position: relative; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment span { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 46px; padding: 8px; border-radius: 10px; border: 1px solid var(--bord);
  background: rgba(255, 255, 255, 0.06); color: var(--texte); font-size: 14px; font-weight: 600; text-align: center; cursor: pointer; }
.segment input:checked + span { background: rgba(232, 163, 61, 0.2); border-color: var(--accent); }
.segment input:focus-visible + span { outline: 2px solid #fff; }
select { font: inherit; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--bord); background: #1b2034; color: var(--texte); }
#ecran-creer-salon h2, #salle-attente h2 { text-align: center; }
#salle-attente { z-index: 15; }
#sa-nom { overflow-wrap: anywhere; }
.sa-code { display: flex; align-items: baseline; justify-content: center; gap: 10px; color: var(--discret); }
.sa-code b { font-size: 34px; letter-spacing: 6px; color: var(--accent); font-variant-numeric: tabular-nums; }
.sa-joueurs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow-y: auto; }
.sa-joueurs li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; min-height: 44px; border-radius: 10px; background: rgba(255, 255, 255, 0.06); }
.sa-joueurs li.moi { border: 1px solid rgba(232, 163, 61, 0.5); }
.sa-joueurs .sa-nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-joueurs small { color: var(--discret); }
.sa-exclure.confirmer { background: var(--danger); color: #fff; }
.badge-bc { width: 1.15em; height: 1.15em; vertical-align: -0.2em; }
@media (max-height: 500px) and (min-width: 600px) {
  .accueil-v3 { padding: 10px 14px; }
  .acc-embleme { width: 42px; height: 42px; }
  .accueil-v3 h1 { font-size: 22px; letter-spacing: 0.1em; padding-bottom: 3px; }
  .acc-accroche, .acc-statut { display: none; }
  .acc-outil-btn { padding: 6px 10px; font-size: 12px; }
  .acc-entree { width: min(440px, 100%); padding: 10px 12px; flex-direction: row; align-items: flex-end; gap: 10px; }
  .acc-identite { flex: 1; min-width: 0; }
  .acc-identite input { padding: 8px 10px; font-size: 14px; }
  #acc-ouvrir { width: auto; min-width: 140px; padding: 9px 16px; }
  .acc-jouer-lib { font-size: 19px; }
  .acc-jouer-sous { display: none; }
  #ecran-accueil.choix-ouverts .acc-corps { justify-content: flex-start; gap: 8px; padding-top: 6px; }
  #ecran-accueil.choix-ouverts .acc-entree { padding: 7px 12px; }
  #acc-choix { padding: 12px 14px; gap: 10px; }
  .acc-choix-entete { padding-bottom: 6px; }
  .acc-choix-titre h2 { font-size: 16px; }
  .acc-choix-sous { display: none; }
  .acc-choix-grille { grid-template-columns: 1.1fr 0.9fr; gap: 12px; }
  .acc-types { gap: 5px; }
  .acc-type { min-height: 46px; padding: 6px 9px; gap: 8px; }
  .acc-visuel-cadre { width: 32px; height: 32px; }
  .acc-description b { font-size: 13px; }
  .acc-description small { font-size: 10px; }
  .acc-salons { padding: 10px; gap: 6px; }
  #acc-publics { position: relative; }
  #acc-publics[open] .liste-salons { position: absolute; bottom: 100%; left: 0; right: 0; max-height: 130px; padding: 8px; background: #faf2e2; border: 2px solid #5c3a21; border-radius: 10px; box-shadow: 0 4px 0 #3e2615, 0 12px 24px rgba(16,10,5,0.45); z-index: 4; }
  #ecran-creer-salon .carte-ui { width: min(620px, 100%); padding: 14px; gap: 8px; }
  #form-creer-salon { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
  #form-creer-salon > h2, #form-creer-salon > .discret, #form-creer-salon > .ligne, #cs-erreur { grid-column: 1 / -1; }
  #form-creer-salon .champ { gap: 3px; }
  #form-creer-salon .segment span { min-height: 40px; padding: 6px; }
}
/* Partie v2 : objectifs, double vue et commandes lisibles sur petit écran. */
:root { --vue-w: 164px; --vue-h: 104px; --vue-top: 164px; --vue-right: calc(8px + env(safe-area-inset-right)); }
#jeu3d { display: none; touch-action: none; }
body.en-jeu.avec-3d #jeu3d { display: block; position: fixed; inset: 0; width: 100%; height: 100%; border-radius: 0; z-index: 0; }
body.en-jeu.avec-3d #jeu { inset: auto; top: var(--vue-top); right: var(--vue-right); width: var(--vue-w); height: var(--vue-h); border-radius: 10px; z-index: 4; pointer-events: none; }
#vue-switch { position: fixed; top: var(--vue-top); right: var(--vue-right); width: var(--vue-w); height: var(--vue-h); border: 1px solid #d1b581; border-radius: 10px; color: #fff5df; background: linear-gradient(transparent 55%, rgba(5,8,17,.95)); display: flex; align-items: flex-end; justify-content: center; gap: 5px; padding: 7px 3px; font: 600 12px system-ui; cursor: pointer; touch-action: manipulation; }
#vue-switch > span:first-child { font-size: 20px; line-height: 15px; }
#vue-conseil { position: fixed; top: calc(var(--vue-top) + var(--vue-h) + 6px); right: var(--vue-right); width: var(--vue-w); background: #f0d49e; color: #271c14; border-radius: 8px; padding: 6px 8px; font-size: 12px; text-align: center; pointer-events: none; }
#hud-boutons { margin-top: calc(var(--vue-h) + 55px); }
#hud-objectif { position: absolute; left: 50%; top: calc(76px + env(safe-area-inset-top)); transform: translateX(-50%); width: min(480px, calc(100% - 420px)); padding: 9px 14px; border: 1px solid var(--bord); border-radius: 10px; background: var(--panneau); font-size: 14px; line-height: 1.4; text-align: center; pointer-events: none; }
#panneau-vote, #bandeau { top: calc(142px + env(safe-area-inset-top)); }
#panneau-vote:not(.cache) ~ #bandeau { top: calc(338px + env(safe-area-inset-top)); }
#journal { max-height: 160px; overflow-y: auto; pointer-events: auto !important; overscroll-behavior: contain; font-size: 14px; }
#journal div { animation: none; flex-shrink: 0; line-height: 1.4; background: rgba(8,12,22,.88); }
#tutoriel { display: none; position: absolute; top: 36%; left: 16px; width: min(320px, calc(100% - 32px)); padding: 14px; border-radius: 12px; border: 1px solid #e8a33d; background: rgba(16,21,35,.97); font-size: 14px; line-height: 1.5; box-shadow: 0 8px 24px #0006; z-index: 3; }
#tutoriel.visible { display: block; }
#tutoriel p { margin: 7px 0; }
#ecran-chargement { z-index: 25; background: #0e1220; }
.chargement { text-align: center; align-items: center; padding: 32px; }
.chargement > .ico { width: 64px; height: 64px; color: var(--accent); }
.chargement p { font-size: 16px; line-height: 1.6; }
.progression-chargement { height: 4px; width: 100%; background: #ffffff20; overflow: hidden; border-radius: 3px; }
.progression-chargement i { display: block; height: 100%; background: var(--accent); animation: charger 2.5s linear both; transform-origin: left; }
@keyframes charger { from { transform: scaleX(0); } to { transform: scaleX(1); } }
#popup-manche .carte-ui { max-height: calc(100dvh - 24px); overflow-y: auto; }
#pm-role p { color: #d3d7e3; font-size: 16px; }
body.tactile-on #actions { grid-template-columns: repeat(2, 68px); gap: 8px; }
.act { width: 68px; height: 60px; border-radius: 18px; }
.act small { font-size: 12px; }
#stick { width: 116px; height: 116px; }
body.tactile-on #journal { bottom: calc(230px + env(safe-area-inset-bottom)); max-height: 130px; font-size: 14px; }
body.tactile-on #selection { top: auto; bottom: calc(226px + env(safe-area-inset-bottom)); z-index: 4; }
@media (max-width: 700px), (max-height: 500px) {
  :root { --vue-w: 112px; --vue-h: 78px; --vue-top: calc(118px + env(safe-area-inset-top)); }
  #hud-boutons { margin-top: calc(var(--vue-h) + 55px); }
  #hud-haut { font-size: 14px; }
  #hud-objectif { top: calc(96px + env(safe-area-inset-top)); left: 8px; transform: none; width: calc(100% - 136px); font-size: 14px; padding: 7px 9px; text-align: left; }
  #vue-switch { font-size: 11px; }
  #vue-conseil { font-size: 12px; }
  #panneau-vote, #bandeau { top: calc(240px + env(safe-area-inset-top)); }
  #panneau-vote:not(.cache) ~ #bandeau { top: calc(432px + env(safe-area-inset-top)); }
  #panneau-vote h4 { font-size: 14px; }
  #panneau-vote .info { font-size: 14px; }
  #panneau-vote .btn { min-height: 44px; }
  .role-carte small { font-size: 12px; }
  #annonce { top: 34%; font-size: 26px; pointer-events: none; }
  #tutoriel { top: 34%; font-size: 14px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  :root { --vue-w: 112px; --vue-h: 66px; --vue-top: calc(86px + env(safe-area-inset-top)); }
  #minicarte { width: 72px; height: 72px; }
  #hud-haut { top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); }
  #hud-objectif { top: calc(48px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: calc(100% - 310px); padding: 5px 8px; }
  #hud-boutons { margin-top: calc(var(--vue-h) + 42px); }
  #vue-conseil { padding: 3px; }
  #panneau-vote, #bandeau { top: calc(106px + env(safe-area-inset-top)); width: min(400px, calc(100% - 320px)); }
  #panneau-vote { padding: 8px; gap: 5px; }
  #panneau-vote:not(.cache) ~ #bandeau { top: auto; bottom: 8px; }
  body.tactile-on #journal { bottom: 8px; left: 160px; width: calc(100% - 330px); max-height: 70px; font-size: 13px; }
  body.tactile-on #actions { grid-template-columns: repeat(3, 60px); gap: 6px; bottom: 12px; }
  .act { width: 60px; height: 54px; }
  body.tactile-on #selection { bottom: 86px; max-width: calc(100% - 350px); }
  #tutoriel { top: 106px; left: 160px; width: calc(100% - 320px); padding: 10px; }
  #annonce { top: 42%; font-size: 24px; }
}
.act small { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.05; max-width: 64px; }

/* Pendant un vote : le panneau de vote passe devant, le tutoriel attend, le journal se resserre sur mobile. */
body.vote-actif #tutoriel, body.vote-actif #annonce { display: none; }
body.vote-actif.tactile-on #journal { max-height: 76px; }

/* Démonstration locale, indépendante des canevas et des commandes de partie. */
body:not(.en-jeu) #jeu { visibility: hidden; }
#scene-accueil { position: fixed; inset: 0; display: grid; grid-template-columns: 1fr 1fr; pointer-events: none; background: #17261c; }
body.en-jeu #scene-accueil { display: none; }
.scene-vue { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.scene-vue + .scene-vue { border-left: 1px solid #e5cf9d44; }
.scene-vue canvas { display: block; width: 100%; height: 100%; }
.scene-etiquette { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); padding: 6px 13px; background: #2c1d12; border: 2px solid #6e472b; border-radius: 999px; font-size: 11px; font-weight: 700; color: #f7eedc; box-shadow: 0 2px 0 #1a1009; white-space: nowrap; }
#scene-legende { position: absolute; top: max(18px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); color: #fff5e2; font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-align: center; white-space: nowrap; padding: 8px 16px; background: #2c1d12; border: 2px solid #6e472b; border-radius: 999px; box-shadow: 0 3px 0 #1a1009, 0 8px 18px rgba(14,9,4,0.45); }
#scene-fondu { position: absolute; inset: 0; background: #080d16; opacity: 0; }
@media (orientation: portrait) and (max-width: 760px) {
  #scene-accueil { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .scene-vue + .scene-vue { border-left: 0; border-top: 1px solid #e5cf9d44; }
  .scene-dessus .scene-etiquette { bottom: 10px; top: auto; left: 12px; transform: none; font-size: 10px; padding: 4px 8px; }
  #scene-legende { top: 50%; left: 50%; right: auto; transform: translate(-50%, -50%); font-size: 11px; letter-spacing: 0.8px; padding: 6px 12px; border: 2px solid #6e472b; }
  .scene-personne .scene-etiquette { top: 10px; bottom: auto; right: 12px; left: auto; transform: none; font-size: 10px; padding: 4px 8px; }
}

#scene-accueil.sans-webgl { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.sans-webgl .scene-personne { display: none; }
/* Jeu v3 : course maintenue et nuit des fantômes. */
#act-courir { touch-action: none; user-select: none; }
#act-courir.actif { border-color: #e8a33d; background: #594023; }
body.tactile-on #act-courir { grid-column: 1 / -1; justify-self: end; height: 48px; }
body.tactile-on #selection { bottom: calc(278px + env(safe-area-inset-bottom)); }
body.fantome-nuit #selection { display: none; }
#menu-jeu { max-height: calc(100dvh - 24px); overflow-y: auto; }
#volume-son { width: 100%; min-height: 44px; }
@media (max-height: 500px) and (orientation: landscape) {
  body.tactile-on #act-courir { grid-column: auto; height: 54px; }
  body.tactile-on #journal { bottom: 8px; }
  body.tactile-on #selection { bottom: 86px; }
}
body.tactile-on #act-courir { justify-self: start; }
@media (max-height: 500px) and (orientation: landscape) {
  body.tactile-on #hud-boutons { margin-top: calc(var(--vue-h) + 3px); }
}

/* Badge « jeu français » sous le titre de l'accueil : petit reflet animé, ouvre #ecran-fr */
.badge-fr { position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 7px; align-self: flex-start; margin: 0; padding: 5px 12px 5px 8px; border-radius: 999px;
  border: 2px solid #5c3a21; background: #f7eedc; color: #2b1d12; font: inherit; font-size: 12px; font-weight: 800; letter-spacing: .2px; cursor: pointer;
  box-shadow: 0 3px 0 #3e2615, 0 5px 12px rgba(16, 10, 5, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease; }
.badge-fr::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%); transform: translateX(-120%); animation: fr-reflet 2.8s ease-in-out infinite; }
.badge-fr:hover, .badge-fr:focus-visible { background: #fffaf0; border-color: #c84630; transform: translateY(-1px); outline: none; }
@keyframes fr-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(239, 65, 53, 0); } 50% { box-shadow: 0 0 0 4px rgba(0, 85, 164, 0.25); } }
@keyframes fr-reflet { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
@media (prefers-reduced-motion: reduce) { .badge-fr, .badge-fr::after { animation: none; } }
.drapeau-fr { display: inline-flex; width: 18px; height: 12px; border-radius: 2px; overflow: hidden; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.drapeau-fr.grand { width: 54px; height: 36px; border-radius: 4px; align-self: center; }
.drapeau-fr i { flex: 1; } .drapeau-fr i:nth-child(1) { background: #0055a4; } .drapeau-fr i:nth-child(2) { background: #fff; } .drapeau-fr i:nth-child(3) { background: #ef4135; }
.fr-carte { width: min(420px, 100%); text-align: center; gap: 10px; }
.fr-carte p { margin: 0; line-height: 1.45; font-size: 15px; }
#ecran-fr { z-index: 22; }
/* Pointage : sélection tactile lisible, même avec tous les pouvoirs disponibles. */
#selection { background: #121626; }
#selection .nom { max-width: 100%; overflow-wrap: anywhere; }
#selection button { min-width: 44px; min-height: 44px; flex-shrink: 0; }
#selection [data-a="pointer"] { border-color: var(--accent); }
body.tactile-on #selection { box-sizing: border-box; width: max-content; max-width: calc(100% - 24px); }
@media (max-height: 500px) and (orientation: landscape) {
  body.tactile-on #selection { max-width: calc(100% - 350px); }
}

/* La scène reste dégagée, et Parler / Micro restent accessibles. */
#execution { position:fixed; z-index:7; left:50%; top:20%; transform:translateX(-50%); width:max-content; max-width:calc(100vw - 32px); padding:10px 18px; border:1px solid #a8894b; border-radius:12px; background:#171d26ee; color:#f3d99d; text-align:center; pointer-events:none; box-sizing:border-box; }
#execution[hidden] { display:none; }
#execution b { display:block; font-size:15px; overflow-wrap:anywhere; }
#execution small { display:block; margin-top:4px; color:#eee3ce; font-size:12px; }

.execution-active #panneau-vote, .execution-active #hud-objectif, .execution-active #annonce { visibility:hidden; }

.execution-active #journal { visibility:hidden; }
@media (max-width:600px) and (min-height:501px) {
  #execution { top:122px; left:12px; transform:none; width:calc(100vw - 150px); max-width:280px; padding:8px 10px; }
  #execution b { font-size:13px; }
}
@media (max-height:500px) { #execution { top:72px; left:12px; transform:none; width:230px; padding:6px 12px; } }

/* Inscription à main levée sur le village. */
#hud > #viseur-inscription {
  position: absolute; top: 50%; left: 50%; width: 18px; height: 18px; transform: translate(-50%, -50%);
  border-radius: 50%; border: 1px solid rgba(255, 241, 201, .74);
  background: radial-gradient(circle, #fff1c9 0 1px, transparent 2px);
  box-shadow: 0 0 6px #31210e; pointer-events: none;
}
#viseur-inscription.pret { border-color: #ffcc74; box-shadow: 0 0 9px #ffbc63; }
#btn-inscription {
  position: absolute; top: calc(50% + 20px); left: 50%; transform: translateX(-50%);
  white-space: nowrap; box-shadow: 0 4px 16px #14100cc9;
}
#btn-inscription:active { transform: translateX(-50%) scale(.97); }
#dialogue-inscription {
  position: fixed; inset: 0; width: min(530px, calc(100vw - 24px), calc(200dvh - 220px));
  min-width: min(280px, calc(100vw - 24px)); max-height: calc(100dvh - 16px);
  padding: 14px; gap: 10px; color: var(--texte); background: #191a23;
}
#dialogue-inscription:not([open]) { display: none; }
#dialogue-inscription::backdrop { background: rgba(8, 9, 14, .72); }
#titre-inscription { font-size: 20px; }
#dessin-inscription {
  display: block; width: 100%; aspect-ratio: 2; height: auto; touch-action: none;
  background: #403735; border: 1px solid #786659; border-radius: 9px; cursor: crosshair;
}
#dialogue-inscription .btn { padding: 9px 6px; }
#dialogue-inscription .btn:disabled { opacity: .5; cursor: default; }
#etat-inscription { color: #ffcc9a; }

#effet-chuchotement {
  display: none;
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  box-shadow: inset 0 0 clamp(36px, 9vw, 110px) rgba(89, 223, 202, .48);
}
.en-jeu.en-chuchotement #effet-chuchotement { display: block; }
#hud-boutons .btn-chuchoter { background: var(--panneau); }
#hud .btn-chuchoter[aria-pressed="true"] {
  color: #b7ffef;
  border-color: #8cf4dd;
  background: #153932;
}
#act-chuchoter small { font-size: 10px; }

/* Manette tactile v2 (alignée sur Vampires) : joystick de tête à droite, actions en cercle autour */
body.tactile-on { --ma-t: 118px; --ma-r1: 96px; --ma-r2: 162px; }
body.tactile-on #actions {
  display: block; position: absolute; left: auto; top: auto; transform: none;
  right: calc(24px + env(safe-area-inset-right)); bottom: calc(22px + env(safe-area-inset-bottom));
  width: var(--ma-t); height: var(--ma-t); pointer-events: none; direction: ltr; z-index: 2;
}
body.tactile-on.gaucher #actions { right: auto; left: calc(24px + env(safe-area-inset-left)); }
body:not(.tactile-on) #stick-tete { display: none; }
body.tactile-on #actions > * { pointer-events: auto; }
body.tactile-on .anneau-el {
  position: absolute; left: 50%; top: 50%; margin: 0; --aa: var(--a, 180deg);
  transform: translate(-50%, -50%) rotate(calc(-1 * var(--aa))) translateX(var(--r, var(--ma-r1))) rotate(var(--aa));
  width: 56px; height: 56px; border-radius: 50%; font-size: 20px;
}
body.tactile-on .anneau-el small { font-size: 9px; margin-top: 2px; }
body.tactile-on.gaucher .anneau-el { --aa: calc(180deg - var(--a, 180deg)); }
#stick-tete {
  display: none; position: absolute; inset: 0; border-radius: 50%;
  background: rgba(255,255,255,.1); border: 2px solid rgba(255,255,255,.3);
  align-items: center; justify-content: center; touch-action: none;
}
body.tactile-on.premiere-personne #stick-tete { display: flex; }
#nub-tete { width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,.45); pointer-events: none; }
/* Arc intérieur : actions principales */
body.tactile-on #act-action { --a: 175deg; width: 62px; height: 62px; }
body.tactile-on #act-role   { --a: 135deg; }
body.tactile-on #act-courir { --a: 95deg; }
body.tactile-on #act-voter  { --a: 215deg; }
/* Arc extérieur : communication et cible */
body.tactile-on #act-cible     { --a: 158deg; --r: var(--ma-r2); width: 50px; height: 50px; font-size: 18px; }
body.tactile-on #act-chuchoter { --a: 122deg; --r: var(--ma-r2); width: 50px; height: 50px; font-size: 18px; }
body.tactile-on #act-micro     { --a: 86deg;  --r: var(--ma-r2); width: 50px; height: 50px; font-size: 18px; }

/* ===== Accueil aligné façon Bordée (27/11) : type de partie à gauche, pseudo + JOUER à droite ===== */
.acc-corps { justify-content: flex-end; align-items: stretch; pointer-events: none; }
.acc-dock { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; width: 100%; }
.acc-pan {
  pointer-events: auto;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, #faf2e2 0%, #ede0c4 100%);
  border: 3px solid #5c3a21;
  box-shadow: 0 6px 0 #3e2615, 0 18px 36px rgba(16, 10, 5, 0.54), inset 0 1px 0 #fffbf2;
  color: #2b1d12;
}
#acc-choix.acc-pan-modes {
  flex: 0 1 540px; min-width: 0; width: auto;
  display: flex; flex-direction: column; gap: 9px;
  animation: none;
}
.acc-pan-entete { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.acc-pan-entete .acc-section-titre { display: inline-flex; align-items: center; gap: 6px; }
.acc-amis-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 999px;
  border: 2px solid #1f2b44; background: linear-gradient(180deg, #2b3d61 0%, #1f2b44 100%);
  color: #fff6e6; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer;
  box-shadow: 0 2px 0 #131b2c;
}
.acc-amis-btn:hover { filter: brightness(1.12); }
.acc-amis-btn:active { transform: translateY(2px); box-shadow: none; }
.acc-types { flex-direction: row; gap: 10px; }
.acc-type {
  position: relative;
  flex: 1 1 0; min-width: 0; min-height: 0;
  flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 5px; padding: 10px 8px 9px; text-align: center;
}
.acc-type:hover, .acc-type:focus-visible { transform: translateY(-2px); box-shadow: 0 6px 0 #5c3a21, 0 10px 18px rgba(45, 28, 14, 0.2), inset 0 1px 0 #fff; }
.acc-type.choisi {
  border-color: #c84630; border-width: 3px;
  background: linear-gradient(180deg, #fff6ef 0%, #fbe3d6 100%);
  box-shadow: 0 4px 0 #8f2d1d, 0 8px 16px rgba(143, 45, 29, 0.28), inset 0 1px 0 #fff;
}
.acc-type.choisi::after {
  content: ""; position: absolute; top: 7px; right: 7px;
  width: 10px; height: 10px; border-radius: 50%;
  background: #c84630; box-shadow: 0 0 0 2px #fff6ef;
}
.acc-type .acc-description { align-items: center; flex: none; gap: 1px; }
.acc-type .acc-description b { font-size: 14px; }
.acc-type .acc-description small { font-size: 11px; }
.acc-type .acc-enligne {
  flex-direction: row; gap: 4px; min-width: 0; padding: 2px 8px; border-width: 1.5px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
}
.acc-type .acc-enligne b { font-size: 12px; }

.acc-entree.acc-pan { flex: 0 1 360px; width: auto; min-width: 0; padding: 12px 14px; gap: 9px; }
.acc-identite .champ { flex-direction: row; align-items: center; gap: 0; }
.acc-identite .acc-champ-label { display: none; }
.acc-identite input { padding: 10px 13px; }
#acc-ouvrir { padding: 12px 16px; }
.acc-jouer-lib { font-size: 24px; }
.acc-ligne-classe { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.acc-classe-btn, .acc-classement-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 8px 6px; border-radius: 11px; font: inherit; font-size: 13px; font-weight: 800; cursor: pointer;
}
.acc-classe-btn { border: 2px solid #9a6a12; background: linear-gradient(180deg, #f5b942 0%, #e09a1f 100%); color: #3a2405; box-shadow: 0 3px 0 #8a5a0c; }
.acc-classement-btn { border: 2px solid #5c3a21; background: #fffaf0; color: #2b1d12; box-shadow: 0 3px 0 #3e2615; }
.acc-classe-btn:active, .acc-classement-btn:active { transform: translateY(2px); box-shadow: none; }
.acc-rang { margin: -2px 0 0; text-align: center; font-size: 12px; font-weight: 700; color: #5e4631; }
.acc-rang .discret { color: #6e5640; }
body.avec-bc .acc-ligne-classe, body.avec-bc .acc-rang, body.avec-bc #acc-choix { display: none; }
body.avec-bc .acc-dock { justify-content: flex-end; }

#ecran-amis { z-index: 21; background: rgba(18, 13, 10, 0.66); }
#ecran-amis .acc-salons {
  width: min(440px, 100%); max-height: 100%; overflow-y: auto;
  background: linear-gradient(180deg, #faf2e2 0%, #ede0c4 100%);
  border: 3px solid #5c3a21; box-shadow: 0 7px 0 #3e2615, 0 24px 48px rgba(14, 9, 4, 0.62);
}

@media (max-width: 760px) {
  .acc-dock { flex-direction: column; align-items: stretch; gap: 10px; }
  #acc-choix.acc-pan-modes, .acc-entree.acc-pan { flex: none; width: 100%; }
  .acc-pan { padding: 10px; }
  .acc-type { padding: 8px 4px; }
  .acc-type .acc-description small { display: none; }
}
@media (max-height: 540px) and (min-width: 560px) {
  .accueil-v3 {
    padding:
      calc(6px + env(safe-area-inset-top))
      calc(8px + env(safe-area-inset-right))
      calc(6px + env(safe-area-inset-bottom))
      calc(8px + env(safe-area-inset-left));
  }
  .acc-haut { gap: 6px; align-items: flex-start; }
  .acc-marque { gap: 6px; }
  .acc-embleme { width: 30px; height: 30px; }
  .accueil-v3 h1 { font-size: 17px; letter-spacing: 0.08em; padding-bottom: 2px; }
  .badge-fr { font-size: 9.5px; padding: 2px 6px; }
  .acc-accroche, .acc-statut { display: none; }
  .acc-outils { gap: 4px; }
  .acc-outil-btn { padding: 4px 8px; font-size: 10.5px; border-radius: 8px; }
  #scene-accueil #scene-legende { display: none !important; }
  .acc-dock { gap: 8px; flex-direction: row; align-items: flex-end; justify-content: space-between; }
  .acc-pan {
    padding: 6px 8px;
    border-radius: 11px;
    border-width: 2px;
    box-shadow: 0 3px 0 #3e2615, 0 8px 18px rgba(16, 10, 5, 0.45), inset 0 1px 0 #fffbf2;
  }
  #acc-choix.acc-pan-modes { flex: 0 1 296px; gap: 4px; }
  .acc-pan-entete { gap: 6px; }
  .acc-pan-entete .acc-section-titre { font-size: 10.5px; }
  .acc-amis-btn { padding: 2px 7px; font-size: 10px; border-width: 1.5px; }
  .acc-types { gap: 4px; }
  .acc-type { padding: 4px 3px; gap: 2px; border-radius: 8px; border-width: 1.5px; min-height: 0; }
  .acc-type.choisi { border-width: 2px; box-shadow: 0 2px 0 #8f2d1d; }
  .acc-type.choisi::after { width: 7px; height: 7px; top: 4px; right: 4px; }
  .acc-type .acc-visuel-cadre { width: 22px; height: 22px; border-radius: 6px; font-size: 13px; }
  .acc-type .acc-visuel-cadre img { width: 20px; height: auto; }
  .acc-type .acc-description b { font-size: 10px; line-height: 1.1; }
  .acc-type .acc-description small { display: none; }
  .acc-type .acc-enligne { padding: 1px 5px; font-size: 8.5px; border-width: 1px; }
  .acc-type .acc-enligne b { font-size: 9.5px; }
  .acc-entree.acc-pan { flex: 0 1 224px; width: auto; padding: 6px 8px; gap: 4px; flex-direction: column; align-items: stretch; }
  .acc-identite input { padding: 5px 8px; font-size: 12px; border-radius: 8px; }
  #acc-ouvrir { width: 100%; min-width: 0; padding: 6px 10px; border-radius: 9px; }
  .acc-jouer-lib { font-size: 14px; }
  .acc-ligne-classe { gap: 4px; }
  .acc-classe-btn, .acc-classement-btn { padding: 4px 4px; font-size: 10.5px; border-radius: 8px; border-width: 1.5px; box-shadow: 0 2px 0 #3e2615; }
  .acc-classe-btn { box-shadow: 0 2px 0 #8a5a0c; }
  .acc-rang { font-size: 9.5px; margin: 0; }
  .acc-rang .rang-badge { font-size: 9px; padding: 1px 6px; }
}

/* ===== Viseur central + Boutons d'action ronds à droite (PC & Mobile au-dessus du joystick) ===== */
#viseur-centre {
  display: none; position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  flex-direction: column; align-items: center; pointer-events: none !important; z-index: 6;
}
body.premiere-personne #viseur-centre:not(.cache) { display: flex; }
#viseur-centre .vc-croix {
  position: relative; width: 22px; height: 22px; transition: transform 0.12s ease;
}
#viseur-centre .vc-croix::before, #viseur-centre .vc-croix::after {
  content: ''; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.92); border-radius: 2px;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
}
#viseur-centre .vc-croix::before { width: 18px; height: 2px; }
#viseur-centre .vc-croix::after { width: 2px; height: 18px; }
#viseur-centre.cible .vc-croix { transform: scale(1.22); }
#viseur-centre.cible .vc-croix::before, #viseur-centre.cible .vc-croix::after {
  background: #ffd36b; box-shadow: 0 0 6px rgba(255, 211, 107, 0.85), 0 0 2px rgba(0, 0, 0, 0.95);
}
#viseur-nom {
  margin-top: 8px; padding: 2px 9px; border-radius: 999px;
  background: rgba(10, 14, 24, 0.82); border: 1px solid rgba(255, 211, 107, 0.7);
  color: #ffe8a3; font: 700 12px/1.3 system-ui, sans-serif; white-space: nowrap;
  opacity: 0; transition: opacity 0.12s ease;
}
#viseur-centre.cible #viseur-nom:not(:empty) { opacity: 1; }

/* Boutons d'action ronds sur la droite (toujours visibles en jeu) */
#actions {
  display: grid !important; position: fixed !important;
  right: calc(18px + env(safe-area-inset-right)) !important;
  bottom: calc(22px + env(safe-area-inset-bottom)) !important;
  left: auto !important; top: auto !important; transform: none !important;
  width: auto !important; height: auto !important;
  grid-template-columns: repeat(2, 60px) !important; gap: 10px !important;
  direction: ltr !important; pointer-events: none !important; z-index: 6 !important;
}
#actions > .act {
  position: static !important; transform: none !important; margin: 0 !important;
  width: 60px !important; height: 60px !important; border-radius: 50% !important;
  pointer-events: auto !important; cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s, border-color 0.15s;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
#actions > .act:hover { transform: scale(1.07) !important; border-color: rgba(255, 255, 255, 0.85); }
#actions > .act:active { transform: scale(0.95) !important; }
#actions > .act small { font-size: 9px !important; margin-top: 2px !important; }

/* Joystick droit sur mobile : en bas à droite ; boutons ronds juste au-dessus */
body:not(.tactile-on) #stick-tete { display: none !important; }
body.tactile-on #stick-tete {
  display: none; position: fixed; inset: auto;
  right: calc(22px + env(safe-area-inset-right));
  bottom: calc(22px + env(safe-area-inset-bottom));
  width: 118px; height: 118px; border-radius: 50%; z-index: 5;
}
body.tactile-on.premiere-personne #stick-tete { display: flex !important; }
body.tactile-on #actions {
  bottom: calc(152px + env(safe-area-inset-bottom)) !important;
  right: calc(16px + env(safe-area-inset-right)) !important;
  grid-template-columns: repeat(2, 54px) !important; gap: 8px !important;
}
body.tactile-on #actions > .act { width: 54px !important; height: 54px !important; font-size: 19px !important; }
body.tactile-on.gaucher #stick-tete { right: auto; left: calc(22px + env(safe-area-inset-left)); }
body.tactile-on.gaucher #actions { right: auto !important; left: calc(16px + env(safe-area-inset-left)) !important; }

@media (max-height: 500px) and (orientation: landscape) {
  body.tactile-on #stick-tete { width: 98px; height: 98px; bottom: 12px; right: 16px; }
  body.tactile-on #actions {
    bottom: 120px !important; right: 12px !important;
    grid-template-columns: repeat(4, 48px) !important; gap: 6px !important;
  }
  body.tactile-on #actions > .act { width: 48px !important; height: 48px !important; font-size: 17px !important; }
  body.tactile-on.gaucher #stick-tete { right: auto; left: 16px; }
  body.tactile-on.gaucher #actions { right: auto !important; left: 12px !important; }
}
