/* Ballistic Tycoon — war-room console. Deliberately single-theme (dark phosphor display). */
:root {
  --ground: #070c15;
  --panel: #0d1524;
  --panel-2: #111c2e;
  --line: #1c2a40;
  --line-2: #27395a;
  --ink: #e4e9f2;
  --ink-2: #93a0b8;
  --ink-3: #5c6a84;
  --phos: #34dfb6;
  --phos-dim: rgba(52, 223, 182, 0.14);
  --amber: #f2b13a;
  --amber-dim: rgba(242, 177, 58, 0.16);
  --red: #ff4f5e;
  --red-dim: rgba(255, 79, 94, 0.16);
  --display: "Oswald", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --body: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.45;
  min-height: 100vh;
}
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 500; text-wrap: balance; }
h2 {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible, canvas:focus-visible,
.chip:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

#app {
  display: grid;
  grid-auto-rows: auto;
  align-content: start;
  min-height: 100vh;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #0b1322, var(--ground));
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand-mark {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--amber);
  box-shadow: 0 0 0 3px var(--amber-dim), 0 0 14px var(--amber);
  align-self: center;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 5px var(--amber-dim), 0 0 22px var(--amber); } }
.brand h1 { font-size: 21px; letter-spacing: 0.09em; text-transform: uppercase; white-space: nowrap; }
@media (max-width: 980px) { .brand h1 { font-size: 17px; } .brand .tag { display: none; } }
.tag { font-family: var(--mono); font-size: 11px; color: var(--ink-3); letter-spacing: 0.04em; }

.status { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 64px; }
.lbl {
  font-family: var(--display); font-size: 10px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--ink-3);
}
.val { font-family: var(--mono); font-size: 18px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.val.cr { color: var(--amber); }
.sub { font-family: var(--mono); font-size: 10px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.name {
  background: transparent; border: 0; border-bottom: 1px dashed var(--line-2);
  color: var(--ink); font-family: var(--mono); font-size: 16px; width: 150px; padding: 0 0 1px;
}
.stat.xp { min-width: 160px; }
.bar { height: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.bar > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--phos), #8ff0d6); transition: width 0.5s ease; }
.icon {
  background: var(--panel); border: 1px solid var(--line-2); color: var(--ink-2);
  width: 34px; height: 34px; border-radius: 4px; font-size: 16px;
}
.icon.off { color: var(--ink-3); text-decoration: line-through; }

/* ---------- Console ---------- */
.console {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 12px;
  padding: 12px 18px;
  align-items: start;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Assembly bay */
.slots { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.slot-head { display: block; margin-bottom: 5px; min-width: 0; }
.slot-head .lbl { color: var(--phos); display: block; }
.slot-head .cur {
  display: block; font-family: var(--mono); font-size: 11px; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.chip {
  text-align: left; padding: 6px 8px; border-radius: 3px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
  display: flex; flex-direction: column; gap: 2px; min-height: 52px;
  transition: border-color 0.15s, background 0.15s;
}
.chip:hover:not(:disabled) { border-color: var(--line-2); background: #15223a; }
.chip.on { border-color: var(--phos); background: var(--phos-dim); }
.chip:disabled { cursor: not-allowed; opacity: 0.45; }
.chip .nm {
  font-family: var(--display); font-size: 13px; letter-spacing: 0.03em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.chip .st {
  font-family: var(--mono); font-size: 10px; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.chip .st.dim { color: var(--ink-3); }
.chip .st b { color: var(--amber); font-weight: 500; }
.chip .lock { color: var(--red); white-space: nowrap; }

.readout, .record {
  margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px;
  font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums;
}
.readout dt, .record dt { color: var(--ink-3); }
.readout dd, .record dd { margin: 0; text-align: right; }
.readout dd.total { color: var(--amber); }
.flavor { font-size: 12px; color: var(--ink-2); font-style: italic; margin: 8px 0 0; min-height: 34px; }

/* Map */
.mapwrap {
  position: sticky;
  top: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  min-width: 0;
}
.map-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 6px 12px; border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; color: var(--ink-2);
}
.defcon { color: var(--ink-3); letter-spacing: 0.1em; }
.defcon b { color: var(--phos); font-weight: 500; }
.defcon.hot b { color: var(--red); }
.hint { flex: 1; text-align: center; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coords { color: var(--ink-3); min-width: 130px; text-align: right; font-variant-numeric: tabular-nums; }
canvas#map { display: block; width: 100%; height: auto; cursor: crosshair; }
canvas#map.city { cursor: pointer; }

.telemetry[hidden] { display: none; }
.telemetry {
  position: absolute; left: 12px; bottom: 12px;
  background: rgba(7, 12, 21, 0.86); border: 1px solid var(--line-2); border-radius: 3px;
  padding: 8px 12px; font-family: var(--mono); font-size: 11px; color: var(--phos);
  display: grid; grid-template-columns: auto auto; gap: 2px 14px; font-variant-numeric: tabular-nums;
  backdrop-filter: blur(3px);
}
.telemetry span:nth-child(odd) { color: var(--ink-3); }
.telemetry .phase { color: var(--amber); grid-column: 1 / -1; letter-spacing: 0.14em; }

/* Launch control */
select {
  width: 100%; background: var(--panel-2); color: var(--ink); border: 1px solid var(--line-2);
  border-radius: 3px; padding: 7px 8px; font-family: var(--mono); font-size: 12px; margin-bottom: 10px;
}
.target {
  border: 1px dashed var(--line-2); border-radius: 3px; padding: 10px; margin-bottom: 10px;
  min-height: 132px; font-size: 12px;
}
.target .empty { color: var(--ink-3); font-style: italic; }
.target h3 { font-size: 20px; letter-spacing: 0.04em; line-height: 1.1; }
.target .meta { font-family: var(--mono); font-size: 11px; color: var(--ink-2); margin-bottom: 8px; }
.target .kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-family: var(--mono); font-size: 11px; font-variant-numeric: tabular-nums; }
.target .kv span:nth-child(odd) { color: var(--ink-3); }
.target .kv span:nth-child(even) { text-align: right; }
.target .ok { color: var(--phos); }
.target .warn { color: var(--amber); }
.target .bad { color: var(--red); }
.hp { height: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 2px; overflow: hidden; margin: 6px 0 8px; }
.hp > div { height: 100%; background: var(--phos); transition: width 0.4s; }
.hp.mid > div { background: var(--amber); }
.hp.low > div { background: var(--red); }
.hp.struct { height: 4px; margin: 0 0 8px; opacity: 0.85; }
.hp.struct > div { background: var(--ink-2); }
.hp.struct.mid > div { background: var(--amber); }
.hp.struct.low > div { background: var(--red); }

.launch {
  width: 100%; padding: 14px; margin-bottom: 14px;
  font-family: var(--display); font-size: 22px; letter-spacing: 0.3em; text-transform: uppercase;
  background: var(--amber); color: #1a1204; border: 0; border-radius: 3px;
  box-shadow: 0 0 0 1px #c98d1f inset, 0 0 18px rgba(242, 177, 58, 0.35);
  transition: transform 0.08s, filter 0.15s;
}
.launch:hover:not(:disabled) { filter: brightness(1.08); }
.launch:active:not(:disabled) { transform: translateY(1px); }
.launch:disabled { background: var(--panel-2); color: var(--ink-3); box-shadow: none; cursor: not-allowed; }
.launch.armed { animation: arm 1.2s ease-in-out infinite; }
@keyframes arm { 50% { box-shadow: 0 0 0 1px #c98d1f inset, 0 0 30px rgba(242, 177, 58, 0.7); } }

.missions { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.missions li {
  display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 8px; align-items: start;
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel-2); font-size: 12px;
}
.missions li .box { width: 12px; height: 12px; border: 1px solid var(--ink-3); border-radius: 2px; margin-top: 3px; }
.missions li.done { opacity: 0.55; }
.missions li.done .box { background: var(--phos); border-color: var(--phos); }
.missions li .ttl { font-family: var(--display); font-size: 13px; letter-spacing: 0.03em; }
.missions li .dsc { color: var(--ink-2); font-size: 11px; }
.missions li .rw { font-family: var(--mono); font-size: 11px; color: var(--amber); white-space: nowrap; }

.ghost {
  margin-top: 12px; background: transparent; border: 1px solid var(--line); color: var(--ink-3);
  border-radius: 3px; padding: 6px; font-size: 11px;
}
.ghost:hover { color: var(--red); border-color: var(--red); }

/* Comms feed: the newest three lines, under the title bar */
.log { padding: 0 18px 16px; }
.log.feed {
  display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 4px 14px;
  margin: 0 18px 8px; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
}
.log.feed h2 { margin: 2px 0 0; padding: 0; border: 0; font-size: 10.5px; }
.log.feed ul { margin: 0; padding: 0; height: auto; min-height: 52px; max-height: 42vh; background: none; border: 0; border-radius: 0; }
.log-more {
  background: transparent; border: 1px solid var(--line); color: var(--ink-3); border-radius: 3px;
  padding: 3px 9px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
}
.log-more:hover { color: var(--phos); border-color: var(--phos); }
@media (max-width: 640px) {
  .log.feed { grid-template-columns: 1fr auto; margin: 0 10px 8px; }
  .log.feed h2 { display: none; }
}
.log ul {
  list-style: none; margin: 0; padding: 8px 12px; height: 118px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
  font-family: var(--mono); font-size: 11px; display: flex; flex-direction: column; gap: 2px;
}
.log li { color: var(--ink-2); display: flex; gap: 10px; }
.log li time { color: var(--ink-3); flex: none; font-variant-numeric: tabular-nums; }
.log li.hot { color: var(--amber); }
.log li.bad { color: var(--red); }
.log li.good { color: var(--phos); }

/* Toast */
.toast {
  position: fixed; left: 50%; top: 70px; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--amber); color: var(--ink);
  padding: 10px 18px; border-radius: 3px; font-family: var(--display); font-size: 16px; letter-spacing: 0.1em;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5); z-index: 10; animation: toast 3.2s ease forwards;
}
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -8px); } 10%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

@media (max-width: 1080px) {
  .console { grid-template-columns: 1fr; }
  .mapwrap { grid-column: 1; }
}
@media (max-width: 640px) {
  .console { grid-template-columns: 1fr; padding: 10px; }
  .topbar { padding: 10px; }
  .log { padding: 0 10px 12px; }
  .stat.xp { min-width: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .brand-mark, .launch.armed { animation: none; }
}


/* Loadout blueprint and part quality bars */
.preview {
  display: block; width: 100%; height: 132px;
  background: #070d18; border: 1px solid var(--line); border-radius: 3px;
  margin: 2px 0 6px;
}
.chip .qbar {
  display: block; height: 3px; border-radius: 2px;
  background: var(--panel-2); border: 1px solid var(--line);
  margin: 3px 0 1px; overflow: hidden;
}
.chip .qbar i { display: block; height: 100%; background: var(--phos); }
.chip.on .qbar i { background: var(--amber); }
.chip:disabled .qbar i { background: var(--ink-3); }
.readout .total.short { color: var(--red); }


/* Threat board */
.threats { font-family: var(--mono); font-size: 11px; margin-bottom: 4px; }
.threats .empty { color: var(--ink-3); margin: 4px 0; }
.threats.active {
  border: 1px solid var(--red); border-radius: 3px; padding: 2px 8px 6px;
  background: rgba(255, 79, 94, 0.05);
}
h2.alert { color: var(--red); }
h2 .tcount {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  background: var(--red); color: #fff; padding: 1px 6px; border-radius: 2px; margin-left: 8px;
  animation: tpulse 1.4s ease-in-out infinite;
}
@keyframes tpulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { h2 .tcount { animation: none; } }

.threat-row { padding: 6px 0; border-bottom: 1px solid var(--line); }
.threat-row:last-child { border-bottom: 0; }
.threat-row .t-line { display: flex; align-items: center; gap: 6px; }
.threat-row .t-line.sub { margin-top: 4px; justify-content: space-between; }
.threat-row .t-from { color: var(--red); font-weight: 500; }
.threat-row .t-arrow { color: var(--ink-3); }
.threat-row .t-to { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.threat-row .t-eta { color: var(--ink-2); font-variant-numeric: tabular-nums; flex: none; }
.threat-row.urgent .t-eta { color: var(--red); font-weight: 500; }
.threat-row .t-dmg { color: var(--ink-3); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-kill {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em;
  color: var(--ground); background: var(--phos); border: 0; border-radius: 2px;
  padding: 3px 8px; cursor: pointer; white-space: nowrap; flex: none;
}
.t-kill:hover:not(:disabled) { background: #5ef0cb; }
.t-kill:disabled { background: var(--panel-2); color: var(--ink-3); cursor: not-allowed; }

/* Holdings */
.holdings { list-style: none; margin: 0 0 4px; padding: 0; font-family: var(--mono); font-size: 11px; }
.holdings li {
  display: grid; grid-template-columns: 1fr auto auto; gap: 8px;
  padding: 3px 0; border-bottom: 1px solid var(--line); color: var(--ink-2);
}
.holdings li.empty, .holdings li.h-head { display: block; color: var(--ink-3); }
.holdings li.h-head { color: var(--phos); border-bottom: 1px solid var(--line-2); }
.holdings .h-name { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.holdings .h-rate { color: var(--amber); }
.holdings .h-left { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.holdings .h-left.low { color: var(--red); }


/* Flattened ground and what you put on it */
.site-state {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 6px 8px; border-radius: 2px; margin: 8px 0 6px;
}
.site-state.flat { background: var(--red-dim); color: var(--red); }
.site-state.built { background: var(--phos-dim); color: var(--phos); }
.site-state .ss-rate { color: var(--ink-3); letter-spacing: 0.04em; }
.site-choice { display: grid; gap: 6px; margin-top: 8px; }
button.dev {
  display: flex; flex-direction: column; gap: 2px; text-align: left;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 3px;
  padding: 8px 10px; cursor: pointer; color: var(--ink); font-family: var(--body);
}
button.dev:hover { border-color: var(--phos); background: var(--phos-dim); }
button.dev b { font-size: 13px; }
button.dev span { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
button.dev:hover span { color: var(--ink-2); }
button.dev.mini {
  flex-direction: row; padding: 2px 7px; font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.dev-pair { display: inline-flex; gap: 4px; }
.holdings li.pending { color: var(--red); }
.holdings li.pending .h-name { color: var(--red); }
.kv .pay { color: var(--phos); font-weight: 500; }


/* ============================================================
   Campaign record: one consolidated strip under the title bar
   ============================================================ */
.statstrip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
  gap: 1px; margin: 0 18px; background: var(--line);
  border: 1px solid var(--line); border-radius: 4px; overflow: hidden;
}
.statstrip .cell { background: var(--panel); padding: 8px 12px; min-width: 0; }
.statstrip dt {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-3); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.statstrip dd {
  margin: 2px 0 0; font-family: var(--display); font-size: 20px; font-weight: 500;
  color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.statstrip dd small {
  font-family: var(--mono); font-size: 11px; color: var(--ink-3); font-weight: 400;
  margin-left: 5px;
}
.statstrip .cell.good dd { color: var(--phos); }
.statstrip .cell.amber dd { color: var(--amber); }
.statstrip .cell.hot dd { color: var(--red); }

/* ============================================================
   Launch control deck
   ============================================================ */
.deck { display: flex; flex-direction: column; gap: 8px; }
.target { display: flex; flex-direction: column; gap: 0; }
.target .t-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  border-bottom: 1px solid var(--line-2); padding-bottom: 6px;
}
.target .t-head h3 {
  font-family: var(--display); font-size: 22px; font-weight: 500; margin: 0;
  letter-spacing: 0.02em; text-transform: uppercase; line-height: 1.1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.target .t-tier {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ground); background: var(--ink-2); padding: 2px 6px; border-radius: 2px; flex: none;
}
.target .t-tier.t4 { background: var(--amber); }
.target .t-tier.t5 { background: var(--red); color: #fff; }
.target .t-sub {
  font-family: var(--mono); font-size: 11px; color: var(--ink-3);
  padding: 5px 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* integrity, labelled inline so nothing wraps */
.gauge { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 3px 0; }
.gauge .g-lbl { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.gauge .g-track { height: 7px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.gauge .g-fill { height: 100%; background: var(--phos); transition: width 0.4s; }
.gauge.mid .g-fill { background: var(--amber); }
.gauge.low .g-fill { background: var(--red); }
.gauge .g-num { font-family: var(--mono); font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gauge.down .g-num { color: var(--red); }

/* the firing solution: aligned rows, units never wrap */
.solution { margin-top: 10px; border-top: 1px solid var(--line); }
.srow {
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: baseline;
  padding: 5px 0; border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px;
}
.srow .s-lbl { color: var(--ink-3); letter-spacing: 0.06em; text-transform: uppercase; font-size: 10px; }
.srow .s-val { color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.srow .s-val.bad { color: var(--red); }
.srow .s-val.ok { color: var(--phos); }
.badge {
  font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 1px 5px; border-radius: 2px; margin-left: 6px; white-space: nowrap;
}
.badge.bad { background: var(--red-dim); color: var(--red); }

/* the three engagement layers, side by side like a threat panel */
.layers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); margin: 10px 0 0; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.layers .lay { background: var(--panel-2); padding: 7px 8px; text-align: center; }
.layers .lay-k { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.layers .lay-v { font-family: var(--display); font-size: 19px; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.2; }
.layers .lay-n { font-family: var(--mono); font-size: 9px; color: var(--ink-3); }
.layers .lay.ok .lay-v { color: var(--phos); }
.layers .lay.warn .lay-v { color: var(--amber); }
.layers .lay.bad .lay-v { color: var(--red); }
.layers .lay.through { background: var(--panel); }
.layers .lay.through .lay-v { color: var(--ink); }

.payline {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  margin-top: 9px; padding: 7px 10px; border-radius: 3px;
  background: var(--phos-dim); font-family: var(--mono); font-size: 11px;
}
.payline .p-lbl { color: var(--ink-2); letter-spacing: 0.08em; text-transform: uppercase; font-size: 10px; }
.payline .p-val { color: var(--phos); font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }

.launch .cost { font-family: var(--mono); font-size: 11px; opacity: 0.72; letter-spacing: 0.04em; }

/* ============================================================
   Assembly bay along the bottom
   ============================================================ */
.bay {
  margin: 12px 18px 0; background: var(--panel);
  border: 1px solid var(--line); border-radius: 4px;
}
.bay-head {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px; border-bottom: 1px solid var(--line);
}
.bay-head h2 { margin: 0; border: 0; padding: 0; }
.bay-hint { font-family: var(--mono); font-size: 11px; color: var(--ink-3); flex: 1; }
.bay-head .ghost { margin: 0; padding: 4px 10px; font-size: 10px; }
.bay-body {
  display: grid; grid-template-columns: 250px minmax(0, 1fr) 210px;
  gap: 18px; padding: 12px 14px; align-items: start;
}
.bay-loadout { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.bay .preview { height: 120px; margin: 0; }
.bay .readout { font-size: 11px; gap: 1px 8px; }
.bay .slots { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; align-content: start; min-width: 0; }
.bay .slot { min-width: 0; }
.bay .chips { display: flex; flex-direction: column; gap: 4px; }
.bay .chip { padding: 5px 7px; }
.bay .chip .nm { font-size: 11.5px; }
.bay .chip .st { font-size: 9.5px; }
.bay-missions { min-width: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line); padding-left: 16px; }
.bay-missions h3 {
  font-family: var(--display); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 6px; font-weight: 500;
}
.bay-missions .missions { max-height: 420px; overflow-y: auto; margin: 0; padding-right: 4px; }
.bay-missions .missions li { padding: 3px 0; font-size: 11px; }
.bay-missions .missions .ttl { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bay-missions .missions .dsc { display: block; font-size: 10.5px; line-height: 1.35; }
.bay-missions .missions .rw { font-size: 10px; }

@media (max-width: 1100px) {
  .bay-body { grid-template-columns: 1fr; }
  .bay .slots { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
@media (max-width: 760px) {
  .statstrip { margin: 0 10px; }
  .bay { margin: 10px; }
  .layers { grid-template-columns: 1fr; }
}


/* Map key: each swatch is the shape it stands for */
.legend {
  display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center;
  padding: 7px 12px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; color: var(--ink-2);
}
.legend .key { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.legend .key b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.legend i { display: inline-block; width: 11px; height: 11px; flex: none; }

/* a live target: a filled dot */
.legend i.k-dot { background: var(--phos); border-radius: 50%; }
/* flattened ground: a hollow ring */
.legend i.k-crater {
  border: 1.5px solid var(--ink-3); border-radius: 50%; background: transparent;
  box-shadow: 0 0 0 1.5px rgba(228, 233, 242, 0.22);
}
/* a plant: a block */
.legend i.k-plant { background: var(--phos); border-radius: 1px; }
/* a launch site: a pad ring */
.legend i.k-pad {
  border: 1.5px solid var(--amber); border-radius: 50%;
  background: rgba(242, 177, 58, 0.22);
}
@media (max-width: 620px) { .legend { gap: 5px 12px; font-size: 10px; } }


/* Losing every launch site ends the campaign */
.over {
  border: 1px solid var(--red); border-radius: 3px;
  background: var(--red-dim); padding: 14px 14px 12px;
}
.over-head {
  font-family: var(--display); font-size: 17px; font-weight: 500;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--red); margin-bottom: 7px;
}
.over p { margin: 0 0 7px; font-size: 13px; color: var(--ink-2); }
.over p.sub { margin: 0; font-family: var(--mono); font-size: 11px; color: var(--ink-3); }

.threat-row .t-dmg.fatal { color: var(--red); font-weight: 500; }
.holdings li.lost .h-name { color: var(--ink-3); text-decoration: line-through; }
.holdings li.lost .h-rate { color: var(--red); }


/* What a siege will actually cost, before you commit to it */
.estimate {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  margin-top: 9px; padding: 7px 10px; border-radius: 3px;
  background: var(--panel-2); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px;
}
.estimate .e-lbl { color: var(--ink-3); letter-spacing: 0.08em; text-transform: uppercase; font-size: 10px; white-space: nowrap; }
.estimate .e-val { color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.estimate.bad { background: var(--red-dim); border-color: rgba(255, 79, 94, 0.4); }
.estimate.bad .e-val { color: var(--red); }

/* ============================================================
   Online: today's run, handle prompt, leaderboard (hosted build only)
   ============================================================ */
.board-btn {
  font-family: var(--display); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
  background: transparent; color: var(--ink-2); border: 1px solid var(--line-2); border-radius: 3px;
  padding: 7px 14px; margin: 0; white-space: nowrap;
}
.board-btn:hover { color: var(--phos); border-color: var(--phos); }
body.in-sortie #resetBtn { display: none; }
body.in-sortie #cmdName { color: var(--amber); }

.run-strip {
  display: flex; flex-wrap: nowrap; align-items: stretch; gap: 1px; margin: 8px 18px;
  background: var(--line); border: 1px solid var(--line); border-radius: 4px; overflow: hidden;
}
.run-tag {
  display: flex; align-items: center; padding: 8px 14px; background: var(--phos-dim); color: var(--phos);
  font-family: var(--display); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
}
.run-tag.over { background: var(--red-dim); color: var(--red); }
.run-strip .cell { background: var(--panel); padding: 7px 14px; min-width: 0; flex: 1 1 0; overflow: hidden; }
.run-strip dt, .run-strip dd { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-strip dd small { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-left: 5px; }
body.in-sortie #record { display: none; }
@media (max-width: 1000px) {
  .run-strip { flex-wrap: wrap; }
  .run-strip .cell { flex: 1 1 110px; }
}
.run-strip dt { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.run-strip dd { margin: 2px 0 0; font-family: var(--display); font-size: 19px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.run-strip .cell.good dd { color: var(--phos); }
.run-strip .cell.hot dd { color: var(--red); }
.run-actions { display: flex; align-items: center; padding: 6px 10px; background: var(--panel); }
.restart {
  font-family: var(--display); font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase;
  background: var(--amber); color: #1a1204; border: 0; border-radius: 3px; padding: 8px 16px;
}
.restart:hover { filter: brightness(1.08); }
.restart.quiet { background: transparent; color: var(--ink-2); border: 1px solid var(--line-2); }
.restart.quiet:hover { color: var(--amber); border-color: var(--amber); filter: none; }

.online-dlg {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 40px); padding: 0;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line-2); border-radius: 6px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
}
.online-dlg::backdrop { background: rgba(2, 5, 12, 0.78); backdrop-filter: blur(2px); }
.online-dlg .dlg-body { padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 12px; }
.online-dlg h2 { font-size: 20px; letter-spacing: 0.04em; text-transform: none; color: var(--ink); margin: 0; padding: 0; border: 0; }
.online-dlg .eyebrow { margin: 0; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--phos); }
.online-dlg.over .eyebrow { color: var(--red); }
.online-dlg .dlg-x {
  position: absolute; top: 8px; right: 10px; background: none; border: 0; color: var(--ink-3);
  font-size: 22px; line-height: 1; padding: 4px 8px;
}
.online-dlg .dlg-x:hover { color: var(--ink); }
.online-dlg .launch { margin: 4px 0 0; font-size: 16px; padding: 12px; letter-spacing: 0.22em; }
.dlg-note { margin: 0; color: var(--ink-3); font-size: 12px; }
.dlg-err { margin: 0; color: var(--red); font-size: 12.5px; }
.dlg-row { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.dlg-row .launch { flex: 1 1 200px; margin: 0; }
.dlg-row .board-btn { flex: 0 0 auto; }

/* Socials panel: follow link and the token address, matching the board dialog. */
.social-block { display: flex; flex-direction: column; gap: 7px; }
.social-block + .social-block { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.social-block > .lbl {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-3);
}
a.social-link { align-self: flex-start; display: inline-block; text-decoration: none; }
.social-addr { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.social-addr .addr {
  flex: 1 1 260px; min-width: 0; font-family: var(--mono); font-size: 12px; line-height: 1.5;
  color: var(--ink); background: rgba(2, 5, 12, 0.5); border: 1px solid var(--line-2);
  border-radius: 3px; padding: 8px 10px; overflow-wrap: anywhere; user-select: all;
}
.copy-btn {
  flex: 0 0 auto; font-family: var(--display); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; background: transparent; color: var(--ink-2);
  border: 1px solid var(--line-2); border-radius: 3px; padding: 0 14px; white-space: nowrap;
}
.copy-btn:hover { color: var(--phos); border-color: var(--phos); }
.dlg-note.warn { color: var(--amber); }

.how { margin: 0; padding-left: 20px; color: var(--ink-2); font-size: 13.5px; display: flex; flex-direction: column; gap: 5px; }
.how li::marker { color: var(--phos); font-family: var(--mono); }
.dlg-form { display: flex; flex-direction: column; gap: 6px; }
.dlg-form .lbl { margin-top: 4px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.dlg-form input {
  width: 100%; min-width: 0; padding: 10px 11px; font: 14px var(--mono); color: var(--ink);
  background: var(--ground); border: 1px solid var(--line-2); border-radius: 3px;
}
.dlg-form input:focus { border-color: var(--amber); outline: none; }
.dlg-form .row { display: flex; gap: 8px; }

.over-score { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.over-score > div { background: var(--panel-2); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.over-score .lbl { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.over-score b { font-family: var(--display); font-size: 24px; font-weight: 500; font-variant-numeric: tabular-nums; }
.over-score > div:first-child b { color: var(--phos); }

.board-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-right: 28px; flex-wrap: wrap; }
.dlg-tabs { display: flex; gap: 4px; background: var(--ground); border: 1px solid var(--line); border-radius: 4px; padding: 3px; }
.dlg-tabs button {
  background: transparent; border: 0; color: var(--ink-3); border-radius: 3px;
  padding: 5px 12px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
}
.dlg-tabs button.on { color: var(--ink); background: var(--panel-2); }
.you {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--phos-dim); border: 1px solid rgba(52, 223, 182, 0.35); border-radius: 4px;
}
.you .lbl { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--phos); }
.you b { font-weight: 500; overflow-wrap: anywhere; }
.you-stat { font-family: var(--display); font-size: 17px; font-variant-numeric: tabular-nums; }
.board-list { list-style: none; margin: 0; padding: 0; max-height: 48vh; overflow: auto; border-top: 1px solid var(--line); }
.board-row { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.b-rank { font-family: var(--mono); font-size: 13px; color: var(--ink-3); text-align: center; font-variant-numeric: tabular-nums; }
.board-row.podium .b-rank { color: #1a1204; background: var(--amber); border-radius: 50%; width: 24px; height: 24px; line-height: 24px; justify-self: center; font-size: 12px; }
.b-name { display: flex; flex-direction: column; min-width: 0; }
.b-name b { font-weight: 500; overflow-wrap: anywhere; }
.b-name small { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
.b-score { font-family: var(--display); font-size: 18px; font-variant-numeric: tabular-nums; }
.board-row.mine { background: var(--phos-dim); }
.board-empty { margin: 8px 0; padding: 18px; text-align: center; color: var(--ink-2); border: 1px dashed var(--line-2); border-radius: 4px; }
.profile { border-top: 1px solid var(--line); padding-top: 10px; }
.profile summary { cursor: pointer; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.profile[open] summary { margin-bottom: 8px; }
@media (max-width: 640px) {
  .run-strip { margin: 0 10px 8px; }
  .over-score { grid-template-columns: 1fr; }
}

/* Launch pad integrity */
.holdings li.pad { display: grid; grid-template-columns: 1fr 70px 38px; align-items: center; gap: 8px; }
.pad-bar { display: block; height: 5px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.pad-bar i { display: block; height: 100%; background: var(--phos); }
.pad-bar.mid i { background: var(--amber); }
.pad-bar.low i { background: var(--red); }
.threat-rate { margin: 8px 0 0; font-size: 11.5px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 2px 8px; }
.threat-rate b { color: var(--ink-2); font-weight: 500; }

/* Mission requirements and progress */
/* requirement, then a full-width bar, then progress: stacked, so nothing is squeezed */
.missions li .m-body { display: block; min-width: 0; }
.m-need { display: block; margin-top: 4px; }
.m-bar { display: block; width: 100%; height: 4px; background: var(--ground); border-radius: 2px; overflow: hidden; }
.m-bar i { display: block; height: 100%; background: var(--amber); }
.missions li.done .m-bar i { background: var(--phos); }
.m-txt { display: block; margin-top: 3px; font-family: var(--mono); font-size: 10.5px; line-height: 1.35; color: var(--ink-3); overflow-wrap: normal; word-break: normal; }
