/* Layout: full-bleed canvas with a HUD overlay; hangar is a side panel (bottom sheet on phones). */
:root {
  --ink: #0d0f12;
  --panel: rgba(13, 15, 18, 0.86);
  --panel-solid: #15181d;
  --line: rgba(236, 232, 223, 0.16);
  --fg: #ece8df;
  --dim: #9d998f;
  --signal: #f2b632;
  --alert: #e0392f;
  --hud: #7dffb6;
  --hud-dim: rgba(125, 255, 182, 0.45);
  --font-display: "Chakra Petch", "Bahnschrift", "Segoe UI", system-ui, sans-serif;
  --font-mono: "Share Tech Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--fg);
  font-family: var(--font-display);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.label { font-size: 11px; letter-spacing: 0.14em; color: var(--dim); }
.eyebrow { font-size: 11px; letter-spacing: 0.22em; color: var(--signal); font-weight: 600; }
kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 1px 6px;
  margin-right: 3px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg);
  background: rgba(255, 255, 255, 0.05);
  text-align: center;
}
button { font-family: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

.stripe {
  height: 8px;
  background: repeating-linear-gradient(135deg, var(--signal) 0 12px, #1b1c1f 12px 24px);
}

.btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
.btn:hover { background: rgba(255, 255, 255, 0.12); }
.btn.primary { background: var(--signal); color: #16130b; border-color: var(--signal); }
.btn.primary:hover { background: #ffc94d; }
.chip-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--fg);
  padding: 6px 10px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.chip-btn kbd { font-size: 10px; }

/* ---------- loading ---------- */
#loading {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 40%, #1b1f26, var(--ink));
  z-index: 50;
}
.load-box { width: min(360px, 80vw); display: grid; gap: 10px; }
.load-title { font-size: 28px; font-weight: 700; }
.bar { height: 4px; background: rgba(255, 255, 255, 0.1); }
.bar i { display: block; height: 100%; width: 0; background: var(--signal); transition: width 0.2s; }
#load-msg { font-size: 12px; color: var(--dim); }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.hud-top {
  position: absolute;
  top: max(12px, env(safe-area-inset-top, 0px));
  left: max(16px, env(safe-area-inset-left, 0px));
  right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.unit { display: flex; align-items: baseline; gap: 8px; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.unit-code { font-weight: 700; font-size: 18px; color: var(--hud); letter-spacing: 0.06em; }
.unit-name { font-size: 13px; letter-spacing: 0.3em; color: var(--fg); }
.score { display: flex; align-items: baseline; gap: 10px; background: var(--panel); padding: 5px 12px; border-left: 3px solid var(--signal); }
.score b { font-size: 20px; color: var(--fg); }
.tally { display: flex; gap: 6px; }
.score.wave { border-left-color: var(--alert); }
.hud-btns { display: flex; gap: 6px; }
#btn-hangar, #btn-summon { pointer-events: auto; }

#boss-bar {
  position: absolute; left: 50%; top: max(60px, calc(env(safe-area-inset-top, 0px) + 52px)); transform: translateX(-50%);
  width: min(420px, 70vw); display: grid; gap: 4px; justify-items: center;
}
#boss-bar .label { color: #ff4aa0; letter-spacing: 0.3em; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); }
#boss-bar i { display: block; width: 100%; height: 6px; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 74, 160, 0.5); }
#boss-bar b { display: block; height: 100%; width: 100%; background: #ff2a8a; transition: width 0.15s; }

#reticle { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
/* Diameter 2 x LockOn.radius (0.36 of half the screen height) in js/weapons.js */
#lock-zone {
  position: absolute; left: 50%; top: 50%;
  width: 36vh; height: 36vh;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px dashed var(--hud-dim);
  opacity: 0.35;
  transition: opacity 0.2s;
}
#lock-zone.active { opacity: 0.8; }
.cross { position: absolute; left: 0; top: 0; }
.cross i { position: absolute; background: var(--hud); box-shadow: 0 0 4px rgba(0, 0, 0, 0.6); }
.cross i:nth-child(1) { width: 12px; height: 2px; left: -20px; top: -1px; }
.cross i:nth-child(2) { width: 12px; height: 2px; left: 8px; top: -1px; }
.cross i:nth-child(3) { width: 2px; height: 10px; left: -1px; top: 8px; }
.cross i:nth-child(4) { width: 4px; height: 4px; left: -2px; top: -2px; border-radius: 50%; }
#hitmark {
  position: absolute; left: -14px; top: -14px; width: 28px; height: 28px;
  border: 2px solid #fff; transform: rotate(45deg) scale(0.6); opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
}
#hitmark.on { opacity: 1; transform: rotate(45deg) scale(1); transition: none; }
#hitmark.kill { border-color: var(--alert); }

#locks { position: absolute; inset: 0; }
#hardlock {
  position: absolute; width: 64px; height: 64px; margin: -32px 0 0 -32px;
  border: 2px solid var(--hud);
  clip-path: polygon(0 0, 30% 0, 30% 3px, 70% 3px, 70% 0, 100% 0, 100% 100%, 70% 100%, 70% calc(100% - 3px), 30% calc(100% - 3px), 30% 100%, 0 100%);
  box-shadow: 0 0 8px rgba(125, 255, 182, 0.5);
}
#hardlock span {
  position: absolute; left: 0; top: 70px; white-space: nowrap;
  font-size: 11px; color: var(--hud); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}
#hardlock .hp { position: absolute; left: 0; right: 0; top: -9px; height: 3px; background: rgba(0, 0, 0, 0.5); }
#hardlock .hp b { display: block; height: 100%; width: 100%; background: var(--hud); }
#lock-arrow {
  position: absolute; width: 0; height: 0;
  border-top: 12px solid transparent; border-bottom: 12px solid transparent; border-left: 22px solid var(--hud);
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.7));
}
.lock {
  position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border: 2px solid var(--alert);
  transform: rotate(45deg);
  box-shadow: 0 0 6px rgba(224, 57, 47, 0.6);
}
.lock.new { animation: lockin 0.18s ease-out; }
.lock b {
  position: absolute; left: 36px; top: -14px; transform: rotate(-45deg);
  font: 11px var(--font-mono); color: var(--alert); white-space: nowrap;
}
@keyframes lockin { from { transform: rotate(45deg) scale(2.4); opacity: 0; } to { transform: rotate(45deg) scale(1); opacity: 1; } }

.hud-left {
  position: absolute;
  left: max(16px, env(safe-area-inset-left, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  width: 230px;
  display: grid; gap: 10px;
}
.gauge { background: var(--panel); padding: 8px 10px; border-left: 3px solid var(--hud); }
.gauge-head { display: flex; justify-content: space-between; align-items: baseline; }
.gauge-bar { margin-top: 5px; height: 8px; background: rgba(255, 255, 255, 0.08); }
.gauge-bar i { display: block; height: 100%; width: 100%; background: var(--hud); }
.gauge.hot { border-left-color: var(--alert); }
.gauge.hot .gauge-bar i { background: var(--alert); }
#overheat { display: none; margin-top: 4px; font-size: 12px; letter-spacing: 0.2em; color: var(--alert); font-weight: 700; animation: blink 0.5s steps(2) infinite; }
.gauge.hot #overheat { display: block; }
.gauge.armor { border-left-color: var(--fg); }
.gauge.armor .gauge-bar i { background: var(--fg); transition: width 0.15s; }
.gauge.armor.low { border-left-color: var(--alert); }
.gauge.armor.low .gauge-bar i { background: var(--alert); }
.gauge.armor.low #ap-txt { color: var(--alert); animation: blink 0.6s steps(2) infinite; }
.gauge.armor.struck { background: rgba(224, 57, 47, 0.35); }

/* Damage: red edges, and arcs around the reticle pointing at the shooter */
#dmg-vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 9; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(224, 57, 47, 0) 50%, rgba(224, 57, 47, 0.38) 82%, rgba(150, 10, 10, 0.75) 100%);
}
#dmg-dirs { position: absolute; left: 50%; top: 50%; }
.dmg-dir { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.dmg-dir i {
  position: absolute; left: -150px; top: -150px; width: 300px; height: 300px; border-radius: 50%;
  border: 7px solid transparent; border-top-color: rgba(255, 60, 48, 0.95);
  filter: drop-shadow(0 0 6px rgba(255, 40, 30, 0.9));
}
.dmg-dir.blocked i { border-top-color: rgba(125, 255, 182, 0.9); filter: drop-shadow(0 0 6px rgba(125, 255, 182, 0.7)); }
@keyframes blink { 50% { opacity: 0.2; } }
.readouts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.readouts > div { background: var(--panel); padding: 6px 8px; display: grid; }
.readouts b { font-size: 18px; color: var(--fg); font-weight: 400; }
.readouts small { font-size: 10px; color: var(--dim); }

.hud-right {
  position: absolute;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  width: 250px;
  display: grid; gap: 4px;
}
.wrow {
  background: var(--panel);
  padding: 5px 10px 6px;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 2px 8px;
  align-items: baseline;
  border-left: 3px solid var(--line);
}
.wrow .slot { font: 11px var(--font-mono); color: var(--dim); }
.wrow .wname { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wrow .ammo { font: 15px var(--font-mono); color: var(--fg); }
.wrow .meter { grid-column: 2 / 4; height: 3px; background: rgba(255, 255, 255, 0.08); }
.wrow .meter i { display: block; height: 100%; background: var(--fg); }
.wrow.reloading { border-left-color: var(--signal); }
.wrow.reloading .meter i { background: var(--signal); }
.wrow.empty-slot { opacity: 0.4; }
.wrow.missile .meter i { background: var(--alert); }

#toast {
  /* Never higher than 12px under the boss bar, which matters on short landscape phones */
  position: absolute; left: 50%; top: max(22%, calc(env(safe-area-inset-top, 0px) + 96px)); transform: translateX(-50%);
  width: max-content; max-width: calc(100vw - 32px); text-align: center; padding-left: 0.3em;
  font-size: 22px; font-weight: 700; letter-spacing: 0.3em; color: var(--signal);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
  opacity: 0; transition: opacity 0.3s;
}
#toast.on { opacity: 1; transition: none; }
#help-hint {
  position: absolute; left: 50%; bottom: max(16px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  font-size: 11px; color: var(--dim); background: var(--panel); padding: 4px 10px; white-space: nowrap;
  transition: opacity 1s;
}

/* ---------- game over ---------- */
#gameover {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center;
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
  background: radial-gradient(ellipse at center, rgba(70, 8, 6, 0.35), rgba(13, 15, 18, 0.88));
}
.over-card { width: min(460px, 100%); display: grid; gap: 14px; background: var(--panel); padding: 20px 22px 22px; }
.over-card .stripe { width: 120px; background: repeating-linear-gradient(135deg, var(--alert) 0 12px, #1b1c1f 12px 24px); }
.over-card .eyebrow { color: var(--alert); }
.over-card h2 { margin: 0; font-size: clamp(30px, 6vw, 44px); letter-spacing: 0.03em; }
.over-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.over-stats > div { background: rgba(255, 255, 255, 0.05); padding: 8px 10px; display: grid; gap: 2px; }
.over-stats b { font-size: 26px; font-weight: 400; }

/* ---------- intro ---------- */
#intro {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center;
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
  background: linear-gradient(90deg, rgba(13, 15, 18, 0.92) 0%, rgba(13, 15, 18, 0.6) 55%, rgba(13, 15, 18, 0.1) 100%);
  overflow-y: auto;
  /* As a scroller it escapes the page's touch-action: none. iOS ignores user-scalable=no, and a pinch
     here would leave the game zoomed with nothing left that can pinch back out. */
  touch-action: pan-y;
}
.intro-card { width: min(640px, 100%); justify-self: start; margin-left: max(0px, 6vw); display: grid; gap: 16px; padding-block: 24px; }
.intro-card .stripe { width: 120px; }
.intro-card h1 { margin: 0; font-size: clamp(38px, 7vw, 72px); line-height: 0.95; letter-spacing: 0.04em; text-wrap: balance; }
.intro-card h1 span { color: var(--signal); }
.lede { margin: 0; font-size: 16px; line-height: 1.5; color: #d6d2c8; max-width: 52ch; }
.controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ctl-group { background: var(--panel); padding: 12px 14px; border-top: 2px solid var(--hud); }
.ctl-group h3 { margin: 0 0 8px; font-size: 12px; letter-spacing: 0.2em; color: var(--hud); }
.ctl-group p { margin: 6px 0; font-size: 14px; color: #d6d2c8; }
.touch-note { margin: 0; font-size: 13px; color: var(--dim); }
.intro-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- frame select: cards on the left, the frame itself in the showroom on the right ---------- */
#frames {
  position: fixed; inset: 0; z-index: 30;
  display: grid; align-items: center;
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
  background: linear-gradient(90deg, rgba(13, 15, 18, 0.9) 0%, rgba(13, 15, 18, 0.5) 48%, rgba(13, 15, 18, 0) 72%);
  overflow-y: auto;
  touch-action: pan-y;
}
.frames-card { width: min(780px, 100%); margin-left: max(0px, 5vw); display: grid; gap: 14px; padding-block: 20px; }
.frames-card .stripe { width: 120px; }
.frames-card h2 { margin: 0; font-size: clamp(28px, 4.4vw, 44px); letter-spacing: 0.03em; }
.frame-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.frame-card {
  display: grid; gap: 7px; text-align: left; color: var(--fg); font: inherit;
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--line);
  padding: 12px 14px;
}
.frame-card:hover { background: rgba(30, 33, 38, 0.92); }
.frame-card[aria-pressed="true"] { border-color: rgba(242, 182, 50, 0.55); border-left-color: var(--signal); }
.fc-head { display: flex; align-items: baseline; gap: 10px; }
.fc-code { font-size: 15px; color: var(--hud); }
.frame-card[aria-pressed="true"] .fc-code { color: var(--signal); }
.fc-name { font-size: 22px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.fc-role { font-size: 11px; letter-spacing: 0.2em; color: var(--dim); text-transform: uppercase; }
.fc-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 18px; }
.fc-stat { display: grid; grid-template-columns: 44px 1fr 66px; align-items: center; gap: 8px; }
.fc-stat i { display: block; height: 5px; background: rgba(255, 255, 255, 0.08); }
.fc-stat b { display: block; height: 100%; background: var(--hud); }
.frame-card[aria-pressed="true"] .fc-stat b { background: var(--signal); }
.fc-stat .mono { font-size: 12px; text-align: right; }
.fc-blurb { font-size: 13px; line-height: 1.45; color: #cfcbc1; }

/* ---------- insertion: letterbox and caption while the Kestrel H flies the frame in ---------- */
#drop { position: fixed; inset: 0; z-index: 25; pointer-events: none; }
#drop .lb { position: absolute; left: 0; right: 0; height: 9vh; background: #000; animation: lb-in 0.6s ease-out both; }
#drop .lb.top { top: 0; transform-origin: top; }
#drop .lb.bottom { bottom: 0; transform-origin: bottom; }
.drop-cap {
  position: absolute; left: max(24px, env(safe-area-inset-left, 0px)); bottom: calc(9vh + 18px);
  display: grid; gap: 4px; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  animation: cap-in 0.8s 0.3s ease-out both;
}
.drop-title { font-size: clamp(22px, 3.4vw, 34px); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.drop-eta { font-size: 13px; letter-spacing: 0.16em; color: var(--hud); }
.drop-eta b { font-weight: 400; color: var(--fg); }
.drop-hint { margin-top: 4px; font-size: 11px; letter-spacing: 0.16em; color: var(--dim); }
@keyframes lb-in { from { transform: scaleY(0); } }
@keyframes cap-in { from { opacity: 0; transform: translateX(-12px); } }

/* ---------- hangar ---------- */
#hangar {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 40;
  width: min(440px, 100%);
  background: var(--panel-solid);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.hangar-head { flex: none; }
.hh-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; gap: 12px; border-bottom: 1px solid var(--line); }
.hh-row h2 { margin: 2px 0 0; font-size: 26px; }
.hh-actions { display: flex; gap: 8px; }
.hangar-body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  display: grid; gap: 14px; align-content: start;
  touch-action: pan-y;
  -webkit-user-select: none; user-select: none;
}
.hsec { display: grid; gap: 8px; }
.hsec-title { display: flex; justify-content: space-between; align-items: baseline; }
.hsec-title h3 { margin: 0; font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; }
.hsec-title .hint { font: 11px var(--font-mono); color: var(--dim); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg);
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.chip:hover { background: rgba(255, 255, 255, 0.1); }
.chip[aria-pressed="true"] { background: var(--signal); color: #16130b; border-color: var(--signal); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch {
  width: 28px; height: 28px; padding: 0;
  border: 2px solid transparent;
  outline: 1px solid var(--line);
  position: relative;
}
.swatch i { position: absolute; right: 2px; bottom: 2px; width: 8px; height: 8px; }
.swatch[aria-pressed="true"] { border-color: var(--signal); outline-color: var(--signal); }
.slot-card { background: rgba(255, 255, 255, 0.03); border-left: 3px solid var(--line); padding: 10px 12px; display: grid; gap: 8px; }
.slot-card.filled { border-left-color: var(--hud); }
.slot-desc { font-size: 12px; color: var(--dim); min-height: 1.2em; }
.settings-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; }
.settings-row input[type="range"] { width: 160px; accent-color: var(--signal); }
.settings-row .chips { flex-wrap: nowrap; justify-content: flex-end; gap: 4px; }
.settings-row .chip { padding: 5px 8px; }
.toggle { border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); color: var(--fg); padding: 5px 12px; font-size: 12px; min-width: 62px; }
.toggle[aria-pressed="true"] { background: var(--hud); color: #0c1a12; border-color: var(--hud); }

/* ---------- summon menu (the ` key) and the tech-demo notice ---------- */
#summon {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 42;
  width: min(430px, 100%);
  background: rgba(21, 24, 29, 0.95);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: env(safe-area-inset-left, 0px);
}
.summon-head { flex: none; }
.summon-note { margin: 0; padding: 10px 16px; font-size: 12px; line-height: 1.45; color: var(--dim); border-bottom: 1px solid var(--line); }
.summon-body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  display: grid; gap: 16px; align-content: start;
  touch-action: pan-y;
}
.sgroup { display: grid; gap: 6px; }
.sgroup h3 { margin: 0 0 2px; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--hud); }
.srow {
  display: grid; grid-template-columns: 92px minmax(0, 1fr) 32px 84px; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.03); border-left: 3px solid var(--hud-dim); padding: 6px 8px 6px 10px;
}
.srow.cooling { border-left-color: var(--alert); }
.srow-name { font-size: 14px; font-weight: 600; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow input[type="range"] { width: 100%; min-width: 0; margin: 0; accent-color: var(--signal); }
.srow output { font-size: 16px; text-align: right; }
.srow-fixed { font-size: 11px; letter-spacing: 0.08em; color: var(--dim); text-transform: uppercase; }
.btn-summon {
  border: 1px solid var(--signal); background: rgba(242, 182, 50, 0.14); color: var(--signal);
  padding: 7px 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
}
.btn-summon:hover:not(:disabled), .btn-summon.queued { background: var(--signal); color: #16130b; }
#summon:not(.queueing) .queue-note { display: none; }
#summon.queueing .queue-note { display: block; color: var(--signal); }
/* The loadout's Debug button opens the summon menu on touchscreens, which have no ` key */
body:not(.touch) .debug-btn { display: none; }
body.touch #btn-summon-close kbd { display: none; }
.debug-btn { border-color: rgba(242, 182, 50, 0.6); color: var(--signal); }
.btn-summon:disabled { border-color: var(--line); background: transparent; color: var(--dim); cursor: not-allowed; font-family: var(--font-mono); font-size: 14px; letter-spacing: 0.06em; }

#brief {
  position: fixed; inset: 0; z-index: 45;
  display: grid; place-items: center;
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
  background: radial-gradient(ellipse at center, rgba(180, 77, 255, 0.16), rgba(13, 15, 18, 0.72));
}
.brief-card { width: min(520px, 100%); display: grid; gap: 14px; background: var(--panel); padding: 20px 22px 22px; border-top: 2px solid var(--signal); }
.brief-card .stripe { width: 120px; }
.brief-card h2 { margin: 0; font-size: clamp(26px, 5vw, 38px); letter-spacing: 0.03em; }
.brief-text { margin: 0; font-size: 15px; line-height: 1.55; color: #d6d2c8; }

/* ---------- touch ---------- */
#touch { position: fixed; inset: 0; z-index: 20; }
#move-zone { position: absolute; left: 0; top: 0; bottom: 0; width: 42%; }
#look-zone { position: absolute; right: 0; top: 0; bottom: 0; width: 58%; }
#stick {
  position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px;
  border-radius: 50%; border: 2px solid rgba(236, 232, 223, 0.35);
  background: rgba(13, 15, 18, 0.25);
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
}
#stick.on { opacity: 1; }
#stick-knob {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px;
  transform: translate(-50%, -50%); border-radius: 50%; background: rgba(236, 232, 223, 0.55);
}
.tbtns {
  position: absolute;
  right: max(14px, env(safe-area-inset-right, 0px));
  bottom: max(14px, env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: repeat(3, 64px);
  grid-template-areas: "lock msl salvo" "cnn fl jump" "dash fire fire";
  gap: 8px;
}
.tb {
  width: 64px; height: 64px; border-radius: 50%;
  border: 2px solid rgba(236, 232, 223, 0.4);
  background: rgba(13, 15, 18, 0.55);
  color: var(--fg); font-weight: 700; font-size: 13px; letter-spacing: 0.04em;
  display: grid; place-content: center; line-height: 1.05;
  touch-action: none;
}
.tb small { font-size: 9px; font-weight: 500; color: var(--dim); }
.tb.held { background: rgba(242, 182, 50, 0.85); color: #16130b; }
.tb.held small { color: #16130b; }
.tb.big { grid-area: fire; width: 136px; border-radius: 40px; }
.tb.alert { border-color: rgba(224, 57, 47, 0.8); }
.tb.small { height: 44px; width: 44px; justify-self: center; align-self: center; font-size: 11px; }
#t-lock { grid-area: lock; }
.tb.lockbtn { border-color: rgba(125, 255, 182, 0.7); }
.t-reload { position: absolute; top: max(92px, calc(env(safe-area-inset-top, 0px) + 84px)); right: max(16px, env(safe-area-inset-right, 0px)); }
#t-msl { grid-area: msl; }
#t-salvo { grid-area: salvo; }
#t-cannon { grid-area: cnn; }
#t-fireL { grid-area: fl; }
#t-jump { grid-area: jump; }
#t-dash { grid-area: dash; }
.t-summon { position: absolute; top: max(132px, calc(env(safe-area-inset-top, 0px) + 124px)); right: max(16px, env(safe-area-inset-right, 0px)); border-color: rgba(242, 182, 50, 0.6); color: var(--signal); }
.t-menu { position: absolute; top: max(52px, calc(env(safe-area-inset-top, 0px) + 44px)); right: max(16px, env(safe-area-inset-right, 0px)); }

/* --hud-side: how far the weapon list reaches in from the left edge. Centered HUD text stays inside it. */
body.touch { --hud-side: calc(max(16px, env(safe-area-inset-left, 0px)) + 176px + 12px); }
body.touch #help-hint, body.touch #btn-hangar, body.touch #btn-summon, body.touch .controls { display: none; }
body.touch #toast { max-width: calc(100vw - 2 * var(--hud-side)); font-size: 16px; letter-spacing: 0.2em; padding-left: 0.2em; }
body.touch #boss-bar { width: min(420px, calc(100vw - 2 * var(--hud-side))); }
body:not(.touch) .touch-note { display: none; }
body.touch .hud-right {
  bottom: auto; right: auto;
  top: max(44px, calc(env(safe-area-inset-top, 0px) + 40px));
  left: max(16px, env(safe-area-inset-left, 0px));
  width: 176px; gap: 2px;
}
body.touch .wrow { padding: 2px 8px 3px; grid-template-columns: 30px 1fr auto; }
body.touch .wrow .wname { font-size: 10px; }
body.touch .wrow .ammo { font-size: 12px; }
body.touch .wrow .slot { font-size: 9px; }
body.touch .wrow .meter { height: 2px; }
body.touch .hud-left { width: 190px; }
body.touch .score { padding: 3px 10px; }

@media (max-width: 720px) {
  .controls { grid-template-columns: 1fr; }
  .intro-card { margin-left: 0; }
  #intro { background: rgba(13, 15, 18, 0.82); }
  .frames-card { margin-left: 0; }
  #frames { background: rgba(13, 15, 18, 0.7); }
  .fc-stats { grid-template-columns: 1fr; }
  .hud-left { width: 180px; }
  .readouts b { font-size: 15px; }
  .unit-name { display: none; }
  .score b { font-size: 16px; }
}
/* Bottom-sheet hangar on narrow upright screens; landscape phones keep the side panel. Matches hangarSheet in js/main.js. */
@media (max-width: 720px) and (orientation: portrait) {
  #hangar { top: auto; height: 62%; width: 100%; border-left: 0; border-top: 1px solid var(--line); }
  #summon { top: auto; height: 62%; width: 100%; border-right: 0; border-top: 1px solid var(--line); }
}
@media (max-height: 500px) {
  .tbtns { grid-template-columns: repeat(3, 54px); gap: 6px; }
  .tb { width: 54px; height: 54px; font-size: 11px; }
  .tb.big { width: 114px; }
  .hud-left .readouts { display: none; }
  .intro-card { gap: 10px; padding-block: 16px; }
  .intro-card h1 { font-size: 40px; }
  .lede { font-size: 14px; }
  .hh-row { padding: 8px 16px; }
  .hh-row h2 { font-size: 20px; }
  /* Landscape phones: the two cards side by side, without their blurbs */
  .frames-card { gap: 8px; padding-block: 10px; width: min(620px, 100%); }
  .frames-card h2 { font-size: 24px; }
  .frame-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .frame-card { padding: 8px 10px; gap: 5px; }
  .fc-name { font-size: 17px; }
  .fc-stats { grid-template-columns: 1fr; gap: 3px; }
  .fc-blurb { display: none; }
  .drop-cap { bottom: calc(9vh + 8px); }
  .summon-note { display: none; }
  .summon-body { gap: 10px; padding-top: 8px; }
  .srow { padding-block: 3px; }
  .brief-card { gap: 10px; padding: 14px 18px 16px; }
  .brief-text { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  #overheat, .lock.new, .gauge.armor.low #ap-txt { animation: none; }
}

/* ---------------------------------------------------------------------------
   Boot screen (loads the title theme), title screen and the rotate-to-landscape overlay.
   Colors are the VECTORCLAD brand neon palette (vectorclad-brand kit, tokens/palette.json).
--------------------------------------------------------------------------- */
#title, #boot {
  --vc-void: #050507;
  --vc-ink: #e6e7ee;
  --vc-dim: #8b8e9d;
  --vc-rule: #3b3d4a;
  --vc-purple: #b44dff;
  --vc-green: #3dff7a;
  --vc-yellow: #ffe23d;
  position: fixed; inset: 0; z-index: 60;
  color: var(--vc-ink);
  background:
    radial-gradient(ellipse at 30% 40%, rgba(180, 77, 255, 0.16), transparent 60%),
    radial-gradient(ellipse at 75% 60%, rgba(61, 255, 122, 0.08), transparent 55%),
    var(--vc-void);
  transition: opacity 0.9s ease, filter 0.9s ease;
}

/* Boot screen: sits over the title until the title theme has downloaded (js/boot.js). */
#boot { z-index: 70; display: grid; place-items: center; transition-duration: 0.4s; }
#boot.is-leaving { opacity: 0; pointer-events: none; }
#boot .eyebrow { color: var(--vc-yellow); }
#boot .bar i { background: var(--vc-purple); box-shadow: 0 0 10px rgba(180, 77, 255, 0.7); }
.boot-song { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--vc-ink); }
.boot-song span { color: var(--vc-dim); }
#title-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  opacity: 0; transition: opacity 0.8s ease;
}
#title.is-live #title-canvas { opacity: 1; }

/* Text logo: shows until the 3D logo is running (or for good if WebGL is unavailable). */
.title-word {
  position: absolute; left: 50%; top: 43%; margin: 0;
  transform: translate(-50%, -50%) skewX(-7deg);
  font: 700 clamp(40px, 9vw, 120px) / 1 var(--font-display);
  letter-spacing: 0.06em; white-space: nowrap;
  color: #d9dce6; text-shadow: 0 0 18px rgba(180, 77, 255, 0.55);
  transition: opacity 0.6s ease;
}
.title-word span { color: var(--vc-green); text-shadow: 0 0 18px rgba(61, 255, 122, 0.5); }
#title.is-live .title-word { opacity: 0; }

/* The whole screen is the start button. */
#title-start, #boot-start {
  position: absolute; inset: 0; width: 100%; margin: 0; border: 0; background: transparent; color: inherit;
  display: flex; align-items: flex-end; justify-content: center;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 calc(clamp(64px, 17vh, 150px) + env(safe-area-inset-bottom, 0px));
  -webkit-tap-highlight-color: transparent;
}
#title-start:focus-visible, #boot-start:focus-visible { outline: none; }
#title-start:focus-visible .title-prompt, #boot-start:focus-visible .title-prompt { outline: 2px solid var(--vc-yellow); outline-offset: 8px; }
.title-prompt {
  display: inline-flex; align-items: center; gap: 14px;
  font: 14px var(--font-mono); letter-spacing: 0.5em; text-transform: uppercase;
  padding-left: 0.5em;
  color: var(--vc-yellow);
  text-shadow: 0 0 6px rgba(255, 226, 61, 0.8), 0 0 18px rgba(255, 226, 61, 0.45);
  animation: title-blink 1.6s steps(1, end) infinite;
}
.title-prompt i { display: block; width: 22px; height: 2px; background: currentColor; box-shadow: 0 0 8px rgba(255, 226, 61, 0.7); }
@keyframes title-blink { 0%, 60% { opacity: 1; } 61%, 100% { opacity: 0.2; } }

#title.is-leaving { opacity: 0; filter: brightness(1.8) blur(2px); pointer-events: none; }
#title.is-leaving .title-prompt { animation: title-blink-fast 0.12s steps(1, end) infinite; }
@keyframes title-blink-fast { 50% { opacity: 0.15; } }

.title-tag {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 calc(22px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 16px;
  font-size: 12px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--vc-ink);
  pointer-events: none;
}
.title-bracket { width: 11px; height: 11px; flex: none; border: 1.5px solid var(--vc-ink); display: grid; place-items: center; }
.title-bracket::after { content: ""; width: 3px; height: 3px; background: var(--vc-green); }
.title-dashes { display: flex; gap: 4px; }
.title-dashes i { display: block; width: 12px; height: 4px; background: var(--vc-yellow); transform: skewX(-32deg); }
.title-dashes i:nth-child(n+5) { background: var(--vc-purple); }
.title-kana {
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif; font-weight: 700;
  letter-spacing: 0.18em; padding: 3px 9px; border: 1.5px solid var(--vc-rule); color: var(--vc-green);
}

@media (max-height: 500px) {
  #title-start, #boot-start { padding-block: 0 calc(52px + env(safe-area-inset-bottom, 0px)); }
  .title-prompt { font-size: 12px; }
  .title-tag { font-size: 10px; padding-block: 0 calc(12px + env(safe-area-inset-bottom, 0px)); }
}

/* Rotate overlay: phones held upright. Matches portraitPhone in js/title/title.js (main.js pauses on it too). */
#rotate { display: none; }
@media (pointer: coarse) and (orientation: portrait) and (max-width: 600px) {
  #rotate {
    position: fixed; inset: 0; z-index: 100;
    display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    background:
      radial-gradient(ellipse at 50% 40%, rgba(180, 77, 255, 0.2), transparent 60%),
      rgba(5, 5, 7, 0.96);
    color: #e6e7ee;
  }
}
.rotate-phone {
  position: relative; width: 46px; height: 80px; margin-bottom: 18px;
  border: 3px solid #e6e7ee;
  box-shadow: 0 0 18px rgba(180, 77, 255, 0.55), inset 0 0 12px rgba(180, 77, 255, 0.25);
  animation: rotate-phone 2.4s ease-in-out infinite;
}
.rotate-phone i { position: absolute; left: 50%; bottom: 6px; width: 12px; height: 3px; margin-left: -6px; background: #b44dff; }
@keyframes rotate-phone {
  0%, 20% { transform: rotate(0deg); }
  50%, 80% { transform: rotate(-90deg); }
  100% { transform: rotate(0deg); }
}
.rotate-title {
  margin: 0; font: 700 22px var(--font-display); letter-spacing: 0.14em; text-transform: uppercase;
  color: #ffe23d; text-shadow: 0 0 12px rgba(255, 226, 61, 0.5);
}
.rotate-sub { margin: 0; font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; color: #8b8e9d; }

@media (prefers-reduced-motion: reduce) {
  #title, #boot, #title-canvas, .title-word { transition-duration: 0.15s; }
  .title-prompt, #title.is-leaving .title-prompt, .rotate-phone { animation: none; }
}
