/* 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; }
/* A gamepad moving through the menus (js/title/padnav.js): the focus always shows */
html.pad-nav button:focus, html.pad-nav input:focus { outline: 2px solid var(--signal); outline-offset: 2px; }
/* (cut-corner buttons clip anything drawn outside them, so their ring is drawn inside) */
.btn:focus-visible, html.pad-nav .btn:focus, .hp-mount:focus-visible, html.pad-nav .hp-mount:focus,
.frame-card:focus-visible, html.pad-nav .frame-card:focus, .mode-card:focus-visible, html.pad-nav .mode-card:focus { outline: 2px solid var(--signal); outline-offset: -3px; }
.btn.primary:focus-visible, html.pad-nav .btn.primary:focus { outline-color: #16130b; }

.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; }

/* ---------- boot and loading: one layer, under the power-up gate and the title (js/title/loading.js) ---------- */
.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; }
#loading {
  position: fixed; inset: 0; z-index: 50; overflow: hidden;
  display: grid; grid-template-rows: minmax(0, 1fr) auto;
  padding: max(20px, env(safe-area-inset-top, 0px)) max(28px, env(safe-area-inset-right, 0px)) max(18px, env(safe-area-inset-bottom, 0px)) max(28px, env(safe-area-inset-left, 0px));
  background: #07080b;
  transition: opacity 0.45s ease;
}
#loading.is-leaving { opacity: 0; }
/* The key art (tools/keyart.js): full bleed, its subject to the right. It fades in once it has decoded; the readout
   never waits for it. Its black is the layer's own, so the edges of a cropped picture don't show. */
.ld-art {
  position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; object-fit: cover; object-position: 60% 50%;
  opacity: 0; transform: scale(1.03); transform-origin: 70% 60%;
  transition: opacity 1.1s ease, transform 9s cubic-bezier(0.2, 0.7, 0.2, 1);
  pointer-events: none;
}
#loading.art-in .ld-art { opacity: 1; transform: none; }
/* A shade under the readout on the picture's dark side and under the bottom line, no more than they need */
#loading::before {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(7, 8, 11, 0.78), rgba(7, 8, 11, 0.5) 26%, rgba(7, 8, 11, 0) 48%),
    linear-gradient(0deg, rgba(7, 8, 11, 0.7), rgba(7, 8, 11, 0) 20%);
}
.ld-grid {
  position: relative; z-index: 2; width: min(1680px, 100%); margin: 0 auto; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 470px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; column-gap: clamp(20px, 5vw, 72px);
}
/* The readout: the overall share, the bar, the line, a row per stage, a cell per district */
.ld-read { grid-column: 1; grid-row: 1; display: grid; gap: 10px; align-content: center; min-width: 0; min-height: 0; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.ld-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-top: -2px; }
.load-title { margin: 0; font-size: clamp(24px, 2.6vw, 34px); font-weight: 700; letter-spacing: 0.02em; line-height: 1; }
.load-title span { color: var(--signal); }
.ld-pct { line-height: 0.8; color: var(--fg); white-space: nowrap; }
.ld-pct b { font-weight: 400; font-size: clamp(44px, 5.4vw, 76px); letter-spacing: -0.02em; }
.ld-pct small { font-size: 0.34em; color: var(--dim); margin-left: 4px; }
.ld-bar { height: 6px; background: rgba(255, 255, 255, 0.09); -webkit-mask-image: repeating-linear-gradient(90deg, #000 0 10px, transparent 10px 12px); mask-image: repeating-linear-gradient(90deg, #000 0 10px, transparent 10px 12px); }
.ld-bar i { background: var(--signal); transition: width 0.25s ease-out; }
#load-msg { font-size: 12px; letter-spacing: 0.1em; color: var(--fg); min-height: 1.3em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#load-msg::before { content: '\25B8  '; color: var(--signal); }
.ld-stages { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 0; }
.ld-stages li {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) minmax(60px, 0.5fr) 38px; gap: 10px; align-items: center;
  padding: 3px 0; border-bottom: 1px solid rgba(236, 232, 223, 0.06);
  font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(157, 153, 143, 0.62);
}
.ld-stages .n { font-size: 10px; opacity: 0.7; }
.ld-stages .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-stages i { display: block; height: 3px; background: rgba(255, 255, 255, 0.07); }
.ld-stages i b { display: block; height: 100%; width: 0; background: var(--dim); transition: width 0.2s; }
.ld-stages .pc { text-align: right; font-size: 11px; }
.ld-stages li.on { color: var(--signal); }
.ld-stages li.on i b { background: var(--signal); }
.ld-stages li.on .name::after { content: '_'; animation: blink 0.9s steps(2) infinite; }
.ld-stages li.done { color: rgba(236, 232, 223, 0.8); }
.ld-stages li.done i b { background: rgba(125, 255, 182, 0.55); }
.ld-stages li.done .pc { color: var(--hud); }
.ld-districts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 10px; padding-top: 4px; }
.ld-districts div { display: grid; gap: 3px; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.ld-districts span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-districts i { display: block; height: 2px; background: rgba(255, 255, 255, 0.08); }
.ld-districts i b { display: block; height: 100%; width: 0; background: rgba(199, 125, 255, 0.85); }
.ld-districts div.on { color: #d6a6ff; }
.ld-districts div.done { color: var(--fg); }
.ld-districts div.done i b { background: var(--hud); }
.ld-song { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); padding-top: 2px; }
.ld-song span { opacity: 0.6; }
/* The plate: what the picture shows, set like a page of a field manual. A rule with a tab of the subject's colour,
   its class, its name, three figures and a line on how to fight it (or fly it). It stands under the readout, on the
   picture's dark side: the subject keeps the upper right two thirds to itself (tools/keyart.js frames it there). */
.ld-plate {
  --acc: var(--signal);
  grid-column: 1; grid-row: 2; position: relative; align-self: end; justify-self: start; width: min(470px, 100%); margin: 20px 0 4px;
  padding-top: 14px; border-top: 1px solid rgba(236, 232, 223, 0.26);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  opacity: 0; transform: translateY(6px); transition: opacity 0.7s ease 0.15s, transform 0.7s ease 0.15s;
}
.ld-plate::before { content: ''; position: absolute; left: 0; top: -2px; width: 48px; height: 3px; background: var(--acc); }
#loading.plate-in .ld-plate { opacity: 1; transform: none; }
.ld-plate-k { margin: 0 0 8px; display: flex; justify-content: space-between; gap: 12px; font-size: 11px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--dim); }
.ld-plate-k b { font-weight: 400; color: var(--acc); }
.ld-plate-name { margin: 0 0 0 -0.04em; font: 700 clamp(40px, 4.6vw, 74px) / 0.9 var(--font-display); letter-spacing: 0.01em; text-transform: uppercase; color: var(--fg); }
.ld-plate-stats { margin: 16px 0 0; display: flex; }
.ld-plate-stats div { padding-right: 16px; margin-right: 16px; border-right: 1px solid rgba(236, 232, 223, 0.18); min-width: 0; }
.ld-plate-stats div:last-child { border: 0; margin: 0; padding: 0; }
.ld-plate-stats dt { font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--dim); }
.ld-plate-stats dd { margin: 4px 0 0; font-size: 15px; letter-spacing: 0.05em; color: var(--fg); white-space: nowrap; }
.ld-plate-note { margin: 14px 0 0; font-size: 14px; font-weight: 500; line-height: 1.5; color: #d3cfc5; }
.ld-tip { position: relative; z-index: 2; margin: 0 auto; width: min(860px, 100%); display: flex; gap: 12px; align-items: baseline; justify-content: center; font-size: 13px; line-height: 1.45; color: #cfcbc1; text-align: left; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); }
.ld-tip b { flex: none; font-weight: 400; font-size: 10.5px; letter-spacing: 0.22em; color: var(--signal); padding: 2px 7px; border: 1px solid rgba(242, 182, 50, 0.4); }
.ld-tip.turn span { animation: ld-tip 0.6s ease-out; }
@keyframes ld-tip { from { opacity: 0; transform: translateY(4px); } }
/* A short window: the song line goes and the rows close up, so the readout and the plate share the column */
@media (max-height: 820px) {
  .ld-song { display: none; }
  .ld-stages li { padding: 2px 0; }
  .ld-plate-note { font-size: 13px; margin-top: 10px; }
  .ld-plate-stats { margin-top: 12px; }
}
#loading.is-ready .ld-bar i { background: var(--hud); }
#loading.is-ready .ld-pct b { color: var(--hud); }
/* A phone in landscape: the readout narrower, the plate shorter (no note) and clear of the bottom line */
@media (max-height: 500px) {
  #loading { padding-top: max(10px, env(safe-area-inset-top, 0px)); padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)); }
  .ld-grid { grid-template-columns: minmax(0, 330px) minmax(0, 1fr); column-gap: 16px; }
  .ld-read { gap: 6px; }
  .load-title { font-size: 20px; }
  .ld-pct b { font-size: 40px; }
  .ld-stages li { padding: 1px 0; font-size: 10px; grid-template-columns: 20px minmax(0, 1fr) minmax(40px, 0.4fr) 32px; }
  .ld-districts { gap: 3px 8px; }
  .ld-song { display: none; }
  .ld-stages li { padding: 0; line-height: 1.35; }
  /* (the districts' cells give way to the plate here; the stage row and the line under the bar still name them) */
  .ld-districts { display: none !important; }
  .ld-plate { padding-top: 8px; margin: 8px 0 0; }
  .ld-plate-k { font-size: 9.5px; margin-bottom: 4px; }
  .ld-plate-name { font-size: 25px; }
  .ld-plate-stats { margin-top: 9px; }
  .ld-plate-stats div { padding-right: 10px; margin-right: 10px; }
  .ld-plate-stats dt { font-size: 8.5px; }
  .ld-plate-stats dd { font-size: 12px; margin-top: 2px; }
  .ld-plate-note { display: none; }
  .ld-tip { font-size: 11px; }
}
@media (max-width: 640px) {
  .ld-grid { grid-template-columns: 1fr; }
  .ld-plate { display: none; }
  #boot-start { padding-left: 16px !important; }
}
@media (prefers-reduced-motion: reduce) {
  .ld-art, .ld-plate { transition: opacity 0.3s ease; transform: none; }
}

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
/* The HUD's panels: light glass with a small cut corner, a hairline along the top and a thin colored edge.
   --ui scales the HUD with the screen (js/ui.js sets it on a resize: 1 at 1280 x 720, 1.5 at 1080 lines, 0.72 on a
   phone); each group scales from the corner it hangs from. The edges keep to the safe area, and on a screen wider than
   2:1 to a 2:1 frame in the middle, so on an ultrawide the eye never has to travel to the far corners. */
#hud {
  --glass: linear-gradient(180deg, rgba(13, 15, 18, 0.62), rgba(13, 15, 18, 0.4));
  --cut: 8px;
  --rift: #c77dff;
  --hot: #ff5a4a;
  --hair: inset 0 1px 0 rgba(236, 232, 223, 0.1);
  --ui: 1;
  /* Safe margins: they grow with the HUD (22 px at 720 lines, 33 at 1080), keep to a notch's safe area, and on a
     screen wider than 2:1 to a 2:1 frame in the middle */
  --ex: max(calc(22px * var(--ui)), env(safe-area-inset-left, 0px), calc(50vw - 100vh + 22px * var(--ui)));
  --exr: max(calc(22px * var(--ui)), env(safe-area-inset-right, 0px), calc(50vw - 100vh + 22px * var(--ui)));
  --et: max(calc(16px * var(--ui)), env(safe-area-inset-top, 0px));
  --eb: max(calc(18px * var(--ui)), env(safe-area-inset-bottom, 0px));
  /* One type scale for every word and figure (at --ui 1; each group scales with the HUD): a tag, a label, a name or a
     line, a figure beside a label, a heading, the armor and the banners, the magazine */
  --t1: 9px; --t2: 10px; --t3: 12px; --t4: 14px; --t5: 18px; --t6: 28px; --t7: 36px;
  /* (words on no glass, or on less of it, keep an edge over a bright sky) */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  /* The calm HUD (#hud.calm, js/ui.js calmTick): what steps back takes --out to go, and is back in --in */
  --in: 0.1s;
  --out: 0.8s;
}
.hud-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.hud-top {
  position: absolute; top: var(--et); left: var(--ex); right: var(--exr);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.unit { display: grid; gap: 3px; transform-origin: 0 0; scale: var(--ui); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75); }
.unit-line { display: flex; align-items: baseline; gap: 9px; }
.unit-code { font-weight: 700; font-size: var(--t5); color: var(--hud); letter-spacing: 0.08em; }
.unit-code::before {
  content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 8px; translate: 0 -1px;
  background: var(--hud); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
.unit-name { font-size: var(--t3); font-weight: 600; letter-spacing: 0.32em; color: var(--fg); }
/* On foot: where the frame was left */
.unit-sub { font-size: var(--t2); letter-spacing: 0.14em; color: var(--signal); min-height: 14px; }
/* The top right: the tally and the buttons as quiet words on no glass, a tick of color for the kills (amber) and the
   hostiles (red); each button's key only in the calm or the run's first minute (#hud.calm, #hud.fresh: js/ui.js),
   its place kept so nothing moves when it comes and goes */
.hud-topright {
  display: flex; align-items: baseline; gap: 20px; padding-top: 2px; transform-origin: 100% 0; scale: var(--ui);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 6px rgba(0, 0, 0, 0.35);
}
.tally { display: flex; align-items: baseline; gap: 16px; }
.score { display: flex; align-items: baseline; gap: 6px; }
.score::before { content: ''; align-self: center; width: 2px; height: 9px; background: var(--signal); opacity: 0.85; }
.score.wave::before { background: var(--alert); }
.score .label { font-size: var(--t2); letter-spacing: 0.16em; color: rgba(157, 153, 143, 0.9); }
.score b { font-size: var(--t4); font-weight: 400; color: rgba(236, 232, 223, 0.88); min-width: 1ch; text-align: right; }
.hud-btns { display: flex; align-items: baseline; gap: 16px; }
.hud-btns .chip-btn {
  pointer-events: auto; gap: 5px; padding: 0; border: 0; background: none; clip-path: none;
  font-size: var(--t2); letter-spacing: 0.16em; color: rgba(236, 232, 223, 0.6); transition: color 0.15s;
}
.hud-btns .chip-btn:hover { color: var(--fg); }
.hud-btns .chip-btn kbd {
  min-width: 0; margin: 0; padding: 0 3px; font-size: var(--t1); line-height: 12px; border-bottom-width: 1px;
  color: rgba(236, 232, 223, 0.7); background: rgba(13, 15, 18, 0.35); opacity: 0; transition: opacity var(--in);
}
#hud.calm .hud-btns kbd, #hud.fresh .hud-btns kbd { opacity: 1; transition-duration: var(--out); }
/* (the sandbox's TOOLS, moved in beside SUMMON by js/ui.js) */
.hud-btns #sbx-btn-tools { position: static; scale: none; }

/* Heading: a tape of ticks and letters sliding under a fixed mark, the bearing in a chip under the mark */
#compass {
  position: absolute; left: 50%; top: var(--et); width: 320px; height: 52px;
  translate: -50% 0; transform-origin: 50% 0; scale: var(--ui);
}
#compass .tape-win {
  position: absolute; left: 0; right: 0; top: 0; height: 34px; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}
#compass .tape-win::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: rgba(236, 232, 223, 0.32); }
#compass-tape { position: absolute; left: 0; top: 0; height: 100%; width: 2160px; will-change: transform; }
#compass-tape i { position: absolute; top: 0; width: 1px; height: 5px; background: rgba(236, 232, 223, 0.5); }
#compass-tape i.mid { height: 8px; background: rgba(236, 232, 223, 0.78); }
#compass-tape i.maj { height: 11px; width: 2px; margin-left: -0.5px; background: var(--fg); }
#compass-tape b, #compass-tape s {
  position: absolute; top: 12px; transform: translateX(-50%);
  font: 600 var(--t3) var(--font-display); letter-spacing: 0.08em; color: var(--fg); text-decoration: none;
}
#compass-tape b.card { color: var(--hud); }
#compass-tape s { font: var(--t2) var(--font-mono); color: var(--dim); top: 14px; }
#compass > i {
  position: absolute; left: 50%; top: -1px; width: 0; height: 0; margin-left: -5px;
  border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 7px solid var(--signal);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.7));
}
#compass-deg {
  position: absolute; left: 50%; top: 35px; translate: -50% 0;
  font-size: var(--t2); line-height: 14px; font-weight: 400; padding: 0 5px; color: var(--signal);
  background: rgba(13, 15, 18, 0.45); border: 1px solid rgba(242, 182, 50, 0.22);
}

/* The last few kills, newest on top, under the buttons; a boss or a heavy is amber */
#killfeed {
  position: absolute; right: var(--exr); top: calc(var(--et) + 30px * var(--ui));
  display: grid; gap: 3px; justify-items: end; transform-origin: 100% 0; scale: var(--ui);
}
#killfeed div {
  display: flex; align-items: center; gap: 7px;
  font: 600 var(--t3) var(--font-display); letter-spacing: 0.14em; color: var(--fg);
  padding: 3px 10px 3px 9px; background: var(--glass); border-right: 2px solid var(--alert);
  clip-path: polygon(6px 0, 100% 0, 100% 100%, 0 100%, 0 6px);
  animation: feed 3.2s ease-out forwards;
}
#killfeed div i { flex: none; width: 7px; height: 7px; border: 1.5px solid var(--alert); rotate: 45deg; }
#killfeed div b { font: var(--t2) var(--font-mono); letter-spacing: 0.16em; color: var(--hot); }
#killfeed div.big { border-right-color: var(--signal); }
#killfeed div.big i { border-color: var(--signal); background: rgba(242, 182, 50, 0.35); }
#killfeed div.big b { color: var(--signal); }
@keyframes feed { 0% { opacity: 0; transform: translateX(14px); } 8% { opacity: 1; transform: none; } 78% { opacity: 1; } 100% { opacity: 0; } }

/* A boss: its name and strength across the top; what it just lost shows pale until the bar catches up */
#boss-bar {
  position: absolute; left: 50%; top: calc(var(--et) + 56px * var(--ui)); translate: -50% 0; transform-origin: 50% 0; scale: var(--ui);
  width: 460px; max-width: calc((100vw - 32px) / var(--ui)); display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 4px 10px;
  --boss: #ff3d8b;
}
#boss-bar .label { font: 700 var(--t3) var(--font-display); letter-spacing: 0.34em; color: var(--boss); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#boss-bar em { grid-row: 1; grid-column: 2; font-size: var(--t3); font-style: normal; color: var(--fg); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85); }
#boss-bar i { grid-column: 1 / -1; position: relative; display: block; height: 9px; background: rgba(0, 0, 0, 0.6); box-shadow: 0 0 0 1px rgba(255, 61, 139, 0.55); }
#boss-bar i u, #boss-bar i b { position: absolute; inset: 0; transform-origin: 0 0; }
#boss-bar i u { background: rgba(255, 214, 230, 0.75); transition: transform 0.5s 0.45s ease-in; }
#boss-bar i b { background: linear-gradient(180deg, #ff74ad, #e3246c); }
#boss-bar i::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(13, 15, 18, 0.75) calc(10% - 1px) 10%); }

/* ---- the reticle ---- */
/* The frame's missile lock circle: 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; translate: -50% -50%; opacity: 0.8; transition: opacity var(--in); }
#lock-zone svg { display: block; width: 100%; height: 100%; overflow: visible; fill: none; }
#lock-zone svg { filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.8)); }
#lock-zone circle { stroke: rgba(125, 255, 182, 0.75); stroke-width: 1.5; stroke-dasharray: 2.5 4; vector-effect: non-scaling-stroke; }
#lock-zone path { stroke: rgba(125, 255, 182, 0.85); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
#lock-zone.held circle { stroke: rgba(255, 90, 74, 0.65); }
#lock-zone.held path { stroke: var(--hot); }
#lock-n {
  position: absolute; left: 86%; top: 86%; font-size: var(--t2); font-weight: 400; letter-spacing: 0.14em; white-space: nowrap;
  color: var(--hot); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9); scale: var(--ui); transform-origin: 0 0;
}
#lock-n:empty { display: none; }

#reticle { position: absolute; left: 50%; top: 50%; transform-origin: 0 0; scale: var(--ui); }
/* The crosshair: data-r is its shape (js/ui.js reticle()): ar a rifle's cross, shot a scatter circle, rot a rotary's
   cross with its spin-up ring, lob a launcher's chevron and drop marks, beam a pin ring, rkt rocket brackets, mega
   the charge ring, dot just the dot. --gap: how far the arms stand off for the spread now, in px at --ui 1. */
.cross {
  position: absolute; left: 0; top: 0;
  --gap: 0px; --len: 9px; --w: 2px; --off: 4px;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.95)) drop-shadow(0 0 2px rgba(0, 0, 0, 0.35));
  transition: opacity 0.15s;
}
.cross > i { position: absolute; left: 0; top: 0; background: var(--hud); transition: opacity 0.12s; }
.cross > i:nth-child(1) { width: var(--len); height: var(--w); translate: calc(-1 * (var(--off) + var(--gap) + var(--len))) calc(var(--w) / -2); }
.cross > i:nth-child(2) { width: var(--len); height: var(--w); translate: calc(var(--off) + var(--gap)) calc(var(--w) / -2); }
.cross > i:nth-child(3) { width: var(--w); height: var(--len); translate: calc(var(--w) / -2) calc(var(--off) + var(--gap)); }
.cross > i:nth-child(4) { width: var(--w); height: var(--len); translate: calc(var(--w) / -2) calc(-1 * (var(--off) + var(--gap) + var(--len))); }
.cross > u { position: absolute; left: -1.5px; top: -1.5px; width: 3px; height: 3px; border-radius: 50%; background: var(--hud); }
.rt-svg { position: absolute; left: -64px; top: -64px; width: 128px; height: 128px; overflow: visible; fill: none; }
.rt-svg > * { display: none; stroke: var(--hud); stroke-width: 1.5; }
.rt-svg .rt-trk { stroke: rgba(236, 232, 223, 0.16); stroke-width: 2; }
.rt-prog, .rt-magR, .rt-magL, .rt-boost { stroke-width: 2; transition: stroke 0.15s; }
.rt-svg .rt-magR, .rt-svg .rt-magL { stroke: rgba(236, 232, 223, 0.78); }
.rt-ladder { position: absolute; left: 0; top: 0; display: none; }
.rt-ladder i { position: absolute; left: 0; height: 2px; background: var(--hud); }
.rt-ladder i:nth-child(1) { top: 12px; width: 14px; margin-left: -7px; }
.rt-ladder i:nth-child(2) { top: 21px; width: 10px; margin-left: -5px; opacity: 0.85; }
.rt-ladder i:nth-child(3) { top: 30px; width: 6px; margin-left: -3px; opacity: 0.7; }
.rt-word {
  position: absolute; left: 0; top: 41px; translate: -50% 0; font-size: var(--t2); font-style: normal; letter-spacing: 0.26em; padding-left: 0.26em;
  white-space: nowrap; color: var(--signal); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
}
.rt-word:empty { display: none; }
.rt-word.out { color: var(--hot); }
/* Shapes */
.cross[data-r="dot"] > i, .cross[data-r="lob"] > i:nth-child(n+3), .cross[data-r="rkt"] > i { display: none; }
.cross[data-r="ar"] { --len: 9px; --w: 2px; --off: 4px; }
.cross[data-r="rot"] { --len: 6px; --w: 3px; --off: 6px; }
.cross[data-r="shot"] { --len: 5px; --w: 2px; --off: -2.5px; }
.cross[data-r="beam"] { --len: 7px; --w: 2px; --off: 10px; }
.cross[data-r="mega"] { --len: 6px; --w: 2px; --off: 12px; }
.cross[data-r="lob"] { --len: 7px; --w: 2px; --off: 15px; }
.cross[data-r="shot"] .rt-spread, .cross[data-r="beam"] .rt-ring, .cross[data-r="lob"] .rt-chev, .cross[data-r="rkt"] .rt-brk { display: inline; }
.cross[data-r="lob"] .rt-ladder { display: block; }
.cross.cyc .rt-spread { opacity: 0.35; }
/* Rings shown as they are needed (.prog, .magR, .magL, .boost on the cross) */
.cross.prog :is(.rt-prog, .rt-prog-t), .cross.magR :is(.rt-magR, .rt-magR-t), .cross.magL :is(.rt-magL, .rt-magL-t), .cross.boost :is(.rt-boost, .rt-boost-t) { display: inline; }
.rt-svg .rt-prog.spin, .rt-svg .rt-prog.charge { stroke: var(--signal); }
.rt-svg .rt-prog.full { stroke: rgba(125, 255, 182, 0.5); }
.rt-svg .rt-prog.fire { stroke: #fff; }
.rt-svg .rt-magR.rl, .rt-svg .rt-magL.rl { stroke: var(--signal); }
.rt-svg .rt-magR.low, .rt-svg .rt-magL.low { stroke: var(--hot); }
.rt-svg .rt-boost { stroke: rgba(125, 255, 182, 0.8); }
.rt-svg .rt-boost.hot { stroke: var(--hot); }
/* Aimed down the sights: the arms give way to the dot (the scattergun keeps its circle, the launcher its marks) */
.cross.aimed > i { opacity: 0; }
.cross.aimed[data-r="shot"] > i { opacity: 1; }
/* Mid-switch the reticle dims */
.cross.sw { opacity: 0.3; }
/* On foot: brackets round the reticle when the grappling hook has something in reach (amber when it is too far),
   the distance, and a pip for each charge */
#hook-aim { position: absolute; left: 0; top: 0; }
#hook-aim i { position: absolute; top: -12px; width: 6px; height: 24px; border: 2px solid var(--hud); opacity: 0.22; box-sizing: border-box; transition: opacity 0.1s, border-color 0.1s; filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.9)); }
#hook-aim i:nth-child(1) { left: -33px; border-right: 0; }
#hook-aim i:nth-child(2) { left: 27px; border-left: 0; }
#hook-aim.ok i { opacity: 1; }
#hook-aim.far i { opacity: 0.85; border-color: var(--signal); }
#hook-aim span { position: absolute; left: 39px; top: -7px; font-size: var(--t2); line-height: 14px; color: var(--hud); white-space: nowrap; text-shadow: 0 0 4px rgba(0, 0, 0, 0.8); }
#hook-aim.far span { color: var(--signal); }
#hook-aim b { position: absolute; left: -43px; top: 0; display: flex; flex-direction: column; gap: 5px; transform: translate(-50%, -50%); }
#hook-aim b u { display: block; width: 6px; height: 6px; transform: rotate(45deg); border: 1px solid var(--hud); box-shadow: 0 0 3px rgba(0, 0, 0, 0.6); }
#hook-aim b u.full { background: var(--hud); }
/* The hit marker: four ticks, white for a hit, red and wider for a kill, and a ring for a big kill (js/ui.js hit()) */
#hitmark { position: absolute; left: 0; top: 0; opacity: 0; --c: #fff; --t: 7px; --r: 7px; --w: 2px; }
#hitmark i {
  position: absolute; left: calc(var(--w) / -2); top: 0; width: var(--w); height: var(--t); background: var(--c);
  transform-origin: 50% 0; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
}
#hitmark i:nth-child(1) { transform: rotate(45deg) translateY(var(--r)); }
#hitmark i:nth-child(2) { transform: rotate(135deg) translateY(var(--r)); }
#hitmark i:nth-child(3) { transform: rotate(225deg) translateY(var(--r)); }
#hitmark i:nth-child(4) { transform: rotate(315deg) translateY(var(--r)); }
#hitmark.kill { --c: var(--hot); --t: 10px; --r: 8px; --w: 3px; }
#hitmark b { display: none; position: absolute; left: -17px; top: -17px; width: 34px; height: 34px; box-sizing: border-box; border: 2px solid var(--signal); rotate: 45deg; box-shadow: 0 0 10px rgba(242, 182, 50, 0.6); }
#hitmark.big b { display: block; }

/* Missile locks: a red diamond on each, the nearest few with their distance (js/ui.js places them with translate) */
#locks { position: absolute; inset: 0; }
.lock { position: absolute; left: 0; top: 0; scale: var(--ui); transform-origin: 0 0; }
.lock i { position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; box-sizing: border-box; border: 1.5px solid var(--hot); rotate: 45deg; box-shadow: 0 0 5px rgba(224, 57, 47, 0.5); }
.lock i::after { content: ''; position: absolute; left: 50%; top: 50%; width: 2px; height: 2px; margin: -1px 0 0 -1px; background: var(--hot); }
.lock.new i { animation: lockin 0.2s ease-out; }
.lock b { position: absolute; left: 11px; top: -7px; font: var(--t2) var(--font-mono); font-weight: 400; color: var(--hot); white-space: nowrap; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95); }
@keyframes lockin { from { scale: 2.6; opacity: 0; } to { scale: 1; opacity: 1; } }
/* The held target: corner brackets hugging it (--r, its size on screen), its strength, name and distance */
#hardlock { position: absolute; left: 0; top: 0; --r: 32px; }
#hardlock > i:not(.hp) { position: absolute; left: 0; top: 0; width: 12px; height: 12px; box-sizing: border-box; border: 0 solid var(--hud); filter: drop-shadow(0 0 3px rgba(125, 255, 182, 0.55)) drop-shadow(0 0 1px rgba(0, 0, 0, 0.9)); }
#hardlock > i:nth-child(1) { border-width: 2px 0 0 2px; translate: calc(-1 * var(--r)) calc(-1 * var(--r)); }
#hardlock > i:nth-child(2) { border-width: 2px 2px 0 0; translate: calc(var(--r) - 12px) calc(-1 * var(--r)); }
#hardlock > i:nth-child(3) { border-width: 0 0 2px 2px; translate: calc(-1 * var(--r)) calc(var(--r) - 12px); }
#hardlock > i:nth-child(4) { border-width: 0 2px 2px 0; translate: calc(var(--r) - 12px) calc(var(--r) - 12px); }
#hardlock .hp { position: absolute; left: calc(-28px * var(--ui)); top: calc(var(--r) + 7px); width: calc(56px * var(--ui)); height: 3px; background: rgba(0, 0, 0, 0.6); box-shadow: 0 0 0 1px rgba(125, 255, 182, 0.25); }
#hardlock .hp b { position: absolute; inset: 0; background: var(--hud); transform-origin: 0 0; }
#hardlock span {
  position: absolute; left: 0; top: calc(var(--r) + 14px); translate: -50% 0; white-space: nowrap;
  font-size: calc(11px * var(--ui)); letter-spacing: 0.08em; color: var(--hud); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}
#hardlock.in { animation: hardin 0.22s cubic-bezier(0.2, 0.9, 0.2, 1); }
@keyframes hardin { from { scale: 1.9; opacity: 0; rotate: 45deg; } to { scale: 1; opacity: 1; rotate: 0deg; } }
/* Where the aimed weapons lead it: a pipper, and a thread back to the target */
#lead { position: absolute; left: 0; top: 0; scale: var(--ui); transform-origin: 0 0; }
#lead::before { content: ''; position: absolute; left: -6px; top: -6px; width: 12px; height: 12px; box-sizing: border-box; border: 2px solid var(--hud); border-radius: 50%; filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.9)); }
#lead::after { content: ''; position: absolute; left: -1px; top: -1px; width: 2px; height: 2px; background: var(--hud); }
#lead-line { position: absolute; left: 0; top: 0; width: 1px; height: 1px; background: rgba(125, 255, 182, 0.55); transform-origin: 0 50%; }
/* The held target off the screen: a chevron at the edge pointing to it, and how far */
#lock-arrow { position: absolute; left: 0; top: 0; scale: var(--ui); transform-origin: 0 0; }
#lock-arrow i { position: absolute; left: -12px; top: -12px; width: 24px; height: 24px; }
#lock-arrow i::before { content: ''; position: absolute; inset: 0; background: var(--hud); clip-path: polygon(0 0, 100% 50%, 0 100%, 22% 50%); }
#lock-arrow span { position: absolute; left: 0; top: 16px; translate: -50% 0; font-size: var(--t2); color: var(--hud); white-space: nowrap; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95); }

/* ---- vitals: the radar, then armor (with what was just lost still showing), boost, the frame, speed and height ---- */
.hud-left {
  position: absolute; left: var(--ex); bottom: var(--eb);
  display: flex; align-items: flex-end; gap: 10px; transform-origin: 0 100%; scale: var(--ui);
}
#hud .hud-left { width: auto; }
/* Radar: drawn in js/ui.js */
#radar { flex: none; width: 132px; height: 132px; display: block; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45)); }
.vitals {
  position: relative; isolation: isolate; width: 262px; display: grid; gap: 6px; padding: 8px 11px 7px;
  border-left: 2px solid rgba(236, 232, 223, 0.85);
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%);
  transition: border-color var(--in), gap var(--in), padding var(--in);
}
/* (the glass on a layer of its own, so the calm HUD can fade it) */
.vitals::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--glass); box-shadow: var(--hair); transition: opacity var(--in); }
/* (a hit flashes it red) */
.vitals::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(224, 57, 47, 0.42), rgba(224, 57, 47, 0.12)); opacity: 0; transition: opacity 0.4s; pointer-events: none; }
.vitals.struck::after { opacity: 1; transition: none; }
.vitals.low { border-left-color: var(--alert); }
.gauge { display: grid; gap: 4px; transition: gap var(--in); }
.gauge-head { display: flex; align-items: baseline; gap: 7px; max-height: 32px; overflow: clip; overflow-clip-margin: 3px; transition: max-height var(--in), opacity var(--in); }
.gauge-head .label { flex: 1; font-size: var(--t2); }
.gauge-head em { font: 600 var(--t1) var(--font-display); font-style: normal; letter-spacing: 0.2em; padding: 1px 5px 1px 6px; align-self: center; }
.gauge-head em:empty { display: none; }
.gauge.armor #ap-txt { font-size: var(--t6); line-height: 23px; color: var(--fg); }
#ap-max { font-size: var(--t3); color: var(--dim); margin-left: -5px; }
.gauge.armor .state { color: #1a0605; background: var(--alert); }
/* Bars in segments: the fill shows through a comb of gaps (--seg of them); fills scale from the left */
.gauge-bar {
  position: relative; height: 10px; overflow: hidden; background: rgba(255, 255, 255, 0.075); --seg: 20; transition: height var(--in), background-color var(--in);
  -webkit-mask-image: repeating-linear-gradient(90deg, #000 0 calc(100% / var(--seg) - 2px), transparent calc(100% / var(--seg) - 2px) calc(100% / var(--seg)));
  mask-image: repeating-linear-gradient(90deg, #000 0 calc(100% / var(--seg) - 2px), transparent calc(100% / var(--seg) - 2px) calc(100% / var(--seg)));
}
.gauge-bar > i, .gauge-bar > u { position: absolute; inset: 0; transform-origin: 0 0; }
.gauge.armor .gauge-bar > i { background: linear-gradient(180deg, #fffdf6, var(--fg) 45%, #c9c4b8); }
/* What was just lost: amber, catching up once the hits stop */
#ap-ghost { background: var(--signal); transition: transform 0.45s 0.5s ease-in; }
.gauge.armor.low .gauge-bar > i { background: linear-gradient(180deg, #ff7a6e, var(--alert)); animation: lowpulse 1.2s ease-in-out infinite; }
.gauge.armor.low #ap-txt { color: var(--hot); }
.gauge.armor.crit .gauge-bar > i { animation-duration: 0.6s; }
/* Doomed: the reserve, hot orange to red, bleeding away fast */
.gauge.armor.doom .gauge-bar > i { background: linear-gradient(180deg, #ffb27a, #ff5a2e 50%, var(--alert)); animation-duration: 0.35s; }
.gauge.armor.doom .state { background: #ff5a2e; color: #1a0605; }
@keyframes lowpulse { 50% { opacity: 0.5; } }
.gauge.boost .gauge-bar { height: 6px; --seg: 25; }
.gauge.boost .gauge-bar > i { background: var(--hud); }
.gauge.boost #boost-txt { font-size: var(--t4); color: var(--hud); min-width: 3ch; text-align: right; }
/* Overheated: red, hazard stripes moving through the whole gauge, and a mark where the boosters come back */
#overheat { display: none; color: #1a0605; background: var(--alert); animation: hotpulse 0.9s ease-in-out infinite; }
.gauge.hot #overheat { display: inline-block; }
.gauge.hot #boost-txt { color: var(--hot); }
.gauge.hot .gauge-bar > i { background: var(--alert); }
.gauge.hot .gauge-bar::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -15px; right: 0;
  background: repeating-linear-gradient(135deg, rgba(255, 90, 74, 0.5) 0 5px, transparent 5px 10px);
  animation: stripes 0.6s linear infinite;
}
.gauge.boost .gauge-bar > s { position: absolute; left: 40%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #fff; display: none; z-index: 1; }
.gauge.hot .gauge-bar > s { display: block; }
@keyframes stripes { to { transform: translateX(14.14px); } }
@keyframes hotpulse { 50% { opacity: 0.55; } }
/* In the frame, the core: filling amber as the weapons do damage, READY (V) pulsing, white-hot and draining in overdrive */
.gauge.core .gauge-bar { height: 6px; --seg: 25; }
.gauge.core .gauge-bar > i { background: linear-gradient(90deg, #c98a1c, var(--signal)); transform: scaleX(0); transition: transform 0.25s; }
.gauge.core #core-txt { font-size: var(--t3); color: var(--signal); min-width: 4ch; text-align: right; }
.gauge.core .state { color: #1a1205; background: var(--signal); }
.gauge.core.ready .state { animation: hotpulse 0.9s ease-in-out infinite; }
.gauge.core.ready .gauge-bar > i { background: linear-gradient(90deg, var(--signal), #ffe9b0); box-shadow: 0 0 10px rgba(242, 182, 50, 0.8); }
.gauge.core.on .gauge-bar > i { background: linear-gradient(90deg, #ffd27a, #fffaf0); transition: none; }
.gauge.core.on #core-txt { color: #fffaf0; }
.gauge.core.on .state { background: #fffaf0; }
/* Overdrive: the frame's HUD runs hot */
#hud.overdrive .vitals { border-left-color: var(--signal); box-shadow: inset 3px 0 14px rgba(242, 182, 50, 0.25); }
#hud.overdrive #reticle { filter: drop-shadow(0 0 4px rgba(242, 182, 50, 0.9)); }
@media (prefers-reduced-motion: reduce) { .gauge.core.ready .state { animation: none; } }
/* On foot, the frame: filling toward the next one (amber), READY, or the armor of the one standing by */
.gauge.frame .gauge-bar { height: 6px; --seg: 25; }
.gauge.frame .gauge-bar > i { right: auto; width: 0; background: var(--signal); transition: width 0.2s; }
.gauge.frame #frame-txt { font-size: var(--t3); color: var(--signal); }
.gauge.frame.ready #frame-txt { animation: hotpulse 1s ease-in-out infinite; }
.gauge.frame.ready .gauge-bar > i { background: linear-gradient(90deg, var(--signal), #ffe08a); }
.gauge.frame.lost .gauge-bar > i, .gauge.frame.out.low .gauge-bar > i { background: var(--alert); }
.gauge.frame.out .gauge-bar > i { background: var(--fg); }
.gauge.frame.out #frame-txt { color: var(--fg); }
.readouts { display: flex; gap: 16px; padding-top: 5px; border-top: 1px solid var(--line); max-height: 26px; overflow: hidden; transition: max-height var(--in), opacity var(--in), padding var(--in), border-color var(--in); }
.readouts > div { display: flex; align-items: baseline; gap: 5px; }
.readouts .label { font-size: var(--t2); }
.readouts b { font-size: var(--t4); color: var(--fg); font-weight: 400; min-width: 2ch; text-align: right; }
.readouts small { font-size: var(--t2); color: var(--dim); }
/* ---- the calm HUD (js/ui.js calmTick): with nothing going on for a few seconds, what is not needed steps back. The
   vitals thin to slim bars on no glass (low armor and DOOMED keep their gauge and panel whole, .hold; a frame or core
   READY keeps its words), speed and height fold away; the weapons beyond the one in hand, the top right, threat and
   lost, the frame's lock circle and the keys dim. Anything at all brings it back in --in. ---- */
#hud.calm .vitals:not(.hold) { gap: 3px; padding-top: 4px; padding-bottom: 3px; border-left-color: transparent; transition-duration: var(--out); }
#hud.calm .vitals:not(.hold)::before { opacity: 0; transition-duration: var(--out); }
#hud.calm .gauge:not(.hold, .ready, .on) { gap: 0; transition-duration: var(--out); }
#hud.calm .gauge:not(.hold, .ready, .on) .gauge-head { max-height: 0; opacity: 0; transition-duration: var(--out); }
#hud.calm .gauge:not(.hold, .ready, .on) .gauge-bar { height: 2px; transition-duration: var(--out); }
#hud.calm .gauge.armor:not(.hold) .gauge-bar { height: 4px; }
/* (on no glass a slim bar needs a darker track and an edge to read over a bright street) */
#hud.calm .vitals:not(.hold) .gauge-bar { background-color: rgba(13, 15, 18, 0.5); }
#hud.calm .vitals:not(.hold) .gauge { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.55)); }
#hud.calm .readouts { max-height: 0; opacity: 0; padding-top: 0; border-top-color: transparent; transition-duration: var(--out); }
.hud-topright, .obj-head, .wpn-head, .wrow { transition: opacity var(--in); }
#hud.calm .hud-topright { opacity: 0.65; transition-duration: var(--out); }
#hud.calm .obj-head { opacity: 0.4; transition-duration: var(--out); }
#hud.calm #weapons > .wrow:not(.lead), #hud.calm .wpn-head { opacity: 0.4; transition-duration: var(--out); }
#hud.calm #lock-zone { opacity: 0.25; transition-duration: var(--out); }
#hud.calm #help-hint:not(.gone) { opacity: 0.4; transition-duration: var(--out); }

/* Damage: red edges, and a crescent toward whoever is shooting (mint when the shield took it) */
#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) 52%, rgba(224, 57, 47, 0.34) 80%, rgba(150, 10, 10, 0.72) 100%);
}
#dmg-dirs { position: absolute; left: 50%; top: 50%; transform-origin: 0 0; scale: var(--ui); }
.dmg-dir { position: absolute; left: 0; top: 0; width: 0; height: 0; opacity: 0; will-change: transform, opacity; }
.dmg-dir svg { position: absolute; left: -180px; top: -180px; width: 360px; height: 360px; overflow: visible; fill: rgba(255, 64, 50, 0.92); filter: drop-shadow(0 0 4px rgba(255, 40, 30, 0.7)); }
.dmg-dir.blocked svg { fill: rgba(125, 255, 182, 0.9); filter: drop-shadow(0 0 4px rgba(125, 255, 182, 0.6)); }
@keyframes blink { 50% { opacity: 0.2; } }

/* ---- weapons ---- */
.hud-right {
  position: absolute; right: var(--exr); bottom: var(--eb); width: 262px;
  display: grid; gap: 4px; transform-origin: 100% 100%; scale: var(--ui);
}
/* In the frame: missiles loaded and locks held */
.wpn-head { display: flex; align-items: baseline; justify-content: flex-end; gap: 6px; padding: 2px 9px 2px; background: linear-gradient(90deg, rgba(13, 15, 18, 0), rgba(13, 15, 18, 0.45) 40%); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85); }
.wpn-head .label { font-size: var(--t2); }
.wpn-head b { font-size: var(--t3); font-weight: 400; color: var(--fg); margin-right: 8px; }
.wpn-head .lock-read { display: inline-flex; align-items: baseline; gap: 6px; }
.wpn-head .lock-read b { margin-right: 0; }
.wpn-head .lock-read.on .label, .wpn-head .lock-read.on b { color: var(--hot); }
#hud.foot .wpn-head, .wpn-head.none { display: none; }
#weapons { display: grid; gap: 3px; }
/* (the gun in hand at the bottom, the list growing up from it; the frame's right hand the bottom row) */
.hud-right > #gun-card { order: 2; }
#weapons > .wrow.lead { order: 9; }
/* Folded (js/ui.js: all but a moment after a switch, a pickup or a new set in hand), the rest of the list is one row
   of slots over the gun in hand (in the frame, over its right hand): the key on foot, a glyph and the count, and a
   meter under it only while it fills (a reload, a charge, the next sticky). The frame's mounts go by their place. */
#weapons.compact { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 2px 12px; }
#weapons.compact > .wrow.lead { flex: 1 0 100%; }
#weapons.compact > .wrow:not(.lead) {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 0 5px; position: relative;
  background: none; border: 0; box-shadow: none; clip-path: none; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  animation: wpn-fold 0.25s ease-out;
}
#weapons.compact > .wrow:not(.lead) :is(.wname, .ammo, kbd) { display: none; }
#weapons .cn { display: none; font-size: var(--t3); font-style: normal; color: var(--fg); }
#weapons.compact > .wrow:not(.lead) .cn { display: inline; }
#weapons.compact > .wrow:not(.lead) .slot { font-size: var(--t2); color: var(--dim); }
#weapons.compact > .wrow:not(.lead) .glyph { width: 22px; height: 11px; color: rgba(236, 232, 223, 0.7); filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.7)); }
#hud:not(.foot) #weapons.compact > .wrow:not(.lead) .slot { display: none; }
#weapons.compact > .wrow:not(.lead) .meter { display: none; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; }
#weapons.compact > .wrow:is(.reloading, .charging, .refill):not(.lead) .meter { display: block; }
#weapons.compact > .wrow.low .cn { color: var(--hot); }
#weapons.compact > .wrow.shield.up .glyph { color: var(--hud); }
#weapons.compact > .wrow.missile .glyph { color: #ff8a7e; }
#weapons.compact > .wrow.empty-slot { display: none; }
#weapons:not(.compact) > .wrow:not(.lead) { animation: wpn-open 0.2s cubic-bezier(0.2, 0.9, 0.3, 1); }
@keyframes wpn-open { from { opacity: 0; translate: 0 6px; } }
@keyframes wpn-fold { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #weapons > .wrow { animation: none !important; } }
/* A row per mount: its place, a glyph of the weapon, its name, ammunition and the key that fires it, a meter under */
.wrow {
  position: relative; display: grid; grid-template-columns: 26px 28px minmax(0, 1fr) auto auto; grid-template-rows: auto auto;
  align-items: center; gap: 3px 6px; padding: 4px 8px 5px 7px;
  background: var(--glass); border-left: 2px solid rgba(236, 232, 223, 0.24); box-shadow: var(--hair);
  clip-path: polygon(5px 0, 100% 0, 100% 100%, 0 100%, 0 5px);
}
.wrow .slot { font: var(--t2) var(--font-mono); color: var(--dim); letter-spacing: 0.04em; }
.wrow .glyph { width: 28px; height: 14px; fill: currentColor; color: rgba(236, 232, 223, 0.85); }
.wrow .wname { font-size: var(--t3); font-weight: 600; letter-spacing: 0.1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wrow .ammo { font: var(--t4) var(--font-mono); color: var(--fg); white-space: nowrap; }
.wrow .ammo small { font-size: var(--t2); color: var(--dim); }
.wrow kbd { margin: 0; min-width: 0; padding: 0 4px; font-size: var(--t1); line-height: 13px; color: var(--dim); border-bottom-width: 1px; }
.wrow .meter { grid-column: 2 / -1; grid-row: 2; position: relative; height: 3px; overflow: hidden; background: rgba(255, 255, 255, 0.09); --seg: 1; }
.wrow .meter.segs {
  -webkit-mask-image: repeating-linear-gradient(90deg, #000 0 calc(100% / var(--seg) - 1px), transparent calc(100% / var(--seg) - 1px) calc(100% / var(--seg)));
  mask-image: repeating-linear-gradient(90deg, #000 0 calc(100% / var(--seg) - 1px), transparent calc(100% / var(--seg) - 1px) calc(100% / var(--seg)));
}
.wrow .meter i { position: absolute; inset: 0; background: var(--fg); transform-origin: 0 0; }
.wrow.reloading, .wrow.charging { border-left-color: var(--signal); }
.wrow.reloading .meter i, .wrow.charging .meter i { background: var(--signal); }
.wrow.reloading .ammo, .wrow.charging .ammo { color: var(--signal); font-size: var(--t2); letter-spacing: 0.12em; }
.wrow.firing { border-left-color: #fff; }
.wrow.firing .ammo { color: #fff; font-size: var(--t2); letter-spacing: 0.12em; }
.wrow.low .ammo { color: var(--hot); }
.wrow.low .meter i { background: var(--alert); }
.wrow.missile .meter i { background: var(--hot); }
.wrow.missile .glyph { color: #ff8a7e; }
.wrow.shield .ammo { color: var(--dim); font-size: var(--t2); letter-spacing: 0.12em; }
.wrow.shield .meter { visibility: hidden; }
.wrow.shield.up { border-left-color: var(--hud); }
.wrow.shield.up .ammo, .wrow.shield.up .glyph { color: var(--hud); }
.wrow.empty-slot { opacity: 0.38; }
.wrow.empty-slot .meter { visibility: hidden; }
/* On foot: the gun in hand is the card above, so its row is not shown; the guns carried are slim */
#hud.foot #weapons > .wrow.cur { display: none; }
.wrow.stowed { grid-template-columns: 26px 24px minmax(0, 1fr) auto; padding: 2px 10px 3px 7px; border-left-color: transparent; background: linear-gradient(90deg, rgba(13, 15, 18, 0.42), rgba(13, 15, 18, 0.6)); }
/* (lighter than the gun in hand, still clear over a bright street) */
.wrow.stowed .glyph { width: 24px; height: 12px; color: rgba(236, 232, 223, 0.6); }
.wrow.stowed .wname { font-size: var(--t2); font-weight: 500; letter-spacing: 0.14em; color: rgba(236, 232, 223, 0.74); }
.wrow.stowed .ammo { font-size: var(--t3); color: rgba(236, 232, 223, 0.78); }
.wrow.stowed .meter, .wrow.stowed kbd { display: none; }
.wrow.stowed.low .ammo { color: var(--hot); }
/* The sticky grenades: a slim row, the meter filling toward the next one */
.wrow.nade { grid-template-columns: 26px 24px minmax(0, 1fr) auto; padding: 3px 10px 4px 7px; }
.wrow.nade .glyph { width: 24px; height: 12px; }
.wrow.nade .wname { font-size: var(--t2); letter-spacing: 0.14em; }
.wrow.nade .ammo { font-size: var(--t3); }
.wrow.nade kbd { display: none; }
.wrow.nade .meter { grid-column: 3 / -1; height: 2px; }
/* On foot: the gun in hand, with its fire mode; the reload fills along the bottom edge */
#gun-card {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 3px 10px; padding: 7px 11px 8px;
  background: var(--glass); border-right: 2px solid var(--hud); box-shadow: var(--hair);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% 100%, 0 100%, 0 var(--cut));
}
.gun-head { grid-column: 1; grid-row: 1; display: flex; align-items: center; gap: 7px; min-width: 0; }
.gun-sub { grid-column: 1; grid-row: 2; display: flex; align-items: center; gap: 8px; }
#gun-slot { font-size: var(--t2); color: var(--dim); padding: 0 4px; border: 1px solid var(--line); line-height: 14px; }
#gun-card .glyph { flex: none; width: 34px; height: 17px; fill: currentColor; color: var(--fg); }
#gun-name { font-size: var(--t4); font-weight: 700; letter-spacing: 0.14em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#gun-mode { flex: none; font-size: var(--t1); font-style: normal; letter-spacing: 0.16em; color: var(--dim); padding: 0 3px 0 4px; border: 1px solid var(--line); line-height: 13px; }
.gun-ammo { grid-row: 1 / 3; grid-column: 2; display: flex; align-items: baseline; gap: 3px; }
#gun-card #gun-pips { grid-column: 1 / -1; grid-row: 3; margin-top: 3px; }
#gun-mag { font-size: var(--t7); line-height: 30px; font-weight: 400; color: var(--fg); min-width: 2ch; text-align: right; }
#gun-res { font-size: var(--t4); color: var(--dim); }
#gun-res::before { content: '/'; margin-right: 3px; color: rgba(157, 153, 143, 0.6); }
/* A pip for every round in the magazine (in groups when there are many; a shell each, bigger, when few) */
#gun-pips { display: flex; gap: 2px; align-items: flex-end; height: 8px; }
#gun-pips i { flex: 1 1 0; max-width: 6px; height: 100%; background: var(--fg); }
#gun-pips.few i { max-width: 14px; }
#gun-pips i.out { background: rgba(255, 255, 255, 0.13); }
.gun-rl { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; display: none; }
.gun-rl b { position: absolute; inset: 0; background: var(--signal); transform-origin: 0 0; }
#gun-card.reloading { border-right-color: var(--signal); }
#gun-card.reloading .gun-rl { display: block; }
#gun-card.reloading #gun-mag { color: var(--signal); }
#gun-card.reloading #gun-pips i:not(.out) { background: var(--signal); }
#gun-card.low #gun-mag { color: var(--hot); }
#gun-card.low { border-right-color: var(--alert); }
#gun-card.dry #gun-mag, #gun-card.dry #gun-res { color: var(--hot); }

/* ---- the invasion ---- */
.obj-head { display: flex; align-items: center; gap: 7px; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
.obj-head .label { color: var(--fg); font-size: var(--t2); letter-spacing: 0.2em; }
.obj-head .pips { display: inline-flex; gap: 3px; margin-right: 8px; }
.obj-head .pips i { width: 10px; height: 8px; background: rgba(13, 15, 18, 0.72); border: 1px solid rgba(236, 232, 223, 0.4); transform: skewX(-18deg); }
.obj-head .pips i.on { background: var(--rift); border-color: var(--rift); box-shadow: 0 0 6px rgba(199, 125, 255, 0.7); }
/* (the top two threat levels burn red) */
#threat[data-n="4"] i.on, #threat[data-n="5"] i.on { background: var(--alert); border-color: var(--hot); box-shadow: 0 0 6px rgba(224, 57, 47, 0.75); }
.obj-head .pips.lost i.on { background: var(--alert); border-color: var(--alert); box-shadow: 0 0 6px rgba(224, 57, 47, 0.7); }
/* A row per open rift, under the unit tag: where, how far, its district's threat, its anchor's strength */
#objectives {
  position: absolute; left: var(--ex); top: calc(var(--et) + 56px * var(--ui));
  display: grid; gap: 5px; width: 240px; transform-origin: 0 0; scale: var(--ui);
}
#hud #objectives { width: 240px; }
#obj-note { font-size: var(--t2); letter-spacing: 0.14em; color: var(--signal); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
#obj-note:empty { display: none; }
.obj-row {
  display: grid; gap: 4px; padding: 6px 10px 7px 9px; background: var(--glass); border-left: 2px solid var(--rift); box-shadow: var(--hair);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%);
}
.obj-row .head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.obj-row .head b { font-size: var(--t3); font-weight: 600; letter-spacing: 0.14em; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.obj-row .head b::before {
  content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 8px; background: var(--rift);
  transform: rotate(45deg) translateY(-1px); box-shadow: 0 0 6px rgba(199, 125, 255, 0.8);
}
.obj-row .head span { font-size: var(--t3); color: var(--fg); white-space: nowrap; }
.obj-row .line { display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 6px; }
.obj-row .line small { font-size: var(--t1); letter-spacing: 0.16em; color: var(--dim); }
.obj-row .line i { position: relative; display: block; height: 4px; background: rgba(0, 0, 0, 0.55); overflow: hidden; }
.obj-row .line i b { position: absolute; inset: 0; background: var(--signal); transform-origin: 0 0; scale: 0 1; transition: scale 0.3s; }
.obj-row .line.hp i b { background: var(--rift); }
.obj-row.crit { border-left-color: var(--alert); }
.obj-row.crit .line.threat i b { background: var(--alert); animation: crit 0.9s ease-in-out infinite; }
.obj-row.far .head span { color: var(--signal); }
.obj-row.armed .line.hp small { color: var(--signal); }
.obj-row.armed .line.hp i b { background: var(--signal); animation: crit 0.5s ease-in-out infinite; }
@keyframes crit { 50% { opacity: 0.45; } }
/* What the director announces: a title across the top over a rule with hazard ends, and a line under it */
#banner {
  position: absolute; left: 50%; top: calc(var(--et) + 104px * var(--ui)); translate: -50% 0; transform-origin: 50% 0; scale: var(--ui);
  display: grid; justify-items: center; gap: 7px; width: max-content; max-width: calc((100vw - 32px) / var(--ui)); text-align: center;
  color: var(--signal); opacity: 0; transition: opacity 0.45s;
}
#banner::before {
  content: ''; position: absolute; left: -80px; right: -80px; top: -10px; bottom: -8px; z-index: -1;
  background: linear-gradient(90deg, transparent, rgba(13, 15, 18, 0.42) 22%, rgba(13, 15, 18, 0.42) 78%, transparent);
}
#banner.on { opacity: 1; }
#banner b { font-size: var(--t6); font-weight: 700; line-height: 1.1; letter-spacing: 0.34em; padding-left: 0.34em; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8); }
#banner i { position: relative; width: 380px; max-width: 60vw; height: 2px; background: linear-gradient(90deg, transparent, currentColor 18%, currentColor 82%, transparent); }
#banner i::before, #banner i::after {
  content: ''; position: absolute; top: -3px; width: 40px; height: 8px;
  background: repeating-linear-gradient(135deg, currentColor 0 4px, transparent 4px 8px);
}
#banner i::before { right: calc(100% + 8px); }
#banner i::after { left: calc(100% + 8px); }
#banner span { font: var(--t3) var(--font-mono); letter-spacing: 0.24em; padding: 3px 12px 3px 14px; color: var(--fg); background: var(--glass); border-left: 2px solid currentColor; }
#banner.good { color: var(--hud); }
#banner.bad { color: var(--hot); }
#banner.on b { animation: bannerT 0.6s cubic-bezier(0.16, 0.9, 0.24, 1) both; }
#banner.on i { animation: bannerR 0.5s cubic-bezier(0.2, 0.9, 0.2, 1) both; }
#banner.on span { animation: bannerS 0.4s 0.16s ease-out both; }
@keyframes bannerT { 0% { opacity: 0; scale: 1.3 1; } 55% { opacity: 1; } 100% { opacity: 1; scale: 1 1; } }
@keyframes bannerR { from { opacity: 0; scale: 0 1; } to { opacity: 1; scale: 1 1; } }
@keyframes bannerS { from { opacity: 0; translate: 0 -5px; } to { opacity: 1; translate: 0 0; } }
/* Each rift's mark: on the compass, and over the rift itself with how far it is (js/ui.js places it with translate) */
#compass-tape u { position: absolute; top: 25px; width: 7px; height: 7px; margin-left: -3.5px; background: var(--rift); transform: rotate(45deg); box-shadow: 0 0 5px rgba(199, 125, 255, 0.9); }
.obj-mark { position: absolute; left: 0; top: 0; display: grid; justify-items: center; gap: 3px; transform: translate(-50%, -100%); transform-origin: 0 0; scale: var(--ui); }
.obj-mark span { font-size: var(--t2); letter-spacing: 0.06em; padding: 1px 7px 1px 6px; color: var(--fg); background: var(--glass); border-left: 2px solid var(--rift); white-space: nowrap; }
.obj-mark i { width: 12px; height: 12px; border: 2px solid var(--rift); background: rgba(180, 77, 255, 0.3); transform: rotate(45deg); box-shadow: 0 0 9px rgba(180, 77, 255, 0.75); }
.obj-mark::after { content: ''; width: 1px; height: 10px; margin-top: 2px; background: linear-gradient(var(--rift), transparent); }
.obj-mark.crit span { border-left-color: var(--alert); color: var(--hot); }
.obj-mark.crit i { animation: crit 0.9s ease-in-out infinite; }
/* (out of view: a chevron toward it at the edge of the middle band, js/ui.js turns it) */
.obj-mark b { display: none; }
.obj-mark.edge { transform: translate(-50%, -50%); }
.obj-mark.edge i, .obj-mark.edge::after { display: none; }
.obj-mark.edge b { display: block; order: -1; width: 16px; height: 16px; background: var(--rift); clip-path: polygon(0 0, 100% 50%, 0 100%, 28% 50%); }
.obj-mark.edge.crit b { background: var(--hot); }
@media (prefers-reduced-motion: reduce) {
  #killfeed div, #banner.on b, #banner.on i, #banner.on span, .gauge.armor.low .gauge-bar > i, #overheat, .gauge.hot .gauge-bar::after,
  .gauge.frame.ready #frame-txt, .obj-row.crit .line.threat i b, .obj-row.armed .line.hp i b, .obj-mark.crit i { animation: none; }
}
@media (max-height: 500px) { #banner span { display: none; } #objectives { display: none; } }

/* The districts map */
#map { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; background: rgba(13, 15, 18, 0.5); }
/* (while it is open, what belongs to aiming and announcing stands aside) */
#hud.mapping #reticle, #hud.mapping #lock-zone, #hud.mapping #toast, #hud.mapping #banner, #hud.mapping #prompt, #hud.mapping #obj-markers,
#hud.mapping #locks, #hud.mapping #hardlock, #hud.mapping #lead, #hud.mapping #lead-line, #hud.mapping #lock-arrow, #hud.mapping #help-hint { visibility: hidden; }
#map[hidden] { display: none; }
.map-card {
  display: grid; gap: 9px; padding: 13px 16px 15px; background: var(--panel); border-top: 2px solid var(--rift);
  width: min(792px, calc(100vw - 32px)); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
}
.map-head { display: flex; justify-content: space-between; align-items: baseline; }
.map-head .eyebrow { color: var(--rift); }
.map-hint { font-size: var(--t2); color: var(--dim); }
.map-card canvas { width: 100%; height: auto; display: block; background: rgba(0, 0, 0, 0.35); }
.map-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: var(--t2); letter-spacing: 0.14em; color: var(--dim); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend span::before { content: ''; width: 12px; height: 9px; }
.map-legend .lg-calm::before { background: rgba(125, 255, 182, 0.16); box-shadow: inset 0 0 0 1px rgba(125, 255, 182, 0.5); }
.map-legend .lg-rift::before { background: rgba(180, 77, 255, 0.32); box-shadow: inset 0 0 0 1px rgba(199, 125, 255, 0.95); }
.map-legend .lg-lost::before { background: repeating-linear-gradient(135deg, rgba(224, 57, 47, 0.75) 0 2px, rgba(224, 57, 47, 0.22) 2px 4px); box-shadow: inset 0 0 0 1px var(--alert); }
.map-legend .lg-anchor::before { width: 8px; height: 8px; margin: 0 2px; rotate: 45deg; background: #c77dff; box-shadow: 0 0 5px #b44dff; }
.map-legend .lg-frame::before { width: 9px; height: 9px; background: var(--signal); }
.map-legend .lg-you::before { width: 10px; height: 11px; background: var(--hud); clip-path: polygon(50% 0, 100% 100%, 50% 72%, 0 100%); }
.map-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 4px 14px; font-size: var(--t3); letter-spacing: 0.08em; color: var(--dim); }
.map-list li { display: flex; justify-content: space-between; gap: 8px; border-left: 2px solid var(--hud-dim); padding-left: 7px; }
.map-list li b { font-weight: 400; color: var(--fg); }
.map-list li.rift { border-left-color: var(--rift); }
.map-list li.rift span { color: var(--rift); }
.map-list li.lost { border-left-color: var(--alert); }
.map-list li.lost span { color: var(--alert); }
/* Controls in the hangar: a role and the key that does it */
.bind-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; }
.bind-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: #d6d2c8; }
.bind-row button { min-width: 74px; padding: 4px 8px; font: 12px var(--font-mono); color: var(--fg); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); }
.bind-row button:hover { background: rgba(255, 255, 255, 0.11); }
.bind-row button.listening { color: #16130b; background: var(--signal); border-color: var(--signal); }
.bind-row button.none { color: var(--alert); }
@media (max-width: 560px) { .bind-grid { grid-template-columns: 1fr; } }

/* What a held key would do here, just under the reticle */
#prompt {
  position: absolute; left: 50%; top: calc(50% + 74px * var(--ui)); translate: -50% 0; transform-origin: 50% 0; scale: var(--ui);
  display: flex; align-items: center; gap: 9px; padding: 5px 13px 6px 7px; overflow: hidden;
  background: var(--glass); border-left: 2px solid var(--signal); box-shadow: var(--hair);
  font-size: var(--t3); font-weight: 600; letter-spacing: 0.2em; color: var(--fg); white-space: nowrap;
}
/* (through a sight the prompt and the hook's brackets step out of its picture; a key being held brings the prompt back) */
#prompt, #hook-aim { transition: opacity 0.12s linear; }
#hud.sighted #prompt:not(.held), #hud.sighted #hook-aim { opacity: 0; }
#prompt kbd { margin: 0; color: var(--signal); border-color: rgba(242, 182, 50, 0.55); background: rgba(242, 182, 50, 0.08); }
/* (holding the key fills the bottom edge) */
#prompt i { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(242, 182, 50, 0.18); }
#prompt i b { position: absolute; inset: 0; background: var(--signal); transform-origin: 0 0; transform: scaleX(0); }

#toast {
  /* Under a banner (one can be showing at the same time), so under the boss bar too, which matters on short landscape phones */
  position: absolute; left: 50%; top: max(28%, calc(var(--et) + 198px * var(--ui))); translate: -50% 0; transform-origin: 50% 0; scale: var(--ui);
  display: flex; align-items: center; gap: 14px;
  width: max-content; max-width: calc((100vw - 32px) / var(--ui)); text-align: center;
  font-size: var(--t5); font-weight: 700; letter-spacing: 0.26em; color: var(--signal);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
  opacity: 0; transition: opacity 0.3s;
}
#toast::before, #toast::after { content: ''; flex: none; width: 28px; height: 2px; background: currentColor; opacity: 0.7; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
#toast.on { opacity: 1; transition: none; }
#help-hint {
  position: absolute; left: 50%; bottom: var(--eb); translate: -50% 0; transform-origin: 50% 100%; scale: var(--ui);
  max-width: calc((100vw - 2 * var(--ex) - 832px * var(--ui)) / var(--ui)); text-align: center;
  font-size: var(--t2); line-height: 16px; color: var(--dim); background: var(--glass); padding: 4px 12px;
  transition: opacity var(--in);
}
/* (the keys fade after a while: js/ui.js setFoot) */
#help-hint.gone { opacity: 0; transition-duration: 1s; }
#help-hint b { color: var(--fg); font-weight: 400; }

/* ---------- 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(auto-fit, minmax(90px, 1fr)); gap: 6px; }
#over-salvage-box b { color: var(--signal); }
.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(680px, 100%); justify-self: start; margin-left: max(0px, 6vw); display: grid; gap: 14px; padding-block: 20px; }
.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.45; color: #d6d2c8; max-width: 62ch; }
.controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.touch-note { margin: 0; font-size: 13px; color: var(--dim); }
/* Invasion or sandbox: two cards, the picked one lit like a picked frame (their own class: `.frame-card` is the frame select's) */
.mode-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mode-card {
  display: grid; gap: 7px; text-align: left; color: var(--fg); font: inherit; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--line);
  padding: 12px 14px;
}
.mode-card:hover { background: rgba(30, 33, 38, 0.92); }
.mode-card[aria-pressed="true"] { border-color: rgba(242, 182, 50, 0.55); border-left-color: var(--signal); }
.mode-card[aria-pressed="true"] .fc-code { color: var(--signal); }
.mode-card .fc-name { font-size: 20px; }
.mode-card .fc-blurb { font-size: 13px; line-height: 1.4; color: #c9c5bb; }
@media (max-width: 560px) { .mode-list { grid-template-columns: 1fr; } }
.intro-actions { display: flex; gap: 12px; flex-wrap: wrap; }
/* The briefing: the alert and the wordmark, the two modes with their marks, the pilot's record, then the keys */
.intro-card { gap: 13px; animation: intro-in 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes intro-in { from { opacity: 0; transform: translateX(-16px); } }
.intro-alert { display: inline-flex; align-items: center; gap: 9px; }
.intro-alert b { width: 7px; height: 7px; background: #c77dff; transform: rotate(45deg); box-shadow: 0 0 8px rgba(199, 125, 255, 0.9); animation: alert-pulse 1.8s ease-in-out infinite; }
.intro-card h1 { font-size: clamp(44px, 7.4vw, 86px); text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45); margin-top: -2px; }
.intro-card .lede { font-size: 15.5px; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6); }
.mode-card {
  position: relative; grid-template-columns: 42px minmax(0, 1fr); grid-template-areas: "icon head" "icon role" "blurb blurb";
  column-gap: 12px; row-gap: 4px; align-items: center; padding: 12px 14px 13px;
  background: linear-gradient(180deg, rgba(25, 28, 34, 0.92), rgba(13, 15, 18, 0.88));
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
  transition: background 0.15s, border-color 0.15s;
}
.mode-card:hover, .mode-card:focus-visible { background: linear-gradient(180deg, rgba(36, 40, 47, 0.95), rgba(18, 20, 24, 0.9)); border-color: rgba(236, 232, 223, 0.3); }
.mode-card:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }
.mode-icon { grid-area: icon; width: 42px; height: 42px; fill: none; stroke: var(--dim); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; transition: stroke 0.2s; }
.mode-card .fc-head { grid-area: head; align-self: end; }
.mode-card .fc-role { grid-area: role; align-self: start; }
.mode-card .fc-blurb { grid-area: blurb; margin-top: 4px; }
.mode-card[aria-pressed="true"] { background: linear-gradient(180deg, rgba(242, 182, 50, 0.14), rgba(13, 15, 18, 0.9) 70%); box-shadow: inset 0 1px 0 rgba(242, 182, 50, 0.45); }
#mode-invasion[aria-pressed="true"] .mode-icon { stroke: #c77dff; filter: drop-shadow(0 0 6px rgba(199, 125, 255, 0.55)); }
#mode-sandbox[aria-pressed="true"] .mode-icon { stroke: var(--hud); filter: drop-shadow(0 0 6px rgba(125, 255, 182, 0.4)); }
.mode-card[aria-pressed="true"]::after { content: ''; position: absolute; right: 12px; top: 14px; width: 8px; height: 8px; background: var(--signal); transform: rotate(45deg); box-shadow: 0 0 8px rgba(242, 182, 50, 0.8); }
/* The pilot's record: a row of figures */
.intro-profile {
  display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; padding: 0;
  background: linear-gradient(90deg, rgba(13, 15, 18, 0.88), rgba(13, 15, 18, 0.7)); border: 1px solid var(--line); border-left: 3px solid #c77dff;
}
.intro-profile .ip-title { display: grid; place-items: center; padding: 0 12px; font: 600 10px var(--font-display); letter-spacing: 0.2em; text-transform: uppercase; color: #c77dff; writing-mode: vertical-rl; transform: rotate(180deg); border-left: 1px solid var(--line); }
.intro-profile > div { display: grid; gap: 1px; padding: 8px 13px 7px; border-left: 1px solid var(--line); min-width: 0; }
.intro-profile > div:first-of-type { border-left: 0; }
.intro-profile b { display: flex; align-items: center; gap: 7px; font: 400 18px var(--font-mono); color: var(--fg); white-space: nowrap; }
.intro-profile span:not(.pips) { font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); white-space: nowrap; }
.intro-profile .sal b { color: var(--signal); }
.intro-profile .pips { display: inline-flex; gap: 3px; }
.intro-profile .pips i { width: 7px; height: 11px; transform: skewX(-14deg); border: 1px solid rgba(236, 232, 223, 0.35); }
.intro-profile .pips i.on { background: var(--hud); border-color: var(--hud); box-shadow: 0 0 5px rgba(125, 255, 182, 0.6); }
.intro-actions { align-items: center; }
.intro-hint { font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); }
.intro-hint::before { content: '\25B8  '; color: var(--signal); }
/* The keys: one panel in two halves, a key to a row with what it does on foot and in the frame */
.controls { gap: 0; padding: 9px 4px 10px; background: linear-gradient(180deg, rgba(25, 28, 34, 0.9), rgba(13, 15, 18, 0.86)); border-top: 2px solid var(--hud); }
.ctl-table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.ctl-table + .ctl-table { border-left: 1px solid var(--line); }
.ctl-table th { padding: 0 10px 5px; text-align: left; font: 600 10px var(--font-display); letter-spacing: 0.2em; text-transform: uppercase; color: var(--hud); }
.ctl-table th:first-child { color: var(--dim); }
.ctl-table td { padding: 2px 10px; color: #d6d2c8; white-space: nowrap; }
.ctl-table td:first-child { width: 1%; }
.ctl-table td:last-child { color: #b9b5ab; }
.ctl-table td.na { color: rgba(157, 153, 143, 0.5); }
.ctl-table kbd { margin: 0; font-size: 11px; padding: 0 5px; }
.ctl-table small { font: 9.5px var(--font-mono); letter-spacing: 0.1em; color: var(--dim); text-transform: uppercase; }
.ctl-table tbody tr:nth-child(odd) td { background: rgba(255, 255, 255, 0.02); }
@media (max-height: 500px) {
  .intro-card h1 { font-size: 38px; }
  .intro-profile > div { padding: 5px 10px 4px; }
  .intro-profile b { font-size: 15px; }
  .mode-card { padding: 9px 12px 10px; grid-template-columns: 34px minmax(0, 1fr); }
  .mode-icon { width: 34px; height: 34px; }
}
@media (max-width: 720px) {
  .intro-profile .ip-title { display: none; }
}
/* (a short landscape phone: the actions come before the record, and the story gives way) */
@media (max-height: 420px) {
  .intro-card .lede { display: none; }
  .intro-card .intro-actions { order: 1; }
  .intro-card .intro-profile { order: 2; }
  .intro-card .controls, .intro-card .touch-note { order: 3; }
}
@media (prefers-reduced-motion: reduce) {
  .intro-card { animation: none; }
  .intro-alert b { animation: none; }
}

/* ---------- 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; }
/* The cards: a role glyph, the name, how far each figure goes against the best in the bay (with a tick for the
   frame picked and the difference), how a locked one is earned */
.frame-card {
  position: relative; gap: 6px; padding: 11px 14px 12px;
  background: linear-gradient(180deg, rgba(25, 28, 34, 0.9), rgba(13, 15, 18, 0.86));
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.frame-card:hover:not(.locked), .frame-card:focus-visible { background: linear-gradient(180deg, rgba(36, 40, 47, 0.94), rgba(18, 20, 24, 0.9)); border-color: rgba(236, 232, 223, 0.32); }
.frame-card:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }
.frame-card[aria-pressed="true"] { background: linear-gradient(180deg, rgba(242, 182, 50, 0.13), rgba(13, 15, 18, 0.88) 60%); box-shadow: inset 0 1px 0 rgba(242, 182, 50, 0.4); }
.fc-top { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.fc-glyph { width: 34px; height: 34px; padding: 4px; fill: none; stroke: var(--hud); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; border: 1px solid rgba(125, 255, 182, 0.3); background: rgba(125, 255, 182, 0.05); }
.frame-card[aria-pressed="true"] .fc-glyph { stroke: var(--signal); border-color: rgba(242, 182, 50, 0.5); background: rgba(242, 182, 50, 0.08); }
.frame-card.locked .fc-glyph { stroke: var(--dim); border-color: var(--line); background: transparent; }
.frame-card .fc-head { display: grid; gap: 1px; }
.frame-card .fc-code { font-size: 11px; letter-spacing: 0.12em; }
.frame-card .fc-name { font-size: 21px; line-height: 1; }
.fc-tag { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); }
.frame-card[aria-pressed="true"] .fc-tag { color: #16130b; background: var(--signal); padding: 2px 6px; }
.frame-card.locked .fc-tag { color: var(--dim); border: 1px dashed var(--line); padding: 1px 6px; }
.frame-card .fc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; }
.frame-card .fc-stat { grid-template-columns: 40px minmax(0, 1fr) auto 34px; gap: 6px; }
.frame-card .fc-stat .label { font-size: 10px; text-transform: uppercase; }
.frame-card .fc-stat i { position: relative; height: 5px; }
.frame-card .fc-stat i u { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--signal); }
.frame-card .fc-stat .mono { font-size: 11.5px; white-space: nowrap; }
/* (tall screens have the room for a row a figure, and longer bars) */
@media (min-height: 860px) and (min-width: 721px) { .frame-card .fc-stats { grid-template-columns: 1fr; gap: 3px; } .frame-card .fc-stat { grid-template-columns: 52px minmax(0, 1fr) 76px 40px; } }
.frame-card .fc-stat em { font: 10.5px var(--font-mono); font-style: normal; text-align: right; }
.frame-card .fc-stat em.up { color: var(--hud); }
.frame-card .fc-stat em.down { color: #ff6a5e; }
.frame-card .fc-blurb { font-size: 12.5px; line-height: 1.42; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.frame-card.locked > :not(.fc-lock):not(.fc-top) { opacity: 0.45; }
.frame-card.locked .fc-top .fc-head { opacity: 0.6; }
.fc-lock { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.fc-lock::before { content: 'Earn it \00b7'; color: var(--dim); }
.fc-lock small { font: 10.5px var(--font-mono); letter-spacing: 0.12em; color: var(--hud); }

/* ---------- 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(480px, 100%);
  background: linear-gradient(180deg, #191c22, #111317 30%);
  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); }
/* Progression (invasion only): what is not owned yet is dimmed, with its price or how it is earned */
.chip.locked { color: var(--dim); border-style: dashed; }
.chip.locked::after { content: attr(data-price); margin-left: 7px; font: 11px var(--font-mono); color: var(--signal); }
.chip.locked[data-price=""]::after { content: 'LOCKED'; letter-spacing: 0.1em; }
.swatch.locked { opacity: 0.45; outline: 1px dashed var(--line); outline-offset: 2px; }
.salvage { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.salvage b { font-size: 18px; font-weight: 400; color: var(--signal); }
.buy-row, .kit-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; background: rgba(242, 182, 50, 0.07); border-left: 2px solid var(--signal); font-size: 13px; color: #d6d2c8; }
.buy-row button, .kit-row button { white-space: nowrap; padding: 6px 12px; font-size: 12px; }
.buy-row button:disabled, .kit-row button:disabled { opacity: 0.45; cursor: default; }
.kit-row { background: rgba(255, 255, 255, 0.04); border-left-color: var(--line); }
.kit-row.owned { border-left-color: var(--hud); }
.kit-row b { display: block; font-size: 13px; letter-spacing: 0.08em; color: var(--fg); }
.kit-row small { color: var(--dim); font-size: 12px; }
.kit-row .own { font: 11px var(--font-mono); letter-spacing: 0.14em; color: var(--hud); }
/* (the card keeps its panel; what is on it is dimmed, but not the line that says how to earn it) */
.frame-card.locked .fc-code { color: var(--dim); }
.frame-card.locked { cursor: default; }
.fc-lock { font-size: 11px; letter-spacing: 0.16em; color: var(--signal); text-transform: uppercase; }
.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); }

/* ---------- the hangar as an armory: tabs, the hardpoints, a rack per hardpoint with its comparison ---------- */
@media (min-width: 1700px) { #hangar { width: 540px; } }
.hh-row { border-bottom: 0; padding-bottom: 8px; }
.hh-row h2 { letter-spacing: 0.02em; }
.hh-tabs { display: flex; gap: 2px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.hh-tabs [role="tab"] {
  position: relative; display: inline-flex; align-items: baseline; gap: 7px;
  padding: 9px 12px 10px; border: 0; background: transparent; color: var(--dim);
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
}
.hh-tabs [role="tab"] .mono { font-size: 10px; letter-spacing: 0.08em; opacity: 0.7; }
.hh-tabs [role="tab"]:hover { color: var(--fg); }
.hh-tabs [role="tab"][aria-selected="true"] { color: var(--fg); }
.hh-tabs [role="tab"][aria-selected="true"] .mono { color: var(--signal); opacity: 1; }
.hh-tabs [role="tab"]::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--signal); transform: scaleX(0); transition: transform 0.18s ease-out; }
.hh-tabs [role="tab"][aria-selected="true"]::after { transform: scaleX(1); }
.hh-tabs [role="tab"]:focus-visible { outline-offset: -2px; }
.hpanel { display: grid; gap: 16px; align-content: start; }
.hpanel[hidden] { display: none; }
.hsec-title h3 { color: var(--fg); }
.hsec-title h3::before { content: ''; display: inline-block; width: 6px; height: 6px; margin: 0 8px 1px 0; background: var(--signal); transform: rotate(45deg); }
/* The frame: four small cards in a row */
.frame-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.frame-chips .chip { display: grid; gap: 1px; text-align: left; padding: 5px 8px 6px; }
.frame-chips .chip .mono { font-size: 10px; font-weight: 400; letter-spacing: 0.08em; opacity: 0.8; }
.frame-chips .chip b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frame-chips .chip.locked::after { content: none; }
.frame-chips .chip.locked .mono::after { content: ' \00b7  LOCKED'; color: var(--signal); }
/* The hardpoints: a tile each, laid out as they sit on the frame */
.hp-map { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.hp-mount {
  display: grid; gap: 2px; text-align: left; color: var(--fg); font: inherit;
  padding: 6px 10px 7px 11px; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line); border-left: 3px solid rgba(125, 255, 182, 0.55);
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 0 100%);
  transition: background 0.12s, border-color 0.12s;
}
.hp-mount:hover { background: rgba(255, 255, 255, 0.08); }
.hp-mount.empty { border-left-color: var(--line); }
.hp-mount.empty .hp-wpn { color: var(--dim); }
.hp-mount.on { background: linear-gradient(90deg, rgba(242, 182, 50, 0.16), rgba(242, 182, 50, 0.04)); border-color: rgba(242, 182, 50, 0.45); border-left-color: var(--signal); }
.hp-slot { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.hp-slot b { font-size: 10.5px; font-weight: 600; letter-spacing: 0.18em; color: var(--dim); }
.hp-mount.on .hp-slot b { color: var(--signal); }
.hp-slot kbd { font-size: 10px; margin: 0; padding: 0 5px; min-width: 0; }
.hp-wpn { display: flex; align-items: center; gap: 7px; font-size: 14.5px; font-weight: 700; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; }
.hp-wpn span { overflow: hidden; text-overflow: ellipsis; }
.hp-sub { font-size: 10.5px; letter-spacing: 0.08em; color: var(--dim); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.hp-wpn .wg { color: var(--hud); }
.hp-mount.on .hp-wpn .wg { color: var(--signal); }
.hp-sum { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); padding: 2px 2px 0; }
.hp-sum b { font-weight: 400; color: var(--fg); }
/* The rack: what this hardpoint takes, a row each */
.slot-card { background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); border-left: 3px solid var(--signal); padding: 10px 12px 12px; gap: 10px; }
.slot-card.filled { border-left-color: var(--signal); }
.slot-card .hsec-title h3::before { background: var(--hud); }
.wp-list { display: grid; gap: 3px; }
.chip.wp {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) auto 76px; align-items: center; gap: 9px;
  text-align: left; padding: 7px 10px; font-size: 13px; background: rgba(255, 255, 255, 0.03); border-color: transparent; border-left: 2px solid transparent;
}
.chip.wp:hover, .chip.wp:focus-visible { background: rgba(255, 255, 255, 0.09); }
.chip.wp .wg { color: var(--dim); }
.wp-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wp-code { font-size: 11px; font-weight: 400; color: var(--dim); }
.wp-state { font-size: 10.5px; font-weight: 400; letter-spacing: 0.12em; text-transform: uppercase; text-align: right; color: var(--dim); }
.chip.wp[aria-pressed="true"] { background: rgba(242, 182, 50, 0.12); color: var(--fg); border-color: transparent; border-left-color: var(--signal); }
.chip.wp[aria-pressed="true"] .wg, .chip.wp[aria-pressed="true"] .wp-state { color: var(--signal); }
.chip.wp.locked { border-style: solid; border-color: transparent; color: var(--dim); }
.chip.wp.locked::after, .chip.preset.locked::after { content: none; }
.chip.wp.locked .wp-state { color: var(--signal); letter-spacing: 0.06em; }
.chip.wp.offered { border: 1px dashed rgba(242, 182, 50, 0.6); border-left: 2px solid var(--signal); color: var(--fg); }
/* The comparison: what the pointed-at weapon does, against what is mounted */
.wp-compare, .wc-body { display: grid; gap: 7px; }
.wp-compare {
  padding: 10px 12px 11px; border: 1px solid rgba(125, 255, 182, 0.18);
  background: linear-gradient(180deg, rgba(125, 255, 182, 0.06), rgba(125, 255, 182, 0.02)), #14171c;
}
/* With room for it, the comparison stands beside the panel, over the bay, where it is always in view */
@media (min-width: 1000px) and (min-height: 600px) {
  .wp-compare {
    position: fixed; z-index: 41; bottom: max(18px, env(safe-area-inset-bottom, 0px)); right: calc(min(480px, 100%) + 16px); width: 360px;
    background: linear-gradient(180deg, rgba(125, 255, 182, 0.07), rgba(125, 255, 182, 0.02)), rgba(13, 15, 18, 0.9);
    border-top: 2px solid var(--hud); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  }
  .wp-compare::before { content: 'Inspect'; font: 10px var(--font-mono); letter-spacing: 0.24em; text-transform: uppercase; color: var(--hud); margin-bottom: -2px; }
}
@media (min-width: 1700px) and (min-height: 600px) { .wp-compare { right: 556px; width: 380px; } }
.wp-compare .buy-row { margin-top: 2px; }
#binds-reset { justify-self: start; }
.wc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.wc-head b { font-size: 15px; letter-spacing: 0.04em; }
.wc-tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.wc-tags i { font: 9.5px var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; font-style: normal; color: var(--hud); border: 1px solid rgba(125, 255, 182, 0.35); padding: 1px 5px; }
.wc-desc { margin: 0; font-size: 12.5px; line-height: 1.4; color: #c9c5bb; }
.wc-stats { display: grid; gap: 5px; }
.wc-stat { display: grid; grid-template-columns: 70px minmax(0, 1fr) 72px 50px; align-items: center; gap: 8px; }
.wc-stat .label { font-size: 10px; text-transform: uppercase; }
.wc-stat i { position: relative; display: block; height: 6px; background: rgba(255, 255, 255, 0.07); }
.wc-stat i b { display: block; height: 100%; background: var(--hud); -webkit-mask-image: repeating-linear-gradient(90deg, #000 0 6px, transparent 6px 8px); mask-image: repeating-linear-gradient(90deg, #000 0 6px, transparent 6px 8px); }
.wc-stat i u { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--fg); opacity: 0.85; }
.wc-stat .mono { font-size: 12px; text-align: right; color: var(--fg); white-space: nowrap; }
.wc-stat em { font: 11px var(--font-mono); font-style: normal; white-space: nowrap; }
.wc-stat em.up { color: var(--hud); }
.wc-stat em.down { color: #ff6a5e; }
.wc-foot { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); padding-top: 4px; border-top: 1px solid rgba(236, 232, 223, 0.08); }
.wc-foot b { font-weight: 400; color: var(--fg); }
.wc-foot .vs { margin-left: auto; color: var(--signal); }
.wp-skins { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: baseline; }
.wp-skins .label { font-size: 10px; text-transform: uppercase; }
.wp-skins .hint { font-size: 11px; color: var(--dim); text-align: right; }
.wp-skins .swatches { grid-column: 1 / -1; }
.wp-skins .swatch { width: 26px; height: 26px; }
/* Paint: named swatches */
.paints { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.swatch.paint { width: auto; height: 52px; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: 1px; padding: 5px 7px; text-align: left; outline-offset: 0; }
.swatch.paint span { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9); }
.swatch.paint em { font: 10px var(--font-mono); font-style: normal; color: var(--signal); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9); }
.swatch.paint.locked { opacity: 0.55; filter: saturate(0.4); }
.swatch.paint[aria-pressed="true"] { outline: 2px solid var(--signal); outline-offset: 2px; border-color: transparent; }
/* Presets */
.presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.chip.preset { display: grid; grid-template-columns: 16px minmax(0, 1fr); grid-template-rows: auto auto; gap: 2px 8px; text-align: left; padding: 7px 9px; }
.chip.preset i { grid-row: 1 / 3; width: 16px; height: 16px; align-self: center; }
.chip.preset b { font-size: 12.5px; }
.chip.preset small { font-size: 10.5px; font-weight: 500; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.preset[aria-pressed="true"] small { color: rgba(22, 19, 11, 0.75); }
.chip.preset.locked { border-style: dashed; }
/* The pilot: kit and outfits */
.kit-row { padding: 10px 12px; }
.kit-row small { display: block; margin-top: 2px; }
.outfits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.chip.outfit { display: flex; align-items: center; gap: 9px; text-align: left; padding: 6px 9px; }
.chip.outfit i { width: 22px; height: 22px; flex: none; border: 1px solid rgba(0, 0, 0, 0.4); }
.buy-row { padding: 9px 10px; }
.buy-row span b { color: var(--fg); }
@media (max-height: 500px) {
  .hh-row h2 { display: none; }
  .hh-row .salvage { margin-top: 2px; }
  .hh-tabs [role="tab"] { padding: 6px 10px 7px; }
  .hp-mount { padding: 5px 9px; }
  .hp-sub { display: none; }
  .wc-desc { display: none; }
}
@media (max-width: 420px) {
  .hh-tabs { padding: 0 8px; }
  .hh-tabs [role="tab"] { padding-inline: 8px; letter-spacing: 0.08em; }
  .hh-tabs [role="tab"] .mono { display: none; }
  .wc-stat { grid-template-columns: 62px minmax(0, 1fr) 70px 44px; }
  .paints { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- 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: "use crouch lock" "cnn msl salvo" "dash fl jump" ". fire fire";
  grid-template-rows: 44px 64px 64px 64px;
  gap: 8px;
}
#t-use { grid-area: use; }
#t-crouch { grid-area: crouch; }
/* On foot there is nothing to lock and something to duck under (#touch: .tb would show it in the frame) */
#touch .foot-only { display: none; }
body.on-foot #touch .foot-only { display: grid; }
body.on-foot #t-lock { display: none; }
/* (MAP and SUMMON sit in a row with RELOAD, clear of the buttons' top row: the frame's LOCK is there) */
.t-map { position: absolute; top: max(92px, calc(env(safe-area-inset-top, 0px) + 84px)); right: max(104px, calc(env(safe-area-inset-right, 0px) + 88px)); border-color: rgba(199, 125, 255, 0.6); color: #c77dff; }
body.touch #gun-card { pointer-events: auto; }
.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; }
/* AIM toggled on (on foot, a touchscreen): it stays lit */
.tb.on { background: rgba(125, 255, 182, 0.32); border-color: var(--hud); }
.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(92px, calc(env(safe-area-inset-top, 0px) + 84px)); right: max(162px, calc(env(safe-area-inset-right, 0px) + 146px)); 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)); }
.t-core { position: absolute; top: max(92px, calc(env(safe-area-inset-top, 0px) + 84px)); right: max(220px, calc(env(safe-area-inset-right, 0px) + 204px)); border-color: var(--signal); color: #1a1205; background: var(--signal); box-shadow: 0 0 14px rgba(242, 182, 50, 0.7); animation: hotpulse 0.9s ease-in-out infinite; }
.t-core[hidden] { display: none; }
body.on-foot .t-core { display: none; }

/* On a touchscreen the HUD's edges are the safe area alone, and the weapons hang under the unit tag (the buttons have
   the bottom right). --hud-side: how far that list reaches in from the left edge. Centered HUD text stays inside it. */
body.touch #hud { --ex: max(16px, env(safe-area-inset-left, 0px)); --exr: max(16px, env(safe-area-inset-right, 0px)); --hud-side: calc(var(--ex) + 240px * var(--ui) + 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)) / var(--ui)); font-size: 16px; letter-spacing: 0.2em; }
body.touch #boss-bar { width: min(460px, calc((100vw - 2 * var(--hud-side)) / var(--ui))); }
body:not(.touch) .touch-note { display: none; }
body.touch .hud-right { bottom: auto; right: auto; top: calc(var(--et) + 46px * var(--ui)); left: var(--ex); width: 240px; gap: 3px; transform-origin: 0 0; }
/* (on foot the tag has a second line, where the frame is: the guns start under it) */
body.touch.on-foot .hud-right { top: calc(var(--et) + 48px * var(--ui)); }
body.touch .wpn-head { justify-content: flex-start; }
body.touch .hud-right > #gun-card { order: 0; }
body.touch #weapons > .wrow.lead { order: -1; }
body.touch #weapons.compact { justify-content: flex-start; }
body.touch #compass { width: 240px; }
body.touch #killfeed, body.touch #prompt kbd { display: none; }

@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, .frame-card .fc-stats { grid-template-columns: 1fr; }
  .hud-left { width: 180px; }
  .readouts b { font-size: var(--t4); }
  .unit-name { display: none; }
  .score b { font-size: 13px; }
}
/* 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, .frame-card .fc-name { font-size: 17px; }
  .fc-stats, .frame-card .fc-stats { grid-template-columns: 1fr; gap: 2px; }
  .fc-blurb, .frame-card .fc-blurb { display: none; }
  .fc-top { grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px; }
  .fc-glyph { width: 28px; height: 28px; padding: 3px; }
  .fc-lock small { 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 title's neon palette (first drawn for the 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);
  transition: opacity 0.9s ease, filter 0.9s ease;
}
#title {
  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);
}

/* Boot: the power-up gate, over the loading layer, until the title theme can play (js/boot.js). */
#boot { z-index: 70; background: transparent; pointer-events: none; transition-duration: 0.4s; }
#boot-start { pointer-events: auto; padding-block: 0 calc(58px + env(safe-area-inset-bottom, 0px)) !important; }
/* (under the subject, in the right part of the loading layer, clear of the readout and the plate in its left column) */
#boot-start { padding-left: calc(max(28px, env(safe-area-inset-left, 0px)) + min(470px, 40vw) + clamp(20px, 5vw, 72px)) !important; }
#boot.is-leaving { opacity: 0; pointer-events: none; }
#boot .title-prompt {
  padding: 12px 22px 12px calc(22px + 0.5em); background: rgba(5, 5, 7, 0.82); border: 1px solid rgba(255, 226, 61, 0.55);
  box-shadow: 0 0 0 1px rgba(5, 5, 7, 0.6), 0 0 28px rgba(255, 226, 61, 0.16);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}
#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: 1px solid rgba(255, 226, 61, 0.6); outline-offset: 10px; }
/* The start prompt: it breathes, its rules reach out and draw back, and a glint runs along the letters */
.title-prompt {
  display: inline-flex; align-items: center; gap: 16px;
  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.7), 0 0 18px rgba(255, 226, 61, 0.35);
  animation: prompt-breathe 2.6s ease-in-out infinite;
}
.title-prompt > span {
  background: linear-gradient(100deg, var(--vc-yellow) 0 42%, #fffbe0 48%, #ffffff 50%, #fffbe0 52%, var(--vc-yellow) 58% 100%);
  background-size: 300% 100%; background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  text-shadow: none; filter: drop-shadow(0 0 5px rgba(255, 226, 61, 0.5));
  animation: prompt-glint 3.9s cubic-bezier(0.5, 0, 0.3, 1) infinite;
}
.title-prompt i { display: block; width: 28px; height: 2px; background: currentColor; box-shadow: 0 0 8px rgba(255, 226, 61, 0.7); animation: prompt-rule 2.6s ease-in-out infinite; }
.title-prompt i:first-child { transform-origin: right; }
.title-prompt i:last-child { transform-origin: left; }
@keyframes prompt-breathe { 0%, 100% { opacity: 0.62; } 50% { opacity: 1; } }
@keyframes prompt-rule { 0%, 100% { transform: scaleX(0.35); } 50% { transform: scaleX(1); } }
@keyframes prompt-glint { 0%, 55% { background-position: 100% 0; } 100% { background-position: 0 0; } }

#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; }
#title.is-leaving .title-prompt i { animation: none; transform: scaleX(1.6); }
@keyframes title-blink-fast { 50% { opacity: 0.15; } }

/* Top right: how far the game behind the title has got */
.title-sys {
  position: absolute; top: max(18px, env(safe-area-inset-top, 0px)); right: max(22px, env(safe-area-inset-right, 0px));
  display: flex; align-items: center; gap: 10px; pointer-events: none;
  font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; color: #b9bccb;
  padding: 5px 10px; background: rgba(5, 5, 7, 0.55); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
  transition: color 0.6s;
}
.title-sys i { display: block; width: 72px; height: 3px; background: rgba(230, 231, 238, 0.12); }
.title-sys i b { display: block; height: 100%; width: 0; background: var(--vc-purple); box-shadow: 0 0 6px rgba(180, 77, 255, 0.8); transition: width 0.3s; }
.title-sys > b { min-width: 4.6em; font-weight: 400; color: var(--vc-ink); }
.title-sys.ready { color: var(--vc-ink); }
.title-sys.ready i b { background: var(--vc-green); box-shadow: 0 0 6px rgba(61, 255, 122, 0.8); }
.title-sys.ready > b { color: var(--vc-green); }

.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);
}
/* In-world: the alert over the city, with a pulse in the rifts' violet; and the build */
.title-alert { display: inline-flex; align-items: center; gap: 10px; color: var(--vc-ink); }
.title-alert b { width: 7px; height: 7px; background: var(--vc-purple); transform: rotate(45deg); box-shadow: 0 0 8px rgba(180, 77, 255, 0.9); animation: alert-pulse 1.8s ease-in-out infinite; }
@keyframes alert-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.title-build { color: var(--vc-dim); letter-spacing: 0.22em; }

@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)); gap: 6px 12px; }
  .title-build, .title-dashes { display: none; }
  /* (the power-up prompt takes the bottom line from the tip while it is up) */
  #boot-start { padding-block: 0 calc(6px + env(safe-area-inset-bottom, 0px)) !important; }
  body:has(#boot-start:not([hidden])) .ld-tip { visibility: hidden; }
  .title-sys { top: max(10px, env(safe-area-inset-top, 0px)); font-size: 10px; }
}

/* 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-prompt > span, .title-prompt i, #title.is-leaving .title-prompt, .rotate-phone, .title-alert b { animation: none; }
  .title-prompt i { transform: none; }
  .ld-stages li.on .name::after, .ld-tip.turn span { animation: none; }
}

/* The run won: the card's red turns to the HUD's green */
#gameover.won { background: radial-gradient(ellipse at center, rgba(10, 60, 36, 0.35), rgba(13, 15, 18, 0.88)); }
#gameover.won .over-card .stripe { background: repeating-linear-gradient(135deg, var(--hud) 0 12px, #1b1c1f 12px 24px); }
#gameover.won .over-card .eyebrow { color: var(--hud); }
/* The run's summary: the outcome over four figures, where the salvage came from, how far the run went */
.over-card {
  width: min(560px, 100%); gap: 13px; padding: 20px 22px 22px;
  background: linear-gradient(180deg, rgba(30, 20, 22, 0.94), rgba(13, 15, 18, 0.94) 45%);
  border-top: 2px solid var(--alert); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
  animation: over-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes over-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
.over-card h2 { font-size: clamp(32px, 6vw, 50px); line-height: 1; text-shadow: 0 2px 18px rgba(224, 57, 47, 0.25); }
.over-stats { gap: 5px; }
.over-stats > div { padding: 9px 11px 8px; background: rgba(255, 255, 255, 0.045); border-top: 1px solid rgba(255, 255, 255, 0.08); }
.over-stats b { font-size: 30px; line-height: 1.05; }
.over-stats .label { font-size: 10px; }
.over-detail { display: grid; gap: 7px; padding-top: 2px; }
.od-head { display: flex; justify-content: space-between; align-items: baseline; }
.od-head .label { font-size: 10px; text-transform: uppercase; color: var(--signal); }
.od-head .mono { font-size: 11px; letter-spacing: 0.08em; color: var(--dim); }
.od-bar { display: flex; gap: 2px; height: 10px; }
.od-bar i { flex: 1 1 0; min-width: 4px; }
.od-bar i.k, .od-legend .k u { background: var(--hud); }
.od-bar i.r, .od-legend .r u { background: #c77dff; }
.od-bar i.b, .od-legend .b u { background: var(--alert); }
.od-bar i.w, .od-legend .w u { background: var(--signal); }
.od-bar i.e, .od-legend .e u { background: #ff8a3d; }
.od-bar i.none { background: rgba(255, 255, 255, 0.08); }
.od-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.od-legend span { display: inline-flex; align-items: center; gap: 6px; }
.od-legend u { width: 8px; height: 8px; }
.od-legend b { font-weight: 400; color: var(--fg); }
.od-legend .zero { opacity: 0.45; }
.od-run { display: flex; flex-wrap: wrap; gap: 4px 18px; padding-top: 7px; border-top: 1px solid var(--line); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.od-run b { font-weight: 400; color: var(--fg); }
.od-earned { display: grid; gap: 5px; }
.od-earned div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 12px; background: linear-gradient(90deg, rgba(242, 182, 50, 0.2), rgba(242, 182, 50, 0.05)); border-left: 3px solid var(--signal); }
.od-earned .label { color: var(--signal); font-size: 10px; }
.od-earned b { font-size: 16px; letter-spacing: 0.08em; text-transform: uppercase; }
#gameover.won .over-card { border-top-color: var(--hud); background: linear-gradient(180deg, rgba(16, 34, 26, 0.94), rgba(13, 15, 18, 0.94) 45%); }
#gameover.won .over-card h2 { text-shadow: 0 2px 18px rgba(125, 255, 182, 0.25); }
@media (max-height: 500px) {
  .over-card { gap: 8px; padding: 12px 16px 14px; }
  .over-card h2 { font-size: 28px; }
  .over-stats b { font-size: 22px; }
  .od-run { display: none; }
}
@media (prefers-reduced-motion: reduce) { .over-card { animation: none; } }

/* Field events (js/events.js): the card under the compass, and the marker over the place */
.fe-card {
  /* (under the compass, in the boss bar's place; below it while a boss is up; at the HUD's scale) */
  position: absolute; top: calc(var(--et, 12px) + 58px * var(--ui, 1)); left: 50%; translate: -50% 0; transform-origin: 50% 0; scale: var(--ui, 1);
  width: min(340px, calc((100vw - 32px) / var(--ui, 1)));
  padding: 7px 12px 8px; display: grid; gap: 4px; background: var(--glass, var(--panel)); border-left: 2px solid var(--signal); box-shadow: var(--hair, none);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%); pointer-events: none;
  animation: fe-in 0.35s ease-out both;
}
#boss-bar:not([hidden]) ~ .fe-card { top: calc(var(--et, 12px) + 94px * var(--ui, 1)); }
.fe-card[hidden] { display: none; }
.fe-card[data-kind="convoy"] { border-left-color: var(--hud); }
.fe-head { display: flex; align-items: baseline; gap: 8px; }
.fe-icon { width: 9px; height: 9px; transform: rotate(45deg); background: var(--signal); box-shadow: 0 0 8px rgba(242, 182, 50, 0.8); align-self: center; }
.fe-card[data-kind="convoy"] .fe-icon { background: var(--hud); box-shadow: 0 0 8px rgba(125, 255, 182, 0.8); }
.fe-title { font-size: var(--t3, 13px); letter-spacing: 0.16em; font-weight: 700; color: var(--fg); }
.fe-dist { margin-left: auto; font-size: var(--t3, 12px); color: var(--signal); }
.fe-card[data-kind="convoy"] .fe-dist { color: var(--hud); }
.fe-sub { font-size: var(--t2, 11px); letter-spacing: 0.1em; color: var(--dim); }
.fe-bar { height: 3px; background: rgba(236, 232, 223, 0.12); }
.fe-bar b { display: block; height: 100%; background: var(--signal); transition: width 0.2s linear; }
.fe-card[data-kind="convoy"] .fe-bar b { background: var(--hud); }
.fe-card.low .fe-bar b { background: var(--alert); }
.fe-card.low .fe-sub { color: var(--alert); }
.fe-mark { position: absolute; left: 0; top: 0; display: grid; justify-items: center; gap: 4px; pointer-events: none; }
.fe-mark > * { transform: translate(-50%, -100%); }
.fe-mark i { width: 12px; height: 12px; border: 2px solid var(--signal); background: rgba(242, 182, 50, 0.25); transform: translate(-50%, -100%) rotate(45deg); box-shadow: 0 0 10px rgba(242, 182, 50, 0.75); }
.fe-mark span { font-size: var(--t2, 11px); padding: 1px 6px; color: var(--fg); background: var(--glass, rgba(13, 15, 18, 0.7)); white-space: nowrap; }
/* (round 3) An elite hunt in the alert red with a gold name, an evacuation in the allies' green with a cross, a downed
   Kestrel in a flare orange with a warning triangle; the marker over each in its card's color */
.fe-card[data-kind="elite"] { border-left-color: var(--alert); }
.fe-card[data-kind="elite"] .fe-icon { background: var(--alert); box-shadow: 0 0 8px rgba(224, 57, 47, 0.85); }
.fe-card[data-kind="elite"] .fe-dist { color: #ff7a6b; }
.fe-card[data-kind="elite"] .fe-bar b { background: var(--alert); }
.fe-card[data-kind="evac"] { border-left-color: var(--hud); }
.fe-card[data-kind="evac"] .fe-icon { transform: none; background: var(--hud); clip-path: polygon(35% 0, 65% 0, 65% 35%, 100% 35%, 100% 65%, 65% 65%, 65% 100%, 35% 100%, 35% 65%, 0 65%, 0 35%, 35% 35%); box-shadow: none; filter: drop-shadow(0 0 4px rgba(125, 255, 182, 0.9)); }
.fe-card[data-kind="evac"] .fe-dist { color: var(--hud); }
.fe-card[data-kind="evac"] .fe-bar b { background: var(--hud); }
.fe-card[data-kind="downed"] { border-left-color: #ff6a3a; }
.fe-card[data-kind="downed"] .fe-icon { transform: none; width: 11px; background: #ff6a3a; clip-path: polygon(50% 0, 100% 100%, 0 100%); box-shadow: none; filter: drop-shadow(0 0 4px rgba(255, 106, 58, 0.9)); }
.fe-card[data-kind="downed"] .fe-dist { color: #ff8a5c; }
.fe-card[data-kind="downed"] .fe-bar b { background: #ff6a3a; }
.fe-card.low[data-kind] .fe-bar b { background: var(--alert); }
.fe-mark[data-kind="convoy"] i, .fe-mark[data-kind="evac"] i { border-color: var(--hud); background: rgba(125, 255, 182, 0.22); box-shadow: 0 0 10px rgba(125, 255, 182, 0.7); }
.fe-mark[data-kind="elite"] i { border-color: var(--alert); background: rgba(224, 57, 47, 0.28); box-shadow: 0 0 10px rgba(224, 57, 47, 0.8); }
.fe-mark[data-kind="elite"] span { color: #ffd27a; }
.fe-mark[data-kind="downed"] i { border-color: #ff6a3a; background: rgba(255, 106, 58, 0.25); box-shadow: 0 0 10px rgba(255, 106, 58, 0.8); }
/* An elite's nameplate over its back: its name in gold, what it is, and its armor */
.fe-plate { position: absolute; left: 0; top: 0; pointer-events: none; }
.fe-plate > div { translate: -50% -100%; scale: var(--ui, 1); transform-origin: 50% 100%; display: grid; justify-items: center; gap: 3px; min-width: 128px; padding: 3px 9px 5px; background: var(--glass, rgba(13, 15, 18, 0.7)); border-top: 2px solid var(--alert); }
.fe-plate b { font-size: var(--t3, 12px); letter-spacing: 0.18em; color: #ffd27a; text-shadow: 0 0 6px rgba(255, 170, 60, 0.55); white-space: nowrap; }
.fe-plate span { font-size: var(--t1, 9px); letter-spacing: 0.22em; color: var(--dim); white-space: nowrap; }
.fe-plate i { display: block; width: 116px; height: 3px; background: rgba(236, 232, 223, 0.14); }
.fe-plate u { display: block; height: 100%; width: 100%; background: var(--alert); box-shadow: 0 0 6px rgba(224, 57, 47, 0.7); transition: width 0.15s linear; }
#hud.mapping .fe-card, #hud.mapping .fe-mark, #hud.mapping .fe-plate { visibility: hidden; }
@keyframes fe-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (max-height: 500px) { .fe-card { width: min(300px, calc((100vw - 32px) / var(--ui, 1))); } .fe-sub { font-size: 10px; } }
@media (prefers-reduced-motion: reduce) { .fe-card { animation: none; } }

/* Sandbox lane ----------------------------------------------------------------------------------------------------
   The toolbox (B; js/toolbox.js, rows from js/ui.js SbxToolsPanel): the summon menu's panel at the right; the HUD's
   status chips; the pause hangar's row for photo mode and the toolbox; photo mode (P; js/photo.js): its panel at the
   left, the framing guides and crop over the view, the shutter. */

/* The toolbox: the summon menu's look (#summon), from the right */
#sbx-tools {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 42;
  width: min(420px, 100%);
  background: rgba(21, 24, 29, 0.95);
  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);
}
.sbx-status {
  display: flex; align-items: center; gap: 9px; min-height: 30px; padding: 6px 16px;
  font-size: 11px; letter-spacing: 0.14em; color: var(--hud); border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(125, 255, 182, 0.08), transparent 70%);
}
.sbx-status i { flex: none; width: 8px; height: 8px; border: 1.5px solid currentColor; rotate: 45deg; box-shadow: 0 0 6px currentColor; }
.sbx-status span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sbx-status.bld { color: var(--signal); background: linear-gradient(90deg, rgba(242, 182, 50, 0.1), transparent 70%); }
.sbx-status.warn { color: #ff8a7a; background: linear-gradient(90deg, rgba(224, 57, 47, 0.12), transparent 70%); }
.sbx-group h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.sbx-group h3 .mono { font-size: 10px; letter-spacing: 0.12em; color: var(--dim); font-weight: 400; }
/* A tool: what it is and does, how many, its button. The summon menu's row and button (.srow, .btn-summon), with a line
   under the name, in classes of the toolbox's own */
.sbx-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 92px 30px 76px; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.03); border-left: 3px solid var(--hud-dim); padding: 7px 8px 7px 10px;
}
.sbx-row.cooling { border-left-color: var(--alert); }
.sbx-row.sbx-solo { grid-template-columns: minmax(0, 1fr) 76px; }
.sbx-row.sbx-extra { grid-template-areas: "txt txt txt btn" "step range out ."; row-gap: 6px; }
.sbx-row input[type="range"] { width: 100%; min-width: 0; margin: 0; accent-color: var(--signal); }
.sbx-row output { font-size: 16px; text-align: right; }
.sbx-extra .sbx-txt { grid-area: txt; }
.sbx-extra .sbx-step { grid-area: step; }
.sbx-extra input[type="range"] { grid-area: range; }
.sbx-extra output { grid-area: out; }
.sbx-extra .sbx-go { grid-area: btn; }
.sbx-txt { display: grid; gap: 2px; min-width: 0; }
.sbx-txt .srow-name { font-size: 14px; }
.sbx-txt small { font-size: 11px; line-height: 1.3; color: var(--dim); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sbx-go {
  border: 1px solid var(--signal); background: rgba(242, 182, 50, 0.14); color: var(--signal);
  padding: 7px 4px; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
}
.sbx-go:hover:not(:disabled) { background: var(--signal); color: #16130b; }
/* (Recall, while an escort flies) */
.sbx-go.queued { background: var(--hud); border-color: var(--hud); color: #0c1a12; }
.sbx-go: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; }
.sbx-step { display: grid; grid-template-columns: 22px minmax(0, 1fr) 22px; align-items: center; gap: 4px; min-width: 0; }
.sbx-step-name { font-size: 12px; letter-spacing: 0.08em; text-align: center; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sbx-step-btn { height: 24px; padding: 0; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); color: var(--signal); font: 700 15px var(--font-display); line-height: 1; }
.sbx-step-btn:hover { background: rgba(242, 182, 50, 0.16); }
/* The world's switches: the hangar's settings rows, tighter */
.sbx-switch { padding: 3px 0 3px 10px; border-left: 3px solid var(--hud-dim); background: rgba(255, 255, 255, 0.02); font-size: 13px; }
.sbx-switch .chip { padding: 4px 8px; font-size: 11.5px; }
.sbx-switch .toggle { padding: 4px 10px; min-width: 54px; }
/* Skies lane: the toolbox's Sky row, in the switches' look (a class of its own: it is the sky's state, not a switch's) */
.sky-switch { padding: 3px 0 3px 10px; border-left: 3px solid var(--hud-dim); background: rgba(255, 255, 255, 0.02); font-size: 13px; }
.sky-switch .chip { padding: 4px 8px; font-size: 11.5px; }
/* (and wherever a Sky row stands: its six or seven chips wrap under the label) */
.sky-row .chips { gap: 4px; }
/* The briefing's Sky chip, at the end of its actions */
.sky-brief { margin-left: auto; white-space: nowrap; }
.sky-brief span { margin-right: 7px; font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); }
#sbx-tools .summon-body { gap: 14px; }

/* The HUD: TOOLS under the unit tag (the sandbox has no objectives there), the chips under it; on a touchscreen a
   chip beside HANGAR */
#sbx-btn-tools { position: absolute; left: var(--ex); top: calc(var(--et) + 50px * var(--ui)); transform-origin: 0 0; scale: var(--ui); pointer-events: auto; }
/* (js/ui.js moves it into the top right's buttons: .hud-btns #sbx-btn-tools) */
#sbx-btn-tools[hidden], body.touch #sbx-btn-tools { display: none; }
#hud.mapping #sbx-btn-tools { visibility: hidden; }
/* (in the top row, left of HANGAR: the row under it is full, and the round buttons start just below that) */
.sbx-t-tools { position: absolute; top: max(52px, calc(env(safe-area-inset-top, 0px) + 44px)); right: max(100px, calc(env(safe-area-inset-right, 0px) + 84px)); border-color: rgba(242, 182, 50, 0.6); color: var(--signal); }
.sbx-t-tools[hidden] { display: none; }

/* What the sandbox has switched on: chips under the unit tag (the invasion's objectives' place; the sandbox has none) */
#sbx-chips {
  position: absolute; left: var(--ex); top: calc(var(--et) + 50px * var(--ui));
  display: flex; flex-wrap: wrap; gap: 4px; width: 360px; transform-origin: 0 0; scale: var(--ui);
}
#sbx-chips:empty { display: none; }
.sbx-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 6px;
  font: var(--t2) var(--font-mono); letter-spacing: 0.12em; color: var(--fg); white-space: nowrap;
  background: var(--glass); border-left: 2px solid var(--signal); box-shadow: var(--hair);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%);
  animation: sbx-chip-in 0.22s ease-out;
}
.sbx-chip i { width: 6px; height: 6px; background: var(--signal); rotate: 45deg; }
.sbx-chip.warn { border-left-color: #ffd166; }
.sbx-chip.warn i { background: #ffd166; }
.sbx-chip.hot { border-left-color: var(--hot); color: #ffd2cc; }
.sbx-chip.hot i { background: var(--hot); animation: hotpulse 0.6s ease-in-out infinite; }
.sbx-chip.ally { border-left-color: var(--hud); }
.sbx-chip.ally i { background: var(--hud); }
@keyframes sbx-chip-in { from { opacity: 0; translate: -6px 0; } }
#hud.mapping #sbx-chips { visibility: hidden; }
/* (a touchscreen has the weapons under the unit tag and buttons down the right: the chips sit at the bottom, between
   the vitals and FIRE) */
body.touch #sbx-chips { left: 50%; top: auto; bottom: var(--eb); translate: -50% 0; transform-origin: 50% 100%; width: 300px; justify-content: center; flex-wrap: wrap-reverse; }

/* The pause hangar: photo mode and the toolbox, under the title (inside #hangar, where the menus' gamepad reaches) */
/* (under Launch, at the right: a pad's down from Launch lands in it, and down again on the tabs) */
.sbx-hangar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; padding: 0 16px 10px; }
.sbx-hangar .chip-btn { cursor: pointer; border-color: rgba(242, 182, 50, 0.45); }
.sbx-hangar .chip-btn:hover { background: rgba(242, 182, 50, 0.14); }
.sbx-hangar .chip-btn[hidden] { display: none; }
body.touch .sbx-hangar kbd { display: none; }

/* Photo mode: the world held, the guides over it, the panel at the left */
#sbx-photo { position: fixed; inset: 0; z-index: 44; pointer-events: none; }
.sbx-guides { position: absolute; inset: 0; width: 100%; height: 100%; }
.sbx-guides .mask { fill: rgba(5, 6, 8, 0.66); }
.sbx-guides .edge { fill: none; stroke: rgba(236, 232, 223, 0.35); stroke-width: 1; }
.sbx-guides .guide { fill: none; stroke: rgba(236, 232, 223, 0.42); stroke-width: 1; }
.sbx-guides .dots circle { fill: rgba(242, 182, 50, 0.85); }
.sbx-guides .dots .ring { fill: none; stroke: rgba(236, 232, 223, 0.5); }
.sbx-guides .corner { fill: none; stroke: rgba(236, 232, 223, 0.8); stroke-width: 2; }
.sbx-photo-panel {
  position: absolute; top: 0; left: 0; bottom: 0; width: min(340px, 46vw); pointer-events: auto;
  background: rgba(21, 24, 29, 0.93); 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);
}
.sbx-photo-panel .summon-body { gap: 12px; }
.sbx-photo-panel .settings-row { font-size: 13px; }
.sbx-photo-panel .hh-row h2 { font-size: 24px; white-space: nowrap; }
.sbx-photo-panel .hh-row .btn { white-space: nowrap; padding-inline: 12px; }
/* A slider on one line: its name and value, then the slider */
.sbx-slider { display: grid; grid-template-columns: minmax(0, 1fr) 128px; align-items: center; gap: 10px; min-height: 24px; }
.sbx-slider label { display: flex; justify-content: space-between; gap: 8px; color: #d6d2c8; white-space: nowrap; }
.sbx-slider label .mono { color: var(--signal); }
.sbx-slider input[type="range"] { width: 100%; margin: 0; accent-color: var(--signal); }
.sbx-wrap { flex-wrap: wrap; align-items: flex-start; }
.sbx-wrap .chips { flex-wrap: wrap; justify-content: flex-start; }
.sbx-wrap > span { flex: 0 0 100%; }
.sbx-reset { justify-self: start; display: inline-flex; gap: 8px; align-items: center; }
.sbx-reset kbd { font-size: 10px; }
.sbx-photo-foot { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
.sbx-photo-foot .btn { display: flex; justify-content: center; gap: 10px; align-items: center; white-space: nowrap; }
.sbx-photo-foot .btn.primary kbd { color: #16130b; border-color: rgba(22, 19, 11, 0.4); background: rgba(22, 19, 11, 0.08); }
.sbx-photo-foot #sbx-photo-hide { padding-inline: 12px; }
/* The panel hidden: its way back, and the shutter, at the bottom right */
.sbx-photo-bare { display: none; position: absolute; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); gap: 8px; pointer-events: auto; }
#sbx-photo.bare .sbx-photo-bare { display: flex; }
.sbx-photo-bare .chip-btn { cursor: pointer; }
#sbx-photo-shot2 { border-color: var(--signal); color: var(--signal); }
body.touch .sbx-photo-panel kbd, body.touch .sbx-reset kbd, body.touch .sbx-photo-bare kbd, body.touch #sbx-tools-close kbd { display: none; }
.sbx-photo-keys {
  position: absolute; left: calc(min(340px, 46vw) + 50% - min(340px, 46vw) / 2); bottom: max(14px, env(safe-area-inset-bottom, 0px)); translate: -50% 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; max-width: calc(100vw - min(340px, 46vw) - 32px);
  padding: 5px 12px; font-size: 11px; color: var(--dim); background: var(--panel); clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.sbx-photo-keys span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.sbx-photo-keys kbd { font-size: 10px; padding: 0 5px; margin: 0; }
.sbx-photo-keys:empty { display: none; }
.sbx-photo-flash { position: absolute; inset: 0; background: #fff; opacity: 0; }
.sbx-photo-toast {
  position: absolute; left: calc(min(340px, 46vw) + 50% - min(340px, 46vw) / 2); top: max(18px, env(safe-area-inset-top, 0px)); translate: -50% -6px;
  padding: 7px 14px; font-size: 12px; letter-spacing: 0.12em; color: var(--fg); white-space: nowrap; opacity: 0;
  background: var(--panel); border-left: 2px solid var(--hud); transition: opacity 0.4s, translate 0.4s;
}
.sbx-photo-toast.on { opacity: 1; translate: -50% 0; transition: none; }
/* H: the panel and the keys gone, only the view and the guides */
#sbx-photo.bare .sbx-photo-panel, #sbx-photo.bare .sbx-photo-keys { display: none; }
#sbx-photo.bare .sbx-photo-toast, #sbx-photo.bare .sbx-photo-keys { left: 50%; }

@media (max-width: 720px) and (orientation: portrait) {
  #sbx-tools { top: auto; height: 62%; width: 100%; border-left: 0; border-top: 1px solid var(--line); }
  .sbx-photo-panel { top: auto; height: 50%; width: 100%; border-right: 0; border-top: 1px solid var(--line); }
  .sbx-photo-keys, .sbx-photo-toast { left: 50%; max-width: calc(100vw - 32px); }
}
@media (max-height: 500px) {
  .sbx-status { min-height: 24px; padding-block: 3px; }
  .sbx-row { padding-block: 4px; }
  .sbx-txt small { -webkit-line-clamp: 1; }
  .sbx-photo-keys { display: none; }
  /* (the panels' titles go on short screens, as the hangar's do: photo mode keeps its name and drops the line over it) */
  .sbx-photo-panel .hh-row h2 { display: block; font-size: 18px; margin: 0; }
  .sbx-photo-panel .hh-row .eyebrow { display: none; }
}
@media (prefers-reduced-motion: reduce) { .sbx-chip, .sbx-chip.hot i { animation: none; } }

/* ---------- progression: the hangar's Upgrades tab, the run's goals (js/upgrades.js) ---------- */
/* Five tabs in the hangar's width: set closer (the first label lines up with the title), on a narrow sheet without
   their numbers, scrolling only as a last resort */
.hh-tabs { padding: 0 10px; overflow-x: auto; scrollbar-width: none; }
.hh-tabs::-webkit-scrollbar { display: none; }
.hh-tabs [role="tab"] { flex: none; padding-inline: 6px; gap: 4px; font-size: 12px; letter-spacing: 0.065em; }
.hh-tabs [role="tab"] .mono { font-size: 9px; }
.hh-tabs [role="tab"]::after { left: 6px; right: 6px; }
@media (min-width: 1700px) { .hh-tabs [role="tab"] { padding-inline: 8px; font-size: 12.5px; letter-spacing: 0.08em; } .hh-tabs [role="tab"]::after { left: 8px; right: 8px; } }
@media (max-width: 520px) { .hh-tabs [role="tab"] .mono { display: none; } }
@media (max-width: 400px) { .hh-tabs [role="tab"] { font-size: 11px; letter-spacing: 0.04em; } }
/* A card a track: its tiers as pips, what the next does against what runs, the Buy */
.up-lede { margin: -2px 0 2px; font-size: 12.5px; line-height: 1.45; color: #b9b5ab; }
.up-list { display: grid; gap: 8px; }
/* The frame as it runs, in a line (like the hardpoints' sum): what the tiers changed is lit */
.up-sum { display: flex; flex-wrap: wrap; gap: 3px 14px; padding: 7px 10px; background: rgba(255, 255, 255, 0.03); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.up-sum b { font-weight: 400; color: var(--fg); }
.up-sum .mod b { color: var(--signal); }
.up-card {
  display: grid; gap: 7px; padding: 10px 12px 11px;
  background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); border-left: 3px solid var(--line);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
}
.up-card.on { border-left-color: var(--signal); background: linear-gradient(90deg, rgba(242, 182, 50, 0.08), rgba(0, 0, 0, 0.22) 55%); }
.up-card.maxed { border-left-color: var(--hud); }
.up-card.fresh { animation: up-fresh 0.7s ease-out; }
@keyframes up-fresh { from { background: rgba(242, 182, 50, 0.28); } }
.up-head { display: flex; align-items: center; gap: 10px; }
.up-glyph { width: 22px; height: 22px; flex: none; fill: none; stroke: var(--dim); stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; }
.up-card.on .up-glyph { stroke: var(--signal); filter: drop-shadow(0 0 4px rgba(242, 182, 50, 0.45)); }
.up-name { display: grid; gap: 1px; min-width: 0; }
.up-name b { font-size: 14px; letter-spacing: 0.06em; white-space: nowrap; }
.up-name .mono { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); white-space: nowrap; }
.up-pips { margin-left: auto; display: flex; gap: 4px; flex: none; }
.up-pip {
  min-width: 30px; height: 21px; padding: 0 6px; transform: skewX(-12deg);
  border: 1px dashed rgba(236, 232, 223, 0.3); background: transparent; color: var(--dim);
  font: 10.5px var(--font-mono); letter-spacing: 0.06em;
}
.up-pip:hover { background: rgba(255, 255, 255, 0.08); }
.up-pip.own { border-style: solid; border-color: rgba(125, 255, 182, 0.6); color: var(--hud); }
.up-pip.use { background: var(--signal); border-color: var(--signal); color: #16130b; }
.up-pip.top { box-shadow: 0 0 9px rgba(242, 182, 50, 0.6); }
.up-pip:focus-visible, html.pad-nav .up-pip:focus { outline: 2px solid var(--fg); outline-offset: 1px; }
.up-desc { margin: 0; font-size: 12px; line-height: 1.4; color: #a9a59b; }
.up-stats { display: grid; gap: 3px; }
.up-cols, .up-stat { display: grid; grid-template-columns: 78px minmax(0, 1fr) 10px minmax(0, 1fr) 82px; align-items: baseline; gap: 6px; }
.up-cols { font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }
.up-cols span:nth-child(2), .up-cols span:nth-child(4) { text-align: right; }
.up-cols span:nth-child(4) { color: var(--signal); }
.up-stat .label { font-size: 10px; text-transform: uppercase; }
.up-stat .mono { font-size: 12.5px; text-align: right; white-space: nowrap; color: #c9c5bb; }
.up-stat .b.good { color: var(--fg); }
.up-stat .b.bad { color: #e6b3ad; }
.up-stat i { font-style: normal; color: var(--dim); text-align: center; }
.up-stat em { font: 11px var(--font-mono); font-style: normal; white-space: nowrap; text-align: right; }
.up-stat em.up { color: var(--hud); }
.up-stat em.down { color: #ff6a5e; }
.up-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; padding-top: 6px; border-top: 1px solid rgba(236, 232, 223, 0.08); }
.up-state { font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.up-state.own { color: var(--hud); }
.up-state.short { color: #d6d2c8; }
.up-buy { padding: 6px 12px; font-size: 12px; white-space: nowrap; }
.up-buy:disabled, .up-buy.wait { opacity: 0.5; cursor: default; }
body.touch .up-pip { min-width: 40px; height: 36px; }
.up-pilot .up-card.on { border-left-color: var(--hud); background: linear-gradient(90deg, rgba(125, 255, 182, 0.06), rgba(0, 0, 0, 0.22) 55%); }
.up-pilot .up-card.on .up-glyph { stroke: var(--hud); filter: drop-shadow(0 0 4px rgba(125, 255, 182, 0.4)); }
@media (max-width: 420px) {
  .up-cols, .up-stat { grid-template-columns: 64px minmax(0, 1fr) 8px minmax(0, 1fr) 66px; gap: 4px; }
  .up-stat .mono { font-size: 11.5px; }
  .up-desc { display: none; }
}
@media (prefers-reduced-motion: reduce) { .up-card.fresh { animation: none; } }

/* The briefing's goals: three cells under the pilot's record */
.intro-goals {
  display: flex; align-items: stretch;
  background: linear-gradient(90deg, rgba(13, 15, 18, 0.88), rgba(13, 15, 18, 0.7)); border: 1px solid var(--line); border-left: 3px solid var(--signal);
}
.intro-goals .ig-title { display: grid; place-items: center; padding: 0 12px; font: 600 10px var(--font-display); letter-spacing: 0.2em; text-transform: uppercase; color: var(--signal); writing-mode: vertical-rl; transform: rotate(180deg); border-left: 1px solid var(--line); }
.ig-goal { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 8px 12px 8px; border-left: 1px solid var(--line); }
.ig-goal:first-of-type { border-left: 0; }
.ig-top, .ig-foot { display: flex; justify-content: space-between; gap: 8px; }
.ig-grade { font-size: 9.5px; letter-spacing: 0.18em; text-transform: uppercase; }
.ig-goal.easy .ig-grade { color: var(--hud); }
.ig-goal.medium .ig-grade { color: var(--signal); }
.ig-goal.hard .ig-grade { color: #ff6a5e; }
.ig-pay { font-size: 11px; color: var(--signal); }
.ig-goal b { flex: 1; font-size: 12.5px; font-weight: 600; line-height: 1.25; letter-spacing: 0.02em; }
.ig-bar { display: block; height: 3px; background: rgba(236, 232, 223, 0.12); }
.ig-bar u { display: block; height: 100%; background: var(--fg); }
.ig-goal.easy .ig-bar u { background: var(--hud); }
.ig-goal.medium .ig-bar u { background: var(--signal); }
.ig-goal.hard .ig-bar u { background: #ff6a5e; }
.ig-foot { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.ig-goal.done b { color: var(--hud); }
@media (max-width: 720px) { .intro-goals .ig-title { display: none; } }
@media (max-width: 520px) { .intro-goals { flex-direction: column; } .ig-goal { border-left: 0; border-top: 1px solid var(--line); } .ig-goal:first-of-type { border-top: 0; } }
@media (max-height: 500px) { .ig-goal { padding: 5px 10px; gap: 3px; } .ig-goal b { font-size: 11.5px; } }
@media (max-height: 420px) { .intro-card .intro-goals { order: 2; } }

/* The results card's goals: each as the run left it, the run's part of the bar bright, what it paid */
.od-bar i.g, .od-legend .g u { background: var(--fg); }
.od-goals { display: grid; gap: 6px; padding-top: 7px; border-top: 1px solid var(--line); }
.og { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto 86px; grid-template-areas: "g t c s" "g bar c s"; column-gap: 10px; row-gap: 3px; align-items: center; }
.og .og-grade { grid-area: g; font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; }
.og.easy .og-grade { color: var(--hud); }
.og.medium .og-grade { color: var(--signal); }
.og.hard .og-grade { color: #ff6a5e; }
.og b { grid-area: t; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.og.done b { color: var(--hud); }
.og i { grid-area: bar; position: relative; height: 3px; background: rgba(236, 232, 223, 0.12); }
.og i u, .og i s { position: absolute; top: 0; bottom: 0; }
.og i u { left: 0; background: rgba(236, 232, 223, 0.42); }
.og i s { background: var(--hud); box-shadow: 0 0 6px rgba(125, 255, 182, 0.6); }
.og .og-n { grid-area: c; font-size: 11px; color: var(--fg); white-space: nowrap; }
.og em { grid-area: s; justify-self: end; font: 13px var(--font-mono); font-style: normal; color: var(--hud); white-space: nowrap; }
.og em.dim, .og em.out { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.og em.out { color: #ff8a7f; }
@media (max-height: 500px) { .og i { display: none; } .og { grid-template-areas: "g t c s"; } }
@media (max-width: 520px) { .og { grid-template-columns: 50px minmax(0, 1fr) auto 64px; column-gap: 8px; } .og b { white-space: normal; line-height: 1.2; } }
