:root {
  --fond: #0c0710;
  --panneau: rgba(22, 12, 24, 0.88);
  --bord: rgba(255, 255, 255, 0.12);
  --texte: #f2e9ec;
  --discret: #b0a0aa;
  --sang: #d8203a;
  --sang-fonce: #7a0c1c;
  --lune: #e9e2c8;
  --ok: #7cc96b;
  --bois: #b07a45;
  --or: #f2c94c;
}
* { 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; }
canvas#jeu3d { position: fixed; inset: 0; width: 100%; height: 100%; display: none; }
canvas#jeu3d.pret { display: block; }
.cache { display: none !important; }

.ecran { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(ellipse at 50% 20%, rgba(90, 14, 34, 0.75), rgba(8, 4, 10, 0.96) 70%); overflow-y: auto; z-index: 10; }
.ecran.visible { display: flex; }
#ecran-accueil::before { content: ''; position: absolute; top: 7%; right: 12%; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #fff8e0, #e9e2c8 55%, #b9b190); box-shadow: 0 0 60px rgba(233, 226, 200, .5); opacity: .8; pointer-events: none; }
.carte-ui { position: relative; background: var(--panneau); border: 1px solid var(--bord); border-radius: 16px; padding: 22px; width: min(440px, 100%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6); display: flex; flex-direction: column; gap: 12px; margin: auto; }
.carte-ui.large { width: min(620px, 100%); }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 46px; line-height: 1.05; text-align: center; color: var(--sang);
  letter-spacing: 2px; text-shadow: 0 3px 0 #3a0410, 0 0 24px rgba(216, 32, 58, .45); font-variant: small-caps; }
h2, h3 { margin: 0; font-family: Georgia, serif; }
.sous-titre { margin: -6px 0 6px; 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(--sang); }
.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.14); }
.btn:active { transform: scale(0.97); }
.btn.principal { background: linear-gradient(#e0334c, #8d1022); color: #fff; border-color: #ff7083; }
.btn.enorme { font-size: 28px; padding: 18px; letter-spacing: 3px; font-family: Georgia, serif; font-variant: small-caps; }
.btn.petit { padding: 7px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.actif { background: var(--ok); color: #102a0b; }
.btn.coupe { background: var(--sang); color: #fff; }
.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; }
.case { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.case input { width: 18px; height: 18px; }
.discret-case { color: var(--discret); font-size: 13px; justify-content: center; }

/* ---------------- HUD ---------------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { pointer-events: auto; }
#hud-haut, #annonce, #toasts, #hud-ressources, #fil, #bandeau-mort { 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-cycle.nuit { color: #9fb2ff; } #hud-cycle.jour { color: #ffd76a; } #hud-cycle.finale { color: var(--sang); }
#hud-minuteur { font-variant-numeric: tabular-nums; }
#hud-compte { font-size: 13px; color: var(--discret); font-weight: 600; }
#hud-compte b.h { color: #ffd9a0; } #hud-compte b.v { color: #ff6b7f; }
#hud-ressources { position: absolute; top: calc(8px + env(safe-area-inset-top)); left: calc(8px + env(safe-area-inset-left)); display: flex; flex-wrap: wrap; gap: 6px; max-width: 46%; }
.res { display: flex; align-items: center; gap: 6px; background: var(--panneau); border: 1px solid var(--bord); border-radius: 10px; padding: 6px 10px;
  font-weight: 700; font-variant-numeric: tabular-nums; }
.res i { width: 13px; height: 13px; border-radius: 3px; display: inline-block; }
.res.bois i { background: var(--bois); } .res.or i { background: var(--or); border-radius: 50%; }
.res.pv i { background: var(--sang); border-radius: 50%; } .res.niv i { background: #b27cff; transform: rotate(45deg); }
.res .barre { width: 70px; height: 7px; background: rgba(255,255,255,.15); border-radius: 4px; overflow: hidden; }
.res .barre span { display: block; height: 100%; background: var(--sang); }
.res.niv .barre span { background: #b27cff; }
#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: 5px; width: 176px; pointer-events: none; }
#colonne-droite > * { pointer-events: auto; }
#minicarte { width: 176px; height: 176px; border: 1px solid var(--bord); border-radius: 8px; background: #000; }
#infos-monde { font-size: 11px; color: var(--discret); text-align: right; background: rgba(0,0,0,.35); border-radius: 6px; padding: 2px 6px; }
#hud-boutons { position: absolute; top: calc(8px + env(safe-area-inset-top)); right: calc(192px + env(safe-area-inset-right)); display: flex; flex-direction: column; gap: 8px; }
.btn.rond { width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 19px; background: var(--panneau); }
#classement { background: var(--panneau); border: 1px solid var(--bord); border-radius: 8px; font-size: 12px; overflow: hidden; }
#classement-titre { all: unset; display: block; width: 100%; box-sizing: border-box; padding: 5px 8px; font-weight: 700; cursor: pointer; }
#classement.replie #classement-corps { display: none; }
#classement-corps { padding: 0 8px 6px; }
#classement-corps h4 { margin: 4px 0 2px; font-size: 11px; color: var(--discret); font-weight: 600; }
#classement-corps ol { margin: 0; padding-left: 18px; }
#classement-corps li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#fil { position: absolute; top: calc(52px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 3px; }
#fil div { background: rgba(0,0,0,.5); padding: 3px 10px; border-radius: 12px; font-size: 12px; white-space: nowrap; animation: fil 6s forwards; }
#fil b { color: #ff8c9b; } #fil .jour { color: #ffd76a; } #fil .nuit { color: #a9b8ff; }
@keyframes fil { 0% { opacity: 0; } 6%, 78% { opacity: 1; } 100% { opacity: 0; } }

#barre-construction { position: absolute; bottom: calc(10px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; gap: 6px;
  background: var(--panneau); border: 1px solid var(--bord); border-radius: 14px; padding: 6px; }
.bat { position: relative; width: 72px; padding: 4px 2px 5px; border-radius: 10px; border: 2px solid transparent; background: rgba(255, 255, 255, 0.06);
  color: var(--texte); font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 1px; touch-action: manipulation; }
.bat canvas { width: 34px; height: 34px; }
.bat .n { font-size: 12px; font-weight: 700; }
.bat .c { font-size: 11px; color: var(--discret); white-space: nowrap; }
.bat .c .b { color: #e0a46b; } .bat .c .o { color: var(--or); }
.bat .touche { position: absolute; top: 2px; left: 5px; font-size: 10px; color: var(--discret); }
.bat.choisi { border-color: var(--or); background: rgba(242, 201, 76, 0.18); }
.bat.trop-cher { opacity: 0.45; }

#boutique { position: absolute; bottom: calc(10px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(520px, calc(100% - 16px));
  background: var(--panneau); border: 1px solid rgba(216,32,58,.5); border-radius: 14px; padding: 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
#boutique h4 { grid-column: 1 / -1; margin: 0 0 2px; display: flex; justify-content: space-between; font-family: Georgia, serif; color: #ff8c9b; }
.objet { font: inherit; color: var(--texte); text-align: left; background: rgba(255,255,255,.06); border: 1px solid var(--bord); border-radius: 10px; padding: 6px 8px; cursor: pointer; touch-action: manipulation; }
.objet b { display: block; font-size: 13px; } .objet small { color: var(--discret); font-size: 11px; display: block; }
.objet .prix { color: var(--or); font-weight: 700; font-size: 12px; }
.objet.trop-cher { opacity: .5; } .objet.max { opacity: .35; }

#panneau-bat { position: absolute; bottom: calc(96px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: var(--panneau);
  border: 1px solid var(--bord); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 250px; font-size: 13px; }
#panneau-bat h4 { margin: 0; font-size: 15px; display: flex; justify-content: space-between; gap: 10px; }
#panneau-bat .stats { color: var(--discret); }
#panneau-bat .ligne { display: flex; gap: 8px; } #panneau-bat .ligne .btn { flex: 1; padding: 8px 10px; font-size: 13px; }
.niv { color: var(--or); letter-spacing: 1px; }

#bandeau-mort { position: absolute; top: 34%; left: 50%; transform: translateX(-50%); width: min(520px, calc(100% - 32px));
  text-align: center; background: rgba(90, 8, 24, 0.85); border: 1px solid rgba(255,90,110,.5); border-radius: 12px; padding: 12px; font-size: 15px; }
#annonce { position: absolute; top: 24%; left: 0; right: 0; text-align: center; font-family: Georgia, serif; font-size: 46px; font-weight: 700; color: var(--lune);
  text-shadow: 0 3px 0 #000, 0 0 30px rgba(0,0,0,.9); opacity: 0; transition: opacity 0.5s, transform .5s; padding: 0 16px; transform: scale(.96); font-variant: small-caps; }
#annonce.visible { opacity: 1; transform: none; }
#annonce.vampire { color: var(--sang); text-shadow: 0 3px 0 #2a0008, 0 0 40px rgba(216,32,58,.8); font-size: 54px; letter-spacing: 3px; }
#annonce small { display: block; font-size: 18px; color: var(--texte); font-weight: 600; font-family: system-ui, sans-serif; font-variant: normal; letter-spacing: 0; margin-top: 8px; }
#toasts { position: absolute; bottom: calc(110px + 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 2.6s forwards; text-align: center; }
.toast.erreur { border-color: var(--sang); }
@keyframes toast { 0% { opacity: 0; transform: translateY(8px); } 10%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }
#menu-jeu, #aide { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(340px, calc(100% - 32px)); z-index: 6; }
#aide { width: min(460px, calc(100% - 32px)); max-height: 86vh; overflow-y: auto; font-size: 14px; }
#aide table { width: 100%; border-collapse: collapse; } #aide td { padding: 3px 4px; border-bottom: 1px solid var(--bord); }
#aide td:first-child { color: var(--or); font-weight: 700; white-space: nowrap; }

/* Fin de manche */
#fin-titre { text-align: center; font-size: 30px; }
#fin-titre.humains { color: var(--lune); } #fin-titre.vampires { color: var(--sang); }
#fin-resume, #fin-moi { text-align: center; margin: 0; color: var(--discret); }
#fin-moi { color: var(--texte); font-weight: 600; }
#fin-listes { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; font-size: 13px; }
#fin-listes h4 { margin: 0 0 4px; font-size: 13px; color: var(--discret); }
#fin-listes ol { margin: 0; padding-left: 20px; } #fin-listes li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Commandes tactiles : joystick fixe en bas à gauche, boutons ronds en bas à droite */
.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: 132px; height: 132px; border-radius: 50%; background: rgba(255,255,255,.1);
  border: 2px solid rgba(255,255,255,.28); align-items: center; justify-content: center; touch-action: none; }
#nub { width: 54px; height: 54px; border-radius: 50%; background: rgba(255,255,255,.42); pointer-events: none; }
#actions { right: calc(18px + env(safe-area-inset-right)); grid-template-columns: repeat(2, 64px); gap: 10px; direction: rtl; align-items: end; }
.act { direction: ltr; width: 64px; height: 64px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); background: rgba(22,12,24,.78); color: #fff;
  font-size: 23px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; touch-action: manipulation; padding: 0; }
.act small { font-size: 9px; font-weight: 600; margin-top: 3px; opacity: .85; }
.act.grand { width: 78px; height: 78px; font-size: 30px; background: rgba(150,14,36,.85); border-color: #ff7083; }
.act.choisi, #act-poser { background: rgba(242,201,76,.85); color: #2b1600; }
#act-ameliorer { background: rgba(124,201,107,.85); color: #102a0b; }
.act.actif { background: var(--ok); } .act.coupe { background: var(--sang); }
.act.recharge { opacity: .45; }
body.camp-h .act.vampire, body:not(.camp-h) .act.humain { display: none !important; }
body.gaucher #stick { left: auto; right: calc(22px + env(safe-area-inset-right)); }
body.gaucher #actions { right: auto; left: calc(18px + env(safe-area-inset-left)); direction: ltr; }
body.tactile-on .pc-seulement { display: none; }
body.tactile-on #barre-construction { display: none; }
body.tactile-on.menu-constr #barre-construction { display: flex; bottom: calc(176px + env(safe-area-inset-bottom)); }
body.tactile-on #panneau-bat, body.tactile-on #boutique { bottom: calc(176px + env(safe-area-inset-bottom)); }
body.tactile-on #toasts { bottom: calc(250px + env(safe-area-inset-bottom)); }
body:not(.camp-h) #barre-construction { display: none !important; }

/* Petits écrans */
@media (max-width: 700px), (max-height: 500px) {
  h1 { font-size: 36px; }
  #hud-haut { font-size: 12px; gap: 6px; padding: 5px 9px; top: calc(98px + env(safe-area-inset-top)); left: calc(8px + env(safe-area-inset-left)); transform: none; }
  #hud-compte { display: none; }
  #fil { top: calc(136px + env(safe-area-inset-top)); left: 8px; transform: none; align-items: flex-start; }
  #fil div { font-size: 11px; }
  #colonne-droite { width: 112px; }
  #minicarte { width: 112px; height: 112px; }
  #infos-monde { font-size: 10px; }
  #classement-titre { padding: 4px 6px; }
  #hud-boutons { right: calc(126px + env(safe-area-inset-right)); flex-direction: row; }
  .btn.rond { width: 38px; height: 38px; font-size: 16px; }
  #hud-ressources { max-width: calc(100% - 220px); }
  .res { padding: 4px 7px; font-size: 12px; gap: 4px; }
  .res .barre { width: 40px; }
  #barre-construction { left: 8px; right: 8px; transform: none; justify-content: space-between; gap: 4px; padding: 4px; }
  .bat { flex: 1; width: auto; min-width: 0; }
  .bat .touche { display: none; }
  .bat .n { font-size: 10px; } .bat .c { font-size: 9px; }
  #annonce { font-size: 30px; } #annonce.vampire { font-size: 36px; } #annonce small { font-size: 15px; }
  #boutique { grid-template-columns: 1fr 1fr; }
}
@media (max-height: 500px) and (orientation: landscape) {
  #hud-haut { top: calc(8px + env(safe-area-inset-top)); bottom: auto; left: 50%; transform: translateX(-50%); }
  #hud-ressources { max-width: calc(50% - 170px); }
  #fil { top: calc(44px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); align-items: center; }
  body.tactile-on.menu-constr #barre-construction { left: 50%; right: auto; transform: translateX(-50%); width: min(480px, 56%); bottom: calc(8px + env(safe-area-inset-bottom)); }
  body.tactile-on #panneau-bat, body.tactile-on #boutique { bottom: calc(8px + env(safe-area-inset-bottom)); width: min(420px, 50%); }
  body.tactile-on #toasts { bottom: calc(90px + env(safe-area-inset-bottom)); }
  #minicarte { width: 96px; height: 96px; }
}

/* ---------------- v3 : pouvoirs, prime, Lune de sang, progression ---------------- */
#barre-pouvoirs { position: absolute; bottom: calc(10px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; gap: 6px; }
body.camp-h #barre-pouvoirs { display: none; }
body:not(.tactile-on) #boutique { bottom: calc(92px + env(safe-area-inset-bottom)); }
.pouvoir { position: relative; width: 70px; height: 70px; border-radius: 14px; border: 2px solid rgba(255,112,131,.6); background: rgba(40,6,16,.88); color: #fff;
  font: inherit; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; cursor: pointer; overflow: hidden; touch-action: manipulation; }
.pouvoir .ic { font-size: 24px; line-height: 1; }
.pouvoir .n { font-size: 11px; font-weight: 700; }
.pouvoir .touche { position: absolute; top: 2px; left: 5px; font-size: 10px; color: var(--discret); }
.pouvoir .cd { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; color: #fff; text-shadow: 0 1px 3px #000;
  background: conic-gradient(rgba(0,0,0,.72) calc(var(--p, 0) * 360deg), rgba(0,0,0,.15) 0); }
.pouvoir.recharge .cd { display: flex; }
.pouvoir .verrou { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.62); font-size: 12px; font-weight: 700; color: var(--discret); }
.pouvoir.verrouille .verrou { display: flex; }
.pouvoir.verrouille { border-color: rgba(255,255,255,.18); }
.pouvoir.pret { box-shadow: 0 0 12px rgba(255,60,90,.55); }
.pouvoir.actif { border-color: #b9c4ff; box-shadow: 0 0 16px rgba(160,180,255,.8); }
.pouvoir.nouveau { animation: nouveau 1s ease-in-out 4; }
@keyframes nouveau { 50% { transform: scale(1.15); box-shadow: 0 0 22px rgba(255,200,90,.9); } }
body.tactile-on #barre-pouvoirs { left: auto; transform: none; right: calc(18px + env(safe-area-inset-right)); bottom: calc(190px + env(safe-area-inset-bottom)); }
body.tactile-on.gaucher #barre-pouvoirs { right: auto; left: calc(18px + env(safe-area-inset-left)); }
body.tactile-on .pouvoir { width: 58px; height: 58px; }
body.tactile-on .pouvoir .touche { display: none; }
body.boutique-ouverte.tactile-on #barre-pouvoirs { display: none; }
@media (max-height: 500px) and (orientation: landscape) {
  body.tactile-on #barre-pouvoirs { bottom: calc(10px + env(safe-area-inset-bottom)); right: calc(196px + env(safe-area-inset-right)); flex-direction: column-reverse; }
  body.tactile-on.gaucher #barre-pouvoirs { left: calc(196px + env(safe-area-inset-left)); }
  #infos-monde, #hud-prime small { display: none; }
  body.tactile-on .pouvoir { width: 52px; height: 52px; }
  body.tactile-on .pouvoir .n { display: none; }
}

#hud-lune { color: #ff5a6e; font-size: 13px; }
#hud-prime { background: rgba(90,8,24,.88); border: 1px solid rgba(255,90,110,.6); border-radius: 8px; padding: 4px 7px; font-size: 12px; font-weight: 700; line-height: 1.3; }
#hud-prime small { display: block; font-weight: 500; color: var(--discret); font-size: 11px; }
#hud-prime.revele { animation: revele 1s ease-in-out infinite; }
@keyframes revele { 50% { border-color: #ffd76a; box-shadow: 0 0 10px rgba(255,215,106,.6); } }
body.lune #hud-haut { border-color: rgba(255,60,80,.6); box-shadow: 0 0 18px rgba(216,32,58,.35); }
body.lune canvas#jeu { filter: saturate(1.15) hue-rotate(-8deg); }
#annonce.lune { color: #ff3b4e; text-shadow: 0 3px 0 #2a0008, 0 0 40px rgba(255,40,60,.9); }

.ligne-btn { display: flex; gap: 8px; } .ligne-btn .btn { flex: 1; }
#fin-progres:empty { display: none; }
#fin-progres { background: rgba(242,201,76,.1); border: 1px solid rgba(242,201,76,.4); border-radius: 10px; padding: 8px 10px; font-size: 13px; text-align: center; }
#fin-progres b { color: var(--or); }
#progres-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.stat { background: rgba(255,255,255,.06); border-radius: 8px; padding: 6px 8px; font-size: 12px; color: var(--discret); }
.stat b { display: block; font-size: 18px; color: var(--texte); }
#progres-choix h4 { margin: 10px 0 6px; font-family: Georgia, serif; }
.choix { display: flex; flex-wrap: wrap; gap: 6px; }
.puce { font: inherit; font-size: 13px; min-height: 44px; padding: 6px 10px; border-radius: 10px; border: 2px solid var(--bord); background: rgba(255,255,255,.06); color: var(--texte);
  display: flex; align-items: center; gap: 7px; cursor: pointer; touch-action: manipulation; text-align: left; }
.puce small { display: block; color: var(--discret); font-size: 11px; }
.puce.choisi { border-color: var(--or); background: rgba(242,201,76,.16); }
.puce:disabled { opacity: .45; cursor: default; }
.pastille { width: 22px; height: 22px; border-radius: 50%; flex: none; border: 1px solid rgba(255,255,255,.3); }
#titre-accueil { font-weight: 500; }
#ecran-progression { z-index: 12; }
#fil .prime { color: #ffb0bb; font-weight: 600; }
#ecran-progression { background: radial-gradient(ellipse at 50% 20%, #3a0a18, #08040a 70%); }
#actions { grid-template-columns: repeat(2, 78px); justify-items: center; }
@media (max-width: 700px) {
  #hud-lune .long { display: none; }
  #fil div { white-space: normal; max-width: calc(100vw - 140px); }
}
@media (max-height: 500px) and (orientation: landscape) { #hud-prime small { display: none; } }

/* Petite fenêtre sous la minicarte : l'autre vue (3D ou vue du dessus), touchez pour échanger */
#vignette { position: relative; width: 176px; height: 118px; border: 1px solid var(--bord); border-radius: 8px; overflow: hidden; background: #0c0710; cursor: pointer; flex: none; }
#vignette > canvas { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; display: block; }
#vignette > canvas.cache { display: none !important; }
#btn-inverser { position: absolute; right: 4px; bottom: 4px; width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 1px solid var(--bord);
  background: rgba(20, 10, 18, 0.85); color: #f1eee2; font-size: 15px; line-height: 1; pointer-events: none; }
@media (max-width: 700px), (max-height: 500px) { #vignette { width: 112px; height: 75px; } #btn-inverser { width: 22px; height: 22px; font-size: 12px; } }
@media (max-height: 500px) and (orientation: landscape) { #vignette { width: 96px; height: 64px; } }

/* Encart « Bientôt » (affichage seul) */
.bientot { border: 1px dashed var(--bord); border-radius: 12px; padding: 8px 12px; background: rgba(255, 255, 255, 0.04);
  font-size: 12.5px; line-height: 1.4; color: var(--discret); margin: 0; text-align: left; }
.bientot .badge-bientot { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .03em; padding: 1px 7px; margin-right: 6px;
  border-radius: 999px; background: var(--sang-fonce); color: var(--texte); vertical-align: 1px; }

/* Accueil : les deux vues en fond (gauche : vue du dessus, droite : 1re personne) */
#fond-vues { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
#fond-vues .demi { position: absolute; top: 0; bottom: 0; width: 50%; background-size: cover; background-position: center; filter: blur(2px) brightness(.5) saturate(.9); transform: scale(1.03); }
#fond-vues .demi.gauche { left: 0; background-image: url(/fond-dessus.jpg); }
#fond-vues .demi.droite { right: 0; background-image: url(/fond-fps.jpg); }
#fond-vues::after { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; transform: translateX(-1px); background: linear-gradient(transparent, rgba(255,255,255,.35), transparent); }
#fond-vues .etiquette-vue { position: absolute; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); white-space: nowrap;
  font-size: 13px; font-weight: 700; color: #fff; background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.18); padding: 5px 11px; border-radius: 999px; }
#fond-vues .etiquette-vue.gauche { left: 25%; } #fond-vues .etiquette-vue.droite { left: 75%; }
#fond-vues .bascule-vues { position: absolute; top: calc(12px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 12px; font-weight: 700;
  color: #fff; background: var(--sang); padding: 4px 12px; border-radius: 999px; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
#ecran-accueil > .carte-ui { position: relative; z-index: 1; }
@media (max-width: 700px) { #fond-vues .etiquette-vue { font-size: 11px; padding: 4px 8px; } #fond-vues .bascule-vues { font-size: 11px; } }

/* Écran de chargement : 2,5 s, une astuce */
#ecran-chargement { z-index: 12; }
.chargement { width: min(460px, 100%); text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.chargement-titre { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; opacity: .8; }
.chargement-barre { width: 100%; height: 6px; border-radius: 99px; background: rgba(255,255,255,.12); overflow: hidden; }
.chargement-barre span { display: block; height: 100%; width: 0; background: var(--sang); }
#ecran-chargement.visible .chargement-barre span { animation: remplir 2.5s linear forwards; }
@keyframes remplir { to { width: 100%; } }
.astuce { margin: 0; font-size: 17px; line-height: 1.45; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: 14px 16px; }
.astuce b { color: var(--sang); }

/* Bulle sous la petite fenêtre (premières parties) */
#bulle-vue { align-self: stretch; text-align: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--sang); border-radius: 8px; padding: 5px 6px;
  pointer-events: none !important; animation: bulle 1.1s ease-in-out infinite; }
@keyframes bulle { 50% { transform: translateY(-3px); } }
#vignette.attire { box-shadow: 0 0 0 2px #fff, 0 0 18px 4px var(--sang); }

/* Accueil vivant : la vraie manche en direct (vue du dessus à gauche, 3D à droite) remplace les captures */
body.accueil-vivant #fond-vues .demi { display: none; }
body.accueil-vivant #ecran-accueil { background: radial-gradient(ellipse at 50% 20%, rgba(90, 14, 34, 0.35), rgba(8, 4, 10, 0.6) 70%); }
body.accueil-vivant canvas#jeu3d.pret { left: 50%; width: 50%; }

#ecran-micro { background: rgba(0, 0, 0, 0.45); z-index: 30; }
#ecran-micro h2 { text-align: center; }
