/* css/style.css */
/* NYC HUD design system: quiet graphite glass in the corners of the screen, taxi yellow for whatever is active,
   NYC DOT green for street names, so that the city itself stays the star */

:root {
  /* Surfaces */
  --glass: rgba(18, 19, 22, 0.62);
  --glass-strong: rgba(16, 17, 20, 0.88);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-highlight: rgba(255, 255, 255, 0.08);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.045 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --hover: rgba(255, 255, 255, 0.08);
  --divider: rgba(255, 255, 255, 0.1);

  /* Text */
  --text: #f6f5f2;
  --text-2: rgba(246, 245, 242, 0.68);
  --text-3: rgba(246, 245, 242, 0.44);

  /* Accents */
  --taxi: #ffc21a;
  --taxi-ink: #17140a;
  --sign-green: #0b6a46;
  --highway: #c08a3e;
  --ok: #5ee08f;
  --warn: #ffc857;
  --bad: #ff7a6b;

  /* Shape & motion */
  --edge: 20px;
  --bar-h: 50px;
  --r-panel: 16px;
  --r-ctl: 10px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.2);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --font-sign: 'Overpass', 'Inter', 'Helvetica Neue', Arial, sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #0a0b0d;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  overscroll-behavior: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sm {
  width: 14px;
  height: 14px;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 5px;
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

#canvas-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  cursor: grab;
}

#canvas-container:active {
  cursor: grabbing;
}

/* Soft scrims behind the HUD: keep small type legible over a bright midday street */
body::before,
body::after {
  content: '';
  position: fixed;
  left: 0;
  right: 0;
  z-index: 5;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

body::before {
  top: 0;
  height: 120px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0));
}

body::after {
  bottom: 0;
  height: 210px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.36), rgba(0, 0, 0, 0));
}

/* ------------------------------------------------------------------------------------------------------------------
   Glass panel
   ------------------------------------------------------------------------------------------------------------------ */
.panel {
  background: var(--grain), var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-panel);
  box-shadow: inset 0 1px 0 var(--glass-highlight), var(--shadow);
}

/* ------------------------------------------------------------------------------------------------------------------
   Loading screen
   ------------------------------------------------------------------------------------------------------------------ */
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  /* same art as the title screen (already cached by its <img>), dimmed so the loader text reads over it */
  background:
    radial-gradient(60% 45% at 50% 50%, rgba(4, 9, 12, .62) 0%, rgba(4, 9, 12, .28) 100%),
    linear-gradient(0deg, rgba(3, 7, 9, .52), transparent 42%),
    #071016 url('../images/kaiju-home.webp?v=1') 50% 40% / cover no-repeat;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loader-title {
  text-shadow: 0 4px 24px rgba(0, 0, 0, .6);
}

/* hidden behind the title screen until Deploy is pressed (kaiju-launching) or a run is live */
#loading-overlay.hidden,
body:not(.kaiju-active):not(.kaiju-launching) #loading-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* appears at once on Deploy (a fade could stall while the city builds on the main thread); still fades out */
body.kaiju-launching #loading-overlay {
  transition: none;
}

.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: rise-in 0.8s var(--ease-out) both;
}

.loader-title {
  font-size: 34px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.loader-track {
  position: relative;
  width: 240px;
  height: 3px;
  margin: 26px 0 14px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.loader-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--taxi);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

/* While the city is being built (main thread busy) the bar sweeps on the compositor; it fills once shaders compile */
.loader-track.is-indeterminate .loader-fill {
  width: 35%;
  transform: translateX(-100%);
  transition: none;
  animation: loader-sweep 1.5s cubic-bezier(0.45, 0, 0.25, 1) infinite;
  will-change: transform;
}

#loading-status {
  font-size: 12.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.loading-hint {
  max-width: 300px;
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-3);
  opacity: 0.75;
  text-wrap: pretty;
}

@keyframes loader-sweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(290%); }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* Title-screen loading note (#kaiju-boot-note): while the city builds with the title screen and its menus still up
   (body.kaiju-city-loading, until main.js marks it ready); a solo Deploy shows the full loading screen instead. Never
   takes clicks. */
.kaiju-boot-note { position: fixed; top: max(14px, env(safe-area-inset-top)); left: 50%; z-index: 190; width: min(440px, calc(100vw - 28px)); padding: 11px 14px 12px; transform: translateX(-50%); border: 1px solid color-mix(in srgb, var(--warn) 34%, transparent); background: rgba(4, 9, 12, .82); color: rgba(238, 246, 244, .78); font-family: var(--font-sign); pointer-events: none; transition: opacity .6s ease, visibility .6s; }
body:not(.kaiju-city-loading) .kaiju-boot-note, body.kaiju-city-ready .kaiju-boot-note, body.kaiju-launching .kaiju-boot-note, body.kaiju-active .kaiju-boot-note { opacity: 0; visibility: hidden; }
.kaiju-boot-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.kaiju-boot-label { flex: none; color: var(--warn); font-size: 10px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.kaiju-boot-status { min-width: 0; overflow: hidden; font-size: 11px; letter-spacing: .03em; text-align: right; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kaiju-boot-track { position: relative; height: 2px; margin: 8px 0 9px; overflow: hidden; background: rgba(255, 255, 255, .12); }
/* (a transform animation: it keeps sweeping on the compositor while the build holds the main thread) */
.kaiju-boot-track span { position: absolute; inset: 0; width: 35%; background: var(--warn); transform: translateX(-100%); animation: loader-sweep 1.5s cubic-bezier(0.45, 0, 0.25, 1) infinite; will-change: transform; }
.kaiju-boot-copy { font-size: 11.5px; line-height: 1.5; letter-spacing: .02em; text-wrap: pretty; }
@media (prefers-reduced-motion: reduce) { .kaiju-boot-track span { width: 100%; transform: none; animation: none; opacity: .5; } }

/* Kaiju launch screen: a game title card over a living city, not a marketing page. */
.kaiju-home { position: fixed; inset: 0; z-index: 120; overflow: hidden; background: transparent; color: var(--text); transition: opacity 0.6s var(--ease-out), visibility 0.6s; }
.kaiju-home.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.kaiju-home-video, .kaiju-home-shade { position: absolute; inset: 0; width: 100%; height: 100%; }
.kaiju-home-video { display: block; object-fit: cover; object-position: 50% 40%; background: #071016; transition: opacity 1.6s ease; }
/* Live night flythrough (js/home-flythrough.js): the poster cross-fades away once the first shot is on screen; cuts
   between shots fade through black on .kaiju-home-fade */
.kaiju-home.is-live .kaiju-home-video { opacity: 0; }
.kaiju-home-fade { position: absolute; inset: 0; background: #020406; opacity: 0; pointer-events: none; }
.kaiju-home-shade { background: linear-gradient(90deg, rgba(4, 9, 12, .72) 0%, rgba(4, 9, 12, .28) 45%, rgba(4, 9, 12, .03) 100%), linear-gradient(0deg, rgba(3, 7, 9, .52), transparent 42%); pointer-events: none; }
.kaiju-home-inner { position: absolute; left: clamp(20px, 7vw, 112px); right: clamp(20px, 7vw, 112px); bottom: clamp(64px, 13vh, 132px); display: flex; flex-direction: column; align-items: flex-start; max-width: 760px; }
.kaiju-eyebrow { color: var(--warn); font-family: var(--font-sign); font-size: 11px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; }
.kaiju-home h1 { max-width: 100%; color: #eef6f4; font-family: var(--font-sign); font-size: clamp(40px, min(9vw, 15vh), 128px); font-weight: 700; letter-spacing: .02em; line-height: .86; text-wrap: balance; text-shadow: 0 8px 40px rgba(0, 0, 0, .48); }
.kaiju-lede { max-width: 34ch; margin-top: clamp(12px, 2.4vh, 22px); color: rgba(238, 246, 244, .78); font-family: var(--font-sign); font-size: clamp(14px, min(1.6vw, 2.8vh), 19px); line-height: 1.45; letter-spacing: .03em; text-wrap: pretty; }
.kaiju-home .kaiju-lede-cite { margin-top: 6px; color: rgba(238, 246, 244, .6); font-size: clamp(12px, min(1.1vw, 2vh), 14px); }
.kaiju-home .kaiju-launch { margin-top: clamp(16px, 3.6vh, 32px); border-radius: 0; color: var(--warn); background: transparent; }
/* Story Mode | Horde Mode: two equal CTAs side by side (js/game-mode.js) */
.kaiju-home-modes { display: flex; flex-wrap: wrap; gap: 12px; margin-top: clamp(16px, 3.6vh, 32px); }
.kaiju-home-modes .kaiju-launch { margin-top: 0; }
/* Story Mode campaign dialog */
.kaiju-story-card { width: min(620px, 100%); }
.kaiju-story-note { margin-top: 16px; color: rgba(238,246,244,.66); font-size: 13px; line-height: 1.5; }
.kaiju-story-missions { display: grid; gap: 2px; margin-top: 10px; list-style: none; }
.kaiju-story-mission { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 10px; background: rgba(238,246,244,.03); border-left: 2px solid rgba(238,246,244,.12); }
.kaiju-story-mission[data-status="ready"] { border-left-color: var(--warn); }
.kaiju-story-num { color: rgba(238,246,244,.4); font-family: var(--font-sign); font-size: 12px; letter-spacing: .1em; padding-top: 2px; }
.kaiju-story-name { color: #eef6f4; font-family: var(--font-sign); font-size: 14px; font-weight: 700; letter-spacing: .04em; }
.kaiju-story-place { margin-top: 2px; color: var(--warn); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.kaiju-story-brief { margin-top: 6px; color: rgba(238,246,244,.66); font-size: 12px; line-height: 1.45; text-wrap: pretty; }
.kaiju-story-tag { color: rgba(238,246,244,.45); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; padding-top: 3px; }
button.kaiju-story-mission { width: 100%; text-align: left; color: inherit; cursor: pointer; transition: background .15s ease, border-color .15s ease; }
button.kaiju-story-mission:hover { background: rgba(255,200,87,.08); }
button.kaiju-story-mission:focus-visible { outline: 2px solid var(--warn); outline-offset: -2px; }
.kaiju-story-mission[data-status="planned"], .kaiju-story-mission[data-status="locked"] { opacity: .62; }
.kaiju-story-body { display: flex; flex-direction: column; min-width: 0; }
button.kaiju-story-mission .kaiju-story-tag { color: var(--warn); }
.kaiju-story-tag.is-done { color: #9be29b; }
.kaiju-story-slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.kaiju-story-slot { display: flex; flex-direction: column; min-width: 0; background: rgba(238,246,244,.03); border-top: 2px solid rgba(238,246,244,.12); }
.kaiju-story-slot[data-active="1"] { background: rgba(255,200,87,.07); border-top-color: var(--warn); }
.kaiju-story-slot-pick { display: flex; flex-direction: column; gap: 3px; width: 100%; padding: 10px 10px 8px; text-align: left; color: inherit; cursor: pointer; background: none; border: 0; transition: background .15s ease; }
.kaiju-story-slot-pick:hover { background: rgba(255,200,87,.08); }
.kaiju-story-slot-pick:focus-visible, .kaiju-story-slot-del:focus-visible { outline: 2px solid var(--warn); outline-offset: -2px; }
.kaiju-story-slot-name { color: rgba(238,246,244,.5); font-family: var(--font-sign); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; }
.kaiju-story-slot[data-active="1"] .kaiju-story-slot-name { color: var(--warn); }
.kaiju-story-slot-line { color: #eef6f4; font-family: var(--font-sign); font-size: 13px; font-weight: 700; letter-spacing: .03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kaiju-story-slot-sub { color: rgba(238,246,244,.6); font-size: 11px; line-height: 1.35; }
.kaiju-story-slot-del { align-self: flex-start; margin: 0 10px 8px; padding: 2px 0; color: rgba(238,246,244,.45); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; background: none; border: 0; cursor: pointer; }
.kaiju-story-slot-del:hover { color: #ff8a65; }
/* In a story run the loadout's Battleground and Starting wave pickers don't apply (the mission sets both) */
body[data-game-mode="story"] #kaiju-city-pick, body[data-game-mode="story"] #kaiju-wave-pick { display: none; }
/* A co-op guest (js/coop-lobby.js) only picks a mech: the host's map, starting wave and difficulty run the squad */
body.coop-guest #kaiju-city-pick, body.coop-guest #kaiju-wave-pick, body.coop-guest #kaiju-difficulty-pick { display: none; }
.kaiju-coop-guest-note { display: none; }
body.coop-guest .kaiju-coop-guest-note { display: block; flex: 1 1 0; align-self: center; white-space: normal !important; }
.kaiju-coop-mode select { min-width: 0; max-width: 100%; }
.kaiju-coop-mode strong { color: var(--warn); font-size: 12px; letter-spacing: .06em; }
/* Story HUD (js/story-director.js): objective tracker under the combat telemetry, radio box bottom-centre */
.kaiju-objective { position: fixed; z-index: 8; top: 150px; left: 50%; width: min(360px, calc(100vw - 32px)); padding: 10px 14px 11px; transform: translateX(-50%); border: 1px solid var(--glass-border); border-left: 3px solid var(--warn); border-radius: 6px; color: var(--text-1, #eef6f4); background: rgba(12, 18, 22, 0.78); backdrop-filter: blur(10px); pointer-events: none; }
.kaiju-objective[hidden], .kaiju-comms[hidden] { display: none; }
body:not(.kaiju-active) .kaiju-objective, body:not(.kaiju-active) .kaiju-comms, body.kaiju-over .kaiju-objective, body.kaiju-over .kaiju-comms, body.kaiju-intro .kaiju-objective { display: none; }
.kaiju-objective-kicker { color: rgba(238,246,244,.55); font-family: var(--font-sign); font-size: 9px; letter-spacing: .18em; text-transform: uppercase; }
.kaiju-objective-text { margin-top: 3px; font-family: var(--font-sign); font-size: 14px; font-weight: 700; letter-spacing: .04em; }
.kaiju-objective.is-done { border-left-color: #9be29b; }
.kaiju-objective.is-done .kaiju-objective-text { color: #9be29b; }
.kaiju-objective.is-new { animation: kaiju-objective-in .5s var(--ease-out, ease-out); }
@keyframes kaiju-objective-in { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }
.kaiju-objective-bar { height: 3px; margin-top: 7px; background: rgba(238,246,244,.14); overflow: hidden; }
.kaiju-objective-bar[hidden] { display: none; }
.kaiju-objective-bar i { display: block; height: 100%; background: var(--warn); transform-origin: 0 50%; transform: scaleX(0); transition: transform .3s ease; }
.kaiju-objective-sub { margin-top: 5px; color: rgba(238,246,244,.62); font-family: var(--font-sign); font-size: 10px; letter-spacing: .12em; }
.kaiju-comms { --speaker: var(--warn); position: fixed; z-index: 9; left: 50%; bottom: 128px; display: flex; gap: 12px; align-items: flex-start; width: min(520px, calc(100vw - 32px)); padding: 11px 14px 12px 11px; transform: translateX(-50%); border: 1px solid var(--glass-border); border-radius: 6px; background: rgba(8, 13, 16, 0.84); backdrop-filter: blur(10px); pointer-events: none; }
.kaiju-comms.is-in { animation: kaiju-comms-in .35s var(--ease-out, ease-out); }
@keyframes kaiju-comms-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.kaiju-comms-portrait { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--speaker); color: var(--speaker); background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--speaker) 22%, transparent), transparent 70%), repeating-linear-gradient(0deg, rgba(255,255,255,.04) 0 1px, transparent 1px 3px); font-family: var(--font-sign); font-size: 17px; font-weight: 700; }
.kaiju-comms-body { min-width: 0; }
.kaiju-comms-who { display: flex; gap: 8px; align-items: baseline; font-family: var(--font-sign); text-transform: uppercase; }
.kaiju-comms-who strong { color: var(--speaker); font-size: 11px; letter-spacing: .14em; }
.kaiju-comms-who span { color: rgba(238,246,244,.45); font-size: 9px; letter-spacing: .14em; }
.kaiju-comms-text { margin-top: 4px; color: #eef6f4; font-size: 14px; line-height: 1.45; text-wrap: pretty; }
.kaiju-story-grade { display: flex; align-items: baseline; gap: 12px; margin-top: 10px; }
.kaiju-story-grade[hidden] { display: none; }
.kaiju-story-grade span { color: rgba(238,246,244,.55); font-family: var(--font-sign); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; }
.kaiju-story-grade strong { color: var(--warn); font-family: var(--font-sign); font-size: 44px; line-height: 1; }
.kaiju-story-end .gameover-actions [hidden] { display: none; }
.kaiju-story-end-squad { margin: 12px 0 0; max-width: 46ch; color: rgba(238,246,244,.7); font-size: 13px; line-height: 1.45; }
.kaiju-story-end-squad[hidden] { display: none; }
.kaiju-story-end .gameover-actions button:focus-visible { outline: 2px solid var(--warn); outline-offset: 3px; }
@media (max-width: 640px) {
  .kaiju-objective { top: 118px; padding: 8px 11px 9px; }
  .kaiju-objective-text { font-size: 12px; }
  .kaiju-comms { bottom: 210px; padding: 9px 11px; }
  .kaiju-comms-portrait { width: 32px; height: 32px; font-size: 14px; }
  .kaiju-comms-text { font-size: 12px; }
}
.kaiju-story-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 22px; }
.kaiju-home .kaiju-launch:hover { background: rgba(255, 200, 87, .12); }
.kaiju-home .kaiju-launch:focus-visible { outline: 2px solid var(--warn); outline-offset: 3px; }
.kaiju-launch { display: inline-flex; align-items: center; gap: 34px; margin-top: 34px; padding: 16px 20px 16px 23px; border: 1px solid var(--warn); border-radius: 5px; color: var(--taxi-ink); background: var(--warn); font-family: var(--font-sign); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; transition: transform .2s var(--ease-out), background .2s ease; }
.kaiju-launch:hover { transform: translateY(-3px); background: #ffd878; }
.kaiju-home-corner { position: absolute; right: 28px; bottom: 26px; display: flex; gap: 16px; color: rgba(238, 246, 244, .5); font-family: var(--font-sign); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; }
.kaiju-home-corner span:first-child { color: var(--warn); }
.kaiju-mark { background: var(--warn); color: var(--taxi-ink); }
.kaiju-home-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px clamp(20px, 2.4vw, 28px); margin-top: clamp(14px, 2.6vh, 22px); }
.kaiju-settings-button { padding: 8px 0; color: rgba(238,246,244,.72); font-family: var(--font-sign); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; border-bottom: 1px solid rgba(238,246,244,.3); }
.kaiju-settings-button:hover { color: var(--warn); border-color: var(--warn); }
/* Footer corner: a quiet support note (secondary to the hero CTA) above the site links */
.kaiju-home-footer { position: absolute; right: max(30px, env(safe-area-inset-right)); bottom: max(28px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: flex-end; gap: 18px; max-width: 290px; color: rgba(238,246,244,.45); font-family: var(--font-sign); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.kaiju-home-footer a { color: inherit; text-decoration: none; }
.kaiju-home-links { display: flex; align-items: center; gap: 18px; }
.kaiju-support { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; padding-top: 14px; border-top: 1px solid rgba(238, 246, 244, .16); text-align: right; }
.kaiju-support-copy { margin: 0; color: rgba(238, 246, 244, .72); font-family: 'Inter', system-ui, sans-serif; font-size: 13px; letter-spacing: 0; line-height: 1.5; text-transform: none; text-wrap: balance; }
.kaiju-home-footer .kaiju-support-copy a { color: var(--warn); text-decoration: underline; text-underline-offset: 2px; }
.kaiju-home-footer .kaiju-support-cta { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; white-space: nowrap; border: 1px solid color-mix(in srgb, var(--warn) 60%, transparent); color: var(--warn); font-size: 10px; font-weight: 700; letter-spacing: .16em; transition: background .2s var(--ease-out), border-color .2s var(--ease-out); }
.kaiju-home-footer .kaiju-support-cta:hover { border-color: var(--warn); background: rgba(255, 200, 87, .12); }
.kaiju-support-cta:focus-visible, .kaiju-support-copy a:focus-visible { outline: 2px solid var(--warn); outline-offset: 3px; }
/* Early-access eyebrow above the title */
.kaiju-alpha-badge { display: flex; align-items: center; gap: 8px; margin: 0 0 clamp(12px, 2.2vh, 20px); padding: 6px 11px; background: rgba(0,0,0,.35); color: var(--warn); font-family: var(--font-sign); font-size: 10px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; }
.kaiju-alpha-sep { opacity: .5; }
.kaiju-alpha-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: kaiju-alpha-pulse 1.8s ease-in-out infinite; }
@keyframes kaiju-alpha-pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .kaiju-alpha-dot { animation: none; } }
@media (max-width: 640px), (max-height: 500px) and (orientation: landscape) {
  .kaiju-alpha-badge { gap: 6px; padding: 5px 9px; font-size: 9px; letter-spacing: .12em; white-space: nowrap; }
  .kaiju-support { padding-top: 0; border-top: 0; }
  .kaiju-support-copy { display: none; }
  .kaiju-home-footer .kaiju-support-cta { padding: 0 12px; font-size: 9px; letter-spacing: .14em; }
}
.kaiju-home-footer a:hover { color: var(--warn); }
.kaiju-settings[hidden] { display: none; }
.kaiju-settings { position: fixed; inset: 0; z-index: 130; display: grid; place-items: center; padding: 24px; background: rgba(2,6,8,.58); backdrop-filter: blur(10px); }
.kaiju-settings-card { width: min(440px, 100%); padding: 26px; border: 1px solid rgba(238,246,244,.16); background: rgba(8,16,20,.95); box-shadow: 0 24px 80px rgba(0,0,0,.5); }
.kaiju-settings-head { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 22px; border-bottom: 1px solid rgba(238,246,244,.12); }
.kaiju-settings h2 { margin-top: 8px; color: #eef6f4; font-family: var(--font-sign); font-size: 26px; letter-spacing: .02em; }
.kaiju-settings-close { color: rgba(238,246,244,.62); font-size: 28px; line-height: 1; }
.kaiju-setting-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 0; border-bottom: 1px solid rgba(238,246,244,.1); color: #eef6f4; }
.kaiju-setting-row[hidden] { display: none; }
.kaiju-setting-row strong, .kaiju-setting-row small { display: block; }
.kaiju-setting-row strong { font-size: 13px; letter-spacing: .04em; }
.kaiju-setting-row small { margin-top: 5px; color: rgba(238,246,244,.52); font-size: 11px; line-height: 1.4; }
.kaiju-setting-row select { padding: 8px 10px; border: 1px solid rgba(238,246,244,.2); border-radius: 3px; color: #eef6f4; background: #101d24; }
.kaiju-setting-row input { width: 18px; height: 18px; accent-color: var(--warn); }
.kaiju-setting-row input.kaiju-volume { flex: 0 0 150px; width: 150px; height: 18px; cursor: pointer; }
/* Range sliders get real width (the 18px rule above is for checkboxes; it made the shadow slider unusable) */
.kaiju-setting-row input.kaiju-range { flex: 0 0 170px; width: 170px; height: 18px; cursor: pointer; }
.kaiju-setting-row output { margin-left: 6px; color: var(--warn); font-variant-numeric: tabular-nums; font-weight: 600; }
.kaiju-settings-card { max-height: calc(100dvh - 48px); overflow-y: auto; overscroll-behavior: contain; }
.kaiju-settings-group { margin-top: 22px; color: rgba(238,246,244,.52); font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.kaiju-pause-music { display: flex; flex-direction: column; gap: 8px; padding: 14px 0 16px; border-bottom: 1px solid rgba(238,246,244,.12); }
.kaiju-pause-music-label { color: rgba(238,246,244,.52); font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.kaiju-pause-music-row { display: flex; align-items: center; gap: 8px; }
.kaiju-music-select { flex: 1 1 auto; min-width: 0; padding: 8px 10px; border: 1px solid rgba(238,246,244,.2); border-radius: 3px; color: #eef6f4; background: #101d24; font: inherit; font-size: 13px; }
.kaiju-mini-btn.kaiju-music-skip { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; }
@media (max-width: 480px) {
  .kaiju-setting-row.kaiju-setting-slider { flex-direction: column; align-items: stretch; gap: 12px; }
  .kaiju-setting-row.kaiju-setting-slider input.kaiju-range { flex: 1 1 auto; width: 100%; }
}
.kaiju-settings-actions { display: flex; justify-content: flex-end; padding-top: 22px; }
.kaiju-settings-actions .kaiju-launch { margin-top: 0; border-radius: 0; color: var(--warn); background: transparent; }
.kaiju-settings-actions .kaiju-launch:hover { background: rgba(255,200,87,.12); }
.kaiju-settings-actions .kaiju-launch:focus-visible { outline: 2px solid var(--warn); outline-offset: 3px; }
.kaiju-settings-head .kaiju-eyebrow { margin-top: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Elderwake deployment loadout (#kaiju-hangar): frame list | 3D hangar preview | primary weapon + stats.
   Black steel and gold only: --ew-gold accents, --ew-loss for stat drops. Three columns from 1100 px, the stage on
   top of two columns from 720 px, one stacked column on phones (stage first). */
.kaiju-hangar { --ew-ink: #0a0a0c; --ew-steel: #141518; --ew-gold: #c9a24a; --ew-text: #ece6d6; --ew-loss: #b4553f; --ew-line: rgba(201,162,74,.22); --ew-mute: rgba(236,230,214,.56); --ew-chamfer: 12px; }
.kaiju-hangar-card.ew-loadout { display: flex; flex-direction: column; width: min(1360px, 100%); max-height: calc(100dvh - 48px); padding: 22px 26px 20px; overflow: auto; color: var(--ew-text); border: 1px solid var(--ew-line); background: linear-gradient(180deg, rgba(20,21,24,.97), rgba(10,10,12,.98)); box-shadow: 0 30px 90px rgba(0,0,0,.65), inset 0 1px 0 rgba(201,162,74,.12); }
.ew-head { flex: 0 0 auto; align-items: center; padding-bottom: 16px; border-bottom-color: var(--ew-line); }
.ew-loadout .ew-eyebrow { color: var(--ew-gold); font-size: 10px; letter-spacing: .28em; }
.ew-loadout h2 { margin-top: 4px; color: var(--ew-text); font-family: var(--font-sign); font-size: clamp(22px, 2.4vw, 30px); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.ew-loadout .kaiju-settings-close { color: var(--ew-mute); transition: color .2s; }
.ew-loadout .kaiju-settings-close:hover, .ew-loadout .kaiju-settings-close:focus-visible { color: var(--ew-gold); }

.ew-grid { display: flex; flex-direction: column; flex: 0 0 auto; gap: 18px; padding-top: 18px; }
.ew-panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ew-panel-title, .ew-sub-title { display: flex; align-items: center; gap: 10px; color: var(--ew-gold); font-family: var(--font-sign); font-size: 11px; font-weight: 700; letter-spacing: .24em; text-transform: uppercase; }
.ew-panel-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--ew-line), transparent); }
.ew-sub-title { margin-top: 6px; color: var(--ew-mute); font-size: 10px; }
.ew-compare-note { color: var(--ew-gold); letter-spacing: .14em; }
.ew-traits, .ew-stats { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.ew-list { display: flex; flex-direction: column; gap: 10px; min-width: 0; margin: 0; padding: 0; border: 0; }

/* Cards: chamfered steel plates; the picked one gets gold corner brackets and a warm inner glow */
.ew-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 15px; color: var(--ew-text); cursor: pointer; background: linear-gradient(135deg, rgba(236,230,214,.045), rgba(236,230,214,.012)); clip-path: polygon(var(--ew-chamfer) 0, 100% 0, 100% calc(100% - var(--ew-chamfer)), calc(100% - var(--ew-chamfer)) 100%, 0 100%, 0 var(--ew-chamfer)); box-shadow: inset 0 0 0 1px rgba(236,230,214,.1); transition: background .25s, box-shadow .25s, transform .25s var(--ease-out, ease-out); }
.ew-card::before, .ew-card::after { content: ''; position: absolute; width: 14px; height: 14px; border-color: var(--ew-gold); border-style: solid; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; }
.ew-card::before { top: 5px; right: 5px; border-width: 1px 1px 0 0; transform: translate(4px, -4px); }
.ew-card::after { bottom: 5px; left: 5px; border-width: 0 0 1px 1px; transform: translate(-4px, 4px); }
.ew-card:hover { background: linear-gradient(135deg, rgba(201,162,74,.09), rgba(236,230,214,.02)); box-shadow: inset 0 0 0 1px rgba(201,162,74,.38); transform: translateX(2px); }
.ew-card:has(:checked) { background: linear-gradient(135deg, rgba(201,162,74,.17), rgba(201,162,74,.03) 70%); box-shadow: inset 0 0 0 1px var(--ew-gold), inset 0 0 28px rgba(201,162,74,.12); }
.ew-card:has(:checked)::before, .ew-card:has(:checked)::after { opacity: 1; transform: none; }
.ew-card:has(:focus-visible) { box-shadow: inset 0 0 0 2px var(--ew-gold); }
.kaiju-hangar-radio { position: absolute; opacity: 0; pointer-events: none; }
.ew-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ew-card-kicker { color: var(--ew-gold); font-family: var(--font-sign); font-size: 10px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; }
.ew-card-code { color: var(--ew-mute); font-family: var(--font-sign); font-size: 10px; letter-spacing: .14em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ew-card-name { font-family: var(--font-sign); font-size: 17px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; transition: color .25s; }
.ew-card:has(:checked) .ew-card-name { color: #f3dfa6; }
.ew-card-role { color: var(--ew-mute); font-size: 13px; line-height: 1.45; }
.ew-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ew-tag { padding: 3px 8px; color: rgba(236,230,214,.78); font-size: 11px; line-height: 1.4; letter-spacing: .02em; background: rgba(236,230,214,.06); box-shadow: inset 0 0 0 1px rgba(236,230,214,.1); }
.ew-card:has(:checked) .ew-tag { color: var(--ew-text); box-shadow: inset 0 0 0 1px rgba(201,162,74,.35); }

/* Frame traits */
.ew-trait-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ew-trait { display: flex; align-items: center; gap: 10px; font-size: 14px; line-height: 1.45; animation: ew-rise .4s var(--ease-out, ease-out) both; }
.ew-trait:nth-child(2) { animation-delay: .05s; }
.ew-trait:nth-child(3) { animation-delay: .1s; }
.ew-trait-mark { flex: 0 0 auto; width: 9px; height: 9px; transform: rotate(45deg); }
.ew-trait.is-good .ew-trait-mark { background: var(--ew-gold); box-shadow: 0 0 10px rgba(201,162,74,.6); }
.ew-trait.is-bad .ew-trait-mark { border: 1px solid var(--ew-loss); }
.ew-trait.is-bad .ew-trait-text { color: var(--ew-mute); }
@keyframes ew-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Stage: the hangar bay photo behind the transparent 3D canvas */
.ew-stage.kaiju-hangar-stage { position: relative; height: min(52dvh, 460px); overflow: hidden; background: radial-gradient(ellipse at 50% 58%, transparent 38%, rgba(10,10,12,.78) 100%), linear-gradient(180deg, rgba(10,10,12,.35), transparent 30%, transparent 70%, rgba(10,10,12,.9)), url('../images/hangar-bay.webp') center 76% / cover no-repeat, var(--ew-ink); box-shadow: inset 0 0 0 1px var(--ew-line); clip-path: polygon(18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 18px); }
.kaiju-hangar-canvas { position: relative; display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.kaiju-hangar-canvas:active { cursor: grabbing; }
.kaiju-hangar-canvas:focus-visible { outline: 2px solid var(--ew-gold); outline-offset: -4px; }
.ew-plate { position: absolute; top: 16px; left: 20px; display: flex; flex-direction: column; gap: 2px; pointer-events: none; text-shadow: 0 2px 18px rgba(0,0,0,.8); }
.ew-plate-frame { color: var(--ew-gold); font-family: var(--font-sign); font-size: 10px; font-weight: 700; letter-spacing: .24em; text-transform: uppercase; }
.ew-plate-name { color: var(--ew-text); font-family: var(--font-sign); font-size: clamp(22px, 2.6vw, 34px); font-weight: 700; letter-spacing: .1em; line-height: 1.1; text-transform: uppercase; }
.ew-plate-weapon { color: rgba(236,230,214,.75); font-family: var(--font-sign); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; }
.ew-plate-weapon::before { content: ''; display: inline-block; width: 18px; height: 1px; margin-right: 8px; vertical-align: middle; background: var(--ew-gold); }
.kaiju-hangar-status { position: absolute; inset: auto 16px 50%; color: rgba(236,230,214,.75); font-family: var(--font-sign); font-size: 11px; letter-spacing: .16em; text-align: center; text-transform: uppercase; transform: translateY(50%); pointer-events: none; }
.kaiju-hangar-hint { position: absolute; right: 22px; bottom: 14px; color: rgba(236,230,214,.45); font-family: var(--font-sign); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; pointer-events: none; }

/* Stat bars: segmented gold fill; the ghost shows what a hovered card would gain (light gold) or lose (red) */
.ew-stat-list { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.ew-stat { display: grid; grid-template-columns: 9.5em 1fr; align-items: center; column-gap: 12px; }
.ew-stat-label { color: rgba(236,230,214,.78); font-family: var(--font-sign); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.ew-stat-body { display: grid; grid-template-columns: 1fr 30px 34px; align-items: center; gap: 8px; margin: 0; }
.ew-stat-track { position: relative; height: 8px; overflow: hidden; background: rgba(236,230,214,.07); -webkit-mask: repeating-linear-gradient(90deg, #000 0 calc(10% - 2px), transparent calc(10% - 2px) 10%); mask: repeating-linear-gradient(90deg, #000 0 calc(10% - 2px), transparent calc(10% - 2px) 10%); }
.ew-stat-fill, .ew-stat-ghost { position: absolute; inset: 0; transform-origin: left center; transform: scaleX(0); transition: transform .55s cubic-bezier(.2, .8, .2, 1), background .3s; }
.ew-stat-fill { background: linear-gradient(90deg, #8a6a28, var(--ew-gold) 60%, #f0d68f); }
.ew-stat-ghost { background: transparent; }
.ew-stat[data-trend="up"] .ew-stat-ghost { background: rgba(240,214,143,.55); }
.ew-stat[data-trend="down"] .ew-stat-ghost { background: rgba(180,85,63,.75); }
.ew-stat-value { color: var(--ew-text); font-family: var(--font-sign); font-size: 13px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.ew-stat-delta { font-family: var(--font-sign); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ew-stat[data-trend="up"] .ew-stat-delta { color: #f0d68f; }
.ew-stat[data-trend="down"] .ew-stat-delta { color: var(--ew-loss); }

/* Footer: battleground + starting wave + Deploy */
.ew-footer { display: flex; flex: 0 0 auto; flex-direction: column; gap: 14px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--ew-line); }
.ew-footer .kaiju-city-pick { margin: 0; }
.kaiju-hangar-actions.ew-actions { padding-top: 0; }
.ew-actions .kaiju-launch { gap: 40px; padding: 16px 22px 16px 26px; color: var(--ew-ink); background: var(--ew-gold); border-color: var(--ew-gold); clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px); font-size: 13px; letter-spacing: .22em; transition: background .2s, transform .2s; }
.ew-actions .kaiju-launch:hover { color: var(--ew-ink); background: #e0bd68; transform: translateY(-1px); }
/* The chamfer clip-path clips any outline, so focus (keyboard or pad) swaps the plate to bone white with a gold
   inner ring, and the wrapper (unclipped) throws a gold glow around the chamfered shape */
.ew-actions .kaiju-launch:focus-visible,
body.gamepad-active .ew-actions .kaiju-launch.pad-focus:focus { outline: none; color: var(--ew-ink); background: var(--ew-text); box-shadow: inset 0 0 0 3px var(--ew-gold); transform: translateY(-1px); }
.ew-actions:has(.kaiju-launch:focus-visible),
body.gamepad-active .ew-actions:has(.kaiju-launch.pad-focus:focus) { filter: drop-shadow(0 0 8px rgba(201,162,74,.85)); }

/* Battleground (city) choice and starting wave: segmented switches; changing the city reloads into it */
.kaiju-city-pick { display: flex; flex-direction: column; gap: 8px; min-width: 0; margin: 16px 0 0; padding: 0; border: 0; }
.kaiju-city-legend { padding: 0; color: var(--ew-mute, rgba(238,246,244,.5)); font-family: var(--font-sign); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; }
.kaiju-city-options { display: flex; gap: 0; }
.kaiju-city-option { position: relative; flex: 1 1 0; display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 12px; border: 1px solid rgba(236,230,214,.12); color: rgba(236,230,214,.72); font-family: var(--font-sign); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; cursor: pointer; transition: border-color .15s, background .15s, color .15s; }
.kaiju-city-option + .kaiju-city-option { border-left: 0; }
.kaiju-city-option:hover { color: var(--ew-text, #eef6f4); }
.kaiju-city-option:has(:checked) { border-color: var(--ew-gold, var(--warn)); color: var(--ew-gold, var(--warn)); background: rgba(201,162,74,.1); }
.kaiju-city-option + .kaiju-city-option:has(:checked) { border-left: 1px solid var(--ew-gold, var(--warn)); margin-left: -1px; }
.kaiju-city-option:has(:focus-visible) { outline: 2px solid var(--ew-gold, var(--warn)); outline-offset: 3px; }
.kaiju-city-credit { margin: 0; color: rgba(236,230,214,.42); font-size: 11px; line-height: 1.5; }
.kaiju-city-credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
html[data-city="tokyo"] .kaiju-city-credit-nyc { display: none; }
.kaiju-wave-pick .kaiju-city-option { min-width: 0; padding-inline: 4px; font-variant-numeric: tabular-nums; }
.kaiju-wave-pick .kaiju-resume-option { flex-grow: 2.6; white-space: nowrap; }
.kaiju-wave-pick .kaiju-resume-option[hidden] { display: none; }

@media (max-width: 719px) {
  .kaiju-settings.kaiju-hangar { padding: 10px; }
  .kaiju-hangar-card.ew-loadout { max-height: calc(100dvh - 20px); padding: 16px; }
  .ew-grid { gap: 20px; }
  .ew-stage.kaiju-hangar-stage { order: -1; height: min(48dvh, 380px); }
  .ew-actions .kaiju-launch { flex: 1; justify-content: space-between; }
  .kaiju-hangar-hint { display: none; }
}
@media (min-width: 720px) {
  .ew-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: 'stage stage' 'frames weapons'; gap: 20px 24px; }
  .ew-stage { grid-area: stage; }
  .ew-frames { grid-area: frames; }
  .ew-weapons { grid-area: weapons; }
  /* both pickers have the same three rows (label, buttons, one-line note) so their button rows line up, and Deploy
     sits centred on them (user: align the hangar's bottom bar) */
  .ew-footer { flex-direction: row; align-items: center; gap: 24px; }
  .ew-footer .kaiju-city-credit { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ew-footer .kaiju-city-pick { flex: 1 1 0; }
  .ew-footer .kaiju-wave-pick { flex: 1.6 1 0; }
  .ew-actions { flex: 0 0 auto; margin-bottom: 10px; } /* (centres Deploy on the button rows, not on label + note) */
}
@media (min-width: 1100px) {
  .ew-grid { grid-template-columns: minmax(240px, 290px) 1fr minmax(270px, 330px); grid-template-areas: 'frames stage weapons'; }
  .ew-stage.kaiju-hangar-stage { height: auto; min-height: 520px; }
}
/* Desktop windows (fullscreen or not): the whole loadout fits the window, no scrollbars. The card takes the window's
   height, the three columns share what is left after head + footer, and each height step tightens spacing / drops the
   least needed text so the side columns never overflow */
@media (min-width: 900px) and (min-height: 521px) {
  .kaiju-settings.kaiju-hangar { padding: clamp(8px, 2vh, 24px); }
  .kaiju-hangar-card.ew-loadout { height: min(calc(100dvh - 2 * clamp(8px, 2vh, 24px)), 940px); max-height: none; overflow: hidden; padding: clamp(12px, 2vh, 22px) clamp(16px, 2vw, 26px) clamp(12px, 1.8vh, 20px); }
  .ew-head { padding-bottom: clamp(8px, 1.6vh, 16px); }
  .ew-grid { flex: 1 1 auto; min-height: 0; grid-template-columns: minmax(220px, 290px) minmax(0, 1fr) minmax(250px, 330px); grid-template-rows: minmax(0, 1fr); grid-template-areas: 'frames stage weapons'; gap: 0 clamp(16px, 2vw, 24px); padding-top: clamp(10px, 1.8vh, 18px); }
  .ew-stage.kaiju-hangar-stage { height: auto; min-height: 0; }
  .ew-panel { min-height: 0; gap: clamp(6px, 1.2vh, 12px); overflow: hidden; }
  .ew-list { gap: clamp(6px, 1.1vh, 10px); }
  .ew-traits, .ew-stats { gap: clamp(6px, 1.1vh, 12px); margin-top: clamp(2px, .6vh, 6px); }
  .ew-footer { margin-top: clamp(10px, 1.8vh, 18px); padding-top: clamp(10px, 1.6vh, 16px); gap: 24px; }
  .ew-footer .kaiju-city-pick { flex: 1.35 1 0; }
  .ew-footer .kaiju-wave-pick { flex: 1.6 1 0; }
  #kaiju-city-pick .kaiju-city-credit { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .kaiju-hangar-hint { white-space: nowrap; }
}
@media (min-width: 900px) and (max-width: 1000px) and (min-height: 521px) {
  .kaiju-hangar-hint { display: none; }
}
@media (min-width: 900px) and (min-height: 521px) and (max-height: 860px) {
  .ew-card { padding: 10px 14px 11px; gap: 3px; }
  .ew-card-name { font-size: 15px; }
  .ew-card-role { font-size: 12px; line-height: 1.35; }
  .ew-tags { gap: 5px; margin-top: 3px; }
  .ew-tag { padding: 2px 7px; font-size: 10.5px; }
  .ew-trait { font-size: 13px; line-height: 1.35; }
  .ew-stat-list { gap: 7px; }
  .ew-footer .kaiju-city-pick { gap: 6px; }
  .ew-footer .kaiju-city-option { min-height: 34px; padding: 6px 10px; }
  .ew-actions .kaiju-launch { padding: 12px 18px 12px 22px; }
  .kaiju-wave-pick .kaiju-city-credit { visibility: hidden; } /* (keeps its line so the two pickers stay aligned) */
}
@media (min-width: 900px) and (min-height: 521px) and (max-height: 720px) {
  .ew-loadout h2 { font-size: 22px; }
  .ew-frame-card .ew-card-role { display: none; }
  .ew-trait-list { gap: 4px; }
  .ew-stat-list { gap: 5px; }
  .ew-plate-name { font-size: 24px; }
}
@media (min-width: 900px) and (min-height: 521px) and (max-height: 660px) {
  .ew-traits .ew-element-list { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
  .ew-card { padding: 7px 12px 8px; }
  .ew-list { gap: 5px; }
  .ew-stat-list { gap: 3px; }
  .ew-stat { grid-template-columns: 10.5em 1fr; }
  .ew-stat-label { font-size: 10px; white-space: nowrap; }
  .ew-loadout .ew-eyebrow { display: none; }
  .ew-loadout h2 { margin-top: 0; }
  .ew-footer .kaiju-city-option { min-height: 30px; padding: 4px 8px; }
  .ew-actions .kaiju-launch { padding: 10px 16px 10px 20px; }
}
@media (min-width: 900px) and (min-height: 521px) and (max-height: 600px) {
  .ew-panel-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .ew-stat-list { gap: 1px; }
  .ew-tag { padding: 1px 6px; }
}

/* Loadout head toolbar: Fullscreen / Controls / Settings beside the close button */
.ew-head-tools { display: flex; align-items: center; gap: 8px; }
.ew-tool-btn { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 0 12px; color: var(--ew-mute); font-family: var(--font-sign); font-size: 10px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; white-space: nowrap; box-shadow: inset 0 0 0 1px rgba(236,230,214,.14); transition: color .2s, box-shadow .2s; }
.ew-tool-btn:hover { color: var(--ew-gold); box-shadow: inset 0 0 0 1px rgba(201,162,74,.5); }
.ew-tool-btn:focus-visible { outline: 2px solid var(--ew-gold); outline-offset: 2px; }
.ew-head-tools .kaiju-settings-close { margin-left: 4px; }
@media (max-width: 719px) {
  .ew-head { flex-wrap: wrap; row-gap: 10px; }
  .ew-head-tools { flex: 1 1 100%; }
  .ew-tool-btn { flex: 1 1 0; justify-content: center; padding: 0 6px; letter-spacing: .12em; }
}

/* Fullscreen buttons: expand icon, swapped for the shrink icon while fullscreen */
.kaiju-fs-button .fs-icon { flex: 0 0 auto; }
.kaiju-fs-button .fs-shrink,
.kaiju-fs-button.is-fullscreen .fs-expand { display: none; }
.kaiju-fs-button.is-fullscreen .fs-shrink { display: inline; }
.kaiju-home-tools .kaiju-fs-button { display: inline-flex; align-items: center; gap: 6px; }
.kaiju-fs-button[hidden] { display: none; }

/* Phones held sideways: the stage beside the scrolling panels */
@media (max-height: 520px) and (orientation: landscape) {
  .kaiju-settings.kaiju-hangar { padding: 8px; }
  .kaiju-hangar-card.ew-loadout { max-height: calc(100dvh - 16px); padding: 12px 16px; }
  .ew-head { padding-bottom: 10px; }
  .ew-loadout h2 { font-size: 18px; }
  .ew-grid { grid-template-columns: 1.1fr 1fr 1fr; grid-template-areas: 'stage frames weapons'; padding-top: 12px; }
  .ew-stage.kaiju-hangar-stage { height: calc(100dvh - 110px); min-height: 0; }
  .ew-card { padding: 9px 12px; }
  .ew-card-role, .ew-tags { display: none; }
  .kaiju-city-pick { gap: 6px; }
  .kaiju-city-option { min-height: 32px; padding: 6px 10px; }
  .kaiju-city-credit { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ew-card, .ew-card::before, .ew-card::after, .ew-stat-fill, .ew-stat-ghost, .kaiju-city-option { transition: none; }
  .ew-trait { animation: none; }
}

/* Pause menu (P): sits under Settings / Controls (earlier in the DOM, same z-index) so they open on top of it */
.kaiju-pause-card { width: min(380px, 100%); }
.kaiju-pause-actions { display: flex; flex-direction: column; padding-top: 10px; }
/* Upgrades installed this run: under the actions on narrow screens, own scrolling column beside them on wide ones */
.kaiju-pause-upgrades { padding-top: 18px; color: #eef6f4; }
.kaiju-pause-upgrades .loadout-upgrade-name { font-size: 13px; }
.kaiju-pause-upgrades .loadout-desc, .kaiju-pause-upgrades .loadout-none { color: rgba(238,246,244,.6); font-size: 12px; }
@media (min-width: 760px) {
  .kaiju-pause-card:has(.kaiju-pause-upgrades) { display: grid; width: min(780px, 100%); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); column-gap: 32px; overflow: hidden; }
  .kaiju-pause-card .kaiju-settings-head { grid-column: 1 / -1; }
  .kaiju-pause-upgrades { min-height: 0; padding-top: 14px; overflow-y: auto; overscroll-behavior: contain; }
}
.kaiju-pause-btn { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 12px; width: 100%; padding: 16px 0; border-bottom: 1px solid rgba(238,246,244,.1); color: #eef6f4; background: transparent; text-align: left; cursor: pointer; transition: color .15s, padding-left .15s; }
.kaiju-pause-btn:last-child { border-bottom: 0; }
.kaiju-pause-btn span { font-family: var(--font-sign); font-size: 14px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.kaiju-pause-btn small { grid-column: 1; margin-top: 4px; color: rgba(238,246,244,.52); font-size: 11px; line-height: 1.4; }
.kaiju-pause-btn:hover, .kaiju-pause-btn:focus-visible { padding-left: 8px; color: var(--warn); }
.kaiju-pause-btn:focus-visible { outline: 2px solid var(--warn); outline-offset: 2px; }
.kaiju-pause-btn.is-primary span { color: var(--warn); }
.kaiju-pause-btn kbd { grid-row: 1; grid-column: 2; min-width: 24px; margin-right: 12px; padding: 3px 7px; text-align: center; border: 1px solid rgba(255,200,87,.5); color: var(--warn); background: rgba(255,200,87,.12); font-family: var(--font-sign); font-size: 11px; text-decoration: none; }
@media (prefers-reduced-motion: reduce) { .kaiju-pause-btn { transition: none; } .kaiju-pause-btn:hover, .kaiju-pause-btn:focus-visible { padding-left: 0; } }

/* HUD note "P Menu" next to the fps readout: keyboard devices only, so touch layouts are unchanged */
.hud-menu-hint kbd { min-width: 0; margin-right: 4px; padding: 0 4px; border: 1px solid rgba(255,200,87,.45); color: var(--warn); font-family: var(--font-sign); font-size: 10px; line-height: 1.5; text-decoration: none; }
@media (hover: none), (pointer: coarse) { .hud-menu-hint { display: none; } }
.hud-mouselook-state { margin-left: 2px; color: var(--warn); font-weight: 700; letter-spacing: .08em; }
.hud-mouselook-state.is-off { color: var(--text-2); }
.kaiju-tip-item { display: inline-flex; align-items: center; gap: 8px; }
.kaiju-tip [hidden] { display: none; }
/* Story Mode: the radio panel (.kaiju-comms, bottom 128px) opens over the tip's usual spot, so the tip sits under it */
body[data-game-mode="story"] .kaiju-tip { bottom: 84px; }
.kaiju-tip-sep { width: 1px; height: 14px; margin: 0 6px; background: var(--glass-border); }
.kaiju-mini-btn { flex: none; padding: 8px 14px; border: 1px solid rgba(238,246,244,.24); color: #eef6f4; background: transparent; font-family: var(--font-sign); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; cursor: pointer; transition: color .15s, border-color .15s; }
.kaiju-mini-btn:hover { color: var(--warn); border-color: var(--warn); }
.kaiju-mini-btn:focus-visible { outline: 2px solid var(--warn); outline-offset: 2px; }

/* Controls modal: wider than Settings, capped to the viewport, key list scrolls between a fixed header and footer */
.kaiju-controls-card { display: flex; flex-direction: column; width: min(720px, 100%); max-height: calc(100dvh - 48px); }
.kaiju-controls-help { flex: none; padding-top: 16px; color: rgba(238,246,244,.6); font-size: 12px; line-height: 1.5; text-wrap: pretty; }
.kaiju-controls-body { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 22px 32px; margin: 16px -10px 0 0; padding: 4px 10px 4px 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) var(--scroll-track); }
.kaiju-keygroup { display: flex; flex-direction: column; min-width: 0; }
.kaiju-keygroup .kaiju-eyebrow { margin: 0 0 6px; font-size: 10px; }
.kaiju-keyrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; border-bottom: 1px solid rgba(238,246,244,.08); }
.kaiju-keyname { min-width: 0; color: #eef6f4; font-size: 13px; line-height: 1.3; }
.kaiju-keycaps { display: flex; flex: none; gap: 6px; }
.kaiju-keycap { display: inline-flex; align-items: center; justify-content: center; width: 78px; height: 28px; padding: 0 6px; overflow: hidden; border: 1px solid rgba(238,246,244,.22); color: #eef6f4; background: rgba(238,246,244,.04); font-family: var(--font-sign); font-size: 11px; font-weight: 700; letter-spacing: .06em; white-space: nowrap; cursor: pointer; transition: color .15s, border-color .15s, background-color .15s; }
button.kaiju-keycap:hover { border-color: var(--warn); color: var(--warn); }
.kaiju-keycap:focus-visible { outline: 2px solid var(--warn); outline-offset: 2px; }
.kaiju-keycap.is-empty { border-style: dashed; color: rgba(238,246,244,.36); background: transparent; }
.kaiju-keycap.is-listening { border-color: var(--warn); color: var(--warn); background: rgba(255,200,87,.12); animation: kaiju-keycap-pulse 1s ease-in-out infinite; }
.kaiju-keycap.is-fixed { width: auto; padding: 0 10px; border-color: transparent; color: rgba(238,246,244,.6); background: rgba(238,246,244,.06); cursor: default; }
@keyframes kaiju-keycap-pulse { 50% { background: rgba(255,200,87,.24); } }
.kaiju-padgroup { grid-column: 1 / -1; }
.kaiju-padopts { display: flex; flex-direction: column; margin-top: 10px; }
.kaiju-padopts output { margin-left: 6px; color: var(--warn); font-variant-numeric: tabular-nums; }
.kaiju-padopts input[type="range"] { width: 160px; accent-color: var(--warn); }
.kaiju-padopts input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--warn); }
/* Gamepad menu focus (js/gamepad-controls.js spatial navigation) */
body.gamepad-active .pad-focus:focus { outline: 2px solid var(--warn); outline-offset: 3px; }
body.gamepad-active .pad-focus-card:has(.pad-focus:focus) { outline: 2px solid var(--warn); outline-offset: 3px; }
body.gamepad-active .kaiju-lock { display: none !important; }
@media (prefers-reduced-motion: reduce) { .kaiju-keycap.is-listening { animation: none; } }
.kaiju-controls-status { flex: none; min-height: 18px; padding-top: 12px; color: var(--warn); font-size: 12px; line-height: 1.5; }
.kaiju-controls-actions { flex: none; justify-content: space-between; align-items: center; gap: 16px; margin-top: 4px; padding-top: 16px; border-top: 1px solid rgba(238,246,244,.12); }
@media (max-width: 640px) {
  .kaiju-controls { padding: 12px; }
  .kaiju-controls-card { max-height: calc(100dvh - 24px); padding: 18px; }
  .kaiju-controls-body { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .kaiju-keycap { width: 72px; }
}
.kaiju-launch-arrow { flex: none; }
/* Home screen: everything above scales fluidly; these only re-anchor the chrome on small or short screens. */
@media (max-width: 640px) {
  .kaiju-home-shade { background: linear-gradient(0deg, rgba(3, 7, 9, .82) 0%, rgba(3, 7, 9, .45) 45%, rgba(3, 7, 9, .1) 100%); }
  .kaiju-home-inner { bottom: max(84px, calc(env(safe-area-inset-bottom) + 76px)); }
  .kaiju-home h1 { font-size: clamp(40px, 14vw, 72px); }
  .kaiju-home .kaiju-launch { align-self: stretch; justify-content: space-between; }
  .kaiju-home-modes { align-self: stretch; }
  .kaiju-home-modes .kaiju-launch { flex: 1 1 0; gap: 10px; padding: 14px 14px 14px 16px; white-space: nowrap; letter-spacing: .1em; }
  .kaiju-story-mission { grid-template-columns: 24px minmax(0, 1fr); }
  .kaiju-story-slots { grid-template-columns: 1fr; }
  .kaiju-story-tag { grid-column: 2; padding-top: 0; }
  /* one centred row under the hero: [Support development] Supporters */
  .kaiju-home-footer { left: 20px; right: 20px; bottom: max(18px, env(safe-area-inset-bottom)); max-width: none; flex-direction: row; justify-content: center; align-items: center; gap: 16px; font-size: 9px; }
  .kaiju-home-links a { display: inline-flex; align-items: center; min-height: 36px; }
  .kaiju-home-links .kaiju-home-copyright { display: none; }
  .kaiju-home-tools { align-self: stretch; justify-content: center; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .kaiju-home-inner { bottom: 48px; max-width: 60vw; }
  .kaiju-home h1 { font-size: clamp(36px, 15vh, 64px); }
  .kaiju-home .kaiju-launch { align-self: flex-start; padding: 12px 16px; }
  .kaiju-home-modes { margin-top: 12px; }
  .kaiju-home-tools { margin-top: 10px; }
  .kaiju-home-footer { bottom: max(14px, env(safe-area-inset-bottom)); gap: 10px; }
}
.kaiju-combat-telemetry { position: fixed; z-index: 8; top: 78px; left: 50%; display: flex; align-items: stretch; transform: translateX(-50%); border: 1px solid var(--glass-border); border-radius: 6px; color: var(--text-1); background: rgba(12, 18, 22, 0.82); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18); backdrop-filter: blur(14px); }
.combat-readout { display: flex; min-width: 92px; flex-direction: column; gap: 3px; padding: 9px 13px 8px; }
.combat-label, .combat-sub { color: var(--text-3); font-family: var(--font-sign); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; }
.combat-readout strong { color: var(--warn); font-family: var(--font-sign); font-size: 16px; letter-spacing: 0.04em; line-height: 1; }
.combat-sub { font-size: 8px; }
.combat-divider { width: 1px; margin: 9px 0; background: var(--glass-border); }
@media (max-width: 640px) { .kaiju-combat-telemetry { top: 68px; width: calc(100% - 32px); } .combat-readout { min-width: 0; flex: 1; padding: 8px 7px; } .combat-readout strong { font-size: 13px; } .combat-label, .combat-sub { font-size: 7px; } }
  .kaiju-class { color: var(--ok); }

  /* ---- Combat HUD (only while an Assault Mech is deployed) ---- */
  .kaiju-combat-telemetry, .kaiju-threat, .kaiju-vitals, .kaiju-reticle, .kaiju-lock, .kaiju-banner, .kaiju-boundary, .kaiju-touch { display: none; }
  body.kaiju-active .kaiju-combat-telemetry, body.kaiju-active .kaiju-vitals, body.kaiju-active .kaiju-reticle { display: flex; }
  body.kaiju-active.touch-enabled .kaiju-touch { display: flex; }
  body.kaiju-active .kaiju-threat, body.kaiju-active .kaiju-lock, body.kaiju-active .kaiju-banner, body.kaiju-active .kaiju-boundary { display: flex; }
  body.kaiju-active #mode-switch, body.kaiju-active #btn-teleport, body.kaiju-active .time-switch + .toolbar-divider { display: none; }
  body.kaiju-over .kaiju-vitals, body.kaiju-over .kaiju-reticle, body.kaiju-over .kaiju-touch { display: none; }
  body.hud-minimized .kaiju-vitals, body.hud-minimized .kaiju-combat-telemetry { visibility: hidden; }

  .kaiju-threat { position: fixed; z-index: 8; top: 140px; left: 50%; width: min(420px, calc(100% - 32px)); flex-direction: column; gap: 6px; transform: translate(-50%, -6px); opacity: 0; pointer-events: none; transition: opacity 0.3s ease, transform 0.3s ease; }
  .kaiju-threat.is-visible { opacity: 1; transform: translate(-50%, 0); }
  .threat-head { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--text); font-family: var(--font-sign); font-size: 12px; font-weight: 700; letter-spacing: 0.18em; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6); }
  .threat-tag { padding: 2px 5px; border-radius: 3px; color: var(--taxi-ink); background: var(--bad); font-size: 9px; }
  .elem-tag { padding: 1px 5px; border: 1px solid var(--elem); border-radius: 3px; color: var(--elem); font-size: 9px; text-transform: uppercase; }
  .threat-track { height: 6px; overflow: hidden; border: 1px solid rgba(255, 122, 107, 0.4); border-radius: 3px; background: rgba(12, 18, 22, 0.7); }
  .threat-track span { display: block; height: 100%; background: var(--bad); transform-origin: left; transition: transform 0.25s ease; }
  /* Boss health bars: one chip per bar left; a broken bar's chip drops out, the bar refills for the next phase */
  .threat-chips { display: flex; justify-content: center; gap: 6px; }
  .threat-chips:empty { display: none; }
  .threat-chips i { width: 18px; height: 6px; background: var(--bad); box-shadow: 0 0 8px rgba(255, 122, 107, 0.55); transform: skewX(-24deg); transition: opacity 0.35s ease, transform 0.35s ease, background 0.35s ease; }
  .threat-chips i.is-gone { opacity: 0.25; background: transparent; box-shadow: inset 0 0 0 1px rgba(255, 122, 107, 0.6); transform: skewX(-24deg) scale(0.8); }
  .kaiju-threat.is-shift .threat-track { border-color: #fff; box-shadow: 0 0 12px rgba(255, 255, 255, 0.6); }
  .kaiju-threat.is-shift .threat-track span { background: #fff; }
  .kaiju-threat.is-last .threat-track span { background: linear-gradient(90deg, #ff3b2f, #ff9a4d); animation: threat-rage 0.9s ease-in-out infinite alternate; }
  @keyframes threat-rage { to { filter: brightness(1.45); } }
  @media (prefers-reduced-motion: reduce) { .kaiju-threat.is-last .threat-track span { animation: none; } }

  .kaiju-vitals { position: fixed; z-index: 8; bottom: calc(var(--edge) + 38px); left: 50%; align-items: center; gap: 14px; padding: 10px 12px; transform: translateX(-50%); border: 1px solid var(--glass-border); border-radius: 8px; background: rgba(12, 18, 22, 0.82); backdrop-filter: blur(14px); }
  .vital { display: flex; width: 132px; flex-direction: column; gap: 5px; }
  .vital-head { display: flex; justify-content: space-between; color: var(--text-3); font-family: var(--font-sign); font-size: 9px; font-weight: 700; letter-spacing: 0.14em; }
  .vital-head span:last-child { color: var(--text); }
  .vital-track { height: 5px; overflow: hidden; border-radius: 3px; background: rgba(246, 245, 242, 0.1); }
  .vital-track span { display: block; height: 100%; transform-origin: left; transition: transform 0.15s linear; }
  .vital-hull span { background: var(--ok); }
  .vital-hull.is-critical span { background: var(--bad); animation: kaiju-blink 0.6s steps(2) infinite; }
  .vital-energy span { background: #5ff4ff; }
  .weapon-rack { display: flex; gap: 4px; }
  .weapon-btn { position: relative; display: flex; min-width: 62px; flex-direction: column; align-items: flex-start; gap: 2px; padding: 6px 8px 7px; border: 1px solid transparent; border-radius: 5px; color: var(--text-3); background: rgba(246, 245, 242, 0.05); font-family: var(--font-sign); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; }
  .weapon-btn kbd { color: inherit; font-size: 8px; opacity: 0.7; }
  .weapon-btn.active { border-color: var(--warn); color: var(--warn); background: rgba(255, 200, 87, 0.1); }
  .weapon-ammo { position: absolute; top: 5px; right: 7px; color: var(--text); font-size: 9px; }
  .weapon-heat { position: absolute; left: 8px; right: 8px; bottom: 3px; height: 2px; overflow: hidden; background: rgba(246, 245, 242, 0.1); }
  .weapon-heat span { display: block; height: 100%; background: var(--warn); transform: scaleX(0); transform-origin: left; }
  .weapon-heat.is-hot span { background: var(--bad); }
  .weapon-ammo.is-low { color: var(--bad); }

  .kaiju-reticle { position: fixed; z-index: 7; top: 50%; left: 50%; width: 30px; height: 30px; align-items: center; justify-content: center; transform: translate(-50%, -50%); border: 1px solid rgba(246, 245, 242, 0.35); border-radius: 50%; pointer-events: none; }
  .kaiju-reticle span { width: 4px; height: 4px; border-radius: 50%; background: var(--text); }
  .kaiju-reticle.is-hit { border-color: var(--warn); }
  .kaiju-reticle.is-hit span { background: var(--warn); }
  .kaiju-reticle.is-hit-elem { border-color: var(--hit-elem); border-width: 2px; box-shadow: 0 0 10px var(--hit-elem); }
  .kaiju-reticle.is-hit-elem span { background: var(--hit-elem); }
  /* Aim down sights (cockpit view): the ring tightens round the dot, as the primary's cone does */
  .kaiju-reticle { transition: width 0.18s ease, height 0.18s ease, border-color 0.18s ease; }
  body.kaiju-ads .kaiju-reticle { width: 16px; height: 16px; border-color: rgba(246, 245, 242, 0.6); }
  /* The gun's own sights are up (Vulcan reflex sight, Scatterstorm irons) or the Rail Lance scope: no HUD crosshair */
  body.kaiju-sights .kaiju-reticle, body.kaiju-scoped .kaiju-reticle { opacity: 0; }
  /* Rail Lance scope: black round the lens, fine crosshair with a gap, amber centre dot */
  .kaiju-scope { position: fixed; inset: 0; z-index: 6; display: none; pointer-events: none; background: radial-gradient(circle at 50% 50%, transparent 0, transparent min(41vh, 41vw), rgba(4, 6, 8, 0.55) calc(min(41vh, 41vw) + 2px), #040608 calc(min(41vh, 41vw) + 14px)); }
  body.kaiju-scoped .kaiju-scope { display: block; animation: kaiju-scope-in 0.12s ease-out; }
  @keyframes kaiju-scope-in { from { opacity: 0; } to { opacity: 1; } }
  .kaiju-scope i { position: absolute; top: 50%; left: 50%; display: block; background: rgba(8, 10, 12, 0.85); transform: translate(-50%, -50%); }
  .kaiju-scope-h { width: min(82vh, 82vw); height: 1.5px; -webkit-mask: linear-gradient(90deg, #000 0 46%, transparent 46% 54%, #000 54%); mask: linear-gradient(90deg, #000 0 46%, transparent 46% 54%, #000 54%); }
  .kaiju-scope-v { width: 1.5px; height: min(82vh, 82vw); -webkit-mask: linear-gradient(180deg, #000 0 46%, transparent 46% 54%, #000 54%); mask: linear-gradient(180deg, #000 0 46%, transparent 46% 54%, #000 54%); }
  .kaiju-scope .kaiju-scope-dot { width: 4px; height: 4px; border-radius: 50%; background: #ffb347; box-shadow: 0 0 6px #ffb347; }
  .kaiju-lock { position: fixed; z-index: 7; top: 0; left: 0; width: 46px; height: 46px; opacity: 0; pointer-events: none; transition: opacity 0.15s ease; background:
    linear-gradient(var(--bad), var(--bad)) top left / 12px 2px no-repeat, linear-gradient(var(--bad), var(--bad)) top left / 2px 12px no-repeat,
    linear-gradient(var(--bad), var(--bad)) top right / 12px 2px no-repeat, linear-gradient(var(--bad), var(--bad)) top right / 2px 12px no-repeat,
    linear-gradient(var(--bad), var(--bad)) bottom left / 12px 2px no-repeat, linear-gradient(var(--bad), var(--bad)) bottom left / 2px 12px no-repeat,
    linear-gradient(var(--bad), var(--bad)) bottom right / 12px 2px no-repeat, linear-gradient(var(--bad), var(--bad)) bottom right / 2px 12px no-repeat; }
  .kaiju-lock.is-visible { opacity: 1; }

  .kaiju-vignette { position: fixed; z-index: 6; inset: 0; opacity: 0; pointer-events: none; box-shadow: inset 0 0 160px 30px rgba(255, 70, 40, 0.75); }
  body.kaiju-shielding .kaiju-vignette { box-shadow: inset 0 0 160px 30px rgba(95, 244, 255, 0.5); }

  /* Centred with auto margins, not left: 50%: a fixed box at left: 50% may only be half the screen wide, which wrapped
     long subtitles into three lines on phones */
  .kaiju-banner { position: fixed; z-index: 9; top: 34%; left: 0; right: 0; width: fit-content; max-width: calc(100vw - 32px); margin-inline: auto; flex-direction: column; align-items: center; gap: 8px; transform: translateY(10px); opacity: 0; pointer-events: none; text-align: center; text-wrap: balance; transition: opacity 0.35s ease, transform 0.35s ease; }
  .kaiju-banner.is-visible { opacity: 1; transform: none; }
  .kaiju-banner strong { color: var(--text); font-family: var(--font-sign); font-size: clamp(30px, 6vw, 64px); font-weight: 700; letter-spacing: 0.08em; line-height: 1; text-shadow: 0 4px 30px rgba(0, 0, 0, 0.6); }
  .kaiju-banner span { color: var(--warn); font-family: var(--font-sign); font-size: 11px; font-weight: 700; letter-spacing: 0.24em; text-shadow: 0 1px 10px rgba(0, 0, 0, 0.8); }
  .kaiju-banner.is-small { top: 62%; }
  .kaiju-banner.is-small strong { font-size: 18px; letter-spacing: 0.16em; }
  .kaiju-banner.is-small span { color: var(--text-3); font-size: 9px; }

  .kaiju-boundary { position: fixed; z-index: 9; top: 50%; left: 50%; padding: 8px 14px; transform: translate(-50%, 46px); border: 1px solid var(--bad); border-radius: 5px; color: var(--bad); background: rgba(12, 18, 22, 0.82); font-family: var(--font-sign); font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
  .kaiju-boundary.is-visible { opacity: 1; }

  /* The card centres with margin: auto so a card taller than the screen scrolls from its top instead of being cut off */
  .kaiju-gameover { position: fixed; z-index: 40; inset: 0; display: flex; overflow-y: auto; overscroll-behavior: contain; padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left)); background: rgba(8, 11, 14, 0.72); backdrop-filter: blur(6px); transition: opacity 0.5s ease, visibility 0.5s ease; }
  .kaiju-gameover.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
  /* showing: visible at once (only the opacity fades in) so the main button can take focus right away */
  .kaiju-gameover:not(.hidden) { transition: opacity 0.5s ease; }
  .gameover-card { display: flex; width: min(460px, 100%); margin: auto; flex-direction: column; gap: 18px; padding: 28px; border: 1px solid var(--glass-border); border-radius: 10px; background: rgba(12, 18, 22, 0.92); }
  .gameover-eyebrow { margin: 0; color: var(--bad); }
  .gameover-card h2 { color: var(--text); font-family: var(--font-sign); font-size: clamp(40px, 9vw, 64px); font-weight: 700; letter-spacing: 0.03em; line-height: 0.9; text-transform: uppercase; }
  .gameover-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; overflow: hidden; border-radius: 6px; background: var(--glass-border); }
  .gameover-stats div { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; background: rgba(12, 18, 22, 0.96); }
  .gameover-stats dt { color: var(--text-3); font-family: var(--font-sign); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; }
  .gameover-stats dd { color: var(--warn); font-family: var(--font-sign); font-size: 24px; font-weight: 700; }
  .gameover-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
  .gameover-secondary { color: var(--text-2); background: none; border: 0; font-family: var(--font-sign); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
  .gameover-secondary:hover { color: var(--text); }
  /* Landscape phones: a wide, short card (stats in one row) so the buttons are on screen without scrolling */
  @media (max-height: 480px) and (orientation: landscape) {
    .kaiju-gameover { padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
    .gameover-card { width: min(620px, 100%); gap: 10px; padding: 14px 18px; }
    .gameover-card h2 { font-size: clamp(26px, 10vh, 40px); }
    .gameover-stats { grid-template-columns: repeat(4, 1fr); }
    .gameover-stats div { padding: 8px 10px; }
    .gameover-stats dd { font-size: 18px; }
    .kaiju-story-grade { margin: 0; }
    .kaiju-story-grade strong { font-size: 28px; }
  }


  @keyframes kaiju-blink { 50% { opacity: 0.35; } }

  @media (max-width: 640px) {
    .kaiju-threat { top: 124px; }
    .kaiju-vitals { bottom: max(8px, env(safe-area-inset-bottom)); width: calc(100% - 16px); flex-wrap: wrap; gap: 6px 10px; padding: 7px 9px; }
    .vital { flex: 1; width: auto; min-width: 0; }
    .weapon-rack { width: 100%; }
    .weapon-btn { min-width: 0; flex: 1; flex-direction: row; align-items: center; gap: 4px; padding: 5px 6px; font-size: 9px; }
    .weapon-btn kbd { display: none; }
    .weapon-ammo { position: static; margin-left: auto; }
    body.kaiju-active #hud-controls-hint { display: none; }
  }

@media (max-width: 640px) {
  .kaiju-eyebrow { margin-top: 58px; }
  .kaiju-brief-grid { gap: 18px; margin-top: 58px; }
  .kaiju-brief-grid span { max-width: 82px; line-height: 1.35; }
}

/* ------------------------------------------------------------------------------------------------------------------
   HUD layout: four corners plus the bottom centre, the middle of the screen stays clear
   ------------------------------------------------------------------------------------------------------------------ */
.hud {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.4s var(--ease-out);
  }

/* The homepage cinematic is a clean title screen; gameplay telemetry returns only after deployment. */
body:not(.kaiju-active) .hud,
body:not(.kaiju-active) .kaiju-threat,
body:not(.kaiju-active) .kaiju-lock,
/* Spawn hint for the cockpit toggle: keyboard players only, so touch/portrait layouts are untouched. */
.kaiju-tip { position: fixed; z-index: 9; bottom: calc(var(--edge) + 112px); left: 50%; display: flex; align-items: center; gap: 8px; padding: 8px 14px; transform: translate(-50%, 8px); border: 1px solid var(--glass-border); border-radius: 999px; background: rgba(12, 18, 22, 0.82); backdrop-filter: blur(14px); color: var(--text-2); font-family: var(--font-sign); font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.35s ease, transform 0.35s var(--ease-out), visibility 0s linear 0.35s; }
.kaiju-tip.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition: opacity 0.35s ease, transform 0.35s var(--ease-out), visibility 0s; }
.kaiju-tip kbd { min-width: 24px; padding: 3px 7px; border: 1px solid rgba(255, 200, 87, 0.5); border-radius: 6px; background: rgba(255, 200, 87, 0.12); color: var(--warn); font-family: var(--font-sign); font-size: 12px; text-align: center; }
@media (pointer: coarse), (max-width: 640px) { .kaiju-tip { display: none; } }

/* Co-op: teammates in the next zone waiting for the squad leader (host) — sits in the threat bar's slot, which is
   empty while navigating */
.kaiju-zone-hold { position: fixed; z-index: 9; top: 140px; left: 0; right: 0; display: flex; width: fit-content; max-width: calc(100% - 32px); margin-inline: auto; align-items: center; gap: 10px; padding: 9px 16px; border: 1px solid rgba(255, 200, 87, 0.45); border-radius: 999px; background: rgba(12, 18, 22, 0.86); backdrop-filter: blur(14px); color: var(--text-1); font-family: var(--font-sign); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; line-height: 1.4; text-align: center; text-transform: uppercase; pointer-events: none; animation: zone-hold-in 0.35s var(--ease-out); }
.kaiju-zone-hold[hidden], body:not(.kaiju-active) .kaiju-zone-hold { display: none; }
.kaiju-zone-hold-pulse { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); animation: zone-hold-pulse 1.4s ease-in-out infinite; }
@keyframes zone-hold-in { from { opacity: 0; transform: translateY(-6px); } }
@keyframes zone-hold-pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .kaiju-zone-hold, .kaiju-zone-hold-pulse { animation: none; } }
@media (max-width: 640px) { .kaiju-zone-hold { top: 96px; font-size: 10px; letter-spacing: 0.08em; } }

body:not(.kaiju-active) .kaiju-tip,
body:not(.kaiju-active) .kaiju-banner,
body:not(.kaiju-active) .kaiju-boundary {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.hud > * {
  pointer-events: auto;
}

.hud-top-left {
  top: max(var(--edge), env(safe-area-inset-top));
  left: max(var(--edge), env(safe-area-inset-left));
}

.hud-top-right {
  top: var(--edge);
  right: var(--edge);
}

.hud-bottom-left {
  left: var(--edge);
  bottom: var(--edge);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.hud-bottom-center {
  left: 50%;
  bottom: var(--edge);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.hud-bottom-right {
  right: var(--edge);
  bottom: var(--edge);
}

/* Clean view [H]: everything but the toggle itself steps out of the way */
body.hud-minimized::before,
body.hud-minimized::after {
  opacity: 0;
}

body.hud-minimized .hud:not(.hud-top-right) {
  opacity: 0;
}

body.hud-minimized .hud:not(.hud-top-right),
body.hud-minimized .hud:not(.hud-top-right) > * {
  pointer-events: none;
}

body.hud-minimized .hud-top-left { transform: translateY(-10px); }
body.hud-minimized .hud-bottom-left,
body.hud-minimized .hud-bottom-right { transform: translateY(12px); }
body.hud-minimized .hud-bottom-center { transform: translate(-50%, 12px); }

body.hud-minimized .toolbar > :not(#btn-toggle-hud) {
  display: none;
}

/* ------------------------------------------------------------------------------------------------------------------
   Top left: brand
   ------------------------------------------------------------------------------------------------------------------ */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  height: var(--bar-h);
  padding: 0 18px 0 9px;
}

.mta-bullet {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--taxi);
  color: var(--taxi-ink);
  font-weight: 800;
  font-size: 12.5px;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

.brand-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-titles h1 {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.repo-link {
  flex: none;
  padding: 3px 0;
  color: var(--text-2);
  font-size: 11px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.repo-link:hover,
.repo-link:focus-visible {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.brand-subtitle {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#hud-fps {
  font-weight: 650;
  color: var(--text-2);
}

#hud-fps.fps-ok { color: var(--ok); }
#hud-fps.fps-warn { color: var(--warn); }
#hud-fps.fps-bad { color: var(--bad); }

/* ------------------------------------------------------------------------------------------------------------------
   Top right: toolbar (time of day, teleport, map, clean view)
   ------------------------------------------------------------------------------------------------------------------ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  height: var(--bar-h);
  padding: 0 5px;
}

.toolbar-divider {
  flex: none;
  width: 1px;
  height: 20px;
  margin: 0 5px;
  background: var(--divider);
}

.time-switch {
  display: flex;
  gap: 2px;
}

.time-btn {
  height: 36px;
  padding: 0 9px;
  border-radius: var(--r-ctl);
  display: inline-flex;
  align-items: center;
  gap: 0;
  color: var(--text-2);
  transition: background-color 0.2s ease, color 0.2s ease, gap 0.35s var(--ease-out), padding 0.35s var(--ease-out);
}

.time-btn:hover {
  color: var(--text);
  background: var(--hover);
}

/* The active time of day spells out its name */
.time-btn .seg-label {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  transition: max-width 0.4s var(--ease-out), opacity 0.25s ease;
}

.time-btn.active,
.time-btn.active:hover {
  gap: 7px;
  padding: 0 12px 0 10px;
  background: var(--text);
  color: #121314;
}

.time-btn.active .seg-label {
  max-width: 120px;
  opacity: 1;
}

.tool-btn {
  height: 36px;
  padding: 0 11px;
  border-radius: var(--r-ctl);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
  transition: background-color 0.2s ease;
}

.tool-btn:hover,
.tool-btn.is-open {
  background: var(--hover);
}

.tool-btn .icon-sm {
  margin-left: -2px;
  color: var(--text-3);
  transition: transform 0.3s var(--ease-out);
}

.tool-btn.is-open .icon-sm {
  transform: rotate(180deg);
}

.tool-btn.icon-only {
  width: 36px;
  padding: 0;
  justify-content: center;
}

.icon-show {
  display: none;
}

body.hud-minimized .icon-hide {
  display: none;
}

body.hud-minimized .icon-show {
  display: block;
}

.tool-btn:active,
.time-btn:active,
.icon-btn:active,
.mode-btn:active,
.camera-current:active,
.pop-item:active {
  transform: scale(0.97);
}

/* ------------------------------------------------------------------------------------------------------------------
   Popovers (teleport destinations, cameras)
   ------------------------------------------------------------------------------------------------------------------ */
.popover {
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 6px;
  min-width: 264px;
  max-height: calc(100vh - 2 * var(--edge) - 64px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  color: var(--text);
  background: var(--grain), var(--glass-strong);
  -webkit-backdrop-filter: blur(26px) saturate(170%);
  backdrop-filter: blur(26px) saturate(170%);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 var(--glass-highlight), 0 28px 60px -22px rgba(0, 0, 0, 0.8), 0 4px 14px rgba(0, 0, 0, 0.3);
  transform-origin: top right;
  transition: opacity 0.18s ease, transform 0.26s var(--ease-out), overlay 0.26s allow-discrete, display 0.26s allow-discrete;
}

.popover[data-side='above'] {
  transform-origin: bottom right;
}

.popover:not(:popover-open) {
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
}

.popover[data-side='above']:not(:popover-open) {
  transform: translateY(4px) scale(0.98);
}

@starting-style {
  .popover:popover-open {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }

  .popover[data-side='above']:popover-open {
    transform: translateY(4px) scale(0.98);
  }
}

.pop-title {
  padding: 9px 10px 6px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.pop-title:not(:first-child) {
  margin-top: 5px;
  padding-top: 12px;
  border-top: 1px solid var(--divider);
}

.pop-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 10px;
  border-radius: 9px;
  text-align: left;
  font-size: 13px;
  font-weight: 550;
  color: var(--text);
  transition: background-color 0.15s ease;
}

.pop-item:hover {
  background: var(--hover);
}

.pop-item.active,
.pop-item.active:hover {
  background: var(--text);
  color: #121314;
}

.pop-item.active kbd {
  color: rgba(0, 0, 0, 0.55);
  background: rgba(0, 0, 0, 0.08);
  box-shadow: none;
}

.tp-btn {
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.pop-sub {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-3);
}

/* ------------------------------------------------------------------------------------------------------------------
   Bottom left: NYC street-name signs over the GPS radar
   ------------------------------------------------------------------------------------------------------------------ */
.location {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  pointer-events: none;
}

.location-place {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7), 0 0 14px rgba(0, 0, 0, 0.4);
  animation: rise-in 0.4s var(--ease-out) both;
}

.location-signs {
  display: flex;
  align-items: center;
  gap: 6px;
  animation: rise-in 0.4s var(--ease-out) both;
}

.location-near {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

/* Green blade, white inset border, Highway Gothic lettering: the sign on every Manhattan corner */
.street-sign {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 9px 13px 7px;
  font-family: var(--font-sign);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.01em;
  color: #ffffff;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 55%), var(--sign-green);
  border-radius: 6px;
  outline: 1.5px solid rgba(255, 255, 255, 0.92);
  outline-offset: -4px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35), 0 10px 22px -10px rgba(0, 0, 0, 0.75);
}

/* --radar-w/h = the layout's base size, --radar-k = the player's minimap size (set by nyc-map.js, keyboard layouts) */
.radar {
  --radar-w: 288px;
  --radar-h: 184px;
  position: relative;
  width: min(calc(var(--radar-w) * var(--radar-k, 1)), calc(100vw - 2 * var(--edge)));
  height: min(calc(var(--radar-h) * var(--radar-k, 1)), 58vh);
  overflow: hidden;
  border-radius: 18px;
  background: #0a1118;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  cursor: pointer;
  transition: transform 0.35s var(--ease-out);
}

.radar:hover {
  transform: translateY(-2px);
}

/* Inner rim: a soft vignette so the map sinks into the frame */
.radar::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 0 30px rgba(0, 0, 0, 0.55);
}

#minimap-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.radar-north {
  position: absolute;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  color: #ffffff;
  background: rgba(10, 12, 15, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  pointer-events: none;
}

.radar-key {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 1;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(10, 12, 15, 0.6);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.radar:hover .radar-key {
  color: var(--taxi-ink);
  background: var(--taxi);
  box-shadow: none;
}

/* Minimap size (keyboard layouts; touch layouts keep their fixed radar) */
.radar-size {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 1;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.radar:hover .radar-size,
.radar:focus-within .radar-size { opacity: 1; }
.radar-size-btn {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(10, 12, 15, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  font: 700 15px/1 var(--font-sign, inherit);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.radar-size-btn:hover,
.radar-size-btn:focus-visible { color: var(--taxi-ink); background: var(--taxi); }
.radar-size-btn:disabled { opacity: 0.35; cursor: default; }
body.touch-enabled .radar-size { display: none; }

/* ------------------------------------------------------------------------------------------------------------------
   Bottom centre: travel mode switcher & keyboard guide
   ------------------------------------------------------------------------------------------------------------------ */
.controls-hint {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  max-width: 600px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
  pointer-events: none;
}

.hint {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  animation: rise-in 0.35s var(--ease-out) both;
}

.hint kbd {
  color: #ffffff;
  background: rgba(12, 13, 15, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  text-shadow: none;
}

.hint-label {
  margin-left: 4px;
}

.mode-switch {
  position: relative;
  display: flex;
  gap: 2px;
  padding: 5px;
}

/* The taxi-yellow pill glides to the selected mode (positioned by main.js) */
.mode-indicator {
  position: absolute;
  z-index: 0;
  top: 5px;
  bottom: 5px;
  left: 0;
  width: var(--ind-w, 0px);
  transform: translateX(var(--ind-x, 0px));
  border-radius: 12px;
  background: var(--taxi);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -1px 0 rgba(0, 0, 0, 0.12), 0 4px 12px -4px rgba(0, 0, 0, 0.5);
  transition: transform 0.45s var(--ease-out), width 0.45s var(--ease-out);
}

.mode-switch.no-anim .mode-indicator {
  transition: none;
}

.mode-btn {
  position: relative;
  z-index: 1;
  height: 42px;
  padding: 0 12px 0 11px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-2);
  transition: color 0.25s ease, background-color 0.2s ease;
}

.mode-btn:hover {
  color: var(--text);
  background: var(--hover);
}

.mode-btn.active,
.mode-btn.active:hover {
  color: var(--taxi-ink);
  background: transparent;
}

.mode-btn .icon {
  width: 20px;
  height: 20px;
  stroke-width: 1.7;
}

.mode-btn kbd {
  margin-left: 2px;
  transition: color 0.25s ease, background-color 0.25s ease;
}

.mode-btn.active kbd {
  color: rgba(23, 20, 10, 0.62);
  background: rgba(23, 20, 10, 0.1);
  box-shadow: none;
}

/* ------------------------------------------------------------------------------------------------------------------
   Bottom right: speed cluster & camera switcher
   ------------------------------------------------------------------------------------------------------------------ */
.cluster {
  width: 272px;
  overflow: hidden;
}

.gauge {
  padding: 13px 16px 15px;
}

.gauge-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.gauge-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.gauge-alt {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gauge-alt-label {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.gauge-speed {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 5px;
}

#hud-speed {
  font-size: 42px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.gauge-unit {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.gauge-clock {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}

.gauge-clock-icon {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: var(--text-3);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: translateY(-1px);
}

/* Portrait phones keep their exact cluster layout */
@media (orientation: portrait) and (max-width: 820px) {
  .gauge-clock { display: none; }
}

.gauge-meter {
  position: relative;
  height: 4px;
  margin-top: 12px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

/* Speed as a share of the mode's top speed; it turns taxi yellow on boost */
#hud-speed-meter {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--text);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.25s linear, background-color 0.2s ease;
}

body.is-boosting #hud-speed-meter {
  background: var(--taxi);
}

.camera-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-top: 1px solid var(--divider);
}

.icon-btn {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--r-ctl);
  display: inline-grid;
  place-items: center;
  color: var(--text-2);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--hover);
}

.camera-current {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 8px;
  border-radius: var(--r-ctl);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: background-color 0.15s ease;
}

.camera-current:hover,
.camera-current.is-open {
  background: var(--hover);
}

.camera-current .icon {
  color: var(--text-3);
}

#hud-active-camera {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------------------------------------------------------------
   Full-screen interactive street map ([M])
   ------------------------------------------------------------------------------------------------------------------ */
.fullmap-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #0a1118;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.fullmap-modal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.fullmap-canvas-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: crosshair;
}

.fullmap-canvas-wrap.is-panning {
  cursor: grabbing;
}

#fullmap-canvas {
  touch-action: none;
  display: block;
  width: 100%;
  height: 100%;
}

.fullmap-header {
  position: absolute;
  top: var(--edge);
  left: var(--edge);
  right: var(--edge);
  display: flex;
  align-items: stretch;
  gap: 10px;
  pointer-events: none;
}

.fullmap-header > * {
  pointer-events: auto;
}

.fullmap-modal:not(.hidden) .fullmap-header,
.fullmap-modal:not(.hidden) .map-controls,
.fullmap-modal:not(.hidden) .fullmap-footer {
  animation: rise-in 0.45s var(--ease-out) both;
}

.fullmap-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 9px 20px 9px 11px;
}

.fullmap-title h2 {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.2;
  white-space: nowrap;
}

.fullmap-subtitle {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fullmap-search-wrap {
  flex: 0 1 440px;
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  color: var(--text-3);
  cursor: text;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.fullmap-search-wrap:focus-within {
  color: var(--text-2);
  border-color: rgba(255, 255, 255, 0.24);
  background: var(--grain), var(--glass-strong);
}

.fullmap-search {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: none;
  border: 0;
  outline: none;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  user-select: text;
}

.fullmap-search::placeholder {
  color: var(--text-3);
}

.fullmap-close {
  margin-left: auto;
  height: auto;
  padding: 0 14px 0 12px;
  border-radius: var(--r-panel);
}

.fullmap-close:hover {
  background: var(--grain), var(--glass-strong);
}

/* (centred with `translate`, which the rise-in entrance animation on `transform` leaves alone) */
.map-controls {
  position: absolute;
  top: 50%;
  right: var(--edge);
  translate: 0 -50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.map-compass {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.map-compass svg {
  width: 44px;
  height: 44px;
}

.map-compass text {
  font: 800 7.5px var(--font-sans);
  fill: #ffffff;
}

.map-zoom {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  border-radius: 14px;
}

.fullmap-footer {
  position: absolute;
  left: 50%;
  bottom: var(--edge);
  translate: -50% 0;
  display: flex;
  max-width: min(560px, calc(100% - 2 * var(--edge) - 2 * 200px));
}

.fullmap-status {
  min-width: 0;
  padding: 10px 16px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fullmap-legend {
  position: absolute;
  right: var(--edge);
  bottom: var(--edge);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}

.fullmap-modal:not(.hidden) .fullmap-legend {
  animation: rise-in 0.45s var(--ease-out) both;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-swatch {
  flex: none;
  display: inline-block;
}

.player-swatch {
  width: 10px;
  height: 11px;
  background: #ffffff;
  clip-path: polygon(50% 0, 100% 100%, 50% 78%, 0 100%);
}

.landmark-swatch {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 0 2px #0b0f14, 0 0 0 3px rgba(255, 255, 255, 0.35);
}

.gps-swatch,
.bridge-swatch {
  width: 16px;
  height: 4px;
  border-radius: 2px;
}

.gps-swatch { background: var(--taxi); }
.bridge-swatch { background: var(--highway); }

.legend-counts {
  padding-left: 14px;
  border-left: 1px solid var(--divider);
  color: var(--text-3);
}

/* ------------------------------------------------------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------------------------------------------------------ */
@media (max-width: 1800px) {
  .legend-counts { display: none; }
}

@media (max-width: 1360px) {
  .fullmap-legend { display: none; }
}

@media (max-width: 1240px) {
  .controls-hint { display: none; }
  .mode-btn kbd { display: none; }
}

@media (max-width: 1080px) {
  .mode-label,
  .tool-label,
  .tool-btn kbd { display: none; }
  .mode-btn { padding: 0 12px; }
  .tool-btn:not(.icon-only):not(.fullmap-close) { gap: 4px; padding: 0 9px; }
}

@media (max-width: 820px) {
  :root { --edge: 12px; }
  .hud-top-left { top: calc(max(var(--edge), env(safe-area-inset-top)) + 62px); }
  .brand > .mta-bullet,
  .brand-heading h1,
  .brand-subtitle { display: none; }
  .brand { height: 44px; padding: 0 12px; }
  .repo-link { display: flex; align-items: center; gap: 4px; min-height: 44px; font-size: 12px; }
  .radar { --radar-w: 220px; --radar-h: 148px; }
  .cluster { width: 220px; }
  #hud-speed { font-size: 34px; }
  .fullmap-title > div { display: none; }
  .fullmap-title { padding: 9px; }
  .fullmap-footer { max-width: calc(100% - 2 * var(--edge)); bottom: calc(var(--edge) + 34px); }
  .map-controls { top: auto; bottom: calc(var(--edge) + 96px); translate: none; }
}

@media (max-width: 620px) {
  .time-btn.active .seg-label { display: none; }
  .time-btn.active { padding: 0 9px; gap: 0; }
  .radar { display: none; }
  .hud-bottom-right { bottom: calc(var(--edge) + 64px); }
  .gauge { display: none; }
  .camera-switch { border-top: 0; }
}

/* Touch controls reserve the bottom corners; mode and camera selection remain within reach. */
#touch-controls {
  position: fixed;
  z-index: 12;
  left: max(var(--edge), env(safe-area-inset-left));
  right: max(var(--edge), env(safe-area-inset-right));
  bottom: calc(max(var(--edge), env(safe-area-inset-bottom)) + 72px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
  -webkit-touch-callout: none;
}

#touch-controls[hidden],
.touch-action[hidden] { display: none; }

.touch-movement { text-align: center; }

#touch-stick {
  position: relative;
  width: 136px;
  height: 136px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.06) 32%, transparent 33%), var(--glass);
  box-shadow: var(--shadow), inset 0 0 0 12px rgba(255, 255, 255, 0.025);
  pointer-events: auto;
  touch-action: none;
}

.touch-stick-axis::before,
.touch-stick-axis::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.12);
}
.touch-stick-axis::before { top: 16px; bottom: 16px; width: 1px; left: 50%; }
.touch-stick-axis::after { left: 16px; right: 16px; height: 1px; top: 50%; }

#touch-stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(246, 245, 242, 0.8);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transform: translate(calc(-50% + var(--stick-x, 0px)), calc(-50% + var(--stick-y, 0px)));
  pointer-events: none;
}

#touch-stick.is-pressed #touch-stick-knob { background: var(--taxi); border-color: var(--taxi); }

.touch-caption,
.touch-look-hint {
  color: var(--text-2);
  font-size: 11px;
  font-weight: 550;
  text-shadow: 0 1px 5px #000;
}
.touch-caption { display: block; margin-top: 8px; }
.touch-look-hint {
  position: fixed;
  top: calc(max(var(--edge), env(safe-area-inset-top)) + 120px);
  right: max(var(--edge), env(safe-area-inset-right));
  padding: 4px;
}

.touch-actions {
  display: grid;
  grid-template-columns: repeat(2, 64px);
  gap: 10px;
  padding-bottom: 22px;
}
.touch-action {
  width: 64px;
  height: 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: var(--glass-strong);
  box-shadow: var(--shadow);
  font-size: 11px;
  font-weight: 650;
  pointer-events: auto;
  touch-action: none;
}
.touch-action > [aria-hidden] { font-size: 23px; line-height: 1; }
.touch-boost { grid-column: 2; border-color: rgba(255, 194, 26, 0.65); color: var(--taxi); }
.touch-action.is-pressed { color: var(--taxi-ink); background: var(--taxi); border-color: var(--taxi); }

body.touch-enabled .controls-hint,
body.touch-enabled .radar,
body.touch-enabled .gauge,
body.touch-enabled kbd,
body.touch-enabled .toolbar-divider,
body.touch-enabled .seg-label { display: none; }

body.touch-enabled .hud-top-right { top: max(var(--edge), env(safe-area-inset-top)); right: max(var(--edge), env(safe-area-inset-right)); }
body.touch-enabled .toolbar { gap: 2px; padding: 4px; }
body.touch-enabled .time-btn,
body.touch-enabled .time-btn.active { height: 44px; min-width: 44px; padding: 0 8px; gap: 0; }
body.touch-enabled .tool-btn { min-width: 44px; min-height: 44px; }
body.touch-enabled .tool-label { display: none; }
body.touch-enabled .hud-bottom-center { bottom: max(var(--edge), env(safe-area-inset-bottom)); }
body.touch-enabled .mode-label { display: block; font-size: 10px; }
body.touch-enabled .mode-btn { width: 62px; height: 48px; padding: 0; flex-direction: column; justify-content: center; gap: 3px; }
body.touch-enabled .hud-bottom-right { top: calc(max(var(--edge), env(safe-area-inset-top)) + 62px); right: max(var(--edge), env(safe-area-inset-right)); bottom: auto; }
body.touch-enabled .cluster { width: 230px; }
body.touch-enabled .camera-switch { border: 0; }
body.touch-enabled .camera-switch .icon-btn { width: 44px; height: 44px; }
body.touch-enabled .hud-bottom-left { left: max(var(--edge), env(safe-area-inset-left)); bottom: calc(max(var(--edge), env(safe-area-inset-bottom)) + 254px); max-width: calc(100% - 2 * var(--edge)); }
body.touch-enabled .fullmap-header { top: max(var(--edge), env(safe-area-inset-top)); left: max(var(--edge), env(safe-area-inset-left)); right: max(var(--edge), env(safe-area-inset-right)); }
body.touch-enabled .map-controls .icon-btn { width: 44px; height: 44px; }
body.touch-enabled .pop-item { min-height: 44px; }

@media (max-width: 360px) {
  body.touch-enabled .toolbar { width: 194px; height: auto; flex-wrap: wrap; justify-content: center; }
  body.touch-enabled .hud-bottom-right { top: calc(max(var(--edge), env(safe-area-inset-top)) + 114px); }
  .touch-look-hint { top: calc(max(var(--edge), env(safe-area-inset-top)) + 172px); }
}

@media (max-height: 500px) {
  body.touch-enabled .hud-bottom-left { display: none; }
  body.touch-enabled .hud-bottom-right { top: calc(max(var(--edge), env(safe-area-inset-top)) + 58px); }
  #touch-controls { bottom: max(var(--edge), env(safe-area-inset-bottom)); }
}

/* ------------------------------------------------------------------------------------------------------------------
   Compact in-game HUD for desktop and landscape. Portrait phones keep their own layout above and are not touched.
   ------------------------------------------------------------------------------------------------------------------ */
@media (min-width: 641px) and (orientation: landscape) {
  :root { --edge: 12px; --bar-h: 38px; }

  /* Top left: just the badge, name and fps */
  .brand { gap: 8px; padding: 0 12px 0 6px; }
  .mta-bullet { width: 26px; height: 26px; font-size: 11px; }
  .brand .kaiju-class, .brand .brand-tech { display: none; }
  .brand-subtitle { font-size: 11px; line-height: 1.2; }
  .brand-titles { display: flex; align-items: baseline; gap: 8px; }

  /* Top right: icon-only toolbar */
  .toolbar .seg-label, .toolbar .tool-label, .toolbar kbd { display: none; }
  .toolbar .time-btn, .toolbar .tool-btn { min-width: 32px; padding: 0 8px; }

  /* Top centre: one slim score strip, no sub-captions */
  .kaiju-combat-telemetry { top: var(--edge); background: rgba(12, 18, 22, 0.55); }
  .combat-readout { min-width: 70px; gap: 1px; padding: 5px 10px 5px; }
  .combat-readout strong { font-size: 14px; }
  .combat-label { font-size: 8px; }
  .combat-sub { display: none; }
  .combat-divider { margin: 7px 0; }
  .kaiju-threat { top: 58px; width: min(300px, calc(100% - 32px)); gap: 4px; }
  .threat-head { font-size: 11px; }
  .threat-track { height: 4px; }
  .kaiju-banner { top: 28%; }

  /* Bottom centre: slim vitals and weapons, controls hint removed */
  body.kaiju-active #hud-controls-hint { display: none; }
  .kaiju-vitals { bottom: var(--edge); gap: 10px; padding: 6px 8px; background: rgba(12, 18, 22, 0.6); }
  .vital { width: 84px; gap: 3px; }
  .vital-head { font-size: 8px; }
  .vital-track { height: 4px; }
  .weapon-rack { gap: 3px; }
  .weapon-btn { min-width: 0; flex-direction: row; align-items: center; gap: 5px; padding: 4px 7px 6px; font-size: 9px; }
  .weapon-btn kbd { font-size: 8px; }
  .weapon-ammo { position: static; margin-left: 2px; font-size: 9px; }

  /* Bottom left: small radar, small street signs */
  .hud-bottom-left { gap: 6px; }
  .radar { --radar-w: 176px; --radar-h: 112px; border-radius: 12px; opacity: 0.88; }
  .radar:hover { opacity: 1; }
  .radar-key { display: none; }
  .location-signs { gap: 4px; }
  .street-sign { max-width: 150px; padding: 5px 9px 4px; font-size: 11px; border-radius: 4px; outline-offset: -3px; }
  .location-near { display: none; }

  /* Bottom right: small speed readout, one-button camera switch */
  .cluster { width: 176px; }
  .gauge { padding: 8px 12px 9px; }
  .gauge-label { font-size: 9px; }
  .gauge-speed { margin-top: 2px; }
  #hud-speed { font-size: 26px; }
  .gauge-unit { font-size: 10px; }
  .gauge-clock { font-size: 12px; gap: 4px; }
  .gauge-clock-icon { width: 11px; height: 11px; }
  .gauge-meter { margin-top: 6px; height: 3px; }
  .camera-switch { padding: 2px; }
  .camera-switch #cam-prev, .camera-switch #cam-next { display: none; }
  .camera-current { height: 28px; font-size: 11px; gap: 6px; }

  /* Keyboard layout: hull, cells, weapons and ability stack in the top-right corner */
  body:not(.touch-enabled) .kaiju-vitals { top: var(--edge); right: var(--edge); bottom: auto; left: auto; width: 228px; flex-direction: column; align-items: stretch; gap: 7px; padding: 9px 10px; transform: none; }
  body:not(.touch-enabled) .vital { width: auto; }
  body:not(.touch-enabled) .weapon-rack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body:not(.touch-enabled) .weapon-ammo { margin-left: auto; }
  body:not(.touch-enabled).kaiju-active .kaiju-ability { justify-content: center; }

  /* Time of day + utilities: a slim bar in the bottom-right corner, the speed cluster sits above it */
  body:not(.touch-enabled) .hud-top-right { top: auto; bottom: var(--edge); }
  body:not(.touch-enabled) .hud-bottom-right { bottom: calc(var(--edge) + 38px); }
  body:not(.touch-enabled) .toolbar { height: 32px; padding: 0 3px; gap: 1px; opacity: 0.82; transition: opacity 0.2s ease; }
  body:not(.touch-enabled) .toolbar:hover, body:not(.touch-enabled) .toolbar:focus-within { opacity: 1; }
  body:not(.touch-enabled) .toolbar .time-btn, body:not(.touch-enabled) .toolbar .tool-btn { height: 26px; min-width: 28px; padding: 0 6px; }
  body:not(.touch-enabled) .toolbar .icon { width: 15px; height: 15px; }
  body:not(.touch-enabled) .toolbar-divider { height: 16px; }
}

@media (min-width: 641px) and (orientation: landscape) and (max-height: 560px) {
  .radar { --radar-w: 144px; --radar-h: 92px; }
  .street-sign { display: none; }
  .kaiju-banner { top: 22%; }
}


@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (hover: hover) and (pointer: fine) and (min-width: 641px) {
  body.kaiju-orbiting .kaiju-reticle { opacity: 0; }
}

/* ------------------------------------------------------------------------------------------------------------------
   Touch play: four zones and nothing else. Top left = score + vitals, top right = pause / camera / map / settings,
   bottom left = stick, bottom right = action pad. Time of day, radar, speed, street signs and captions are hidden so
   the middle of the screen stays clear.
   ------------------------------------------------------------------------------------------------------------------ */
.touch-only { display: none; }
body.touch-enabled .touch-only { display: inline-flex; }

/* Every touch size hangs off these. --k scales panels and text (phones 1, tablets up), --tb is a toolbar button,
   --bar the height of the top row (score strip and toolbar share it), --col the left column (vitals + radar).
   The pad and stick follow the short side of the screen, so a 320px phone and a 430px phone both fit them. */
body.touch-enabled {
  --t-top: max(10px, env(safe-area-inset-top));
  --t-left: max(10px, env(safe-area-inset-left));
  --t-right: max(10px, env(safe-area-inset-right));
  --t-bottom: max(14px, env(safe-area-inset-bottom));
  --k: 1;
  --tb: 40px;
  --bar: calc(var(--tb) + 8px);
  --col: calc(160px * var(--k));
  --side: min(calc(176px * var(--k)), calc(100vw - var(--col) - var(--t-left) - var(--t-right) - 10px));
  --pad-b: clamp(44px, 13.4vmin, 52px);
  --pad-gap: clamp(5px, 1.9vmin, 8px);
  --pad-w: calc(var(--pad-b) * 4 + var(--pad-gap) * 3);
  --pad-h: calc(var(--pad-b) * 3 + var(--pad-gap) * 2);
  --stick: clamp(96px, 30vmin, 124px);
}
@media (max-width: 349px) {
  body.touch-enabled { --tb: 36px; }
}
/* Tablets: bigger text and controls, lifted off the corners to where thumbs rest */
@media (min-width: 700px) and (min-height: 700px) {
  body.touch-enabled {
    --k: 1.25; --tb: 48px; --pad-b: 64px; --pad-gap: 10px; --stick: 150px;
    --t-top: max(14px, env(safe-area-inset-top));
    --t-left: max(18px, env(safe-area-inset-left));
    --t-right: max(18px, env(safe-area-inset-right));
    --t-bottom: max(28px, env(safe-area-inset-bottom));
  }
}
@media (min-width: 1000px) and (min-height: 1000px) {
  body.touch-enabled { --k: 1.4; --tb: 52px; --pad-b: 72px; --pad-gap: 12px; --stick: 168px; --t-bottom: max(36px, env(safe-area-inset-bottom)); }
}

body.touch-enabled.kaiju-active .hud-top-left,
body.touch-enabled.kaiju-active .hud-bottom-left,
body.touch-enabled.kaiju-active .hud-bottom-right,
body.touch-enabled.kaiju-active .hud-bottom-center,
body.touch-enabled.kaiju-active .time-switch,
body.touch-enabled.kaiju-active #btn-toggle-hud,
body.touch-enabled.kaiju-active .toolbar-divider,
body.touch-enabled .kaiju-keystrip,
body.touch-enabled .kaiju-tip { display: none; }

/* Top right: one row of square buttons, never wrapping */
body.touch-enabled.kaiju-active .hud-top-right { top: var(--t-top); right: var(--t-right); }
body.touch-enabled.kaiju-active .toolbar { width: auto; height: var(--bar); flex-wrap: nowrap; gap: 2px; padding: 0 3px; }
body.touch-enabled.kaiju-active .toolbar .tool-btn { width: var(--tb); min-width: var(--tb); height: var(--tb); min-height: var(--tb); padding: 0; justify-content: center; }
body.touch-enabled.kaiju-active .toolbar .icon { width: calc(18px * var(--k)); height: calc(18px * var(--k)); }
/* Narrow phones: settings stay one tap away in the pause menu, so the score strip keeps its room */
@media (max-width: 430px) {
  body.touch-enabled.kaiju-active #btn-open-settings { display: none; }
}

/* Top left: wave + score, the same height as the toolbar */
body.touch-enabled.kaiju-active .kaiju-combat-telemetry { top: var(--t-top); left: var(--t-left); width: auto; height: var(--bar); align-items: center; transform: none; background: rgba(12, 18, 22, 0.6); }
body.touch-enabled.kaiju-active .combat-readout { min-width: 0; flex: none; justify-content: center; gap: calc(2px * var(--k)); padding: 0 calc(10px * var(--k)); }
body.touch-enabled.kaiju-active .combat-readout strong { font-size: calc(15px * var(--k)); }
body.touch-enabled.kaiju-active .combat-label { font-size: calc(9px * var(--k)); }
body.touch-enabled.kaiju-active .combat-sub,
body.touch-enabled.kaiju-active .kaiju-combat-telemetry > :nth-child(3),
body.touch-enabled.kaiju-active .kaiju-combat-telemetry > :nth-child(4) { display: none; }
body.touch-enabled.kaiju-active .combat-divider { align-self: stretch; margin: 8px 0; }

/* Vitals: one line per bar (label, bar, value), then the active weapon */
body.touch-enabled.kaiju-active .kaiju-vitals {
  top: calc(var(--t-top) + var(--bar) + 6px);
  left: var(--t-left);
  bottom: auto;
  width: var(--col);
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: calc(5px * var(--k));
  padding: calc(7px * var(--k)) calc(8px * var(--k));
  transform: none;
  background: rgba(12, 18, 22, 0.6);
}
body.touch-enabled.kaiju-active .vital { display: grid; grid-template-columns: calc(36px * var(--k)) 1fr calc(24px * var(--k)); align-items: center; gap: calc(6px * var(--k)); width: auto; flex: none; }
body.touch-enabled.kaiju-active .vital-head { display: contents; font-size: calc(9px * var(--k)); }
body.touch-enabled.kaiju-active .vital-head span:last-child { order: 2; font-size: calc(10px * var(--k)); text-align: right; font-variant-numeric: tabular-nums; }
body.touch-enabled.kaiju-active .vital-track { order: 1; height: calc(5px * var(--k)); }
body.touch-enabled.kaiju-active .weapon-rack { width: auto; pointer-events: none; }
body.touch-enabled.kaiju-active .weapon-btn:not(.active) { display: none; }
body.touch-enabled.kaiju-active .weapon-btn.active { min-width: 0; flex: 1; flex-direction: row; align-items: center; gap: 6px; padding: calc(4px * var(--k)) calc(7px * var(--k)) calc(6px * var(--k)); font-size: calc(10px * var(--k)); }
body.touch-enabled.kaiju-active .weapon-btn kbd { display: none; }
body.touch-enabled.kaiju-active .weapon-ammo { position: static; margin-left: auto; font-size: calc(10px * var(--k)); }

/* Radar under the vitals (tap opens the full map). --vitals-bottom comes from js/hud-stack.js; the height gives way
   to the stick on short landscape screens. */
body.touch-enabled.kaiju-active .hud-bottom-left { display: flex; top: calc(var(--vitals-bottom, 140px) + 6px); left: var(--t-left); bottom: auto; max-width: none; }
body.touch-enabled.kaiju-active .hud-bottom-left .location { display: none; }
body.touch-enabled.kaiju-active .radar { display: block; width: var(--col); height: clamp(48px, calc(100dvh - var(--vitals-bottom, 140px) - 6px - var(--stick) - var(--t-bottom) - 12px), calc(104px * var(--k))); border-radius: 10px; opacity: 0.9; }
body.touch-enabled.kaiju-active .radar:hover { transform: none; }
body.touch-enabled.kaiju-active .radar-north { top: 4px; width: 14px; height: 14px; font-size: 8px; }

/* Right column under the toolbar: kaiju health (or the co-op zone hold in its slot), then the story objective */
body.touch-enabled.kaiju-active .kaiju-threat,
body.touch-enabled.kaiju-active .kaiju-threat.is-visible { top: calc(var(--t-top) + var(--bar) + 8px); left: auto; right: var(--t-right); width: var(--side); gap: 4px; transform: none; }
body.touch-enabled.kaiju-active .threat-head { justify-content: flex-end; font-size: calc(10px * var(--k)); letter-spacing: 0.12em; }
body.touch-enabled.kaiju-active .threat-chips { justify-content: flex-end; }
body.touch-enabled.kaiju-active .kaiju-zone-hold { top: calc(var(--t-top) + var(--bar) + 8px); left: auto; right: var(--t-right); width: var(--side); max-width: none; margin: 0; gap: 7px; padding: 5px 8px; border-radius: 8px; font-size: calc(9px * var(--k)); letter-spacing: 0.06em; line-height: 1.3; text-align: left; animation: none; }
body.touch-enabled.kaiju-active #kaiju-zone-hold-text { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; }
body.touch-enabled.kaiju-active:has(#kaiju-zone-hold:not([hidden])) .kaiju-objective { top: calc(var(--t-top) + var(--bar) + 8px + 54px * var(--k)); }
body.touch-enabled.kaiju-active .kaiju-objective { top: calc(var(--t-top) + var(--bar) + 8px + 46px * var(--k)); left: auto; right: var(--t-right); width: var(--side); padding: calc(6px * var(--k)) calc(9px * var(--k)) calc(7px * var(--k)); transform: none; background: rgba(12, 18, 22, 0.6); }
body.touch-enabled.kaiju-active .kaiju-objective.is-new { animation: touch-panel-in 0.4s ease-out; }
body.touch-enabled.kaiju-active .kaiju-objective-kicker { font-size: calc(9px * var(--k)); letter-spacing: 0.14em; }
body.touch-enabled.kaiju-active .kaiju-objective-text { margin-top: 2px; font-size: calc(11px * var(--k)); line-height: 1.25; }
body.touch-enabled.kaiju-active .kaiju-objective-bar { margin-top: 5px; }
body.touch-enabled.kaiju-active .kaiju-objective-sub { margin-top: 4px; font-size: calc(9px * var(--k)); letter-spacing: 0.08em; }
@keyframes touch-panel-in { from { opacity: 0; } }

/* Radio comms: above the controls in portrait, between the stick and the pad in landscape */
body.touch-enabled.kaiju-active .kaiju-comms { left: var(--t-left); right: var(--t-right); bottom: calc(var(--t-bottom) + var(--pad-h) + 12px); width: auto; max-width: 560px; margin-inline: auto; padding: 8px 10px; gap: 9px; transform: none; }
body.touch-enabled.kaiju-active .kaiju-comms.is-in { animation: touch-panel-in 0.3s ease-out; }
body.touch-enabled.kaiju-active .kaiju-comms-portrait { width: calc(30px * var(--k)); height: calc(30px * var(--k)); font-size: calc(13px * var(--k)); }
body.touch-enabled.kaiju-active .kaiju-comms-who strong { font-size: calc(10px * var(--k)); }
body.touch-enabled.kaiju-active .kaiju-comms-who span { font-size: calc(9px * var(--k)); }
body.touch-enabled.kaiju-active .kaiju-comms-text { margin-top: 2px; font-size: calc(12px * var(--k)); line-height: 1.35; }

/* Co-op squad: a strip of chips between the two columns, under the top row (your own hull is in the vitals) */
body.touch-enabled.kaiju-active .kaiju-team { top: calc(var(--t-top) + var(--bar) + 8px); left: calc(var(--t-left) + var(--col) + 8px); right: calc(var(--t-right) + var(--side) + 8px); width: auto; flex-direction: row; justify-content: center; gap: 4px; transform: none; }
body.touch-enabled.kaiju-active .kaiju-team-row { flex: 0 1 calc(96px * var(--k)); min-width: 0; grid-template-columns: minmax(0, 1fr); grid-template-areas: "name" "bar"; gap: 3px; padding: 4px 6px; font-size: calc(10px * var(--k)); }
body.touch-enabled.kaiju-active .kaiju-team-row.is-me,
body.touch-enabled.kaiju-active .kaiju-team-meta { display: none; }
body.touch-enabled.kaiju-active .kaiju-team-row.is-downed .kaiju-team-name { color: #ff8a7a; }

@media (orientation: landscape) {
  body.touch-enabled.kaiju-active .kaiju-comms { left: calc(var(--t-left) + var(--stick) + 14px); right: calc(var(--t-right) + var(--pad-w) + 14px); bottom: var(--t-bottom); }
  /* Announcements stay between the two columns */
  body.touch-enabled.kaiju-active .kaiju-banner { max-width: calc(100vw - 2 * (var(--col) + var(--t-left) + 12px)); }
}
/* Short landscape phones: the objective slims down so it clears the action pad */
@media (orientation: landscape) and (max-height: 400px) {
  body.touch-enabled.kaiju-active .kaiju-banner { top: 31%; gap: 5px; }
  body.touch-enabled.kaiju-active .kaiju-banner:not(.is-small) strong { font-size: clamp(22px, 8.5vh, 34px); }
  body.touch-enabled.kaiju-active .kaiju-banner span { font-size: 9px; letter-spacing: 0.14em; }
  body.touch-enabled.kaiju-active .kaiju-banner.is-small { top: 31%; }
  body.touch-enabled.kaiju-active .kaiju-objective-kicker { display: none; }
  body.touch-enabled.kaiju-active .kaiju-objective-text { margin-top: 0; }
}
@media (orientation: landscape) and (max-height: 350px) {
  body.touch-enabled.kaiju-active .kaiju-objective-sub { display: none; }
  body.touch-enabled.kaiju-active .kaiju-objective-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  body.touch-enabled.kaiju-active .kaiju-comms-text { font-size: 11px; line-height: 1.3; }
  body.touch-enabled.kaiju-active .kaiju-comms-who span { display: none; }
}

/* Bottom corners: stick left, action pad right. Neither may shrink, the gap between them does. */
body.touch-enabled #touch-controls { left: var(--t-left); right: var(--t-right); bottom: var(--t-bottom); align-items: flex-end; gap: 8px; }
body:not(.kaiju-active) #touch-controls,
body.kaiju-over #touch-controls,
body.kaiju-paused #touch-controls { display: none; }

body.touch-enabled #touch-stick { flex: none; width: var(--stick); height: var(--stick); border: 1.5px solid rgba(246, 245, 242, 0.25); background: rgba(12, 18, 22, 0.35); box-shadow: none; }
body.touch-enabled #touch-stick-knob { width: calc(var(--stick) * 0.38); height: calc(var(--stick) * 0.38); border-color: rgba(246, 245, 242, 0.5); background: rgba(246, 245, 242, 0.55); box-shadow: none; }

body.touch-enabled .touch-look-hint { top: auto; right: 0; bottom: calc(var(--t-bottom) + var(--pad-h) + 10px); left: 0; font-size: calc(11px * var(--k)); text-align: center; pointer-events: none; animation: touch-hint-fade 6s ease forwards; }
@keyframes touch-hint-fade { 0%, 75% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
/* Landscape: along the bottom edge between the stick and the pad, clear of the reticle */
@media (orientation: landscape) {
  body.touch-enabled .touch-look-hint { bottom: calc(var(--t-bottom) + 2px); }
}

.touch-pad {
  display: grid;
  flex: none;
  grid-template-columns: repeat(4, var(--pad-b));
  grid-template-rows: repeat(3, var(--pad-b));
  grid-template-areas: "ability melee weapon shield" "aim jets fire fire" ". boost fire fire";
  gap: var(--pad-gap);
  pointer-events: none;
}
.touch-pad .touch-action {
  width: 100%;
  height: 100%;
  gap: 0;
  border: 1.5px solid rgba(246, 245, 242, 0.28);
  border-radius: 50%;
  color: var(--text);
  background: rgba(12, 18, 22, 0.45);
  box-shadow: none;
  font-family: var(--font-sign);
  font-size: clamp(9px, calc(var(--pad-b) * 0.18), 13px);
  font-weight: 700;
  letter-spacing: 0.08em;
  backdrop-filter: blur(6px);
}
.touch-pad .pad-melee { grid-area: melee; }
.touch-pad .pad-weapon { grid-area: weapon; }
.touch-pad .pad-shield { grid-area: shield; border-color: rgba(95, 244, 255, 0.55); }
.touch-pad .pad-jets { grid-area: jets; }
.touch-pad .pad-boost { grid-area: boost; border-color: rgba(255, 200, 87, 0.6); }
/* Aim down sights: a toggle, only in the cockpit view (KaijuGame.updateAds sets body.kaiju-cockpit) */
.touch-pad .pad-aim { grid-area: aim; }
body:not(.kaiju-cockpit) .touch-pad .pad-aim { visibility: hidden; }
.touch-pad .pad-aim.is-on { border-color: var(--warn); color: var(--warn); background: rgba(255, 200, 87, 0.16); }
.touch-pad .pad-fire { grid-area: fire; border: 0; color: var(--taxi-ink); background: var(--warn); font-size: calc(var(--pad-b) * 0.29); letter-spacing: 0.14em; }
.touch-pad .touch-action.is-pressed { border-color: var(--text); color: var(--taxi-ink); background: var(--text); }
.touch-pad .pad-fire.is-pressed { background: var(--taxi); transform: scale(0.96); }

/* Fullscreen toggle (hidden where the page can't go fullscreen) */
.tool-btn[hidden] { display: none !important; }
#btn-fullscreen .icon-shrink,
#btn-fullscreen.is-fullscreen .icon-expand { display: none; }
#btn-fullscreen.is-fullscreen .icon-shrink { display: block; }

/* During a touch run the whole page is a game surface: no scrolling, zooming, text selection or callouts. */
html:has(body.touch-enabled.kaiju-active),
body.touch-enabled.kaiju-active {
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* Run loadout (left edge, between the brand card and the radar): keyboard layouts only, touch layouts untouched */
.kaiju-loadout { display: none; }
body.kaiju-active:not(.touch-enabled):not(.kaiju-over) .kaiju-loadout { position: fixed; z-index: 8; top: calc(var(--edge) + 92px); left: var(--edge); display: flex; width: 240px; max-height: calc(100dvh - var(--edge) * 2 - 92px - 66px - min(184px * var(--radar-k, 1), 58vh)); flex-direction: column; gap: 14px; padding: 12px; overflow-y: auto; border: 1px solid var(--glass-border); border-radius: 8px; color: var(--text); background: var(--hud-glass, rgba(12, 18, 22, 0.42)); backdrop-filter: blur(6px); scrollbar-width: thin; }
body.hud-minimized .kaiju-loadout { visibility: hidden; }
/* Ability rack: own panel stacked above the bottom-right speed cluster (keyboard layouts only; touch untouched) */
.kaiju-abilities { display: none; }
body.kaiju-active:not(.touch-enabled) .hud-bottom-right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
body.kaiju-active:not(.touch-enabled):not(.kaiju-over) .kaiju-abilities { position: fixed; z-index: 8; right: var(--edge); bottom: calc(100dvh - var(--cluster-top, 100dvh) + 10px); display: flex; width: 240px; max-height: calc(var(--cluster-top, 100dvh) - var(--edge) - 92px - 10px); flex-direction: column; gap: 6px; padding: 12px; overflow-y: auto; border: 1px solid var(--glass-border); border-radius: 8px; color: var(--text); }
/* Landscape keyboard layout: vitals live top-right, so the rack stacks right under them (same width), stopping above
   the speed cluster. --vitals-bottom / --cluster-top come from js/hud-stack.js */
@media (min-width: 641px) and (orientation: landscape) {
  body.kaiju-active:not(.touch-enabled):not(.kaiju-over) .kaiju-abilities { top: calc(var(--vitals-bottom, 220px) + 8px); bottom: auto; width: 228px; max-height: calc(var(--cluster-top, 100dvh) - var(--vitals-bottom, 220px) - 18px); padding: 10px; }
}
body.hud-minimized .kaiju-abilities { visibility: hidden; }
@media (max-height: 620px) { body.kaiju-active:not(.touch-enabled) .kaiju-loadout { display: none; } }
.loadout-group { display: flex; flex-direction: column; gap: 6px; }
.loadout-head { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 6px; border-bottom: 1px solid var(--glass-border); }
.loadout-head h2 { margin: 0; color: var(--text-3); font-family: var(--font-sign); font-size: 10px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.loadout-meta { color: var(--warn); font-family: var(--font-sign); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; }
.loadout-slots, .loadout-upgrades { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.loadout-slot button { display: flex; width: 100%; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 8px; padding: 6px 8px; border: 1px solid rgba(246, 245, 242, 0.12); border-radius: 4px; color: var(--text-2, var(--text)); background: transparent; font: inherit; text-align: left; cursor: pointer; }
.loadout-slot.is-selected button { border-color: var(--warn); color: var(--text); background: rgba(255, 200, 87, 0.1); }
.loadout-slot-name { font-family: var(--font-sign); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.loadout-slot.is-selected .loadout-slot-name { color: var(--warn); }
.loadout-slot.is-empty { padding: 6px 8px; border: 1px dashed rgba(246, 245, 242, 0.12); border-radius: 4px; color: var(--text-3); }
.loadout-slot kbd { min-width: 16px; padding: 1px 4px; border: 1px solid rgba(255, 200, 87, 0.5); border-radius: 3px; color: var(--warn); font-family: var(--font-sign); font-size: 9px; text-align: center; }
.loadout-desc { flex-basis: 100%; color: var(--text-3); font-size: 11px; line-height: 1.4; text-wrap: pretty; }
.loadout-hint, .loadout-effect { margin: 0; color: var(--text-3); font-family: var(--font-sign); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; }
.loadout-effect { color: var(--warn); }
.loadout-upgrade { display: flex; flex-direction: column; gap: 2px; padding: 4px 0 4px 8px; border-left: 2px solid rgba(246, 245, 242, 0.18); }
.loadout-upgrade[data-rarity="rare"] { border-left-color: rgb(95, 244, 255); }
.loadout-upgrade[data-rarity="epic"] { border-left-color: var(--warn); }
.loadout-upgrade[data-rarity="exotic"] { border-left-color: rgb(255, 90, 210); }
.loadout-upgrade-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.loadout-upgrade-name { font-size: 12px; font-weight: 600; }
.loadout-pips { display: inline-flex; flex-shrink: 0; gap: 2px; }
.loadout-pips i { width: 6px; height: 6px; border: 1px solid rgba(246, 245, 242, 0.3); border-radius: 1px; }
.loadout-pips i.on { border-color: var(--warn); background: var(--warn); }
.loadout-none { color: var(--text-3); font-size: 11px; line-height: 1.4; }

/* Lighter in-run HUD glass on keyboard layouts: lower fill + softer blur so the city reads through. Touch/portrait
   layouts and the full map keep their own backgrounds. A faint text shadow keeps the readouts legible on bright sky. */
body.kaiju-active:not(.touch-enabled) {
  --hud-glass: rgba(12, 18, 22, 0.42);
}
body.kaiju-active:not(.touch-enabled) :is(.brand, .toolbar, .radar, .cluster).panel {
  background: var(--hud-glass);
  -webkit-backdrop-filter: blur(6px) saturate(130%);
  backdrop-filter: blur(6px) saturate(130%);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}
body.kaiju-active:not(.touch-enabled) :is(.kaiju-combat-telemetry, .kaiju-vitals, .kaiju-tip, .kaiju-loadout, .kaiju-abilities) {
  background: var(--hud-glass);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
body.kaiju-active:not(.touch-enabled) :is(.brand, .toolbar, .cluster, .kaiju-combat-telemetry, .kaiju-vitals, .kaiju-tip, .kaiju-loadout, .kaiju-abilities) {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

/* Special ability readout (vitals row) and touch button */
.kaiju-ability { display: none; }
body.kaiju-active .kaiju-ability { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border: 1px solid rgba(246, 245, 242, 0.12); border-radius: 4px; color: var(--text-3); font-family: var(--font-sign); font-size: 10px; font-weight: 700; letter-spacing: 0.1em; white-space: nowrap; }
body.kaiju-active .kaiju-ability.is-ready { border-color: rgba(242, 246, 255, 0.55); color: var(--text); }
.kaiju-ability kbd { min-width: 15px; padding: 1px 4px; border: 1px solid rgba(246, 245, 242, 0.2); border-radius: 3px; font-family: inherit; font-size: 9px; text-align: center; }
.kaiju-ability-count { color: var(--warn); }
body.touch-enabled.kaiju-active .kaiju-ability { display: none; }

.touch-pad .pad-ability { grid-area: ability; color: var(--text-3); }
.touch-pad .pad-ability.is-ready { border-color: rgba(242, 246, 255, 0.7); color: var(--text); }
.touch-pad .pad-shield.is-on { border-color: rgb(95, 244, 255); color: rgb(95, 244, 255); background: rgba(95, 244, 255, 0.16); }
body.kaiju-drafting #touch-controls { display: none; }

/* Wave debrief & upgrade draft */
/* Flex + margin:auto centres the panel but, unlike place-items:center, never pushes an overflowing panel's top out of
   reach: a tall debrief scrolls from its header down to the Confirm button. */
.kaiju-draft { position: fixed; inset: 0; z-index: 125; display: flex; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; background: rgba(2, 6, 8, 0.66); backdrop-filter: blur(8px); }
.kaiju-draft[hidden] { display: none; }
.draft-panel { display: flex; flex-direction: column; gap: 16px; width: min(920px, 100%); margin: auto; padding: 22px; border: 1px solid var(--glass-border); border-radius: 8px; color: var(--text); background: var(--glass-strong); box-shadow: var(--shadow); animation: rise-in 0.4s var(--ease-out) both; }
.draft-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.draft-head h2 { margin: 4px 0 0; font-family: var(--font-sign); font-size: 24px; letter-spacing: 0.04em; text-transform: uppercase; text-wrap: balance; }
.draft-reward { margin: 6px 0 0; color: var(--text-2); font-size: 14px; line-height: 1.5; text-wrap: pretty; }
.draft-grade { display: flex; flex-direction: column; align-items: center; min-width: 76px; padding: 8px 10px; border: 1px solid rgba(246, 245, 242, 0.16); border-radius: 6px; font-family: var(--font-sign); }
.draft-grade span { font-size: 40px; font-weight: 800; line-height: 1; }
.draft-grade span[data-grade="S"], .draft-grade span[data-grade="A"] { color: var(--warn); }
.draft-grade span[data-grade="C"] { color: var(--bad); }
.draft-grade small { margin-top: 4px; color: var(--text-3); font-size: 10px; letter-spacing: 0.1em; }
.draft-lines { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; margin: 0; padding: 0; list-style: none; color: var(--text-2); font-size: 13px; }
.draft-lines li { display: flex; align-items: baseline; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--divider); }
.draft-lines li > :first-child { flex: 1; }
.draft-line-value { color: var(--text); font-variant-numeric: tabular-nums; }
.draft-line-pts { min-width: 40px; color: var(--text-3); font-family: var(--font-sign); font-size: 11px; text-align: right; }
.draft-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.draft-card { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-height: 150px; padding: 14px; border: 1px solid rgba(246, 245, 242, 0.14); border-radius: 6px; color: var(--text); background: rgba(246, 245, 242, 0.03); text-align: left; cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease, transform 0.2s var(--ease-out); }
.draft-card:hover { background: rgba(246, 245, 242, 0.07); transform: translateY(-2px); }
.draft-card:focus-visible { outline: 2px solid var(--warn); outline-offset: 2px; }
.draft-card[data-rarity="rare"] { border-color: rgba(95, 244, 255, 0.4); }
.draft-card[data-rarity="epic"] { border-color: rgba(255, 200, 87, 0.55); }
.draft-card.is-selected { border-color: var(--warn); background: rgba(255, 200, 87, 0.12); box-shadow: inset 0 0 0 1px var(--warn); }
.draft-card-head { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-family: var(--font-sign); font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.draft-card[data-rarity="rare"] .draft-card-head { color: rgb(95, 244, 255); }
.draft-card[data-rarity="epic"] .draft-card-head { color: var(--warn); }
.draft-card-head kbd, .draft-actions kbd { min-width: 18px; padding: 1px 5px; border: 1px solid currentColor; border-radius: 3px; font-family: inherit; font-size: 10px; text-align: center; }
.draft-card strong { font-family: var(--font-sign); font-size: 16px; letter-spacing: 0.02em; }
.draft-card-desc { color: var(--text-2); font-size: 14px; line-height: 1.45; text-wrap: pretty; }
.draft-card-level { margin-top: auto; color: var(--text-3); font-size: 11px; }
.draft-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.draft-hint { margin: 0; color: var(--text-2); font-size: 14px; }
.draft-actions .kaiju-launch { gap: 14px; margin-top: 0; padding: 12px 16px; }
.draft-actions .kaiju-launch:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
body.touch-enabled .draft-actions kbd { display: none; }
@media (max-width: 640px), (max-height: 520px) {
  .draft-panel { gap: 12px; padding: 14px; }
  .draft-head h2 { font-size: 18px; }
  .draft-grade span { font-size: 30px; }
  .draft-lines { grid-template-columns: 1fr; font-size: 12px; }
  .draft-cards { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
  .draft-card { min-height: 0; padding: 10px; gap: 5px; }
  .draft-card strong { font-size: 14px; }
  .draft-actions { flex-direction: column; align-items: stretch; }
  .draft-actions .kaiju-launch { justify-content: center; }
}
/* Landscape phones: the whole debrief fits one screen. The panel is capped to the viewport, the stat lines take the
   squeeze (and scroll if they must), and the cards + Confirm always stay on screen. */
@media (max-height: 520px) and (orientation: landscape) {
  .kaiju-draft { padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .draft-panel { max-height: 100%; gap: 8px; padding: 10px 14px; }
  .draft-head { align-items: center; }
  .draft-head h2 { margin-top: 2px; font-size: 16px; }
  .draft-reward { margin-top: 2px; font-size: 12px; line-height: 1.35; }
  .draft-grade { flex-direction: row; align-items: baseline; gap: 8px; min-width: 0; padding: 6px 10px; }
  .draft-grade span { font-size: 24px; }
  .draft-grade small { margin-top: 0; }
  .draft-lines { flex: 0 1 auto; min-height: 0; overflow-y: auto; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 14px; font-size: 11px; }
  .draft-lines li { padding-bottom: 3px; }
  .draft-line-pts { min-width: 32px; font-size: 10px; }
  .draft-cards { flex-shrink: 0; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); grid-auto-flow: column; }
  .draft-card { gap: 3px; padding: 8px 10px; }
  .draft-card strong { font-size: 13px; }
  .draft-card-desc { font-size: 12px; line-height: 1.35; }
  .draft-card-level { font-size: 10px; }
  .draft-actions { flex-shrink: 0; flex-direction: row; align-items: center; }
  .draft-hint { font-size: 12px; }
  .draft-actions .kaiju-launch { min-width: 160px; padding: 10px 18px; }
}
/* Short portrait screens: keep Confirm pinned to the bottom edge while the cards scroll underneath it. */
@media (max-height: 760px) and (max-width: 640px) and (orientation: portrait) {
  .kaiju-draft { padding-bottom: 0; }
  .draft-actions { position: sticky; bottom: 0; margin: 0 -14px -14px; padding: 10px 14px max(14px, env(safe-area-inset-bottom)); border-radius: 0 0 8px 8px; background: rgb(14, 20, 24); }
}

/* ---- Co-op: lobby dialog (reuses the .kaiju-settings card), teammate strip & name tags ------------------------- */
.kaiju-coop-card { width: min(560px, 100%); }
.kaiju-coop-input { padding: 9px 11px; border: 1px solid rgba(238,246,244,.2); border-radius: 3px; color: #eef6f4; background: #101d24; font: inherit; font-size: 14px; }
.kaiju-setting-row input.kaiju-coop-input { width: 180px; height: auto; }
.kaiju-coop-input:focus-visible { outline: 2px solid var(--warn); outline-offset: 2px; }
.kaiju-coop-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding-top: 4px; }
.kaiju-coop-block { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.kaiju-coop-help { margin: 0; color: rgba(238,246,244,.6); font-size: 13px; line-height: 1.5; }
.kaiju-coop-inline { display: flex; align-items: center; gap: 10px; color: #eef6f4; font-size: 13px; }
.kaiju-coop-inline select { padding: 7px 10px; border: 1px solid rgba(238,246,244,.2); border-radius: 3px; color: #eef6f4; background: #101d24; font: inherit; }
.kaiju-coop-code { width: 120px; font-family: var(--font-sign); font-size: 20px; letter-spacing: .3em; text-transform: uppercase; }
.kaiju-coop-primary { border-color: var(--warn); color: var(--warn); }
.kaiju-coop-primary:hover:not(:disabled) { background: rgba(255,200,87,.12); }
.kaiju-coop-card .kaiju-mini-btn:disabled { opacity: .45; cursor: default; }
.kaiju-coop-codebox { display: flex; align-items: center; gap: 16px; padding: 20px 0; border-bottom: 1px solid rgba(238,246,244,.1); color: rgba(238,246,244,.6); font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.kaiju-coop-codebox strong { color: var(--warn); font-family: var(--font-sign); font-size: 32px; letter-spacing: .32em; }
.kaiju-coop-codebox .kaiju-mini-btn { margin-left: auto; }
.kaiju-coop-players { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.kaiju-coop-player { display: grid; grid-template-columns: 1fr auto auto; grid-template-areas: "name ready ping" "mech ready ping"; column-gap: 14px; row-gap: 2px; align-items: center; padding: 12px 0; border-bottom: 1px solid rgba(238,246,244,.08); color: #eef6f4; }
.kaiju-coop-player strong { grid-area: name; font-size: 14px; }
.kaiju-coop-player > span:nth-child(2) { grid-area: mech; color: rgba(238,246,244,.55); font-size: 12px; }
.kaiju-coop-ready { grid-area: ready; color: rgba(238,246,244,.5); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.kaiju-coop-player.is-ready .kaiju-coop-ready { color: #5ff4ff; }
.kaiju-coop-ping { grid-area: ping; min-width: 48px; color: rgba(238,246,244,.45); font-size: 11px; font-variant-numeric: tabular-nums; text-align: right; }
.kaiju-coop-room .kaiju-coop-help, #kaiju-coop-room > .kaiju-coop-help { padding-top: 14px; }
.kaiju-coop-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding-top: 18px; }
.kaiju-coop-actions #kaiju-coop-leave { margin-right: auto; }
.kaiju-coop-status { min-height: 20px; margin: 16px 0 0; color: rgba(238,246,244,.7); font-size: 13px; line-height: 1.5; }
.kaiju-coop-status.is-error { color: #ff8a7a; }
@media (max-width: 520px) { .kaiju-coop-choice { grid-template-columns: 1fr; } .kaiju-setting-row input.kaiju-coop-input { width: 140px; } }

.kaiju-team { position: fixed; z-index: 8; top: 50%; right: var(--edge, 16px); display: flex; width: 190px; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; transform: translateY(-50%); pointer-events: none; }
.kaiju-team[hidden], body:not(.kaiju-active) .kaiju-team { display: none; }
.kaiju-team-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name meta" "bar bar"; gap: 4px 8px; padding: 6px 8px; border: 1px solid rgba(246,245,242,.12); border-radius: 4px; background: rgba(8,16,20,.62); color: #eef6f4; font-size: 12px; }
.kaiju-team-row.is-me { border-color: rgba(95,244,255,.35); }
.kaiju-team-name { grid-area: name; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.kaiju-team-meta { grid-area: meta; color: rgba(238,246,244,.5); font-size: 10px; font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.kaiju-team-bar { grid-area: bar; height: 4px; overflow: hidden; border-radius: 2px; background: rgba(238,246,244,.12); }
.kaiju-team-bar i { display: block; height: 100%; background: #5ff4ff; transition: width .25s; }
.kaiju-team-row.is-downed .kaiju-team-bar i { background: #ff3b3b; }
.kaiju-team-row.is-downed .kaiju-team-meta { color: #ff8a7a; font-weight: 700; }
.kaiju-team-tags { position: fixed; inset: 0; z-index: 7; overflow: hidden; pointer-events: none; }
body:not(.kaiju-active) .kaiju-team-tags { display: none; }
.coop-tag { position: absolute; top: 0; left: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; color: #5ff4ff; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-shadow: 0 1px 3px rgba(0,0,0,.8); white-space: nowrap; will-change: transform; }
.coop-tag[hidden] { display: none; }
.coop-tag-bar { width: 44px; height: 3px; overflow: hidden; border-radius: 2px; background: rgba(0,0,0,.45); }
.coop-tag-bar i { display: block; height: 100%; background: #5ff4ff; }
.coop-tag.is-downed { color: #ff8a7a; }
.coop-tag.is-downed .coop-tag-bar i { background: #ff3b3b; }
body.hud-minimized .kaiju-team { visibility: hidden; }
/* Portrait phones keep their HUD exactly as in solo: teammates only show on the radar and full map */
@media (orientation: portrait) and (max-width: 640px) { .kaiju-team, .kaiju-team-tags { display: none !important; } }

/* ---- Elemental attributes (js/elements.js): element colour arrives as --elem ---------------------------------- */
.draft-card[data-element] { border-color: color-mix(in srgb, var(--elem) 45%, transparent); }
.draft-card[data-element] .draft-card-head { color: var(--elem); }
.draft-card[data-element]:not(.is-selected) { background: color-mix(in srgb, var(--elem) 6%, transparent); }
.loadout-upgrade[data-element] { border-left-color: var(--elem); }
.loadout-elements { display: flex; flex-direction: column; gap: 3px; margin: 0; padding: 0; list-style: none; }
.loadout-element { display: grid; grid-template-columns: 1fr 44px 44px; align-items: center; gap: 6px; padding-left: 8px; border-left: 2px solid var(--elem); font-size: 12px; }
.loadout-element-name { color: var(--elem); font-family: var(--font-sign); font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.loadout-element-val { color: var(--text-3); font-variant-numeric: tabular-nums; text-align: right; }
.loadout-element-val.is-good { color: var(--text); }
.loadout-element-val.is-bad { color: var(--bad); }
/* Hangar: elemental resistance list under the frame traits */
.ew-element-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ew-element { display: flex; align-items: center; gap: 10px; font-size: 13px; line-height: 1.4; color: var(--ew-mute); }
.ew-element-mark { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--elem); box-shadow: 0 0 8px var(--elem); }
.ew-element-name { flex: 1; }
.ew-element-value { font-variant-numeric: tabular-nums; }
.ew-element.is-good { color: var(--ew-text); }
.ew-element.is-good .ew-element-value { color: var(--ew-gold); }
.ew-element.is-bad .ew-element-value { color: var(--ew-loss); }
/* The portrait touch HUD keeps its exact layout: no element labels there */
@media (orientation: portrait) {
  body.touch-enabled .elem-tag, body.touch-enabled .target-elem { display: none !important; }
}

/* ---- Home "What's new" pill + build notes dialog (js/updates-panel.js, data js/changelog.js) ------------------- */
.kaiju-updates-pill { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; margin: calc(clamp(12px, 2.2vh, 20px) * -0.5) 0 clamp(12px, 2.2vh, 20px); padding: 5px 10px 5px 6px; border: 1px solid rgba(238,246,244,.16); background: rgba(0,0,0,.35); color: rgba(238,246,244,.72); font-family: var(--font-sign); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; transition: color .15s, border-color .15s; }
.kaiju-updates-pill[hidden] { display: none; }
.kaiju-updates-pill:hover, .kaiju-updates-pill:focus-visible { color: #eef6f4; border-color: var(--warn); }
.kaiju-updates-new { display: none; padding: 2px 5px; background: var(--warn); color: var(--taxi-ink); font-weight: 700; letter-spacing: .16em; }
.kaiju-updates-pill.is-unseen .kaiju-updates-new { display: inline-block; }
.kaiju-updates-label { color: var(--warn); font-weight: 700; }
.kaiju-updates-pill.is-unseen .kaiju-updates-label { display: none; }
.kaiju-updates-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }
.kaiju-updates-arrow { flex: 0 0 auto; opacity: .7; }
.kaiju-updates-card { width: min(560px, 100%); }
.kaiju-updates-list { display: flex; flex-direction: column; gap: 26px; max-height: min(58vh, 520px); overflow-y: auto; padding: 20px 4px 4px 0; overscroll-behavior: contain; }
.kaiju-updates-list:focus-visible { outline: 1px solid var(--warn); outline-offset: 4px; }
.kaiju-update { display: flex; flex-direction: column; gap: 12px; }
.kaiju-update + .kaiju-update { padding-top: 22px; border-top: 1px solid rgba(238,246,244,.1); }
.kaiju-update-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: rgba(238,246,244,.52); font-family: var(--font-sign); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.kaiju-update-latest { padding: 1px 5px; border: 1px solid var(--warn); color: var(--warn); }
.kaiju-update-title { margin-top: 6px; color: #eef6f4; font-family: var(--font-sign); font-size: 17px; letter-spacing: .02em; text-wrap: balance; }
.kaiju-update-items { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.kaiju-update-item { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: baseline; color: rgba(238,246,244,.82); font-size: 14px; line-height: 1.5; }
.kaiju-update-type { color: var(--warn); font-family: var(--font-sign); font-size: 9px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.kaiju-update-item[data-type="changed"] .kaiju-update-type { color: rgba(238,246,244,.62); }
.kaiju-update-item[data-type="fixed"] .kaiju-update-type { color: var(--good, #7fd99a); }
.kaiju-update-text { text-wrap: pretty; }
.kaiju-update-feature { position: relative; padding-left: 16px; color: rgba(238,246,244,.82); font-size: 14px; line-height: 1.5; text-wrap: pretty; }
.kaiju-update-feature::before { content: ''; position: absolute; left: 0; top: .62em; width: 6px; height: 6px; background: var(--warn); }
.kaiju-updates-list:has(.is-features) .kaiju-update-title { margin-top: 0; }
@media (max-width: 520px) {
  .kaiju-update-item { grid-template-columns: 1fr; gap: 2px; }
  .kaiju-updates-pill { max-width: calc(100vw - 40px); }
}

/* ---- Scrollbars: black track + gold thumb everywhere (menus, dialogs, hangar, loadout) ------------------------ */
:root { --scroll-thumb: rgba(201, 162, 74, 0.55); --scroll-thumb-hover: rgba(255, 200, 87, 0.85); --scroll-track: rgba(10, 10, 12, 0.6); }
* { scrollbar-color: var(--scroll-thumb) var(--scroll-track); }
@supports not (scrollbar-color: auto) {
  ::-webkit-scrollbar { width: 8px; height: 8px; }
  ::-webkit-scrollbar-track { background: var(--scroll-track); }
  ::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 4px; background: var(--scroll-thumb) padding-box; }
  ::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover) padding-box; }
  ::-webkit-scrollbar-corner { background: transparent; }
}

/* Run intro (js/run-intro.js): letterboxed live cinematic of the first wave; the HUD is hidden until it hands over */
body.kaiju-intro > :not(#canvas-container):not(.kaiju-intro-layer):not(script) { visibility: hidden !important; }
.kaiju-intro-layer { position: fixed; inset: 0; z-index: 90; pointer-events: none; color: var(--text); font-family: var(--font-sans); }
.kaiju-intro-layer[hidden] { display: none; }
.kaiju-intro-bar {
  position: absolute; left: 0; right: 0; height: 12vh; min-height: 56px; background: #050506;
  transition: transform 0.9s var(--ease-out);
}
.kaiju-intro-bar.is-top { top: 0; transform: translateY(-100%); }
.kaiju-intro-bar.is-bottom {
  bottom: 0; transform: translateY(100%);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 clamp(16px, 5vw, 64px);
}
.kaiju-intro-layer.is-in .kaiju-intro-bar { transform: translateY(0); }
.kaiju-intro-layer.is-out .kaiju-intro-bar { transition-duration: 0.5s; }
.kaiju-intro-card {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  opacity: 0; transform: translateY(6px); transition: opacity 0.6s ease, transform 0.6s var(--ease-out);
}
.kaiju-intro-layer.is-card .kaiju-intro-card { opacity: 1; transform: translateY(0); }
.kaiju-intro-kicker { font-family: var(--font-sign); font-size: 12px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; color: var(--taxi); }
.kaiju-intro-title {
  font-family: var(--font-sign); font-size: clamp(22px, 3.4vw, 38px); font-weight: 800; line-height: 1.05;
  letter-spacing: 0.06em; text-transform: uppercase; text-wrap: balance;
}
.kaiju-intro-sub { font-size: 14px; line-height: 1.4; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kaiju-intro-skip { flex: none; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); }
.kaiju-intro-fade { position: absolute; inset: 0; background: #000; opacity: 0; transition: opacity 0.12s linear; }
@media (max-width: 560px) {
  .kaiju-intro-bar { height: 15vh; }
  .kaiju-intro-bar.is-bottom { flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px; }
}

/* Shoulder lamps toolbar toggle */
#btn-mech-lamps.active,
#btn-mech-lamps.active:hover {
  background: var(--text);
  color: #121314;
}

/* portrait phone layout stays exactly as it was */
@media (orientation: portrait) and (max-width: 820px) {
  #btn-mech-lamps { display: none; }
}

/* ------------------------------------------------------------------------------------------------------------------
   Keyboard HUD on small windows and big screens (touch layouts have their own block above and are not touched)
   ------------------------------------------------------------------------------------------------------------------ */
/* The key hints in the brand bar run under the score strip below this width */
@media (max-width: 1279px) { .hud-menu-hint { display: none; } }

@media (min-width: 641px) and (orientation: landscape) {
  /* The 820px rule strips the brand bar down for portrait; a small landscape window keeps the compact bar on top */
  .hud-top-left { top: max(var(--edge), env(safe-area-inset-top)); }
  .brand { height: var(--bar-h); padding: 0 12px 0 6px; }
  .brand > .mta-bullet { display: inline-flex; }
  .brand-heading h1, .brand-subtitle { display: block; }

  .combat-label, .vital-head, .weapon-btn kbd { font-size: 9px; }

  /* Score strip never reaches the vitals in the top-right corner: the target name gives way first */
  body:not(.touch-enabled) .kaiju-combat-telemetry { max-width: calc(100vw - 2 * (228px + var(--edge) + 10px)); }
  body:not(.touch-enabled) .combat-readout { min-width: 0; flex: none; }
  body:not(.touch-enabled) .kaiju-combat-telemetry > :nth-child(3) { flex: 0 1 auto; min-width: 48px; }
  body:not(.touch-enabled) .combat-readout :is(strong, .combat-sub) { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

  /* Squad list on the left edge: the right edge belongs to the vitals, abilities and speed cluster */
  body:not(.touch-enabled) .kaiju-team { right: auto; left: var(--edge); width: 176px; }

  /* Zone hold takes the kaiju bar's slot; the story objective sits under it */
  .kaiju-zone-hold { top: 58px; }
  .kaiju-objective { top: 100px; }
  body:not(.touch-enabled) :is(.kaiju-zone-hold, .kaiju-objective) { max-width: calc(100vw - 2 * (228px + var(--edge) + 10px)); }
  body:not(.touch-enabled):has(#kaiju-zone-hold:not([hidden])) .kaiju-objective { top: 124px; }

  /* Radio comms stay between the radar and the speed cluster */
  body:not(.touch-enabled) .kaiju-comms { width: min(520px, calc(100vw - 2 * (var(--edge) + 196px))); }
}
@media (min-width: 641px) and (orientation: landscape) and (max-height: 600px) {
  body:not(.touch-enabled) .kaiju-comms { bottom: 56px; }
}
/* The element stats were meant to step aside on short windows, but the rule lost to the more specific one showing them */
@media (max-height: 620px) {
  body.kaiju-active:not(.touch-enabled):not(.kaiju-over) .kaiju-loadout { display: none; }
}

/* Narrow keyboard windows (portrait): the brand link, element stats and ability rack have no room; the kaiju bar,
   zone hold and objective step down below the taller score strip, and the corners clear the full-width vitals. */
@media (max-width: 820px) and (orientation: portrait) {
  body.kaiju-active:not(.touch-enabled) .hud-top-left { display: none; }
}
@media (max-width: 640px) {
  body.kaiju-active:not(.touch-enabled):not(.kaiju-over) .kaiju-loadout,
  body.kaiju-active:not(.touch-enabled):not(.kaiju-over) .kaiju-abilities { display: none; }
  body.kaiju-active:not(.touch-enabled) .hud-bottom-left,
  body.kaiju-active:not(.touch-enabled) .hud-bottom-right { bottom: calc(max(8px, env(safe-area-inset-bottom)) + 108px); }
  body:not(.touch-enabled) .kaiju-threat,
  body:not(.touch-enabled) .kaiju-zone-hold { top: 146px; }
  body:not(.touch-enabled) .kaiju-objective { top: 196px; }
}

/* 1440p and 4K monitors: the whole in-run HUD scales up instead of staying phone-sized in the corners. The radar is
   sized, not zoomed, so its canvas stays sharp; the ability rack's JS-measured edges are in screen px, hence the
   division. */
@media (min-width: 2200px) and (min-height: 1200px) {
  body.kaiju-active:not(.touch-enabled) { --hud-k: 1.25; }
  body.kaiju-active:not(.touch-enabled) :is(.hud-top-left, .hud-top-right, .hud-bottom-right, .hud-bottom-center, .location, .kaiju-combat-telemetry, .kaiju-threat, .kaiju-vitals, .kaiju-abilities, .kaiju-loadout, .kaiju-team, .kaiju-objective, .kaiju-comms, .kaiju-tip, .kaiju-zone-hold, .kaiju-boundary) { zoom: var(--hud-k); }
  body.kaiju-active:not(.touch-enabled) .hud-bottom-left { left: calc(var(--edge) * var(--hud-k)); bottom: calc(var(--edge) * var(--hud-k)); }
  body.kaiju-active:not(.touch-enabled) .radar { --radar-w: calc(176px * var(--hud-k)); --radar-h: calc(112px * var(--hud-k)); }
  body.kaiju-active:not(.touch-enabled):not(.kaiju-over) .kaiju-abilities { top: calc(var(--vitals-bottom, 220px) / var(--hud-k) + 8px); max-height: calc((var(--cluster-top, 100dvh) - var(--vitals-bottom, 220px)) / var(--hud-k) - 18px); }
}
@media (min-width: 3000px) and (min-height: 1600px) {
  body.kaiju-active:not(.touch-enabled) { --hud-k: 1.5; }
}

/* Landscape phones: menus (pause, settings, controls, co-op, story) use the full height with a slim header, and the
   pause actions sit two abreast so Resume through Return to home fit without scrolling. The hangar has its own rules. */
@media (max-height: 520px) and (orientation: landscape) {
  .kaiju-settings:not(.kaiju-hangar) { padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .kaiju-settings:not(.kaiju-hangar) .kaiju-settings-card { max-height: calc(100dvh - 16px); padding: 14px 18px; }
  .kaiju-settings:not(.kaiju-hangar) .kaiju-settings-head { padding-bottom: 10px; }
  .kaiju-settings:not(.kaiju-hangar) h2 { margin-top: 2px; font-size: 20px; }
  .kaiju-pause-btn { padding: 10px 0; }
  .kaiju-pause-music { padding: 8px 0 10px; }
}
@media (max-height: 520px) and (orientation: landscape) and (max-width: 759px) {
  .kaiju-pause-card { width: min(620px, 100%); }
  .kaiju-pause-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 24px; align-items: center; padding-top: 2px; }
  .kaiju-pause-btn:last-child { border-bottom: 1px solid rgba(238,246,244,.1); }
}

/* Full map on landscape phones: the zoom column is taller than the screen there and ran under the Close button, so it
   lies down along the bottom-right edge and the hint moves to the left above the scale bar. Notches are respected. */
body.touch-enabled .map-controls { right: max(var(--edge), env(safe-area-inset-right)); }
@media (max-height: 480px) and (orientation: landscape) {
  .map-controls { top: auto; bottom: max(var(--edge), env(safe-area-inset-bottom)); translate: none; flex-direction: row; }
  .map-zoom { flex-direction: row; }
  .fullmap-footer { left: max(var(--edge), env(safe-area-inset-left)); bottom: calc(max(var(--edge), env(safe-area-inset-bottom)) + 34px); translate: none; max-width: calc(100% - 2 * var(--edge) - 300px); }
}

/* Crash report (js/device-profile.js): the last city boot never finished; shown on mobile or with ?crashlog=1 */
#crash-report { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 300; width: min(560px, calc(100vw - 32px)); max-height: min(70vh, 560px); display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; transform: translateX(-50%); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); border-radius: 8px; background: rgba(4, 9, 12, .94); color: var(--text); font-family: var(--font-sign, system-ui, sans-serif); box-shadow: 0 12px 40px rgba(0, 0, 0, .5); }
#crash-report h2 { margin: 0; font-size: 15px; color: var(--warn); }
#crash-report p { margin: 0; font-size: 13px; line-height: 1.4; color: rgba(238, 246, 244, .82); }
#crash-report pre { flex: 1 1 auto; min-height: 0; margin: 0; padding: 8px; overflow: auto; border-radius: 4px; background: rgba(255, 255, 255, .05); font: 11px/1.4 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-word; user-select: text; -webkit-user-select: text; }
#crash-report .crash-report-actions { display: flex; gap: 8px; justify-content: flex-end; }
#crash-report button { min-height: 40px; padding: 0 16px; border: 1px solid var(--glass-border); border-radius: 6px; background: var(--glass-strong); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
#crash-report button:hover { background: var(--hover); }
