* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #0a0a12;
  color: #e8e8f0;
  user-select: none;
}

#game {
  display: block;
  width: 100vw;
  height: 100vh;
}

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#hud-top {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding-top: 16px;
}

.hud-box {
  background: linear-gradient(180deg, rgba(16, 18, 40, 0.72), rgba(10, 10, 25, 0.6));
  border: 1px solid rgba(140, 165, 255, 0.35);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 8px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 110px;
  backdrop-filter: blur(4px);
}

.hud-label {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #8b93c8;
}

.hud-box span:last-child {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}

/* Esprit lié : nom + pouvoir, plus discret que les gros compteurs */
#hud-spirit {
  font-size: 13px !important;
  font-weight: 600;
  color: #9fecff;
  max-width: 200px;
  text-align: center;
}

#hud-bottom {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
}

#inventory {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 10px;
}

.inv-slot {
  min-width: 120px;
  padding: 5px 12px;
  background: rgba(10, 10, 25, 0.7);
  border: 1px solid rgba(120, 140, 255, 0.25);
  border-radius: 8px;
  text-align: center;
  backdrop-filter: blur(4px);
}

.inv-slot .key {
  display: block;
  font-size: 10px;
  letter-spacing: 1px;
  color: #666f9f;
}

.inv-slot .nm {
  font-size: 13px;
  color: #9aa0d0;
}

.inv-slot.active {
  border-color: #ffd166;
  box-shadow: 0 0 12px rgba(255, 209, 102, 0.35);
}

.inv-slot.active .nm {
  color: #ffd166;
}

#car-bar {
  width: 320px;
  height: 22px;
  margin-bottom: 8px;
  background: rgba(10, 10, 25, 0.7);
  border: 1px solid rgba(192, 57, 43, 0.5);
  border-radius: 7px;
  position: relative;
  overflow: hidden;
}

#car-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #c0392b, #e67e22);
  transition: width 0.15s ease;
}

#car-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

#hp-bar {
  width: 320px;
  height: 26px;
  background: rgba(10, 10, 25, 0.7);
  border: 1px solid rgba(255, 100, 100, 0.4);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

#hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #e63946, #ff6b6b);
  transition: width 0.15s ease;
}

#hp-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

#announce {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 44px;
  font-weight: 800;
  letter-spacing: 4px;
  color: #ffd166;
  text-shadow: 0 0 20px rgba(255, 209, 102, 0.6), 0 2px 4px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transition: opacity 0.4s ease;
}

#announce.show {
  opacity: 1;
}

#damage-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(230, 57, 70, 0.55) 100%);
  opacity: 0;
  transition: opacity 0.35s ease;
}

#damage-flash.show {
  opacity: 1;
  transition: opacity 0.05s ease;
}

/* ---------- Écrans (menu, pause, game over) ---------- */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: radial-gradient(ellipse at center, rgba(20, 20, 45, 0.88), rgba(8, 8, 16, 0.96));
  z-index: 10;
}

.overlay h1 {
  font-size: 68px;
  font-weight: 900;
  letter-spacing: 8px;
  color: #fff;
  text-shadow: 0 0 30px rgba(100, 120, 255, 0.5);
}

.overlay h1 span {
  color: #e63946;
  text-shadow: 0 0 30px rgba(230, 57, 70, 0.6);
}

.overlay h1.defeat {
  color: #e63946;
}

.overlay h1.victory {
  color: #ffd166;
  text-shadow: 0 0 30px rgba(255, 209, 102, 0.6);
}

.subtitle {
  font-size: 18px;
  color: #a8aed4;
}

.menu-version {
  margin-top: -12px;
  font: 12px monospace;
  color: rgba(200, 205, 235, 0.45);
}

.btn {
  font-size: 22px;
  font-weight: 700;
  padding: 14px 52px;
  border: 2px solid #6474ff;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(100, 116, 255, 0.25), rgba(100, 116, 255, 0.1));
  color: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 2px;
}

.btn:hover {
  background: linear-gradient(180deg, rgba(100, 116, 255, 0.45), rgba(100, 116, 255, 0.2));
  box-shadow: 0 0 24px rgba(100, 116, 255, 0.5);
  transform: translateY(-2px);
}

.controls-help {
  margin-top: 14px;
  background: rgba(10, 10, 25, 0.6);
  border: 1px solid rgba(120, 140, 255, 0.2);
  border-radius: 12px;
  padding: 18px 32px;
}

.controls-help h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: #8b93c8;
  margin-bottom: 10px;
  text-align: center;
}

.controls-help ul {
  list-style: none;
  font-size: 15px;
  color: #c8cce8;
}

.controls-help li {
  padding: 4px 0;
}

.final-stats {
  display: flex;
  gap: 32px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-size: 48px;
  font-weight: 800;
  color: #ffd166;
}

.stat-label {
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #8b93c8;
}

.btn-row {
  display: flex;
  gap: 14px;
}

.btn-ghost {
  border-color: rgba(160, 168, 210, 0.4);
  background: rgba(20, 22, 40, 0.35);
}

.btn-ghost:hover {
  background: rgba(60, 66, 100, 0.4);
  box-shadow: 0 0 18px rgba(160, 168, 210, 0.25);
}

#ko-banner {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  pointer-events: none;
  background: rgba(80, 12, 20, 0.85);
  border: 2px solid #e6394b;
  border-radius: 14px;
  padding: 10px 22px;
  font-size: 17px;
  font-weight: 700;
  color: #ffd6d6;
  letter-spacing: 1px;
}

#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 62%, rgba(0, 0, 10, 0.26) 100%);
}

.hidden {
  display: none !important;
}

/* Viseur : au centre de l'écran dès qu'une arme à feu est équipée. Point +
   4 tirets, lisible sur tout fond (contour sombre), discret — l'épée le déçoit */
#crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 4;
  opacity: 0.92;
}

#crosshair i {
  position: absolute;
  background: #fff;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.7);
  border-radius: 1px;
}

#crosshair .dot {
  left: 50%;
  top: 50%;
  width: 3px;
  height: 3px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
}

#crosshair .t { left: 50%; top: 0; width: 2px; height: 8px; transform: translateX(-50%); }
#crosshair .b { left: 50%; bottom: 0; width: 2px; height: 8px; transform: translateX(-50%); }
#crosshair .l { top: 50%; left: 0; width: 8px; height: 2px; transform: translateY(-50%); }
#crosshair .r { top: 50%; right: 0; width: 8px; height: 2px; transform: translateY(-50%); }

/* En visée zoomée : les tirets se resserrent et la croix passe à l'or */
#crosshair i { transition: top 0.12s, bottom 0.12s, left 0.12s, right 0.12s, background 0.12s; }
#crosshair.zoom .t { top: 5px; }
#crosshair.zoom .b { bottom: 5px; }
#crosshair.zoom .l { left: 5px; }
#crosshair.zoom .r { right: 5px; }
#crosshair.zoom .dot { background: #ffd166; }

.btn.event {
  border-color: #ff9a3c;
  background: linear-gradient(180deg, rgba(232, 114, 42, 0.35), rgba(138, 31, 43, 0.25));
  animation: pulseHalloween 1.6s ease-in-out infinite;
}

@keyframes pulseHalloween {
  0%, 100% { box-shadow: 0 0 10px rgba(232, 114, 42, 0.4); }
  50% { box-shadow: 0 0 26px rgba(232, 114, 42, 0.75); }
}

.btn-tiny.halloween {
  border-color: #ff9a3c;
  color: #ffb36b;
}

/* ---------- Casier (récompenses) ---------- */
#locker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 480px;
  width: 90vw;
  max-height: 46vh;
  overflow-y: auto;
  padding: 4px;
}

.locker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: rgba(12, 13, 28, 0.75);
  border: 1px solid rgba(120, 140, 255, 0.22);
  border-radius: 10px;
  padding: 10px 16px;
}

.locker-row.locked {
  opacity: 0.55;
}

.locker-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.locker-name {
  font-size: 15px;
  font-weight: 700;
  color: #e8e8f4;
}

.locker-desc {
  font-size: 12px;
  color: #8b93c8;
}

.btn-tiny {
  font-size: 13px;
  padding: 6px 16px;
  border-radius: 8px;
  border: 1px solid rgba(160, 168, 210, 0.4);
  background: rgba(20, 22, 40, 0.5);
  color: #b4badc;
  cursor: pointer;
}

.btn-tiny.worn {
  border-color: #ffd166;
  color: #ffd166;
}

/* ---------- Progression (niveau / XP) ---------- */
.player-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(10, 10, 25, 0.6);
  border: 1px solid rgba(255, 209, 102, 0.25);
  border-radius: 14px;
  padding: 10px 22px;
  margin-top: -14px;
}

.level-badge {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid #ffd166;
  background: rgba(30, 28, 12, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: #ffd166;
  box-shadow: 0 0 14px rgba(255, 209, 102, 0.35);
}

.level-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 220px;
}

.level-label {
  font-size: 13px;
  letter-spacing: 1px;
  color: #c8cce8;
}

#pseudo-input {
  background: transparent;
  border: none;
  border-bottom: 1px dashed rgba(255, 209, 102, 0.45);
  color: #ffd166;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 0 0 2px;
  outline: none;
  caret-color: #ffd166;
}

#pseudo-input::placeholder {
  color: rgba(255, 209, 102, 0.35);
  font-weight: 400;
}

.xp-bar {
  height: 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

/* ---------- Copains (multijoueur) ---------- */
.friends-card {
  background: rgba(10, 10, 25, 0.6);
  border: 1px solid rgba(150, 200, 255, 0.25);
  border-radius: 14px;
  padding: 12px 22px;
  min-width: 320px;
  max-height: 220px;
  overflow-y: auto;
}

.friends-card h2 {
  margin: 0 0 8px;
  font-size: 15px;
  letter-spacing: 2px;
  color: #9fc5ff;
}

.friends-add {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.friends-add input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(150, 200, 255, 0.3);
  border-radius: 8px;
  color: #e8ecff;
  font: inherit;
  padding: 5px 10px;
  outline: none;
}

.btn-mini {
  padding: 5px 12px;
  font-size: 13px;
}

#friend-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

#friend-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 2px;
  font-size: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.friend-status { font-size: 11px; }
.friend-name { flex: 1; font-weight: 700; }

.friends-note {
  margin: 6px 0 0;
  font-size: 13px;
  color: #ffd166;
  min-height: 17px;
}

#invite-banner {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(10, 10, 25, 0.92);
  border: 2px solid #9fc5ff;
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 16px;
  box-shadow: 0 0 30px rgba(150, 200, 255, 0.45);
  animation: pulseInvite 1.2s ease-in-out infinite;
}

@keyframes pulseInvite {
  0%, 100% { box-shadow: 0 0 18px rgba(150, 200, 255, 0.35); }
  50% { box-shadow: 0 0 34px rgba(150, 200, 255, 0.7); }
}

#room-card {
  background: rgba(10, 10, 25, 0.75);
  border: 2px solid #9fc5ff;
  border-radius: 14px;
  padding: 14px 26px;
  text-align: center;
}

#room-card h2 {
  margin: 0 0 6px;
  font-size: 17px;
  letter-spacing: 2px;
  color: #9fc5ff;
}

#room-members {
  margin: 0 0 6px;
  font-size: 15px;
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffd166, #ff9f43);
  border-radius: 6px;
  transition: width 0.4s ease;
}

.xp-text {
  font-size: 11px;
  color: #8b93c8;
}

#xp-line {
  font-size: 22px;
  font-weight: 700;
  color: #ffd166;
  margin-top: -16px;
}

#pickup-hint {
  position: absolute;
  bottom: 108px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 10, 25, 0.8);
  border: 1px solid rgba(255, 209, 102, 0.45);
  border-radius: 999px;
  padding: 7px 18px;
  font-size: 14px;
  color: #ffd166;
  opacity: 0;
  transition: opacity 0.15s ease;
}

#pickup-hint.show {
  opacity: 1;
}

#pickup-hint.drop {
  border-color: rgba(180, 186, 220, 0.35);
  color: #b4badc;
}

#build-version {
  position: fixed;
  right: 8px;
  bottom: 3px;
  font: 10px monospace;
  color: rgba(200, 205, 235, 0.4);
  z-index: 20;
}
/* ===== Collection d'Esprits au salon : grisés tant que jamais liés ===== */
.spirits-card {
  background: rgba(10, 10, 25, 0.6);
  border: 1px solid rgba(60, 220, 255, 0.3);
  border-radius: 14px;
  padding: 12px 22px;
  min-width: 380px;
  max-width: 440px;
}
.spirits-card h2 {
  margin: 0 0 8px;
  font-size: 15px;
  letter-spacing: 2px;
  color: #6fe0f0;
}
.spirits-count { color: #9fecff; }
.spirits-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 8px 4px;
}
.spirit-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
}
.spirit-blob {
  width: 24px;
  height: 21px;
  border-radius: 45%;
  position: relative;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.25);
}
/* Les deux yeux blancs du petit monstre (comme en 3D) */
.spirit-blob::before, .spirit-blob::after {
  content: '';
  position: absolute;
  top: 5px;
  width: 5px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
}
.spirit-blob::before { left: 5px; }
.spirit-blob::after { right: 5px; }
.spirit-tile small {
  font-size: 8px;
  color: #cfe6ff;
  text-align: center;
  line-height: 1.1;
}
.spirit-tile.locked { opacity: 0.55; filter: grayscale(0.6); }
.spirit-tile.locked small { color: #555d70; }
/* Carte collection DANS l'écran de pause (touche C en jeu) */
#pause-spirits {
  max-height: 300px;
  overflow-y: auto;
  margin: 10px 0;
}
/* Esprit équipé : halo doré, comme une relique prête au combat */
.spirit-tile.equipped .spirit-blob {
  box-shadow: 0 0 10px #ffd166;
  border: 2px solid #ffd166;
}
.spirit-tile.equipped small { color: #ffd166; font-weight: 700; }

/* ===== Vernis : annonces en pilule de verre, vie qui pulse, transitions douces ===== */
#announce {
  background: rgba(10, 10, 26, 0.55);
  border: 1px solid rgba(255, 209, 102, 0.35);
  border-radius: 14px;
  padding: 10px 26px;
  backdrop-filter: blur(5px);
  transform: translateX(-50%) scale(0.92);
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}
#announce.show {
  transform: translateX(-50%) scale(1);   // petit pop à l'apparition
}
#hp-fill.danger {
  animation: hpPulse 0.8s ease-in-out infinite alternate;
}
@keyframes hpPulse {
  from { box-shadow: 0 0 4px rgba(255, 90, 90, 0.3); }
  to { box-shadow: 0 0 14px rgba(255, 60, 60, 0.8); }
}
#inventory .inv-slot, #hp-bar {
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

/* ---------- Passe d'embellissement (vitre, titre, boutons) ---------- */
/* Le menu, la pause et la fin : une VITRE fumantee — l'ile resplendissante
   vit toujours derriere, legerement defocalisee comme un souvenir */
.overlay {
  background: radial-gradient(ellipse at center, rgba(18, 18, 40, 0.74), rgba(8, 8, 16, 0.9));
  backdrop-filter: blur(3px) saturate(1.15);
}
/* Le titre : un metal gradient (ivoire vers lavande) au lieu du blanc plein,
   avec une signature d'ombre double — la victoire et la defaite teintent
   le metal d'or ou de rouge, et le tout apparait en flottant */
.overlay h1 {
  background: linear-gradient(180deg, #ffffff 20%, #b9c0ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 26px rgba(100, 120, 255, 0.35));
  animation: titreMontee 0.5s ease-out both;
}
.overlay h1 span {
  background: linear-gradient(180deg, #ff8a94 0%, #e63946 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
.overlay h1.victory {
  background: linear-gradient(180deg, #ffe9a8 0%, #ffd166 60%, #e8a93c 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
.overlay h1.defeat {
  background: linear-gradient(180deg, #ff929b 0%, #d92c40 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
@keyframes titreMontee {
  from { opacity: 0; transform: translateY(14px); filter: blur(6px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}
/* Le sous-titre et les boutons suivent le titre en cascade */
.subtitle, .btn-row, .menu-version {
  animation: titreMontee 0.5s ease-out 0.1s both;
}
.btn {
  font-size: 21px;
  padding: 13px 50px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.btn:hover {
  background: linear-gradient(180deg, rgba(120, 135, 255, 0.5), rgba(100, 116, 255, 0.22));
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35), 0 0 26px rgba(100, 116, 255, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}
.btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
