/* In-match HUD (client/js/ui/hud.js). Containers ignore the mouse so the battlefield stays clickable;
   only controls take pointer events (GameView's Input._hitsUi relies on that). Sizes are in em of the
   .hud font size, which follows --ui-scale. Tokens come from main.css with local fallbacks. */

.hud {
  --hud-bg: rgba(18, 22, 14, 0.84);
  --hud-bg-2: rgba(34, 40, 27, 0.92);
  --hud-line: var(--c-line, #4d5636);
  --hud-line-2: var(--c-line-2, #6a7349);
  --hud-text: var(--c-text, #d9cfae);
  --hud-dim: var(--c-dim, #a39a7c);
  --hud-paper: var(--c-paper, #e6dcbf);
  --hud-brass: var(--c-brass, #d8b25a);
  --hud-rust: var(--c-rust, #b4482f);
  --hud-ok: var(--c-ok, #7fae4e);
  --hud-bad: #e0644a;
  --hud-team0: var(--c-team0, #5299ff);
  --hud-team1: var(--c-team1, #f24d40);
  --hud-f-ui: var(--f-ui, 'Barlow Condensed', system-ui, sans-serif);
  --hud-f-num: var(--f-num, 'Rajdhani', 'Barlow Condensed', system-ui, sans-serif);
  --hud-f-display: var(--f-display, 'Black Ops One', system-ui, sans-serif);
  --hud-f-stencil: var(--f-stencil, 'Saira Stencil One', 'Black Ops One', system-ui, sans-serif);
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  color: var(--hud-text);
  font-family: var(--hud-f-ui);
  font-weight: 500;
  /* 14 px at 1280×720, growing with the viewport up to 1.35× (1920×1080 and up) */
  font-size: calc(var(--ui-scale, 1) * clamp(14px, min(1.9444vh, 1.0938vw), 18.9px));
  line-height: 1.2;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}
.hud [hidden] { display: none !important; }
.hud *, .hud *::before, .hud *::after { box-sizing: border-box; }
.hud .ico { width: 1.15em; height: 1.15em; flex: none; }
.hud kbd {
  font-family: var(--hud-f-num);
  font-weight: 700;
  font-size: 0.68em;
  line-height: 1;
  padding: 0.12em 0.32em;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--hud-line-2);
  color: var(--hud-paper);
}
.hud-label {
  font-family: var(--hud-f-ui);
  font-weight: 600;
  font-size: 0.72em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hud-dim);
}

/* ---------------------------------------------------------------- controls */
.hud-btn {
  pointer-events: auto;
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3em;
  margin: 0;
  padding: 0.25em 0.45em;
  font: inherit;
  color: var(--hud-text);
  background: var(--hud-bg-2);
  border: 1px solid var(--hud-line);
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, transform 0.08s, filter 0.12s;
}
.hud-btn:hover { border-color: var(--hud-brass); background: rgba(52, 60, 40, 0.95); }
.hud-btn:active { transform: translateY(1px); }
.hud-btn:focus-visible { outline: 2px solid var(--hud-brass); outline-offset: 1px; }
.hud-bar { display: block; height: 3px; background: rgba(0, 0, 0, 0.55); border-radius: 2px; overflow: hidden; }
.hud-bar > i { display: block; height: 100%; width: 0; background: var(--hud-brass); transition: width 0.1s linear; }

.hud-zone { position: absolute; pointer-events: none; display: flex; flex-direction: column; gap: 0.35em; }
.hud-tl { top: 0.85em; left: 24px; width: 13.5em; }
.hud-tc { top: 0.55em; left: 50%; transform: translateX(-50%); align-items: center; width: 38em; }
.hud-tr { top: 0.85em; right: 24px; width: 19em; align-items: stretch; }
.hud-ml { top: 9.6em; left: 24px; width: 22em; }
.hud-bl { left: 24px; bottom: 10.4em; width: 27em; }
.hud-bottom {
  left: 24px;
  right: 24px;
  bottom: 0.6em;
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.9em;
}

/* ---------------------------------------------------------------- resources */
.hud-res {
  background: var(--hud-bg);
  border: 1px solid var(--hud-line);
  border-left: 3px solid var(--hud-brass);
  border-radius: 3px;
  padding: 0.35em 0.6em 0.4em;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.hud-money { display: flex; align-items: center; gap: 0.5em; color: var(--hud-brass); }
.hud-money .ico { width: 1.6em; height: 1.6em; }
.hud-money-box { display: flex; flex-direction: column; }
.hud-money-val { font-family: var(--hud-f-display); font-size: 1.55em; color: var(--hud-paper); letter-spacing: 0.02em; line-height: 1.05; }
.hud-res-row { display: flex; justify-content: space-between; align-items: center; margin-top: 0.2em; }
.hud-income { font-family: var(--hud-f-num); font-weight: 700; color: var(--hud-ok); }
.hud-pop { display: inline-flex; align-items: center; gap: 0.3em; font-family: var(--hud-f-num); font-weight: 700; pointer-events: auto; }
.hud-pop.is-full { color: var(--hud-bad); }
.hud-research { justify-content: flex-start; text-align: left; padding: 0.35em 0.55em 0.5em; width: 100%; }
.hud-research .ico { color: var(--hud-brass); }
.hud-research-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.hud-research-label { font-family: var(--hud-f-display); font-size: 0.95em; color: var(--hud-paper); }
.hud-research-sub { font-size: 0.78em; color: var(--hud-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-research-bar { position: absolute; left: 0.5em; right: 0.5em; bottom: 0.22em; }
.hud-research.is-ok { border-color: var(--hud-line-2); }
.hud-research.is-ok .hud-research-sub { color: var(--hud-text); }
.hud-research.is-nomoney .hud-research-sub { color: var(--hud-bad); }
.hud-research.is-running .hud-research-sub { color: var(--hud-brass); }
.hud-research.is-max { opacity: 0.75; }

/* ---------------------------------------------------------------- HQ / clock */
.hud-hqs { display: flex; align-items: stretch; gap: 0.5em; width: 100%; }
.hud-hq {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.35em 0.5em;
  background: var(--hud-bg);
  border: 1px solid var(--hud-line);
  border-radius: 3px;
  min-width: 0;
}
.hud-hq[data-team='1'] { flex-direction: row-reverse; text-align: right; }
.hud-hq.is-mine { border-color: var(--hud-line-2); box-shadow: inset 0 0 0 1px rgba(216, 178, 90, 0.35); }
.hud-hq-flag { width: 2.1em; height: 1.4em; flex: none; display: block; border: 1px solid rgba(0, 0, 0, 0.6); overflow: hidden; border-radius: 1px; }
.hud-hq-flag > * { width: 100%; height: 100%; display: block; }
.hud-hq-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.2em; }
.hud-hq-head { display: flex; justify-content: space-between; gap: 0.4em; font-size: 0.8em; }
.hud-hq[data-team='1'] .hud-hq-head { flex-direction: row-reverse; }
.hud-hq-name { font-family: var(--hud-f-stencil); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-hq[data-team='0'] .hud-hq-name { color: var(--hud-team0); }
.hud-hq[data-team='1'] .hud-hq-name { color: var(--hud-team1); }
.hud-hq-extra { font-family: var(--hud-f-num); font-weight: 700; font-size: 0.74em; color: var(--hud-paper); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-hq-extra:empty { display: none; }
.hud-hq-bar { height: 0.55em; background: rgba(0, 0, 0, 0.6); border-radius: 2px; overflow: hidden; border: 1px solid rgba(0, 0, 0, 0.5); }
.hud-hq[data-team='1'] .hud-hq-bar { transform: scaleX(-1); }
.hud-hq-fill { display: block; height: 100%; width: 100%; transition: width 0.25s; }
.hud-hq[data-team='0'] .hud-hq-fill { background: linear-gradient(180deg, color-mix(in srgb, var(--hud-team0) 80%, white), var(--hud-team0)); }
.hud-hq[data-team='1'] .hud-hq-fill { background: linear-gradient(180deg, color-mix(in srgb, var(--hud-team1) 80%, white), var(--hud-team1)); }
.hud-hq.is-low .hud-hq-bar { animation: hud-blink 0.9s ease-in-out infinite; }
.hud-hq-pct { font-family: var(--hud-f-num); font-weight: 700; font-size: 0.9em; min-width: 2.6em; text-align: center; color: var(--hud-paper); }
.hud-center {
  flex: none;
  min-width: 7.4em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.2em 0.6em;
  background: var(--hud-bg);
  border: 1px solid var(--hud-line);
  border-radius: 3px;
}
.hud-clock { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.hud-clock-label { font-size: 0.62em; letter-spacing: 0.1em; text-transform: uppercase; color: var(--hud-dim); }
.hud-clock-val { font-family: var(--hud-f-display); font-size: 1.35em; color: var(--hud-paper); margin-top: 0.1em; }
.hud-clock-val.is-urgent { color: var(--hud-bad); }
.hud-badge { margin-top: 0.2em; font-size: 0.62em; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.1em 0.35em; background: var(--hud-rust); color: #fff; border-radius: 2px; }
.hud-modeinfo { display: flex; flex-direction: column; align-items: center; font-family: var(--hud-f-num); font-weight: 700; font-size: 0.78em; }
.hud-modeinfo:empty { display: none; }
.hud-wave { color: var(--hud-brass); font-size: 1.1em; }
.hud-nextwave, .hud-kothinfo { color: var(--hud-text); white-space: nowrap; }
.hud-objective {
  display: flex;
  gap: 0.5em;
  align-items: baseline;
  max-width: 100%;
  padding: 0.15em 0.7em;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 2px;
  font-size: 0.86em;
}
.hud-objective-text { color: var(--hud-paper); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- notices / killfeed */
.hud-notices { display: flex; flex-direction: column; align-items: center; gap: 0.25em; margin-top: 0.3em; }
.hud-notice {
  font-family: var(--hud-f-display);
  font-size: 1.02em;
  letter-spacing: 0.03em;
  padding: 0.2em 0.9em;
  background: rgba(10, 12, 8, 0.72);
  border-left: 3px solid var(--hud-brass);
  color: var(--hud-paper);
  text-shadow: 0 1px 2px #000;
  animation: hud-in 0.25s var(--ease, ease-out);
  transition: opacity 0.4s, transform 0.4s;
}
.hud-notice.tone-good { border-left-color: var(--hud-ok); }
.hud-notice.tone-bad { border-left-color: var(--hud-bad); color: #ffd9cc; }
.hud-notice.leaving, .hud-kill.leaving { opacity: 0; transform: translateY(-4px); }
.hud-killfeed { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2em; }
.hud-kill {
  display: flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.12em 0.45em;
  background: rgba(10, 12, 8, 0.66);
  border-radius: 2px;
  font-size: 0.82em;
  transition: opacity 0.4s, transform 0.4s;
  animation: hud-in 0.2s ease-out;
}
.hud-kill.is-mine { border-right: 2px solid var(--hud-brass); }
.hud-kill.victim-team-0 .hud-kill-text { color: color-mix(in srgb, var(--hud-team0) 55%, white); }
.hud-kill.victim-team-1 .hud-kill-text { color: color-mix(in srgb, var(--hud-team1) 55%, white); }
.hud-kill-art { width: 2.9em; height: 1.45em; display: block; color: var(--hud-dim); }

/* ---------------------------------------------------------------- minimap / tools */
.hud-minimap {
  position: relative;
  height: 5.2em;
  background: var(--hud-bg);
  border: 1px solid var(--hud-line);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.hud-minimap canvas { pointer-events: auto; display: block; width: 100%; height: 100%; cursor: crosshair; }
.hud-tools { display: flex; justify-content: flex-end; gap: 0.3em; }
.hud-tool { padding: 0.22em 0.4em; }
.hud-tool .ico { width: 1em; height: 1em; }

/* ---------------------------------------------------------------- chat */
.hud-chat { display: flex; flex-direction: column; gap: 0.25em; }
.hud-chat-log { display: flex; flex-direction: column; gap: 0.1em; max-height: 9em; overflow: hidden; font-size: 0.9em; }
.hud-chat-line { display: none; padding: 0.08em 0.4em; background: rgba(10, 12, 8, 0.62); border-radius: 2px; text-shadow: 0 1px 1px #000; word-break: break-word; }
.hud-chat-line.is-recent, .hud-chat.is-open .hud-chat-line { display: block; }
.hud-chat.is-open .hud-chat-log { overflow-y: auto; pointer-events: auto; background: rgba(10, 12, 8, 0.4); }
.hud-chat-line.is-system { color: var(--hud-brass); font-style: italic; }
.hud-chat-prefix { color: var(--hud-dim); margin-right: 0.3em; font-size: 0.85em; }
.hud-chat-line.is-team .hud-chat-prefix { color: var(--hud-ok); }
.hud-chat-name { font-weight: 700; }
.hud-chat-name.team-0 { color: var(--hud-team0); }
.hud-chat-name.team-1 { color: var(--hud-team1); }
.hud-chat-text { color: var(--hud-paper); }
.hud-chat-form { pointer-events: auto; display: flex; align-items: center; gap: 0.4em; padding: 0.25em 0.4em; background: var(--hud-bg-2); border: 1px solid var(--hud-brass); border-radius: 3px; }
.hud-chat-chan { font-family: var(--hud-f-num); font-weight: 700; color: var(--hud-brass); font-size: 0.85em; text-transform: uppercase; }
.hud-chat-input { pointer-events: auto; flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--hud-paper); font: inherit; }
.hud-chat-input::placeholder { color: var(--hud-dim); }

/* ---------------------------------------------------------------- buy bar */
.hud-buy { display: flex; flex-direction: column; gap: 0.3em; min-width: 0; }
.hud-queue { display: flex; align-items: center; gap: 0.3em; min-height: 2.3em; }
.hud-queue-label { margin-right: 0.2em; }
.hud-buy:not(.has-queue) .hud-queue-label { opacity: 0.5; }
.hud-queue-item { width: 3.9em; height: 2.3em; padding: 0.15em; flex-direction: column; gap: 0.1em; }
.hud-q-art { display: flex; align-items: center; justify-content: center; width: 100%; height: 1.45em; color: var(--hud-dim); }
.hud-q-art > * { max-width: 100%; max-height: 100%; }
.hud-q-bar { width: 100%; }
.hud-q-x { position: absolute; top: -0.35em; right: -0.35em; width: 1em; height: 1em; display: none; align-items: center; justify-content: center; background: var(--hud-rust); border-radius: 50%; color: #fff; }
.hud-q-x .ico { width: 0.7em; height: 0.7em; }
.hud-queue-item:hover .hud-q-x { display: flex; }
.hud-queue-item:first-of-type .hud-q-bar > i { background: var(--hud-ok); }
.hud-cards { display: flex; gap: 0.55em; align-items: flex-end; }
.hud-cardgroup { display: flex; flex-direction: column; gap: 0.2em; }
.hud-cardrow { display: flex; gap: 0.22em; }
.hud-card {
  width: 3.75em;
  height: 5.1em;
  padding: 0.2em 0.15em 0.15em;
  flex-direction: column;
  justify-content: space-between;
  gap: 0;
  background: linear-gradient(180deg, rgba(46, 54, 36, 0.95), rgba(24, 28, 19, 0.95));
  overflow: hidden;
}
.hud-card-key { position: absolute; top: 0.2em; left: 0.2em; z-index: 1; }
.hud-card-art { display: flex; align-items: center; justify-content: center; width: 100%; height: 2.5em; margin-top: 0.65em; color: var(--hud-dim); }
.hud-card-art > * { max-width: 100%; max-height: 100%; display: block; }
.hud-card-art .unit-sil { width: 100%; height: 100%; }
.hud-card-name { font-size: 0.66em; line-height: 1.05; width: 100%; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--hud-text); }
.hud-card-cost { font-family: var(--hud-f-num); font-weight: 700; font-size: 0.8em; color: var(--hud-brass); }
/* state badge over the card art: icon + short label (full reason in the tooltip) */
.hud-card-lock {
  position: absolute;
  top: 0.95em;
  left: 0;
  right: 0;
  height: 2.45em;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12em;
  z-index: 1;
  pointer-events: none;
  color: var(--hud-paper);
}
.hud-card-lock-ico { display: flex; align-items: center; justify-content: center; width: 1.35em; height: 1.35em; border-radius: 50%; background: rgba(8, 10, 6, 0.78); box-shadow: 0 0 0 1px rgba(216, 178, 90, 0.45); }
.hud-card-lock-ico:empty { display: none; }
.hud-card-lock-ico .ico { width: 0.8em; height: 0.8em; }
.hud-card-lock-text {
  max-width: 100%;
  padding: 0.05em 0.45em;
  font-family: var(--hud-f-num);
  font-size: 0.66em;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
  background: rgba(8, 10, 6, 0.78);
  border-radius: 2px;
  text-shadow: 0 1px 1px #000;
}
.hud-card.is-locked .hud-card-lock-ico { color: var(--hud-brass); }
.hud-card.is-locked .hud-card-lock, .hud-card.is-disabled .hud-card-lock, .hud-card.is-queuefull .hud-card-lock, .hud-card.is-popcap .hud-card-lock { display: flex; }
.hud-card.is-locked .hud-card-art, .hud-card.is-disabled .hud-card-art { filter: grayscale(1) brightness(0.55); }
.hud-card.is-disabled { opacity: 0.45; }
.hud-card.is-nomoney .hud-card-cost { color: var(--hud-bad); }
.hud-card.is-nomoney .hud-card-art { filter: saturate(0.45) brightness(0.8); }
.hud-card.is-queuefull, .hud-card.is-popcap { filter: brightness(0.8); }

/* ---------------------------------------------------------------- command panel */
.hud-cmd { display: flex; flex-direction: column; gap: 0.3em; flex: none; }
.hud-cmdgroup { display: flex; flex-direction: column; gap: 0.15em; }
.hud-btnrow { display: flex; gap: 0.22em; }
.hud-support { width: 2.85em; height: 2.85em; padding: 0; overflow: hidden; }
.hud-sup-art { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--hud-paper); }
.hud-sup-art > canvas { width: 100%; height: 100%; display: block; }
.hud-sup-art .ico { width: 1.5em; height: 1.5em; }
.hud-support kbd { position: absolute; top: 0.12em; left: 0.12em; z-index: 2; }
.hud-sup-cost { position: absolute; bottom: 0.05em; right: 0.15em; z-index: 2; padding: 0 0.2em; border-radius: 2px; background: rgba(10, 12, 8, 0.62); line-height: 1.2; font-family: var(--hud-f-num); font-weight: 700; font-size: 0.66em; color: var(--hud-brass); text-shadow: 0 1px 1px #000; }
/* cooldown: radial sweep over the icon + small seconds badge in the top-right corner */
.hud-sup-cd {
  position: absolute;
  top: 0.12em;
  right: 0.12em;
  z-index: 2;
  min-width: 1.6em;
  padding: 0 0.25em;
  font-family: var(--hud-f-num);
  font-size: 0.62em;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  color: #fff;
  background: rgba(8, 10, 6, 0.82);
  border: 1px solid rgba(216, 178, 90, 0.5);
  border-radius: 2px;
  font-variant-numeric: tabular-nums;
}
.hud-sup-cd:empty { display: none; }
.hud-support::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: conic-gradient(rgba(0, 0, 0, 0.62) calc(var(--cd, 0) * 360deg), transparent 0);
}
.hud-support.is-cooldown .hud-sup-art { filter: saturate(0.4) brightness(0.8); }
.hud-support.is-cooldown .hud-sup-cost { opacity: 0.6; }
.hud-support.is-locked .hud-sup-art, .hud-support.is-disabled .hud-sup-art { filter: grayscale(1) brightness(0.5); }
.hud-sup-lock { position: absolute; inset: 0; z-index: 2; display: none; align-items: center; justify-content: center; color: var(--hud-paper); }
.hud-sup-lock .ico { width: 1.1em; height: 1.1em; filter: drop-shadow(0 1px 1px #000); }
.hud-support.is-locked .hud-sup-lock { display: flex; }
.hud-support.is-disabled { opacity: 0.4; }
.hud-support.is-nomoney .hud-sup-cost { color: var(--hud-bad); }
.hud-support.is-ok { border-color: var(--hud-line-2); }
.hud-support.is-active { border-color: var(--hud-brass); box-shadow: 0 0 0 2px rgba(216, 178, 90, 0.55), 0 0 12px rgba(216, 178, 90, 0.45); }
.hud-upgrade { flex: 1 1 0; min-width: 5.15em; height: 2.6em; padding: 0.15em 0.3em; justify-content: flex-start; gap: 0.25em; }
.hud-upgrade > .ico { color: var(--hud-brass); width: 1.1em; height: 1.1em; }
.hud-upg-text { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1.05; }
.hud-upg-name { font-size: 0.7em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hud-upg-row { display: flex; align-items: baseline; gap: 0.35em; font-family: var(--hud-f-num); font-weight: 700; font-size: 0.72em; white-space: nowrap; }
.hud-upg-level { color: var(--hud-paper); }
.hud-upg-cost { color: var(--hud-brass); }
.hud-upgrade.is-locked { opacity: 0.55; }
.hud-upgrade.is-nomoney .hud-upg-cost { color: var(--hud-bad); }
.hud-upgrade.is-max { border-color: var(--hud-ok); }
.hud-stancerow .hud-btn { height: 2.2em; font-size: 0.82em; padding: 0.1em 0.4em; }
.hud-stance.is-active { border-color: var(--hud-brass); background: rgba(216, 178, 90, 0.22); color: var(--hud-paper); }
.hud-front { margin-left: auto; }

/* ---------------------------------------------------------------- banners */
.hud-countdown {
  position: absolute;
  top: 34%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-shadow: 0 2px 10px #000;
}
.hud-countdown-label { font-family: var(--hud-f-stencil); font-size: 1.4em; letter-spacing: 0.12em; text-transform: uppercase; color: var(--hud-paper); }
.hud-countdown-num { font-family: var(--hud-f-display); font-size: 5em; color: var(--hud-brass); line-height: 1; }
.hud-targeting {
  position: absolute;
  top: 27%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.45em 1em;
  background: rgba(10, 12, 8, 0.82);
  border: 1px solid var(--hud-brass);
  border-radius: 3px;
  box-shadow: 0 0 18px rgba(216, 178, 90, 0.25);
}
.hud-targeting > .ico { width: 1.7em; height: 1.7em; color: var(--hud-brass); }
.hud-targeting > div { display: flex; flex-direction: column; }
.hud-targeting-text { font-family: var(--hud-f-display); color: var(--hud-paper); }
.hud-targeting-hint { font-size: 0.8em; color: var(--hud-dim); }
.hud-spectating { position: absolute; bottom: 1.2em; left: 50%; transform: translateX(-50%); display: flex; gap: 0.5em; align-items: center; padding: 0.4em 1em; background: var(--hud-bg); border: 1px solid var(--hud-line-2); font-family: var(--hud-f-stencil); letter-spacing: 0.1em; text-transform: uppercase; }
.hud-fps { position: absolute; right: 24px; bottom: 11.6em; font-family: var(--hud-f-num); font-weight: 700; font-size: 0.8em; color: var(--hud-ok); text-shadow: 0 1px 1px #000; }
.hud.is-spectator .hud-tl, .hud.is-spectator .hud-bottom { display: none; }
.hud.has-result .hud-bottom, .hud.has-result .hud-bl, .hud.has-result .hud-ml { opacity: 0.25; }

/* ---------------------------------------------------------------- tutorial */
.hud-tutorial {
  pointer-events: auto;
  max-height: calc(100vh - 22em);
  overflow: auto;
  padding: 0.6em 0.7em;
  background: rgba(230, 220, 191, 0.94);
  color: var(--c-ink, #1d1b14);
  border: 1px solid #8d7e55;
  border-radius: 3px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.hud-tut-head { display: flex; align-items: center; gap: 0.6em; }
.hud-tut-portrait { width: 3.4em; height: 3.4em; object-fit: cover; border-radius: 2px; border: 1px solid #6b5f3f; background: #3a3d35; }
.hud-tut-who { display: flex; flex-direction: column; flex: 1; line-height: 1.1; }
.hud-tut-who strong { font-family: var(--hud-f-stencil); font-weight: 400; letter-spacing: 0.04em; text-transform: uppercase; }
.hud-tut-who span { font-size: 0.8em; color: #5b5131; }
.hud-tut-prog { font-family: var(--hud-f-num); font-weight: 700; color: #5b5131; }
.hud-tut-text { margin: 0.5em 0; font-size: 0.98em; line-height: 1.3; }
.hud-tut-objhead { font-size: 0.7em; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #5b5131; }
.hud-tut-objs { list-style: none; margin: 0.2em 0 0.4em; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.05em 0.6em; font-size: 0.74em; }
.hud-tut-obj { display: flex; align-items: center; gap: 0.25em; color: #6b6248; }
.hud-tut-check { width: 0.95em; height: 0.95em; display: inline-flex; border: 1px solid #8d7e55; border-radius: 2px; color: transparent; }
.hud-tut-check .ico { width: 100%; height: 100%; }
.hud-tut-obj.is-done { color: #3e5a22; text-decoration: line-through; }
.hud-tut-obj.is-done .hud-tut-check { color: #3e5a22; background: rgba(127, 174, 78, 0.3); }
.hud-tut-obj.is-current { color: var(--c-ink, #1d1b14); font-weight: 700; }
.hud-tut-actions, .hud-tutorial .hud-confirm-actions { display: flex; justify-content: space-between; gap: 0.5em; }
.hud-tutorial .btn { font-size: 0.85em; }
.hud-tutorial .btn-ghost { color: #3a3424; border-color: #8d7e55; background: rgba(255, 255, 255, 0.25); }
.hud-tutorial .btn-ghost:hover { color: #1d1b14; background: rgba(255, 255, 255, 0.45); }
.hud-tutorial .hud-confirm-text { color: var(--c-ink, #1d1b14); }
.hud .tut-focus { outline: 2px solid var(--hud-brass); outline-offset: 2px; animation: hud-pulse 1.2s ease-in-out infinite; }

/* ---------------------------------------------------------------- overlays */
.hud-pause-wrap, .hud-result-wrap {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 8, 5, 0.55);
  backdrop-filter: blur(1px);
}
.hud-pause, .hud-result {
  width: min(26em, 92vw);
  max-height: 92vh;
  overflow: auto;
  padding: 1em 1.2em 1.1em;
  background: var(--c-panel, rgba(28, 32, 22, 0.97));
  border: 1px solid var(--hud-line-2);
  border-top: 3px solid var(--hud-brass);
  border-radius: 3px;
  box-shadow: var(--shadow, 0 10px 30px rgba(0, 0, 0, 0.55));
}
.hud-result { width: min(46em, 94vw); }
.hud-pause-title, .hud-result-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--hud-f-stencil);
  font-weight: 400;
  font-size: 1.6em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hud-brass);
}
.hud-pause-hint, .hud-result-hint, .hud-result-meta { margin: 0.3em 0 0.8em; color: var(--hud-dim); }
.hud-pause-list { display: flex; flex-direction: column; gap: 0.4em; }
.hud-pause-list .btn, .hud-confirm .btn { justify-content: flex-start; }
.hud-pause-list .btn { width: 100%; }
.hud-pause-settingsbox { display: flex; flex-direction: column; gap: 0.35em; margin-top: 0.7em; padding: 0.6em; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--hud-line); border-radius: 3px; }
.hud-set-row { display: grid; grid-template-columns: 9em 1fr; align-items: center; gap: 0.6em; font-size: 0.9em; }
.hud-set-label { color: var(--hud-text); }
.hud-confirm { display: flex; flex-direction: column; gap: 0.6em; padding: 0.5em 0; }
.hud-confirm-text { margin: 0; color: var(--hud-paper); }
.hud-confirm-actions { display: flex; gap: 0.5em; justify-content: flex-end; }
.hud-result-title { font-size: 2.4em; justify-content: center; }
.hud-result-title.is-win { color: var(--hud-ok); }
.hud-result-title.is-loss { color: var(--hud-bad); }
.hud-result-title.is-aborted { color: var(--hud-dim); }
.hud-result-meta { text-align: center; }
.hud-result-sub { margin: 0 0 0.3em; font-size: 0.78em; letter-spacing: 0.08em; text-transform: uppercase; color: var(--hud-dim); font-weight: 700; }
.hud-res-table, .hud-sb-table { width: 100%; border-collapse: collapse; font-size: 0.88em; }
.hud-res-table th, .hud-sb-table th { text-align: left; font-weight: 600; font-size: 0.82em; color: var(--hud-dim); text-transform: uppercase; letter-spacing: 0.05em; padding: 0.2em 0.35em; border-bottom: 1px solid var(--hud-line); }
.hud-res-table td, .hud-sb-table td { padding: 0.22em 0.35em; border-bottom: 1px solid rgba(77, 86, 54, 0.45); }
.hud-res-table .num, .hud-sb-table .num { text-align: right; font-family: var(--hud-f-num); font-weight: 700; }
.hud-res-table tr.is-me td, .hud-sb-table tr.is-me td { background: rgba(216, 178, 90, 0.12); }
.hud-res-table tr.team-0 td:first-child { border-left: 3px solid var(--hud-team0); }
.hud-res-table tr.team-1 td:first-child { border-left: 3px solid var(--hud-team1); }
.hud-res-player, .hud-sb-player { display: flex; align-items: center; gap: 0.4em; }
.hud-flag { width: 1.5em; height: 1em; flex: none; display: block; }
.hud-mvp { font-size: 0.7em; padding: 0.05em 0.3em; background: var(--hud-brass); color: #1d1b14; border-radius: 2px; font-weight: 700; }
.hud-result-extras { display: flex; flex-wrap: wrap; gap: 0.5em 1.2em; margin: 0.8em 0 0.2em; }
.hud-result-extras.is-empty { display: none; }
.hud-result-extras > div { display: flex; align-items: center; gap: 0.35em; }
.hud-result-extras .ico { color: var(--hud-brass); }
.hud-res-rating .up { color: var(--hud-ok); }
.hud-res-rating .down { color: var(--hud-bad); }
.hud-result-actions { display: flex; justify-content: center; gap: 0.6em; margin-top: 1em; }
.hud-scoreboard {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  transform: translate(-50%, -50%);
  width: min(48em, 94vw);
  padding: 0.8em 1em;
  background: var(--c-panel, rgba(28, 32, 22, 0.95));
  border: 1px solid var(--hud-line-2);
  border-radius: 3px;
  box-shadow: var(--shadow, 0 10px 30px rgba(0, 0, 0, 0.55));
}
.hud-sb-title { margin: 0 0 0.5em; font-family: var(--hud-f-stencil); font-weight: 400; letter-spacing: 0.06em; text-transform: uppercase; color: var(--hud-brass); font-size: 1.2em; }
.hud-sb-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 1em; }
.hud-sb-teamhead { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 0.2em; margin-bottom: 0.2em; }
.hud-sb-team.team-0 .hud-sb-teamhead { border-bottom: 2px solid var(--hud-team0); }
.hud-sb-team.team-1 .hud-sb-teamhead { border-bottom: 2px solid var(--hud-team1); }
.hud-sb-teamname { font-family: var(--hud-f-stencil); letter-spacing: 0.05em; text-transform: uppercase; }
.hud-sb-teamscore { font-family: var(--hud-f-num); font-weight: 700; font-size: 0.85em; color: var(--hud-dim); }
.hud-sb-tags { font-size: 0.75em; color: var(--hud-dim); }
.hud-sb-player .avatar { width: 1.4em; height: 1.4em; flex: none; }

/* ---------------------------------------------------------------- tooltip content */
.hud-tip { max-width: 18em; font-size: 13px; }
.hud-tip-title { font-family: var(--hud-f-display); color: var(--hud-paper, #e6dcbf); font-size: 1.05em; }
.hud-tip-sub { color: var(--hud-brass, #d8b25a); font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.05em; }
.hud-tip-desc { margin: 0.3em 0; color: var(--c-text, #d9cfae); }
.hud-tip-stats { display: grid; grid-template-columns: auto 1fr; gap: 0.05em 0.6em; margin: 0.3em 0; font-size: 0.9em; }
.hud-tip-stats dt { color: var(--c-dim, #a39a7c); }
.hud-tip-stats dd { margin: 0; text-align: right; font-family: var(--f-num, 'Rajdhani', sans-serif); font-weight: 700; }
.hud-tip-strong { color: #a8d17a; font-size: 0.9em; }
.hud-tip-weak { color: #f0a08a; font-size: 0.9em; }
.hud-tip-warn { color: #f0a08a; font-weight: 700; margin-top: 0.2em; }

/* ---------------------------------------------------------------- hardcore */
.hud.hardcore .hud-tip-strong, .hud.hardcore .hud-tip-weak { display: none; }

/* ---------------------------------------------------------------- animation */
@keyframes hud-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes hud-blink { 50% { opacity: 0.45; } }
@keyframes hud-pulse { 50% { outline-color: rgba(216, 178, 90, 0.25); box-shadow: 0 0 16px rgba(216, 178, 90, 0.6); } }
@media (prefers-reduced-motion: reduce) {
  .hud *, .hud *::before, .hud *::after { animation: none !important; transition: none !important; }
}

/* Small screens: shrink the whole HUD rather than wrapping bars. */
@media (max-width: 1180px) { .hud { font-size: calc(12.5px * var(--ui-scale, 1)); } }
@media (max-width: 1000px) { .hud { font-size: calc(11px * var(--ui-scale, 1)); } }
@media (max-height: 640px) { .hud { font-size: calc(11.5px * var(--ui-scale, 1)); } }
