/* ============================================================
   Naming In Progress — layout + typography.

   Visual chrome (frames, keycaps, dividers, icons) lives in chrome.css and
   comes from hand-authored pixel art. This file handles position, scale,
   colour and type only. Nothing here draws a bevel or a rivet.
   ============================================================ */

:root {
  --ink: #0b0806;
  --stone-0: #3e3a34;
  --stone-1: #514b43;
  --stone-2: #655d51;
  --stone-edge: #8a8071;
  --stone-top: #9c917f;
  --iron-0: #14100b;
  --iron-1: #241d15;
  --iron-2: #3d3323;
  --bone: #e9dfc8;
  --bone-dim: #a89a7e;
  /* accent: struck gold — the dungeon's reward metal */
  --gold: #c9a24e;
  --gold-hot: #e8c169;
  --blood: #7e2a22;
  --blood-bright: #c8453a;
  --arcane: #7fd7ff;
  --hp-green: #7d9c58;
  --shadow: 0 16px 34px rgba(0, 0, 0, 0.66), 0 3px 8px rgba(0, 0, 0, 0.5);
  --font-display: "Cinzel", "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

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

html,
body {
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--font-mono);
  -webkit-font-smoothing: antialiased;
}

#app {
  position: fixed;
  inset: 0;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.hidden {
  display: none !important;
}

.engraved {
  color: var(--bone);
  text-shadow:
    0 -1px 0 rgba(0, 0, 0, 0.85),
    0 1px 1px rgba(0, 0, 0, 0.6),
    0 1px 0 rgba(233, 223, 200, 0.09);
}

/* ---------- atmosphere overlays ---------- */

#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 50% 45%,
    transparent 42%,
    rgba(0, 0, 0, 0.45) 78%,
    rgba(0, 0, 0, 0.82) 100%
  );
  mix-blend-mode: multiply;
}

#damage-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    ellipse at 50% 50%,
    transparent 30%,
    rgba(126, 42, 34, 0.6) 100%
  );
  transition: opacity 90ms linear;
}

#damage-flash.hit {
  opacity: 1;
  transition: none;
}

/* ---------- HUD ---------- */

#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-size: 13px;
}

#hud-top {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  align-items: stretch;
}

#wave-block,
#enemy-block,
#coin-block,
#score-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  padding: 4px 12px 6px;
}

#coin-block,
#score-block {
  flex-direction: row;
  gap: 8px;
  min-width: 0;
  padding-top: 8px;
}

.hud-label {
  font-family: "PixelChrome", var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #c9bda1;
  margin-bottom: 4px;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 240, 210, 0.14);
}

#wave-num {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--gold-hot);
  line-height: 1;
  text-shadow:
    0 -1px 0 rgba(0, 0, 0, 0.9),
    0 1px 0 rgba(0, 0, 0, 0.5),
    0 0 14px rgba(232, 182, 76, 0.22);
}

#enemy-num {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  color: #f2ead6;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 240, 210, 0.16);
}

#enemy-block.danger #enemy-num {
  color: var(--blood-bright);
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.9), 0 0 14px rgba(200, 69, 58, 0.35);
}

#coin-num,
#score-num {
  font-size: 15px;
  font-weight: 600;
  color: var(--gold-hot);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 240, 210, 0.12);
}

#score-num {
  color: #f2ead6;
}

/* wave banner */

#wave-banner {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  animation: banner-in 2.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#wave-banner-kicker {
  display: block;
  font-family: "PixelChrome", var(--font-mono);
  font-size: 20px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--bone-dim);
  text-indent: 0.28em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
}

#wave-banner-num {
  display: block;
  font-family: var(--font-display);
  font-size: 84px;
  font-weight: 900;
  line-height: 0.95;
  color: var(--gold-hot);
  text-shadow:
    0 0 40px rgba(255, 209, 102, 0.35),
    0 4px 0 rgba(0, 0, 0, 0.55),
    0 8px 22px rgba(0, 0, 0, 0.8);
}

#wave-banner-sub {
  display: block;
  margin-top: 8px;
  font-family: "PixelChrome", var(--font-mono);
  font-size: 20px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blood-bright);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}

@keyframes banner-in {
  0% { opacity: 0; transform: translateX(-50%) translateY(18px) scale(0.96); }
  12% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  78% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* bottom HUD */

#hud-bottom {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 18px;
}

#hp-wrap {
  display: flex;
  align-items: center;
  gap: 0;
}

#hp-bar {
  position: relative;
  width: 380px;
  height: 50px;
  display: flex;
  align-items: center;
  /* 14px gap + 32px heart + 10px gap = 56px, matching the icon above. */
  padding: 0 14px 0 56px;
}

#hp-heart {
  position: absolute;
  left: 14px;
  top: 50%;
  /* 32px for a 16px source = exactly 2x. The bar's 46px left padding is
     14 + 32, so the icon and the trough line up by construction. */
  width: 32px;
  height: 32px;
  transform: translateY(-50%);
  z-index: 2;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.6));
}

#hp-trough {
  position: relative;
  flex: 1;
  /* The trough frame is a 20x20 source with a 7px slice, so the content box
     is only (height - 14) tall. At 16px the channel collapsed to 2px and the
     fill was invisible. 22px leaves an 8px channel. */
  height: 22px;
  overflow: hidden;
}

#hp-chip {
  position: absolute;
  inset: 0;
  background: rgba(233, 223, 200, 0.32);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

#hp-fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #93b36a, var(--hp-green) 52%, #4c6134);
  transform-origin: left;
  transition: transform 90ms linear;
  box-shadow: inset 0 -2px 2px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.22);
}

#hp-bar.low #hp-fill {
  background: linear-gradient(180deg, #d4574a, var(--blood) 58%, #4a1713);
  animation: hp-pulse 0.9s ease-in-out infinite;
}

@keyframes hp-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.68; }
}

#hp-text {
  font-size: 13px;
  font-weight: 600;
  color: #f2ead6;
  font-variant-numeric: tabular-nums;
  margin-left: 12px;
  min-width: 78px;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 240, 210, 0.14);
}

#hp-max {
  color: #b3a686;
}

/* abilities: iron keycap in a stone plaque */

#ability-row {
  display: flex;
  gap: 6px;
}

.ability {
  position: relative;
  min-width: 104px;
  padding: 6px 12px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

.ability-key {
  font-size: 10px;
  letter-spacing: 0.12em;
  padding: 0;
  color: var(--bone);
}

/* When the ability is off cooldown the keycap turns gold. The keycap art
   bakes a bright top face, so the label must be near-black to stay legible —
   a light label on the gold face washed out completely. */
.ability.ready .ability-key {
  color: #1c1409;
  text-shadow: 0 1px 0 rgba(255, 240, 200, 0.4);
}

.ability-name {
  font-family: "PixelChrome", var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #bfb394;
  margin-top: 6px;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.85), 0 1px 0 rgba(255, 240, 210, 0.12);
}

.ability-cd {
  position: absolute;
  inset: 0;
  background: rgba(4, 3, 2, 0.78);
  transform-origin: bottom;
  transform: scaleY(0);
  pointer-events: none;
  z-index: 2;
}

/* combo tag */

#combo-tag {
  position: absolute;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--gold-hot);
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.7),
    0 4px 16px rgba(0, 0, 0, 0.9);
  animation: combo-pop 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes combo-pop {
  0% { opacity: 0; transform: translateX(-50%) scale(0.8); }
  20% { opacity: 1; transform: translateX(-50%) scale(1.06); }
  70% { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) scale(1) translateY(-8px); }
}

/* upgrade strip (owned upgrades) */

#upgrade-strip {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.upgrade-pip {
  font-family: "PixelChrome", var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bone-dim);
  padding: 3px 9px 4px 8px;
  background: linear-gradient(180deg, var(--iron-1), var(--iron-0));
  border: 1px solid #060403;
  border-left: 3px solid var(--gold);
  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.55),
    0 4px 10px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(226, 200, 152, 0.12);
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.8);
}

.upgrade-pip.rare { border-left-color: var(--arcane); }
.upgrade-pip.epic { border-left-color: var(--blood-bright); }

/* ---------- overlays ---------- */

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(14, 10, 7, 0.9), rgba(4, 3, 2, 0.97));
  z-index: 10;
}

.overlay-inner {
  text-align: center;
  max-width: 900px;
  padding: 40px;
}

.overlay-inner.narrow {
  max-width: 760px;
}

.kicker {
  font-family: "PixelChrome", var(--font-mono);
  font-size: 20px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(42px, 7vw, 76px);
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: 0.01em;
  color: var(--bone);
  text-shadow:
    0 4px 0 rgba(0, 0, 0, 0.55),
    0 10px 34px rgba(0, 0, 0, 0.9);
}

h1 em {
  font-style: normal;
  color: var(--gold-hot);
  text-shadow:
    0 4px 0 rgba(0, 0, 0, 0.5),
    0 0 46px rgba(255, 209, 102, 0.28),
    0 10px 34px rgba(0, 0, 0, 0.9);
}

h2 {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  color: var(--bone);
  margin-bottom: 18px;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.5), 0 8px 26px rgba(0, 0, 0, 0.85);
}

.title-rule {
  width: 340px;
  margin-top: 6px;
  /* the knight's cape red, sampled off the model */
  --rule-red: #e8462c;
}

.title-rule .px-divider {
  border-image-source: none;
  border: none;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--rule-red) 10%, #ff6a44 50%, var(--rule-red) 90%, transparent);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
  image-rendering: pixelated;
}

.title-rule .px-divider-boss {
  width: 12px;
  height: 12px;
  display: none;
}

.death-rule {
  width: 300px;
  margin: 0 auto 20px;
}

/* ---------- title stage ---------- */

#title-screen {
  align-items: stretch;
  justify-content: flex-start;
  flex-direction: column;
  padding: 0;
  background:
    radial-gradient(ellipse 68% 52% at 66% 58%, rgba(46, 32, 20, 0.5) 0%, rgba(16, 11, 7, 0.72) 55%, rgba(6, 5, 3, 0.9) 100%),
    linear-gradient(180deg, rgba(8, 6, 4, 0.9) 0%, rgba(8, 6, 4, 0.2) 30%, rgba(6, 5, 3, 0.34) 100%);
}

.title-bar {
  position: relative;
  z-index: 3;
  padding: 34px 46px 0;
  text-align: left;
}

.title-left h1 {
  font-size: clamp(34px, 4.4vw, 56px);
  margin-top: 2px;
}

.title-body {
  position: relative;
  z-index: 3;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 36px;
  padding: 0 46px;
  pointer-events: none;
}

/* roster: stacked bars, Elden Ring register */

#hero-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 262px;
  pointer-events: auto;
}

.hero-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 16px 8px 14px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-mono);
  color: var(--bone-dim);
  background: transparent;
  border: none;
  transition: color 180ms ease, padding-left 200ms ease;
}

/* the sigil sits in a socket on the bar */

.hero-bar .bar-sigil {
  image-rendering: pixelated;
  width: 32px;
  height: 32px;
  flex: none;
  opacity: 0.62;
  transition: opacity 180ms ease, transform 180ms ease;
}

.hero-bar .bar-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.hero-bar .bar-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--bone);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
  transition: color 160ms ease;
}

.hero-bar .bar-role {
  font-family: "PixelChrome", var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bone-dim);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

.hero-bar:hover {
  color: var(--bone);
  padding-left: 18px;
}

.hero-bar:hover .bar-sigil {
  opacity: 0.88;
}

.hero-bar.selected {
  padding-left: 18px;
}

.hero-bar.selected .bar-sigil {
  opacity: 1;
  transform: scale(1.06);
}

.hero-bar.selected .bar-name {
  color: var(--hero-accent, var(--gold-hot));
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9), 0 0 22px rgba(232, 182, 76, 0.25);
}

/* detail plaque */

#hero-detail {
  position: relative;
  width: 320px;
  padding: 4px 6px 8px;
  text-align: left;
  color: var(--bone);
  font-family: var(--font-mono);
  transition: border-color 200ms ease;
  pointer-events: auto;
}

.detail-empty {
  font-family: "PixelChrome", var(--font-mono);
  font-size: 20px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bone-dim);
  padding: 10px 8px;
}

.detail-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 0;
}

.detail-sigil {
  image-rendering: pixelated;
  width: 32px;
  height: 32px;
  flex: none;
}

.detail-head-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.detail-name {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 700;
  color: var(--hero-accent, var(--bone));
  line-height: 1;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.85), 0 1px 0 rgba(233, 223, 200, 0.12);
}

.detail-role {
  font-family: "PixelChrome", var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bone-dim);
}

.detail-blurb {
  margin: 10px 8px 0;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--bone-dim);
  min-height: 36px;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.6);
}

.detail-stats {
  display: flex;
  gap: 20px;
  margin: 12px 8px 0;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.5);
  box-shadow: 0 -1px 0 rgba(226, 200, 152, 0.09);
}

.detail-stat {
  display: flex;
  align-items: center;
  gap: 7px;
}

.detail-stat img {
  image-rendering: pixelated;
  width: 16px;
  height: 16px;
  flex: none;
}

.detail-stat-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.detail-stat b {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--bone);
}

.detail-stat span {
  font-family: "PixelChrome", var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bone-dim);
}

/* footer: hint + descend button + controls */

.title-foot {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0 46px 14px;
}

.title-hint {
  font-family: "PixelChrome", var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bone-dim);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95);
}

.title-hint b {
  color: var(--gold);
  font-weight: 400;
}

.title-controls {
  margin-top: 4px;
  white-space: nowrap;
}

/* buttons: struck gold plate (chrome.css owns the frame) */

.px-btn {
  font-size: 20px;
  padding: 6px 34px 8px;
  color: #2a1f0b;
  text-shadow: 0 1px 0 rgba(255, 240, 200, 0.35);
  transition: transform 90ms ease, filter 140ms ease;
}

.px-btn:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.px-btn:active:not(:disabled) {
  transform: translateY(2px);
  filter: brightness(0.96);
}

.px-btn:disabled {
  filter: grayscale(0.72) brightness(0.6);
  cursor: not-allowed;
  color: #2a1f0b;
}

.controls-line {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 18px;
  font-family: "PixelChrome", var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bone-dim);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
  align-items: center;
}

.controls-line > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.controls-line b.px-keycap {
  font-size: 10px;
  padding: 2px 7px 3px;
  font-weight: 400;
  color: var(--bone);
}

.controls-line.small {
  margin-top: 14px;
  font-size: 10px;
}

/* upgrade cards: tiered ornate panels */

#card-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.upgrade-card {
  position: relative;
  padding: 6px 4px 8px;
  cursor: pointer;
  text-align: left;
  color: var(--bone);
  font-family: var(--font-mono);
  background: transparent;
  transition: transform 150ms cubic-bezier(0.16, 1, 0.3, 1), filter 150ms ease;
  animation: card-in 0.45s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.upgrade-card:nth-child(1) { animation-delay: 0.04s; }
.upgrade-card:nth-child(2) { animation-delay: 0.12s; }
.upgrade-card:nth-child(3) { animation-delay: 0.2s; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(22px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.upgrade-card:hover {
  transform: translateY(-4px);
  filter: brightness(1.1);
}

.upgrade-card .card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 0;
}

.upgrade-card .card-icon {
  image-rendering: pixelated;
  width: 32px;
  height: 32px;
  flex: none;
}

.upgrade-card .tier-tag {
  font-family: "PixelChrome", var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tier-color);
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.85);
}

.upgrade-card h3 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.15;
  /* one line where it fits, two where it must — never a ragged 3-line stack */
  min-height: 2.3em;
  margin: 0 0 6px;
  padding: 0 10px;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.85), 0 1px 0 rgba(233, 223, 200, 0.1);
}

.upgrade-card p {
  font-size: 12px;
  line-height: 1.55;
  color: var(--bone-dim);
  padding: 0 10px;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.6);
}

.upgrade-card .pick-hint {
  margin: 14px 10px 0;
  font-family: "PixelChrome", var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tier-color);
  opacity: 0;
  transition: opacity 140ms ease;
}

.upgrade-card:hover .pick-hint {
  opacity: 1;
}

/* death stats */

#death-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin: 22px 0 16px;
}

.death-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.death-stat img {
  image-rendering: pixelated;
  /* 32px display for a 16px source = a clean 2x. */
  width: 32px;
  height: 32px;
}

.death-stat b {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 900;
  color: var(--gold-hot);
  line-height: 1;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.5), 0 0 24px rgba(232, 182, 76, 0.2);
}

.death-stat span {
  font-family: "PixelChrome", var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bone-dim);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

#death-best {
  font-family: "PixelChrome", var(--font-mono);
  font-size: 20px;
  color: var(--gold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 22px;
  min-height: 20px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
}

/* loading */

.loader-rune {
  width: 54px;
  height: 54px;
  margin: 0 auto 22px;
  border: 2px solid var(--iron-1);
  border-top-color: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(201, 162, 78, 0.18);
  animation: spin 1.1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#loading-text {
  font-family: "PixelChrome", var(--font-mono);
  font-size: 20px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bone-dim);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}

/* toast */

#toast {
  position: absolute;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 18px 6px;
  font-family: "PixelChrome", var(--font-mono);
  font-size: 20px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-hot);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
  z-index: 20;
}

#toast.show {
  opacity: 1;
}

/* responsive */

@media (max-width: 860px) {
  #card-row { grid-template-columns: 1fr; }
  #hp-bar { width: 250px; padding: 0 10px 0 46px; height: 44px; }
  /* 32px = 2x the 16px heart; never a fractional scale. */
  #hp-heart { width: 32px; height: 32px; left: 8px; }
  #hp-text { min-width: 0; font-size: 11px; margin-left: 8px; }
  #hud-top { gap: 4px; }
  #wave-block, #enemy-block, #coin-block, #score-block { min-width: 62px; padding: 2px 8px 4px; }
  .title-bar { padding: 20px 24px 0; }
  .title-body { padding: 0 24px; gap: 16px; }
  #hero-list { width: 200px; gap: 12px; }
  .hero-bar { padding: 5px 10px 6px 8px; gap: 9px; }
  /* sigils are 32px sources: 1x or 2x only. */
  .hero-bar .bar-sigil { width: 32px; height: 32px; }
  .hero-bar .bar-name { font-size: 17px; }
  #hero-detail { width: 250px; }
  .title-controls { display: none; }
}
