@import url('https://fonts.googleapis.com/css2?family=Jersey+10&display=swap');

/* ==========================================================================
   ORBITAL KITCHEN — PIXEL UI THEME (font: Jersey 10, single weight)
   Palette sampled from the Stage 1 hangar art: steel navy panels, hazard
   yellow, console cyan. Every frame is a hard 2px "pixel" edge: no radius,
   no blur, no soft gradients. Outlines are drawn with stacked box-shadows so
   corners come out notched, like a 9-slice sprite.
   ========================================================================== */

:root {
  --font: 'Jersey 10', 'Courier New', monospace;

  --ink: #06080f;
  --bg: #0b1020;
  --panel: #161f37;
  --panel-2: #1e2946;
  --panel-3: #283657;
  --hi: #3b4c78;
  --lo: #0d1428;
  --text: #eef1f8;
  --muted: #8f9bbd;

  --hazard: #f6c445;
  --hazard-hi: #ffe39a;
  --hazard-lo: #a8741a;
  --cyan: #4fd6f0;
  --cyan-lo: #1d7894;
  --green: #5fe07c;
  --green-lo: #23894a;
  --red: #ff5d5d;
  --red-lo: #9c2a39;
  --purple: #b48cff;
  --purple-lo: #6a43c0;

  /* Notched 2px outline (corners left open) */
  --frame: 0 -2px 0 0 var(--ink), 0 2px 0 0 var(--ink), -2px 0 0 0 var(--ink), 2px 0 0 0 var(--ink);
  --frame-lg: 0 -4px 0 0 var(--ink), 0 4px 0 0 var(--ink), -4px 0 0 0 var(--ink), 4px 0 0 0 var(--ink);
  --frame-hazard: 0 -2px 0 0 var(--hazard), 0 2px 0 0 var(--hazard), -2px 0 0 0 var(--hazard), 2px 0 0 0 var(--hazard);
  --frame-cyan: 0 -2px 0 0 var(--cyan), 0 2px 0 0 var(--cyan), -2px 0 0 0 var(--cyan), 2px 0 0 0 var(--cyan);
  --frame-green: 0 -2px 0 0 var(--green), 0 2px 0 0 var(--green), -2px 0 0 0 var(--green), 2px 0 0 0 var(--green);
  --frame-red: 0 -2px 0 0 var(--red), 0 2px 0 0 var(--red), -2px 0 0 0 var(--red), 2px 0 0 0 var(--red);
  --bevel: inset 0 2px 0 0 var(--hi), inset 0 -2px 0 0 var(--lo);
  --drop: 0 6px 0 0 rgba(0, 0, 0, 0.45);

  --hazard-stripe: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='4' shape-rendering='crispEdges'%3E%3Crect width='12' height='4' fill='%2306080f'/%3E%3Crect x='0' y='0' width='6' height='1' fill='%23f6c445'/%3E%3Crect x='1' y='1' width='6' height='1' fill='%23f6c445'/%3E%3Crect x='2' y='2' width='6' height='1' fill='%23f6c445'/%3E%3Crect x='3' y='3' width='6' height='1' fill='%23f6c445'/%3E%3C/svg%3E");
  --dither: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='2' shape-rendering='crispEdges'%3E%3Crect width='1' height='1' fill='%2306080f'/%3E%3Crect x='1' y='1' width='1' height='1' fill='%2306080f'/%3E%3C/svg%3E");
  --dots: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' shape-rendering='crispEdges'%3E%3Crect width='1' height='1' fill='%23ffffff' fill-opacity='0.035'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; }

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg) var(--dots);
  background-size: 16px 16px;
  image-rendering: pixelated;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.25;
  -webkit-font-smoothing: none;
  font-synthesis: none;
  letter-spacing: 0.3px;
  display: flex;
  flex-direction: column;
}

button { font-family: var(--font); }

b, strong { font-weight: 700; }

/* Pixel icons (src/icons.js) */
.px-ico {
  display: inline-block;
  width: calc(var(--cw) * var(--cell, 2px));
  height: calc(var(--ch) * var(--cell, 2px));
  vertical-align: -3px;
  flex-shrink: 0;
}
.px-ico.x3 { --cell: 3px; }
.px-item {
  display: block;
  width: 22px;
  height: 22px;
  image-rendering: pixelated;
  flex-shrink: 0;
}

/* ==========================================================================
   3-ZONE VIEWPORT
   ========================================================================== */

#hud-top {
  flex: 0 0 auto;
  min-height: 74px;
  padding: 8px 14px 14px;
  background: var(--panel);
  box-shadow: inset 0 -8px 0 0 var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  z-index: 20;
  position: relative;
}
#hud-top::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 6px;
  background: var(--hazard-stripe) repeat-x;
  background-size: 24px 8px;
  image-rendering: pixelated;
  pointer-events: none;
}

#tickets-bar {
  flex: 1 1 0%;
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: nowrap;
  overflow: hidden;
  min-width: 0;
  padding: 4px 4px 8px;
}
#tickets-bar::-webkit-scrollbar { display: none; }

/* --- Order tickets --- */
.ticket {
  flex: 1 1 0;
  min-width: 0;
  max-width: 184px;
  background: var(--panel-2);
  color: var(--text);
  box-shadow: var(--bevel), var(--frame), var(--drop);
  overflow: hidden;
  cursor: pointer;
  animation: dropTicket 0.24s steps(4, end);
}
.ticket:hover { filter: brightness(1.12); }
.ticket.target-ticket {
  box-shadow: var(--bevel), var(--frame-hazard), 0 0 0 4px var(--ink), 0 8px 0 0 rgba(0, 0, 0, 0.45);
  animation: dropTicket 0.24s steps(4, end), targetBlink 1.2s steps(2, jump-none) infinite;
}
.ticket.built-ticket:not(.target-ticket) {
  box-shadow: var(--bevel), var(--frame-green), var(--drop);
}
@keyframes dropTicket {
  from { transform: translateY(-20px); }
  to { transform: translateY(0); }
}
@keyframes targetBlink {
  50% { filter: brightness(1.18); }
}
.ticket-header {
  padding: 3px 6px 4px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow: 1px 1px 0 var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  box-shadow: inset 0 -2px 0 0 rgba(0, 0, 0, 0.3);
}
.ticket-header > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ticket-header-right {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.ticket-header-right > span:last-child { display: inline-flex; align-items: center; gap: 2px; }
.req-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 4px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  text-shadow: none;
  background: var(--ink);
  color: var(--hazard);
  box-shadow: inset 0 0 0 1px var(--hazard);
}
.req-badge.req-met {
  color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
}
.ticket-timer-bg {
  height: 6px;
  background: var(--ink);
  width: 100%;
  position: relative;
}
.ticket-timer-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 6px, var(--ink) 6px 8px);
  pointer-events: none;
}
.ticket-timer-fill {
  height: 100%;
  background: var(--green);
  transition: width 0.15s steps(3, end);
}
.ticket-body {
  padding: 5px 6px 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.ticket-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ticket-trade {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ticket-reqs {
  display: flex;
  gap: 4px;
  justify-content: center;
  background: var(--ink);
  padding: 3px;
}
.req-chip {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  background: var(--panel);
  padding: 3px 2px 2px;
  box-shadow: inset 0 2px 0 0 var(--hi);
}
.req-chip.chip-ready {
  background: #173a2a;
  box-shadow: inset 0 2px 0 0 var(--green-lo), inset 0 0 0 1px var(--green);
}
.req-chip.chip-ready span.pname { color: var(--green); }
.req-chip svg:not(.px-ico) { width: 20px; height: 20px; flex-shrink: 0; }
.req-chip span.pname {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.05;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.req-chip span.pname .px-ico { --cell: 1px; vertical-align: 0; }
.req-chip small { font-size: 12px; font-weight: 700; text-transform: uppercase; white-space: nowrap; letter-spacing: 0.4px; }
.ticket-bonus-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  padding: 2px 6px 0;
}

/* --- Stage banner --- */
#stage-banner {
  display: none;
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--panel-2);
  box-shadow: var(--bevel), var(--frame), var(--drop);
  padding: 8px 14px;
  margin: 2px 2px 6px;
}
#stage-banner .sb-copy {
  flex: 1 1 auto;
  min-width: 0;
}
#stage-banner .badge {
  background: var(--hazard);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  padding: 4px 8px 5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: inset 0 2px 0 0 var(--hazard-hi), inset 0 -2px 0 0 var(--hazard-lo), var(--frame);
}
#stage-banner h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 2px 2px 0 var(--ink);
}
#stage-banner p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.25;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-status-pill {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.6px;
  padding: 4px 8px;
  background: var(--ink);
  color: var(--cyan);
  box-shadow: inset 0 0 0 2px var(--cyan-lo);
  white-space: nowrap;
}

#hud-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
}
.hud-cmd-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
}

/* --- 4-player crew chips --- */
.squad-bar {
  display: flex;
  gap: 2px;
  background: var(--ink);
  padding: 2px;
  box-shadow: var(--frame);
}
.p-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 42px;
  padding: 3px 6px 2px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  background: var(--panel-2);
  box-shadow: inset 0 2px 0 0 var(--hi);
}
.p-chip:hover { background: var(--panel-3); }
.p-chip.active {
  background: #3a3220;
  box-shadow: inset 0 0 0 2px var(--hazard);
}
.p-chip.remote-claimed { box-shadow: inset 0 0 0 2px var(--cyan); }
.p-chip .dot { width: 6px; height: 6px; margin-bottom: 2px; box-shadow: 0 0 0 1px var(--ink); }
.p-chip span { color: var(--text); line-height: 1; }
.p-chip small { font-size: 12px; color: var(--muted); font-weight: 500; line-height: 1.1; }
.p-chip.active span { color: var(--hazard); }

.pill-box {
  background: var(--panel-2);
  color: var(--text);
  padding: 5px 9px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--bevel), var(--frame);
}
.pill-icon { display: inline-flex; line-height: 1; }
.star-val { font-size: 19px; font-weight: 700; color: var(--hazard); text-shadow: 1px 1px 0 var(--ink); }
.clock-val { font-size: 18px; font-weight: 700; color: var(--text); white-space: nowrap; letter-spacing: 0.5px; }
.clock-free {
  background: #173a2a;
  box-shadow: inset 0 2px 0 0 var(--green-lo), var(--frame);
}
.clock-free .clock-val { color: var(--green); font-size: 16px; }
.clock-urgent {
  animation: urgentBlink 0.6s steps(2, jump-none) infinite;
  background: #3d1820;
  box-shadow: inset 0 2px 0 0 var(--red-lo), var(--frame-red);
}
.clock-urgent .clock-val { color: var(--red); }
.clock-paused {
  animation: none !important;
  background: #3a3220;
  box-shadow: inset 0 2px 0 0 var(--hazard-lo), var(--frame-hazard);
}
.clock-paused .clock-val { color: var(--hazard); }
@keyframes urgentBlink { 50% { filter: brightness(1.45); } }

/* --- Pixel buttons --- */
.btn-hud {
  border: 0;
  border-radius: 0;
  padding: 6px 10px 7px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
  background: var(--panel-3);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: inset 0 2px 0 0 rgba(255, 255, 255, 0.16), inset 0 -3px 0 0 rgba(0, 0, 0, 0.35), var(--frame);
}
.btn-hud:hover { filter: brightness(1.15); }
.btn-hud:active { transform: translateY(2px); box-shadow: inset 0 3px 0 0 rgba(0, 0, 0, 0.35), var(--frame); }
.btn-bot { background: #1a4a5c; color: #c9f3fb; }
.btn-bot.local2p { background: #1d4a2e; color: #c8f7d3; }
.btn-bot.net4p { background: #1a4a5c; color: var(--cyan); }
.btn-bot.off { background: var(--panel-2); color: var(--muted); }
.btn-blueprint { background: #143652; color: #bfefff; }
.btn-blueprint.active {
  background: #1b4d74;
  color: var(--text);
  box-shadow: var(--bevel), var(--frame-cyan);
}
.btn-blueprint:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
  transform: none;
}
.bp-progress-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 5px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  background: var(--ink);
  color: var(--cyan);
  box-shadow: inset 0 0 0 1px var(--cyan-lo);
}
.bp-progress-pill.complete {
  background: #173a2a;
  color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
}
.btn-guide { background: var(--panel-3); }
.btn-pause { background: var(--panel-3); }
.btn-pause.paused { background: var(--hazard); color: var(--ink); }
.btn-pause:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
  transform: none;
}
.btn-launch { background: var(--cyan); color: var(--ink); font-weight: 700; }
.btn-launch.locked { background: #1a4a5c; color: #a8dfea; }
.btn-launch.warn { background: var(--hazard); color: var(--ink); }
.btn-launch.ready {
  background: var(--green);
  color: var(--ink);
  animation: readyBlink 0.9s steps(2, jump-none) infinite;
}
@keyframes readyBlink { 50% { background: #a6f5b6; } }
.btn-next { background: var(--purple); color: var(--ink); font-weight: 700; display: none; }

/* ==========================================================================
   CENTER CANVAS
   ========================================================================== */

#game-wrap {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 12px;
  min-height: 0;
  position: relative;
}
canvas {
  display: block;
  border-radius: 0;
  image-rendering: pixelated;
  background: #0a0f1d;
  /* Monitor bezel: ink / steel / ink */
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px var(--panel-3), 0 0 0 7px var(--hi), 0 0 0 10px var(--ink);
}

/* ==========================================================================
   BOTTOM TELEMETRY STRIP
   ========================================================================== */

#hud-bottom {
  flex: 0 0 auto;
  padding: 14px 14px 8px;
  background: var(--panel);
  box-shadow: inset 0 8px 0 0 var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  z-index: 20;
  position: relative;
}
#hud-bottom::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 6px;
  background: var(--hazard-stripe) repeat-x;
  background-size: 24px 8px;
  image-rendering: pixelated;
  pointer-events: none;
}
.telemetry-strip {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 2px;
}
.t-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 15px;
  font-weight: 500;
  padding: 3px 7px;
  background: var(--panel-2);
  color: var(--muted);
  white-space: nowrap;
  box-shadow: var(--bevel), var(--frame);
}
.t-stat b { color: var(--text); font-weight: 700; }
.t-stat.warn { background: #3a3220; box-shadow: var(--bevel), var(--frame-hazard); }
.t-stat.danger { background: #3d1820; box-shadow: var(--bevel), var(--frame-red); }
.t-bar {
  position: relative;
  width: 46px;
  height: 8px;
  background: var(--ink);
  box-shadow: 0 0 0 1px var(--lo);
  overflow: hidden;
  display: inline-block;
  flex-shrink: 0;
}
.t-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 4px, var(--ink) 4px 6px);
  pointer-events: none;
}
.t-bar-fill {
  display: block;
  height: 100%;
  box-shadow: inset 0 2px 0 0 rgba(255, 255, 255, 0.35);
  transition: width 0.2s steps(4, end);
}
.t-stat.t-goal {
  background: #142f3d;
  color: #a8dfea;
  box-shadow: inset 0 2px 0 0 var(--cyan-lo), var(--frame);
}
.t-stat.t-goal.cml-ready {
  background: #173a2a;
  color: #c8f7d3;
  box-shadow: inset 0 2px 0 0 var(--green-lo), var(--frame-green);
}

.controls-hint {
  background: var(--panel-2);
  color: var(--text);
  padding: 6px 10px;
  font-size: 16px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: var(--bevel), var(--frame);
}
kbd {
  display: inline-block;
  background: var(--hazard);
  color: var(--ink);
  padding: 1px 5px 2px;
  margin: 0 2px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: inset 0 -2px 0 0 var(--hazard-lo), 0 0 0 2px var(--ink);
}

/* ==========================================================================
   MODAL WINDOWS
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 12, 0.55) var(--dither);
  background-size: 4px 4px;
  image-rendering: pixelated;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  padding: 24px;
}
.modal-backdrop.hidden { display: none; }

.modal-card {
  position: relative;
  background: var(--panel);
  color: var(--text);
  width: 760px;
  max-width: 94vw;
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px 28px 18px;
  text-align: left;
  box-shadow: inset 0 0 0 2px var(--hi), inset 0 0 0 4px var(--lo), var(--frame-lg), 0 12px 0 0 rgba(0, 0, 0, 0.5);
  scrollbar-width: thin;
  scrollbar-color: var(--hi) var(--lo);
}
.modal-card::before {
  content: '';
  position: absolute;
  left: 4px;
  right: 4px;
  top: 4px;
  height: 6px;
  background: var(--hazard-stripe) repeat-x;
  background-size: 24px 8px;
  image-rendering: pixelated;
}
.modal-card h1 {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--hazard);
  text-shadow: 3px 3px 0 var(--ink);
  margin: 4px 0 6px;
  line-height: 1.1;
}
.modal-card h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  text-shadow: 2px 2px 0 var(--ink);
}
.modal-card p.sub {
  font-size: 17px;
  color: var(--muted);
  margin-bottom: 14px;
  line-height: 1.35;
}
.modal-card p.sub b { color: var(--text); }

.md-section {
  margin-bottom: 12px;
}
.md-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--cyan);
  margin-bottom: 8px;
}
.md-section-label::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--hazard);
  box-shadow: 2px 2px 0 0 var(--ink);
}
.opt-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 2px;
}
.opt-btn {
  position: relative;
  background: var(--panel-2);
  border: 0;
  border-radius: 0;
  padding: 9px 12px;
  text-align: left;
  cursor: pointer;
  font-family: var(--font);
  color: var(--text);
  box-shadow: var(--bevel), var(--frame), 0 4px 0 0 rgba(0, 0, 0, 0.45);
}
.opt-btn:hover { background: var(--panel-3); }
.opt-btn:active { transform: translateY(2px); box-shadow: var(--bevel), var(--frame); }
.opt-btn.selected {
  background: #33301f;
  box-shadow: inset 0 2px 0 0 #5a5030, inset 0 -2px 0 0 var(--lo), var(--frame-hazard), 0 0 0 4px var(--ink), 0 6px 0 0 rgba(0, 0, 0, 0.45);
}
.opt-btn.selected::after {
  content: '';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--hazard);
  box-shadow: 2px 2px 0 0 var(--ink);
}
.opt-btn b { display: block; font-size: 18px; font-weight: 700; color: var(--text); padding-right: 12px; }
.opt-btn small { display: block; font-size: 14px; color: var(--muted); line-height: 1.35; margin-top: 4px; }

.opt-btn.science-opt-btn { padding: 9px 12px; }
.opt-btn.science-opt-btn b { font-size: 17px; line-height: 1.2; }
.opt-btn.science-opt-btn small.sci-loc { color: var(--cyan); font-weight: 600; margin-top: 4px; }
.opt-btn.science-opt-btn small.sci-req { color: var(--hazard); font-size: 14px; margin-top: 2px; }

.trade-preview {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 2px;
}
.trade-chip {
  background: var(--ink);
  padding: 5px 10px;
  font-size: 16px;
  font-weight: 500;
  color: var(--muted);
  box-shadow: inset 0 0 0 2px var(--panel-3);
}
.trade-chip b { color: var(--text); }
.trade-chip-science { color: #a8dfea; box-shadow: inset 0 0 0 2px var(--cyan-lo); }

.config-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
  padding: 2px;
}
.config-panel {
  background: var(--panel-2);
  padding: 14px 16px;
  box-shadow: var(--bevel), var(--frame);
}
.config-panel h3 {
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--cyan);
  margin-bottom: 10px;
}

/* Dilemma choice cards (src/dilemmas.js) */
.dilemma-badge {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 8px 4px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--cyan);
  box-shadow: inset 0 0 0 2px var(--cyan-lo);
}
.opt-btn.dilemma-opt { padding: 14px 16px; }
.opt-btn.dilemma-opt b { font-size: 19px; }
.dilemma-trade { font-size: 16px; color: var(--text); margin-top: 6px; line-height: 1.4; }
.opt-btn .dilemma-lesson { margin-top: 8px; color: var(--muted); }

.debrief-kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
  padding: 2px;
}
.kpi-card {
  background: var(--panel-2);
  padding: 12px 10px;
  text-align: center;
  box-shadow: var(--bevel), var(--frame);
}
.kpi-card small { display: block; font-size: 13px; color: var(--muted); text-transform: uppercase; font-weight: 700; letter-spacing: 0.6px; }
.kpi-card b { display: block; margin-top: 4px; font-size: 24px; color: var(--hazard); text-shadow: 2px 2px 0 var(--ink); }

.timeline-list {
  text-align: left;
  max-height: 150px;
  overflow-y: auto;
  font-size: 16px;
}
.timeline-item {
  padding: 6px 0;
  border-bottom: 2px solid var(--lo);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
}
.timeline-item b { color: var(--text); }
.timeline-item:last-child { border-bottom: none; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding: 4px;
}

.btn-play,
.btn-primary {
  background: var(--hazard);
  color: var(--ink);
  border: 0;
  border-radius: 0;
  padding: 10px 22px 12px;
  font-family: var(--font);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: inset 0 2px 0 0 var(--hazard-hi), inset 0 -4px 0 0 var(--hazard-lo), var(--frame), 0 4px 0 0 rgba(0, 0, 0, 0.5);
}
.btn-play:hover,
.btn-primary:hover { filter: brightness(1.08); }
.btn-play:active,
.btn-primary:active { transform: translateY(2px); box-shadow: inset 0 4px 0 0 var(--hazard-lo), var(--frame); }

.btn-secondary {
  background: var(--panel-3);
  color: var(--text);
  border: 0;
  border-radius: 0;
  padding: 10px 18px 12px;
  font-family: var(--font);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: inset 0 2px 0 0 rgba(255, 255, 255, 0.16), inset 0 -4px 0 0 rgba(0, 0, 0, 0.35), var(--frame), 0 4px 0 0 rgba(0, 0, 0, 0.5);
}
.btn-secondary:hover { filter: brightness(1.15); }
.btn-secondary:active { transform: translateY(2px); box-shadow: inset 0 4px 0 0 rgba(0, 0, 0, 0.35), var(--frame); }

/* ==========================================================================
   TITLE / SPLASH SCREEN (pre-game step 1, see showTitleScreen in src/hud.js)
   Full-bleed attract screen. While it is up, showTitleScreen tags #modal with
   .title-splash-open and #modal-content with .title-splash-card; hideTitleScreen
   removes both, so Mission Setup / Lobby / Stage 5 Debrief keep the stock look.
   ========================================================================== */
.modal-backdrop.title-splash-open {
  background: #05070f;
  padding: 0;
  align-items: flex-start;   /* card uses margin:auto, so tall content scrolls instead of clipping */
  overflow-y: auto;
}
.modal-card.title-splash-card {
  width: min(900px, 96vw);
  max-width: none;
  max-height: none;
  margin: auto;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 28px 0 56px;
  background: none;
  box-shadow: none;
}
.modal-card.title-splash-card::before { display: none; }

/* --- Sky: the game's own layered space background, scaled with `cover` ------------ */
.title-splash-sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.ts-layer {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center bottom;
  image-rendering: pixelated;
}
.ts-back   { background-image: url('Assets/background/layered/bg-back.png'); }
.ts-stars  { background-image: url('Assets/background/layered/bg-stars.png'); animation: tsStarsPulse 2.4s steps(1, end) infinite; }
.ts-planet { background-image: url('Assets/background/layered/bg-planet.png'); }

/* Extra twinkling stars: 2px squares, the big ones are a 1-art-pixel plus sign */
.ts-star {
  --sc: #eef1f8;
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--sc);
  animation: tsTwinkle 1.8s steps(1, end) infinite;
}
.ts-star-cyan { --sc: var(--cyan); }
.ts-star-big { box-shadow: 2px 0 var(--sc), -2px 0 var(--sc), 0 2px var(--sc), 0 -2px var(--sc); }

/* Liftoff loop: the stack waits behind the planet limb, then climbs off the top.
   It is drawn BEFORE .ts-planet in the DOM, so the limb hides the pad. */
.ts-rocket {
  position: absolute;
  left: 13%;
  bottom: 5vh;
  width: 42px;
  height: 176px;
  animation: tsLaunch 12s steps(320, end) 1.2s infinite;
}
.ts-rocket img {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  animation: tsShake 0.16s steps(1, end) infinite;
}

/* Marching hazard tape top + bottom, same stripe as every other modal */
.ts-stripe {
  position: absolute;
  left: 0;
  right: 0;
  height: 8px;
  background: var(--hazard-stripe) repeat-x;
  background-size: 24px 8px;
  image-rendering: pixelated;
  animation: tsTape 1.2s steps(12, end) infinite;
}
.ts-stripe-top { top: 0; }
.ts-stripe-bottom { bottom: 0; }

@keyframes tsStarsPulse { 0% { opacity: 1; } 50% { opacity: 0.55; } }
@keyframes tsTwinkle { 0% { opacity: 1; } 40% { opacity: 0.2; } 60% { opacity: 1; } }
@keyframes tsLaunch { 0%, 22% { transform: translateY(0); } 100% { transform: translateY(-125vh); } }
@keyframes tsShake { 0% { transform: translateX(0); } 50% { transform: translateX(2px); } }
@keyframes tsTape { to { background-position: 24px 0; } }
@keyframes tsBob { 0% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes tsHint { 50% { opacity: 0.3; } }

/* --- Foreground ----------------------------------------------------------------- */
.title-splash-card .ts-logo {
  width: min(660px, 92vw, 70vh);
  margin: 0;
}
.ts-logo img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  user-select: none;
  animation: tsBob 2.4s steps(1, end) infinite;
}
.title-splash-card .ts-tagline {
  margin: 2px 0 0;
  font-size: 26px;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: var(--cyan);
  text-shadow: 2px 2px 0 var(--ink);
}

.ts-crew {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
}
.ts-chip {
  --c: var(--hazard);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px 5px 3px;
  background: rgba(6, 8, 15, 0.82);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: var(--frame);
}
.ts-chip b {
  font-weight: 400;
  padding: 3px 7px 4px;
  background: var(--c);
  color: var(--ink);
}
.ts-c1 { --c: var(--hazard); }
.ts-c2 { --c: var(--red); }
.ts-c3 { --c: var(--purple); }
.ts-c4 { --c: var(--green); }

.title-splash-btn {
  --sky: #8fd3ff;
  --sky-hi: #d6f1ff;
  --sky-lo: #3f8fc9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-width: 230px;
  margin-top: 26px;
  background: var(--sky);
  color: var(--ink);
  border: 0;
  border-radius: 0;
  padding: 10px 46px 14px;
  font-family: var(--font);
  font-size: 40px;
  line-height: 1;
  letter-spacing: 3px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: inset 0 2px 0 0 var(--sky-hi), inset 0 -4px 0 0 var(--sky-lo), var(--frame), 0 4px 0 0 rgba(0, 0, 0, 0.5);
  animation: titleBtnBlink 1.2s steps(1, end) infinite;
}
/* Pixel play arrow: one 4px cell + box-shadow cells (widths 1,2,3,4,3,2,1), centred by the lift */
.title-splash-btn::before {
  content: '';
  flex: none;
  width: 4px;
  height: 4px;
  margin-right: 12px;
  background: var(--ink);
  transform: translateY(-12px);
  box-shadow:
    0 4px var(--ink), 4px 4px var(--ink),
    0 8px var(--ink), 4px 8px var(--ink), 8px 8px var(--ink),
    0 12px var(--ink), 4px 12px var(--ink), 8px 12px var(--ink), 12px 12px var(--ink),
    0 16px var(--ink), 4px 16px var(--ink), 8px 16px var(--ink),
    0 20px var(--ink), 4px 20px var(--ink),
    0 24px var(--ink);
}
.title-splash-btn:hover { background: var(--sky-hi); }
.title-splash-btn:focus-visible { outline: 0; }
.title-splash-btn:active {
  animation: none;
  transform: translateY(2px);
  box-shadow: inset 0 4px 0 0 var(--sky-lo), var(--frame);
}
/* Attract-mode frame blink: hard two-state swap, no easing */
@keyframes titleBtnBlink {
  0% { box-shadow: inset 0 2px 0 0 var(--sky-hi), inset 0 -4px 0 0 var(--sky-lo), var(--frame), 0 4px 0 0 rgba(0, 0, 0, 0.5); }
  50% { box-shadow: inset 0 2px 0 0 var(--sky-hi), inset 0 -4px 0 0 var(--sky-lo), var(--frame-cyan), 0 4px 0 0 rgba(0, 0, 0, 0.5); }
}
.title-splash-card .ts-hint {
  margin: 14px 0 0;
  font-size: 20px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  text-shadow: 2px 2px 0 var(--ink);
  animation: tsHint 1.2s steps(1, end) infinite;
}

/* Official NASA Space Apps mark, untouched: black-on-transparent artwork, so it gets
   its own small light chip. Native proportions, smooth scaling (not pixel art). */
.ts-nasa {
  position: fixed;
  right: 24px;
  bottom: 28px;
  width: 116px;
  padding: 8px 10px;
  background: #f7f7f7;
  box-shadow: var(--frame), 0 4px 0 0 rgba(0, 0, 0, 0.5);
}
.ts-nasa img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: auto; /* page-level pixelated is inherited; override it here */
  user-select: none;
}

@media (prefers-reduced-motion: reduce) {
  .ts-stars, .ts-star, .ts-rocket, .ts-rocket img, .ts-stripe,
  .ts-logo img, .title-splash-btn, .title-splash-card .ts-hint { animation: none; }
  .ts-rocket { display: none; }
}
@media (max-height: 560px) {
  .modal-card.title-splash-card { padding: 16px 0 40px; }
  .title-splash-card .ts-logo { width: min(660px, 92vw, 62vh); }
  .title-splash-card .ts-tagline { font-size: 20px; letter-spacing: 3px; }
  .ts-crew { margin-top: 10px; }
  .ts-chip { font-size: 18px; }
  .title-splash-btn { margin-top: 14px; font-size: 32px; padding: 6px 34px 10px; min-width: 190px; }
  .title-splash-card .ts-hint { display: none; }
  .ts-nasa { width: 88px; right: 16px; bottom: 20px; }
}
@media (max-width: 560px) {
  .title-splash-card .ts-tagline { font-size: 20px; letter-spacing: 2px; }
  .ts-chip { font-size: 18px; }
  .ts-nasa { position: static; width: 104px; margin-top: 20px; }
  .ts-rocket { left: 6%; }
}

/* ==========================================================================
   CREW LOBBY (pre-game step 2, see src/lobby-ui.js)
   Scoped to #modal-content.lobby-card; Mission Setup / Debrief are untouched.
   ========================================================================== */
.modal-card:focus { outline: 0; }
.modal-card.lobby-card {
  width: min(1040px, 96vw);
  max-width: 96vw;
  padding: 20px 24px 18px;
}
.lobby-card h1 { margin: 2px 0 4px; }

.lobby-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.lobby-head-copy { flex: 1 1 300px; min-width: 0; }
.lobby-sub {
  font-size: 17px;
  line-height: 1.3;
  color: var(--muted);
}

.lobby-code-box {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 8px 10px;
  padding: 8px 10px;
  background: var(--panel-2);
  box-shadow: var(--bevel), var(--frame-cyan);
}
.lobby-code-label { font-size: 15px; letter-spacing: 1px; text-transform: uppercase; color: var(--cyan); }
.lobby-code { display: flex; gap: 4px; user-select: text; cursor: text; }
.lobby-code span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 38px;
  background: var(--ink);
  color: var(--hazard);
  font-size: 32px;
  line-height: 1;
  text-shadow: 2px 2px 0 var(--lo);
  box-shadow: var(--bevel);
}
.lobby-code-actions { display: flex; gap: 6px; }

.lobby-mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 10px 6px;
  border: 0;
  border-radius: 0;
  background: var(--panel-3);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  box-shadow: inset 0 2px 0 0 rgba(255, 255, 255, 0.16), inset 0 -3px 0 0 rgba(0, 0, 0, 0.35), var(--frame);
}
.lobby-mini-btn .px-ico { vertical-align: 0; }
.lobby-mini-btn:hover { filter: brightness(1.15); }
.lobby-mini-btn:active { transform: translateY(2px); box-shadow: inset 0 3px 0 0 rgba(0, 0, 0, 0.35), var(--frame); }
.lobby-mini-btn:focus-visible,
.swatch:focus-visible,
.tile:focus-visible,
.lobby-toggle:focus-visible,
.slot-btn:focus-visible,
.lobby-card .btn-play:focus-visible,
.lobby-card .btn-secondary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.lobby-body {
  display: grid;
  grid-template-columns: minmax(300px, 340px) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 12px;
}
.lobby-panel {
  min-width: 0;
  padding: 10px 12px 12px;
  background: var(--panel-2);
  box-shadow: var(--bevel), var(--frame);
}
.lobby-card .lobby-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 17px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--cyan);
  text-shadow: none;
}
.lobby-count { color: var(--hazard); }

/* --- crew list (Among Us style rows) --- */
.lobby-slots { list-style: none; display: grid; gap: 8px; }
.lobby-slot {
  position: relative;
  display: grid;
  grid-template-columns: 38px 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 68px;
  padding: 6px 8px 6px 14px;
  background: var(--panel);
  box-shadow: var(--bevel), var(--frame);
}
.lobby-slot::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: var(--role);
}
.lobby-slot.is-you { box-shadow: var(--bevel), var(--frame-hazard); }
.lobby-slot.is-open { background: var(--lo); }
.lobby-slot.is-open::before { opacity: 0.45; }

.slot-seat { display: flex; flex-direction: column; gap: 2px; line-height: 1; }
.slot-seat b { font-size: 21px; color: var(--role); }
.slot-seat small { font-size: 12px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); }

.slot-portrait {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  overflow: hidden;
  background: var(--ink);
  box-shadow: inset 0 0 0 2px var(--lo);
}
.slot-portrait canvas { display: block; width: 56px; height: 56px; image-rendering: pixelated; }
.slot-portrait.is-empty { box-shadow: inset 0 0 0 2px var(--panel-3); }
.slot-q { font-size: 34px; color: var(--panel-3); text-shadow: 2px 2px 0 var(--lo); }

.slot-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.slot-name {
  font-size: 22px;
  line-height: 1;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slot-waiting { color: var(--muted); font-size: 19px; }
.slot-waiting::after { content: ''; animation: lobbyDots 1.2s steps(1, end) infinite; }
@keyframes lobbyDots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}
.slot-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.slot-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px 3px;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--ink);
  box-shadow: inset 0 0 0 2px var(--panel-3);
}
.slot-tag .px-ico { --cell: 1px; vertical-align: 0; }
.slot-tag.tag-host { color: var(--hazard); box-shadow: inset 0 0 0 2px var(--hazard-lo); }
.slot-tag.tag-you { color: var(--green); box-shadow: inset 0 0 0 2px var(--green-lo); }
.slot-tag.tag-bot { color: var(--cyan); box-shadow: inset 0 0 0 2px var(--cyan-lo); }
.slot-hint { font-size: 14px; color: var(--muted); }

.slot-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.slot-state {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 15px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}
.slot-state .px-ico { vertical-align: 0; }
.slot-state.is-ready { color: var(--green); }
.slot-state.is-wait { color: var(--hazard); }
.slot-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-inline-size: 24px;
  min-block-size: 24px;
  gap: 5px;
  padding: 3px 8px 5px;
  border: 0;
  border-radius: 0;
  background: var(--panel-3);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: inset 0 2px 0 0 rgba(255, 255, 255, 0.16), inset 0 -2px 0 0 rgba(0, 0, 0, 0.35), var(--frame);
}
.slot-btn .px-ico { --cell: 1px; vertical-align: 0; }
.slot-btn:hover { filter: brightness(1.15); }
.slot-btn:active { transform: translateY(2px); }

/* --- astronaut customizer --- */
.lobby-custom-grid { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; }
.lobby-preview { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lobby-preview-stage {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 150px;
  height: 238px;
  padding-bottom: 8px;
  background: var(--ink) var(--dots);
  background-size: 16px 16px;
  box-shadow: inset 0 0 0 2px var(--lo), var(--frame);
}
.lobby-preview-stage::after {
  content: '';
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 6px;
  height: 6px;
  background: var(--panel-3);
  box-shadow: inset 0 2px 0 0 var(--hi);
}
.lobby-preview-canvas { position: relative; z-index: 1; display: block; image-rendering: pixelated; }
.lobby-turn { display: flex; gap: 6px; width: 100%; }
.lobby-turn .lobby-mini-btn { flex: 1; }
.lobby-random { width: 100%; }

.lobby-fields { display: grid; align-content: start; gap: 9px; min-width: 0; }
.lobby-field { display: grid; gap: 4px; min-width: 0; transition: none; }
.lobby-field.is-dim { opacity: 0.45; }
.lobby-field-label { font-size: 15px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.lobby-field-label em { margin-left: 6px; font-style: normal; letter-spacing: 0; text-transform: none; color: var(--hazard); }
.lobby-field-inline { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.lobby-hint { font-style: normal; font-size: 14px; color: var(--muted); }

.lobby-name-row { display: flex; gap: 6px; }
.lobby-input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 2px 10px 4px;
  border: 0;
  border-radius: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font);
  font-size: 22px;
  letter-spacing: 1px;
  user-select: text;
  box-shadow: inset 0 2px 0 0 var(--lo), var(--frame);
}
.lobby-input:focus { outline: 0; box-shadow: inset 0 2px 0 0 var(--lo), var(--frame-hazard); }

.swatch-row,
.tile-row { display: flex; flex-wrap: wrap; gap: 5px; padding: 3px; }
.swatch {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--sw);
  cursor: pointer;
  box-shadow: inset 0 2px 0 0 rgba(255, 255, 255, 0.28), inset 0 -3px 0 0 rgba(0, 0, 0, 0.3), var(--frame);
}
.swatch:hover { filter: brightness(1.12); }
.swatch:active { transform: translateY(2px); }
.swatch.selected {
  box-shadow: inset 0 2px 0 0 rgba(255, 255, 255, 0.28), inset 0 -3px 0 0 rgba(0, 0, 0, 0.3), var(--frame-hazard), 0 0 0 4px var(--ink);
}

.tile {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--panel);
  color: var(--muted);
  font-family: var(--font);
  font-size: 14px;
  cursor: pointer;
  box-shadow: var(--bevel), var(--frame);
}
.tile canvas { display: block; width: 34px; height: 30px; image-rendering: pixelated; }
.tile.tile-flag { width: 54px; }
.tile.tile-flag canvas { width: 46px; height: 32px; }
.tile:hover { background: var(--panel-3); }
.tile:active { transform: translateY(2px); }
.tile.selected {
  background: #33301f;
  color: var(--hazard);
  box-shadow: inset 0 2px 0 0 #5a5030, inset 0 -2px 0 0 var(--lo), var(--frame-hazard), 0 0 0 4px var(--ink);
}

.lobby-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 6px;
  border: 0;
  border-radius: 0;
  background: var(--panel-3);
  color: var(--muted);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: inset 0 2px 0 0 rgba(255, 255, 255, 0.16), inset 0 -3px 0 0 rgba(0, 0, 0, 0.35), var(--frame);
}
.lobby-toggle .px-ico { vertical-align: 0; }
.lobby-toggle:hover { filter: brightness(1.15); }
.lobby-toggle:active { transform: translateY(2px); }
.lobby-toggle[aria-checked='true'] {
  background: #1d3a2b;
  color: var(--green);
  box-shadow: inset 0 2px 0 0 #2f6a4a, inset 0 -3px 0 0 var(--lo), var(--frame-green);
}

/* --- footer --- */
.lobby-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 14px; }
.lobby-status {
  display: flex;
  align-items: center;
  flex: 1 1 280px;
  gap: 8px;
  min-width: 0;
  font-size: 18px;
  line-height: 1.25;
  color: var(--muted);
}
.lobby-status .px-ico { vertical-align: 0; }
.lobby-status.is-wait { color: var(--hazard); }
.lobby-foot-actions { display: flex; gap: 12px; margin-left: auto; padding: 4px; }
.btn-play:disabled {
  cursor: not-allowed;
  background: var(--panel-3);
  color: var(--muted);
  box-shadow: inset 0 2px 0 0 rgba(255, 255, 255, 0.12), inset 0 -4px 0 0 rgba(0, 0, 0, 0.35), var(--frame), 0 4px 0 0 rgba(0, 0, 0, 0.5);
}
.btn-play:disabled:hover { filter: none; }
.btn-play:disabled:active { transform: none; }

@media (max-width: 900px) {
  .lobby-head { flex-direction: column; align-items: stretch; }
  .lobby-head-copy { flex: 0 0 auto; }
  .lobby-code-box { justify-content: space-between; }
  .lobby-body { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .modal-card.lobby-card { padding: 16px 12px 14px; }
  .lobby-code-box { flex-wrap: wrap; }
  .lobby-custom-grid { grid-template-columns: 1fr; justify-items: center; }
  .lobby-fields { justify-self: stretch; }
  .lobby-slot { grid-template-columns: 34px 48px minmax(0, 1fr) auto; gap: 6px; padding-left: 12px; }
  .slot-portrait, .slot-portrait canvas { width: 48px; height: 48px; }
  .lobby-foot-actions { width: 100%; justify-content: flex-end; }
}
@media (prefers-reduced-motion: reduce) {
  .slot-waiting::after { animation: none; content: '...'; }
}

.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 14px 0 20px;
  padding: 2px;
}
.guide-card {
  background: var(--panel-2);
  padding: 13px 15px;
  font-size: 16px;
  color: var(--muted);
  line-height: 1.5;
  box-shadow: var(--bevel), var(--frame);
}
.guide-card b { color: var(--text); }
.guide-card > b:first-child { display: block; color: var(--hazard); font-size: 18px; margin-bottom: 6px; }

/* --- Snackbar toast --- */
.mission-toast {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  color: var(--text);
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  max-width: 700px;
  z-index: 30;
  pointer-events: none;
  box-shadow: var(--bevel), var(--frame-cyan), 0 0 0 4px var(--ink), 0 8px 0 0 rgba(0, 0, 0, 0.5);
  animation: fadeUpToast 0.2s steps(3, end);
}
.mission-toast.hidden { display: none; }
.mission-toast .toast-tag {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 7px 4px;
  background: var(--hazard);
  color: var(--ink);
  white-space: nowrap;
  box-shadow: inset 0 -2px 0 0 var(--hazard-lo);
}
@keyframes fadeUpToast {
  from { transform: translate(-50%, 12px); }
  to { transform: translate(-50%, 0); }
}

.cml-review-header {
  margin-bottom: 10px;
}
.cml-warn-badge {
  display: inline-block;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 4px 8px 5px;
  background: var(--hazard);
  color: var(--ink);
  box-shadow: inset 0 -2px 0 0 var(--hazard-lo), var(--frame);
}
.audit-missing-list {
  list-style: none;
  padding-left: 2px;
  color: var(--text);
  font-size: 17px;
  line-height: 1.7;
}
.audit-missing-list li::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  background: var(--hazard);
  vertical-align: 2px;
}
.audit-missing-list li:has(.px-ico)::before { display: none; }
.audit-missing-list .px-ico { margin-right: 6px; }
.audit-penalty-note {
  margin-top: 8px;
  font-size: 16px;
  color: var(--hazard);
  font-weight: 600;
}

.pillar-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 14px;
  padding: 2px;
}
.pillar-card {
  background: var(--panel-2);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--bevel), var(--frame);
}
.pillar-card h4,
.pillar-card .pillar-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.pillar-card p,
.pillar-card small {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.4;
}
.grade-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 2px 7px 3px;
  font-size: 17px;
  font-weight: 700;
  background: var(--ink);
  color: var(--cyan);
  box-shadow: inset 0 0 0 2px var(--cyan-lo);
}
.grade-pill.grade-s { color: var(--hazard); box-shadow: inset 0 0 0 2px var(--hazard); }
.grade-pill.grade-a { color: var(--green); box-shadow: inset 0 0 0 2px var(--green); }
.grade-pill.grade-b { color: var(--cyan); box-shadow: inset 0 0 0 2px var(--cyan); }
.grade-pill.grade-c { color: var(--red); box-shadow: inset 0 0 0 2px var(--red); }
.grade-pill.grade-lg { font-size: 19px; padding: 5px 12px 6px; }

/* --- Stage 5 debrief --- */
.debrief-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.debrief-head h1 { margin: 4px 0 0; display: flex; align-items: center; gap: 10px; }
.debrief-stars { display: inline-flex; gap: 2px; }
.debrief-stars .px-ico { --cell: 3px; }
.gate-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin: 2px 2px 16px;
}
.gate-banner.ok { background: #173a2a; color: #c8f7d3; box-shadow: inset 0 2px 0 0 var(--green-lo), var(--frame-green); }
.gate-banner.warn { background: #3a3220; color: var(--hazard-hi); box-shadow: inset 0 2px 0 0 var(--hazard-lo), var(--frame-hazard); }
.gate-label { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; opacity: 0.85; }
.gate-verdict { font-size: 20px; font-weight: 700; margin-top: 2px; }
.gate-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.check-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px 4px;
  font-size: 14px;
  font-weight: 700;
  background: var(--ink);
}
.check-tag.pass { color: var(--green); box-shadow: inset 0 0 0 2px var(--green-lo); }
.check-tag.miss { color: var(--red); box-shadow: inset 0 0 0 2px var(--red-lo); }
.log-good { color: var(--green); }
.log-warn { color: var(--hazard); }
.log-info { color: var(--cyan); }

/* --- Pause overlay over the canvas --- */
.pause-overlay {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 12, 0.5) var(--dither);
  background-size: 4px 4px;
  image-rendering: pixelated;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 30;
  padding: 20px;
}
.pause-overlay.hidden { display: none; }
.pause-card {
  background: var(--panel);
  padding: 26px 30px 24px;
  width: min(440px, 92vw);
  text-align: center;
  box-shadow: inset 0 0 0 2px var(--hi), inset 0 0 0 4px var(--lo), var(--frame-hazard), 0 0 0 6px var(--ink), 0 12px 0 0 rgba(0, 0, 0, 0.5);
}
.pause-badge {
  display: inline-block;
  padding: 3px 8px 4px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  background: var(--hazard);
  color: var(--ink);
  margin-bottom: 12px;
  box-shadow: inset 0 -2px 0 0 var(--hazard-lo);
}
.pause-card h2 {
  font-size: 36px;
  font-weight: 700;
  color: var(--text);
  text-shadow: 3px 3px 0 var(--ink);
  margin-bottom: 8px;
  letter-spacing: 1px;
}
.pause-sub {
  font-size: 17px;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.4;
}
.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 4px;
}
.pause-actions button { width: 100%; }

/* --- Corner UI spotlight tour --- */
.ui-tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: auto;
}
.ui-tour-overlay.hidden { display: none; }
.ui-tour-svg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  pointer-events: none;
}
.ui-tour-ring {
  position: fixed;
  border-radius: 0;
  box-shadow: var(--frame-hazard), 0 0 0 4px var(--ink), 0 0 0 6px var(--hazard);
  pointer-events: none;
  z-index: 61;
  transition: left 0.2s steps(4, end), top 0.2s steps(4, end), width 0.2s steps(4, end), height 0.2s steps(4, end);
  animation: tourRingBlink 1s steps(2, jump-none) infinite;
}
@keyframes tourRingBlink {
  50% { box-shadow: var(--frame-hazard), 0 0 0 4px var(--ink), 0 0 0 6px var(--hazard-lo); }
}
.ui-tour-card {
  position: fixed;
  width: min(430px, calc(100vw - 28px));
  background: var(--panel);
  padding: 14px 16px;
  color: var(--text);
  z-index: 62;
  box-shadow: inset 0 0 0 2px var(--hi), var(--frame-hazard), 0 0 0 4px var(--ink), 0 10px 0 0 rgba(0, 0, 0, 0.55);
  transition: left 0.2s steps(4, end), top 0.2s steps(4, end);
}
.ui-tour-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.ui-tour-badge {
  display: inline-block;
  padding: 2px 7px 3px;
  background: var(--hazard);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.6px;
  box-shadow: inset 0 -2px 0 0 var(--hazard-lo);
}
.ui-tour-corner {
  font-size: 14px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.6px;
}
.ui-tour-card h3 {
  font-size: 22px;
  font-weight: 700;
  color: var(--hazard);
  text-shadow: 2px 2px 0 var(--ink);
  margin-bottom: 6px;
}
.ui-tour-card p {
  font-size: 17px;
  line-height: 1.45;
  color: var(--text);
  margin-bottom: 12px;
}
.ui-tour-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.ui-tour-keys {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}
.ui-tour-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  padding: 2px;
}
.ui-tour-btn {
  border: 0;
  border-radius: 0;
  padding: 6px 10px 7px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: inset 0 2px 0 0 rgba(255, 255, 255, 0.16), inset 0 -3px 0 0 rgba(0, 0, 0, 0.35), var(--frame);
}
.ui-tour-btn:hover:not(:disabled) { filter: brightness(1.15); }
.ui-tour-btn:active:not(:disabled) { transform: translateY(2px); }
.ui-tour-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ui-tour-btn-primary { background: var(--hazard); color: var(--ink); box-shadow: inset 0 2px 0 0 var(--hazard-hi), inset 0 -3px 0 0 var(--hazard-lo), var(--frame); }
.ui-tour-btn-ghost { background: var(--panel-3); color: var(--text); }

/* Narrow laptops: keep the telemetry strip on as few rows as possible */
@media (max-width: 1240px) {
  .t-bar { display: none; }
  .t-stat { font-size: 14px; padding: 3px 6px; }
  .controls-hint { font-size: 14px; padding: 5px 8px; }
  .controls-hint kbd { font-size: 13px; padding: 0 4px 1px; }
}

@media (max-width: 720px) {
  .opt-group, .config-row, .guide-grid, .debrief-kpis, .pillar-grid { grid-template-columns: 1fr; }
}

/* --- NASA Spacecraft Blueprint Schematic Drawer (Pixel UI) --- */
.blueprint-overlay {
  position: absolute;
  top: 12px;
  right: 14px;
  bottom: 12px;
  width: min(532px, calc(100% - 28px));
  max-height: calc(100% - 24px);
  background:
    linear-gradient(rgba(79, 214, 240, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 214, 240, 0.06) 1px, transparent 1px),
    #0b152a;
  background-size: 16px 16px, 16px 16px, 100% 100%;
  box-shadow: inset 0 0 0 2px var(--hi), inset 0 0 0 4px var(--lo), var(--frame-cyan), 0 0 0 6px var(--ink), var(--drop);
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  gap: 8px;
  z-index: 28;
  pointer-events: auto;
  color: var(--text);
  overflow: hidden;
  animation: bpSlideIn 0.16s steps(4, end);
}
.blueprint-overlay.hidden { display: none; }
@keyframes bpSlideIn {
  from { transform: translateX(16px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.bp-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 2px solid var(--hi);
  padding-bottom: 6px;
}
.bp-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.bp-tag {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.7px;
  color: var(--cyan);
}
.bp-heading-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.bp-heading-row h3 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  text-shadow: 2px 2px 0 var(--ink);
  line-height: 1.05;
}
.bp-header-progress {
  font-size: 14px;
  font-weight: 700;
  padding: 2px 7px;
  background: var(--ink);
  box-shadow: inset 0 0 0 2px var(--cyan-lo);
  color: var(--cyan);
}
.bp-header-progress.complete {
  background: #173a2a;
  box-shadow: inset 0 0 0 2px var(--green);
  color: var(--green);
}
.bp-close-btn {
  border: 0;
  background: var(--panel-3);
  color: var(--text);
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 2px 0 0 rgba(255, 255, 255, 0.16), inset 0 -3px 0 0 rgba(0, 0, 0, 0.35), var(--frame);
}
.bp-close-btn:hover { filter: brightness(1.18); }
.bp-close-btn:active { transform: translateY(2px); }
.bp-subtitle {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
  color: #cfe9f8;
  background: var(--panel);
  box-shadow: inset 0 2px 0 0 var(--hi), var(--frame);
  padding: 5px 8px;
}
.bp-subtitle-hint {
  font-size: 13px;
  color: var(--cyan);
}
.bp-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 10px;
  align-items: stretch;
  overflow-y: auto;
  scrollbar-width: thin;
}
.bp-diagram-pane {
  background: var(--ink);
  box-shadow: inset 0 0 0 2px var(--cyan-lo), var(--frame);
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}
.bp-rocket-svg {
  width: 100%;
  height: 100%;
  max-height: 430px;
  display: block;
}
.bp-svg-mod.bp-clickable {
  cursor: pointer;
}
.bp-svg-mod.bp-clickable:hover .bp-shape {
  stroke: var(--text);
  fill: rgba(79, 214, 240, 0.24);
}
.bp-svg-mod .bp-shape {
  fill: rgba(79, 214, 240, 0.08);
  stroke: var(--cyan);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}
.bp-svg-mod.bp-svg-built .bp-shape {
  fill: rgba(95, 224, 124, 0.22);
  stroke: var(--green);
  stroke-width: 1.8;
  stroke-dasharray: none;
}
.bp-svg-mod.bp-svg-target .bp-shape {
  stroke: var(--hazard);
  stroke-width: 2;
  fill: rgba(246, 196, 69, 0.18);
}
.bp-svg-mod.bp-svg-built.bp-svg-target .bp-shape {
  stroke: var(--hazard);
  fill: rgba(95, 224, 124, 0.3);
}
.bp-svg-label {
  font-family: var(--font);
  font-size: 11px;
  fill: var(--cyan);
}
.bp-svg-built .bp-svg-label { fill: var(--green); }
.bp-svg-target .bp-svg-label { fill: var(--hazard); }

.bp-modules-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 2px;
}
.bp-mod-card {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bp-mod-card.bp-clickable {
  cursor: pointer;
}
.bp-mod-card.bp-clickable:hover {
  filter: brightness(1.14);
}
.bp-mod-card.bp-card-needed {
  background: var(--panel);
  box-shadow: inset 0 0 0 2px var(--cyan-lo), var(--frame);
}
.bp-mod-card.bp-card-built {
  background: #173a2a;
  box-shadow: inset 0 2px 0 0 var(--green-lo), var(--frame-green);
}
.bp-mod-card.bp-card-target {
  box-shadow: inset 0 2px 0 0 var(--hazard-lo), var(--frame-hazard);
}
.bp-mod-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.bp-mod-title-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.bp-mod-slot {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--cyan);
  text-transform: uppercase;
  line-height: 1;
}
.bp-mod-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
}
.bp-mod-badges {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.bp-req-tag {
  font-size: 12px;
  font-weight: 700;
  padding: 1px 5px;
  background: var(--ink);
  box-shadow: inset 0 0 0 1px var(--hazard);
  color: var(--hazard);
}
.bp-req-tag.met {
  background: var(--ink);
  box-shadow: inset 0 0 0 1px var(--green);
  color: var(--green);
}
.bp-status-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 1px 6px;
  white-space: nowrap;
  background: var(--ink);
}
.bp-status-pill.built {
  box-shadow: inset 0 0 0 1px var(--green);
  color: var(--green);
}
.bp-status-pill.needed {
  box-shadow: inset 0 0 0 1px var(--cyan-lo);
  color: var(--cyan);
}
.bp-status-pill.target {
  box-shadow: inset 0 0 0 1px var(--hazard);
  color: var(--hazard);
}
.bp-mod-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.bp-mod-gains {
  color: var(--green);
  font-weight: 700;
}
.bp-mod-card.bp-card-needed .bp-mod-gains {
  color: var(--cyan);
}
.bp-mod-parts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}
.bp-part-chip {
  font-size: 13px;
  font-weight: 600;
  padding: 3px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--ink);
  box-shadow: inset 0 0 0 1px var(--hi);
  color: #bfefff;
}
.bp-part-chip.ready {
  background: #173a2a;
  box-shadow: inset 0 0 0 1px var(--green);
  color: var(--green);
}
.bp-part-chip.built-part {
  background: #153126;
  box-shadow: inset 0 0 0 1px var(--green-lo);
  color: #a6f5b6;
}
.bp-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 2px solid var(--hi);
  padding-top: 6px;
  font-size: 14px;
  color: var(--muted);
}
.bp-footer-bonus {
  font-weight: 700;
  color: var(--hazard);
}
.bp-footer-bonus.unlocked {
  color: var(--green);
}

/* ==========================================================================
   ONLINE 4P WEBSOCKET LOBBY
   ========================================================================== */
.ws-lobby-card {
  background: var(--panel-2);
  padding: 10px 12px;
  box-shadow: var(--bevel), var(--frame);
}
.ws-lobby-connected {
  background: #14263a;
  box-shadow: inset 0 2px 0 0 var(--cyan-lo), var(--frame-cyan);
}
.ws-form-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.ws-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ws-field span {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.ws-input {
  width: 100%;
  background: var(--ink);
  color: var(--text);
  border: 0;
  border-radius: 0;
  padding: 6px 8px;
  font-family: var(--font);
  font-size: 16px;
  user-select: text;
  box-shadow: inset 0 0 0 2px var(--hi);
}
.ws-input:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--cyan);
}
.ws-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.ws-join-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ws-code-input {
  width: 94px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 18px;
  color: var(--hazard);
}
.ws-btn-host {
  background: #173a2a;
  color: var(--green);
  padding: 7px 14px 8px;
  font-size: 16px;
  box-shadow: inset 0 2px 0 0 var(--green-lo), var(--frame-green);
}
.ws-btn-join {
  background: #18324a;
  color: var(--cyan);
  padding: 7px 14px 8px;
  font-size: 16px;
  box-shadow: inset 0 2px 0 0 var(--cyan-lo), var(--frame-cyan);
}
.ws-btn-sm {
  padding: 5px 10px 6px;
  font-size: 15px;
}
.ws-btn-danger {
  background: #3d1820;
  color: var(--red);
  box-shadow: inset 0 2px 0 0 var(--red-lo), var(--frame-red);
}
.ws-hint {
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.3;
}
.ws-hint code {
  background: var(--ink);
  color: var(--cyan);
  padding: 1px 5px;
}
.ws-error {
  margin-top: 8px;
  padding: 6px 10px;
  background: #3d1820;
  color: #ffc2c2;
  font-size: 15px;
  box-shadow: var(--frame-red);
}
.ws-lobby-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.ws-room-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 17px;
  color: var(--text);
}
.ws-room-pill b {
  color: var(--hazard);
  letter-spacing: 2px;
}
.ws-role-tag {
  padding: 2px 6px;
  font-size: 13px;
  font-weight: 700;
  background: var(--ink);
}
.ws-role-tag.host {
  color: var(--hazard);
  box-shadow: inset 0 0 0 1px var(--hazard);
}
.ws-role-tag.guest {
  color: var(--cyan);
  box-shadow: inset 0 0 0 1px var(--cyan);
}
.ws-meta {
  font-size: 14px;
  color: var(--muted);
}
.ws-lobby-head-actions {
  display: flex;
  gap: 8px;
}
.ws-slots-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.ws-slot-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  background: var(--panel);
  border: 0;
  border-radius: 0;
  text-align: left;
  cursor: pointer;
  font-family: var(--font);
  color: var(--text);
  box-shadow: var(--bevel), var(--frame);
}
.ws-slot-btn:hover { background: var(--panel-3); }
.ws-slot-btn.mine {
  background: #33301f;
  box-shadow: inset 0 2px 0 0 #5a5030, var(--frame-hazard);
}
.ws-slot-btn.taken {
  background: #173044;
  box-shadow: inset 0 2px 0 0 var(--cyan-lo), var(--frame-cyan);
}
.ws-slot-dot {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--ink);
}
.ws-slot-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ws-slot-copy b {
  font-size: 15px;
  color: var(--text);
  line-height: 1.1;
}
.ws-slot-copy small {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-lobby-note {
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
}
.btn-play:disabled,
.opt-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.btn-bot.ws-live {
  background: #173a2a;
  color: var(--green);
  box-shadow: inset 0 2px 0 0 var(--green-lo), var(--frame-green);
}

/* Online 4P connection bar inside Crew Lobby (strict 2px pixel framing) */
.lobby-net-bar {
  margin-bottom: 12px;
  padding: 8px 10px;
  background: var(--panel-2);
  box-shadow: var(--bevel), var(--frame);
}
.lobby-net-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.lobby-net-row.is-online { justify-content: space-between; }
.lobby-net-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 4px;
  font-size: 14px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--muted);
  box-shadow: inset 0 0 0 2px var(--panel-3);
}
.lobby-net-pill.is-host {
  color: var(--hazard);
  box-shadow: inset 0 0 0 2px var(--hazard-lo);
}
.lobby-net-pill.is-guest {
  color: var(--cyan);
  box-shadow: inset 0 0 0 2px var(--cyan-lo);
}
.lobby-net-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  color: var(--text);
}
.lobby-net-meta b { color: var(--hazard); }
.lobby-net-url { flex: 1 1 200px; min-width: 160px; font-size: 15px; padding: 4px 8px; }
.lobby-net-code { width: 92px; flex: 0 0 auto; text-transform: uppercase; text-align: center; letter-spacing: 2px; font-size: 16px; padding: 4px 6px; }
.lobby-net-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.lobby-btn-accent {
  background: #173044;
  color: var(--cyan);
  box-shadow: inset 0 2px 0 0 var(--cyan-lo), inset 0 -3px 0 0 var(--lo), var(--frame-cyan);
}
.lobby-btn-danger {
  background: #3a1a22;
  color: var(--red);
  box-shadow: inset 0 2px 0 0 var(--red-lo), inset 0 -3px 0 0 var(--lo), var(--frame-red);
}
.lobby-net-err {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0;
  padding: 4px 8px;
  font-size: 15px;
  color: var(--red);
  background: #2b1318;
  box-shadow: inset 0 0 0 2px var(--red-lo);
}
.slot-btn-claim {
  color: var(--cyan);
  box-shadow: inset 0 2px 0 0 rgba(255, 255, 255, 0.14), inset 0 -3px 0 0 var(--lo), var(--frame-cyan);
}
.btn-play.is-ready-active {
  background: #1d3a2b;
  color: var(--green);
  box-shadow: inset 0 2px 0 0 #2f6a4a, inset 0 -4px 0 0 var(--lo), var(--frame-green), 0 4px 0 0 rgba(0, 0, 0, 0.5);
}
.lobby-mini-btn[data-copied] {
  color: var(--green);
  box-shadow: inset 0 2px 0 0 var(--green-lo), inset 0 -3px 0 0 var(--lo), var(--frame-green);
}
.lobby-mini-btn[data-failed] {
  color: var(--red);
  box-shadow: inset 0 2px 0 0 var(--red-lo), inset 0 -3px 0 0 var(--lo), var(--frame-red);
}
.ws-slot-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}
