/* ============================================================
   HEXAPONS — interface theme.
   Cold slate glass, warm industrial amber, teal water accents.
   The world is the subject: every panel is compact, translucent
   and pinned to an edge so the island always fills the frame.
   ============================================================ */

:root {
  /* surfaces */
  --bg-0: #0d1a22;
  --bg-1: rgba(16, 30, 39, 0.82);
  --bg-2: rgba(22, 40, 51, 0.9);
  --bg-3: rgba(30, 51, 64, 0.95);
  --edge: rgba(150, 205, 225, 0.14);
  --edge-strong: rgba(150, 205, 225, 0.28);

  /* type */
  --ink: #e8f2f6;
  --ink-dim: #a8c0cc;
  --ink-faint: #6f8b98;

  /* accents */
  --amber: #e8a13c;
  --amber-deep: #c97f23;
  --teal: #4fc4c0;
  --teal-deep: #2f8f92;
  --rust: #cf6b45;
  --good: #7fc98a;
  --bad: #e2705f;
  --warn: #e8b73c;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 10px 30px rgba(2, 10, 16, 0.45);
  --drawer-w: 420px;
  --font-head: 'Barlow Condensed', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
}
#game-canvas.dragging { cursor: grabbing; }

button { font-family: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------------- shared building blocks ---------------- */

.hud-card {
  position: fixed;
  z-index: 6;
  background: var(--bg-1);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  padding: 12px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-head--tight { margin-bottom: 8px; }
.card-head-body { flex: 1; min-width: 0; }

.card-title {
  margin: 0;
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.1;
}
.card-sub {
  display: block;
  font-size: 11px;
  color: var(--ink-dim);
  letter-spacing: 0.01em;
}
.card-sub.at-cap, .card-sub.warn { color: var(--warn); }
.card-desc {
  margin: 8px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ink-dim);
}
.card-operator {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--edge);
  font-size: 10.5px;
}
.card-operator span {
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 9px;
}
.card-operator b { font-variant-numeric: tabular-nums; }
.card-operator em {
  font-style: normal;
  margin-left: auto;
  color: var(--teal);
  font-size: 9.5px;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: linear-gradient(160deg, rgba(232, 161, 60, 0.22), rgba(79, 196, 192, 0.14));
  border: 1px solid var(--edge);
  color: var(--amber);
  flex: none;
}

/* icons */
.ico { display: inline-flex; vertical-align: -0.15em; }
.ico svg { width: 100%; height: 100%; display: block; }
.ico--sm { width: 13px; height: 13px; }
.ico--md { width: 18px; height: 18px; }
.ico--lg { width: 22px; height: 22px; }

/* buttons */
.btn {
  border: 1px solid var(--edge-strong);
  background: var(--bg-2);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s, transform 0.08s;
}
.btn:hover:not(:disabled) { background: var(--bg-3); border-color: var(--amber); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: 0.42; cursor: not-allowed; }
.btn--sm { padding: 5px 9px; font-size: 11.5px; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }

/* social link — used on the landing header, the game footer and the guide */
.social-link {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  color: var(--ink-dim);
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.social-link:hover {
  color: var(--ink);
  border-color: var(--amber);
  background: rgba(232, 161, 60, 0.1);
}
.social-link svg { width: 13px; height: 13px; fill: currentColor; display: block; }
.btn--ghost { background: transparent; border-color: var(--edge); }
.btn--icon { padding: 4px; width: 26px; height: 26px; display: grid; place-items: center; }
.btn--danger:hover:not(:disabled) { border-color: var(--bad); color: var(--bad); }
.btn--primary {
  background: linear-gradient(160deg, var(--amber), var(--amber-deep));
  border-color: transparent;
  color: #17242c;
  font-weight: 600;
}
.btn--primary:hover:not(:disabled) { filter: brightness(1.08); background: linear-gradient(160deg, var(--amber), var(--amber-deep)); }
.btn.shake { animation: shake 0.36s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* meters */
.meter {
  height: 4px;
  border-radius: 3px;
  background: rgba(6, 16, 22, 0.6);
  overflow: hidden;
  margin-top: 4px;
}
.meter--lg { height: 7px; }
.meter-fill {
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--teal);
  transition: width 0.3s ease;
}
.meter-energy { background: linear-gradient(90deg, var(--teal-deep), var(--teal)); }
.meter-energy.warn { background: linear-gradient(90deg, var(--amber-deep), var(--warn)); }
.meter-storage { background: linear-gradient(90deg, #5d8ea8, #8fc4d8); }
.meter-storage.warn { background: linear-gradient(90deg, var(--amber-deep), var(--bad)); }
.meter-morale { background: linear-gradient(90deg, #57a06b, var(--good)); }
.meter-morale.warn { background: linear-gradient(90deg, var(--rust), var(--bad)); }
.meter-charter, .meter-research, .meter-build { background: linear-gradient(90deg, var(--amber-deep), var(--amber)); }

/* ============================================================
   COLONY HUD — top centre
   ============================================================ */

#colony-hud {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  pointer-events: none;
}
#colony-hud > * { pointer-events: auto; }

.hud-strip {
  display: flex;
  gap: 4px;
  padding: 6px;
  background: var(--bg-1);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
}

.prime-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  min-width: 108px;
  transition: background 0.15s;
}
.prime-cell:hover { background: rgba(255, 255, 255, 0.05); }
.prime-cell + .prime-cell { border-left: 1px solid var(--edge); }
.prime-icon { color: var(--ink-dim); flex: none; }
.prime-credits .prime-icon { color: var(--amber); }
.prime-energy .prime-icon { color: var(--teal); }
.prime-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.prime-val {
  font-family: var(--font-head);
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.prime-sub, .prime-rate {
  font-size: 10px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.prime-rate.neg { color: var(--bad); }
.prime-sub.warn { color: var(--warn); }

.hud-strip--stocks { padding: 4px; gap: 1px; }
.stock-cell {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.stock-cell:hover { background: rgba(255, 255, 255, 0.05); }
.stock-icon { color: var(--ink-faint); }
.stock-val {
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 26px;
}
.stock-rate {
  font-size: 9.5px;
  color: var(--good);
  font-variant-numeric: tabular-nums;
}
.stock-rate.neg { color: var(--bad); }
.stock-rate.idle { color: var(--ink-faint); }
.stock-cell.tick { animation: stockTick 0.5s ease-out; }
@keyframes stockTick {
  0% { background: rgba(232, 161, 60, 0.3); }
  100% { background: transparent; }
}

#colony-hud.brownout .prime-energy {
  animation: brownoutPulse 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes brownoutPulse {
  0%, 100% { background: transparent; }
  50% { background: rgba(226, 112, 95, 0.18); }
}

/* ============================================================
   CHARTER CARD — top left
   ============================================================ */

#charter-card {
  top: 12px;
  left: 12px;
  width: 268px;
}
#charter-card .card-desc { margin-top: 6px; }

.card-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--edge);
}
.card-stat {
  text-align: center;
  padding: 3px 2px;
  border-radius: var(--radius-sm);
}
.card-stat:hover { background: rgba(255, 255, 255, 0.05); }
.card-stat b {
  display: block;
  font-family: var(--font-head);
  font-size: 16px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.card-stat span {
  font-size: 9.5px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ============================================================
   SURVEY PANEL — right side
   ============================================================ */

#survey-panel {
  top: 12px;
  right: 12px;
  width: 276px;
  max-height: calc(100vh - 84px);
  display: flex;
  flex-direction: column;
}

.survey-tabs {
  display: flex;
  gap: 3px;
  margin-bottom: 7px;
  flex: none;
}
.survey-tab {
  flex: 1;
  padding: 4px 2px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 0.14s, background 0.14s;
}
.survey-tab:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.survey-tab.active {
  color: #17242c;
  background: var(--amber);
}

.survey-catalog {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  overflow-y: auto;
  max-height: 210px;
  padding-right: 2px;
  margin-bottom: 9px;
}
.survey-catalog::-webkit-scrollbar { width: 5px; }
.survey-catalog::-webkit-scrollbar-thumb { background: var(--edge-strong); border-radius: 3px; }

.survey-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px 5px 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background 0.14s, border-color 0.14s;
}
.survey-chip:hover:not(:disabled) { background: rgba(255, 255, 255, 0.09); }
.survey-chip.selected {
  border-color: var(--amber);
  background: rgba(232, 161, 60, 0.16);
}
.survey-chip.locked, .survey-chip:disabled { opacity: 0.4; cursor: not-allowed; }
.survey-chip.unaffordable .chip-name { color: var(--bad); }

.chip-swatch {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  flex: none;
  color: rgba(10, 20, 26, 0.72);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22);
}
.chip-swatch .ico { width: 12px; height: 12px; }
.chip-name {
  font-size: 10.5px;
  flex: 1;
  min-width: 0;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip-lock {
  margin-left: auto;
  flex: none;
  font-size: 9px;
  line-height: 1;
  opacity: 0.75;
}

.survey-preview {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 8px;
  background: rgba(6, 16, 22, 0.4);
  border-radius: var(--radius-sm);
  border: 1px solid var(--edge);
}
#tile-preview {
  width: 78px;
  height: 78px;
  flex: none;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.4));
}
#tile-preview.swap { animation: previewSwap 0.32s ease-out; }
@keyframes previewSwap {
  from { transform: scale(0.86) rotate(-6deg); opacity: 0.4; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}
.survey-preview-body { min-width: 0; flex: 1; }
.preview-name {
  margin: 0 0 5px;
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.preview-yield {
  margin: 5px 0 0;
  font-size: 10.5px;
  color: var(--ink-dim);
}

.cost-row { display: flex; flex-wrap: wrap; gap: 3px; }
.cost-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.07);
}
.cost-chip.ok { color: var(--ink); }
.cost-chip.bad { color: var(--bad); background: rgba(226, 112, 95, 0.15); }

.survey-actions { display: flex; gap: 5px; margin-top: 8px; }
.survey-actions .btn { flex: 1; }
.survey-hint {
  margin: 8px 0 0;
  font-size: 10px;
  line-height: 1.45;
  color: var(--ink-faint);
  text-align: center;
}

/* ============================================================
   INFO PANEL — bottom left
   ============================================================ */

#info-panel {
  left: 12px;
  bottom: 96px;
  width: 300px;
  max-height: calc(100vh - 420px);
  overflow-y: auto;
}
#info-panel::-webkit-scrollbar { width: 5px; }
#info-panel::-webkit-scrollbar-thumb { background: var(--edge-strong); border-radius: 3px; }

.info-block { margin-top: 11px; }
.info-block-title {
  margin: 0 0 6px;
  font-family: var(--font-head);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
}
.info-grid--tight { margin-top: 5px; gap: 2px 10px; }
.info-item {
  display: flex;
  flex-direction: column;
  font-size: 10.5px;
  min-width: 0;
}
.info-item--wide { grid-column: 1 / -1; }
.info-item span { color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; font-size: 9px; }
.info-item b { font-weight: 600; font-size: 11.5px; }
.info-item b.good { color: var(--good); }

.reserve-row { margin-top: 8px; }
.reserve-label {
  display: block;
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}
.reserve-row.depleted .reserve-label { color: var(--bad); }
.info-note {
  margin: 7px 0 0;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--ink-faint);
  font-style: italic;
}

.struct-row {
  display: flex;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.035);
  margin-bottom: 5px;
}
.struct-row.building { background: rgba(232, 161, 60, 0.1); }
.struct-icon { color: var(--amber); flex: none; }
.struct-body { flex: 1; min-width: 0; }
.struct-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
}
.struct-tier {
  font-style: normal;
  font-size: 9.5px;
  color: var(--ink-faint);
  margin-left: 4px;
  letter-spacing: 0.04em;
}
.struct-meta { font-size: 10px; color: var(--ink-dim); }
.struct-flag {
  display: inline-block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--amber);
}

/* ============================================================
   CONSTRUCTION PANEL — left, above the info card
   ============================================================ */

#construction-panel {
  left: 12px;
  top: 258px;
  width: 268px;
  max-height: 34vh;
  overflow-y: auto;
}
.drawer-title--sm {
  margin: 0 0 7px;
  font-family: var(--font-head);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.construction-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
}
.construction-icon { color: var(--amber); flex: none; }
.construction-body { flex: 1; min-width: 0; }
.construction-name {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.construction-pct {
  font-size: 10.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  flex: none;
}

/* ============================================================
   BUILD WHEEL
   ============================================================ */

#build-wheel {
  position: fixed;
  z-index: 9;
  width: 0;
  height: 0;
  pointer-events: none;
}
#build-wheel > * { pointer-events: auto; }

.wheel-center {
  position: absolute;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1px solid var(--edge-strong);
  box-shadow: var(--shadow);
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.wheel-title {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.05;
  padding: 0 6px;
}
.wheel-progress {
  font-size: 9.5px;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}
.wheel-empty {
  position: absolute;
  transform: translate(-50%, 44px);
  white-space: nowrap;
  font-size: 11px;
  color: var(--ink-faint);
  background: var(--bg-1);
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  padding: 4px 9px;
}

.wheel-btn {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(calc(-50% + var(--rx)), calc(-50% + var(--ry)));
  width: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 3px;
  background: var(--bg-2);
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  cursor: pointer;
  animation: wheelPop 0.24s backwards cubic-bezier(0.2, 1.4, 0.4, 1);
  transition: background 0.13s, border-color 0.13s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
@keyframes wheelPop {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
}
.wheel-btn:hover:not(.disabled) { background: var(--bg-3); border-color: var(--amber); }
.wheel-btn.disabled { opacity: 0.4; cursor: not-allowed; }
.wheel-icon { color: var(--ink-dim); }
.wheel-btn--mining .wheel-icon { color: var(--amber); }
.wheel-btn--industry .wheel-icon { color: var(--rust); }
.wheel-btn--logistics .wheel-icon { color: var(--teal); }
.wheel-btn--settlement .wheel-icon { color: #9fc4dd; }
.wheel-btn--upgrade .wheel-icon { color: var(--good); }
.wheel-label {
  font-size: 9.5px;
  font-weight: 500;
  text-align: center;
  line-height: 1.15;
}

/* ============================================================
   DRAWERS — research and operations report
   ============================================================ */

.drawer-toggle {
  position: fixed;
  left: 12px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  background: var(--bg-1);
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: border-color 0.14s, color 0.14s;
}
.drawer-toggle:hover { border-color: var(--amber); }
.drawer-toggle.active { border-color: var(--amber); color: var(--amber); }
#research-toggle { bottom: 52px; }
#stats-toggle { bottom: 52px; left: 148px; }
.drawer-badge {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--amber);
  color: #17242c;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  font-family: var(--font-body);
}

.drawer {
  position: fixed;
  z-index: 8;
  top: 12px;
  right: 12px;
  bottom: 52px;
  width: var(--drawer-w);
  background: var(--bg-1);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  display: flex;
  flex-direction: column;
  padding: 12px;
  animation: drawerIn 0.22s ease-out;
}
@keyframes drawerIn {
  from { opacity: 0; transform: translateX(18px); }
}
.drawer-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--edge);
  flex: none;
}
.drawer-title {
  margin: 0;
  flex: 1;
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.drawer-note { font-size: 10.5px; color: var(--ink-faint); }

/* research */
.rp-active {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px;
  margin-top: 9px;
  border-radius: var(--radius-sm);
  background: rgba(232, 161, 60, 0.12);
  border: 1px solid rgba(232, 161, 60, 0.28);
  flex: none;
}
.rp-active-icon { color: var(--amber); }
.rp-active-body { flex: 1; min-width: 0; }
.rp-active-name { font-size: 12.5px; font-weight: 600; }
.rp-active-time { font-size: 11px; color: var(--amber); font-variant-numeric: tabular-nums; }

.rp-tabs {
  display: flex;
  gap: 3px;
  margin: 10px 0 8px;
  flex: none;
  flex-wrap: wrap;
}
.rp-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  background: transparent;
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  color: var(--ink-dim);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.13s, border-color 0.13s, background 0.13s;
}
.rp-tab:hover { color: var(--ink); }
.rp-tab.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
}
.rp-tab em {
  font-style: normal;
  font-size: 9.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.rp-chain {
  flex: 1;
  overflow-y: auto;
  padding-right: 3px;
}
.rp-chain::-webkit-scrollbar { width: 5px; }
.rp-chain::-webkit-scrollbar-thumb { background: var(--edge-strong); border-radius: 3px; }

.rp-node {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: 100%;
  padding: 9px;
  margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background 0.13s, border-color 0.13s;
}
.rp-node:hover { background: rgba(255, 255, 255, 0.07); }
.rp-node.locked { opacity: 0.44; cursor: not-allowed; }
.rp-node.available { border-color: var(--accent); }
.rp-node.running { border-color: var(--amber); background: rgba(232, 161, 60, 0.12); }
.rp-node.done { opacity: 0.7; cursor: default; }
.rp-node.done .rp-node-icon { color: var(--good); }

.rp-node-rail {
  position: relative;
  width: 18px;
  flex: none;
  display: grid;
  place-items: center;
}
.rp-node-rail i {
  font-style: normal;
  font-size: 9.5px;
  font-weight: 700;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink-faint);
}
.rp-node.done .rp-node-rail i { background: var(--good); color: #12241a; }
.rp-node.available .rp-node-rail i { background: var(--accent); color: #12202a; }
.rp-node-rail::after {
  content: '';
  position: absolute;
  top: 20px;
  bottom: -13px;
  width: 1px;
  background: var(--edge);
}
.rp-node:last-child .rp-node-rail::after { display: none; }

.rp-node-icon { color: var(--accent); flex: none; margin-top: 1px; }
.rp-node-body { flex: 1; min-width: 0; }
.rp-node-name { display: block; font-size: 12.5px; font-weight: 600; overflow-wrap: anywhere; }
.rp-node-unlocks {
  display: block;
  font-size: 10.5px;
  color: var(--ink-dim);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.rp-node-req { display: block; margin-top: 2px; font-size: 9.5px; color: var(--ink-faint); }
.rp-node-meta {
  flex: 0 0 96px;
  align-self: center;
  font-size: 10px;
  line-height: 1.35;
  color: var(--ink-faint);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* operations report */
.stats-body { flex: 1; overflow-y: auto; padding-right: 3px; margin-top: 10px; }
.stats-body::-webkit-scrollbar { width: 5px; }
.stats-body::-webkit-scrollbar-thumb { background: var(--edge-strong); border-radius: 3px; }
.stats-block { margin-bottom: 16px; }
.stats-block h3 {
  margin: 0 0 7px;
  font-family: var(--font-head);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.stats-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.stats-table th {
  text-align: left;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  font-weight: 500;
  padding-bottom: 4px;
}
.stats-table td { padding: 3px 0; border-top: 1px solid rgba(150, 205, 225, 0.08); }
.s-num { text-align: right; font-variant-numeric: tabular-nums; }
.s-num.good { color: var(--good); }
.s-num.bad { color: var(--bad); }
.s-num.flat { color: var(--ink-faint); }
.s-res { display: flex; align-items: center; gap: 5px; color: var(--ink-dim); }
.s-empty { color: var(--ink-faint); font-size: 11px; font-style: italic; }

.s-deposit { margin-bottom: 10px; }
.s-deposit-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11.5px;
  margin-bottom: 3px;
}
.s-deposit-count { font-size: 10px; color: var(--ink-faint); }
.s-deposit-meta { margin-top: 3px; font-size: 10px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

.s-list { list-style: none; margin: 0; padding: 0; }
.s-list li {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 0;
  font-size: 11.5px;
  border-top: 1px solid rgba(150, 205, 225, 0.08);
}
.s-list li span { flex: 1; color: var(--ink-dim); }
.s-list li b { font-variant-numeric: tabular-nums; }

.s-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px; }
.s-kv > div { display: flex; justify-content: space-between; font-size: 11.5px; }
.s-kv span { color: var(--ink-faint); }
.s-kv b { font-variant-numeric: tabular-nums; }

/* ============================================================
   FOOTER, TOAST, TOOLTIP, LOADING
   ============================================================ */

#hud-footer {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  background: var(--bg-1);
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.brand {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--amber);
}
.footer-stat {
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}
.footer-stat b { color: var(--ink); font-variant-numeric: tabular-nums; }
.footer-spacer { flex: 1; }

#toast {
  position: fixed;
  left: 50%;
  bottom: 64px;
  transform: translateX(-50%);
  z-index: 12;
  padding: 9px 18px;
  background: var(--bg-3);
  border: 1px solid var(--edge-strong);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 12.5px;
  max-width: 60vw;
  animation: toastIn 0.24s ease-out;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 12px); }
}

#ui-tooltip {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  max-width: 264px;
  padding: 8px 11px;
  background: rgba(9, 20, 27, 0.96);
  border: 1px solid var(--edge-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink);
}
#ui-tooltip b { color: var(--amber); }
.tip-bad { color: var(--bad); font-style: normal; }
.tip-ok { color: var(--good); }

#debug-hud {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 30;
  margin: 0;
  padding: 10px 14px;
  background: rgba(6, 14, 20, 0.92);
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #9fe0d4;
  white-space: pre;
  pointer-events: none;
}

#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 38%, #1b4358 0%, #0d1a22 62%);
  transition: opacity 0.7s ease;
}
#loading-screen.done { opacity: 0; pointer-events: none; }
#loading-inner { text-align: center; }
#loading-inner h1 {
  margin: 0 0 6px;
  font-family: var(--font-head);
  font-size: 46px;
  font-weight: 700;
  letter-spacing: 0.34em;
  color: var(--amber);
  text-indent: 0.34em;
}
#loading-inner p {
  margin: 0 0 20px;
  font-size: 12.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
#loading-bar {
  width: 260px;
  height: 3px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 auto;
}
#loading-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--teal), var(--amber));
  transition: width 0.45s ease;
}

/* ---------------- responsive trims ---------------- */

@media (max-width: 1180px) {
  #charter-card { width: 232px; }
  #survey-panel { width: 248px; }
  --drawer-w: 366px;
  .prime-cell { min-width: 92px; padding: 5px 8px; }
}

@media (max-height: 780px) {
  #info-panel { max-height: calc(100vh - 320px); }
  #construction-panel { display: none; }
}

@media (max-width: 900px) {
  .hud-strip--stocks { max-width: 96vw; overflow-x: auto; }
  #charter-card .card-stats { grid-template-columns: repeat(2, 1fr); }
  #info-panel { width: 260px; }
  #construction-panel { display: none; }
  .drawer { width: calc(100vw - 24px); }
}
