/* HUD en jeu. Regle de base : rien au centre de l'ecran, tout dans les coins.
   Le joueur regarde son avatar, pas l'interface. */

#hud {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none; /* le HUD ne doit jamais voler un clic au jeu */
  font-variant-numeric: tabular-nums;
}
#hud button, #hud .interactive { pointer-events: auto; }

.hud-topleft { position: absolute; top: 14px; left: 14px; display: flex; flex-direction: column; gap: 8px; }
.hud-topright { position: absolute; top: 14px; right: 14px; width: 250px; }
.hud-bottomleft { position: absolute; bottom: 14px; left: 14px; width: 270px; }
.hud-bottomcenter { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); }
.hud-bottomright { position: absolute; bottom: 14px; right: 14px; }
.hud-tools { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }

/* ---------------- Chrono et evenement ---------------- */

.timer {
  font-family: var(--mono);
  font-size: 1.7rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  background: rgba(10, 13, 17, 0.72);
  border: 1px solid var(--line);
}
.timer.urgent { color: var(--blood); border-color: var(--blood); animation: pulse 1s infinite; }

.event-banner {
  max-width: 320px;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  background: rgba(10, 13, 17, 0.85);
  border-left: 3px solid var(--gold);
}
.event-banner strong { display: block; color: var(--gold); font-size: 0.95rem; }
.event-banner span { font-size: 0.8rem; color: var(--text-dim); }
.event-banner.warning { animation: pulse 1.4s infinite; }

@keyframes pulse { 50% { opacity: 0.55; } }

/* ---------------- Classement ---------------- */

.leaderboard {
  list-style: none;
  margin: 0 0 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: rgba(10, 13, 17, 0.72);
  border: 1px solid var(--line);
  font-size: 0.83rem;
}
.leaderboard li {
  display: grid;
  grid-template-columns: 14px 1fr auto auto;
  gap: 7px;
  align-items: center;
  padding: 2px 0;
  color: var(--text-dim);
}
.leaderboard li.me { color: var(--text); font-weight: 650; }
.leaderboard .dot { width: 8px; height: 8px; border-radius: 50%; }
.leaderboard .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard .zn { color: var(--text-faint); font-size: 0.76rem; }
.leaderboard .sc { font-family: var(--mono); color: var(--text); }
.leaderboard .crown { color: var(--gold); }

/* ---------------- Killfeed ---------------- */

.killfeed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.killfeed li {
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  background: rgba(10, 13, 17, 0.78);
  font-size: 0.8rem;
  animation: slideIn 0.2s ease-out;
  max-width: 100%;
}
.killfeed .backstab { color: var(--blood); font-weight: 650; }
.killfeed .betrayal { border-left: 3px solid var(--blood); color: #ffb3b6; }
.killfeed .crown { border-left: 3px solid var(--gold); color: var(--gold); }
.killfeed .sabotage { border-left: 3px solid var(--gold); }

@keyframes slideIn { from { opacity: 0; transform: translateX(14px); } }

/* ---------------- Vitals ---------------- */

.vitals { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }

.bar {
  position: relative;
  height: 20px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--line);
  overflow: hidden;
}
.bar span {
  display: block;
  height: 100%;
  width: 0;
  transition: width 0.12s linear;
}
.bar b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.74rem;
  font-weight: 700;
  font-family: var(--mono);
  text-shadow: 0 1px 3px #000;
}
.bar-hp span { background: linear-gradient(90deg, #c8353c, #e6484f); }
.bar-hp.low span { background: linear-gradient(90deg, #8b1f24, #c8353c); animation: pulse 0.7s infinite; }
.bar-armor { height: 13px; }
.bar-armor span { background: linear-gradient(90deg, #6b7684, var(--steel)); }
.bar-shield { height: 13px; }
.bar-shield span { background: linear-gradient(90deg, #6d78c9, #a5b4fc); }

/* ---------------- Buffs ---------------- */

.buffs { display: flex; flex-wrap: wrap; gap: 5px; }
.buff {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 600;
  background: rgba(10, 13, 17, 0.8);
  border: 1px solid currentColor;
}
.buff.rage { color: var(--blood); }
.buff.haste { color: var(--azure); }
.buff.fervor { color: var(--gold); }
.buff.veil { color: var(--violet); }
.buff.surge { color: #ff7043; }
.buff.bounty { color: var(--blood); background: rgba(230, 72, 79, 0.2); }
.buff.stun, .buff.blind, .buff.slick { color: var(--text-faint); }
.buff.crown { color: var(--gold); background: rgba(242, 177, 52, 0.16); }

/* ---------------- Emplacements ---------------- */

.slots { display: flex; gap: 8px; }
/* Taille de box inchangee : c'est le CONTENU qui devait etre recentre et
   rendu lisible. La touche est en absolu tout en bas, donc le reste se centre
   dans l'espace restant grace au padding-bottom. */
.slot {
  position: relative;
  width: 76px;
  height: 62px;
  border-radius: var(--radius-sm);
  background: rgba(14, 18, 24, 0.92);
  border: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding-bottom: 11px;
  overflow: hidden;
}
.slot-icon {
  font-size: 1.5rem;
  font-style: normal;
  line-height: 1;
  color: #fff;
  /* Sans ce contour, une icone sombre se noyait dans le fond de la box */
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.9));
}
.slot-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  padding: 0 3px;
  line-height: 1.1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slot-sub { font-size: 0.64rem; font-style: normal; color: var(--gold); font-family: var(--mono); }
.slot kbd {
  position: absolute;
  bottom: 3px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.6rem;
  color: var(--text-dim);
  font-family: var(--font);
}
.slot-empty { opacity: 0.45; border-style: dashed; }
.slot.ready { border-color: var(--gold-dim); }

/* Voile de recharge : se vide par le bas */
.cooldown {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  transform-origin: bottom;
  transform: scaleY(0);
  pointer-events: none;
}

/* ---------------- Minimap ---------------- */

#minimap {
  display: block;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: rgba(6, 8, 11, 0.85);
}
#minimap.large { width: 340px; height: 340px; }

/* ---------------- Invites contextuelles ---------------- */

.prompt {
  position: absolute;
  left: 50%;
  bottom: 108px;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(10, 13, 17, 0.88);
  border: 1px solid var(--line-strong);
  font-size: 0.9rem;
  white-space: nowrap;
}
.prompt kbd {
  display: inline-block;
  padding: 1px 7px;
  margin-right: 5px;
  border-radius: 4px;
  background: var(--gold);
  color: #221803;
  font-weight: 700;
  font-family: var(--font);
}
.prompt.danger kbd { background: var(--blood); color: #fff; }
.prompt .fill { display: inline-block; height: 3px; background: var(--blood); border-radius: 2px; vertical-align: middle; margin-left: 8px; transition: width 0.05s linear; }

.ally-badge {
  position: absolute;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  background: rgba(10, 13, 17, 0.85);
  border: 1px solid currentColor;
}
.ally-badge.far { opacity: 0.55; }

/* ---------------- Barre d'outils ---------------- */

.tool {
  pointer-events: auto;
  border: 1px solid var(--line);
  background: rgba(10, 13, 17, 0.75);
  color: var(--text-dim);
  font: inherit;
  font-size: 0.82rem;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.tool:hover { color: var(--text); border-color: var(--line-strong); }

/* ---------------- Roue de ping ---------------- */

.ping-wheel {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(6, 8, 11, 0.45);
  pointer-events: auto;
}
.ping-wheel .wheel { position: relative; width: 280px; height: 280px; }

/* Point de visee : montre ou pointe le geste, indispensable quand il n'y a
   aucun curseur a l'ecran a cause du verrouillage du pointeur. */
.ping-wheel .wheel-cursor {
  position: absolute;
  left: 140px;
  top: 140px;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.6);
  pointer-events: none;
  transition: background 0.1s, border-color 0.1s;
}
.ping-wheel .wheel-cursor.armed {
  background: var(--gold);
  border-color: #fff;
}

.ping-wheel .wheel-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 150px;
  text-align: center;
  font-size: 0.76rem;
  color: var(--text-faint);
  line-height: 1.4;
  pointer-events: none;
}
.ping-wheel .wheel-hint small { font-size: 0.7rem; }
.ping-wheel .wheel-hint b { color: var(--gold); }
.ping-wheel .opt {
  position: absolute;
  width: 92px;
  margin: -22px 0 0 -46px;
  padding: 7px 0;
  text-align: center;
  border-radius: var(--radius-sm);
  background: rgba(14, 18, 24, 0.95);
  border: 1px solid var(--line-strong);
  font-size: 0.82rem;
  transition: transform 0.1s, border-color 0.1s;
}
.ping-wheel .opt { cursor: pointer; }
.ping-wheel .opt.active {
  border-color: currentColor;
  transform: scale(1.14);
  box-shadow: 0 0 0 2px currentColor, 0 6px 20px rgba(0, 0, 0, 0.5);
}
.ping-wheel .opt:hover { border-color: currentColor; }

/* ---------------- Scoreboard ---------------- */

.scoreboard {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(760px, 92vw);
  max-height: 76vh;
  overflow-y: auto;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.scoreboard table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.scoreboard th {
  text-align: left;
  padding: 6px 8px;
  color: var(--text-dim);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--line);
}
.scoreboard td { padding: 6px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
.scoreboard tr.me td { background: rgba(242, 177, 52, 0.08); }
.scoreboard .num { font-family: var(--mono); text-align: right; }


/* ---------------- Reprise du controle ---------------- */

/* La vue a la troisieme personne exige le verrouillage du pointeur. Des qu'il
   est relache (menu, mort, Echap), ce bandeau dit comment le reprendre. */
.lock-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 18px 28px;
  text-align: center;
  border-radius: var(--radius);
  background: rgba(10, 13, 17, 0.9);
  border: 1px solid var(--line-strong);
  cursor: pointer;
  pointer-events: auto;
}
.lock-hint strong { display: block; font-size: 1.05rem; margin-bottom: 5px; }
.lock-hint span { font-size: 0.82rem; color: var(--text-dim); }
.lock-hint kbd {
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  font-family: var(--font);
  font-size: 0.78rem;
}
.lock-hint:hover { border-color: var(--gold); }

/* ---------------- Fiche de l'objet ramasse ---------------- */

/* Sans elle, personne ne peut retenir ce que fait chaque icone ni quelle
   touche l'active. Elle dit toujours : ce que c'est, ce que ca fait,
   et comment s'en servir. */
.pickup-toast {
  position: absolute;
  left: 50%;
  bottom: 150px;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: min(420px, 82vw);
  padding: 13px 16px;
  border-radius: var(--radius);
  background: rgba(12, 16, 21, 0.94);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.pickup-toast.pop { animation: pickupIn 0.24s cubic-bezier(0.2, 1.2, 0.4, 1); }
@keyframes pickupIn {
  from { opacity: 0; transform: translate(-50%, 14px) scale(0.94); }
}

.pickup-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-style: normal;
  font-size: 1.2rem;
  font-weight: 700;
}
.pickup-body { min-width: 0; }
.pickup-body small {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
}
.pickup-body strong { display: block; font-size: 1rem; margin: 1px 0 4px; }
.pickup-body p { margin: 0 0 5px; font-size: 0.82rem; color: var(--text-dim); line-height: 1.4; }
.pickup-body em { font-style: normal; font-size: 0.8rem; color: var(--gold); }
.pickup-body em kbd {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--gold);
  color: #221803;
  font-weight: 700;
  font-family: var(--font);
  font-size: 0.78rem;
}


/* Vignettes 3D des objets : le modele reel plutot qu'une lettre. */
.has-icon {
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  text-indent: -9999px;
  overflow: hidden;
}
/* <i> est en ligne : sans display block, largeur et hauteur seraient ignorees
   et la vignette ne s'afficherait pas du tout. */
.slot-icon.has-icon {
  display: block;
  width: 34px;
  height: 34px;
  /* La vignette est rendue sur fond transparent : ce halo la decolle du fond */
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.95));
}
.pickup-icon.has-icon { background-size: 78%; }


/* ---------------- Mode spectateur ---------------- */

/* Le spectateur regarde par les yeux d'un joueur : le serveur ne lui envoie
   rien de plus que ce que ce joueur voit. */
.spectate-bar {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 9px 16px;
  border-radius: var(--radius);
  background: rgba(12, 16, 21, 0.92);
  border: 1px solid var(--gold-dim);
  pointer-events: auto;
}
.spectate-who { display: flex; flex-direction: column; line-height: 1.2; }
.spectate-who small {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
}
.spectate-who strong { font-size: 1rem; color: var(--gold); }
.spectate-actions { display: flex; gap: 6px; }
.spectate-actions .btn { min-width: 32px; }
