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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b0a0d;
  color: #e9e6df;
  font-family: "JetBrains Mono", "Courier New", Consolas, monospace;
  user-select: none;
  -webkit-user-select: none;
}

#game-root {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

canvas#game {
  display: block;
  width: 100vw;
  height: 100vh;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  background: #0b0a0d;
  /* Hide OS crosshair — Game.renderCrosshair draws the same reticle at the mouse (screen px). */
  cursor: none;
}

.hidden {
  display: none !important;
}

/* ================== HUD ================== */
.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 12px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.85);
  font-size: 14px;
}

.hud-top,
.hud-bottom {
  display: grid;
  align-items: start;
  gap: 16px;
}

.hud-top {
  grid-template-columns: minmax(140px, 1fr) minmax(260px, 2.2fr) minmax(140px, 1fr);
}

.hud-status-row {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 16px;
  width: 100%;
  pointer-events: none;
}

.hud-status-row:empty {
  display: none !important;
}

.hud-depth-fog {
  align-self: flex-start;
  font-size: 12px;
  line-height: 1.45;
  padding: 6px 10px;
  background: rgba(8, 10, 16, 0.58);
  border: 1px solid rgba(120, 140, 180, 0.24);
  border-radius: 6px;
  pointer-events: none;
}

.hud-depth-fog__line {
  color: #e8e6df;
  font-variant-numeric: tabular-nums;
}

.hud-depth-fog__line + .hud-depth-fog__line {
  margin-top: 2px;
}

.hud-status-row>.health-wrap {
  flex: 1 1 auto;
  min-width: 0;
  max-width: min(380px, 58%);
  pointer-events: none;
}

.hud-status-row>.hud-weapon-cluster {
  flex: 0 0 auto;
  pointer-events: none;
}

.hud-bottom-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  pointer-events: none;
}

.hud-bottom-left>.hud-inv-stack {
  pointer-events: auto;
}

/* Bottom: inventory (+ health above) left; weapon cluster right — touch reparents to #hud-status-row + mobile slot */
.hud-bottom {
  margin-top: auto;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px 16px;
}

.hud-bottom-balance {
  min-width: 0;
  pointer-events: none;
  align-self: end;
  justify-self: end;
}

.hud-bottom-balance .hud-weapon-cluster {
  pointer-events: none;
}

.hud-top-balance {
  min-width: 0;
  pointer-events: none;
  text-align: left;
  align-self: start;
}

.hud-score-plain {
  display: block;
  font-size: 16px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: #f0e8c8;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.hud-top-ready {
  min-width: 0;
  text-align: right;
  align-self: start;
  pointer-events: none;
}

.hud-mp-prep-ready {
  letter-spacing: 0.06em;
}

.hud-inv-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 10px;
  justify-self: start;
  min-width: 0;
  max-width: min(96vw, 400px);
  pointer-events: auto;
}

.hud-left {
  justify-self: start;
}

.hud-center {
  justify-self: center;
  text-align: center;
}

.hud-right {
  justify-self: end;
  text-align: right;
}

.hud-top-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
}

.hud-round-block {
  width: 100%;
  text-align: center;
}

.hud-top-spacer {
  min-height: 1px;
}

/* Touch gameplay */
body.bug-out-touch-game .hud {
  justify-content: flex-start;
  gap: 8px;
  padding: max(6px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) 10px max(10px, env(safe-area-inset-left, 0px));
  font-size: 12px;
}

body.bug-out-touch-game .hud-round-block--tap-pause {
  pointer-events: auto;
  cursor: pointer;
  border-radius: 8px;
  padding: 4px 8px;
  margin: -4px -8px;
  transition: background 0.12s ease;
}

body.bug-out-touch-game .hud-round-block--tap-pause:active {
  background: rgba(255, 255, 255, 0.08);
}

body.bug-out-touch-game #hud-score-wrap {
  pointer-events: auto;
  cursor: pointer;
  border-radius: 6px;
  padding: 2px 6px;
  margin: -2px -6px;
  transition: background 0.12s ease;
}

body.bug-out-touch-game #hud-score-wrap:active {
  background: rgba(255, 255, 255, 0.07);
}

body.bug-out-touch-game .hud-bottom-left:empty {
  display: none !important;
}

body.bug-out-touch-game .hud-status-row .hud-weapon-cluster {
  pointer-events: auto;
  cursor: pointer;
  padding: 4px 2px;
  border-radius: 6px;
  transition: background 0.12s ease;
}

body.bug-out-touch-game .hud-status-row .hud-weapon-cluster:active {
  background: rgba(255, 255, 255, 0.06);
}

body.bug-out-touch-game .hud-bottom {
  display: contents;
}

body.bug-out-touch-game .hud-bottom-balance {
  display: none;
}

body.bug-out-touch-game .hud-inv-stack {
  max-width: 100%;
}

body.bug-out-touch-game .hud-top {
  grid-template-columns: minmax(72px, 1fr) minmax(160px, 2fr) minmax(72px, 1fr);
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

body.bug-out-touch-game .hud-top-mid {
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

body.bug-out-touch-game .hud-status-row {
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px 10px;
  min-width: 0;
}

body.bug-out-touch-game .hud-status-row>.health-wrap {
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
}

body.bug-out-touch-game .prep-info {
  pointer-events: auto;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  left: 0;
  right: 0;
  top: 0;
  transform: none;
  width: auto;
  max-width: none;
  margin-left: calc(-1 * max(10px, env(safe-area-inset-left, 0px)));
  margin-right: calc(-1 * max(10px, env(safe-area-inset-right, 0px)));
  margin-top: calc(-1 * max(6px, env(safe-area-inset-top, 0px)));
  padding: max(10px, env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px)) 12px max(14px, env(safe-area-inset-left, 0px));
  gap: 8px;
  border-radius: 0 0 10px 10px;
  border-top: none;
  box-sizing: border-box;
  text-align: center;
}

body.bug-out-touch-game .prep-info:active {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(147, 226, 168, 0.35);
}

body.bug-out-touch-game .prep-title {
  font-size: clamp(12px, 3.2vw, 16px);
  letter-spacing: 0.18em;
}

body.bug-out-touch-game .prep-timer {
  font-size: clamp(26px, 7.5vw, 34px);
  line-height: 1.1;
}

body.bug-out-touch-game .prep-hint {
  font-size: 12px;
  letter-spacing: 0.06em;
}

body.bug-out-touch-game .round-label {
  font-size: clamp(15px, 3.6vw, 22px);
  letter-spacing: 0.12em;
}

body.bug-out-touch-game .hud-score-plain {
  font-size: 13px;
}

body.bug-out-touch-game .hud-weapon-ammo-row {
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  min-width: 0;
}

body.bug-out-touch-game .ammo-mag {
  font-size: clamp(26px, 7vw, 40px);
}

body.bug-out-touch-game .ammo-reserve {
  font-size: clamp(12px, 3.2vw, 18px);
}

body.bug-out-touch-game .hud-weapon-icon {
  width: min(92px, 22vw);
  height: auto;
}

body.bug-out-touch-game .hud-thrown-count {
  font-size: 15px;
}

body.bug-out-touch-game .mc-hotbar-frame {
  padding: 5px 7px;
  gap: 4px;
}

body.bug-out-touch-game .hud-weapon-cluster {
  max-width: min(48vw, 220px);
  align-items: flex-end;
  flex-shrink: 0;
}

.hud-weapon-cluster {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.hud-weapon-ammo-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.ammo-weapon-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.hud-thrown-stats {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  line-height: 1;
}

.hud-thrown-pair {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.hud-thrown-icon {
  display: block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.hud-thrown-icon--grenade {
  background: #4a7a3a;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
}

.hud-thrown-icon--molotov {
  background: linear-gradient(165deg, rgba(255, 200, 90, 0.95) 0%, rgba(200, 90, 30, 0.9) 100%);
  border: 1px solid rgba(120, 40, 10, 0.85);
  border-radius: 3px 3px 5px 5px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 0 0 1px rgba(0, 0, 0, 0.35);
}

.hud-thrown-count {
  font-size: 18px;
  font-weight: 600;
  color: #ece8e0;
  font-variant-numeric: tabular-nums;
  min-width: 1.1ch;
  text-align: right;
}

.hud-weapon-icon {
  display: block;
  flex-shrink: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}

/* health */
.hud-perk-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
  min-height: 0;
}

.hud-perk-square {
  display: block;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.38);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.45),
    0 1px 2px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
  border-radius: 1px;
}

.health-wrap {
  width: 240px;
}

.health-wrap--above-inv {
  width: 100%;
  max-width: 300px;
  margin: 0 0 4px;
  text-align: left;
  align-self: flex-start;
}

.health-meta-row {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  width: 100%;
  margin-top: 4px;
  gap: 8px;
  min-width: 0;
}

.health-wrap--above-inv .health-meta-row .label {
  margin-bottom: 0;
  text-align: left;
  flex-shrink: 0;
}

.health-wrap--above-inv .health-meta-row .bar-text {
  margin-top: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.label {
  font-size: 11px;
  letter-spacing: 2px;
  color: #d2cfc6;
  margin-bottom: 4px;
  opacity: 0.85;
}

.bar {
  width: 100%;
  height: 14px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 2px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 100%;
  transition: width 0.18s ease-out, background 0.18s;
}

.bar-fill.health {
  background: linear-gradient(90deg, #ff4f4f 0%, #ff8855 100%);
  box-shadow: inset 0 0 12px rgba(255, 80, 80, 0.4);
}

.bar-text {
  margin-top: 2px;
  font-size: 12px;
  color: #f4f1ea;
}

/* round */
.round-label {
  font-size: 28px;
  letter-spacing: 6px;
  font-weight: bold;
  color: #f6e7b1;
  text-shadow: 0 0 14px rgba(246, 215, 140, 0.45), 0 2px 4px rgba(0, 0, 0, 0.85);
}

/* ammo */
.ammo-wrap {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 8px;
}

.ammo-mag {
  font-size: 50px;
  font-weight: bold;
  color: #ffe580;
  line-height: 1;
}

.ammo-reserve {
  font-size: 24px;
  color: #aaa291;
}

.reloading {
  margin-top: 4px;
  font-size: 14px;
  color: #ff9e6e;
  letter-spacing: 2px;
  animation: pulse 0.8s infinite alternate ease-in-out;
}

@keyframes pulse {
  from {
    opacity: 0.5;
  }

  to {
    opacity: 1;
  }
}

/* Inventory: 5 fixed square slots (Minecraft-style); empty cells stay visible */
.mc-hotbar {
  pointer-events: none;
}

.mc-hotbar-frame {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(6, 6, 8, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 2px;
}

/* Weapon hotbar (desktop): Minecraft-style slots + number keys — hidden during touch HUD.
   Parent `.hud-bottom` alone uses margin-top:auto so health+ammo stay above this row at screen bottom. */
.weapon-hotbar-row {
  align-self: center;
  pointer-events: auto;
  padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
}

.weapon-hotbar {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 8px 10px;
  background: rgba(8, 8, 12, 0.72);
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 3px;
  box-shadow:
    inset 0 -3px 0 rgba(0, 0, 0, 0.45),
    0 4px 14px rgba(0, 0, 0, 0.55);
}

.weapon-hotbar__slot {
  position: relative;
  flex: 0 0 auto;
  width: 52px;
  min-height: 56px;
  padding: 4px 3px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.42);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

.weapon-hotbar__slot:focus-visible {
  outline: 2px solid #ffe580;
  outline-offset: 2px;
}

.weapon-hotbar__slot--active {
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.18),
    0 0 0 2px rgba(255, 229, 128, 0.35);
}

.weapon-hotbar__slot--locked {
  opacity: 0.48;
  cursor: not-allowed;
}

.weapon-hotbar__key {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1;
}

.weapon-hotbar__slot--empty {
  opacity: 0.42;
  cursor: default;
}

.weapon-hotbar__slot--empty .weapon-hotbar__icon {
  opacity: 0;
}

.weapon-hotbar__slot--empty .weapon-hotbar__key {
  color: rgba(255, 255, 255, 0.35);
}

.weapon-hotbar__icon {
  display: block;
  width: 40px;
  height: 28px;
  image-rendering: pixelated;
}

.weapon-hotbar__name {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.05;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mc-slot--square {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  padding: 0;
  display: block;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.42);
  border: 2px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45);
  border-radius: 1px;
}

.mc-slot--empty {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.mc-slot--empty::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: 1px;
  pointer-events: none;
}

.mc-slot-inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mc-slot--square .mc-slot-icon {
  display: block;
  width: 20px;
  height: 20px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 0;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
  opacity: 0.38;
  transition: opacity 0.12s ease-out;
}

.mc-slot--square.mc-slot--has-items .mc-slot-icon {
  opacity: 1;
}

.mc-slot-icon--scrap {
  background: #9a8a68;
}

.mc-slot-icon--parts {
  background: #5a9890;
}

.mc-slot--square .mc-slot-count {
  position: absolute;
  right: 3px;
  bottom: 2px;
  min-width: 0.6em;
  text-align: right;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  color: #f4f0e6;
  text-shadow: 0 0 2px #000, 0 1px 2px rgba(0, 0, 0, 0.9);
  font-variant-numeric: tabular-nums;
  z-index: 1;
  pointer-events: none;
}

.mc-slot--square:not(.mc-slot--has-items) .mc-slot-count {
  color: rgba(200, 196, 188, 0.55);
}

.hud-inv-trap-hint {
  margin: 0;
  width: 100%;
  text-align: left;
  font-size: 10px;
  font-weight: normal;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(122, 154, 138, 0.95);
  line-height: 1.35;
  pointer-events: none;
}

.hud-inv-trap-hint .hotkey-pill {
  font-size: 9px;
  margin: 0 3px 0 0;
  vertical-align: 0.1em;
}

.hud-inv-trap-hint--weapon {
  margin-top: 6px;
  text-align: right;
}

.hud-inv-trap-hint--weapon .hotkey-pill {
  margin: 0 3px 0 0;
}

/* trap select */
.trap-select {
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(0, 0, 0, 0.45);
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.trap-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 10px;
  min-width: 64px;
  border-radius: 3px;
  font-size: 11px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
}

.trap-slot.active {
  border-color: #ffe580;
  background: rgba(246, 215, 140, 0.12);
  box-shadow: 0 0 8px rgba(246, 215, 140, 0.25);
}

.trap-slot .key {
  font-weight: bold;
  font-size: 14px;
  color: #ffe580;
}

.trap-slot .name {
  color: #f4f1ea;
}

.trap-slot .cost {
  color: #aaa291;
  font-size: 10px;
}

.trap-select .hint {
  font-size: 11px;
  color: #aaa291;
  margin-left: 4px;
  letter-spacing: 1px;
}

/* prep info — centered overlay at top (does not shift score / depth row) */
.prep-info {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.45);
  padding: 18px 32px 20px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  width: auto;
  max-width: min(92vw, 520px);
  box-sizing: border-box;
  pointer-events: none;
  flex-shrink: 0;
}

.prep-title {
  font-size: 18px;
  letter-spacing: 5px;
  color: #93e2a8;
  font-weight: 600;
}

.prep-timer {
  font-size: 40px;
  font-weight: bold;
  color: #f4f1ea;
  line-height: 1.05;
  letter-spacing: 0.04em;
}

.prep-hint {
  font-size: 16px;
  color: #aaa291;
  letter-spacing: 1.5px;
}

/* floating layer */
.floating-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Rare dig kiosk — viewport-centered prompt above character */
.ammo-depot-hint {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, calc(-100% - 64px));
  z-index: 6;
  pointer-events: none;
  max-width: min(92vw, 440px);
  padding: 0 12px;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: #ece8df;
  line-height: 1.45;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
}

.ammo-depot-hint__gun-name {
  font-weight: 600;
}

.ammo-depot-hint .hotkey-pill {
  vertical-align: 0.1em;
}

.ammo-depot-hint__cost {
  opacity: 0.9;
}

/* ================== Overlays ================== */
.overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(20, 16, 16, 0.85) 0%, rgba(8, 6, 8, 0.96) 100%);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  animation: fadeIn 0.3s ease-out;
}

/* Above in-game mobile-controls (z-index 20) and other HUD chrome */
#pause.overlay {
  z-index: 35;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ----- Title screen (main menu): hierarchy + gestalt grouping ----- */
/* Row flex: one column, full height so tactical line can sit on bottom; content cluster centered in flex child */
.title-screen-overlay {
  align-items: stretch;
  justify-content: center;
  padding: 0;
  overflow-y: auto;
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(120, 40, 35, 0.45) 0%, transparent 55%),
    radial-gradient(ellipse 90% 60% at 50% 120%, rgba(40, 90, 55, 0.35) 0%, transparent 50%),
    linear-gradient(165deg, rgba(12, 10, 14, 0.97) 0%, rgba(18, 14, 22, 0.98) 45%, rgba(8, 14, 12, 0.99) 100%);
  box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.5);
}

/* Full-bleed scanlines; sits behind .title-screen content */
.title-screen__atmosphere {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 100%;
  overflow: hidden;
  border-radius: 0;
  background:
    repeating-linear-gradient(0deg,
      transparent 0,
      transparent 2px,
      rgba(0, 0, 0, 0.22) 2px,
      rgba(0, 0, 0, 0.22) 3px),
    repeating-linear-gradient(0deg,
      rgba(255, 255, 255, 0) 0,
      rgba(255, 255, 255, 0) 2px,
      rgba(255, 255, 255, 0.04) 2px,
      rgba(255, 255, 255, 0.04) 3px);
  pointer-events: none;
  opacity: 0.88;
  z-index: 0;
  animation: title-atmo-flicker 3.2s ease-in-out infinite;
}

/* Subtle green phosphor wash + drift */
.title-screen__atmosphere::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 90% 55% at 50% 45%, rgba(50, 110, 75, 0.09) 0%, transparent 55%);
  animation: title-atmo-vignette 6.5s ease-in-out infinite;
  pointer-events: none;
}

/* Single CRT “refresh” band (military green-tinted) */
.title-screen__atmosphere::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -20%;
  height: 32%;
  background: linear-gradient(180deg,
      transparent 0%,
      rgba(100, 200, 130, 0.045) 45%,
      rgba(100, 200, 130, 0.09) 50%,
      rgba(100, 200, 130, 0.045) 55%,
      transparent 100%);
  pointer-events: none;
  animation: title-crt-sweep 5.2s ease-in-out infinite;
}

@keyframes title-atmo-flicker {

  0%,
  100% {
    opacity: 0.78;
  }

  5% {
    opacity: 0.9;
  }

  6% {
    opacity: 0.75;
  }

  48% {
    opacity: 0.86;
  }

  52% {
    opacity: 0.72;
  }

  90% {
    opacity: 0.84;
  }
}

@keyframes title-atmo-vignette {

  0%,
  100% {
    opacity: 0.85;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.04);
  }
}

@keyframes title-crt-sweep {
  0% {
    transform: translateY(-30%);
  }

  100% {
    transform: translateY(420%);
  }
}

@keyframes title-boot-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes title-sys-line {

  0%,
  100% {
    opacity: 0.78;
  }

  50% {
    opacity: 1;
  }
}

@keyframes title-eyebrow-flicker {

  0%,
  100% {
    opacity: 0.95;
  }

  6% {
    opacity: 0.8;
  }

  7% {
    opacity: 0.95;
  }

  63% {
    opacity: 0.9;
  }

  64% {
    opacity: 0.97;
  }

  90% {
    opacity: 0.88;
  }

  91% {
    opacity: 0.95;
  }
}

@keyframes title-prompt-dim {

  0%,
  100% {
    opacity: 0.9;
  }

  50% {
    opacity: 0.5;
  }
}

@keyframes title-cursor-blink {

  0%,
  48% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0;
  }
}

@keyframes title-bug-amber {

  0%,
  100% {
    text-shadow:
      0 0 32px rgba(246, 215, 140, 0.22),
      0 4px 20px rgba(0, 0, 0, 0.85);
  }

  50% {
    text-shadow:
      0 0 48px rgba(255, 220, 150, 0.38),
      0 0 2px rgba(200, 180, 120, 0.25),
      0 4px 20px rgba(0, 0, 0, 0.85);
  }
}

@keyframes title-out-pulse {

  0%,
  100% {
    filter: drop-shadow(0 0 22px rgba(147, 226, 168, 0.38));
  }

  50% {
    filter: drop-shadow(0 0 42px rgba(147, 226, 168, 0.78)) drop-shadow(0 0 1px rgba(200, 255, 200, 0.5));
  }
}

/* Fallback when gradient text (filter pulse) is unavailable */
@keyframes title-out-pulse-text {

  0%,
  100% {
    text-shadow: 0 0 32px rgba(147, 226, 168, 0.45);
  }

  50% {
    text-shadow:
      0 0 50px rgba(147, 226, 168, 0.78),
      0 0 3px rgba(200, 255, 200, 0.45);
  }
}

@keyframes title-tagline-crt {

  0%,
  100% {
    color: #b8b0a4;
    text-shadow: none;
  }

  50% {
    color: #c4bca2;
    text-shadow: 0 0 12px rgba(150, 180, 150, 0.12);
  }
}

@keyframes title-rule-breathe {

  0%,
  100% {
    transform: scaleX(1);
    opacity: 1;
  }

  50% {
    transform: scaleX(1.08);
    box-shadow: 0 0 8px rgba(120, 200, 140, 0.35);
  }
}

/* Extra glow on the primary CTA — hazmat yellow (matches player suit #e8d030 / #b8a018) */
@keyframes title-btn-hazmat {

  0%,
  100% {
    box-shadow:
      0 6px 18px rgba(0, 0, 0, 0.5),
      inset 0 1px 0 rgba(255, 255, 255, 0.35),
      0 0 0 0 rgba(220, 180, 48, 0);
  }

  50% {
    box-shadow:
      0 6px 18px rgba(0, 0, 0, 0.5),
      inset 0 1px 0 rgba(255, 255, 255, 0.35),
      0 0 22px rgba(240, 200, 64, 0.45);
  }
}

@keyframes title-ref-glow {

  0%,
  100% {
    border-color: rgba(147, 226, 168, 0.22);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }

  50% {
    border-color: rgba(120, 200, 150, 0.55);
    box-shadow: 0 0 16px rgba(60, 140, 100, 0.22);
  }
}

@media (prefers-reduced-motion: reduce) {

  .title-screen__atmosphere,
  .title-screen__atmosphere::before,
  .title-screen__atmosphere::after,
  .title-screen__sys,
  .title-screen__hero--terminal .title-screen__eyebrow,
  .title-screen__prompt,
  .title-screen__cursor,
  .title-screen__hero--terminal .title-screen__mark-bug,
  .title-screen__hero--terminal .title-screen__mark-out,
  .title-screen__hero--terminal .title-screen__promise,
  .title-screen__hero--terminal .title-screen__rule,
  .title-screen__start,
  .title-screen__ref-btn {
    animation: none !important;
  }

  .title-screen__hero--terminal .title-screen__mark,
  .title-screen__hero--terminal .title-screen__promise,
  .title-screen__start,
  .title-screen__sys,
  .title-screen__hero--terminal .title-screen__eyebrow,
  .title-screen__hero--terminal+.title-screen__cta .title-screen__cta-sub {
    animation: title-boot-in 0.4s ease-out both !important;
  }

  .title-screen__ref-btn {
    animation: title-boot-in 0.4s ease-out 0.2s both !important;
  }
}

.title-screen {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 820px);
  max-width: 820px;
  min-height: 100%;
  flex: 0 1 auto;
  margin: 0 auto;
  padding: clamp(16px, 4vh, 48px) clamp(12px, 3vw, 28px) clamp(12px, 2.5vh, 24px);
  box-sizing: border-box;
  align-self: stretch;
}

/* Hero + CTA + how-to: vertically centered in remaining space */
.title-screen__center {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 0;
  width: 100%;
}

.title-screen__hero {
  position: relative;
  z-index: 1;
  text-align: center;
  margin-bottom: clamp(20px, 4vh, 36px);
}

/* Bottom strip: high score in title column; How to play + copyright positioned per breakpoint */
.title-screen__bottom {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  margin-top: auto;
  border-top: 1px solid rgba(100, 180, 130, 0.12);
  padding-top: 12px;
  gap: 10px;
}

/* High score row (centered in the title column on desktop) */
.title-screen__bottom-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

/* Viewport bottom-left — clear of centered high-score line */
.title-screen__copyright {
  margin: 0;
  min-width: 0;
  font-size: 9px;
  font-weight: normal;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(118, 112, 108, 0.88);
  text-shadow: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: fixed;
  left: max(12px, env(safe-area-inset-left, 0px));
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  z-index: 3;
  max-width: min(42vw, 280px);
  padding: 0;
  pointer-events: none;
  text-align: left;
}

.title-screen__sys {
  margin: 0;
  flex: 0 0 auto;
  width: auto;
  max-width: min(96vw, 520px);
  text-align: center;
  font-size: 9px;
  font-weight: normal;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(90, 160, 115, 0.85);
  text-shadow: 0 0 10px rgba(100, 200, 130, 0.35);
  padding: 0 0 max(2px, env(safe-area-inset-bottom, 0px));
  border: none;
  animation: title-boot-in 0.85s ease-out both, title-sys-line 3.4s ease-in-out 0.6s infinite;
}

@media (max-width: 640px) {
  .title-screen__copyright {
    position: static;
    max-width: none;
    white-space: normal;
    text-align: center;
    letter-spacing: 0.2em;
    padding-top: 6px;
  }

  .title-screen__footer {
    position: static;
    justify-content: center;
    align-self: center;
    width: 100%;
  }

  .title-screen__bottom {
    gap: 14px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }

  .title-screen__sys {
    padding-bottom: 0;
  }
}

.title-screen__eyebrow {
  font-size: 10px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: #7a9a8a;
  margin: 0 0 14px;
  font-weight: normal;
  opacity: 0.95;
}

.title-screen__hero--terminal .title-screen__eyebrow {
  margin-bottom: 16px;
  text-shadow: 0 0 6px rgba(100, 160, 120, 0.25);
  animation: title-boot-in 0.8s 0.1s ease-out both, title-eyebrow-flicker 2.4s ease-in-out 1s infinite;
}

.title-screen__prompt {
  margin-right: 0.3em;
  color: #5a9070;
  font-weight: bold;
  letter-spacing: 0.02em;
  animation: title-prompt-dim 2.5s ease-in-out infinite;
}

/* Block cursor: solid phosphor block (not hollow / outline-only) */
.title-screen__cursor {
  display: inline-block;
  width: 0.55ch;
  min-width: 4px;
  min-height: 0.95em;
  margin-left: 0.04em;
  vertical-align: -0.1em;
  background: #7bc49a;
  border: none;
  border-radius: 2px;
  box-shadow: 0 0 12px rgba(100, 200, 140, 0.55);
  animation: title-cursor-blink 1.05s step-end infinite;
}

.title-screen__mark {
  margin: 0;
  font-size: clamp(52px, 14vw, 96px);
  font-weight: bold;
  line-height: 0.92;
  letter-spacing: 0.02em;
  color: #f4ecd4;
  text-shadow:
    0 0 40px rgba(246, 215, 140, 0.25),
    0 4px 24px rgba(0, 0, 0, 0.85);
}

.title-screen__hero--terminal .title-screen__mark {
  animation: title-boot-in 0.9s 0.22s ease-out both;
}

.title-screen__hero--terminal .title-screen__mark-bug {
  animation: title-bug-amber 5.5s ease-in-out 1.1s infinite;
}

.title-screen__mark-bug {
  display: inline-block;
  margin-right: 0.08em;
}

.title-screen__mark-out {
  display: inline-block;
  color: #93e2a8;
  text-shadow: 0 0 32px rgba(147, 226, 168, 0.5);
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .title-screen__mark-out {
    background: linear-gradient(135deg, #c8f0a8 0%, #93e2a8 40%, #5a9a6a 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 0 28px rgba(147, 226, 168, 0.45));
  }

  .title-screen__hero--terminal .title-screen__mark-out {
    animation: title-out-pulse 3.3s ease-in-out 0.5s infinite;
  }
}

@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .title-screen__hero--terminal .title-screen__mark-out {
    animation: title-out-pulse-text 3.3s ease-in-out 0.5s infinite;
  }
}

.title-screen__promise {
  margin: clamp(14px, 2.5vh, 22px) auto 0;
  max-width: 28em;
  font-size: clamp(14px, 2.1vw, 17px);
  line-height: 1.45;
  color: #b8b0a4;
  font-style: normal;
  font-weight: normal;
}

.title-screen__hero--terminal .title-screen__promise {
  animation: title-boot-in 0.9s 0.45s ease-out both, title-tagline-crt 4.2s ease-in-out 1.1s infinite;
}

.title-screen__rule {
  width: min(200px, 40%);
  height: 2px;
  margin: clamp(18px, 3vh, 28px) auto 0;
  background: linear-gradient(90deg, transparent, rgba(147, 226, 168, 0.5), transparent);
  border-radius: 1px;
  transform-origin: center;
}

.title-screen__hero--terminal .title-screen__rule {
  animation: title-rule-breathe 3.8s ease-in-out 0.8s infinite;
}

/* CTA: proximity + similarity to one primary action */
.title-screen__cta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  flex: 0 0 auto;
}

.title-screen__start.big-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  /* Wider footprint: compensate for icon vs old text-only bar; match big-btn lateral padding */
  min-width: min(400px, 100%);
  padding: 14px 32px;
  font-size: 17px;
  /* Hazmat suit yellow (same family as procedural player #e8d030 / shading #b8a018) */
  background: linear-gradient(180deg, #f0dc38 0%, #e8d030 38%, #b8a018 92%, #8a7a0a 100%);
  border: 1px solid #fff2a8;
  color: #1a1408;
  text-shadow: 0 1px 0 rgba(255, 255, 240, 0.35);
  animation: title-boot-in 0.75s 0.5s ease-out both, title-btn-hazmat 2.6s ease-in-out 1s infinite;
}

.title-screen__start.big-btn:hover {
  background: linear-gradient(180deg, #f8e860 0%, #efd830 42%, #c8a818 92%, #9a8a12 100%);
  border-color: #fff8d8;
  transform: translateY(-1px);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 0 18px rgba(248, 210, 72, 0.52);
}

.title-screen__start.big-btn:active {
  background: linear-gradient(180deg, #d8c028 0%, #c8a520 55%, #8a7610 100%);
  transform: translateY(1px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.title-screen__start-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  vertical-align: middle;
  object-fit: contain;
  filter: opacity(0.92);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  user-select: none;
  pointer-events: none;
}

.title-screen__cta-sub {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6a6560;
}

.title-screen__hero--terminal+.title-screen__cta .title-screen__cta-sub {
  animation: title-boot-in 0.75s 0.6s ease-out both;
}

/* Key / hotkey callout: title "Enter" style — shared with manual, HUD, modals */
.title-screen__kbd,
.hotkey-pill,
.title-screen__key,
.title-ref-modal__hint kbd {
  display: inline-block;
  margin: 0 2px;
  padding: 2px 8px;
  font-family: inherit;
  font-size: 10px;
  font-weight: normal;
  letter-spacing: 0.08em;
  color: #c4bdb0;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  line-height: 1.25;
  vertical-align: 0.08em;
  box-shadow: none;
  text-shadow: none;
}

/* Pin to viewport bottom-right (not just the centered 820px title column) */
.title-screen__footer {
  position: fixed;
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  z-index: 3;
  margin: 0;
  display: flex;
  justify-content: flex-end;
  width: auto;
  padding: 0;
  flex: none;
  align-self: auto;
  pointer-events: auto;
}

.title-screen__ref-btn {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 10px 22px;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #93e2a8;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(147, 226, 168, 0.25);
  border-radius: 4px;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.2s;
  animation: title-ref-glow 3.4s ease-in-out 0.4s infinite;
}

.title-screen__ref-btn:hover {
  background: rgba(147, 226, 168, 0.1);
  border-color: rgba(147, 226, 168, 0.45);
  color: #b8f0c8;
  box-shadow: 0 0 18px rgba(80, 180, 120, 0.22);
  animation: none;
}

/* Title screen: quick reference modal */
.title-ref-modal {
  position: fixed;
  inset: 0;
  z-index: 11;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: auto;
}

.title-ref-modal.hidden {
  display: none !important;
}

.title-ref-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 4, 8, 0.72);
  backdrop-filter: blur(2px);
}

.title-ref-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 600px;
  max-height: min(88vh, 720px);
  overflow: auto;
  padding: 20px 22px 16px;
  background: rgba(22, 18, 20, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.85), 0 0 60px rgba(120, 60, 40, 0.15);
}

.title-ref-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.title-ref-modal__title {
  margin: 0;
  font-size: 13px;
  font-weight: normal;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #93e2a8;
}

.title-ref-modal__close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  font-size: 22px;
  line-height: 1;
  color: #aaa291;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  cursor: pointer;
  pointer-events: auto;
  transition: color 0.12s, background 0.12s;
}

.title-ref-modal__close:hover {
  color: #f4f1ea;
  background: rgba(255, 80, 80, 0.2);
  border-color: rgba(255, 120, 120, 0.3);
}

.title-ref-modal__close:focus-visible {
  outline: 2px solid rgba(240, 210, 140, 0.9);
  outline-offset: 2px;
}

.title-ref-modal__hint {
  margin: 14px 0 0;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-align: center;
  color: #5a5850;
}

.title-screen__manual--modal {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

/* Reference: common region (closure) + chunked grid (proximity) */
.title-screen__manual {
  position: relative;
  z-index: 1;
  padding: 18px 20px 20px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.title-screen__manual-heading {
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: normal;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #93e2a8;
  text-align: center;
}

.title-screen__manual-lede {
  margin: 0 0 18px;
  font-size: 12px;
  line-height: 1.55;
  color: #b0aaa0;
  text-align: left;
}

.title-screen__manual-lede p+p {
  margin-top: 0.75em;
}

/* How-to modal: one column, spaced sections, list rows with dividers */
.title-screen__manual--modal .title-screen__manual-lede {
  margin-bottom: 24px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.title-screen__manual-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.title-screen__manual--modal .title-screen__chunk {
  padding: 20px 0 6px;
  background: transparent;
  border: none;
  border-radius: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.title-screen__manual--modal .title-screen__manual-grid>.title-screen__chunk:first-of-type {
  border-top: none;
  padding-top: 0;
}

.title-screen__manual--modal .title-screen__chunk-title {
  margin: 0 0 12px;
  letter-spacing: 0.22em;
}

.title-screen__manual--modal .title-screen__list {
  line-height: 1.5;
}

.title-screen__manual--modal .title-screen__list li {
  margin: 0;
  padding: 10px 0 10px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.title-screen__manual--modal .title-screen__list li:last-child {
  border-bottom: none;
  padding-bottom: 2px;
}

/* Chunks: card style for reuse; modal strips chrome via rules above + higher specificity */
.title-screen__chunk {
  padding: 12px 14px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.title-screen__manual--modal .title-screen__list li+li {
  margin-top: 0;
}

.title-screen__chunk-title {
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #e0d8cc;
  opacity: 0.9;
}

.title-screen__list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  line-height: 1.55;
  color: #c8c2b6;
}

.title-screen__list li+li {
  margin-top: 4px;
}

.menu-card {
  background: rgba(28, 22, 22, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 36px 48px;
  border-radius: 6px;
  text-align: center;
  max-width: 540px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 80px rgba(120, 40, 40, 0.25);
}

.menu-card h1 {
  font-size: 48px;
  letter-spacing: 8px;
  color: #f6e7b1;
  margin-bottom: 4px;
  text-shadow: 0 0 20px rgba(246, 215, 140, 0.4);
}

.menu-card h1.dead {
  color: #ff5555;
  text-shadow: 0 0 20px rgba(255, 80, 80, 0.4);
}

.menu-card h2 {
  font-size: 16px;
  letter-spacing: 4px;
  color: #cfc8b8;
  margin-bottom: 12px;
  font-weight: normal;
}

.menu-card .tagline {
  font-size: 13px;
  color: #aaa291;
  margin-bottom: 24px;
  font-style: italic;
}

.menu-card .controls {
  text-align: left;
  margin-bottom: 24px;
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 4px;
}

.menu-card .controls h3 {
  font-size: 12px;
  letter-spacing: 3px;
  color: #93e2a8;
  margin-bottom: 8px;
}

.menu-card .controls ul {
  list-style: none;
  font-size: 12px;
  color: #d2cfc6;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
}

.menu-card .controls b {
  color: #ffe580;
}

.big-btn {
  /* WebKit/Safari: native button chrome can hide gradients while children (e.g. img) still show. */
  appearance: none;
  -webkit-appearance: none;
  background: linear-gradient(180deg, #c8965a, #8a6435);
  color: #1a120c;
  border: 1px solid #ffd99b;
  font-family: inherit;
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 4px;
  padding: 12px 32px;
  cursor: pointer;
  border-radius: 3px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.08s, box-shadow 0.15s;
}

.big-btn:focus {
  outline: none;
}

.big-btn:focus-visible {
  outline: 2px solid rgba(240, 220, 72, 0.95);
  outline-offset: 3px;
}

.big-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 0 14px rgba(255, 200, 120, 0.4);
}

.big-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.big-btn--secondary {
  background: transparent;
  color: #e8e4dc;
  border: 2px solid rgba(255, 217, 155, 0.45);
  box-shadow: none;
}

.big-btn--secondary:hover {
  box-shadow: 0 0 14px rgba(255, 200, 120, 0.28);
}

.game-over-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.pause-card p {
  margin: 0 0 18px;
  color: #c8c4b8;
  font-size: 14px;
  letter-spacing: 0.06em;
}

.pause-resume-btn {
  width: 100%;
  margin: 0 0 16px;
  border-color: rgba(147, 226, 168, 0.45);
  color: #c8f0d8;
  letter-spacing: 0.12em;
}

.pause-resume-btn:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 0 16px rgba(100, 180, 120, 0.2);
}

.pause-resume-btn:focus-visible {
  outline: 2px solid rgba(147, 226, 168, 0.9);
  outline-offset: 3px;
}

.pause-card kbd {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.9em;
  font-family: inherit;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

.pause-quit-btn {
  background: linear-gradient(180deg, #4a4550, #2e2a32);
  color: #e8e4dc;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  letter-spacing: 0.12em;
  font-size: 15px;
}

.pause-quit-btn:hover {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 0 12px rgba(180, 180, 200, 0.25);
}

.pause-quit-btn:focus-visible {
  outline: 2px solid rgba(220, 216, 238, 0.85);
  outline-offset: 3px;
}

/* game over stats */
.stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 24px 0;
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 4px;
}

.stat {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #d2cfc6;
}

.stat b {
  color: #f4f1ea;
}

.stat.final {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 8px;
  margin-top: 4px;
  font-size: 16px;
}

.stat.final b {
  color: #f6e7b1;
  font-size: 20px;
}

/* floating text animation */
.floating-text {
  position: absolute;
  font-size: 14px;
  font-weight: bold;
  color: #ffe580;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.95);
  pointer-events: none;
  animation: floatUp 1.2s ease-out forwards;
  white-space: nowrap;
}

@keyframes floatUp {
  0% {
    transform: translateY(0);
    opacity: 1;
  }

  100% {
    transform: translateY(-40px);
    opacity: 0;
  }
}

.floating-text.health {
  color: #93e2a8;
}

.floating-text.ammo {
  color: #ffe580;
}

.floating-text.scrap {
  color: #c8b88c;
}

.floating-text.parts {
  color: #80b8b0;
}

.floating-text.pickaxe {
  color: #ff9e6e;
  font-size: 18px;
}

/* Pickaxe unlock popup */
.pickaxe-unlock-overlay {
  z-index: 12;
  background: radial-gradient(ellipse at center, rgba(32, 28, 18, 0.88) 0%, rgba(8, 8, 6, 0.96) 100%);
}

.pickaxe-unlock-card {
  max-width: 480px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 100px rgba(200, 140, 50, 0.22);
  border-color: rgba(200, 160, 90, 0.25);
}

.pickaxe-unlock-h1 {
  color: #e8b860 !important;
  text-shadow: 0 0 24px rgba(232, 184, 96, 0.45) !important;
  margin-bottom: 0 !important;
  font-size: 42px !important;
  letter-spacing: 12px !important;
}

.pickaxe-unlock-sub {
  font-size: 11px;
  letter-spacing: 6px;
  color: #9a8a60;
  margin: 0 0 20px 0;
}

.pickaxe-unlock-body {
  font-size: 13px;
  line-height: 1.5;
  color: #c8c0b0;
  text-align: left;
  margin: 0 0 22px 0;
}

.pickaxe-unlock-body b {
  color: #e8c878;
  font-weight: 600;
}

.pickaxe-unlock-body .hotkey-pill {
  vertical-align: 0.1em;
}

.pickaxe-unlock-keys {
  font-size: 10px;
  letter-spacing: 2px;
  color: #6a6a5a;
  margin: 10px 0 0 0;
}

/* ================== Weapon select overlay ================== */
.weapon-overlay {
  background: radial-gradient(ellipse at center, rgba(20, 16, 16, 0.78) 0%, rgba(8, 6, 8, 0.92) 100%);
}

.weapon-card-wrap {
  background: rgba(28, 22, 22, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 28px 36px;
  border-radius: 6px;
  text-align: center;
  max-width: 880px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 80px rgba(120, 80, 40, 0.25);
}

.weapon-card-wrap h2 {
  font-size: 22px;
  letter-spacing: 8px;
  color: #f6e7b1;
  margin-bottom: 18px;
  text-shadow: 0 0 14px rgba(246, 215, 140, 0.35);
}

.weapon-grid {
  display: grid;
  grid-template-columns: repeat(4, 180px);
  gap: 12px;
  justify-content: center;
}

.weapon-card {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 4px;
  padding: 12px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.08s, border-color 0.15s, box-shadow 0.15s, background 0.15s;
  position: relative;
}

.weapon-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 229, 128, 0.5);
  background: rgba(40, 32, 24, 0.6);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5), 0 0 14px rgba(255, 200, 120, 0.2);
}

.weapon-card:focus {
  outline: none;
}

.weapon-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(255, 229, 128, 0.55);
  outline: 2px solid rgba(255, 229, 128, 0.75);
  outline-offset: 2px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.52), 0 0 18px rgba(255, 200, 120, 0.28);
}

.weapon-card.weapon-card--locked {
  opacity: 0.48;
  pointer-events: none;
  filter: grayscale(0.5);
}

.weapon-card.active {
  border-color: #ffe580;
  background: rgba(70, 52, 28, 0.55);
  box-shadow: 0 0 18px rgba(255, 229, 128, 0.35), inset 0 0 14px rgba(255, 229, 128, 0.12);
}

.weapon-card.active::before {
  content: "EQUIPPED";
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 9px;
  letter-spacing: 2px;
  color: #ffe580;
}

.weapon-card .wkey {
  display: inline-block;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  border: 1px solid rgba(255, 229, 128, 0.6);
  background: rgba(255, 229, 128, 0.12);
  color: #ffe580;
  border-radius: 3px;
  font-weight: bold;
  font-size: 13px;
  margin-bottom: 6px;
}

.weapon-card .wname {
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 2px;
  color: #f4f1ea;
  margin-bottom: 4px;
}

.weapon-card .wdesc {
  font-size: 11px;
  color: #aaa291;
  margin-bottom: 8px;
  min-height: 30px;
  line-height: 1.3;
}

.weapon-card .wstats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 8px;
  font-size: 11px;
  color: #d2cfc6;
}

.weapon-card .wstats span {
  color: #aaa291;
}

.weapon-card .wstats b {
  color: #f4f1ea;
  font-weight: normal;
}

.weapon-hint {
  margin-top: 18px;
  font-size: 12px;
  line-height: 1.5;
  color: #aaa291;
  letter-spacing: 1px;
}

.weapon-hint .hotkey-pill {
  font-size: 10px;
  margin: 0 1px;
  vertical-align: 0.12em;
}

/* Coarse pointers (phones / tablets): weapon list scrolls, full-width rows, no stat grid or number keys */
@media (hover: none) and (pointer: coarse) {
  .weapon-overlay {
    align-items: flex-start;
    justify-content: flex-start;
    padding: max(10px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .weapon-card-wrap {
    width: 100%;
    max-width: min(520px, 100%);
    margin: 0 auto 24px;
    padding: 16px 14px 20px;
    box-sizing: border-box;
  }

  .weapon-card-wrap h2 {
    font-size: clamp(14px, 4vw, 18px);
    letter-spacing: 0.18em;
    margin-bottom: 14px;
  }

  .weapon-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: none;
    justify-content: flex-start;
  }

  .weapon-card {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 16px;
    text-align: left;
  }

  .weapon-card .wkey,
  .weapon-card .wstats {
    display: none !important;
  }

  .weapon-card .wname {
    font-size: clamp(15px, 4vw, 17px);
    margin-bottom: 6px;
  }

  .weapon-card .wdesc {
    min-height: 0;
    margin-bottom: 0;
    font-size: 12px;
    line-height: 1.35;
  }

  .weapon-card.active::before {
    top: 10px;
    right: 12px;
  }
}

/* ================== Multiplayer lobby (Phase 2) ================== */
.title-screen__mp-label {
  margin-top: 1.25rem;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6a7568;
}

.title-screen__mp-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
}

.title-screen__mp-btn {
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 10px 16px;
  color: #b8f0c8;
  background: rgba(40, 90, 55, 0.25);
  border: 1px solid rgba(120, 200, 140, 0.35);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.title-screen__mp-btn:hover {
  background: rgba(50, 110, 70, 0.4);
  border-color: rgba(140, 220, 160, 0.5);
}

.title-screen__mp-btn:focus-visible {
  outline: 2px solid rgba(200, 248, 214, 0.85);
  outline-offset: 3px;
}

.title-screen__ref-btn:focus-visible {
  outline: 2px solid rgba(180, 238, 195, 0.75);
  outline-offset: 3px;
}

.title-screen__inputpref {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-top: 1.35rem;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

.title-screen__inputpref-label,
.pause-inputpref-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #7a8378;
}

.title-screen__inputpref-select {
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  color: #dfe8dc;
  background: rgba(18, 22, 20, 0.92);
  border: 1px solid rgba(120, 200, 140, 0.28);
  border-radius: 4px;
}

.title-screen__inputpref-select:focus-visible {
  outline: 2px solid rgba(180, 248, 200, 0.45);
  outline-offset: 2px;
}

.title-screen__inputpref-hint {
  font-size: 11px;
  line-height: 1.35;
  color: #5f675e;
}

.pause-inputpref-label {
  display: block;
  margin-top: 12px;
  margin-bottom: 4px;
}

.pause-inputpref-select {
  width: 100%;
  margin-bottom: 8px;
}

.pause-inputpref-select:focus-visible {
  outline: 2px solid rgba(180, 248, 200, 0.45);
  outline-offset: 2px;
}

.mp-lobby-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(6, 4, 10, 0.82);
  backdrop-filter: blur(3px);
  pointer-events: auto;
}

.mp-lobby-overlay.hidden {
  display: none !important;
}

.mp-lobby-panel {
  width: 100%;
  max-width: 460px;
  max-height: min(90vh, 560px);
  overflow: auto;
  padding: 20px 22px;
  background: rgba(18, 14, 20, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.85);
}

.mp-lobby-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.mp-lobby-roster {
  margin-bottom: 12px;
}

.mp-lobby-roster__row {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
}

.mp-lobby-slot {
  flex: 1;
  min-width: 0;
  max-width: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px 6px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.mp-lobby-slot--joined {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(20, 28, 22, 0.55);
}

.mp-lobby-slot--empty {
  opacity: 0.92;
}

.mp-lobby-slot__figure {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(30px * 2 + 4px);
}

.mp-lobby-slot__canvas {
  display: block;
  margin: 0 auto;
  border-radius: 4px;
  background: rgba(8, 10, 14, 0.65);
}

.mp-lobby-slot__swatch-tag {
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7a8694;
}

.mp-lobby-slot__name {
  font-size: 10px;
  font-weight: 600;
  color: #c8cfc6;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mp-lobby-slot--empty .mp-lobby-slot__name {
  font-weight: 400;
  color: #5a6058;
}

/* Hazmat palettes — match `main.js` MP_SUIT_PALETTES order */
.mp-lobby-slot--palette-1 {
  --suit: #e8d030;
  --shade: #b8a018;
  --deep: #8a7a0a;
}

.mp-lobby-slot--palette-2 {
  --suit: #40d8e8;
  --shade: #2898b0;
  --deep: #187078;
}

.mp-lobby-slot--palette-3 {
  --suit: #e88828;
  --shade: #b86818;
  --deep: #804810;
}

.mp-lobby-slot--palette-4 {
  --suit: #5c6068;
  --shade: #404448;
  --deep: #282c30;
}

.mp-lobby-slot--empty .mp-lobby-slot__canvas {
  opacity: 0.42;
  filter: saturate(0.65);
}

.mp-lobby-slot--joined .mp-lobby-slot__canvas {
  opacity: 1;
  filter: none;
}

.mp-lobby-title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #93e2a8;
}

.mp-lobby-close {
  width: 36px;
  height: 36px;
  font-size: 22px;
  line-height: 1;
  color: #aaa291;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  cursor: pointer;
}

.mp-lobby-close:hover {
  color: #f4f1ea;
  background: rgba(255, 80, 80, 0.2);
}

.mp-lobby-close:focus-visible {
  outline: 2px solid rgba(240, 210, 140, 0.95);
  outline-offset: 2px;
}

.mp-lobby-status {
  font-size: 11px;
  color: #7a8078;
  margin-bottom: 16px;
}

.mp-lobby-section.hidden {
  display: none !important;
}

.mp-lobby-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 11px;
  color: #8a919c;
}

.mp-lobby-field input {
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  color: #e9e6df;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

.mp-lobby-field input:focus-visible {
  outline: 2px solid rgba(147, 226, 168, 0.55);
  outline-offset: 2px;
  border-color: rgba(147, 226, 168, 0.35);
}

.mp-lobby-section .big-btn {
  width: 100%;
  margin-bottom: 10px;
}

.mp-lobby-error {
  font-size: 12px;
  color: #ff8a8a;
  margin-top: 8px;
}

.mp-lobby-error.hidden {
  display: none !important;
}

.mp-lobby-code-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.mp-lobby-code-row .mp-lobby-code {
  margin-bottom: 0;
  flex: 1;
  min-width: 0;
}

.mp-lobby-code {
  font-size: 13px;
  margin-bottom: 8px;
  color: #d2cfc6;
}

.mp-lobby-copy {
  flex-shrink: 0;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 6px 12px;
  color: #1a221c;
  background: #93e2a8;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: filter 0.12s, transform 0.08s;
}

.mp-lobby-copy:hover {
  filter: brightness(1.08);
}

.mp-lobby-copy:focus-visible {
  outline: 2px solid rgba(255, 255, 236, 0.85);
  outline-offset: 2px;
}

.mp-lobby-copy:active {
  transform: scale(0.97);
}

.mp-lobby-copy--done {
  background: #6a9a78;
  color: #e8f5ec;
}

.mp-lobby-code strong {
  letter-spacing: 0.15em;
  color: #b8f0c8;
}

.mp-lobby-cap {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6a7568;
  margin-bottom: 6px;
}

.mp-lobby-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
}

.mp-lobby-player {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
}

.mp-lobby-player:last-child {
  border-bottom: none;
}

.mp-lobby-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mp-lobby-badge {
  font-size: 9px;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  color: #8a919c;
}

.mp-lobby-badge--host {
  color: #b8f0c8;
  border: 1px solid rgba(120, 200, 140, 0.4);
  background: transparent;
}

.mp-lobby-badge--ready {
  color: #8eb8ff;
}

.mp-lobby-ready {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #aaa291;
  cursor: pointer;
}

.mp-lobby-leave {
  margin-top: 12px;
  width: 100%;
}

.mp-lobby-banner {
  margin-top: 14px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.45;
  color: #c8e0d0;
  background: rgba(60, 120, 80, 0.2);
  border: 1px solid rgba(120, 200, 140, 0.25);
  border-radius: 6px;
}

.mp-lobby-banner.hidden {
  display: none !important;
}

/* ----- Touch game overlay (input layer only) ----- */
body.bug-out-touch-game {
  overscroll-behavior: none;
  touch-action: none;
}

.mobile-controls {
  position: fixed;
  inset: 0;
  pointer-events: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  z-index: 20;
}

.mobile-controls.hidden {
  display: none !important;
}

.mobile-control {
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.mobile-controls__left-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
  flex-shrink: 0;
}

.mobile-controls__jump-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  gap: 8px;
  pointer-events: none;
}

.mobile-zoom-btn {
  flex: 0 0 auto;
  width: 58px;
  min-width: 58px;
  max-width: 58px;
  padding-left: 8px;
  padding-right: 8px;
  font-size: 10px;
  letter-spacing: 0.05em;
  box-sizing: border-box;
}

.mobile-jump-wide {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  max-width: none;
  align-self: stretch;
  box-sizing: border-box;
  min-height: 58px;
  padding-top: 13px;
  padding-bottom: 13px;
}

.mobile-controls__inv-slot {
  width: 100%;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.mobile-controls__cluster {
  position: absolute;
  left: max(8px, env(safe-area-inset-left, 0px));
  right: max(8px, env(safe-area-inset-right, 0px));
  bottom: max(4px, env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  pointer-events: none;
  z-index: 1;
}

.mobile-controls__sticks-and-actions {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
  pointer-events: none;
}

.mobile-joystick {
  position: relative;
  left: auto;
  bottom: auto;
  width: 168px;
  height: 168px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(12, 10, 18, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.35);
}

/* Smaller sticks during touch gameplay only (desktop HUD unchanged). */
/* Move ring slightly larger than fire for touch gameplay. */
body.bug-out-touch-game .mobile-joystick--move {
  width: 162px;
  height: 162px;
}

body.bug-out-touch-game .mobile-joystick--fire {
  width: 152px;
  height: 152px;
}

body.bug-out-touch-game .mobile-joystick__knob {
  width: 48px;
  height: 48px;
  margin-left: -24px;
  margin-top: -24px;
}

body.bug-out-touch-game .mobile-joystick--move .mobile-joystick__knob {
  width: 52px;
  height: 52px;
  margin-left: -26px;
  margin-top: -26px;
}

.mobile-controls__right-rail {
  position: relative;
  right: auto;
  bottom: auto;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: max(8px, 2vw);
  pointer-events: none;
  flex-shrink: 0;
}

.mobile-controls__prep-col {
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: flex-end;
  pointer-events: none;
  max-height: min(40vh, 320px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.mobile-controls__prep-col::-webkit-scrollbar {
  display: none;
}

.mobile-controls__aim-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  pointer-events: none;
}

.mobile-controls__aim-stack .mobile-pill-btn {
  width: min(188px, 44vw);
  max-width: 100%;
}

body.bug-out-touch-game .mobile-controls__aim-stack .mobile-pill-btn {
  width: min(152px, 40vw);
}

.mobile-joystick--fire {
  position: relative;
  right: auto;
  bottom: auto;
  width: 188px;
  height: 188px;
  flex-shrink: 0;
  /* Center = same look as move stick; outer band = fire zone (matches MOBILE_FIRE_EDGE). */
  background-color: rgba(12, 10, 18, 0.42);
  background-image: radial-gradient(circle closest-side,
      transparent 0,
      transparent calc(60% - 0.5px),
      rgba(200, 48, 55, 0.78) 60%,
      rgba(120, 28, 38, 0.92) 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.35);
}

.mobile-fire-cap {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 220, 200, 0.55);
  pointer-events: none;
  z-index: 0;
}

.mobile-joystick__knob--fire {
  z-index: 1;
}

.mobile-joystick__knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58px;
  height: 58px;
  margin-left: -29px;
  margin-top: -29px;
  border-radius: 50%;
  background: rgba(240, 230, 210, 0.26);
  border: 1px solid rgba(255, 255, 255, 0.22);
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

.mobile-pill-btn {
  appearance: none;
  -webkit-appearance: none;
  min-height: 44px;
  min-width: 72px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f0ebe0;
  background: rgba(18, 14, 24, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.mobile-pill-btn:active {
  transform: scale(0.97);
}

.mobile-pill-btn--accent {
  border-color: rgba(147, 226, 168, 0.45);
  color: #c8f0d8;
}

.weapon-wheel {
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: auto;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 5, 10, 0.35);
}

.weapon-wheel.hidden {
  display: none !important;
}

.weapon-wheel__ring {
  position: relative;
  width: min(82vw, 360px);
  height: min(82vw, 360px);
}

.weapon-wheel__seg {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 88px;
  margin-left: -44px;
  margin-top: -22px;
  transform: rotate(var(--wheel-rot, 0deg)) translateY(-118px) rotate(calc(-1 * var(--wheel-rot, 0deg)));
  padding: 10px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
  color: #f4f1ea;
  background: rgba(30, 24, 38, 0.88);
  border: 1px solid rgba(255, 229, 128, 0.35);
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.weapon-wheel__seg--locked {
  opacity: 0.45;
  pointer-events: none;
}

.weapon-wheel__cancel {
  position: absolute;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  padding: 12px 20px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #c8c2b6;
  background: rgba(20, 16, 28, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}