/* Le bilan d'un combat sur la carte (bilan-ui.mjs ; étape 3, sous-tâche 11 e2b ; brief 03-ennemis-client-brief.md § 9.B, § 9.C ; place : la
   maquette G3 B, « à gauche du joystick », réponse du 05/11). Un bandeau bas de verre (≥ 72 %, lisible sur le sable clair et la nuit), plié
   en pastille de 44 px avec la barre d'avance dessous. La page mesure le joystick et le bloc du nom du lieu et écrit `--bilan-gauche`,
   `--bilan-droite`, `--bilan-bas`, `--bilan-bas-plie`, `--bilan-largeur` sur la section ; ces règles en gardent des replis sûrs. */
.halo-preview {
  --bilan-text: #f0e1c5; --bilan-muted: #b7b6a7; --bilan-eyebrow: #e0c98f; --bilan-gold: #e2bc7e; --bilan-coral: #e8836f;
}
/* Grand écran : en bas à gauche, 400 px, au-dessus du bloc du nom du lieu (déplié comme plié). Sous la bulle de CENDRE (44). */
.halo-preview .bilan-ui {
  position: fixed; z-index: 8; left: var(--bilan-gauche, 24px); bottom: var(--bilan-bas-plie, 160px); width: var(--bilan-largeur, 400px);
  box-sizing: border-box; display: flex; flex-direction: column; align-items: flex-start; pointer-events: none;
}
/* Le bandeau et la pastille posent `display` : sans cette règle, ils passeraient outre `[hidden]`. */
.halo-preview .bilan-ui[hidden], .halo-preview .bilan-ui [hidden] { display: none !important; }
/* Masqué pendant la vue épurée, le combat, l'entrée, le compte et le film. */
.halo-preview:is(.clean-view, .combat-open, .entry-open, .auth-open, .intro-open) :is(.bilan-ui, .bilan-ui *) { visibility: hidden; pointer-events: none; }

/* Le bandeau déplié : le verre du jeu ; il ne dépasse pas la moitié de l'écran, le corps défile. */
.halo-preview .bilan-bandeau {
  box-sizing: border-box; width: 100%; max-height: min(52dvh, var(--bilan-hauteur, 52dvh)); display: flex; flex-direction: column; padding: 8px 6px 10px 14px;
  border: 1px solid rgb(196 222 207 / 30%); border-radius: 6px; background: rgb(15 34 38 / 72%); color: var(--bilan-text);
  box-shadow: 0 12px 34px rgb(5 17 15 / 15%), inset 0 1px rgb(232 244 226 / 11%);
  backdrop-filter: blur(7px) saturate(1.08); -webkit-backdrop-filter: blur(7px) saturate(1.08); text-shadow: 0 1px 3px rgb(4 17 15 / 75%);
  pointer-events: auto; touch-action: manipulation; animation: bilan-monte 180ms ease-out both;
}
.halo-preview .bilan-bandeau > * { flex: none; }
.bilan-tete { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px 0 0; }
.halo-preview .bilan-surtitre {
  margin: 0; color: var(--bilan-eyebrow); font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
}
/* La croix : une cible de 44 × 44 px, à droite du surtitre. */
.halo-preview .bilan-fermer {
  display: grid; place-items: center; width: 44px; height: 44px; min-width: 44px; min-height: 44px; margin: 0; padding: 0;
  border: 0; border-radius: 6px; background: transparent; color: var(--bilan-text); cursor: pointer;
}
.halo-preview .bilan-fermer:hover { background: rgb(155 201 178 / 14%); }
.halo-preview .bilan-fermer:focus-visible, .halo-preview .bilan-pastille:focus-visible { outline: 2px solid #add3be; outline-offset: 2px; }
.halo-preview .bilan-fermer[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.halo-preview .bilan-fermer:disabled { opacity: .6; cursor: wait; }
.bilan-titre { margin: -6px 8px 2px 0; font: 400 18px/1.3 Georgia, serif; color: var(--bilan-text); }
.bilan-titre:focus { outline: none; }
.bilan-ligne, .bilan-avance { margin: 0 8px 2px 0; color: var(--bilan-muted); font-size: 12.5px; line-height: 1.45; }
.bilan-avance { color: var(--bilan-text); }
/* La barre d'avance : 3 px, ambre, qui se vide vers la droite (origine à gauche). */
.halo-preview .bilan-barre { height: 3px; margin: 4px 8px 4px 0; border-radius: 2px; background: rgb(226 188 126 / 22%); overflow: hidden; }
.halo-preview .bilan-barre-plein {
  display: block; height: 100%; background: var(--bilan-gold); transform-origin: left center; transition: transform 250ms linear;
}
/* Le corps : les adversaires, les gardes qui rentrent, les objets ; il défile si la liste est longue. */
.halo-preview .bilan-bandeau .bilan-corps {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin-top: 6px; padding-right: 8px;
}
.bilan-adversaires, .bilan-objets { margin: 0; padding: 0; list-style: none; }
/* Une ligne d'adversaire : le nom, des pointillés, l'état à droite ; trop longue, l'état passe dessous, aligné à droite, jamais coupé. */
.bilan-adversaire {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; padding: 3px 0; font-size: 13px; line-height: 1.4;
}
.bilan-adversaire-nom { min-width: 0; overflow-wrap: anywhere; }
.bilan-pointilles { flex: 1 1 12px; min-width: 12px; border-bottom: 1px dotted rgb(196 222 207 / 35%); transform: translateY(-3px); }
.bilan-adversaire-etat { margin-left: auto; color: var(--bilan-text); text-align: right; white-space: nowrap; }
.bilan-rentrent, .bilan-objet { margin: 4px 0 0; color: var(--bilan-muted); font-size: 12.5px; line-height: 1.45; }
.bilan-objets { margin-top: 4px; border-top: 1px solid rgb(196 222 207 / 15%); }
.bilan-objet { padding-top: 4px; }
.halo-preview .bilan-statut { margin: 6px 8px 0 0; padding: 6px 9px; border: 1px solid rgb(226 188 126 / 35%); border-radius: 5px; color: #f0d4a2;
  background: rgb(60 44 22 / 30%); font-size: 12px; }
.halo-preview .bilan-statut[data-erreur="true"] { border-color: rgb(232 131 111 / 45%); color: var(--bilan-coral); background: rgb(60 26 22 / 30%); }

/* Plié : la pastille de 44 px et la barre de 3 px dessous. */
.halo-preview .bilan-pli { display: inline-flex; flex-direction: column; gap: 3px; pointer-events: auto; animation: bilan-fondu 150ms ease both; }
.halo-preview .bilan-pastille {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; height: 44px; padding: 0 12px 0 14px;
  border: 1px solid rgb(196 222 207 / 30%); border-radius: 6px; background: rgb(15 34 38 / 72%); color: var(--bilan-text);
  backdrop-filter: blur(7px) saturate(1.08); -webkit-backdrop-filter: blur(7px) saturate(1.08); text-shadow: 0 1px 3px rgb(4 17 15 / 75%);
  font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; cursor: pointer; touch-action: manipulation;
}
.halo-preview .bilan-pastille:hover { background: rgb(48 81 76 / 85%); }
.bilan-pastille-texte { color: var(--bilan-eyebrow); }
.bilan-pastille-chevron { display: grid; place-items: center; }
.halo-preview .bilan-pli .bilan-barre { margin: 0; }
/* L'annonce : lue, jamais vue. */
.halo-preview .bilan-annonce {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@keyframes bilan-monte { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes bilan-fondu { from { opacity: 0; } to { opacity: 1; } }

/* Téléphone (et pointeur grossier) : déplié en bas à gauche, au-dessus de la barre de sept boutons, à gauche du joystick (10 px d'écart) — il
   recouvre le bloc du nom du lieu ; plié, la pastille se pose au-dessus de ce bloc, à gauche. */
@media (max-width: 720px), (pointer: coarse) {
  .halo-preview .bilan-ui { left: var(--bilan-gauche, 12px); right: var(--bilan-droite, 150px); bottom: var(--bilan-bas, 66px); width: auto; }
  .halo-preview .bilan-ui[data-phase="folded"] { right: auto; bottom: var(--bilan-bas-plie, 150px); }
  .bilan-titre { font-size: 17px; }
  .halo-preview .bilan-bandeau { padding-left: 12px; }
}
/* Paysage bas : à gauche, 45 vw au plus, comme la carte du tas. */
@media (max-height: 500px) and (orientation: landscape) {
  .halo-preview .bilan-ui, .halo-preview .bilan-ui[data-phase="folded"] {
    left: max(12px, env(safe-area-inset-left)); right: auto; width: min(300px, 45vw); bottom: calc(env(safe-area-inset-bottom) + 68px);
  }
  .halo-preview .bilan-bandeau { max-height: calc(100dvh - 68px - 12px); }
}

/* Mouvement réduit (l'appareil ou le réglage du jeu) : pli et dépli par fondu de 150 ms, aucune autre animation, la barre sans transition. */
@media (prefers-reduced-motion: reduce) {
  .halo-preview .bilan-bandeau, .halo-preview .bilan-pli { animation: bilan-fondu 150ms ease both; }
  .halo-preview .bilan-barre-plein, .halo-preview .bilan-ui * { transition: none; }
}
.halo-preview .bilan-ui.is-reduit .bilan-bandeau, .halo-preview .bilan-ui.is-reduit .bilan-pli { animation: bilan-fondu 150ms ease both; }
.halo-preview .bilan-ui.is-reduit .bilan-barre-plein, .halo-preview .bilan-ui.is-reduit * { transition: none; }
