/* ============================================================
   NEON SURVIVOR — visual system
   ============================================================ */
:root {
  --bg: #050204;
  --bg-soft: #0a0307;
  --ink: #f7eef1;
  --muted: #a0838c;
  --dim: #6a4b54;
  --red: #ff2648;
  --red-hot: #ff5770;
  --red-deep: #a9082a;
  --red-dark: #3a0611;
  --line: rgba(255, 58, 91, 0.16);
  --line-strong: rgba(255, 70, 100, 0.42);
  --panel: rgba(11, 3, 7, 0.86);
  --font-display: "Helvetica Neue", "Arial Narrow", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --z-hud: 10;
  --z-screen: 30;
  --z-chrome: 40;
}

*,
*::before,
*::after { box-sizing: border-box; }

html,
body { height: 100%; }

html { background: var(--bg); }

body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 10%, #1a0309 0%, transparent 60%),
    #050204;
  color: var(--ink);
  font-family: var(--font-mono);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
}

#game {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: #050204;
  touch-action: none;
  outline: none;
}

body.is-playing #game { cursor: none; }

/* Ambient screen effects */
.fx-vignette {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 42%, rgba(3, 0, 2, 0.42) 100%),
    linear-gradient(180deg, rgba(4, 0, 2, 0.55), transparent 14%, transparent 86%, rgba(4, 0, 2, 0.6));
}

.fx-scanlines {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0.3;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.022) 0px,
    rgba(255, 255, 255, 0.022) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: screen;
}

/* ============================================================
   HUD
   ============================================================ */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-hud);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  gap: 24px;
  padding: 22px 30px;
  pointer-events: none;
  animation: hudIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
  font-size: 11px;
  letter-spacing: 0.12em;
}

.hud-side {
  display: flex;
  gap: 18px;
  min-width: 0;
}
.hud-side--right {
  justify-content: flex-end;
  align-items: flex-start;
}

.hud-card {
  min-width: 250px;
}

.hud-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}

.pulse-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
  animation: pulse 1.6s ease-in-out infinite;
}

.health-track {
  position: relative;
  width: 260px;
  height: 10px;
  overflow: hidden;
  background: rgba(255, 38, 72, 0.08);
  border: 1px solid rgba(255, 70, 100, 0.3);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 7px 100%, 0 calc(100% - 7px));
}

.health-ghost,
.health-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  transform-origin: left center;
}

.health-ghost {
  background: rgba(255, 90, 110, 0.42);
  transition: width 0.65s cubic-bezier(0.16, 1, 0.3, 1) 0.12s;
}

.health-fill {
  background: linear-gradient(90deg, #9e0825, var(--red) 55%, var(--red-hot));
  box-shadow: 0 0 14px rgba(255, 38, 72, 0.65);
  transition: width 0.16s linear;
}

.health-ticks {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent calc(10% - 1px),
    rgba(5, 2, 4, 0.7) calc(10% - 1px),
    rgba(5, 2, 4, 0.7) 10%
  );
  pointer-events: none;
}

.hud-line {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.hud-value {
  color: var(--ink);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.hud-line b { color: var(--ink); font-weight: 600; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border: 1px solid rgba(255, 70, 100, 0.28);
  background: rgba(255, 38, 72, 0.07);
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.16em;
  line-height: 1;
}

.chip b { color: var(--red-hot); }
.chip--level { margin-left: auto; }
.chip--shield { border-color: rgba(255, 235, 240, 0.35); }
.chip--shield b { color: #fff; }

.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 220px;
  padding-top: 2px;
}

.hud-center .hud-kicker { margin-bottom: 2px; letter-spacing: 0.32em; }

.timer {
  color: var(--ink);
  font-size: clamp(26px, 3.4vw, 40px);
  font-weight: 300;
  line-height: 1;
  letter-spacing: 0.09em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 22px rgba(255, 38, 72, 0.55), 0 0 2px rgba(255, 255, 255, 0.6);
}

.xp-track {
  width: 240px;
  height: 3px;
  margin-top: 11px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.xp-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #7d051c, var(--red) 60%, #ffe9ee);
  box-shadow: 0 0 12px rgba(255, 60, 90, 0.9);
  transition: width 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.hud-line--xp {
  width: 240px;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 8px;
  letter-spacing: 0.2em;
}

.hud-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 74px;
}

.hud-stat .hud-kicker { margin-bottom: 0; }
.hud-stat b {
  color: var(--ink);
  font-size: 24px;
  font-weight: 300;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 16px rgba(255, 38, 72, 0.28);
}
.hud-stat--best b { color: var(--muted); font-size: 16px; }

.controls-hint {
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: var(--z-hud);
  transform: translateX(-50%);
  padding: 8px 14px;
  border: 1px solid rgba(255, 58, 91, 0.12);
  background: rgba(7, 2, 5, 0.55);
  color: var(--dim);
  font-size: 8px;
  letter-spacing: 0.18em;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: hudIn 0.8s 0.4s both;
}
.controls-hint span { color: var(--muted); }

/* Toast */
.toast {
  position: absolute;
  top: 126px;
  left: 50%;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transform: translate(-50%, -8px);
  opacity: 0;
  pointer-events: none;
  text-align: center;
  text-transform: uppercase;
}
.toast.is-visible { animation: toastIn 2.6s cubic-bezier(0.16, 1, 0.3, 1) both; }
.toast span:first-child {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.34em;
  text-shadow: 0 0 20px rgba(255, 38, 72, 0.8);
}
.toast span:last-child {
  color: var(--red-hot);
  font-size: 9px;
  letter-spacing: 0.3em;
}

/* Audio toggle */
.audio-toggle {
  position: absolute;
  right: 22px;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: var(--z-chrome);
  padding: 7px 10px;
  border: 1px solid rgba(255, 58, 91, 0.18);
  background: rgba(7, 2, 5, 0.65);
  color: var(--dim);
  font: 500 8px/1 var(--font-mono);
  letter-spacing: 0.2em;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.audio-toggle b { color: var(--muted); font-weight: 600; }
.audio-toggle:hover,
.audio-toggle:focus-visible {
  color: var(--ink);
  border-color: var(--line-strong);
  background: rgba(255, 38, 72, 0.1);
  outline: none;
}
.audio-toggle[aria-pressed="false"] { opacity: 0.55; }

/* ============================================================
   Screens / menus
   ============================================================ */
.screen {
  position: absolute;
  inset: 0;
  z-index: var(--z-screen);
  display: grid;
  place-items: center;
  padding: 32px;
  overflow-y: auto;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255, 24, 56, 0.07), transparent 55%),
    rgba(4, 1, 3, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: screenIn 0.35s ease both;
}

.screen--menu {
  place-items: stretch;
  padding: 0;
  background:
    linear-gradient(180deg, rgba(4, 1, 3, 0.28), rgba(4, 1, 3, 0.42) 38%, rgba(4, 1, 3, 0.9) 100%),
    radial-gradient(ellipse at 24% 46%, rgba(4, 1, 3, 0.82) 0%, rgba(4, 1, 3, 0.35) 42%, transparent 68%);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.menu-shell {
  position: relative;
  width: min(1320px, 100%);
  min-height: 100%;
  margin: 0 auto;
  padding: clamp(34px, 7vh, 76px) clamp(28px, 7vw, 104px) clamp(46px, 9vh, 96px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: clamp(48px, 12vh, 140px);
}

.menu-brand { position: relative; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  color: var(--red-hot);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}
.eyebrow-line {
  width: 34px;
  height: 1px;
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}
.eyebrow--danger { color: var(--red); }

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 3px 7px;
  border: 1px solid rgba(255, 90, 115, 0.22);
  background: rgba(255, 38, 72, 0.055);
  color: var(--ink);
  font: 500 9px/1 var(--font-mono);
  letter-spacing: 0.08em;
  box-shadow: inset 0 0 8px rgba(255, 38, 72, 0.06);
  white-space: nowrap;
}

.logo {
  display: flex;
  flex-direction: column;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(54px, 8.4vw, 122px);
  line-height: 0.8;
  letter-spacing: -0.055em;
  text-transform: uppercase;
}
.logo-neon {
  position: relative;
  color: var(--ink);
  text-shadow: 0 0 38px rgba(255, 38, 72, 0.16);
}
.logo-neon::after {
  content: "";
  position: absolute;
  top: 13%;
  right: -1.6%;
  width: 4%;
  height: 74%;
  background: var(--red);
  transform: skewX(-14deg);
}
.logo-survivor {
  margin-left: 0.045em;
  color: var(--red);
  text-shadow: 0 0 46px rgba(255, 38, 72, 0.14);
}

.menu-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(18px, 3vh, 28px);
}

.menu-start {
  position: relative;
  min-width: clamp(220px, 22vw, 292px);
  padding: 21px 44px 20px;
  border: 0;
  background: var(--red);
  color: #120307;
  font: 800 clamp(17px, 1.5vw, 21px)/1 var(--font-display);
  letter-spacing: 0.34em;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
  clip-path: polygon(0 0, 100% 0, calc(100% - 13px) 100%, 0 100%);
  box-shadow: 0 18px 54px rgba(255, 38, 72, 0.2);
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.menu-start:hover {
  background: #ff405e;
  box-shadow: 0 22px 64px rgba(255, 38, 72, 0.28);
  transform: translateX(4px);
}
.menu-start:active { transform: translateX(2px) scale(0.995); }
.menu-start:focus-visible {
  outline: 1px solid var(--red-hot);
  outline-offset: 5px;
}

.menu-secondary {
  display: flex;
  align-items: center;
  gap: clamp(24px, 3vw, 38px);
  padding-left: 2px;
}

.menu-link {
  position: relative;
  padding: 7px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: 600 10px/1 var(--font-mono);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s ease;
}
.menu-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.24s ease;
}
.menu-link:hover,
.menu-link:focus-visible { color: var(--ink); outline: none; }
.menu-link:hover::after,
.menu-link:focus-visible::after { transform: scaleX(1); }

/* ============================================================
   Biome select / settings
   ============================================================ */
.screen--biome,
.screen--settings {
  align-items: start;
  padding: clamp(18px, 4vw, 40px);
  background:
    linear-gradient(180deg, rgba(4, 1, 3, 0.78), rgba(4, 1, 3, 0.9)),
    radial-gradient(ellipse at 50% 30%, rgba(255, 24, 56, 0.06), transparent 60%);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.biome-shell,
.settings-shell {
  width: min(1120px, 100%);
  margin-block: auto;
  padding: clamp(8px, 2vh, 24px) 0;
  animation: modalIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.settings-shell { width: min(680px, 100%); }

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: clamp(22px, 4vh, 36px);
}
.section-head .eyebrow { margin-bottom: 9px; }
.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.biome-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px, 1.4vw, 18px);
}

.biome-card {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 235, 240, 0.09);
  background: #070306;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.biome-card-canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0.7;
  transform: scale(1.001);
  transition: opacity 0.24s ease, transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.biome-card-name {
  position: absolute;
  left: 13px;
  bottom: 11px;
  color: rgba(255, 244, 247, 0.76);
  font: 600 9px/1 var(--font-mono);
  letter-spacing: 0.22em;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.95);
  text-transform: uppercase;
  transition: color 0.2s ease;
}
.biome-card-mark {
  position: absolute;
  top: 11px;
  right: 11px;
  width: 7px;
  height: 7px;
  background: var(--red);
  box-shadow: 0 0 14px rgba(255, 38, 72, 0.9);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.biome-card:hover { border-color: rgba(255, 90, 118, 0.42); }
.biome-card:hover .biome-card-canvas { opacity: 0.92; transform: scale(1.035); }
.biome-card:focus-visible {
  outline: 1px solid var(--red-hot);
  outline-offset: 3px;
}
.biome-card.is-selected {
  border-color: var(--red);
  box-shadow: 0 0 0 1px rgba(255, 38, 72, 0.22), 0 14px 44px rgba(0, 0, 0, 0.4);
}
.biome-card.is-selected .biome-card-canvas { opacity: 1; }
.biome-card.is-selected .biome-card-name { color: #fff4f7; }
.biome-card.is-selected .biome-card-mark { opacity: 1; }

.biome-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: clamp(20px, 3.4vh, 32px);
}

.settings-list {
  margin-top: 4px;
  border-top: 1px solid var(--line);
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.settings-copy {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.settings-copy span {
  color: var(--ink);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}
.settings-copy small {
  color: var(--dim);
  font-size: 9px;
  letter-spacing: 0.04em;
}
.settings-row .audio-toggle {
  position: static;
  flex: 0 0 auto;
  padding: 10px 14px;
  background: transparent;
  font-size: 9px;
}
.settings-foot {
  margin: 24px 0 0;
  color: var(--dim);
  font-size: 8px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  padding: 12px 26px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(255, 50, 80, 0.07), rgba(255, 38, 72, 0.015));
  color: var(--ink);
  font: 700 10px/1 var(--font-mono);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  clip-path: polygon(11px 0, 100% 0, 100% calc(100% - 11px), calc(100% - 11px) 100%, 0 100%, 0 11px);
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}
.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 38%;
  height: 1px;
  background: var(--red);
  opacity: 0.7;
}
.btn small {
  color: var(--dim);
  font-size: 7px;
  font-weight: 400;
  letter-spacing: 0.2em;
}
.btn:hover {
  border-color: var(--red);
  background: linear-gradient(180deg, rgba(255, 50, 80, 0.16), rgba(255, 38, 72, 0.04));
  box-shadow: 0 0 32px rgba(255, 38, 72, 0.16), inset 0 0 24px rgba(255, 38, 72, 0.06);
  transform: translateY(-2px);
}
.btn:active { transform: translateY(0) scale(0.995); }
.btn:focus-visible {
  outline: 1px solid var(--red-hot);
  outline-offset: 4px;
}

.btn--primary {
  min-width: 220px;
  border-color: var(--red);
  background: linear-gradient(180deg, rgba(255, 56, 88, 0.34), rgba(132, 4, 28, 0.28));
  box-shadow: 0 0 34px rgba(255, 38, 72, 0.12), inset 0 0 28px rgba(255, 38, 72, 0.08);
  font-size: 11px;
  letter-spacing: 0.26em;
}
.btn--primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.14) 48%, transparent 62%);
  transform: translateX(-120%);
  transition: transform 0.55s ease;
  pointer-events: none;
}
.btn--primary:hover { box-shadow: 0 0 52px rgba(255, 38, 72, 0.28), inset 0 0 32px rgba(255, 38, 72, 0.1); }
.btn--primary:hover::after { transform: translateX(120%); }
.btn--primary small { color: rgba(255, 235, 240, 0.62); }

.btn--ghost {
  background: transparent;
  border-color: rgba(255, 58, 91, 0.16);
  color: var(--muted);
}
.btn--ghost:hover { color: var(--ink); }

/* ============================================================
   Modal screens
   ============================================================ */
.modal {
  position: relative;
  width: min(560px, 100%);
  margin: auto;
  padding: clamp(30px, 5vw, 48px);
  border: 1px solid rgba(255, 70, 100, 0.25);
  background:
    linear-gradient(135deg, rgba(255, 38, 72, 0.06), transparent 45%),
    rgba(8, 2, 5, 0.92);
  box-shadow: 0 30px 120px rgba(0, 0, 0, 0.75), inset 0 0 80px rgba(255, 22, 50, 0.03);
  clip-path: polygon(24px 0, 100% 0, 100% calc(100% - 24px), calc(100% - 24px) 100%, 0 100%, 0 24px);
  animation: modalIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.modal::before,
.modal::after {
  content: "";
  position: absolute;
  width: 52px;
  height: 2px;
  background: var(--red);
  box-shadow: 0 0 12px var(--red);
}
.modal::before { top: 0; left: 34px; }
.modal::after { bottom: 0; right: 34px; }

.modal--wide { width: min(640px, 100%); }

.modal-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(42px, 7vw, 68px);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.modal-title--small { font-size: clamp(32px, 4.5vw, 46px); }
.modal-title--danger {
  color: var(--ink);
  text-shadow: 0 0 34px rgba(255, 38, 72, 0.45);
}
.modal-title--danger::after {
  content: "";
  display: block;
  width: 64px;
  height: 3px;
  margin-top: 14px;
  background: var(--red);
  box-shadow: 0 0 14px var(--red);
}

.modal-sub {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.16em;
  line-height: 1.7;
  text-transform: uppercase;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.modal-actions .btn { flex: 1 1 160px; }

.modal-hint {
  margin: 26px 0 0;
  color: var(--dim);
  font-size: 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.modal-hint kbd { margin: 0 4px; }

/* Game over results */
.result-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin: 30px 0 26px;
  background: rgba(255, 58, 91, 0.12);
  border: 1px solid rgba(255, 58, 91, 0.14);
}
.result {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 16px 12px;
  background: rgba(8, 2, 5, 0.92);
}
.result span {
  color: var(--dim);
  font-size: 7px;
  letter-spacing: 0.2em;
}
.result b {
  color: var(--ink);
  font-size: 18px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
}
.result:first-child b { color: var(--red-hot); }

.record-line {
  margin: -8px 0 24px;
  color: var(--red-hot);
  font-size: 9px;
  letter-spacing: 0.28em;
  text-align: center;
  text-shadow: 0 0 18px rgba(255, 38, 72, 0.7);
  animation: recordPulse 1.6s ease-in-out infinite;
}

/* ============================================================
   Upgrade screen
   ============================================================ */
.screen--upgrade {
  padding: 24px;
  background:
    radial-gradient(ellipse at 50% 48%, rgba(255, 28, 60, 0.12), transparent 62%),
    rgba(3, 1, 2, 0.82);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.upgrade-panel {
  width: min(1120px, 100%);
  margin: auto;
  padding: clamp(20px, 4vw, 40px);
  animation: modalIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.upgrade-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.upgrade-head .eyebrow { margin-bottom: 10px; }
.upgrade-head .modal-title { margin: 0; }

.upgrade-level {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  color: var(--dim);
  font-size: 8px;
  letter-spacing: 0.22em;
  background: rgba(255, 38, 72, 0.05);
}
.upgrade-level b { color: var(--red-hot); font-size: 12px; }

.upgrade-sub {
  margin: 18px 0 24px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.upgrade-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.upgrade-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 13px;
  min-height: 250px;
  padding: 20px;
  border: 1px solid rgba(255, 70, 100, 0.2);
  background:
    linear-gradient(155deg, rgba(255, 38, 72, 0.07), transparent 56%),
    rgba(10, 2, 6, 0.9);
  color: var(--ink);
  font-family: var(--font-mono);
  text-align: left;
  cursor: pointer;
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.22s, box-shadow 0.22s, background 0.22s;
  animation: cardIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.upgrade-card:nth-child(2) { animation-delay: 0.05s; }
.upgrade-card:nth-child(3) { animation-delay: 0.1s; }
.upgrade-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20px;
  width: 40px;
  height: 2px;
  background: var(--red);
  opacity: 0;
  transition: opacity 0.2s;
  box-shadow: 0 0 12px var(--red);
}
.upgrade-card:hover,
.upgrade-card:focus-visible {
  transform: translateY(-7px);
  border-color: var(--red);
  background:
    linear-gradient(155deg, rgba(255, 38, 72, 0.16), transparent 60%),
    rgba(14, 3, 8, 0.96);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 40px rgba(255, 38, 72, 0.12);
  outline: none;
}
.upgrade-card:hover::before,
.upgrade-card:focus-visible::before { opacity: 1; }

.upgrade-card--uncommon { border-color: rgba(99, 255, 164, 0.26); }
.upgrade-card--uncommon::before { background: #63ffa4; box-shadow: 0 0 12px #63ffa4; }
.upgrade-card--uncommon .upgrade-category { color: #63ffa4; }
.upgrade-card--rare { border-color: rgba(180, 92, 255, 0.32); }
.upgrade-card--rare::before { background: #b45cff; box-shadow: 0 0 12px #b45cff; }
.upgrade-card--rare .upgrade-category { color: #b45cff; }
.upgrade-card--epic { border-color: rgba(255, 200, 87, 0.42); }
.upgrade-card--epic::before { background: #ffc857; box-shadow: 0 0 14px #ffc857; }
.upgrade-card--epic .upgrade-category { color: #ffc857; }
.upgrade-card--epic .upgrade-icon { border-color: rgba(255, 200, 87, 0.45); color: #ffc857; }
.upgrade-card--evolution {
  border-color: rgba(255, 43, 122, 0.5);
  background:
    linear-gradient(140deg, rgba(255, 43, 122, 0.16), rgba(8, 2, 6, 0.9) 58%),
    var(--panel, #100409);
  box-shadow: 0 0 30px rgba(255, 43, 122, 0.16), inset 0 0 0 1px rgba(255, 43, 122, 0.12);
}
.upgrade-card--evolution::before { background: #ff2b7a; box-shadow: 0 0 16px #ff2b7a; }
.upgrade-card--evolution .upgrade-category { color: #ff6a9f; }
.upgrade-card--evolution .upgrade-icon { border-color: rgba(255, 43, 122, 0.55); color: #ff6a9f; }
.upgrade-card--evolution .upgrade-name { color: #ffe3ec; text-shadow: 0 0 20px rgba(255, 43, 122, 0.55); }

.upgrade-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.upgrade-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255, 70, 100, 0.32);
  background: rgba(255, 38, 72, 0.07);
  color: var(--red-hot);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  box-shadow: inset 0 0 18px rgba(255, 38, 72, 0.08);
}
.upgrade-index {
  color: var(--dim);
  font-size: 9px;
  letter-spacing: 0.14em;
}
.upgrade-category {
  color: var(--red);
  font-size: 7px;
  letter-spacing: 0.26em;
}
.upgrade-name {
  font-family: var(--font-display);
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
}
.upgrade-desc {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
  letter-spacing: 0.03em;
}
.upgrade-stack {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 58, 91, 0.12);
  color: var(--dim);
  font-size: 7px;
  letter-spacing: 0.2em;
}
.upgrade-stack b { color: var(--muted); }

/* ============================================================
   Animations
   ============================================================ */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}
@keyframes hudIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes screenIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastIn {
  0% { opacity: 0; transform: translate(-50%, -10px); }
  12% { opacity: 1; transform: translate(-50%, 0); }
  80% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -6px); }
}
@keyframes recordPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* ============================================================
   HUD additions — weapon, salvage, boss bar
   ============================================================ */
.hud-line--loadout {
  margin-top: 6px;
  font-size: 8px;
  letter-spacing: 0.16em;
}
.hud-weapon {
  color: var(--ink);
  font-weight: 600;
}
.hud-credits {
  margin-left: auto;
  color: #ffc857;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.boss-bar {
  position: absolute;
  top: 96px;
  left: 50%;
  z-index: 11;
  width: min(760px, 74vw);
  transform: translateX(-50%);
  pointer-events: none;
  animation: bossIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.boss-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
  font-size: 8px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}
.boss-name {
  color: var(--ink);
  font-weight: 700;
  text-shadow: 0 0 18px rgba(255, 38, 72, 0.8);
}
.boss-phase { color: var(--red-hot); }
.boss-track {
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 70, 100, 0.45);
  background: rgba(255, 38, 72, 0.08);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.8);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
.boss-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #7e0020, var(--red) 58%, #ff9cad);
  box-shadow: 0 0 20px rgba(255, 38, 72, 0.85);
  transition: width 0.18s linear;
}
.boss-sub {
  margin-top: 5px;
  color: var(--muted);
  font-size: 7px;
  letter-spacing: 0.3em;
  text-align: center;
  text-transform: uppercase;
}

/* ============================================================
   Garage / Armory
   ============================================================ */
.screen--garage {
  place-items: stretch;
  grid-template-columns: minmax(0, 1fr);
  padding: 24px;
  overflow-y: auto;
  background:
    radial-gradient(ellipse at 18% 12%, rgba(255, 30, 62, 0.1), transparent 46%),
    radial-gradient(ellipse at 82% 86%, rgba(255, 38, 72, 0.07), transparent 50%),
    rgba(3, 1, 2, 0.9);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.garage-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1340px, 100%);
  min-width: 0;
  margin: 0 auto;
  padding: clamp(18px, 2.6vw, 30px);
  border: 1px solid rgba(255, 70, 100, 0.18);
  background:
    linear-gradient(135deg, rgba(255, 38, 72, 0.045), transparent 42%),
    rgba(7, 2, 4, 0.88);
  box-shadow: 0 30px 120px rgba(0, 0, 0, 0.65), inset 0 0 100px rgba(255, 22, 50, 0.025);
  clip-path: polygon(22px 0, 100% 0, 100% calc(100% - 22px), calc(100% - 22px) 100%, 0 100%, 0 22px);
  animation: modalIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.garage-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.garage-head-copy .eyebrow { margin-bottom: 8px; }
.garage-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(38px, 5.4vw, 62px);
  font-weight: 900;
  line-height: 0.86;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.garage-sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.garage-head-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.credit-chip {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 200, 87, 0.28);
  background: rgba(255, 200, 87, 0.045);
  color: var(--dim);
  font-size: 7px;
  letter-spacing: 0.2em;
}
.credit-chip b {
  color: #ffc857;
  font-size: 18px;
  font-weight: 300;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.garage-tabs {
  display: flex;
  gap: 2px;
  min-width: 0;
  margin-top: 2px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.garage-tabs::-webkit-scrollbar { display: none; }
.garage-tab {
  padding: 11px 16px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--dim);
  font: 700 9px/1 var(--font-mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}
.garage-tab:hover { color: var(--ink); }
.garage-tab:focus-visible {
  outline: 1px solid var(--red-hot);
  outline-offset: -2px;
}
.garage-tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--red);
  background: linear-gradient(180deg, transparent, rgba(255, 38, 72, 0.09));
}

.garage-body {
  display: grid;
  grid-template-columns: minmax(270px, 0.82fr) minmax(0, 1.45fr);
  gap: clamp(16px, 2.2vw, 28px);
  align-items: start;
  padding: 20px 0 14px;
}

.garage-preview-panel {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.preview-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 70, 100, 0.22);
  background: #050204;
  box-shadow: inset 0 0 60px rgba(255, 22, 50, 0.06), 0 18px 50px rgba(0, 0, 0, 0.4);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
}
#garage-preview {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 11;
}
.preview-tag {
  position: absolute;
  top: 10px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 7px;
  letter-spacing: 0.22em;
}
.preview-axis {
  position: absolute;
  background: rgba(255, 70, 100, 0.1);
  pointer-events: none;
}
.preview-axis--x { left: 0; right: 0; top: 54%; height: 1px; }
.preview-axis--y { top: 0; bottom: 0; left: 50%; width: 1px; }

.loadout-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.loadout-summary div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 8px 10px;
  background: #080205;
}
.loadout-summary span {
  color: var(--dim);
  font-size: 7px;
  letter-spacing: 0.18em;
}
.loadout-summary b {
  overflow: hidden;
  color: var(--ink);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.loadout-summary--wide { grid-column: 1 / -1; }

.garage-notice {
  min-height: 28px;
  margin: 0;
  padding: 8px 10px;
  border-left: 2px solid var(--red);
  background: rgba(255, 38, 72, 0.05);
  color: var(--muted);
  font-size: 8px;
  line-height: 1.5;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.garage-notice.is-danger {
  border-left-color: var(--red-hot);
  background: rgba(255, 38, 72, 0.11);
  color: var(--ink);
}

.garage-content { min-width: 0; }
.garage-pane { animation: paneIn 0.25s ease both; }
.garage-pane-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.garage-pane-head > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.garage-pane-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.garage-pane-head p {
  max-width: 340px;
  margin: 0;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.7;
  letter-spacing: 0.1em;
  text-align: right;
  text-transform: uppercase;
}
.garage-pane-head--spaced { margin-top: 26px; }
.pane-code {
  color: var(--red);
  font-size: 8px;
  letter-spacing: 0.2em;
}

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
}
.swatch {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 2px 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.012);
  color: var(--ink);
  font-family: var(--font-mono);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}
.swatch:hover {
  border-color: rgba(255, 90, 115, 0.5);
  background: rgba(255, 38, 72, 0.06);
  transform: translateY(-1px);
}
.swatch.is-selected {
  border-color: var(--swatch, var(--red));
  background: rgba(255, 38, 72, 0.09);
  box-shadow: inset 0 0 18px rgba(255, 38, 72, 0.06), 0 0 18px rgba(255, 38, 72, 0.08);
}
.swatch.is-locked { opacity: 0.68; }
.swatch.is-locked:hover { opacity: 1; }
.swatch-chip {
  grid-row: 1 / span 2;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: var(--swatch);
  box-shadow: 0 0 14px var(--swatch);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.swatch-name {
  overflow: hidden;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.swatch-meta {
  color: var(--dim);
  font-size: 7px;
  letter-spacing: 0.16em;
}
.swatch.is-selected .swatch-meta { color: var(--red-hot); }

.custom-color-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.012);
}
.custom-color-label {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.custom-color-label span {
  color: var(--dim);
  font-size: 7px;
  letter-spacing: 0.18em;
}
input[type="color"] {
  width: 46px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 90, 115, 0.35);
  background: transparent;
  cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
input[type="color"]::-webkit-color-swatch { border: 0; }
#custom-color-value {
  min-width: 64px;
  color: var(--ink);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-align: right;
}

.garage-grid,
.weapon-grid,
.core-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.garage-card,
.weapon-card,
.core-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 136px;
  padding: 13px;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 38, 72, 0.035), transparent 52%),
    rgba(8, 2, 5, 0.72);
  color: var(--ink);
  font-family: var(--font-mono);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}
.garage-card::before,
.weapon-card::before,
.core-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 40px;
  height: 2px;
  background: var(--red);
  opacity: 0.4;
  transition: opacity 0.16s ease, width 0.16s ease;
}
.garage-card:hover,
.weapon-card:hover,
.core-card:hover {
  border-color: rgba(255, 90, 115, 0.52);
  background:
    linear-gradient(145deg, rgba(255, 38, 72, 0.075), transparent 52%),
    rgba(10, 3, 6, 0.85);
  transform: translateY(-2px);
}
.garage-card:hover::before,
.weapon-card:hover::before,
.core-card:hover::before { width: 70px; opacity: 1; }
.garage-card.is-selected,
.weapon-card.is-selected {
  border-color: var(--red);
  background:
    linear-gradient(145deg, rgba(255, 38, 72, 0.13), transparent 56%),
    rgba(12, 3, 7, 0.9);
  box-shadow: inset 0 0 30px rgba(255, 38, 72, 0.06), 0 0 26px rgba(255, 38, 72, 0.09);
}
.garage-card.is-selected::before,
.weapon-card.is-selected::before { width: 100%; opacity: 1; }
.garage-card.is-locked,
.weapon-card.is-locked { opacity: 0.7; }
.garage-card.is-locked:hover,
.weapon-card.is-locked:hover { opacity: 1; }
.core-card.is-maxed { border-color: rgba(255, 200, 87, 0.3); }
.core-card.is-maxed::before { background: #ffc857; opacity: 0.8; }
.garage-card:focus-visible,
.weapon-card:focus-visible,
.core-card:focus-visible {
  outline: 1px solid var(--red-hot);
  outline-offset: 2px;
}

.garage-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.garage-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  min-height: 22px;
  padding: 0 6px;
  border: 1px solid rgba(255, 90, 115, 0.24);
  background: rgba(255, 38, 72, 0.07);
  color: var(--red-hot);
  font-size: 8px;
  letter-spacing: 0.12em;
}
.garage-state,
.weapon-tag {
  color: var(--dim);
  font-size: 7px;
  letter-spacing: 0.18em;
  text-align: right;
  text-transform: uppercase;
}
.garage-card.is-selected .garage-state,
.weapon-card.is-selected .weapon-tag { color: var(--red-hot); }
.garage-card-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.garage-card-desc {
  flex: 1;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.65;
  letter-spacing: 0.02em;
}
.garage-card-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 58, 91, 0.1);
  color: var(--dim);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.garage-card-foot b {
  color: var(--red-hot);
  font-weight: 600;
  white-space: nowrap;
}
.garage-card.is-locked .garage-card-foot b { color: #ffc857; }
.core-card.is-maxed .garage-card-foot b { color: #ffc857; }

.weapon-bars {
  display: flex;
  gap: 4px;
  height: 4px;
}
.weapon-bars i {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.07);
}
.weapon-bars i::after {
  content: "";
  position: absolute;
  inset: 0;
  width: calc(var(--v) * 100%);
  background: linear-gradient(90deg, var(--red-deep), var(--red-hot));
}
.core-pips {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}
.core-pips span {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.07);
}
.core-pips span.is-on {
  background: linear-gradient(90deg, var(--red-deep), var(--red-hot));
  box-shadow: 0 0 8px rgba(255, 38, 72, 0.6);
}
.core-card.is-maxed .core-pips span.is-on {
  background: linear-gradient(90deg, #a87500, #ffc857);
  box-shadow: 0 0 8px rgba(255, 200, 87, 0.55);
}

.garage-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 7px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.garage-foot span:last-child { text-align: right; }

.btn--compact {
  min-height: 36px;
  padding: 9px 16px;
  font-size: 8px;
  letter-spacing: 0.18em;
}
.btn--compact kbd { margin-left: 6px; min-height: 18px; font-size: 8px; }
.btn--danger {
  border-color: var(--red);
  background: linear-gradient(180deg, rgba(255, 56, 88, 0.4), rgba(132, 4, 28, 0.4));
  box-shadow: 0 0 26px rgba(255, 38, 72, 0.18);
}
.btn--danger:hover { box-shadow: 0 0 40px rgba(255, 38, 72, 0.34); }
.btn--danger-ghost {
  border-color: rgba(255, 70, 100, 0.34);
  background: transparent;
  color: var(--red-hot);
}
.btn--danger-ghost:hover {
  border-color: var(--red);
  background: rgba(255, 38, 72, 0.08);
  color: var(--ink);
}

.confirm-layer {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 1, 3, 0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: screenIn 0.2s ease both;
}
.confirm-card {
  width: min(520px, 100%);
  padding: clamp(26px, 4vw, 40px);
  border: 1px solid rgba(255, 70, 100, 0.32);
  background:
    linear-gradient(135deg, rgba(255, 38, 72, 0.08), transparent 46%),
    rgba(8, 2, 5, 0.97);
  box-shadow: 0 30px 110px rgba(0, 0, 0, 0.8);
  clip-path: polygon(20px 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%, 0 20px);
  animation: modalIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.confirm-card .modal-title { margin-bottom: 14px; }
.confirm-card .modal-sub { margin-bottom: 24px; }

/* Six result fields read better as two rows of three */
.result-grid { grid-template-columns: repeat(3, 1fr); }
.result:nth-child(5) b,
.result:nth-child(6) b { color: #ffc857; }

@keyframes bossIn {
  from { opacity: 0; transform: translate(-50%, -12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes paneIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1100px) {
  .garage-body { grid-template-columns: 1fr; }
  .garage-preview-panel { position: static; }
  #garage-preview { aspect-ratio: 16 / 8.5; }
  .loadout-summary { grid-template-columns: repeat(3, 1fr); }
  .loadout-summary--wide { grid-column: auto; }
}

@media (max-width: 900px) {
  .garage-pane-head { flex-direction: column; gap: 8px; }
  .garage-pane-head p { max-width: none; text-align: left; }
  .weapon-grid,
  .core-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
  .screen--garage { padding: 12px; }
  .garage-shell { padding: 16px; }
  .garage-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .garage-head-actions { width: 100%; justify-content: space-between; }
  .garage-body { padding-top: 14px; }
  .loadout-summary { grid-template-columns: repeat(2, 1fr); }
  .loadout-summary--wide { grid-column: 1 / -1; }
  .garage-foot span:last-child { display: none; }
  .boss-bar { top: 128px; width: calc(100% - 32px); }
}

@media (max-width: 620px) {
  .garage-grid,
  .weapon-grid,
  .core-grid { grid-template-columns: 1fr; }
  .swatch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .garage-foot { flex-direction: column; align-items: flex-start; }
  .garage-foot span { text-align: left !important; }
  .garage-tab { padding: 10px 12px; font-size: 8px; }
  .custom-color-row { flex-wrap: wrap; }
  .custom-color-label { flex-basis: 100%; }
  .result-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-height: 760px) and (min-width: 1101px) {
  .garage-preview-panel { position: static; }
  .screen--garage { padding: 12px; }
  .garage-shell { padding: 16px 22px; }
  .garage-title { font-size: 46px; }
  .garage-body { padding: 14px 0 10px; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
  .hud { padding: 18px 20px; gap: 14px; }
  .health-track { width: 210px; }
  .hud-card { min-width: 210px; }
  .menu-shell { padding-inline: 34px; }
}

@media (max-width: 780px) {
  .hud {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "vitals kills"
      "center center";
    gap: 10px 16px;
    padding: 14px 16px;
  }
  .hud-side--left { grid-area: vitals; }
  .hud-side--right { grid-area: kills; gap: 14px; }
  .hud-center {
    grid-area: center;
    align-items: stretch;
    min-width: 0;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 58, 91, 0.12);
  }
  .hud-center .hud-kicker,
  .hud-center .xp-track,
  .hud-line--xp { display: none; }
  .timer { font-size: 20px; margin-right: auto; }
  .health-track { width: min(38vw, 230px); }
  .hud-card { min-width: 0; }
  .hud-stat b { font-size: 19px; }
  .hud-stat--best b { font-size: 12px; }

  .menu-shell { gap: 48px; padding: 30px 24px 42px; }
  .biome-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .screen--biome,
  .screen--settings { padding: 20px 16px; }
  .upgrade-cards { grid-template-columns: 1fr; }
  .screen--upgrade { padding: 12px; }
  .upgrade-panel { padding: 18px; }
  .upgrade-card {
    min-height: 0;
    padding: 15px;
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 4px 14px;
  }
  .upgrade-card-top {
    grid-row: 1 / span 4;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 8px;
  }
  .upgrade-icon { width: 44px; height: 44px; font-size: 11px; }
  .upgrade-name { font-size: 19px; }
  .upgrade-stack { margin-top: 4px; }
  .toast { top: 112px; }
}

@media (max-width: 560px) {
  .hud { padding: 10px 12px; }
  .hud-side--right .hud-stat--best { display: none; }
  .health-track { width: 44vw; }
  .hud-line .chip--shield { display: none; }
  .logo { font-size: clamp(48px, 15vw, 74px); }
  .menu-shell { padding: 24px 20px 32px; gap: 38px; }
  .menu-start { width: 100%; min-width: 0; text-align: center; padding-inline: 24px; }
  .menu-secondary { width: 100%; justify-content: space-between; }
  kbd { font-size: 8px; padding: 3px 5px; }
  .screen { padding: 16px; }
  .biome-shell,
  .settings-shell { padding-block: 0; }
  .section-head { align-items: center; margin-bottom: 20px; }
  .section-title { font-size: 28px; }
  .result-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { padding: 26px 22px; }
  .modal-actions .btn { flex-basis: 100%; }
  .controls-hint { display: none; }
  .upgrade-head { flex-direction: column; gap: 10px; }
  .upgrade-level { align-self: flex-start; }
  .upgrade-sub { margin-bottom: 16px; }
  .settings-row { align-items: flex-start; flex-direction: column; gap: 14px; }
  .settings-row .btn,
  .settings-row .audio-toggle { width: 100%; }
}

@media (max-width: 460px) {
  .biome-grid { gap: 8px; }
  .biome-card { aspect-ratio: 16 / 9; }
  .biome-card-name { left: 8px; bottom: 7px; font-size: 7px; letter-spacing: 0.14em; }
  .biome-card-mark { top: 7px; right: 7px; }
}

@media (max-height: 720px) and (min-width: 781px) {
  .menu-shell { padding-top: 24px; padding-bottom: 26px; gap: 40px; }
  .logo { font-size: clamp(50px, 7.4vw, 94px); }
  .menu-start { padding-block: 17px; }
  .biome-shell { padding-block: 0; }
  .upgrade-card { min-height: 210px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .fx-scanlines { display: none; }
}

/* ============================================================
   Account / cloud save
   ============================================================ */
.menu-account {
  position: absolute;
  top: clamp(20px, 4vh, 40px);
  right: 0;
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas:
    "dot label"
    ". save";
  align-items: center;
  column-gap: 8px;
  row-gap: 4px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 70, 100, 0.2);
  background: rgba(8, 2, 5, 0.62);
  box-shadow: inset 0 0 22px rgba(255, 38, 72, 0.05);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  text-transform: uppercase;
}
.menu-account-dot {
  grid-area: dot;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dim);
  box-shadow: 0 0 8px rgba(160, 131, 140, 0.5);
}
.menu-account-dot[data-state="saved"] {
  background: #45ffa8;
  box-shadow: 0 0 10px rgba(69, 255, 168, 0.75);
}
.menu-account-dot[data-state="saving"] {
  background: #ffd166;
  box-shadow: 0 0 10px rgba(255, 209, 102, 0.7);
  animation: pulse 1s ease-in-out infinite;
}
.menu-account-dot[data-state="offline"],
.menu-account-dot[data-state="error"] {
  background: var(--red);
  box-shadow: 0 0 10px rgba(255, 38, 72, 0.8);
}
.menu-account-dot.is-admin { box-shadow: 0 0 0 3px rgba(255, 38, 72, 0.18), 0 0 14px rgba(255, 38, 72, 0.9); }
#menu-account-label {
  grid-area: label;
  color: var(--ink);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.22em;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#menu-account-save {
  grid-area: save;
  color: var(--dim);
  font-size: 7px;
  letter-spacing: 0.2em;
}

.announce {
  position: absolute;
  right: 0;
  top: clamp(88px, 15vh, 160px);
  width: min(340px, 100%);
  padding: 14px 18px 16px;
  border-left: 2px solid var(--red);
  background: linear-gradient(90deg, rgba(255, 38, 72, 0.1), rgba(8, 2, 5, 0.82));
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
  animation: modalIn 0.4s ease both;
}
.announce-kicker {
  display: block;
  margin-bottom: 7px;
  color: var(--red-hot);
  font-size: 7px;
  letter-spacing: 0.26em;
}
.announce b {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.announce p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.screen--account {
  align-items: start;
  padding: clamp(18px, 4vw, 40px);
  background:
    linear-gradient(180deg, rgba(4, 1, 3, 0.84), rgba(4, 1, 3, 0.94)),
    radial-gradient(ellipse at 76% 18%, rgba(255, 24, 56, 0.08), transparent 55%);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.account-shell {
  width: min(1080px, 100%);
  margin-block: auto;
  animation: modalIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 1.6vw, 20px);
}
.account-card {
  position: relative;
  padding: clamp(18px, 2.4vw, 28px);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 50, 80, 0.035), transparent 55%),
    rgba(9, 2, 6, 0.72);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}
.account-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 42%;
  height: 1px;
  background: linear-gradient(90deg, var(--red), transparent);
  opacity: 0.7;
}
.account-card--identity { display: flex; flex-direction: column; gap: 18px; }
.account-card--alert {
  grid-column: 1 / -1;
  border-color: rgba(255, 38, 72, 0.5);
  background:
    linear-gradient(180deg, rgba(255, 38, 72, 0.12), transparent 65%),
    rgba(20, 2, 7, 0.86);
}
.account-card-title {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: clamp(20px, 2.2vw, 27px);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.account-identity {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.account-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border: 1px solid rgba(255, 70, 100, 0.4);
  background-color: rgba(255, 38, 72, 0.09);
  background-position: center;
  background-size: cover;
  color: var(--red-hot);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 900;
  box-shadow: inset 0 0 24px rgba(255, 38, 72, 0.12);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
.account-identity-copy { min-width: 0; }
.account-identity-copy .eyebrow { margin-bottom: 6px; }
.account-name {
  margin: 0 0 5px;
  font-family: var(--font-display);
  font-size: clamp(22px, 2.6vw, 32px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}
.account-meta {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.account-uid {
  margin: 6px 0 0;
  color: var(--dim);
  font-size: 8px;
  letter-spacing: 0.12em;
  overflow-wrap: anywhere;
}
.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.account-actions .btn { flex: 1 1 190px; }
.account-error {
  margin: 0;
  padding: 10px 12px;
  border-left: 2px solid var(--red);
  background: rgba(255, 38, 72, 0.1);
  color: var(--red-hot);
  font-size: 10px;
  line-height: 1.5;
}
.save-state {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12px;
  letter-spacing: 0.18em;
}
.save-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dim);
  box-shadow: 0 0 10px rgba(160, 131, 140, 0.4);
}
.save-dot[data-state="saved"] { background: #45ffa8; box-shadow: 0 0 12px rgba(69, 255, 168, 0.8); }
.save-dot[data-state="saving"] { background: #ffd166; box-shadow: 0 0 12px rgba(255, 209, 102, 0.8); animation: pulse 1s ease-in-out infinite; }
.save-dot[data-state="offline"],
.save-dot[data-state="error"] { background: var(--red); box-shadow: 0 0 12px rgba(255, 38, 72, 0.85); }
.save-dot.is-admin { outline: 2px solid rgba(255, 38, 72, 0.24); outline-offset: 2px; }
.account-fine {
  margin: 12px 0 0;
  color: var(--dim);
  font-size: 8px;
  letter-spacing: 0.16em;
  line-height: 1.7;
  text-transform: uppercase;
}
.account-progress {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 18px;
  border: 1px solid var(--line);
  background: var(--line);
}
.account-progress > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 14px;
  background: rgba(7, 2, 4, 0.92);
}
.account-progress span {
  color: var(--dim);
  font-size: 7px;
  letter-spacing: 0.22em;
}
.account-progress b {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.03em;
}
.account-admin-link {
  display: inline-block;
  margin-top: 18px;
  color: var(--red-hot);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-decoration: none;
}
.account-admin-link:hover,
.account-admin-link:focus-visible {
  color: var(--ink);
  outline: none;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.account-conflict-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.account-conflict-actions .btn { flex: 1 1 180px; }

.record-line--achievement {
  color: #ffd166;
  border-color: rgba(255, 209, 102, 0.35);
}

@media (max-width: 900px) {
  .account-grid { grid-template-columns: 1fr; }
  .account-card--alert { grid-column: auto; }
}

@media (max-width: 780px) {
  .menu-account {
    position: static;
    justify-self: flex-start;
    margin-top: 22px;
  }
  .announce {
    position: static;
    width: 100%;
    margin-top: 18px;
  }
  .screen--account { padding: 20px 16px; }
  .account-shell { padding-block: 0; }
}

@media (max-width: 560px) {
  .account-progress { grid-template-columns: 1fr; }
  .account-actions .btn,
  .account-conflict-actions .btn { flex-basis: 100%; }
  .account-avatar { width: 54px; height: 54px; }
}
