/* ===== AIWW3 — Inference Surface =====
   This is not a war-game HUD. It is instrumentation for watching machines
   decide, so the interface reads as telemetry a human has been allowed to
   observe rather than a cockpit a human flies.

   Amber is gone deliberately: amber-on-navy is CRT phosphor, and a 1980s
   signal is the one thing a 2050 war cannot look like. The void goes colder
   and violet-biased, and the accents stop being decoration — each of the
   three carries a job, so colour on this page always means something:

     ion    violet   authority — an agent acting, or an action you may take
     flux   cyan     telemetry — live state, and every number on the screen
     pulse  magenta  contact   — attacks, losses, anything adversarial     */
:root {
  --void: #04050c;
  --void2: #080b18;
  --panel: rgba(12, 16, 34, 0.55);
  --panel-solid: #0a0e1e;
  --line: rgba(116, 104, 220, 0.18);
  --line-strong: rgba(150, 154, 255, 0.36);
  --ink: #e9edff;
  --muted: #737fb0;

  --ion: #7c5cff;
  --ion-dim: rgba(124, 92, 255, 0.15);
  --flux: #2de2e6;
  --pulse: #ff2e88;
  --ok: #2bf0a8;

  /* Surface kit. Panels are cut, not rounded — a chamfer reads machined where
     a radius reads soft, and it replaces the corner-bracket device that every
     sci-fi dashboard already uses. */
  --notch: 11px;
  --chamfer: polygon(var(--notch) 0, 100% 0, 100% calc(100% - var(--notch)), calc(100% - var(--notch)) 100%, 0 100%, 0 var(--notch));

  --mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", monospace;
  --display: "Bahnschrift", "DIN Alternate", "Oswald", "Segoe UI Semibold", system-ui, sans-serif;
  --body: "Segoe UI", Roboto, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
/* The void is lit from two directions and ruled by a faint 34px lattice. The
   grid is the reason the dark reads as engineered space rather than empty
   space — it gives every panel something to sit on. */
body {
  font-family: var(--body); color: var(--ink);
  background:
    linear-gradient(rgba(124,92,255,0.045) 1px, transparent 1px) 0 0 / 100% 34px,
    linear-gradient(90deg, rgba(124,92,255,0.045) 1px, transparent 1px) 0 0 / 34px 100%,
    radial-gradient(1100px 700px at 78% -12%, #241a5e 0%, transparent 58%),
    radial-gradient(900px 600px at 10% 110%, #06263a 0%, transparent 52%),
    var(--void);
  overflow: hidden;
}
b { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.eyebrow { font-family: var(--display); font-size: 11px; letter-spacing: 3px; text-transform: uppercase; color: var(--muted); margin: 0; }

#app { display: flex; flex-direction: column; height: 100vh; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 22px; padding: 10px 20px;
  background: linear-gradient(180deg, rgba(8,14,28,0.96), rgba(8,14,28,0.55));
  border-bottom: 1px solid var(--line); z-index: 6;
}
.brand { display: flex; align-items: center; gap: 12px; background: none; border: none; padding: 0; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.brand:hover .logo { color: var(--flux); }
.brand:focus-visible { outline: 2px solid var(--flux); outline-offset: 4px; }
.brand-txt { display: flex; flex-direction: column; gap: 2px; }
.logo { font-size: 22px; color: var(--ion); filter: drop-shadow(0 0 12px rgba(124,92,255,0.55)); transition: color .15s; }
.brand-name { font-family: var(--display); font-size: 24px; letter-spacing: 6px; font-weight: 800; color: var(--ink); line-height: 1; }
.tag { margin: 0; font-size: 10px; color: var(--muted); letter-spacing: 2px; }

.status { display: flex; align-items: center; gap: 14px; }
.round { font-family: var(--display); font-size: 12px; letter-spacing: 2px; color: var(--muted); }
.round b { font-family: var(--mono); color: var(--flux); font-size: 16px; }
.phase { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 2px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 20px; color: var(--flux); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--pulse); box-shadow: 0 0 9px currentColor; }
.dot.on { background: var(--ok); }
.dot.off { background: var(--pulse); }

.controls { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.btn { font: inherit; font-size: 13px; cursor: pointer; color: var(--ink); background: rgba(28,40,68,0.5); border: 1px solid var(--line); padding: 8px 14px; border-radius: 3px; transition: all .14s; }
.btn:hover:not(:disabled) { border-color: var(--line-strong); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn.primary { background: var(--ion); color: #080b18; font-weight: 700; border: 1px solid transparent; }
.btn.primary:hover:not(:disabled) { box-shadow: 0 0 18px rgba(124,92,255,0.5); }
.btn.ghost { background: rgba(20,30,52,0.42); }
.btn.ghost:hover:not(:disabled) { border-color: var(--flux); color: var(--flux); }
.btn.danger { background: rgba(80,20,35,0.5); border-color: rgba(255,46,136,0.42); color: #ffc2da; }
.btn.danger:hover:not(:disabled) { border-color: var(--pulse); box-shadow: 0 0 16px rgba(255,46,136,0.45); }
.btn.sm { padding: 6px 12px; font-size: 12px; }
.btn.xs { padding: 4px 9px; font-size: 11px; }
input[type="range"] { accent-color: var(--flux); }

/* ===================== SIGNATURE — the carrier =====================
   Nothing in AIWW3 happens except because two machines are talking, so the
   interface carries a signal line of its own. At rest it drifts; the moment an
   agent begins deliberating it accelerates and takes that faction's colour.
   It is a readout, not trim: if the carrier is running, something is thinking,
   and you can tell from the chrome alone with every panel closed. */
.carrier { position: relative; flex: none; height: 2px; overflow: hidden; z-index: 6; background: rgba(116,104,220,0.13); }
.carrier-wave {
  position: absolute; top: 0; bottom: 0; left: 0; width: 38%;
  background: linear-gradient(90deg, transparent, var(--carrier-c, var(--ion)) 45%, var(--flux) 75%, transparent);
  filter: drop-shadow(0 0 7px var(--carrier-c, var(--ion)));
  animation: carrier 7.5s cubic-bezier(.55,0,.45,1) infinite;
}
/* Deliberating: the same wave, four times the urgency. */
.carrier.is-live .carrier-wave { animation-duration: 1.25s; }
@keyframes carrier { from { transform: translateX(-105%); } to { transform: translateX(365%); } }

/* ---------- stage ---------- */
.stage { position: relative; flex: 1; overflow: hidden; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.hud { position: absolute; top: 14px; right: 14px; width: 306px; display: flex; flex-direction: column; gap: 12px; z-index: 4; max-height: calc(100% - 28px); }
/* Panels are cut sheets of backlit glass: two opposite corners chamfered, a
   hairline edge, and an inset highlight along the top so the surface catches
   light from the same direction as the void behind it. The old corner
   brackets are gone — they are the most-copied sci-fi device there is. */
.panel {
  position: relative; background: var(--panel); backdrop-filter: blur(14px) saturate(1.25);
  border: 1px solid var(--line); border-radius: 0; padding: 13px 15px;
  clip-path: var(--chamfer);
  box-shadow: 0 8px 40px rgba(0,0,0,0.45), inset 0 1px 0 rgba(170,180,255,0.10);
}
/* The cut edge, drawn as a lit hairline so the chamfer reads as a machined
   bevel rather than a missing corner. */
.panel::after {
  content: ""; position: absolute; right: -1px; bottom: -1px;
  width: calc(var(--notch) * 1.42); height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--flux));
  opacity: .5; transform-origin: 100% 50%; transform: rotate(-45deg) translateX(-1px);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; font-family: var(--display); font-size: 12px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.panel-head:hover { color: var(--flux); }
.chev { font-size: 11px; transition: transform .18s; }
.panel.collapsed .panel-head { margin-bottom: 0; }
.panel.collapsed .panel-body { display: none; }
.panel.collapsed .chev { transform: rotate(-90deg); }

.factions ul, .feed ul, .chat ul { list-style: none; margin: 0; padding: 0; }
.factions li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(116,104,220,0.12); }
.factions li:last-child { border-bottom: none; }
.factions li.active { background: rgba(45,226,230,0.08); border-radius: 4px; padding-left: 6px; margin-left: -6px; box-shadow: inset 2px 0 0 var(--flux); }
.factions li.dead { opacity: .32; }
.factions li.dead .f-name { text-decoration: line-through; }
.swatch { width: 12px; height: 12px; border-radius: 2px; box-shadow: 0 0 8px currentColor; flex: none; }
.f-main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.f-name { font-size: 13px; font-weight: 600; }
.f-model { font-family: var(--mono); font-size: 10px; color: var(--muted); display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f-model.llm { color: var(--flux); }
.f-host { color: var(--muted); opacity: .7; }
.f-stats { text-align: right; font-family: var(--mono); font-size: 11px; color: var(--muted); flex: none; }
.f-stats b { color: var(--ink); font-size: 13px; }
.f-missiles { color: var(--ion); }
.f-missiles.zero { opacity: .3; }
.f-sub { font-size: 10px; color: var(--muted); }
.prov-tag { font-family: var(--mono); font-size: 9px; padding: 1px 5px; border-radius: 3px; border: 1px solid var(--line); color: var(--muted); }

.feed { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.feed:not(.collapsed) .panel-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.feed ul { overflow-y: auto; flex: 1; }
.feed.collapsed { flex: 0 0 auto; }
.feed li { font-size: 12px; padding: 5px 0; border-bottom: 1px solid rgba(116,104,220,0.10); line-height: 1.4; }
.feed li.big { font-size: 13px; }
.feed .who { font-weight: 700; }
.feed li b { font-variant-numeric: tabular-nums; }

.chat .panel-body { max-height: 190px; overflow: hidden; display: flex; flex-direction: column; }
.chat ul { overflow-y: auto; }
.chat li { font-size: 12px; padding: 6px 9px; margin-bottom: 6px; border-radius: 3px; background: rgba(30,44,80,0.4); border-left: 3px solid var(--muted); line-height: 1.35; }
.chat li .who { font-weight: 700; font-size: 11px; display: block; margin-bottom: 1px; }
.chat li .msg { color: #eef3ff; }
.chat li.empty { background: none; border: none; color: var(--muted); font-style: italic; }
.chat-badge { display: inline-block; min-width: 15px; height: 15px; line-height: 15px; text-align: center; font-family: var(--mono); font-size: 10px; border-radius: 8px; background: var(--ion); color: #080b18; padding: 0 4px; margin-left: 4px; }
.chat-badge:empty { display: none; }
.feed ul::-webkit-scrollbar, .chat ul::-webkit-scrollbar { width: 6px; }
.feed ul::-webkit-scrollbar-thumb, .chat ul::-webkit-scrollbar-thumb { background: rgba(116,104,220,0.32); border-radius: 3px; }

/* thinking indicator */
.thinking { position: absolute; bottom: 20px; left: 20px; z-index: 4; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 10px 16px; font-size: 13px; display: flex; align-items: center; gap: 10px; backdrop-filter: blur(12px); max-width: 46%; }
.thinking .spin { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--ion); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.thinking .narr { color: var(--muted); font-style: italic; margin-top: 2px; }

/* victory banner */
.banner { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; z-index: 8; background: rgba(4,7,16,0.74); backdrop-filter: blur(4px); }
.banner h2 { font-family: var(--display); font-size: 56px; letter-spacing: 8px; margin: 0; text-shadow: 0 0 34px currentColor; }
.banner p { font-family: var(--mono); color: var(--muted); letter-spacing: 4px; margin-top: 8px; }
.banner button { margin-top: 24px; }

/* countdown / room pre-game overlay */
/* staging screen — the theatre stays dark until the war is live */
.staging { flex: 1; display: flex; align-items: center; justify-content: center; padding: 30px; }
.cd-host { display: flex; align-items: center; justify-content: center; }
.cd-inner { text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 34px 46px; min-width: 340px; box-shadow: 0 20px 70px rgba(0,0,0,0.5); }
.cd-inner h2 { font-family: var(--display); letter-spacing: 3px; margin: 0 0 14px; }
.cd-num { font-family: var(--mono); font-size: 78px; font-weight: 700; color: var(--ion); line-height: 1; text-shadow: 0 0 30px rgba(124,92,255,0.45); }
.cd-wait { font-family: var(--display); font-size: 22px; letter-spacing: 2px; color: var(--flux); }
.cd-seats { display: flex; flex-direction: column; gap: 8px; margin: 20px 0 8px; }
.cd-seat { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); text-align: left; }
.cd-seat.filled { color: var(--ink); border-color: var(--line-strong); }

/* ---------- arena lobby ---------- */
.lobby { flex: 1; overflow-y: auto; padding: 28px 40px 40px; }
.lobby-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding-bottom: 20px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.lobby-head h2 { font-family: var(--display); font-size: 34px; letter-spacing: 3px; margin: 4px 0 0; }
.identity { display: flex; align-items: center; gap: 12px; }
.identity .who { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.identity .who b { color: var(--flux); }

/* ---------- admin ---------- */
.admin-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.admin-row { border: 1px solid var(--line); border-left-width: 2px; border-radius: 6px; padding: 12px 14px; background: rgba(11,18,32,0.5); }
.admin-row.is-root { border-left-color: var(--ion); }
.admin-row.invite.dead { opacity: .55; }
.admin-row.invite.live { border-left-color: var(--ok); }
.ar-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ar-name { font-size: 14px; font-weight: 600; }
.ar-code { font-family: var(--mono); font-size: 14px; color: var(--flux); letter-spacing: 1px; }
.ar-meta { flex: 1; min-width: 0; }
.ar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.swatch.sm { width: 9px; height: 9px; }
.recent-head { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.recent-head.hidden { display: none; }
.rp-scrub { width: 200px; accent-color: var(--flux); cursor: pointer; }
#replay-controls { gap: 10px; }
#rp-pos { min-width: 150px; }
.admin-row.match { border-left-color: var(--line-strong); }
.admin-row.match .ar-head + .ar-head { margin-top: 3px; }
.tag { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; padding: 2px 7px; border-radius: 20px; border: 1px solid var(--line); color: var(--muted); }
.tag.root { color: var(--ion); border-color: var(--ion); }
.tag.admin { color: var(--pulse); border-color: var(--pulse); }
.tag.live { color: var(--ok); border-color: var(--ok); }
.tag.dead { color: var(--muted); }
.tog { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink); cursor: pointer; }
.tog input { accent-color: var(--flux); cursor: pointer; }
.tog input:disabled { cursor: not-allowed; opacity: .5; }
.tog:has(input:disabled) { color: var(--muted); cursor: not-allowed; }

/* ---------- login / register ---------- */
.auth-wrap { max-width: 380px; margin: 6vh auto 0; }
.auth-wrap h2 { margin: 2px 0 6px; font-family: var(--display); font-size: 26px; letter-spacing: 2px; }
.auth-form { margin-top: 22px; }
.auth-form .field input { width: 100%; }
.auth-form .drawer-actions { margin-top: 18px; justify-content: space-between; }
.auth-error { font-size: 12.5px; color: var(--pulse); border-left: 2px solid var(--pulse); padding: 6px 0 6px 10px; margin: 12px 0 0; background: rgba(255,46,136,0.08); }
.auth-error.hidden { display: none; }

.lobby-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 26px; max-width: 1180px; }
.lobby-col { }
.col-head { display: flex; align-items: center; justify-content: space-between; }
.col-head h3 { font-family: var(--display); font-size: 18px; letter-spacing: 2px; text-transform: uppercase; margin: 0; }
.col-sub { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 6px 0 16px; }

.commander-list, .room-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.empty { color: var(--muted); font-style: italic; font-size: 13px; padding: 18px; border: 1px dashed var(--line); border-radius: 6px; text-align: center; }

.commander { position: relative; border: 1px solid var(--line); border-radius: 5px; padding: 14px 16px; background: rgba(11,18,32,0.6); }
.commander .c-main { display: flex; align-items: center; gap: 10px; }
.commander .c-main b { font-size: 15px; }
.c-tag { font-family: var(--mono); font-size: 10px; padding: 2px 7px; border-radius: 3px; border: 1px solid var(--line); color: var(--muted); }
.c-tag.llm { color: var(--flux); border-color: var(--flux); }
.c-brief { font-size: 12px; color: var(--muted); font-style: italic; margin: 8px 0 0; line-height: 1.45; }
.c-warn { font-size: 12px; color: var(--pulse); margin: 8px 0 0; line-height: 1.4; }
.c-warn-soft { color: #d4a017; margin: 6px 0 0; }
input.bad-key { border-color: var(--pulse) !important; box-shadow: 0 0 0 2px rgba(255,46,136,0.2) !important; }
input.bad-key::placeholder { color: var(--pulse); opacity: .9; }
.c-actions { display: flex; gap: 8px; margin-top: 12px; }

/* Cards are cut from the same sheet as .panel — one surface language, so a
   room card and a HUD panel are recognisably the same material. */
.room-card { position: relative; border: 1px solid var(--line); border-left: 3px solid var(--muted); border-radius: 0; clip-path: var(--chamfer); padding: 14px 16px 15px; background: rgba(11,16,34,0.62); }
.room-card.status-waiting { border-left-color: var(--muted); }
.room-card.status-countdown { border-left-color: var(--ion); box-shadow: 0 0 22px rgba(124,92,255,0.18); }
.room-card.status-running { border-left-color: var(--flux); }
.room-card.status-done { border-left-color: var(--pulse); opacity: .8; }
.rc-head { display: flex; align-items: center; justify-content: space-between; }
.rc-head b { font-size: 16px; }
.rc-status { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); }
.status-countdown .rc-status { color: var(--ion); }
.status-running .rc-status { color: var(--flux); }
.rc-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); margin: 5px 0 12px; }
.rc-seats { display: flex; gap: 7px; margin-bottom: 12px; }
.seat { width: 20px; height: 20px; border-radius: 3px; border: 1px dashed var(--line-strong); background: transparent; }
.seat.filled { border: 1px solid transparent; background: var(--c); box-shadow: 0 0 8px var(--c); }
.seat.bot { opacity: .55; }
/* Who holds the seats, in words. The dots carry colour and count; these carry
   identity, so you can read a room without hovering every square. */
.rc-roster { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.rc-who {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .3px; line-height: 1;
  padding: 5px 8px; border-radius: 3px; color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  background: color-mix(in srgb, var(--c) 12%, transparent);
}
.rc-who.bot { color: var(--muted); border-style: dashed; opacity: .8; }
.rc-who.you { color: var(--c); border-color: var(--c); font-weight: 700; box-shadow: 0 0 10px -2px var(--c); }
.rc-who.empty { border: 1px dashed var(--line-strong); background: none; color: var(--muted); }
.rc-actions { display: flex; gap: 8px; }

/* ---------- modals ---------- */
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-head h2 { margin: 0; font-family: var(--display); font-size: 18px; letter-spacing: 1.5px; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 14px 0; }
.mini { font-size: 11px; color: var(--muted); line-height: 1.45; margin: 0 0 12px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.seg button { font: inherit; font-family: var(--mono); font-size: 13px; font-weight: 700; cursor: pointer; color: var(--muted); background: transparent; border: none; padding: 6px 15px; transition: all .12s; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--flux); color: #04121b; }

.field { margin-bottom: 10px; }
.field label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; letter-spacing: .4px; }
.field input, .field select, .field textarea { width: 100%; font: inherit; font-size: 13px; color: var(--ink); background: rgba(5,7,18,0.82); border: 1px solid var(--line); border-radius: 3px; padding: 9px 11px; }
.field textarea { resize: vertical; min-height: 54px; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--flux); box-shadow: 0 0 0 2px rgba(45,226,230,0.18); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* A checkbox field lays its label out beside the box; without this the generic
   .field rules stretch the input to the full width of the modal. */
.field.check label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink); cursor: pointer; }
.field.check input { width: auto; accent-color: var(--flux); }
.field label b { color: var(--flux); font-family: var(--mono); }
.drawer-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

.modal { position: fixed; inset: 0; z-index: 22; display: flex; align-items: center; justify-content: center; background: rgba(2,4,10,0.7); backdrop-filter: blur(4px); }
.modal-inner { width: 640px; max-width: 92vw; max-height: 84vh; overflow-y: auto; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 0; clip-path: var(--chamfer); padding: 24px; box-shadow: 0 20px 80px rgba(0,0,0,0.65); }
.modal-inner.narrow { width: 460px; }
.rules-text { white-space: pre-wrap; font-family: var(--body); font-size: 13px; line-height: 1.6; color: var(--ink); margin: 12px 0 0; }

@media (max-width: 900px) { .lobby-grid { grid-template-columns: 1fr; } .hud { width: 260px; } }

/* ===================== HOME — the machine writes the history =====================
   Signature: the 2050 history types itself out in monospace with a live cursor.
   Everything else on this screen stays deliberately quiet. */
.home { flex: 1; overflow-y: auto; display: flex; justify-content: center; padding: 6vh 32px 40px; }
.home-inner { width: 100%; max-width: 860px; position: relative; }
.transmission { color: var(--flux); margin-bottom: 26px; }
.transmission::before { content: "▚ "; opacity: .7; }

.lore { font-family: var(--mono); font-size: 15px; line-height: 1.85; color: var(--ink); min-height: 40vh; }
.lore p { margin: 0 0 16px; }
/* the opening line carries the year — give it weight */
.lore p.lead { font-family: var(--display); font-size: clamp(30px, 5vw, 52px); line-height: 1.1; letter-spacing: 1px; color: #fff; margin-bottom: 22px; }
.lore p.verdict { color: var(--ion); border-left: 2px solid var(--ion); padding-left: 16px; }
.lore .cursor { display: inline-block; width: 9px; height: 1.05em; background: var(--flux); vertical-align: -0.18em; animation: blink 1s steps(2, start) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.theatres { margin-top: 42px; padding-top: 26px; border-top: 1px solid var(--line); animation: rise .5s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.theatre-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 14px; }
.theatre {
  display: flex; flex-direction: column; gap: 7px; text-align: left; cursor: pointer;
  background: rgba(11,18,32,0.66); border: 1px solid var(--line); border-left: 3px solid var(--muted);
  border-radius: 5px; padding: 20px; color: var(--ink); font: inherit; transition: border-color .16s, transform .16s, box-shadow .16s;
}
.theatre:hover, .theatre:focus-visible { border-color: var(--line-strong); border-left-color: var(--ion); transform: translateY(-2px); box-shadow: 0 12px 34px rgba(0,0,0,0.4); outline: none; }
.t-kicker { font-family: var(--mono); font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--flux); }
.t-name { font-family: var(--display); font-size: 24px; letter-spacing: 2px; }
.t-desc { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.t-go { font-family: var(--mono); font-size: 11px; color: var(--ion); margin-top: 4px; }

.skip { position: absolute; top: 0; right: 0; font-family: var(--mono); font-size: 11px; color: var(--muted); background: none; border: none; cursor: pointer; letter-spacing: 1px; }
.skip:hover { color: var(--flux); }
.skip.hidden { display: none; }

/* ===================== ROSTERS ===================== */
.mono-note { font-family: var(--mono); font-size: 11px; color: var(--muted); }

@media (max-width: 860px) {
  .theatre-grid { grid-template-columns: 1fr; }
  .lobby-head { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .lore .cursor { animation: none; }
  .theatres { animation: none; }
  .theatre:hover { transform: none; }
}

/* the faction this human commands, in an arena room */
.factions li.mine .f-name::after {
  content: "YOU";
  font-family: var(--mono); font-size: 9px; letter-spacing: 1px;
  color: #080b18; background: var(--ion);
  border-radius: 3px; padding: 1px 4px; margin-left: 6px; vertical-align: 1px;
}
.seg button:disabled { opacity: .3; cursor: not-allowed; }
.seg button:disabled:hover { color: var(--muted); }

/* Capitulated: still on the board (unlike .dead) but out of the war. */
.factions li.surrendered { opacity: .55; }
.factions li.surrendered .f-name::before {
  content: "⚐ ";
  color: var(--muted);
}
.factions li.surrendered .f-model { color: var(--muted); }

/* Token spend on the faction card. A dash means "not measurable here" (a remote
   A2A agent bills its own key), which is deliberately not the same as zero. */
.f-tokens { color: var(--flux); font-family: var(--mono); font-size: 10px; margin-left: 6px; }
.f-tokens.unmetered { color: var(--muted); }
.f-tokens.partial::after { content: "+"; opacity: .7; }

/* ===================== quality floor =====================
   Keyboard focus is visible everywhere, in the authority colour so it reads as
   "you can act here". Motion is a preference, and the carrier is the loudest
   thing on the page — it settles to a static glow rather than disappearing, so
   the "something is thinking" signal survives with the animation switched off. */
:where(button, a, input, select, textarea):focus-visible {
  outline: 2px solid var(--ion); outline-offset: 3px; border-radius: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
  .carrier-wave { position: absolute; inset: 0; width: 100%; transform: none; opacity: .45; }
  .carrier.is-live .carrier-wave { opacity: 1; }
}
