@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("./atkinson-hyperlegible-next.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

/* Component display rules must not defeat the hidden attribute: the lobby
   shell and the battle HUD swap with it. */
[hidden] { display: none !important; }

:root {
  --surface-950: #0e1313;
  --surface-900: #111818;
  --surface-850: #182020;
  --surface-780: #232d2d;
  --text-100: #f3f2ec;
  --text-400: #a9b0ac;
  --focus-400: #7cb8ff;
  --capture-400: #52cfa4;
  --warning-500: #dda94b;
  --danger-500: #d96657;
  --rule: #606a67;
  --scale: 1;
  --s1: calc(4px * var(--scale));
  --s2: calc(8px * var(--scale));
  --s3: calc(12px * var(--scale));
  --s4: calc(16px * var(--scale));
  --s6: calc(24px * var(--scale));
  --s8: calc(32px * var(--scale));
  color-scheme: dark;
  font-family: "Atkinson Hyperlegible Next", sans-serif;
  font-size: calc(16px * var(--scale));
  line-height: 1.45;
  background: var(--surface-950);
  color: var(--text-100);
}

[data-ui-scale="140"] { --scale: 1.4; }
[data-high-contrast="true"] {
  --surface-900: #000;
  --surface-850: #090909;
  --surface-780: #1b1b1b;
  --text-400: #f3f2ec;
  --rule: #f3f2ec;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { min-width: 320px; min-height: 100vh; background: var(--surface-950); color: var(--text-100); }
a { color: var(--text-100); text-underline-offset: 0.2em; }
a:hover { color: var(--focus-400); }
:focus { outline: none; }
:focus-visible {
  outline: calc(2px * var(--scale)) solid var(--focus-400);
  outline-offset: calc(3px * var(--scale));
  box-shadow: 0 0 0 calc(1px * var(--scale)) var(--surface-950);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

h1, h2, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: calc(30px * var(--scale)); line-height: 1.15; font-weight: 400; }
h2 { margin: 0; font-size: calc(24px * var(--scale)); line-height: 1.2; font-weight: 400; }

[data-presentation="reduced"] * { animation: none !important; transition: none !important; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* MVP-06 Build 3: the live-match battle HUD (client/web/src/index.html's
   #battle-hud, driven entirely by live-boot.mjs's bootLiveMatch). Layout invariants
   from PRODUCT.md's "Browser battle layout and service states": the newest
   binding readback is never covered by the canvas, connection/capture state
   is never color-only (every state carries a text label), and keyboard focus
   moves among typed input, ticker, captions, and settings without the canvas
   trapping it. */
.battle-hud {
  /* Full-bleed battlefield: the canvas fills the window and the HUD floats
     over it on translucent panels. */
  --glass: rgba(12, 17, 20, 0.62);
  --glass-strong: rgba(12, 17, 20, 0.82);
  --glass-rule: rgba(255, 255, 255, 0.12);
  --radius: calc(12px * var(--scale));
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #9fb0bb;
}
.battle-hud > * { z-index: 2; }

.battle-topstrip {
  position: absolute;
  top: var(--s3);
  left: var(--s3);
  right: var(--s3);
  display: flex;
  gap: var(--s4);
  align-items: center;
  padding: var(--s2) var(--s4);
  border: 1px solid var(--glass-rule);
  border-radius: var(--radius);
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  font-variant-numeric: tabular-nums;
  pointer-events: auto;
}
.battle-clock-group { display: inline-flex; align-items: baseline; gap: var(--s2); }
.battle-clock { font-size: 1.35em; font-weight: 600; letter-spacing: 0.04em; }
.battle-clock-label { color: var(--text-400); font-size: 0.72em; letter-spacing: 0.16em; text-transform: uppercase; }
.battle-transport { color: var(--text-400); font-size: 0.85em; }
.battle-connection {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  color: var(--text-400);
  font-size: 0.74em;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.battle-connection::before {
  content: "";
  width: calc(8px * var(--scale));
  height: calc(8px * var(--scale));
  border-radius: 50%;
  background: var(--warning-500);
}
.battle-connection[data-state="ready"] { color: var(--capture-400); }
.battle-connection[data-state="ready"]::before { background: var(--capture-400); box-shadow: 0 0 8px var(--capture-400); }
.battle-connection[data-state="degraded"]::before { background: var(--danger-500); animation: hud-blink 1s ease-in-out infinite; }
@keyframes hud-blink { 50% { opacity: 0.3; } }

.battle-will {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s1) var(--s3);
  border-radius: 999px;
  background: rgba(124, 88, 255, 0.14);
  border: 1px solid rgba(170, 140, 255, 0.35);
}
.battle-will-label { font-size: 0.8em; letter-spacing: 0.08em; text-transform: uppercase; color: #cdbfff; }
.battle-will-bar {
  position: relative;
  width: calc(120px * var(--scale));
  height: calc(8px * var(--scale));
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.battle-will-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #7b5cff, #c08bff 60%, #ffd28a);
  box-shadow: 0 0 12px rgba(192, 139, 255, 0.7);
  transition: width 400ms ease;
}
.battle-will-value { min-width: 3.2ch; text-align: right; font-weight: 600; }

.battle-capture { display: inline-flex; gap: var(--s2); }
.battle-capture[hidden] { display: none; }
.battle-capture-row {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s1) var(--s3);
  border-radius: 999px;
  font-weight: 600;
  background: rgba(221, 169, 75, 0.14);
  border: 1px solid rgba(221, 169, 75, 0.45);
}
.battle-capture-row[data-tone="danger"] {
  background: rgba(214, 72, 56, 0.2);
  border-color: rgba(240, 110, 90, 0.7);
  animation: capture-pulse 1.2s ease-in-out infinite;
}
@keyframes capture-pulse { 50% { box-shadow: 0 0 14px rgba(240, 110, 90, 0.55); } }
.battle-capture-bar {
  position: relative;
  width: calc(96px * var(--scale));
  height: calc(8px * var(--scale));
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.battle-capture-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
  background: #dda94b;
  transition: width 200ms linear;
}
.battle-capture-row[data-tone="danger"] .battle-capture-fill { background: #f06e5a; }

.battle-body {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.battle-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}
/* The engine canvas and the label overlay fill the window absolutely so the
   canvas backing size never feeds back into the layout. */
.battle-viewport canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; aspect-ratio: auto; background: transparent; }
.battle-viewport canvas#engine-canvas { cursor: grab; pointer-events: auto; }
.battle-viewport canvas#engine-canvas:active { cursor: grabbing; }
.battle-viewport .battle-labels { pointer-events: none; }

.battle-roster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  list-style: none;
  margin: 0 0 0 auto;
  padding: 0;
  font-size: 0.9em;
}
.battle-roster li { display: inline-flex; align-items: center; gap: var(--s1); }
.battle-roster li[data-own="true"] { font-weight: 600; }
.battle-roster li[data-out="true"] { color: var(--text-400); text-decoration: line-through; }
.battle-roster-chip {
  display: inline-block;
  width: calc(12px * var(--scale));
  height: calc(12px * var(--scale));
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.6);
}
.battle-sound {
  min-height: calc(32px * var(--scale));
  padding: 0 var(--s3);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-rule);
  color: var(--text-100);
  cursor: pointer;
}
.battle-sound:hover { background: rgba(255, 255, 255, 0.14); }
.battle-sound[aria-pressed="false"] { color: var(--text-400); }

.battle-compass {
  position: absolute;
  top: calc(76px * var(--scale));
  left: var(--s4);
  width: calc(44px * var(--scale));
  height: calc(44px * var(--scale));
  border: 1px solid var(--glass-rule);
  border-radius: 50%;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  pointer-events: none;
}
.battle-compass svg { width: 80%; height: 80%; }
.battle-compass .compass-n { display: block; fill: #f3f2ec; font: 700 9px sans-serif; }
/* "Contact – F": a camera shortcut beside the compass, shown only while own
   and enemy squads meet in sight. */
.battle-contact {
  position: absolute;
  top: calc(76px * var(--scale));
  left: calc(var(--s4) + 52px * var(--scale));
  min-height: calc(44px * var(--scale));
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: 0 var(--s4);
  border: 1px solid var(--warning-500);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-100);
  font: inherit;
  font-size: 0.88em;
  font-weight: 600;
  cursor: pointer;
}
.battle-contact:hover { background: var(--glass-strong); }
.battle-contact kbd {
  padding: 0 var(--s1);
  border: 1px solid var(--glass-rule);
  border-radius: 4px;
  color: var(--text-400);
  font: inherit;
  font-size: 0.86em;
}
/* The minimap sits light over the field (a camp may be under it) and folds
   to a small "Map" button. */
.battle-minimap {
  position: absolute;
  left: var(--s4);
  bottom: var(--s4);
  width: calc(clamp(136px, 11.5vw, 168px) * var(--scale));
  padding: var(--s1);
  border: 1px solid var(--glass-rule);
  border-radius: var(--radius);
  background: rgba(12, 17, 20, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.24);
  opacity: 0.84;
  transition: opacity 160ms ease;
  z-index: 3;
}
.battle-minimap:hover, .battle-minimap:focus-within { opacity: 1; }
.battle-minimap svg { display: block; width: 100%; height: auto; cursor: crosshair; }
.battle-minimap-toggle {
  position: absolute;
  bottom: calc(100% + var(--s1));
  left: 0;
  min-height: calc(24px * var(--scale));
  padding: 0 var(--s2);
  border: 1px solid var(--glass-rule);
  border-radius: 999px;
  background: var(--glass-strong);
  color: var(--text-400);
  font: inherit;
  font-size: 0.72em;
  cursor: pointer;
}
.battle-minimap-toggle:hover { color: var(--text-100); }
.battle-minimap[data-collapsed="true"] { width: auto; padding: 0; border: none; background: none; box-shadow: none; opacity: 1; }
.battle-minimap[data-collapsed="true"] svg { display: none; }
.battle-minimap[data-collapsed="true"] .battle-minimap-toggle {
  position: static;
  min-height: calc(32px * var(--scale));
  padding: 0 var(--s3);
  font-size: 0.82em;
  color: var(--text-100);
  background: var(--glass);
  opacity: 1;
}
/* The camera keys: one keycap strip centred under the top strip, no panel,
   on the first battle of a session only (battle-hud.mjs). */
.battle-camera-hint {
  position: absolute;
  top: calc(80px * var(--scale));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--s4);
  margin: 0;
  color: var(--text-100);
  font-size: 0.875em;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 10px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  transition: opacity 280ms ease, visibility 280ms;
}
.battle-camera-hint span { display: inline-flex; align-items: center; gap: var(--s1); }
.battle-camera-hint kbd {
  min-width: calc(24px * var(--scale));
  padding: 0 var(--s1);
  border: 1px solid var(--glass-rule);
  border-radius: 4px;
  background: var(--glass-strong);
  color: var(--text-100);
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-shadow: none;
}
/* A reminder until the first camera move or ten seconds, then out of the
   way. */
.battle-camera-hint.is-dismissed { opacity: 0; visibility: hidden; }
.battle-outcome {
  position: absolute;
  left: 50%;
  top: 22%;
  transform: translateX(-50%);
  min-width: min(440px, 90%);
  padding: var(--s6) var(--s8);
  border: 1px solid var(--glass-rule);
  border-radius: calc(18px * var(--scale));
  background: var(--glass-strong);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  text-align: center;
  z-index: 5;
}
.battle-outcome h2 { margin: 0 0 var(--s2); font-size: 2.2em; letter-spacing: 0.06em; text-transform: uppercase; }
/* The verdict's tone is semantic, never a team colour. */
.battle-outcome h2[data-result="victory"] { color: var(--capture-400); }
.battle-outcome h2[data-result="defeat"] { color: var(--danger-500); }
.battle-outcome h2[data-result="draw"] { color: var(--warning-500); }
.battle-outcome p { margin: 0 0 var(--s3); }
.battle-outcome ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); text-align: left; }
.battle-outcome li { display: flex; align-items: center; gap: var(--s2); }

.battle-ticker {
  position: absolute;
  top: calc(76px * var(--scale));
  right: var(--s3);
  width: min(calc(320px * var(--scale)), 32vw);
  max-height: calc(100vh - 360px * var(--scale));
  padding: var(--s2) var(--s3) var(--s3);
  border: 1px solid var(--glass-rule);
  border-radius: var(--radius);
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  overflow-y: auto;
  z-index: 2;
}
.battle-ticker-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s1); }
.battle-ticker h2 { margin: 0; font-size: 0.78em; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-400); }
.battle-ticker-more {
  min-height: calc(24px * var(--scale));
  padding: 0 var(--s2);
  border: 1px solid var(--glass-rule);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-400);
  font: inherit;
  font-size: 0.74em;
  cursor: pointer;
}
.battle-ticker-more:hover { color: var(--text-100); background: rgba(255, 255, 255, 0.12); }
.battle-ticker-active, .battle-ticker-settled { list-style: none; margin: 0; padding: 0; }
/* Quiet Command ticker rows: one coloured state word, then the order, on
   one line; the open ticker wraps each row in full. */
.battle-ticker li {
  --tone: var(--text-400);
  display: flex;
  align-items: baseline;
  gap: var(--s2);
  padding: var(--s1) var(--s2);
  border-left: calc(2px * var(--scale)) solid var(--tone);
  white-space: nowrap;
  overflow: hidden;
}
.battle-ticker .ticker-state { flex: none; }
.battle-ticker .ticker-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.battle-ticker[data-expanded="true"] li { display: grid; gap: 2px; white-space: normal; }
.battle-ticker li[data-tone="focus"] { --tone: var(--focus-400); }
.battle-ticker li[data-tone="ok"] { --tone: var(--capture-400); }
.battle-ticker li[data-tone="warning"] { --tone: var(--warning-500); }
.battle-ticker li[data-tone="danger"] { --tone: var(--danger-500); }
.battle-ticker li[data-tone="magic"] { --tone: #c3a6ff; }
.battle-ticker li[data-tone="muted"] { --tone: #6f7874; }
.battle-ticker-active li { margin-bottom: var(--s1); border-radius: 0 calc(6px * var(--scale)) calc(6px * var(--scale)) 0; background: rgba(255, 255, 255, 0.06); }
.battle-ticker-settled li { opacity: 0.72; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.battle-ticker .ticker-state { color: var(--tone); font-size: 0.7em; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; }
.battle-ticker .ticker-text { font-size: 0.86em; line-height: 1.3; }
.battle-ticker li.ticker-empty { border-left: none; background: none; color: var(--text-400); font-size: 0.82em; white-space: normal; }

/* The command stack: captions, the dock, and the order line float at the
   bottom centre. */
.battle-bottom {
  position: absolute;
  left: 50%;
  bottom: var(--s4);
  transform: translateX(-50%);
  width: min(calc(760px * var(--scale)), calc(100vw - 2 * var(--s4)));
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  z-index: 3;
}

/* Captions are toasts in a side lane under the compass, clear of the ford
   and the labels: the newest three, each gone after eight seconds
   (battle-hud.mjs removes it; the fade only softens the exit). */
.battle-captions {
  position: absolute;
  top: calc(132px * var(--scale));
  left: var(--s4);
  width: min(calc(340px * var(--scale)), 30vw);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s1);
  pointer-events: none;
  z-index: 3;
}
.battle-captions p {
  margin: 0;
  padding: var(--s2) var(--s3);
  border-radius: calc(8px * var(--scale));
  background: var(--glass-strong);
  border: 1px solid var(--glass-rule);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-100);
  font-size: 0.88em;
  line-height: 1.35;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  animation: caption-fade 8s ease forwards;
}
@keyframes caption-fade {
  0% { opacity: 0; transform: translateX(calc(-8px * var(--scale))); }
  3%, 88% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .battle-captions p { animation: none; }
}

.battle-dock {
  border: 1px solid var(--glass-rule);
  border-radius: var(--radius);
  background: var(--glass-strong);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  padding: var(--s3) var(--s4);
  display: grid;
  gap: var(--s1);
}
.battle-dock[data-state="disarmed"] { border-color: var(--glass-rule); }
.battle-dock[data-state="out"] { border-color: var(--glass-rule); color: var(--text-400); }
.battle-dock[data-state="capturing"] { border-color: var(--capture-400); box-shadow: 0 0 0 1px var(--capture-400), 0 12px 36px rgba(0, 0, 0, 0.35); }
.battle-dock[data-state="clarification"] { border-color: var(--warning-500); }
.battle-dock[data-state="binding-readback"] { border-color: var(--focus-400); }
.battle-dock p { margin: 0; }
.battle-dock .dock-intent { font-size: 1.12em; font-weight: 600; line-height: 1.3; }
.battle-dock .dock-heard { color: var(--text-400); font-size: 0.86em; }
.battle-dock .dock-countdown { height: calc(3px * var(--scale)); border-radius: 2px; background: rgba(255, 255, 255, 0.1); overflow: hidden; margin-top: var(--s1); }
.battle-dock .dock-countdown span { display: block; height: 100%; background: var(--focus-400); transition: width 900ms linear; }
.battle-dock .dock-label { font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.72em; color: var(--text-400); }
.battle-dock .dock-options { list-style: none; margin: var(--s1) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s2); }
.battle-dock .dock-options li { display: contents; }
.battle-dock .dock-option {
  min-height: calc(32px * var(--scale));
  padding: var(--s1) var(--s3);
  font: inherit;
  text-align: left;
  color: var(--text-100);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-rule);
  cursor: pointer;
}
.battle-dock .dock-option:hover, .battle-dock .dock-option:focus-visible { border-color: var(--focus-400); background: rgba(124, 184, 255, 0.16); }
.battle-dock .dock-dismiss { color: var(--text-400); }

.battle-command-line {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2);
  border: 1px solid var(--glass-rule);
  border-radius: 999px;
  background: var(--glass-strong);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
}
.battle-command-line input {
  flex: 1;
  min-width: 0;
  padding: var(--s2) var(--s4);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
  color: var(--text-100);
  font: inherit;
}
.battle-command-line input:focus-visible { outline: none; border-color: var(--focus-400); }
.battle-command-line input:disabled { opacity: 0.5; }
.battle-command-line input::placeholder { font-size: 0.92em; }
.battle-ptt-hint { color: var(--text-400); font-size: 0.8em; white-space: nowrap; padding-right: var(--s3); }

.battle-replay-download {
  position: absolute;
  right: var(--s3);
  bottom: var(--s4);
  padding: var(--s1) var(--s3);
  border: 1px solid var(--glass-rule);
  border-radius: 999px;
  background: var(--glass);
  z-index: 3;
}

@media (max-width: 720px) {
  .battle-ticker { top: auto; bottom: calc(190px * var(--scale)); max-height: 24vh; width: calc(100vw - 2 * var(--s3)); }
  .battle-captions { width: calc(100vw - 2 * var(--s4)); }
  .battle-ptt-hint { display: none; }
  .battle-will-bar { width: calc(64px * var(--scale)); }
}

/* --- Lobby-flow shell (see lobby.js): Quiet Command panels over a dim
   sand-table backdrop ------------------------------------------------------ */

body:has(.lobby-shell:not([hidden])) {
  background:
    radial-gradient(ellipse 80% 60% at 70% 20%, rgba(82, 207, 164, 0.07), transparent 60%),
    radial-gradient(ellipse 70% 70% at 15% 90%, rgba(124, 184, 255, 0.06), transparent 60%),
    repeating-radial-gradient(circle at 30% 40%, transparent 0 38px, rgba(243, 242, 236, 0.025) 38px 39px),
    var(--surface-950);
  background-attachment: fixed;
}

.lobby-shell {
  width: min(100%, 52rem);
  min-height: 100vh;
  margin: 0 auto;
  padding: var(--s8) var(--s4);
  display: grid;
  align-content: center;
  gap: var(--s4);
}
.lobby-shell::before {
  content: "◆  BATTLEMIND";
  color: var(--text-400);
  font-size: 0.78em;
  letter-spacing: 0.32em;
  padding-left: var(--s1);
}
.lobby-screen {
  border: 1px solid rgba(243, 242, 236, 0.1);
  border-radius: calc(6px * var(--scale));
  background: linear-gradient(180deg, rgba(24, 32, 32, 0.92), rgba(17, 24, 24, 0.94));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  padding: var(--s8);
  display: grid;
  gap: var(--s4);
}
.lobby-screen h1 { margin: 0; font-size: 1.9em; line-height: 1.15; letter-spacing: -0.01em; }
.lobby-screen h2 {
  margin: var(--s2) 0 0;
  font-size: 0.78em;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-400);
}
.lobby-screen p { margin: 0; }
.lobby-eyebrow { color: var(--capture-400); letter-spacing: 0.22em; text-transform: uppercase; font-size: 0.74em; }
.lobby-lede { font-size: 1.08em; color: var(--text-100); }
.lobby-note, .lobby-privacy { color: var(--text-400); font-size: 0.9em; }

/* Every waiting/blocked state renders through this block: what is
   happening, what is safe, and the next action — never a bare spinner. */
.lobby-state {
  border: 1px solid rgba(124, 184, 255, 0.28);
  border-left: calc(3px * var(--scale)) solid var(--focus-400);
  border-radius: calc(6px * var(--scale));
  background: rgba(124, 184, 255, 0.06);
  padding: var(--s3) var(--s4);
  display: grid;
  gap: var(--s1);
}
.lobby-state[data-tone="blocked"] { border-color: rgba(217, 102, 87, 0.35); border-left-color: var(--danger-500); background: rgba(217, 102, 87, 0.07); }
.lobby-state[data-tone="warning"] { border-color: rgba(221, 169, 75, 0.35); border-left-color: var(--warning-500); background: rgba(221, 169, 75, 0.07); }
.lobby-state[data-tone="ok"] { border-color: rgba(82, 207, 164, 0.3); border-left-color: var(--capture-400); background: rgba(82, 207, 164, 0.06); }
.lobby-state strong { text-transform: none; }

.lobby-trust { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.lobby-trust li {
  display: flex;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s2) var(--s3);
  border-radius: calc(4px * var(--scale));
  background: rgba(243, 242, 236, 0.04);
}
.lobby-trust li span:first-child { color: var(--text-400); }

/* Buttons: one filled primary action, quiet outlined secondaries, and a
   danger outline for leaving or cancelling. */
.lobby-actions { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.lobby-shell button, .lobby-shell a.lobby-button {
  min-height: calc(44px * var(--scale));
  padding: var(--s2) var(--s6);
  font: inherit;
  font-size: 0.92em;
  letter-spacing: 0.06em;
  color: var(--text-100);
  background: rgba(243, 242, 236, 0.03);
  border: 1px solid rgba(243, 242, 236, 0.28);
  border-radius: calc(4px * var(--scale));
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.lobby-shell button:hover:not(:disabled) { border-color: var(--focus-400); background: rgba(124, 184, 255, 0.1); }
.lobby-shell button:active:not(:disabled) { transform: translateY(1px); }
.lobby-shell button.primary {
  color: #0b1414;
  background: var(--capture-400);
  border-color: var(--capture-400);
  font-weight: 600;
}
.lobby-shell button.primary:hover:not(:disabled) { background: #6be0b8; border-color: #6be0b8; }
.lobby-shell button:disabled { opacity: 0.45; cursor: default; }
.lobby-shell button[data-tone="danger"] { color: #f0a197; border-color: rgba(217, 102, 87, 0.5); }
/* The two consent actions are equally weighted by contract: same class,
   same size, no visual primary between them. */
.lobby-actions.equal button { border-color: var(--focus-400); flex: 1 1 12rem; }

.lobby-form { display: grid; gap: var(--s2); }
.lobby-form label { color: var(--text-400); font-size: 0.86em; letter-spacing: 0.04em; margin-top: var(--s2); }
.lobby-form input, .lobby-form select, .lobby-share input, .draft-army input, .draft-army select {
  padding: var(--s2) var(--s3);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(243, 242, 236, 0.22);
  border-radius: calc(4px * var(--scale));
  color: var(--text-100);
  font: inherit;
}
.lobby-form input:focus-visible, .lobby-form select:focus-visible, .draft-army input:focus-visible, .draft-army select:focus-visible { outline: none; border-color: var(--focus-400); box-shadow: 0 0 0 3px rgba(124, 184, 255, 0.18); }
.lobby-form .field-error, .lobby-screen .field-error { color: var(--danger-500); }

.lobby-roster { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.lobby-roster li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s3);
  border-radius: calc(4px * var(--scale));
  background: rgba(243, 242, 236, 0.04);
}
.lobby-roster .seat-name { font-weight: 600; }
.lobby-roster .seat-stage {
  color: var(--text-400);
  font-size: 0.875em;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.lobby-roster li[data-stage="ready"] .seat-stage,
.lobby-roster li[data-stage="ready-to-deploy"] .seat-stage { color: var(--capture-400); }
.lobby-roster li[data-stage="hosting"] .seat-stage { color: var(--focus-400); }
.lobby-roster li[data-stage="declined"] .seat-stage,
.lobby-roster li[data-stage="failed"] .seat-stage,
.lobby-roster li[data-stage="disconnected"] .seat-stage { color: var(--danger-500); }
.lobby-roster li[data-stage="reviewing"] .seat-stage { color: var(--text-400); }

.lobby-share { display: grid; gap: var(--s2); border: 1px dashed rgba(243, 242, 236, 0.25); border-radius: calc(6px * var(--scale)); padding: var(--s4); }
.lobby-share input { width: 100%; }

.drill-transcript { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.drill-transcript li { padding: var(--s2) var(--s3); border-radius: calc(4px * var(--scale)); background: rgba(243, 242, 236, 0.04); }
.drill-battle-note { margin: 0; padding: var(--s2) var(--s3); border-left: calc(2px * var(--scale)) solid var(--focus-400); border-radius: 0 calc(4px * var(--scale)) calc(4px * var(--scale)) 0; background: rgba(124, 184, 255, 0.08); }

/* The landing: copy beside a drawn Stone Ford. */
.home-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 20rem); gap: var(--s6); align-items: center; }
.home-copy { display: grid; gap: var(--s4); }
.home-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); counter-reset: step; }
.home-steps li {
  display: grid;
  grid-template-columns: calc(28px * var(--scale)) 1fr;
  column-gap: var(--s3);
  counter-increment: step;
}
.home-steps li::before {
  content: counter(step);
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: calc(28px * var(--scale));
  height: calc(28px * var(--scale));
  border: 1px solid var(--capture-400);
  border-radius: 50%;
  color: var(--capture-400);
  font-size: 0.85em;
}
.home-steps strong { letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.82em; }
.home-steps span { color: var(--text-400); font-size: 0.94em; }
@media (max-width: 760px) {
  .home-hero { grid-template-columns: 1fr; }
  .lobby-screen { padding: var(--s6) var(--s4); }
}

/* Stone Ford, drawn (stone-ford-map.mjs). */
.lobby-map { margin: 0; display: grid; gap: var(--s2); justify-items: center; }
.lobby-map svg { width: min(100%, 26rem); height: auto; filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.45)); }
.lobby-map figcaption { color: var(--text-400); font-size: 0.84em; text-align: center; }
.stone-ford-map .sf-label {
  font-size: 5.2px;
  letter-spacing: 0.7px;
  fill: #f3f2ec;
  paint-order: stroke;
  stroke: #0e1313;
  stroke-width: 1.6px;
  stroke-linejoin: round;
}
.stone-ford-map .sf-army-label {
  font-size: 6px;
  font-weight: 600;
  letter-spacing: 0.4px;
  paint-order: stroke;
  stroke: #0e1313;
  stroke-width: 1.8px;
  stroke-linejoin: round;
}
.stone-ford-map .sf-you-ring { transform-box: fill-box; transform-origin: center; animation: sf-pulse 1.8s ease-out infinite; }
@keyframes sf-pulse {
  0% { opacity: 0.9; transform: scale(0.7); }
  100% { opacity: 0; transform: scale(1.5); }
}

/* Draft: the kinds on offer as cards, then the army as rows (the table
   keeps its semantics) and the running points total. Text stays at or
   above 14 px. */
.draft-kinds { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); }
.kind-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  gap: var(--s1) var(--s2);
  padding: var(--s3);
  border-radius: calc(6px * var(--scale));
  border-left: calc(3px * var(--scale)) solid rgba(243, 242, 236, 0.12);
  background: rgba(243, 242, 236, 0.04);
}
.kind-card[data-used="true"] { border-left-color: var(--capture-400); background: rgba(82, 207, 164, 0.07); }
.kind-card .kind-name { font-weight: 600; }
.kind-card .kind-points { color: var(--capture-400); font-size: 0.875em; white-space: nowrap; align-self: baseline; font-variant-numeric: tabular-nums; }
.kind-card .kind-note { grid-column: 1 / -1; color: var(--text-400); font-size: 0.875em; line-height: 1.35; }
.draft-army { width: 100%; border-collapse: separate; border-spacing: 0 var(--s2); font-size: 0.94em; }
.draft-army thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.draft-army tbody tr { background: rgba(243, 242, 236, 0.04); }
.draft-army td { padding: var(--s3); vertical-align: middle; }
.draft-army td:first-child { border-radius: calc(6px * var(--scale)) 0 0 calc(6px * var(--scale)); width: 40%; }
.draft-army td:last-child { border-radius: 0 calc(6px * var(--scale)) calc(6px * var(--scale)) 0; }
.draft-army input { width: 100%; max-width: 16em; font-weight: 600; }
.draft-army select { width: 100%; max-width: 15em; min-height: calc(40px * var(--scale)); cursor: pointer; }
.draft-army .draft-name { font-weight: 600; }
.draft-army .draft-kind { color: var(--capture-400); }
.draft-army .draft-points { width: 5em; text-align: right; color: var(--text-400); white-space: nowrap; font-variant-numeric: tabular-nums; }.draft-meter { display: grid; gap: var(--s2); }
.draft-meter-text { font-weight: 600; }
.draft-meter[data-state="over"] .draft-meter-text { color: #f0a197; }
.draft-meter-bar { display: block; height: calc(6px * var(--scale)); border-radius: calc(3px * var(--scale)); background: rgba(243, 242, 236, 0.08); overflow: hidden; }
.draft-meter-bar span { display: block; height: 100%; background: var(--capture-400); transition: width 180ms ease; }
.draft-meter[data-state="over"] .draft-meter-bar span { background: var(--danger-500); }
.draft-roster-who { display: grid; gap: 2px; min-width: 0; }
.draft-roster-kinds { color: var(--text-400); font-size: 0.875em; }
.draft-hint { color: var(--text-400); font-size: 0.9em; }
@media (max-width: 760px) {
  .draft-kinds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.deploy-sectors { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.deploy-sectors li { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); border-radius: calc(4px * var(--scale)); background: rgba(243, 242, 236, 0.04); }
.deploy-sectors li[data-mine="true"] { outline: 1px solid var(--capture-400); }
.deploy-sectors .seat-stage { color: var(--capture-400); }

.aftermath-log { width: 100%; border-collapse: collapse; font-size: 0.92em; }
.aftermath-log th, .aftermath-log td { text-align: left; padding: var(--s2); border-bottom: 1px solid rgba(243, 242, 236, 0.08); vertical-align: top; }
.aftermath-log th { color: var(--text-400); font-weight: 600; letter-spacing: 0.06em; }

/* Aftermath verdict. */
.aftermath-verdict { display: grid; gap: var(--s2); padding: var(--s6); border-radius: calc(6px * var(--scale)); background: rgba(243, 242, 236, 0.04); text-align: center; }
.aftermath-verdict-word { font-size: 2.6em; letter-spacing: 0.18em; text-transform: uppercase; line-height: 1; }
.aftermath-verdict[data-result="victory"] .aftermath-verdict-word { color: var(--capture-400); }
.aftermath-verdict[data-result="defeat"] .aftermath-verdict-word { color: var(--danger-500); }
.aftermath-verdict[data-result="draw"] .aftermath-verdict-word { color: var(--warning-500); }
.aftermath-endings { list-style: none; margin: 0 auto; padding: 0; display: grid; gap: var(--s1); color: var(--text-400); }
.aftermath-squads { margin: 0; color: var(--text-400); }
.lobby-share-folded summary { cursor: pointer; color: var(--text-400); padding: var(--s3) 0; }
.lobby-share-folded[open] summary { margin-bottom: var(--s2); }
.aftermath-stats { list-style: none; margin: var(--s2) 0 0; padding: 0; display: flex; justify-content: center; gap: var(--s8); }
.aftermath-stats li { display: grid; gap: 2px; }
.aftermath-stats strong { font-size: 1.6em; }
.aftermath-stats span { color: var(--text-400); font-size: 0.78em; letter-spacing: 0.12em; text-transform: uppercase; }
