:root {
  --bg: #05070d;
  --ink: #e8edf6;
  --muted: #8a94a8;
  --accent: #5ad1ff;
  --grass: #5a8f2e;   /* darker grasshopper green - join screen theme */
  --panel: rgba(10, 14, 22, 0.72);
  --line: rgba(120, 140, 170, 0.18);
}

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

html, body {
  /* Lock the page to the viewport so on-screen controls can never be scrolled
     or zoomed off-screen on mobile. position:fixed + 100% w/h pins it; dvh/svh
     track iOS's dynamic toolbars (with a 100vh fallback for old browsers). */
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  overflow: hidden;
  overscroll-behavior: none;       /* no rubber-band / pull-to-refresh scroll */
  touch-action: none;              /* no pinch-zoom / double-tap-zoom on the page */
  -webkit-text-size-adjust: 100%;  /* stop iOS auto-inflating text */
  text-size-adjust: 100%;
  -webkit-user-select: none;
  user-select: none;
}

#view {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none; /* we own all gestures (pinch-zoom); no browser scroll/zoom */
}

/* iOS: never let a tap select text, pop the callout menu, or flash a tap-highlight
   on the game surfaces (a tap in the station interior was "selecting" on iPhone).
   #interior-view owns its own pointer gestures, so kill the browser's too. */
#view, #interior, #interior-view, #touch-controls, #sandbox-ui, #dock-prompt, #hud, #onboard {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
#interior-view { touch-action: none; }

/* iOS auto-zooms the whole page when you focus an input under 16px. Keep text
   inputs at 16px so that focus zoom never triggers in the first place. */
input[type="text"], input[type="email"], input[type="password"], input:not([type]), textarea {
  font-size: 16px;
}

.hidden { display: none !important; }

/* ---------- HUD ----------
   Minimal: just the credit balance, top-left. No panel chrome - a small glow so
   it reads over the starfield. Contract guidance lives in the on-screen target
   arrow; fuel is the bar drawn under the ship. */
#hud {
  position: fixed;
  /* Insets keep the credits clear of the iPhone Dynamic Island / status bar in
     fullscreen, and a landscape notch on the left. */
  top: calc(12px + env(safe-area-inset-top));
  left: calc(14px + env(safe-area-inset-left));
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
#hud-credits {
  color: #ffd98a;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7), 0 0 14px rgba(255, 217, 138, 0.18);
}
#hud-cargo {
  margin-left: 12px;
  font-size: 14px;
  color: #9fd6e8;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7), 0 0 14px rgba(143, 207, 230, 0.16);
}
#hud-cargo.hidden { display: none; }

/* ---------- Pickup / delivery toast ---------- */
#toast {
  position: fixed;
  top: calc(22px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  padding: 9px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.05em;
  color: var(--ink);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
#toast.delivered { color: #ffd98a; border-color: rgba(255, 217, 138, 0.35); }
#toast.loaded { color: #6fe3c4; border-color: rgba(111, 227, 196, 0.35); }
/* Fuel-drone launch - warm amber/gold (the drone glyph colour), NOT the teal
   "loaded" tint, so the "Drone launched" toast reads as a utility dispatch. */
#toast.launch { color: #ffd23f; border-color: rgba(255, 210, 63, 0.4); }

/* ---------- Hint ---------- */
#hint {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  transition: opacity 1.2s ease;
  pointer-events: none;   /* informational only - never swallow a pan drag */
}
#hint b { color: var(--ink); font-weight: 600; }
#hint .nw { white-space: nowrap; }   /* keep each gesture phrase unbroken; wrap only at · */
#hint.fade { opacity: 0; }

/* ---------- Connection banner ---------- */
#conn {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  background: rgba(120, 40, 40, 0.85);
  border-radius: 8px;
  font-size: 12px;
  letter-spacing: 0.05em;
}

/* ---------- Join screen ---------- */
#join {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg); /* plain black - no glow behind the launch card */
}
.join-card {
  text-align: center;
  padding: 40px 44px;
  width: min(92vw, 380px);
}
.join-card h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--grass);
  text-shadow: 0 0 26px rgba(143, 194, 74, 0.40);
  margin-bottom: 6px;
  white-space: nowrap;
}
.join-card .tag {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 26px;
}
#name {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 15px;
  text-align: center;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  margin-bottom: 12px;
}
/* 16px keeps iOS Safari from auto-zooming the page when the field is focused. */
@media (pointer: coarse) { #name { font-size: 16px; } }
#name:focus { border-color: var(--grass); }
#launch {
  width: 100%;
  padding: 13px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #0c1505;
  background: var(--grass);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}
#launch:hover { filter: brightness(1.08); }
#launch:active { transform: scale(0.98); }

/* ---------- Reopen screen: Continue / Start new ---------- */
.resume-ship {
  font-size: 15px;
  letter-spacing: 0.04em;
  color: var(--ink);
  margin-bottom: 18px;
}
.resume-ship span { color: var(--grass); font-weight: 600; }
/* #continue reuses the primary green button styling (see the shared rule below). */
#continue {
  width: 100%;
  padding: 13px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #0c1505;
  background: var(--grass);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
  margin-bottom: 10px;
}
#continue:hover { filter: brightness(1.08); }
#continue:active { transform: scale(0.98); }
/* Secondary / destructive: a muted "ghost" button. */
.ghost-btn {
  width: 100%;
  padding: 10px;
  font: inherit;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: rgba(138, 148, 168, 0.85);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.ghost-btn:hover { color: #ff8a7a; border-color: rgba(255, 106, 90, 0.5); }
/* Sandbox entry on the join card: a calmer, cricket-teal accent (not the red of
   Start-new), with a little breathing room above it. */
.sandbox-btn { margin-top: 14px; }
.sandbox-btn:hover { color: #6fe3c4; border-color: rgba(111, 227, 196, 0.5); }

/* ---------- Sandbox controls (right edge, sandbox mode only) ---------- */
#sandbox-ui {
  position: fixed;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 14;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 168px;
  padding: 14px 14px 16px;
  background: rgba(10, 16, 22, 0.82);
  border: 1px solid rgba(111, 227, 196, 0.28);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  font-size: 11px;
  letter-spacing: 0.06em;
}
#sandbox-ui .sb-tag {
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: #6fe3c4;
  opacity: 0.9;
}
#sandbox-ui .sb-row { display: flex; flex-direction: column; gap: 7px; }
#sandbox-ui .sb-label { color: rgba(200, 214, 230, 0.92); font-weight: 600; }
#sandbox-ui input[type="range"] { width: 100%; accent-color: #6fe3c4; cursor: pointer; }
#sandbox-ui select {
  width: 100%;
  padding: 7px 8px;
  font: inherit;
  font-size: 12px;
  color: #d6e0f0;
  background: rgba(6, 10, 16, 0.9);
  border: 1px solid rgba(111, 227, 196, 0.3);
  border-radius: 8px;
  cursor: pointer;
}
/* On a phone the right-pinned panel sits clear of the bottom touch thrust button. */
body.touch #sandbox-ui { top: calc(16px + env(safe-area-inset-top)); transform: none; width: 150px; }
.join-card .fine {
  margin-top: 18px;
  color: rgba(138, 148, 168, 0.6);
  font-size: 11px;
  letter-spacing: 0.03em;
}

/* ---------- Startup hold ("entering orbit…") ----------
   Shown over the dark join backdrop AFTER Launch while the local ship's
   snapshot buffer fills, so the world is never shown mid-settle. Muted and
   restrained - no spinner - matching the rest of the UI. */
#entering {
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.12em;
  opacity: 0.85;
}

/* ---------- Docked prompt ----------
   A small pill near the bottom-center that fades in when docked, inviting the
   player into the shop. Cricket-grass accent so it reads as the "ground crew". */
#dock-prompt {
  position: fixed;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 16px;
  background: var(--panel);
  border: 1px solid rgba(143, 194, 74, 0.4);
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.05em;
  color: var(--ink);
  backdrop-filter: blur(8px);
  z-index: 8;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45), 0 0 18px rgba(143, 194, 74, 0.12);
}
#dock-prompt .dock-tag { color: #9ad36a; font-weight: 600; }
#dock-prompt #dock-name { color: var(--muted); }
#dock-open {
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #0c1505;
  background: var(--grass);
  border: none;
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.08s ease;
}
#dock-open:hover { filter: brightness(1.1); }
#dock-open:active { transform: scale(0.96); }
/* On touch (iPhone), the docked pill (with the OUTFIT/shop button) sits at the
   bottom, JUST ABOVE the thrust/turn controls: the 76px-tall .tc-btn row is
   anchored at bottom max(22px, safe-inset), so clear that height plus a small gap. */
body.touch #dock-prompt {
  top: auto;
  bottom: calc(max(22px, env(safe-area-inset-bottom)) + 76px + 14px);
}

/* STEP INSIDE button - opens the station-interior "colony" overlay. Cyan/teal so
   it reads distinct from the grass-green SHOP button next to it. */
#dock-inside {
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;     /* low letter-spacing so a wrapped 2nd line stays evenly spaced */
  text-align: center;          /* both lines centered when the label wraps on a narrow phone */
  line-height: 1.15;
  color: #04141a;
  background: #6fe3c4;
  border: none;
  border-radius: 16px;
  padding: 7px 16px;
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.08s ease;
}
#dock-inside:hover { filter: brightness(1.1); }
#dock-inside:active { transform: scale(0.96); }
/* Free-trial dock CTA - grass-green "sign in to use this station". */
#dock-signin {
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #04140a;
  background: var(--grass);
  border: none;
  border-radius: 16px;
  padding: 7px 16px;
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.08s ease;
}
#dock-signin:hover { filter: brightness(1.12); }
#dock-signin:active { transform: scale(0.96); }

/* ---------- Station interior ("the colony") overlay ----------
   A fullscreen top-down cutaway of the docked station, crew crickets walking
   around. The scene (incl. its title chip + all action buttons) is drawn on the
   canvas by colony.js; the DOM here is just the canvas. You leave only by
   walking out (board your ship) - there is no close button or Esc exit. */
#interior {
  position: fixed;
  inset: 0;
  z-index: 22;            /* above the shop (20) */
  background: #05070d;
  animation: interiorFade 0.45s ease;
}
@keyframes interiorFade { from { opacity: 0; } to { opacity: 1; } }
#interior-view { display: block; width: 100%; height: 100%; }

/* ---------- Outfitting shop ----------
   A distinct, calm panel - darker than the world, a thin segmented green header
   bar evoking a cricket's banded body, monospace throughout. Rows list each
   upgrade with a level read-out, current effect, and a buy button. */
#shop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 11, 0.7);
  backdrop-filter: blur(4px);
}
.shop-card {
  width: min(94vw, 460px);
  max-height: 86vh;
  /* overflow-x hidden clips the rounded corners / header stripe; overflow-y auto
     keeps a tall list (small screens) scrollable. (A prior `overflow:hidden`
     shorthand here silently killed the scroll.) */
  overflow-x: hidden;
  overflow-y: auto;
  background: linear-gradient(180deg, #0c1410 0%, #0a0e15 100%);
  border: 1px solid rgba(143, 194, 74, 0.28);
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(143, 194, 74, 0.06);
}
.shop-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.shop-titles { flex: 1; }
.shop-station {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #c7e6a0;
}
.shop-sub {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--muted);
  margin-top: 2px;
}
.shop-bal {
  text-align: right;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--muted);
  line-height: 1.5;
}
.shop-bal span { font-size: 16px; font-weight: 700; color: #ffd98a; letter-spacing: 0.02em; }
#shop-close {
  align-self: flex-start;
  width: 30px;
  height: 30px;
  font: inherit;
  font-size: 15px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease;
}
#shop-close:hover { color: var(--ink); border-color: rgba(200, 210, 230, 0.4); }
.shop-list { padding: 8px 14px 6px; }
.shop-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 6px;
  border-bottom: 1px solid rgba(120, 140, 170, 0.1);
}
.shop-row:last-child { border-bottom: none; }
.shop-row.special { background: rgba(111, 227, 196, 0.05); border-radius: 10px; padding-left: 10px; padding-right: 10px; }
.shop-row-main { flex: 1; min-width: 0; }
.shop-row-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.shop-row-name .pips { letter-spacing: 2px; font-size: 11px; color: #9ad36a; }
.shop-row-blurb {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  letter-spacing: 0.02em;
}
.shop-row-blurb .eff { color: #8fd0ff; }
.shop-buy {
  flex: none;
  min-width: 84px;
  text-align: center;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #0c1505;
  background: var(--grass);
  border: none;
  border-radius: 9px;
  padding: 9px 10px;
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.08s ease;
}
.shop-buy:hover { filter: brightness(1.1); }
.shop-buy:active { transform: scale(0.97); }
.shop-buy.cant { background: rgba(120, 140, 170, 0.16); color: var(--muted); cursor: default; }
.shop-buy.cant:hover { filter: none; }
.shop-buy.maxed { background: rgba(143, 194, 74, 0.14); color: #9ad36a; cursor: default; }
.shop-buy.maxed:hover { filter: none; }
.shop-buy.owned { background: rgba(111, 227, 196, 0.18); color: #6fe3c4; cursor: default; }
.shop-buy.owned:hover { filter: none; }
.shop-foot {
  padding: 10px 18px 14px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: rgba(138, 148, 168, 0.6);
  text-align: center;
}
.shop-foot b { color: var(--muted); }

/* Ship preview - the player's current ship + all upgrades, drawn live. Watch it
   transform as you buy (the JS fires a bounce/flare on purchase). */
.shop-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0 4px;
  background:
    radial-gradient(ellipse 60% 70% at 50% 45%, rgba(143,194,74,0.07), transparent 70%);
}
#shop-ship {
  width: 260px;
  height: 128px;
  max-width: 86%;
}

/* Per-upgrade icon */
.shop-ico {
  flex: none;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ad36a;
  opacity: 0.92;
}
.shop-ico svg { width: 24px; height: 24px; display: block; }
.shop-row.special .shop-ico { color: #6fe3c4; }

/* "what the next buy gets you" chip */
.shop-row-blurb .gain {
  color: #c7e6a0;
  font-weight: 600;
  white-space: nowrap;
}
.shop-row.special .shop-row-blurb .gain { color: #6fe3c4; }

/* Purchase feedback: a row glows green, the credits number pops, a denied buy
   shakes the row. Small, snappy - the "ding" that makes spending feel good. */
@keyframes shopBought {
  0%   { background: rgba(143, 194, 74, 0.0); }
  18%  { background: rgba(143, 194, 74, 0.30); }
  100% { background: rgba(143, 194, 74, 0.0); }
}
.shop-row.bought { animation: shopBought 0.72s ease; }
.shop-row.special.bought { animation: shopBought 0.72s ease; }
@keyframes shopShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}
.shop-row.shake { animation: shopShake 0.32s ease; }
@keyframes credBump {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.22); color: #9ad36a; }
  100% { transform: scale(1); }
}
#shop-credits.bump, #hud-credits.bump { display: inline-block; animation: credBump 0.5s ease; }

/* ---------- On-screen touch controls (mobile) ----------
   Fixed buttons: rotate ◄ ► under the left thumb, THRUST under the right.
   Discrete rotate/thrust maps 1:1 onto the boolean input and lets you pre-aim
   then burn without a finger over the target. Hidden entirely off touch; on
   touch they appear with the rest of the HUD at reveal (JS removes .hidden).
   The container is click-through (pointer-events:none); only the buttons grab
   input, so the canvas still receives pinch-to-zoom between them. */
#touch-controls { display: none; }
body.touch #touch-controls:not(.hidden) {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
.tc-btn {
  position: fixed;
  bottom: max(22px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  backdrop-filter: blur(8px);
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none; /* no iOS long-press selection/callout on the buttons */
  outline: none;
  cursor: pointer;
  transition: background-color 0.1s ease, border-color 0.1s ease, transform 0.06s ease;
}
.tc-btn.pressed {
  background: rgba(90, 209, 255, 0.22);
  border-color: var(--accent);
  transform: scale(0.95);
}
/* Rotate arrows drawn as CSS border-triangles so the glyph is PERFECTLY centered
   in the button (a text "◄"/"►" sat off-center due to its font side-bearing). */
.tc-arrow::before {
  content: "";
  width: 0;
  height: 0;
  border-top: 13px solid transparent;
  border-bottom: 13px solid transparent;
}
#tc-left::before  { border-right: 19px solid var(--ink); margin-right: 3px; }
#tc-right::before { border-left: 19px solid var(--ink); margin-left: 3px; }

/* THRUST shown as a fire glyph (inline SVG, not text → nothing to select). */
.tc-flame {
  width: 34px;
  height: 34px;
  display: block;
  fill: #ff8a3d;
  pointer-events: none;       /* taps fall through to the button, never the svg */
  -webkit-user-select: none;
  user-select: none;
}
#tc-thrust.pressed .tc-flame { fill: #ffd24a; }

/* Spaced a little further apart for the left thumb; THRUST mirrors the same
   76×76 size on the right under the right thumb. */
/* Offsets add the safe-area insets so the buttons clear a landscape notch /
   home indicator and stay fully on-screen. */
#tc-left   { left: calc(22px + env(safe-area-inset-left)); }
#tc-right  { left: calc(128px + env(safe-area-inset-left)); }
#tc-thrust { right: calc(22px + env(safe-area-inset-right)); }

body.touch #hint {
  top: auto;
  bottom: 124px;
}

/* ---------- Mission board (top-left, under credits) ----------
   The active contract sits on top (gold), the available offers list below with
   TAKE buttons. Compact + glassy so it never crowds the world. */
#missions {
  position: fixed;
  /* Sits under the credit balance; share its safe-area insets so the gap holds. */
  top: calc(40px + env(safe-area-inset-top));
  left: calc(14px + env(safe-area-inset-left));
  width: 244px;
  max-width: 60vw;
  z-index: 6;
  font-size: 12px;
  letter-spacing: 0.02em;
}
.mb-head {
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--muted);
  margin-bottom: 6px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}
#mb-list { display: flex; flex-direction: column; gap: 5px; }
.mb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 14, 22, 0.62);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 9px 7px 8px;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}
/* A loaded (carrying) mission glows gold - "deliver this". */
.mb-row.loaded { border-color: rgba(255, 217, 138, 0.45); background: rgba(34, 28, 14, 0.6); }
.mb-tag {
  flex: none;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 5px;
  border-radius: 5px;
  color: #0c1505;
}
.mb-tag.earth { background: #6fe3c4; }
.mb-tag.mars  { background: #e08a64; }
.mb-tag.open  { background: #8fb4ff; }
.mb-info { flex: 1; min-width: 0; }
.mb-info .mb-stat { color: #9ad36a; font-weight: 700; font-size: 11.5px; letter-spacing: 0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mb-row.loaded .mb-info .mb-stat { color: #ffd98a; }
.mb-info .mb-route { color: var(--muted); font-size: 10.5px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.touch #missions { top: calc(38px + env(safe-area-inset-top)); width: 210px; }

/* ---------- Dock-prompt REFUEL button (secondary, outline) ---------- */
#dock-refill {
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #ffd98a;
  background: rgba(255, 217, 138, 0.1);
  border: 1px solid rgba(255, 217, 138, 0.45);
  border-radius: 999px;
  padding: 6px 13px;
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.08s ease, opacity 0.12s ease;
}
#dock-refill:hover { filter: brightness(1.12); }
#dock-refill:active { transform: scale(0.96); }
#dock-refill.disabled { opacity: 0.5; cursor: default; }
#dock-refill.disabled:hover { filter: none; }

/* Mining + refine dock buttons - cyan (mine) / teal (refine), same pill shape. */
#dock-mine, #dock-refine {
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: 999px;
  padding: 6px 13px;
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.08s ease, opacity 0.12s ease;
  touch-action: none;            /* let pointerdown drive hold-to-mine on touch */
}
#dock-mine {
  color: #bfe6ff;
  background: rgba(143, 207, 230, 0.12);
  border: 1px solid rgba(143, 207, 230, 0.5);
}
#dock-refine {
  color: #6fe3c4;
  background: rgba(111, 227, 196, 0.1);
  border: 1px solid rgba(111, 227, 196, 0.45);
}
#dock-mine:hover, #dock-refine:hover { filter: brightness(1.12); }
#dock-mine:active, #dock-refine:active { transform: scale(0.96); }
#dock-mine.disabled, #dock-refine.disabled { opacity: 0.5; cursor: default; }
#dock-mine.disabled:hover, #dock-refine.disabled:hover { filter: none; }
#dock-mine.hidden, #dock-refine.hidden { display: none; }

/* ---------- Shop category tabs ---------- */
.shop-tabs {
  display: flex;
  gap: 7px;
  padding: 12px 16px 2px;
}
.shop-tab {
  flex: 1;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 6px;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}
.shop-tab:hover { color: var(--ink); }
.shop-tab.active {
  color: #c7e6a0;
  background: rgba(143, 194, 74, 0.12);
  border-color: rgba(143, 194, 74, 0.5);
}

/* Refill row + tier-locked rows in the shop */
.shop-row.refill { background: rgba(255, 217, 138, 0.05); border-radius: 10px; padding-left: 10px; padding-right: 10px; }
.shop-row.refill .shop-ico { color: #ffd98a; }
.shop-row.refill .shop-row-blurb .gain { color: #ffd98a; }
.shop-row.tierlock { opacity: 0.72; }
.shop-row-blurb .lock { color: #e0b070; font-weight: 600; white-space: nowrap; }
.shop-buy.locked { background: rgba(224, 176, 112, 0.14); color: #e0b070; cursor: default; }
.shop-buy.locked:hover { filter: none; }
.shop-empty {
  padding: 24px 14px;
  text-align: center;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}
.shop-empty b { color: #c7e6a0; }

/* ---------- Shop INSURE tab: live-costed policy builder ---------- */
.ins-form { padding: 4px 2px 10px; }
.ins-current {
  margin: 2px 2px 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(111, 227, 196, 0.08);
  border: 1px solid rgba(111, 227, 196, 0.25);
  font-size: 11.5px;
  line-height: 1.5;
  color: #cfe9df;
}
.ins-current b { color: #6fe3c4; }
.ins-note { margin-top: 4px; font-size: 10.5px; color: var(--muted); }
.ins-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 4px;
  border-bottom: 1px solid rgba(120, 140, 170, 0.1);
}
.ins-label { font-size: 12px; color: var(--ink); white-space: nowrap; }
.ins-seg { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ins-opt {
  font: inherit;
  font-size: 11px;
  padding: 6px 10px;
  color: var(--muted);
  background: rgba(120, 140, 170, 0.08);
  border: 1px solid rgba(120, 140, 170, 0.2);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.ins-opt:hover { color: var(--ink); }
.ins-opt.sel {
  color: #04141a;
  background: #6fe3c4;
  border-color: #6fe3c4;
  font-weight: 700;
}
.ins-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 14px;
  padding: 0 4px;
  font-size: 13px;
  color: var(--muted);
}
.ins-cost { font-size: 20px; font-weight: 700; color: #6fe3c4; }
.ins-buy {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #04141a;
  background: #6fe3c4;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.08s ease;
}
.ins-buy:hover { filter: brightness(1.08); }
.ins-buy:active { transform: scale(0.98); }
.ins-buy.disabled { opacity: 0.45; pointer-events: none; }

/* ---------- Shop COLOR tab: pay-to-repaint swatches ---------- */
.shop-color-note { padding: 6px 4px 10px; }
.shop-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 4px 4px 12px;
  justify-content: center;
}
.shop-swatch {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.shop-swatch:hover { transform: scale(1.12); }
/* .sel = the swatch currently staged in the preview (pending OR worn). */
.shop-swatch.sel { border-color: #fff; transform: scale(1.12); box-shadow: 0 0 10px rgba(255, 255, 255, 0.35); }
/* .worn = the color the hull actually wears right now - a subtle check dot. */
.shop-swatch.worn::after {
  content: '✓';
  display: block;
  text-align: center;
  line-height: 38px;
  font-size: 18px;
  color: #fff;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.7);
}

/* CONFIRM button under the swatches - explicit two-step repaint commit. */
.shop-color-confirm {
  display: block;
  width: calc(100% - 8px);
  margin: 2px 4px 8px;
  padding: 11px 14px;
  border: 1px solid #2c8a5a;
  border-radius: 10px;
  background: linear-gradient(180deg, #1f3a2c, #16261d);
  color: #cdeedd;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.shop-color-confirm:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(40, 160, 100, 0.3); }
.shop-color-confirm:active:not(:disabled) { transform: translateY(0); }
.shop-color-confirm:disabled {
  opacity: 0.55;
  cursor: default;
  border-color: #2c3a45;
  background: rgba(18, 22, 28, 0.6);
  color: #7c8a95;
}
.shop-color-confirm .gain { color: #ffd86b; }

/* ---------- Mission Log ----------
   A top-right book button opens a calm panel (mirrors the shop card) listing the
   active hauls. Safe-area insets keep the button clear of the iPhone notch; the
   HUD/credits sits top-LEFT so there's no overlap. */
#logbtn {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  z-index: 8;
  width: 40px;
  height: 40px;
  font-size: 19px;
  line-height: 1;
  color: var(--ink);
  background: rgba(14, 20, 16, 0.7);
  border: 1px solid rgba(143, 194, 74, 0.28);
  border-radius: 10px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: border-color 0.12s ease, transform 0.08s ease;
}
#logbtn:hover { border-color: rgba(143, 194, 74, 0.55); }
#logbtn:active { transform: scale(0.95); }

/* Nav console button - stacked just under the mission log, techy cyan accent. */
#navbtn {
  position: fixed;
  top: calc(60px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  z-index: 8;
  width: 40px;
  height: 40px;
  font-size: 18px;
  line-height: 1;
  color: var(--ink);
  background: rgba(12, 18, 26, 0.7);
  border: 1px solid rgba(90, 209, 255, 0.3);
  border-radius: 10px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: border-color 0.12s ease, transform 0.08s ease;
}
#navbtn:hover { border-color: rgba(90, 209, 255, 0.6); }
#navbtn:active { transform: scale(0.95); }

/* Nav console overlay - fullscreen solar-system map; navmap.js draws all of it (title,
   buttons, footer) on the canvas. */
#nav {
  position: fixed;
  inset: 0;
  z-index: 21;
  background: #04060c;
  animation: interiorFade 0.3s ease;
}
#nav-view {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
/* When a contract choice is open but deferred ("Look around first"), the log button
   widens into a CHOOSE CONTRACT pill: amber accent + gentle pulse to draw you back. */
#logbtn.choose-pill {
  width: auto;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #ffd98a;
  background: rgba(40, 30, 8, 0.82);
  border-color: rgba(255, 217, 138, 0.5);
  animation: choose-pill-pulse 1.6s ease-in-out infinite;
}
#logbtn.choose-pill:hover { border-color: rgba(255, 217, 138, 0.85); }
@keyframes choose-pill-pulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4); }
  50% { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 14px rgba(255, 217, 138, 0.45); }
}
#missionlog {
  position: fixed;
  inset: 0;
  z-index: 21;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 11, 0.7);
  backdrop-filter: blur(4px);
}
.log-card {
  display: flex;
  flex-direction: column;
  width: min(94vw, 420px);
  max-height: 86vh;
  background: linear-gradient(180deg, #0c1410 0%, #0a0e15 100%);
  border: 1px solid rgba(143, 194, 74, 0.28);
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(143, 194, 74, 0.06);
  overflow: hidden;
}
.log-head {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.log-title { font-size: 18px; font-weight: 700; letter-spacing: 0.03em; color: #c7e6a0; }
.log-sub { font-size: 11px; letter-spacing: 0.22em; color: var(--muted); margin-top: 2px; }
.log-list { flex: 1; overflow-y: auto; padding: 8px 14px; }
.log-empty {
  padding: 26px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
}
.log-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 6px;
  border-bottom: 1px solid rgba(120, 140, 170, 0.1);
}
.log-row:last-child { border-bottom: none; }
.log-tag {
  flex: none;
  min-width: 52px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 4px 6px;
  border-radius: 6px;
  color: #cfe6ff;
  background: rgba(127, 184, 255, 0.12);
  border: 1px solid rgba(127, 184, 255, 0.28);
}
.log-tag.earth { color: #6fe3c4; background: rgba(111, 227, 196, 0.12); border-color: rgba(111, 227, 196, 0.28); }
.log-tag.mars { color: #e08a64; background: rgba(224, 138, 100, 0.12); border-color: rgba(224, 138, 100, 0.28); }
.log-info { flex: 1; min-width: 0; }
.log-route { font-size: 14px; font-weight: 600; color: var(--ink); }
.log-pay { font-size: 12px; color: #ffd98a; margin-top: 2px; letter-spacing: 0.02em; }
.log-foot {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}
#log-close {
  width: 100%;
  padding: 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.12s ease, transform 0.08s ease;
}
#log-close:hover { border-color: rgba(200, 210, 230, 0.4); }
#log-close:active { transform: scale(0.98); }

/* ---------- Mission-log collapsible groups (Active / Completed → by zone) ---------- */
.log-group { margin: 4px 0 6px; }
.log-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 6px;
  background: none;
  border: none;
  border-bottom: 1px solid rgba(120, 140, 170, 0.14);
  color: #c7e6a0;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  text-align: left;
}
.log-group-head .log-caret { flex: none; width: 12px; transition: transform 0.15s ease; color: var(--muted); }
.log-group.collapsed .log-caret { transform: rotate(-90deg); }
.log-group-head .log-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.log-group.completed .log-group-head { color: #9fb6cf; }
.log-group-body { overflow: hidden; }
.log-group.collapsed .log-group-body { display: none; }
.log-subhead {
  padding: 8px 6px 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
}
.log-row.done .log-route { color: #9fb6cf; }
.log-row.done .log-pay { color: #8fb24a; }
.log-row .log-n {
  flex: none;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.log-tag.outer { color: #c7a0ff; background: rgba(199, 160, 255, 0.12); border-color: rgba(199, 160, 255, 0.28); }
.log-tag.secret { color: #ffd98a; background: rgba(255, 217, 138, 0.12); border-color: rgba(255, 217, 138, 0.3); }

/* ---------- My Crickets button + management screen ---------- */
/* Stacked under the nav console button (which sits under the mission log). */
#rosterbtn {
  position: fixed;
  top: calc(108px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  z-index: 8;
  width: 40px;
  height: 40px;
  font-size: 19px;
  line-height: 1;
  color: var(--ink);
  background: rgba(14, 20, 16, 0.7);
  border: 1px solid rgba(143, 194, 74, 0.28);
  border-radius: 10px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: border-color 0.12s ease, transform 0.08s ease;
}
#rosterbtn:hover { border-color: rgba(143, 194, 74, 0.55); }
#rosterbtn:active { transform: scale(0.95); }

#roster-screen {
  position: fixed;
  inset: 0;
  z-index: 22;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 11, 0.74);
  backdrop-filter: blur(4px);
}
.roster-card {
  display: flex;
  flex-direction: column;
  width: min(94vw, 460px);
  max-height: 88vh;
  background: linear-gradient(180deg, #0c1410 0%, #0a0e15 100%);
  border: 1px solid rgba(143, 194, 74, 0.28);
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(143, 194, 74, 0.06);
  overflow: hidden;
}
.roster-head {
  display: flex;
  align-items: center;
  padding: 16px 16px 14px 18px;
  border-bottom: 1px solid var(--line);
}
.roster-title { font-size: 18px; font-weight: 700; letter-spacing: 0.03em; color: #c7e6a0; }
.roster-x {
  margin-left: auto;
  width: 30px; height: 30px;
  font-size: 15px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.roster-x:hover { color: var(--ink); border-color: rgba(200, 210, 230, 0.4); }
.roster-list { flex: 1; overflow-y: auto; padding: 10px 14px; }
.roster-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(120, 140, 170, 0.14);
  border-radius: 12px;
}
.roster-row.active { border-color: rgba(143, 194, 74, 0.5); background: rgba(143, 194, 74, 0.06); }
.roster-swatch {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}
.roster-main { flex: 1; min-width: 0; }
.roster-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 7px;
}
.roster-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  border-radius: 5px;
  text-transform: uppercase;
}
.roster-badge.you { color: #8fb24a; background: rgba(143, 194, 74, 0.14); border: 1px solid rgba(143, 194, 74, 0.3); }
.roster-badge.rebuild { color: #ffc24d; background: rgba(255, 194, 77, 0.12); border: 1px solid rgba(255, 194, 77, 0.32); }
.roster-meta { font-size: 12px; color: var(--muted); margin-top: 3px; letter-spacing: 0.02em; }
.roster-actions { flex: none; display: flex; flex-direction: column; gap: 6px; }
.roster-actions button {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 7px 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.12s ease, transform 0.08s ease;
}
.roster-actions button.primary { color: #c7e6a0; border-color: rgba(143, 194, 74, 0.45); }
.roster-actions button.danger:hover { border-color: rgba(255, 120, 100, 0.5); color: #ff9a8a; }
.roster-actions button:hover { border-color: rgba(200, 210, 230, 0.4); }
.roster-actions button:active { transform: scale(0.97); }
.roster-actions button:disabled { opacity: 0.5; cursor: default; }
.roster-rename-input {
  font: inherit;
  font-size: 14px;
  width: 100%;
  padding: 5px 7px;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(143, 194, 74, 0.45);
  border-radius: 7px;
}
.roster-foot { padding: 12px 14px 6px; border-top: 1px solid var(--line); }
#roster-new {
  width: 100%;
  padding: 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #c7e6a0;
  background: rgba(143, 194, 74, 0.08);
  border: 1px solid rgba(143, 194, 74, 0.4);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.12s ease, transform 0.08s ease;
}
#roster-new:hover { border-color: rgba(143, 194, 74, 0.7); }
#roster-new:active { transform: scale(0.98); }
#roster-new:disabled { opacity: 0.5; cursor: default; }
.roster-note {
  padding: 10px 16px 16px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ---------- Out-of-fuel overlay ----------
   A compact pill pinned at the TOP-CENTER, only as wide as its content. Stays up
   while stranded. The wrapper is click-through (the world + gestures still work
   behind it); only the pill/button grab input. */
#fuel-out {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 18;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
#fuel-out .fo-card {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: calc(env(safe-area-inset-top, 0px) + 12px);
  padding: 9px 10px 9px 18px;
  background: rgba(14, 12, 10, 0.92);
  border: 1px solid rgba(255, 150, 120, 0.5);
  border-radius: 999px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55), 0 0 22px rgba(255, 120, 90, 0.12);
  backdrop-filter: blur(6px);
}
#fuel-out .fo-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #ff9d6c;
  text-shadow: 0 0 14px rgba(255, 120, 90, 0.3);
}
#fuel-restart {
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #0c1505;
  background: var(--grass);
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.08s ease;
}
#fuel-restart:hover { filter: brightness(1.1); }
#fuel-restart:active { transform: scale(0.97); }
/* Emergency fuel drone summon - amber to match the inbound drone glyph. */
#fuel-drone {
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #1a1304;
  background: #ffcf6a;
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.08s ease;
}
#fuel-drone:hover { filter: brightness(1.1); }
#fuel-drone:active { transform: scale(0.97); }
#fuel-drone.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* DEBUG: always-on free fuel-drone launcher (testing aid). Pinned bottom-left. */
#debug-drone {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 60;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ffcf6a;
  background: rgba(20, 16, 6, 0.72);
  border: 1px solid rgba(255, 207, 106, 0.55);
  border-radius: 999px;
  padding: 7px 13px;
  cursor: pointer;
  opacity: 0.7;
  transition: filter 0.12s ease, transform 0.08s ease, opacity 0.12s ease;
}
#debug-drone:hover { opacity: 1; filter: brightness(1.12); }
#debug-drone:active { transform: scale(0.97); }
#debug-drone.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}
#debug-drone.hidden { display: none; }

#debug-belt {
  position: fixed;
  left: 168px;
  bottom: 12px;
  z-index: 60;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #9fd6e8;
  background: rgba(8, 16, 22, 0.72);
  border: 1px solid rgba(143, 207, 230, 0.55);
  border-radius: 999px;
  padding: 7px 13px;
  cursor: pointer;
  opacity: 0.7;
  transition: filter 0.12s ease, transform 0.08s ease, opacity 0.12s ease;
}
#debug-belt:hover { opacity: 1; filter: brightness(1.12); }
#debug-belt:active { transform: scale(0.97); }
#debug-belt.hidden { display: none; }

/* ---------- Join: name-in-use error + ship-color picker ---------- */
.name-err {
  color: #ff8a7a;
  font-size: 12px;
  letter-spacing: 0.03em;
  margin: -4px 0 10px;
}
.picker-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin: 4px 0 8px;
}
.color-picker {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  margin-bottom: 18px;
}
.swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  cursor: pointer;
  padding: 0;
  transition: transform 0.08s ease, border-color 0.12s ease;
}
.swatch:hover { transform: scale(1.12); }
.swatch.sel { border-color: #fff; transform: scale(1.12); box-shadow: 0 0 10px rgba(255, 255, 255, 0.35); }

/* ---------- Cinematic intro ----------
   Fresh-launch only. Lore lines fade in one at a time, then the first delivery
   target (which glows for a couple seconds), then the ship name + color pinned at
   the bottom. Tap / any key to skip. Pure presentation - sits over the dark join
   backdrop while the world spawns behind it. */
#intro {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse 120% 90% at 50% 38%, #0a1016 0%, #05070d 72%);
  cursor: pointer;
  transition: opacity 0.6s ease;
}
#intro.fade-out { opacity: 0; }
.intro-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 0 24px;
}
/* Each beat starts hidden + slightly low, then rises in when JS adds .show. Slow
   fades (~1.2s) so the reveal reads as a calm, deliberate cold open. */
.intro-step {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 1.2s ease, transform 1.2s ease;
}
.intro-step.show { opacity: 1; transform: translateY(0); }
.intro-line {
  font-size: 18px;
  line-height: 1.5;
  letter-spacing: 0.03em;
  color: var(--ink);
}
.intro-line.you { margin-top: 28px; color: var(--ink); }
/* Slightly smaller on phones so the wider name box still keeps each line single. */
@media (max-width: 480px) { .intro-line { font-size: 14px; letter-spacing: 0.01em; } }

/* The refuel instruction reads as the next line of the lore; the home station name
   glows yellow to match its in-world highlight. */
.intro-mission { margin-top: 4px; }
.intro-home {
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #ffd98a;
}
/* The station name flares bright when its line appears, then settles to a soft glow. */
.intro-step.show .intro-home { animation: destGlow 3s ease 0.1s 1 forwards; }
@keyframes destGlow {
  0%   { text-shadow: 0 0 0 rgba(255, 217, 138, 0); }
  30%  { text-shadow: 0 0 24px rgba(255, 217, 138, 0.95), 0 0 46px rgba(255, 217, 138, 0.55); }
  100% { text-shadow: 0 0 11px rgba(255, 217, 138, 0.32); }
}

/* Inline pilot-name field, woven into "You, [name], are a space cricket." Sized to its
   content so it reads as part of the sentence rather than a separate form. */
.intro-name-inline {
  width: 6em;
  max-width: 40vw;
  padding: 0 6px;
  margin: 0 2px;
  font: inherit;
  text-align: center;
  color: #c7e6a0;
  background: rgba(143, 194, 74, 0.08);
  border: 1.5px solid var(--grass);
  border-radius: 7px;
  outline: none;
  vertical-align: baseline;
}
.intro-name-inline::placeholder { color: rgba(199, 230, 160, 0.45); font-weight: 400; }
/* iOS Safari IGNORES the viewport meta's maximum-scale/user-scalable (since iOS 10),
   so a focused field under 16px makes Safari auto-zoom the page in - and it often
   doesn't zoom back out, leaving the player stuck. Bump to 16px on touch so focusing
   the inline name field never triggers that (the page-text stays 14px via .intro-line). */
@media (pointer: coarse) { .intro-name-inline { font-size: 16px; } }
.intro-name-inline:focus { background: rgba(143, 194, 74, 0.16); }
.intro .name-err { margin: 6px 0 0; text-align: center; }

/* Begin: the primary launch button, revealed (and made clickable) only at ready. Sits
   right below the intro text inside .intro-inner. */
.intro-begin {
  margin-top: 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #0c1505;
  background: var(--grass);
  border: none;
  border-radius: 10px;
  padding: 11px 32px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s ease, filter 0.12s ease;
}
.intro-begin:hover { filter: brightness(1.08); }
.intro-begin:active { transform: scale(0.98); }
#intro.ready .intro-begin { opacity: 1; transform: translateY(0); pointer-events: auto; }
#intro.ready .intro-skip { opacity: 0; }
.intro-skip {
  position: absolute;
  bottom: calc(12px + env(safe-area-inset-bottom));
  right: 16px;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: rgba(138, 148, 168, 0.5);
  transition: opacity 0.4s ease;
}

/* ---------- Generic centered popup ----------
   Reused for the onboarding "supplies loaded" hand-off and the choose-your-next-
   contract picker. A blurred backdrop + a grass-themed card with a title, body, and
   a column of action buttons. Sits above the shop/log so it reads as a decision. */
#popup {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(4, 6, 11, 0.72);
  backdrop-filter: blur(4px);
}
.popup-card {
  width: min(94vw, 420px);
  max-height: 86vh;
  overflow-y: auto;
  padding: 22px 22px 20px;
  text-align: center;
  background: linear-gradient(180deg, #0c1410 0%, #0a0e15 100%);
  border: 1px solid rgba(143, 194, 74, 0.28);
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
}
.popup-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: #9fd16a;
  margin-bottom: 12px;
}
.popup-body {
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
}
.popup-body p { margin: 0 0 11px; }
.popup-body p:last-child { margin-bottom: 0; }
/* Emphasis stays the SAME colour & size as the prose - only the slant changes, so
   the card reads in one calm grey with a single gold accent (the station name). */
.popup-body i { font-style: italic; color: inherit; }
.popup-body b { color: #ffd98a; font-weight: 700; }
.popup-dest { color: #ffd98a; }
.popup-host { color: var(--muted); font-weight: 400; }
.popup-sub {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--muted);
}
.popup-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}
.popup-btn {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #0c1505;
  background: var(--grass);
  border: none;
  border-radius: 10px;
  padding: 11px 18px;
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.08s ease;
}
.popup-btn:hover { filter: brightness(1.1); }
.popup-btn:active { transform: scale(0.98); }
/* Contract-offer buttons: a two-line layout (station name + orbit/reward), themed as
   a selectable panel rather than the solid primary action. */
.popup-btn.popup-offer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 12px 16px;
  color: var(--ink);
  background: rgba(143, 194, 74, 0.1);
  border: 1px solid rgba(143, 194, 74, 0.35);
}
.popup-btn.popup-offer:hover { background: rgba(143, 194, 74, 0.2); filter: none; }
.popup-offer-name { font-size: 15px; font-weight: 700; color: #ffd98a; letter-spacing: 0.02em; }
.popup-offer-meta { font-size: 12px; font-weight: 400; color: var(--muted); letter-spacing: 0.02em; }
/* Secondary "Refill for ₡N" action: an outline button that sits ABOVE the solid green
   primary, so a fresh low-fuel cricket can top off without leaving the card. */
.popup-btn.popup-refill {
  color: var(--ink);
  background: rgba(143, 194, 74, 0.1);
  border: 1px solid rgba(143, 194, 74, 0.35);
}
.popup-btn.popup-refill:hover { background: rgba(143, 194, 74, 0.2); filter: none; }
.popup-btn.disabled { opacity: 0.5; pointer-events: none; }
/* "Look around first": a quiet, secondary action that defers the contract choice so you
   can scout the map before committing. Outline/muted so it never competes with the offers. */
.popup-btn.popup-later {
  color: var(--muted);
  background: transparent;
  border: 1px solid rgba(143, 194, 74, 0.22);
  font-weight: 500;
}
.popup-btn.popup-later:hover { color: var(--ink); border-color: rgba(143, 194, 74, 0.45); filter: none; }
/* Quiet parenthetical hint under a popup's main line (e.g. the shop nudge). */
.popup-aside { color: var(--muted); }

/* ---------- Gas-pump refuel popup (openFuelPump) ----------
   A clean fuel terminal inside the generic #popup card: a digital readout, a tank
   gauge, a scrub slider + quick presets + custom-credits entry, then PUMP. */
.pump { display: flex; flex-direction: column; gap: 13px; text-align: left; }
/* Digital readout - dark screen, big monospace CREDITS total + a smaller result line. */
.pump-screen {
  border-radius: 12px;
  padding: 14px 16px;
  background: radial-gradient(120% 140% at 50% 0%, #0a1620 0%, #060c12 100%);
  border: 1px solid rgba(143, 194, 74, 0.22);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.55);
}
.pump-total {
  font: 700 34px ui-monospace, Menlo, monospace;
  letter-spacing: 0.02em;
  color: #7fe7c4;
  text-shadow: 0 0 12px rgba(127, 231, 196, 0.45);
  line-height: 1.05;
}
.pump-sub { margin-top: 5px; font-size: 12.5px; color: var(--muted); }
.pump-sub b { color: #ffd98a; font-weight: 700; }
/* Tank gauge: current fill (amber) | being added (cyan) | empty. */
.pump-gauge {
  display: flex; height: 16px; border-radius: 8px; overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 217, 138, 0.28);
}
.pump-gauge-cur { background: #ffd98a; }
.pump-gauge-add { background: #7fe7c4; transition: width 0.05s linear; }
/* Scrub slider over the spend amount. */
.pump-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 12px; border-radius: 6px; outline: none; cursor: pointer;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(127, 231, 196, 0.35);
}
.pump-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; border: 3px solid #7fe7c4;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); cursor: pointer;
}
.pump-slider::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; border: 3px solid #7fe7c4;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); cursor: pointer;
}
.pump-slider:disabled { opacity: 0.55; }
/* Quick-preset chips. */
.pump-chips { display: flex; gap: 7px; }
.pump-chip {
  flex: 1; font: inherit; font-size: 13px; font-weight: 700;
  color: var(--ink); background: rgba(143, 194, 74, 0.1);
  border: 1px solid rgba(143, 194, 74, 0.3);
  border-radius: 8px; padding: 7px 0; cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.pump-chip:hover { background: rgba(143, 194, 74, 0.2); }
.pump-chip.active { background: rgba(127, 231, 196, 0.22); border-color: #7fe7c4; color: #d6fff0; }
.pump-chip.disabled { opacity: 0.5; pointer-events: none; }
/* Custom exact-amount entry. */
.pump-custom { display: flex; align-items: center; gap: 8px; }
.pump-custom-label { font-size: 12.5px; color: var(--muted); letter-spacing: 0.02em; }
.pump-custom-input {
  flex: 1; min-width: 0;
  font: 700 15px ui-monospace, Menlo, monospace;
  color: #7fe7c4; background: rgba(6, 12, 18, 0.85);
  border: 1px solid rgba(127, 231, 196, 0.3);
  border-radius: 8px; padding: 8px 10px; outline: none;
}
.pump-custom-input:focus { border-color: #7fe7c4; }
.pump-custom-input:disabled { opacity: 0.55; }
/* PUMP primary action - cyan to match the cryo fuel theme. */
.popup-btn.pump-go {
  background: #7fe7c4; color: #062018;
  letter-spacing: 0.08em;
}
.popup-btn.pump-go.pumping { background: #5cc7a6; cursor: default; }

/* ---------- Sign-in: avatar chip + panel ----------
   A small circle pinned top-right, ABOVE everything (intro/popup included) so the
   "sign in" affordance is always reachable. Signed-out = a faint outline carrying
   the ship's initial; signed-in = a filled disc in the ship's color. When the
   in-flight Mission Log book is showing (top-right too), the chip slides left of it. */
#sc-auth-chip {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  z-index: 46;                 /* above #intro (40) and #popup (45) */
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  color: var(--muted);
  background: rgba(14, 20, 26, 0.55);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  transition: border-color 0.14s ease, color 0.14s ease, transform 0.08s ease, box-shadow 0.14s ease;
}
#sc-auth-chip:hover { color: var(--ink); border-color: rgba(200, 210, 230, 0.5); }
#sc-auth-chip:active { transform: scale(0.94); }
/* Empty (no name yet): a hollow ring with a small dot, reading as "tap to sign in". */
#sc-auth-chip.empty #sc-auth-initial { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
/* Signed-in: filled disc in the ship color (--chip-accent set inline by auth.js),
   dark glyph, a soft accent halo. */
#sc-auth-chip.on {
  color: #0c1505;
  background: var(--chip-accent, var(--grass));
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4), 0 0 14px rgba(255, 255, 255, 0.12);
}
#sc-auth-chip.on:hover { color: #0c1505; filter: brightness(1.06); }
/* Slide left of the Mission Log book when it's visible (in flight). */
body:has(#logbtn:not(.hidden)) #sc-auth-chip { right: calc(60px + env(safe-area-inset-right)); }

/* Sign-in panel overlay - mirrors the log/popup card aesthetic. */
#sc-auth {
  position: fixed;
  inset: 0;
  z-index: 48;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(4, 6, 11, 0.72);
  backdrop-filter: blur(4px);
}
.sc-auth-card {
  position: relative;
  width: min(94vw, 360px);
  padding: 24px 22px 20px;
  background: linear-gradient(180deg, #0c1410 0%, #0a0e15 100%);
  border: 1px solid rgba(143, 194, 74, 0.28);
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(143, 194, 74, 0.06);
}
.sc-auth-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.sc-auth-x:hover { color: var(--ink); border-color: rgba(200, 210, 230, 0.4); }
.sc-auth-head { margin-bottom: 16px; }
.sc-auth-title { font-size: 18px; font-weight: 700; letter-spacing: 0.02em; color: #c7e6a0; }
.sc-auth-sub { font-size: 12.5px; line-height: 1.5; color: var(--muted); margin-top: 5px; }
.sc-auth-form { display: flex; flex-direction: column; gap: 10px; }
/* "Continue with Google" - a white button (pops against the dark card) with the
   official multi-colour G mark. */
.sc-auth-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #1f2733;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 10px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.08s ease, opacity 0.15s ease;
}
.sc-auth-google:hover { filter: brightness(0.96); }
.sc-auth-google:active { transform: scale(0.98); }
.sc-auth-google svg { display: block; flex: none; }
.sc-auth-google:disabled { opacity: 0.6; cursor: default; }
/* Labelled hairline divider between Google and the email form. */
.sc-auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  margin: 2px 0;
}
.sc-auth-divider::before, .sc-auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
#sc-auth-email, #sc-auth-pass {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.14s ease;
}
@media (pointer: coarse) { #sc-auth-email, #sc-auth-pass { font-size: 16px; } } /* no iOS auto-zoom */
#sc-auth-email:focus, #sc-auth-pass:focus { border-color: var(--grass); }
.sc-auth-err {
  font-size: 12px;
  line-height: 1.45;
  color: #ff8a7a;
  letter-spacing: 0.02em;
  margin: -2px 2px 0;
}
.sc-auth-go {
  width: 100%;
  margin-top: 4px;
  padding: 13px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #0c1505;
  background: var(--grass);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.08s ease, opacity 0.15s ease;
}
.sc-auth-go:hover { filter: brightness(1.08); }
.sc-auth-go:active { transform: scale(0.98); }
.sc-auth-go.busy { opacity: 0.6; cursor: default; }
.sc-auth-alt, .sc-auth-forgot {
  font: inherit;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  transition: color 0.14s ease, filter 0.15s ease, transform 0.08s ease;
}
.sc-auth-alt:hover, .sc-auth-forgot:hover { color: var(--accent); }
.sc-auth-forgot { align-self: center; font-size: 11.5px; }
/* "or" divider between Sign in and the green Create-account button (sign-in mode). */
.sc-auth-or {
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 2px 0;
}
/* Create-account, sign-in mode: a full green button matching the primary action. */
.sc-auth-alt.green {
  width: 100%;
  padding: 13px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #0c1505;
  background: var(--grass);
  border-radius: 10px;
}
.sc-auth-alt.green:hover { color: #0c1505; filter: brightness(1.08); }
.sc-auth-alt.green:active { transform: scale(0.98); }

/* Signed-in card body: avatar + name/email + sign-out. */
.sc-auth-me { display: flex; flex-direction: column; gap: 16px; }
.sc-auth-me-row { display: flex; align-items: center; gap: 14px; }
.sc-auth-avatar {
  flex: none;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #0c1505;
  background: var(--grass);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
}
.sc-auth-me-info { min-width: 0; }
.sc-auth-me-name { font-size: 15px; font-weight: 600; color: var(--ink); }
.sc-auth-me-email { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-auth-signout {
  width: 100%;
  padding: 11px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(138, 148, 168, 0.9);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.sc-auth-signout:hover { color: #ff8a7a; border-color: rgba(255, 106, 90, 0.5); }

/* Name change (account card): once every 30 days. */
.sc-rename { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sc-rename-label { font-size: 12px; color: rgba(200, 210, 230, 0.9); }
.sc-rename-warn { color: var(--muted); font-size: 11px; }
.sc-rename-row { display: flex; gap: 8px; }
#sc-auth-newname {
  flex: 1; min-width: 0; padding: 9px 11px; font: inherit; font-size: 16px;
  color: var(--ink); background: rgba(8, 12, 18, 0.8);
  border: 1px solid var(--line); border-radius: 8px;
}
#sc-auth-newname:disabled { opacity: 0.5; }
#sc-auth-rename-btn {
  flex: none; padding: 0 14px; font: inherit; font-size: 12px; font-weight: 700;
  color: #04141a; background: #6fe3c4; border: none; border-radius: 8px; cursor: pointer;
}
#sc-auth-rename-btn:disabled { opacity: 0.45; cursor: default; }
.sc-rename-note { font-size: 11.5px; color: #ffb38a; }
.sc-rename-note.ok { color: #7ee0a0; }

/* ---------- Ceres marketplace overlay (rough; refined in the UI pass) ---------- */
#market {
  position: fixed;
  inset: 0;
  z-index: 21;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 11, 0.7);
  backdrop-filter: blur(4px);
}
.market-card {
  width: min(94vw, 480px);
  max-height: 86vh;
  overflow-x: hidden;
  overflow-y: auto;
  background: linear-gradient(180deg, #0a1116 0%, #080d14 100%);
  border: 1px solid rgba(159, 214, 232, 0.3);
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(159, 214, 232, 0.07);
}
.market-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.market-titles { flex: 1; }
.market-name { font-size: 18px; font-weight: 700; letter-spacing: 0.03em; color: #bfe8f3; }
.market-sub { font-size: 11px; letter-spacing: 0.18em; color: var(--muted); margin-top: 2px; text-transform: uppercase; }
.market-bal { text-align: right; font-size: 10px; letter-spacing: 0.14em; color: var(--muted); line-height: 1.5; }
.market-bal span { font-size: 16px; font-weight: 700; color: #ffd98a; }
#market-close {
  align-self: flex-start;
  width: 30px; height: 30px;
  font: inherit; font-size: 15px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease;
}
#market-close:hover { color: var(--ink); border-color: rgba(200, 210, 230, 0.4); }
.market-note {
  margin: 10px 14px 0;
  padding: 8px 12px;
  font-size: 12px;
  color: #bfe8f3;
  background: rgba(159, 214, 232, 0.08);
  border: 1px solid rgba(159, 214, 232, 0.2);
  border-radius: 8px;
}
.market-body { padding: 8px 14px 6px; }
.mk-sec {
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); margin: 14px 2px 6px;
}
.mk-empty { font-size: 12px; color: var(--muted); padding: 4px 2px 8px; font-style: italic; }
.mk-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line); border-radius: 10px;
}
.mk-row.mk-own { border-color: rgba(159, 214, 232, 0.3); background: rgba(159, 214, 232, 0.05); }
.mk-name { flex: 1; font-size: 13px; font-weight: 600; color: var(--ink); }
.mk-val, .mk-seller { font-size: 11px; color: var(--muted); }
.mk-price { font-size: 13px; font-weight: 700; color: #ffd98a; min-width: 48px; text-align: right; }
.mk-btn {
  font: inherit; font-size: 11px; font-weight: 600;
  color: #bfe8f3; padding: 5px 10px;
  background: rgba(159, 214, 232, 0.08);
  border: 1px solid rgba(159, 214, 232, 0.28);
  border-radius: 8px; cursor: pointer; white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.mk-btn:hover { background: rgba(159, 214, 232, 0.18); border-color: rgba(159, 214, 232, 0.5); }
.mk-npc { color: #cdd6e6; border-color: var(--line); background: rgba(255, 255, 255, 0.04); }
.mk-buy { color: #c7e6a0; border-color: rgba(143, 194, 74, 0.4); background: rgba(143, 194, 74, 0.1); }
.mk-cancel, .mk-cancel-form { color: #ff9a8a; border-color: rgba(255, 106, 90, 0.35); background: rgba(255, 106, 90, 0.07); }
.mk-form { padding: 4px 2px; }
.mk-frow { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.mk-frow label { flex: 1; font-size: 12px; color: var(--ink); }
.mk-frow input {
  width: 110px; font: inherit; font-size: 13px;
  color: var(--ink); padding: 6px 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line); border-radius: 8px;
}
.mk-fhint { font-size: 11px; color: var(--muted); margin: 2px 2px 12px; }
.mk-fbtns { gap: 10px; }
.mk-fbtns .mk-btn { flex: 1; text-align: center; padding: 9px; }

/* ---------- Onboarding checklist (rough; refined in the UI pass) ---------- */
#onboard {
  position: fixed;
  left: 14px;
  bottom: 16px;
  z-index: 8;
  width: 250px;
  padding: 12px 13px 11px;
  background: linear-gradient(180deg, rgba(12, 18, 14, 0.94) 0%, rgba(9, 12, 18, 0.94) 100%);
  border: 1px solid rgba(143, 194, 74, 0.3);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  font-size: 12px;
  transition: opacity 0.3s ease;
}
#onboard.fade { opacity: 0; pointer-events: none; }
.ob-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ob-title { flex: 1; font-size: 10px; letter-spacing: 0.18em; color: #c7e6a0; }
#ob-close {
  width: 20px; height: 20px; font: inherit; font-size: 12px; line-height: 1;
  color: var(--muted); background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line); border-radius: 6px; cursor: pointer;
}
#ob-close:hover { color: var(--ink); }
.ob-step { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; }
.ob-mark {
  flex: none; width: 16px; height: 16px; margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; border-radius: 50%;
  border: 1px solid var(--line); color: var(--muted);
}
.ob-step.done .ob-mark { background: rgba(143, 194, 74, 0.85); border-color: rgba(143, 194, 74, 0.85); color: #0a0e15; }
.ob-step.active .ob-mark { border-color: #c7e6a0; color: #c7e6a0; }
.ob-body { flex: 1; }
.ob-label { color: var(--ink); }
.ob-step.done .ob-label { color: var(--muted); text-decoration: line-through; }
.ob-step.active .ob-label { color: #e8f3d8; font-weight: 600; }
.ob-hint { font-size: 11px; color: #9fb6c8; margin-top: 2px; line-height: 1.35; }
.ob-alldone { font-size: 11px; color: #c7e6a0; text-align: center; padding: 4px 0 2px; }
