/* ==========================================================================
   VOID SOVEREIGN — page shell
   Canvas stage, the game shell (title / setup / briefing / loading / pause /
   end of match), the fatal card and the exit link. Owned by index.html and
   src/ui/shell.js. The HUD's own styling lives in hud.css and layers on top.

   Same language as the HUD and nothing new: near-black void, hairlines, mono
   for every label and numeral, Inter for prose, radius zero everywhere, and
   colour only from cyan (us), amber (them) and red (trouble).
   ========================================================================== */

:root {
  --vs-void: #04070c;
  --vs-ink: #dfe8f2;
  --vs-dim: rgba(223, 232, 242, 0.52);
  --vs-faint: rgba(223, 232, 242, 0.16);
  --vs-hair: rgba(223, 232, 242, 0.1);
  --vs-cyan: #7fd8e8;
  --vs-amber: #e8a44a;
  --vs-red: #ff6b4a;
  --vs-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --vs-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --vs-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--vs-void);
  color: var(--vs-ink);
  font-family: var(--vs-sans);
  -webkit-font-smoothing: antialiased;
}

body.vs-body {
  position: fixed;
  inset: 0;
  overscroll-behavior: none;
  touch-action: none;
}

.vs-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
}

#vs-canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  cursor: crosshair;
}

/* What a right-click will do, set by core/input.js. Drawn as inline SVG so
   the zero-binary rule holds; the crosshair stays as the fallback. */
#vs-canvas.is-move {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cg fill='none' stroke-width='2'%3E%3Cpath d='M5 9 L12 3 L19 9 M5 15 L12 9 L19 15' stroke='%2302060b' stroke-width='4'/%3E%3Cpath d='M5 9 L12 3 L19 9 M5 15 L12 9 L19 15' stroke='%237fd8e8'/%3E%3Ccircle cx='12' cy='20' r='1.6' fill='%237fd8e8'/%3E%3C/g%3E%3C/svg%3E") 12 20, crosshair;
}

#vs-canvas.is-attack {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cg fill='none'%3E%3Ccircle cx='12' cy='12' r='7' stroke='%2302060b' stroke-width='4'/%3E%3Ccircle cx='12' cy='12' r='7' stroke='%23ff6b4a' stroke-width='2'/%3E%3Cpath d='M12 1 V7 M12 17 V23 M1 12 H7 M17 12 H23' stroke='%2302060b' stroke-width='4'/%3E%3Cpath d='M12 1 V7 M12 17 V23 M1 12 H7 M17 12 H23' stroke='%23ff6b4a' stroke-width='2'/%3E%3C/g%3E%3C/svg%3E") 12 12, crosshair;
}

/* The HUD container must not eat pointer events by default — individual
   controls inside it opt back in. */
.vs-hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  user-select: none;
}

/* `inert` is how the shell takes the HUD and the canvas out of the tab order
   and the accessibility tree while a menu is up. Belt and braces on pointers
   for the browsers that support the attribute but not its pointer behaviour. */
[inert] {
  pointer-events: none;
  user-select: none;
}

/* ==================================================================== shell */

.vs-shell {
  position: absolute;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}

/* `safe center` rather than `center`: a briefing taller than a 720p viewport
   must scroll from its top edge, not be clipped equally at both ends, which is
   what plain centring in a scroll container does. */
.vs-screen {
  position: absolute;
  inset: 0;
  display: grid;
  align-items: safe center;
  justify-items: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6vmin max(1.6rem, 5vmin);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 260ms var(--vs-ease), visibility 0s linear 260ms;
}

.vs-screen.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 260ms var(--vs-ease), visibility 0s;
}

/* ==================================================== front-matter backdrop
   The generated frame behind title, setup, briefing and loading. See the note
   on the markup in index.html for why it exists and why it is authored rather
   than fetched. It is opaque, so it is what the front-matter screens sit on;
   they carry only a soft directional wash of their own to hold their type. */

.vs-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--vs-void);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 320ms var(--vs-ease), visibility 0s linear 320ms;
}

.vs-shell[data-state='title'] .vs-art,
.vs-shell[data-state='setup'] .vs-art,
.vs-shell[data-state='briefing'] .vs-art,
.vs-shell[data-state='loading'] .vs-art {
  opacity: 1;
  visibility: visible;
  transition: opacity 320ms var(--vs-ease), visibility 0s;
}

.vs-art__svg {
  position: absolute;
  /* Over-sized so the parallax drift never walks an edge into the frame. */
  left: -3%;
  top: -3%;
  width: 106%;
  height: 106%;
}

/* The fleet drifts and nothing else does.

   Deliberately not the gas or the stars: those two groups are `feTurbulence`,
   and moving a filtered subtree risks the browser re-running the noise every
   frame instead of compositing a cached raster. A title screen that costs a
   megapixel of fractal noise per frame is a worse crime than a still nebula.
   The ship is four dozen paths and moves for nothing. */
.vs-art__fleet {
  animation: vs-drift-fleet 74s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes vs-drift-fleet {
  from { transform: translate(1108px, 460px) rotate(-8.4deg); }
  to { transform: translate(1082px, 444px) rotate(-7.2deg); }
}

/* Fine over most of the frame; the deck and the menu need more than the art
   gives them on the left, so the screens keep a directional wash. */
.vs-screen--title,
.vs-screen--setup,
.vs-screen--briefing,
.vs-screen--loading {
  background:
    linear-gradient(100deg, rgba(3, 7, 12, 0.93) 0%, rgba(3, 7, 12, 0.82) 26%, rgba(3, 7, 12, 0.36) 56%, rgba(3, 7, 12, 0.06) 78%, rgba(3, 7, 12, 0) 100%);
}

/* Setup, briefing and loading are reading screens, not posters: the art stays,
   turned down, so the frame is continuous but the prose is not fighting it. */
.vs-screen--setup,
.vs-screen--briefing,
.vs-screen--loading {
  background:
    linear-gradient(100deg, rgba(3, 7, 12, 0.95) 0%, rgba(3, 7, 12, 0.9) 34%, rgba(3, 7, 12, 0.72) 66%, rgba(3, 7, 12, 0.6) 100%);
}

/* Pause and the end card sit over a live battlefield, and the whole point of
   the tactical pause is that you can still read it. A directional scrim, not
   a wall — but a scrim over sharp type is still sharp type, so the field goes
   soft as well as dark. The blur is what separates "behind the menu" from
   "beside the menu"; the gradient alone left the far side reading at
   three-quarter strength. */
.vs-screen--paused,
.vs-screen--gameOver {
  background:
    linear-gradient(90deg, rgba(3, 6, 11, 0.94) 0%, rgba(3, 6, 11, 0.84) 34%, rgba(3, 6, 11, 0.6) 72%, rgba(3, 6, 11, 0.5) 100%);
  justify-items: start;
}

.vs-screen--paused.is-active,
.vs-screen--gameOver.is-active {
  -webkit-backdrop-filter: blur(6px) saturate(0.8);
  backdrop-filter: blur(6px) saturate(0.8);
}

/* No compositor blur: fall back to a heavier wash rather than to nothing. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .vs-screen--paused,
  .vs-screen--gameOver {
    background:
      linear-gradient(90deg, rgba(3, 6, 11, 0.97) 0%, rgba(3, 6, 11, 0.92) 34%, rgba(3, 6, 11, 0.82) 72%, rgba(3, 6, 11, 0.76) 100%);
  }
}

/* The live HUD, while any shell screen or panel is up. `inert` already has it
   out of the tab order and the accessibility tree; this takes it out of the
   composition too, uniformly, so no corner of it survives at full strength
   because the scrim happened to be thin there. */
.vs-body.vs-blocked .vs-hud {
  opacity: 0.24;
  filter: blur(2px) saturate(0.55);
}

.vs-hud {
  transition: opacity 220ms var(--vs-ease), filter 220ms var(--vs-ease);
}

.vs-screen__inner {
  width: min(50rem, 100%);
}

.vs-screen--briefing .vs-screen__inner {
  width: min(64rem, 100%);
}

.vs-screen--paused .vs-screen__inner,
.vs-screen--gameOver .vs-screen__inner {
  width: min(34rem, 100%);
}

.vs-screen.is-active .vs-screen__inner {
  animation: vs-rise 340ms var(--vs-ease) both;
}

@keyframes vs-rise {
  from { transform: translate3d(0, 10px, 0); }
  to { transform: none; }
}

/* -------------------------------------------------------------- typography */

.vs-eyebrow {
  margin: 0 0 1.4rem;
  font-family: var(--vs-mono);
  font-size: 0.7rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--vs-dim);
}

/* The wordmark, in the game's own type.

   It was Inter 700 at −0.03em — a neo-grotesque website headline sitting on a
   screen where every other letterform, in the menus, the HUD, the briefing and
   the key card, is tracked-out uppercase mono. Round 1 called it the single
   fastest thing that would make a stranger dismiss the game, and the fix is
   not a different display face: it is to stop having two languages. */
.vs-title {
  position: relative;
  margin: 0 0 1.6rem;
  padding-left: 1.15em;
  font-family: var(--vs-mono);
  font-size: clamp(1.45rem, 4.4vw, 3.5rem);
  font-weight: 400;
  letter-spacing: 0.26em;
  line-height: 1.12;
  text-transform: uppercase;
  color: #fff;
}

/* A hairline down the left of the wordmark, the same mark the menu rows use to
   grow their tick from — the logotype belongs to the same drawing as the rest
   of the screen rather than sitting on top of it. */
.vs-title::before {
  content: '';
  position: absolute;
  left: 0.16em;
  top: 0.22em;
  bottom: 0.3em;
  width: 1px;
  background: linear-gradient(to bottom, var(--vs-cyan), rgba(127, 216, 232, 0.06));
}

.vs-title__l {
  display: block;
}

/* The second word carries the weight; the first is the qualifier. */
.vs-title__l--b {
  color: var(--vs-ink);
  text-shadow: 0 0 34px rgba(127, 216, 232, 0.24);
}

.vs-heading {
  margin: 0 0 1rem;
  font-family: var(--vs-mono);
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #fff;
}

.vs-heading--verdict {
  font-size: clamp(1.5rem, 3.4vw, 2.4rem);
  letter-spacing: 0.2em;
}

.vs-heading--verdict.is-won { color: var(--vs-cyan); }
.vs-heading--verdict.is-lost { color: var(--vs-red); }

.vs-deck {
  margin: 0 0 2.6rem;
  max-width: 40rem;
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--vs-dim);
}

.vs-hint {
  margin: 0.6rem 0 0;
  font-size: 0.78rem;
  line-height: 1.55;
  color: rgba(223, 232, 242, 0.36);
}

.vs-hint--wide {
  max-width: 42rem;
  margin-top: 1.8rem;
  padding-top: 1rem;
  border-top: 1px solid var(--vs-hair);
}

.vs-status {
  margin: 1rem 0 0;
  font-family: var(--vs-mono);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--vs-dim);
}

/* -------------------------------------------------------------------- menu */

.vs-menu {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  border-top: 1px solid var(--vs-hair);
  max-width: 26rem;
}

.vs-menu__b {
  position: relative;
  display: block;
  width: 100%;
  padding: 0.95em 0 0.95em 1.5em;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--vs-hair);
  border-radius: 0;
  text-align: left;
  font-family: var(--vs-mono);
  font-size: 0.82rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--vs-dim);
  text-decoration: none;
  cursor: pointer;
  transition: color 160ms ease, padding-left 200ms var(--vs-ease);
}

/* A tick that grows into a rule, rather than a hover fill. No panels. */
.vs-menu__b::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 0.5em;
  height: 1px;
  background: currentColor;
  opacity: 0.4;
  transition: width 200ms var(--vs-ease), opacity 160ms ease;
}

.vs-menu__b:hover,
.vs-menu__b:focus-visible {
  color: var(--vs-ink);
  padding-left: 2.1em;
}

.vs-menu__b:hover::before,
.vs-menu__b:focus-visible::before {
  width: 1.4em;
  opacity: 1;
}

.vs-menu__b.is-primary {
  color: var(--vs-cyan);
  font-size: 0.95rem;
}

/* Restart match, armed by its first press and waiting for the second. */
.vs-menu__b.is-armed {
  color: var(--vs-amber);
}

.vs-menu__b--exit {
  color: rgba(223, 232, 242, 0.32);
  font-size: 0.72rem;
}

/* ------------------------------------------------------------------ fields */

.vs-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.8rem 2.6rem;
  margin: 0 0 2.6rem;
  padding: 1.6rem 0 0;
  border-top: 1px solid var(--vs-faint);
}

.vs-field__k {
  display: block;
  margin: 0 0 0.7rem;
  font-family: var(--vs-mono);
  font-size: 0.66rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--vs-dim);
}

.vs-field__row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.vs-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.55em 0.7em;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--vs-faint);
  border-radius: 0;
  color: var(--vs-ink);
  font-family: var(--vs-mono);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
}

.vs-input:focus-visible {
  border-color: var(--vs-cyan);
  outline: none;
}

.vs-range {
  flex: 1 1 auto;
  min-width: 0;
  height: 18px;
  appearance: none;
  background: none;
  cursor: pointer;
}

.vs-range::-webkit-slider-runnable-track {
  height: 1px;
  background: var(--vs-faint);
}

.vs-range::-webkit-slider-thumb {
  appearance: none;
  width: 9px;
  height: 9px;
  margin-top: -4px;
  border-radius: 0;
  background: var(--vs-cyan);
  border: 0;
}

.vs-range::-moz-range-track {
  height: 1px;
  background: var(--vs-faint);
}

.vs-range::-moz-range-thumb {
  width: 9px;
  height: 9px;
  border-radius: 0;
  border: 0;
  background: var(--vs-cyan);
}

.vs-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.vs-btn,
.vs-choice__b,
.vs-panel__close {
  padding: 0.55em 0.9em;
  background: transparent;
  border: 1px solid var(--vs-faint);
  border-radius: 0;
  color: var(--vs-dim);
  font-family: var(--vs-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.vs-btn:hover,
.vs-choice__b:hover,
.vs-panel__close:hover {
  color: var(--vs-ink);
  border-color: rgba(223, 232, 242, 0.4);
}

.vs-choice__b[aria-checked='true'] {
  color: var(--vs-void);
  background: var(--vs-cyan);
  border-color: var(--vs-cyan);
}

.vs-btn--primary {
  color: var(--vs-void);
  background: var(--vs-cyan);
  border-color: var(--vs-cyan);
  font-weight: 600;
  letter-spacing: 0.18em;
  padding: 0.7em 1.6em;
}

.vs-btn--primary:hover {
  color: var(--vs-void);
  background: #a6e6f2;
  border-color: #a6e6f2;
}

.vs-btn--ghost {
  padding: 0.7em 1.3em;
}

.vs-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  padding-top: 1.6rem;
  border-top: 1px solid var(--vs-hair);
}

/* The primary sits last on the right, so the eye lands on it after the
   secondary choices rather than before them. */
.vs-actions .vs-btn--primary {
  order: 3;
  margin-left: auto;
}

.vs-actions .vs-btn--ghost {
  order: 2;
}

.vs-brief__seed {
  order: 1;
  margin: 0;
  font-family: var(--vs-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(223, 232, 242, 0.3);
}

/* ------------------------------------------------------------- seed sigil */
/* The generated mark. See `paintSigil` in shell.js for what it is and why the
   briefing has one — in short, the seed is the project's whole claim and it
   was set in 10 px grey next to the Back button. */

.vs-sigil {
  flex: 0 0 auto;
  width: 104px;
  height: 104px;
  overflow: visible;
}

.vs-sigil--sm {
  width: 46px;
  height: 46px;
}

.vs-sigil__ring,
.vs-sigil__ring2,
.vs-sigil__arc,
.vs-sigil__web {
  fill: none;
  stroke: var(--vs-cyan);
  vector-effect: non-scaling-stroke;
}

.vs-sigil__ring { stroke-width: 1; stroke-opacity: 0.22; }
.vs-sigil__ring2 { stroke-width: 1; stroke-opacity: 0.14; }
.vs-sigil__arc { stroke-width: 1; stroke-opacity: 0.36; }
.vs-sigil__web { stroke-width: 1; stroke-opacity: 0.62; }

.vs-sigil__tick {
  stroke: var(--vs-cyan);
  stroke-width: 1;
  stroke-opacity: 0.3;
  vector-effect: non-scaling-stroke;
}

.vs-sigil__pt {
  fill: #dff5ff;
  fill-opacity: 0.8;
}

.vs-seedmark {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.9rem;
}

.vs-seedmark__k {
  font-family: var(--vs-mono);
  font-size: 0.6rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(223, 232, 242, 0.28);
}

/* ---------------------------------------------------------------- briefing */

.vs-brief__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2.4rem;
  flex-wrap: wrap;
}

.vs-brief__headtext {
  flex: 1 1 20rem;
  min-width: 0;
}

.vs-seed {
  flex: 0 1 25rem;
  display: flex;
  align-items: flex-start;
  gap: 1.1rem;
  margin: 0 0 0.4rem;
  padding-left: 1.4rem;
  border-left: 1px solid var(--vs-faint);
}

.vs-seed__body {
  min-width: 0;
}

.vs-seed__k {
  display: block;
  font-family: var(--vs-mono);
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--vs-dim);
  margin-bottom: 0.3rem;
}

.vs-seed__n {
  display: block;
  font-family: var(--vs-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.05rem, 2.1vw, 1.5rem);
  letter-spacing: 0.1em;
  line-height: 1.1;
  color: var(--vs-cyan);
  word-break: break-all;
}

.vs-seed__meta {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--vs-mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(223, 232, 242, 0.34);
}

.vs-seed__note {
  margin: 0.6rem 0 0;
  font-size: 0.74rem;
  line-height: 1.55;
  color: rgba(223, 232, 242, 0.4);
}

.vs-brief {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 2rem 2.8rem;
  margin: 0 0 0.6rem;
  padding: 1.6rem 0 2rem;
  border-top: 1px solid var(--vs-faint);
}

.vs-brief__k {
  margin: 0 0 0.8rem;
  font-family: var(--vs-mono);
  font-size: 0.64rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--vs-cyan);
}

.vs-brief__k + .vs-brief__p + .vs-brief__k,
.vs-brief__p + .vs-brief__k {
  margin-top: 1.4rem;
}

.vs-brief__p {
  margin: 0 0 0.8rem;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--vs-dim);
}

.vs-brief__ends {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: vsend;
}

.vs-brief__end {
  counter-increment: vsend;
  position: relative;
  padding: 0 0 0.9rem 1.9rem;
  margin: 0 0 0.9rem;
  border-bottom: 1px solid var(--vs-hair);
}

.vs-brief__end:last-child {
  border-bottom: 0;
}

.vs-brief__end::before {
  content: counter(vsend);
  position: absolute;
  left: 0;
  top: 0.05em;
  font-family: var(--vs-mono);
  font-size: 0.72rem;
  color: rgba(223, 232, 242, 0.3);
}

.vs-brief__endk {
  display: block;
  font-family: var(--vs-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--vs-ink);
  margin-bottom: 0.35rem;
}

.vs-brief__endd {
  display: block;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--vs-dim);
}

/* ----------------------------------------------------------------- loading */

.vs-progress {
  position: relative;
  height: 1px;
  background: var(--vs-faint);
  overflow: hidden;
  margin-top: 1.4rem;
}

.vs-progress__fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--vs-cyan), #fff);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 420ms var(--vs-ease);
}

/* The build card (P46). Six real stages, a time-weighted bar and a field note.
   Everything that moves here is transform or opacity, which the compositor
   runs on its own: a stage that holds the main thread for seconds must not
   freeze the one screen whose job is to say the game is still working. */

.vs-bsteps {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 34rem;
  border-top: 1px solid var(--vs-hair);
  font-family: var(--vs-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.vs-bstep {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 1.1em;
  padding: 0.62em 0 0.62em 1.5em;
  border-bottom: 1px solid var(--vs-hair);
  color: rgba(223, 232, 242, 0.3);
  transition: color 240ms ease;
}

/* The same tick the menu rows grow, here as the stage marker. */
.vs-bstep::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 0.5em;
  height: 1px;
  background: currentColor;
  opacity: 0.5;
  transform-origin: 0 50%;
  transition: transform 240ms var(--vs-ease), opacity 240ms ease;
}

.vs-bstep__n {
  flex: none;
  color: rgba(223, 232, 242, 0.22);
}

.vs-bstep__l {
  flex: 1 1 auto;
  min-width: 0;
}

.vs-bstep__t {
  flex: none;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  text-transform: none;
}

.vs-bstep.is-active {
  color: var(--vs-ink);
}

.vs-bstep.is-active::before {
  background: var(--vs-cyan);
  opacity: 1;
  transform: scaleX(2.6);
  animation: vs-stage-pulse 1.3s ease-in-out infinite;
  will-change: opacity;
}

@keyframes vs-stage-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.vs-bstep.is-done {
  color: rgba(223, 232, 242, 0.42);
}

.vs-bstep.is-done::before {
  background: var(--vs-cyan);
  opacity: 0.6;
}

.vs-bstep.is-done .vs-bstep__t {
  color: rgba(127, 216, 232, 0.7);
}

.vs-bstep.is-kept .vs-bstep__t {
  color: var(--vs-dim);
}

.vs-meter {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 34rem;
  margin-top: 1.4rem;
}

.vs-meter .vs-progress {
  flex: 1 1 auto;
  margin-top: 0;
}

.vs-meter__pct {
  flex: none;
  min-width: 3.2em;
  text-align: right;
  font-family: var(--vs-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
  color: var(--vs-cyan);
}

/* A short glint that crosses the track for as long as the card is up. It is
   what keeps the card visibly alive through a long stage. */
.vs-progress__sweep {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 22%;
  background: linear-gradient(90deg, rgba(191, 238, 255, 0), rgba(191, 238, 255, 0.9), rgba(191, 238, 255, 0));
  transform: translateX(-100%);
  animation: vs-sweep 1.9s cubic-bezier(0.45, 0, 0.55, 1) infinite;
  will-change: transform;
}

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

.vs-screen--loading .vs-status {
  max-width: 34rem;
}

.vs-note {
  max-width: 34rem;
  margin-top: 2.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--vs-hair);
}

.vs-note__k {
  margin: 0 0 0.5rem;
  font-family: var(--vs-mono);
  font-size: 0.66rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--vs-amber);
  opacity: 0.8;
}

.vs-note__t {
  margin: 0;
  min-height: 3.2em;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--vs-dim);
}

/* Page load (P46). The title screen is static markup and paints at once, but
   its buttons do nothing until the modules behind them have loaded and the
   shell has adopted the screen. Until then the menu says so, rather than
   ignoring the first click. `is-live` is set by the shell's constructor. */
.vs-boot {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  max-width: 26rem;
  margin: 1.1rem 0 0;
  font-family: var(--vs-mono);
  font-size: 0.66rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--vs-dim);
  transition: opacity 260ms var(--vs-ease);
}

.vs-boot__bar {
  position: relative;
  flex: 0 0 5.5rem;
  height: 1px;
  overflow: hidden;
  background: var(--vs-faint);
}

.vs-boot__bar::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 40%;
  background: var(--vs-cyan);
  transform: translateX(-100%);
  animation: vs-sweep 1.2s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

.vs-shell:not(.is-live) .vs-menu__b[data-act] {
  opacity: 0.4;
  pointer-events: none;
}

.vs-shell.is-live .vs-boot {
  opacity: 0;
  visibility: hidden;
  transition: opacity 260ms var(--vs-ease), visibility 0s linear 260ms;
}

@media (max-width: 520px) {
  .vs-bstep {
    gap: 0.8em;
    letter-spacing: 0.12em;
  }
}

/* ------------------------------------------------------------- end of match */

.vs-tally {
  margin: 0 0 0.4rem;
  padding: 1.4rem 0 0;
  border-top: 1px solid var(--vs-faint);
}

.vs-tally__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.5em 0;
  border-bottom: 1px solid var(--vs-hair);
}

.vs-tally__row:last-child {
  border-bottom: 0;
}

.vs-tally__k {
  font-family: var(--vs-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--vs-dim);
}

.vs-tally__v {
  font-family: var(--vs-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.86rem;
  color: var(--vs-ink);
}

/* ------------------------------------------------------------------ panels */

.vs-panel {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: safe center;
  justify-items: center;
  padding: 5vmin max(1.6rem, 5vmin);
  background: radial-gradient(120% 90% at 50% 50%, rgba(3, 7, 12, 0.93), rgba(0, 0, 0, 0.97));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 200ms var(--vs-ease), visibility 0s linear 200ms;
}

.vs-panel.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 200ms var(--vs-ease), visibility 0s;
}

.vs-panel__inner {
  width: min(56rem, 100%);
  max-height: 86vh;
  overflow-y: auto;
  scrollbar-width: thin;
}

.vs-panel__head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 0.8rem;
  margin-bottom: 1.8rem;
  border-bottom: 1px solid var(--vs-faint);
}

.vs-panel__title {
  margin: 0;
  font-family: var(--vs-mono);
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #fff;
}

.vs-panel__close {
  margin-left: auto;
  border-color: transparent;
  padding: 0.4em 0;
}

.vs-panel__close:hover {
  border-color: transparent;
  color: var(--vs-cyan);
}

.vs-panel__lede {
  margin: 0 0 1.8rem;
  max-width: 46rem;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--vs-dim);
}

.vs-panel__sec {
  margin: 0 0 2rem;
}

.vs-panel__k {
  margin: 0 0 0.9rem;
  font-family: var(--vs-mono);
  font-size: 0.64rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--vs-cyan);
}

.vs-panel__fail {
  font-family: var(--vs-mono);
  font-size: 0.78rem;
  color: var(--vs-red);
}

.vs-panel__body[hidden] {
  display: none;
}

.vs-keys {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 0 2.4rem;
}

.vs-keys__row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.45em 0;
  border-bottom: 1px solid var(--vs-hair);
}

.vs-keys__k {
  flex: 0 0 11rem;
  font-family: var(--vs-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--vs-ink);
}

.vs-keys__d {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--vs-dim);
}

/* ------------------------------------------------------------------ fatal */

.vs-fatal {
  position: absolute;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 6vmin;
  background: var(--vs-void);
}

.vs-fatal[hidden] {
  display: none;
}

.vs-fatal-inner {
  max-width: 34rem;
}

.vs-fatal-inner h2 {
  margin: 0 0 0.9rem;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.vs-fatal-inner p {
  margin: 0 0 2rem;
  color: var(--vs-dim);
  line-height: 1.7;
}

.vs-fatal-back {
  font-family: var(--vs-mono);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--vs-cyan);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 0.2em;
}

/* ------------------------------------------------------------------- exit */

/* The in-game exit link. The shell has its own route back on the title
   screen, so this one is only wanted while a match is live — otherwise the
   same destination appears twice on the same frame. */
.vs-exit {
  position: absolute;
  z-index: 60;
  left: max(1.1rem, env(safe-area-inset-left));
  bottom: max(1.1rem, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.45em 0.2em;
  font-family: var(--vs-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--vs-dim);
  text-decoration: none;
  transition: color 200ms ease, opacity 200ms ease;
}

.vs-exit:hover,
.vs-exit:focus-visible {
  color: var(--vs-ink);
}

.vs-shell.is-blocking ~ .vs-exit {
  opacity: 0;
  pointer-events: none;
}

:focus-visible {
  outline: 1px solid var(--vs-cyan);
  outline-offset: 3px;
}

/* See `_wireKeys` in shell.js: the ring is suppressed only while the last
   input was a pointer, or while there has been none at all. Anyone touching a
   key gets it back on the same event, so this never costs a keyboard user
   their focus indicator. */
.vs-shell.is-quietfocus :focus-visible {
  outline: none;
}

/* =================================================== HUD objective readout

   This block styles DOM built by `src/ui/hud.js`, not by the shell, and it is
   here rather than in hud.css only because hud.css is not this lane's file to
   edit. Class names stay in the HUD's `vsh-` namespace so it can be lifted
   across verbatim the moment ownership allows.

   What it is: the standing answer to "what am I doing and who is winning".
   The sovereignty clock and seam control have been running in
   `src/sim/economy.js` since it was written and have never once been on
   screen — a second victory condition nobody can see is not a victory
   condition. It sits in the one gap in the top bar, between the resource
   readout and the fleet stats. */

.vsh-obj {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 30rem;
  text-align: center;
  opacity: 0;
  transition: opacity 400ms var(--vs-ease);
}

/* Clip, never overprint: see HUD._fitObjective. */
.vsh-obj { overflow: hidden; }

.vsh-obj.is-live {
  opacity: 1;
}

/* Fit levels, set by HUD._fitObjective when the rows do not fit their slot. */
.vsh-obj.is-fit1:not(.is-hold) .vsh-obj__state:not(.is-good):not(.is-bad),
.vsh-obj.is-fit2:not(.is-hold) .vsh-obj__state { display: none; }
.vsh-obj.is-fit1 .vsh-obj__bar { width: 48px; }
.vsh-obj.is-fit1 .vsh-obj__meters { gap: 9px; }
/* Round 14: the seam count is the last thing to go (critic round 13 missed
   it at 1280 px). The bars narrow first; the per-meter You / Them words go
   only after that (critic round 14 missed them), and seams last. */
.vsh-obj.is-fit2 .vsh-obj__bar { width: 30px; }
.vsh-obj.is-fit2 .vsh-obj__m { gap: 4px; }
.vsh-obj.is-fit3 .vsh-obj__m > .vsh-obj__mk { display: none; }
.vsh-obj.is-fit4 .vsh-obj__seams { display: none; }

.vsh-obj__k {
  display: block;
  font-family: var(--vs-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.24);
  margin-bottom: 5px;
}

.vsh-obj__line {
  display: block;
  margin: 0 0 7px;
  font-family: var(--vs-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  line-height: 1.3;
  /* Raised from 40%. The objective sentence is the one line in the bar that
     has to survive over the lit limb of a planet, and 40% white measured at
     roughly the same value as the backdrop it was sitting on. */
  color: rgba(255, 255, 255, 0.56);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vsh-obj__meters {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.vsh-obj__m {
  display: flex;
  align-items: center;
  gap: 7px;
}

.vsh-obj__mk {
  font-family: var(--vs-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.32);
}

.vsh-obj__bar {
  position: relative;
  width: 84px;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.vsh-obj__fill {
  position: absolute;
  inset: 0;
  transform-origin: 0 50%;
  transform: scaleX(1);
  transition: transform 400ms linear;
}

.vsh-obj__m--us .vsh-obj__fill { background: var(--vs-cyan); }
.vsh-obj__m--them .vsh-obj__fill { background: var(--vs-amber); }
.vsh-obj__m--us.is-alert .vsh-obj__fill { background: var(--vs-red); }

.vsh-obj__n {
  font-family: var(--vs-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.64);
  min-width: 2.6em;
  text-align: right;
}

.vsh-obj__m--us.is-alert .vsh-obj__n { color: var(--vs-red); }

.vsh-obj__seams {
  font-family: var(--vs-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.4);
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.vsh-obj__seams b {
  font-weight: 400;
  color: var(--vs-cyan);
}

.vsh-obj__seams { white-space: nowrap; }

.vsh-obj__seams i {
  font-style: normal;
  color: var(--vs-amber);
}

/* The row's own key. The meters are sovereignty percentages, and the round 9
   critic read them as fleet strength without it. */
.vsh-obj__mk--sov {
  color: rgba(255, 255, 255, 0.4);
  padding-right: 2px;
}

.vsh-obj__n { min-width: 3.3em; }

/* Fleet hull: the second row, fleet strength rather than the clock. Same
   hairline meters, its own key, a touch quieter than sovereignty so the
   objective still leads. The side losing the fight carries the full-value
   number; the side ahead rests at the row's grey. */
.vsh-obj__meters--str {
  margin-top: 5px;
}

.vsh-obj__mk--str {
  color: rgba(255, 255, 255, 0.4);
  padding-right: 2px;
}

.vsh-obj__m--str .vsh-obj__bar { height: 2px; }
.vsh-obj__m--str .vsh-obj__n { color: rgba(255, 255, 255, 0.5); }
.vsh-obj__m--str.is-weaker .vsh-obj__n { color: rgba(255, 255, 255, 0.92); }
.vsh-obj__m--us.vsh-obj__m--str.is-weaker .vsh-obj__fill { background: var(--vs-red); }

/* What the middle is doing: "yours at 63%", "draining them", "Battle 0:52". */
.vsh-obj__state {
  font-family: var(--vs-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.4);
  white-space: nowrap;
}

.vsh-obj__state:empty { display: none; }
.vsh-obj__state.is-good { color: var(--vs-cyan); }
.vsh-obj__state.is-bad { color: var(--vs-amber); }

/* A held result: sovereignty is at zero but a battle is on, so the battle
   decides it. The sentence and the countdown take the bar's full value. */
.vsh-obj.is-hold .vsh-obj__line { color: rgba(255, 255, 255, 0.86); }
.vsh-obj.is-hold .vsh-obj__state {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  padding: 1px 6px;
  border: 1px solid currentColor;
}

/* ------------------------------------------------------------- responsive */

/* The top bar is the tightest row on the page. The objective sentence is the
   first thing to go, then the "SOVEREIGNTY" label; the two meters and the
   seam count survive to 1024. Measured at 2560, 1600, 1440, 1280 and 1024. */
@media (max-width: 1560px) {
  .vsh-obj__line { display: none; }
  .vsh-obj__bar { width: 68px; }
}

@media (max-width: 1240px) {
  .vsh-obj__k { display: none; }
  .vsh-obj__bar { width: 52px; }
  .vsh-obj__meters { gap: 10px; }
  .vsh-obj__seams { padding-left: 8px; }
  /* The row keys stay: with two rows of You/Them percentages, the keys are
     what keeps sovereignty and fleet hull from reading as one figure. */
  .vsh-obj__mk--sov,
  .vsh-obj__mk--str { font-size: 8px; letter-spacing: 0.12em; }
  .vsh-obj__state:not(.is-good):not(.is-bad) { display: none; }
}

@media (max-width: 1000px) {
  .vsh-obj { display: none; }
}

@media (max-height: 760px) {
  .vs-screen { padding: 3.5vmin max(1.2rem, 4vmin); }
  .vs-brief { gap: 1.2rem 2.4rem; padding: 1.1rem 0 1.2rem; }
  .vs-brief__p { margin-bottom: 0.55rem; }
  .vs-deck { margin-bottom: 1.6rem; }
  .vs-actions { padding-top: 1.1rem; }
  /* The screen's own padding, not a flat 90vh: at 1280×720 the briefing was
     655 px tall in a 648 px box, so the bottom of its buttons scrolled out
     of view (critic round 17, O1). */
  .vs-screen--briefing .vs-screen__inner,
  .vs-panel__inner { max-height: calc(100vh - 7vmin); overflow-y: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .vs-screen,
  .vs-panel,
  .vs-progress__fill,
  .vsh-obj__fill,
  .vs-hud,
  .vs-menu__b,
  .vs-menu__b::before {
    transition-duration: 1ms;
  }
  .vs-screen.is-active .vs-screen__inner {
    animation: none;
  }
  /* The backdrop holds its composition; it just stops drifting. */
  .vs-art__fleet {
    animation: none;
  }
  /* The build card keeps its stage ticks and the bar; it loses the glint and
     the pulse. */
  .vs-progress__sweep,
  .vs-boot__bar::after,
  .vs-bstep.is-active::before {
    animation: none;
  }
  .vs-progress__sweep {
    display: none;
  }
  .vs-boot__bar::after {
    transform: none;
  }
}
