/* VR Studio — Interface en jeu (2026-10-10) : carte du joueur (vie + score), objectifs, boss, arme, inventaire,
 * messages, dialogues, bannière de niveau, écran de défaite, écran de chargement, boutons du haut.
 * Chargée APRÈS game-ui.css (thème) et game-shell.css : elle remplace l'ancien habillage sans toucher au moteur.
 * Les quelques !important servent uniquement à neutraliser des styles posés en JavaScript par l'ancien code.
 */
:root {
  --hud-accent: #f59e0b;
  --hud-accent-2: #f97316;
  --hud-hp: #22c55e;
  --hud-hp-2: #84cc16;
  --hud-low: #ef4444;
  --hud-card: rgba(9, 12, 22, 0.74);
  --hud-line: rgba(255, 255, 255, 0.14);
  --hud-text: #f8fafc;
  --hud-muted: rgba(226, 232, 240, 0.72);
  --hud-font: "Exo 2", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ── Ancien HUD « Street Fighter » : remplacé par la carte du joueur ─────────── */
#sf-combat-hud,
#vrstudio-camera-mode-indicator { display: none !important; }

/* ── Carte du joueur (haut gauche) ──────────────────────────────────────────── */
.hud {
  position: fixed;
  inset: 0;
  z-index: 9003;
  pointer-events: none;
  font-family: var(--hud-font);
  color: var(--hud-text);
}
.hud.is-hidden { display: none; }
.hud-player {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--hud-line);
  border-radius: 16px;
  background: var(--hud-card);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.hud-hp {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hud-hp-icon {
  font-size: 18px;
  color: #f87171;
  filter: drop-shadow(0 0 6px rgba(248, 113, 113, 0.6));
}
.hud-hp-bar {
  width: clamp(110px, 18vw, 210px);
  height: 12px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
  -webkit-appearance: none;
  appearance: none;
}
.hud-hp-bar::-webkit-progress-bar { background: rgba(255, 255, 255, 0.12); border-radius: 999px; }
.hud-hp-bar::-webkit-progress-value { background: linear-gradient(90deg, var(--hud-hp), var(--hud-hp-2)); border-radius: 999px; transition: width 250ms ease; }
.hud-hp-bar::-moz-progress-bar { background: linear-gradient(90deg, var(--hud-hp), var(--hud-hp-2)); border-radius: 999px; }
.hud-hp-text {
  min-width: 2.4em;
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.hud-score {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 10px;
  border-left: 1px solid var(--hud-line);
}
.hud-score-icon { color: #facc15; font-size: 16px; }
.hud-score-value {
  min-width: 2ch;
  font-size: 18px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
/* Vie basse : la barre passe au rouge et la carte pulse */
.hud-player.is-low { border-color: rgba(239, 68, 68, 0.7); animation: hud-low 1s ease-in-out infinite; }
.hud-player.is-low .hud-hp-bar::-webkit-progress-value { background: linear-gradient(90deg, #ef4444, #f97316); }
.hud-player.is-low .hud-hp-bar::-moz-progress-bar { background: linear-gradient(90deg, #ef4444, #f97316); }
@keyframes hud-low {
  0%, 100% { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
  50% { box-shadow: 0 0 24px rgba(239, 68, 68, 0.55); }
}
/* Coup reçu / soin : petit choc visuel */
.hud-player.is-hit { animation: hud-hit 320ms ease; }
.hud-player.is-heal { animation: hud-heal 600ms ease; }
@keyframes hud-hit {
  0% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}
@keyframes hud-heal {
  0% { box-shadow: 0 0 0 rgba(34, 197, 94, 0); }
  40% { box-shadow: 0 0 26px rgba(34, 197, 94, 0.7); }
  100% { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
}
.hud-score-value.is-up { animation: hud-score 450ms ease; }
@keyframes hud-score {
  0% { transform: scale(1); color: var(--hud-text); }
  40% { transform: scale(1.35); color: #fde047; }
  100% { transform: scale(1); color: var(--hud-text); }
}

/* Vies et chrono (affichés seulement si les règles du jeu en prévoient) */
.hud-lives,
.hud-timer {
  padding-left: 10px;
  border-left: 1px solid var(--hud-line);
  font-size: 15px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.hud-lives { color: #fca5a5; }
.hud-lives.is-hidden,
.hud-timer.is-hidden { display: none; }
.hud-lives.is-lost { animation: hud-hit 320ms ease 3; color: #ef4444; }
.hud-timer.is-urgent { color: #fca5a5; animation: hud-low 1s ease-in-out infinite; }

/* ── Mini-carte (haut droite, sous les boutons) ─────────────────────────────── */
.hud-map {
  position: absolute;
  top: calc(max(12px, env(safe-area-inset-top)) + 58px);
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
  cursor: zoom-out;
}
.hud-map.is-zoomed { cursor: zoom-in; }
.hud-map.is-hidden { display: none; }
.hud-map-canvas {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.hud-map-hint {
  max-width: 200px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--hud-card);
  color: #fde68a;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hud-map-hint:empty { display: none; }

/* ── Bannière de niveau (au centre, à l'entrée d'une scène) ─────────────────── */
.hud-banner {
  position: absolute;
  top: 26%;
  left: 50%;
  display: none;
  transform: translateX(-50%);
  text-align: center;
  white-space: nowrap;
}
.hud-banner.is-on { display: block; animation: hud-banner 3.2s ease forwards; }
.hud-banner-kicker {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--hud-accent);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}
.hud-banner-title {
  margin-top: 4px;
  font-size: clamp(30px, 6vw, 64px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.85), 0 0 30px rgba(245, 158, 11, 0.35);
}
@keyframes hud-banner {
  0% { opacity: 0; transform: translate(-50%, 14px) scale(0.96); letter-spacing: 0.08em; }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1); letter-spacing: 0.02em; }
  78% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -8px); }
}

/* ── Boutons du haut à droite : son + pause ────────────────────────────────── */
.vr-game-header-compact .vr-btn-settings {
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  width: 48px;
  height: 48px;
  line-height: 48px;
  font-size: 20px;
  border-color: var(--hud-line);
  background: var(--hud-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
#sound-control {
  top: max(12px, env(safe-area-inset-top)) !important;
  right: calc(max(12px, env(safe-area-inset-right)) + 58px) !important;
  bottom: auto !important;
  left: auto !important;
}
.vr-sound-toggle {
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--hud-line);
  border-radius: 50%;
  background: var(--hud-card);
  font-size: 18px;
  opacity: 1;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ── Objectifs (sous la carte du joueur, repliables d'un clic) ─────────────── */
.objectives-hud {
  top: calc(max(12px, env(safe-area-inset-top)) + 58px);
  left: max(12px, env(safe-area-inset-left));
  max-width: min(320px, 46vw);
  padding: 10px 12px;
  border: 1px solid var(--hud-line);
  border-radius: 14px;
  background: var(--hud-card);
  font-family: var(--hud-font);
  font-size: 13px;
  pointer-events: auto;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.objectives-hud-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--hud-accent);
  opacity: 1;
  cursor: pointer;
}
.objectives-hud-title::after { content: "▾"; color: var(--hud-muted); }
.objectives-hud.is-collapsed .objectives-hud-title { margin-bottom: 0; }
.objectives-hud.is-collapsed .objectives-hud-title::after { content: "▸"; }
.objectives-hud.is-collapsed .objectives-hud-list { display: none; }
.objective-item-done { color: #86efac; }

/* ── Boss (haut centre) ────────────────────────────────────────────────────── */
/* Deuxième ligne, au centre : ne recouvre ni la carte du joueur (gauche) ni les boutons (droite) */
.boss-hud {
  top: calc(max(12px, env(safe-area-inset-top)) + 58px);
  width: min(520px, calc(100vw - 2 * 360px), 60vw);
  min-width: 260px;
  padding: 8px 14px 10px;
  border-color: rgba(239, 68, 68, 0.6);
  border-radius: 14px;
  background: rgba(20, 6, 10, 0.78);
  font-family: var(--hud-font);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.boss-hud-bar-wrapper { height: 14px; border-radius: 999px; }
.boss-hud-bar-fill { border-radius: 999px; }

/* ── Arme (bas centre) ─────────────────────────────────────────────────────── */
.weapon-hud {
  bottom: max(14px, env(safe-area-inset-bottom));
  padding: 8px 16px 8px 12px;
  border-color: var(--hud-line);
  background: var(--hud-card);
  font-family: var(--hud-font);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.weapon-hud-name { font-size: 14px; font-weight: 800; }

/* ── Inventaire (bas gauche) ───────────────────────────────────────────────── */
.vr-inventory-hud {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 9003;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 38vw;
  pointer-events: none;
  font-family: var(--hud-font);
}
.vr-inventory-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--hud-line);
  border-radius: 999px;
  background: var(--hud-card);
  color: var(--hud-text);
  font-size: 12px;
  font-weight: 800;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.vr-inventory-icon {
  width: 18px;
  height: 18px;
  padding: 2px;
  border-radius: 6px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.08);
}

/* ── Messages (toasts) : en bas au centre, au-dessus de l'arme ───────────────── */
.vr-toast-host {
  position: fixed;
  bottom: calc(max(14px, env(safe-area-inset-bottom)) + 64px);
  left: 50%;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
  font-family: var(--hud-font);
}
.vr-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(520px, 86vw);
  padding: 10px 16px;
  border: 1px solid var(--hud-line);
  border-left: 4px solid var(--hud-accent);
  border-radius: 14px;
  background: rgba(9, 12, 22, 0.9);
  color: var(--hud-text);
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  transition: opacity 180ms ease, transform 180ms ease;
}
.vr-toast.is-visible { opacity: 1; transform: none; }
.vr-toast-icon {
  width: 28px;
  height: 28px;
  padding: 4px;
  border-radius: 8px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.08);
}

/* ── Dialogues / panneaux (bas de l'écran, façon jeu d'aventure) ──────────── */
.vr-dialog {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0 16px max(28px, env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.15) 55%, rgba(0, 0, 0, 0) 100%);
  pointer-events: auto;
  font-family: var(--hud-font);
}
.vr-dialog.is-open { display: flex; animation: vr-dialog-in 220ms ease-out; }
@keyframes vr-dialog-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.vr-dialog-panel {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  width: min(760px, 100%);
  padding: 18px 20px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 18px;
  background: rgba(9, 12, 22, 0.94);
  color: var(--hud-text);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  animation: vr-dialog-up 260ms cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes vr-dialog-up {
  from { transform: translateY(24px); }
  to { transform: none; }
}
.vr-dialog-img {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  padding: 8px;
  border-radius: 14px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.06);
}
.vr-dialog-img.is-hidden { display: none; }
.vr-dialog-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.vr-dialog-title {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hud-accent);
}
.vr-dialog-text {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.45;
  white-space: pre-line;
  max-height: 46vh;
  overflow-y: auto;
}
.vr-dialog-ok {
  align-self: flex-end;
  min-height: 46px;
  padding: 10px 22px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--hud-accent), var(--hud-accent-2));
  color: #1c1003;
  font: inherit;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}
.vr-dialog-ok:focus-visible { outline: 3px solid #fde047; outline-offset: 3px; }

/* ── Défaite (Game Over) : même famille que l'écran de victoire ────────────── */
.vr-game-over-overlay {
  z-index: 1000001;
  background: radial-gradient(circle at center, rgba(127, 29, 29, 0.35), rgba(0, 0, 0, 0.85) 70%);
}
.vr-game-over-card {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(17, 10, 14, 0.94);
  font-family: var(--hud-font);
}
.vr-game-over-title {
  font-size: 40px;
  color: #f87171;
  text-shadow: 0 2px 18px rgba(239, 68, 68, 0.5);
}
.vr-game-over-subtitle { font-size: 15px; }
.vr-game-over-actions { flex-wrap: wrap; }
.vr-game-over-score { font-size: 14px; font-weight: 800; }

/* ── Victoire : police du jeu ──────────────────────────────────────────────── */
.vr-victory-card,
.vr-victory-title { font-family: var(--hud-font); }

/* ── Chargement d'une scène (entre deux niveaux) ───────────────────────────── */
.vr-loading-overlay {
  background: radial-gradient(120% 90% at 20% 10%, #1e293b 0%, #0b0f1a 55%, #05070d 100%) !important;
  padding-top: 0 !important;
  font-family: var(--hud-font);
}
.vr-loading-overlay-title {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 900;
}
.vr-loading-status { color: var(--hud-muted); font-size: 15px; }
.vr-loading-bar-wrapper { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.vr-loading-bar { border-radius: 999px; background: linear-gradient(90deg, var(--hud-accent), var(--hud-accent-2)); }
/* Journal technique du chargement : seulement en mode débogage (?vrdebug=1) */
#loading-steps { display: none !important; }
html.vr-debug #loading-steps { display: block !important; }

/* ── Boutons tactiles : plus lisibles ───────────────────────────────────────── */
.mobile-pad-btn {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(9, 12, 22, 0.55);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.mobile-pad-btn-attack {
  border-color: rgba(251, 146, 60, 0.85);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.85), rgba(239, 68, 68, 0.8));
  color: #fff;
}

/* ── Petits écrans ─────────────────────────────────────────────────────────── */
@media (max-width: 720px), (max-height: 480px) {
  .hud-map { top: calc(max(10px, env(safe-area-inset-top)) + 52px); }
  .hud-map-canvas { width: 112px; height: 112px; }
  .hud-map-hint { max-width: 150px; font-size: 11px; }
  .hud-player { padding: 6px 10px; gap: 8px; border-radius: 14px; }
  .hud-hp-bar { width: 96px; height: 10px; }
  .hud-score-value { font-size: 16px; }
  .objectives-hud { top: calc(max(10px, env(safe-area-inset-top)) + 50px); font-size: 12px; }
  .boss-hud { top: calc(max(10px, env(safe-area-inset-top)) + 50px); width: min(380px, 50vw); min-width: 200px; }
  .vr-toast-host { bottom: calc(max(10px, env(safe-area-inset-bottom)) + 58px); }
  /* Boss à l'écran : les objectifs se replient pour lui laisser la place */
  body:has(#boss-hud[style*="block"]) #objectives-hud .objectives-hud-list { display: none; }
  .vr-dialog-text { font-size: 15px; }
  .vr-dialog-panel { padding: 14px 16px; }
}
