/* Arena HUD: scoreboard, kill feed, respawn countdown. */

.pvp-board {
  position: fixed;
  right: 14px;
  top: 200px;
  z-index: 2147482500;
  min-width: 168px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(12, 10, 18, .9);
  border: 1px solid rgba(248, 113, 113, .38);
  color: #eef2ff;
  font: 700 12px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif;
  pointer-events: none;
}
.pvp-board[hidden] { display: none; }
.pvp-board-head {
  margin-bottom: 5px;
  color: #fca5a5;
  font-size: 10px;
  letter-spacing: .7px;
  text-transform: uppercase;
}
.pvp-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 0;
}
/* Your own line stands out, because the first thing you look for is yourself. */
.pvp-row.is-me .pvp-name { color: #fde047; }
.pvp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pvp-kd { color: #9fb6c9; font-weight: 600; white-space: nowrap; }
.pvp-kd b { color: #fff; font-weight: 900; }

/* Short-lived by design: a feed that persists becomes a wall nobody reads. */
.pvp-feed {
  position: fixed;
  right: 14px;
  top: 156px;
  z-index: 2147482500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  pointer-events: none;
}
.pvp-feed-line {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(12, 10, 18, .86);
  border: 1px solid rgba(248, 113, 113, .3);
  color: #fecaca;
  font: 700 11px/1.3 system-ui, sans-serif;
  animation: pvp-feed-in 160ms ease-out;
}
@keyframes pvp-feed-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

.pvp-respawn {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  z-index: 2147483000;
  padding: 14px 22px;
  border-radius: 14px;
  background: rgba(12, 10, 18, .94);
  border: 1px solid rgba(248, 113, 113, .45);
  color: #fecaca;
  font: 900 18px/1 system-ui, sans-serif;
  pointer-events: none;
}

@media (max-width: 720px) {
  .pvp-board { top: auto; bottom: 96px; min-width: 132px; font-size: 11px; }
  .pvp-feed { top: 60px; }
}

/* Whose shot is this?
   A coloured GLOW, not a recolour. hue-rotate on already-colourful art is
   unpredictable — a red candy star rotated 120deg is not "a green star", it is
   whatever that maths produces, and it differs across the seven Star Swap
   objects. A glow keeps the star looking like a star while wearing your colour. */
.projectile--arena {
  filter:
    drop-shadow(0 0 5px var(--arena-tint, #fff))
    drop-shadow(0 0 11px var(--arena-tint, #fff));
}
/* Your own shots read first: the question mid-fight is almost always "is that
   mine" before "whose is that". */
.projectile--arena.is-mine {
  filter:
    drop-shadow(0 0 3px #fff)
    drop-shadow(0 0 8px var(--arena-tint, #fff))
    drop-shadow(0 0 16px var(--arena-tint, #fff))
    brightness(1.12);
}

/* The same colour on the name plate, so the glow in the air maps to a person
   without anyone having to work it out.

   !important is not laziness here: exp-theme.css sets this shadow with
   !important of its own, so no amount of specificity wins. Overriding in kind is
   the only option short of restyling the theme. */
.player--arena-tinted .player-name {
  text-shadow:
    0 0 8px var(--arena-tint, transparent),
    0 0 3px var(--arena-tint, transparent),
    0 2px 3px rgba(0, 0, 0, .9) !important;
}

/* ── Overhead HP bars ────────────────────────────────────────────────────────
   Arena only — added and removed by renderOverheadHp, so nothing here applies
   in a normal map. Deliberately shaped like the monster bar the game already
   uses (.monster-hp): a second visual language for the same idea would only
   make people learn it twice. */

.player-hp {
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translate(-50%, -10px);
  width: 96px;
  height: 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .62);
  border: 1px solid rgba(255, 255, 255, .16);
  overflow: hidden;
  /* Above the character art but below anything the player has to click. */
  z-index: 3;
  pointer-events: none;
}
.player-hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  /* Eased, so chip damage reads as a movement rather than a flicker — but short
     enough that it has finished before the next hit lands. */
  transition: width .16s linear;
}
.player-hp.is-low .player-hp-fill {
  background: linear-gradient(90deg, #ef4444, #f97316);
}
.player-hp-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 800 9px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #fff;
  /* Outlined rather than shadowed: the bar behind it changes colour, so a soft
     shadow stops working exactly when the number matters most. */
  text-shadow: 0 0 2px #000, 0 0 3px #000;
  letter-spacing: .02em;
}

/* Match the fighter's arena colour on the frame, so a bar maps to a person the
   same way their projectiles and name plate already do. */
.player--arena-tinted .player-hp {
  border-color: var(--arena-tint, rgba(255, 255, 255, .16));
  box-shadow: 0 0 7px -1px var(--arena-tint, transparent);
}

@media (max-width: 980px) {
  .player-hp { width: 76px; height: 10px; }
  .player-hp-text { font-size: 8px; }
}

/* ── Arena intro ─────────────────────────────────────────────────────────────
   Shown once on entering an arena. Deliberately a card over a dimmed backdrop
   rather than a corner toast: the rules of the map have just changed out from
   under the player, and that is worth stopping for. */

.pvp-intro {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 8, 16, .62);
  backdrop-filter: blur(2px);
  z-index: 90;
  padding: 16px;
  animation: pvp-intro-in .18s ease-out;
}
@keyframes pvp-intro-in { from { opacity: 0 } to { opacity: 1 } }

.pvp-intro-card {
  width: min(430px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 18px 20px 20px;
  border-radius: 16px;
  border: 1px solid rgba(239, 68, 68, .5);
  background: linear-gradient(180deg, #131c2b, #0d141f);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .04) inset;
  color: #e6f2ff;
  font: 400 13px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  text-align: left;
}

.pvp-intro-head {
  font: 900 15px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: .1em;
  color: #fca5a5;
  margin-bottom: 10px;
}
/* The one line that has to land even if nothing else is read. */
.pvp-intro-lead {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
  color: #fff;
}
.pvp-intro-list {
  margin: 0 0 16px;
  padding-left: 17px;
  display: grid;
  gap: 7px;
  color: #b9cbdd;
}
.pvp-intro-list b { color: #e6f2ff; font-weight: 700; }

.pvp-intro-go {
  width: 100%;
  padding: 11px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(180deg, #ef4444, #b91c1c);
  color: #fff;
  font: 800 14px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  cursor: pointer;
}
.pvp-intro-go:hover { filter: brightness(1.1); }

@media (max-width: 640px) {
  .pvp-intro-card { font-size: 12.5px; padding: 15px 16px 17px; }
  .pvp-intro-lead { font-size: 14px; }
}

/* ── The returning player's version ──────────────────────────────────────────
   One line instead of the card, and then it folds down to a pill rather than
   disappearing. Disappearing would leave no way back to rules that decide
   whether the room makes sense — being told your level is ignored in here is
   the difference between a strange room and a fair fight.

   Bottom centre, above the status bar: out of the way of the utility stack in
   the top right and of the scoreboard on the left. */
.pvp-hint {
  position: absolute;
  left: 50%;
  bottom: 104px;
  transform: translateX(-50%);
  z-index: 88;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(560px, calc(100% - 32px));
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(239, 68, 68, .45);
  background: rgba(13, 20, 31, .92);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  color: #e6f2ff;
  font: 700 12.5px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif;
  text-align: left;
  cursor: pointer;
  backdrop-filter: blur(6px);
  animation: pvp-intro-in .18s ease-out;
  /* Width, padding and gap all animate, so the collapse reads as the line
     folding itself away rather than one element being swapped for another. */
  transition: max-width .35s ease, padding .35s ease, gap .35s ease;
}
.pvp-hint:hover { border-color: rgba(252, 165, 165, .75); }

.pvp-hint__mark { flex: none; color: #fca5a5; font-size: 14px; }
.pvp-hint__info { flex: none; color: #93c5fd; font-size: 13px; }
.pvp-hint__text {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: max-width .35s ease, opacity .25s ease;
  max-width: 460px;
}

/* Folded: just the crossed swords and the ⓘ, still a full-size tap target. */
.pvp-hint.is-mini { max-width: 78px; gap: 6px; padding: 9px 12px; }
.pvp-hint.is-mini .pvp-hint__text { max-width: 0; opacity: 0; }

@media (max-width: 640px) {
  .pvp-hint { bottom: 92px; font-size: 11.5px; }
  .pvp-hint__text { max-width: 210px; }
}

@media (prefers-reduced-motion: reduce) {
  .pvp-hint, .pvp-hint__text { transition: none; }
}
