/* ============================================================
   DESIGN TOKENS — three themes via [data-theme] on <html>
   These CSS custom properties are the "design tokens" you'll port
   to a game engine (Unity ThemeAsset / Godot Theme / etc).
   ============================================================ */

/* ---------- GAMEPLAY COLORS (theme-agnostic, semantic) ---------- */
:root {
  /* Three population groups — also color the buildings they own */
  --grp-research:  #5cd7ff;  /* Researchers — cool cyan */
  --grp-construct: #ff8c40;  /* Constructors — industrial orange */
  --grp-digit:     #b487ff;  /* Digitizers — data violet */

  /* Three resource tiers */
  --tier-basic:  #5fdba0;    /* C, O, N, H₂O — abundant green */
  --tier-mid:    #e8d04d;    /* Si, Fe, Al, Cu — industrial gold */
  --tier-exotic: #ff5fa0;    /* Nb, W, rare — magenta */
}

/* ---------- THEME 1 · GLASS (Ixion-inspired holographic) ---------- */
html[data-theme="glass"] {
  --font-ui: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Consolas", monospace;
  --font-display: "Inter", system-ui, sans-serif;
  --tracking-display: 0.18em;

  --bg: #03070f;
  --surface: rgba(18, 38, 70, 0.45);
  --surface-strong: rgba(24, 48, 88, 0.65);
  --surface-hover: rgba(40, 80, 140, 0.55);
  --border: rgba(120, 200, 255, 0.22);
  --border-strong: rgba(120, 200, 255, 0.45);

  --text: #e6f2ff;
  --text-dim: #7e9bbd;
  --text-faint: #4a637f;

  --accent-1: #5ce1ff;     /* primary cyan */
  --accent-2: #b487ff;     /* secondary violet */
  --warn: #ffb84d;
  --crit: #ff5577;
  --ok: #6dffb0;

  --radius: 4px;
  --radius-lg: 10px;
  --shadow-panel: 0 8px 32px rgba(0, 12, 30, 0.5);
  --glow-accent: 0 0 12px rgba(92, 225, 255, 0.55);
  --backdrop: blur(12px) saturate(140%);

  /* Viewport scene colors */
  --vp-space-1: #102447;
  --vp-space-2: #02060f;
  --vp-hull-1: #18284a;
  --vp-hull-2: #050a18;
  --vp-end-1: #2a5fa0;
  --vp-end-2: #0a1830;
  --vp-line: #5ce1ff;
  --vp-star: #ffffff;
  --vp-building: #1a2a4a;
  --vp-building-edge: #3a6090;
  --vp-light: #ffd27a;

  --vignette: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.7) 100%);
}

/* ---------- THEME · CARBON (near-black monochrome, translucent panels) ---------- */
html[data-theme="carbon"] {
  --font-ui: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Consolas", monospace;
  --font-display: "Inter", system-ui, sans-serif;
  --tracking-display: 0.18em;

  --bg: #050608;
  --surface: rgba(20, 22, 26, 0.42);
  --surface-strong: rgba(32, 36, 42, 0.6);
  --surface-hover: rgba(54, 58, 68, 0.65);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.28);

  --text: #e8eaef;
  --text-dim: #8a8e98;
  --text-faint: #4a4e56;

  --accent-1: #d8e4f0;      /* icy near-white */
  --accent-2: #8aa3bd;      /* muted cool grey-blue */
  --warn: #d4a76a;
  --crit: #c87060;
  --ok: #7ed4a7;

  --radius: 4px;
  --radius-lg: 10px;
  --shadow-panel: 0 8px 28px rgba(0, 0, 0, 0.7);
  --glow-accent: 0 0 10px rgba(216, 228, 240, 0.25);
  --backdrop: blur(14px) saturate(110%);

  --vp-space-1: #0c0d10;
  --vp-space-2: #020203;
  --vp-hull-1: #16181c;
  --vp-hull-2: #040506;
  --vp-end-1: #d8e4f0;
  --vp-end-2: #1a1f28;
  --vp-line: #d8e4f0;
  --vp-star: #ffffff;
  --vp-building: #14161a;
  --vp-building-edge: #4a505a;
  --vp-light: #f5e8d0;

  --vignette: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,0.78) 100%);
}

/* ---------- THEME · DEEP (saturated dark navy, translucent panels) ---------- */
html[data-theme="deep"] {
  --font-ui: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Consolas", monospace;
  --font-display: "Inter", system-ui, sans-serif;
  --tracking-display: 0.16em;

  --bg: #010206;
  --surface: linear-gradient(180deg, rgba(20, 56, 120, 0.08), rgba(4, 12, 32, 0.02));
  --surface-strong: linear-gradient(180deg, rgba(26, 64, 130, 0.20), rgba(8, 18, 46, 0.10));
  --surface-hover: rgba(36, 80, 150, 0.36);
  --border: rgba(90, 140, 200, 0.30);
  --border-strong: rgba(90, 140, 200, 0.58);

  --text: #c8d8ee;
  --text-dim: #5a7aa3;
  --text-faint: #354868;

  --accent-1: #2c66c0;      /* deeper midnight blue — saturated, low-light */
  --accent-2: #5e8dc8;
  --warn: #ffb84d;
  --crit: #ff5577;
  --ok: #6dffb0;

  --radius: 4px;
  --radius-lg: 10px;
  --shadow-panel:
    0 8px 32px rgba(0, 1, 8, 0.8),
    inset 0 1px 0 rgba(180, 205, 240, 0.28),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5);
  --glow-accent: 0 0 12px rgba(44, 102, 192, 0.55);
  --backdrop: blur(3px) saturate(135%);

  --vp-space-1: #020a22;
  --vp-space-2: #010104;
  --vp-hull-1: #030814;
  --vp-hull-2: #010104;
  --vp-end-1: #2c66c0;
  --vp-end-2: #010415;
  --vp-line: #2c66c0;
  --vp-star: #c4dcfa;
  --vp-building: #040a16;
  --vp-building-edge: #142847;
  --vp-light: #ffd27a;

  --vignette:
    radial-gradient(ellipse 55% 50% at 15% 20%, rgba(20, 70, 180, 0.34), transparent 65%),
    radial-gradient(ellipse 50% 45% at 88% 80%, rgba(70, 40, 130, 0.22), transparent 65%),
    radial-gradient(ellipse 45% 35% at 90% 15%, rgba(160, 100, 50, 0.12), transparent 70%),
    radial-gradient(ellipse 50% 45% at 10% 85%, rgba(20, 80, 150, 0.22), transparent 70%),
    radial-gradient(ellipse at center, transparent 60%, rgba(0,0,4,0.75) 100%);
}

/* ---------- THEME 2 · NOSTROMO (amber CRT brutalism) ---------- */
html[data-theme="nostromo"] {
  --font-ui: "JetBrains Mono", "Consolas", "Courier New", monospace;
  --font-mono: "JetBrains Mono", "Consolas", monospace;
  --font-display: "JetBrains Mono", "Consolas", monospace;
  --tracking-display: 0.25em;

  --bg: #0a0500;
  --surface: rgba(36, 18, 4, 0.85);
  --surface-strong: rgba(50, 24, 6, 0.92);
  --surface-hover: rgba(70, 36, 10, 0.95);
  --border: rgba(255, 140, 30, 0.55);
  --border-strong: rgba(255, 170, 60, 0.9);

  --text: #ffcc66;
  --text-dim: #b87928;
  --text-faint: #6e4818;

  --accent-1: #ff9f1a;
  --accent-2: #ffd27a;
  --warn: #ffae33;
  --crit: #ff3d1f;
  --ok: #b6ff3d;

  --radius: 0px;
  --radius-lg: 0px;
  --shadow-panel: none;
  --glow-accent: 0 0 6px rgba(255, 159, 26, 0.7);
  --backdrop: none;

  --vp-space-1: #1a0b00;
  --vp-space-2: #050200;
  --vp-hull-1: #2a1400;
  --vp-hull-2: #080300;
  --vp-end-1: #ff9f1a;
  --vp-end-2: #2a1400;
  --vp-line: #ff9f1a;
  --vp-star: #ffd27a;
  --vp-building: #2a1600;
  --vp-building-edge: #ff9f1a;
  --vp-light: #ffae33;

  --vignette: radial-gradient(ellipse at center, transparent 35%, rgba(0,0,0,0.85) 100%);
}

/* ---------- THEME 3 · ATRIUM (warm daylight) ---------- */
html[data-theme="atrium"] {
  --font-ui: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Consolas", monospace;
  --font-display: "Inter", system-ui, sans-serif;
  --tracking-display: 0.12em;

  --bg: #ebe5d6;
  --surface: rgba(255, 250, 240, 0.78);
  --surface-strong: rgba(255, 252, 246, 0.95);
  --surface-hover: rgba(245, 235, 215, 0.95);
  --border: rgba(80, 60, 30, 0.18);
  --border-strong: rgba(80, 60, 30, 0.4);

  --text: #2a2218;
  --text-dim: #6a5a44;
  --text-faint: #a39479;

  --accent-1: #c97e3a;
  --accent-2: #4a7c59;
  --warn: #d49633;
  --crit: #b94238;
  --ok: #4a7c59;

  --radius: 8px;
  --radius-lg: 14px;
  --shadow-panel: 0 4px 20px rgba(60, 40, 20, 0.12);
  --glow-accent: none;
  --backdrop: blur(16px) saturate(120%);

  --vp-space-1: #c9d4e0;
  --vp-space-2: #f0e8d6;
  --vp-hull-1: #b0a48a;
  --vp-hull-2: #d4c8a8;
  --vp-end-1: #f5e6c0;
  --vp-end-2: #c9b78e;
  --vp-line: #6a5a44;
  --vp-star: #8a7a5a;
  --vp-building: #d8cdb0;
  --vp-building-edge: #6a5a44;
  --vp-light: #c97e3a;

  --vignette: radial-gradient(ellipse at center, transparent 60%, rgba(60,40,20,0.18) 100%);
}

/* ============================================================
   BASE
   ============================================================ */

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

ul { list-style: none; }

/* ============================================================
   THEME SWITCHER (floating)
   ============================================================ */

.theme-switcher {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 100;
  display: flex;
  gap: 6px;
  padding: 6px;
  background: var(--surface-strong);
  backdrop-filter: var(--backdrop);
  -webkit-backdrop-filter: var(--backdrop);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
}
.theme-switcher button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
}
.theme-switcher button:hover { background: var(--surface-hover); color: var(--text); }
.theme-switcher button.active {
  background: var(--surface-hover);
  color: var(--accent-1);
  box-shadow: var(--glow-accent);
}
.swatch {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
}
.swatch-glass    { background: linear-gradient(135deg, #5ce1ff, #102447); }
.swatch-carbon   { background: linear-gradient(135deg, #d8e4f0, #050608); }
.swatch-deep     { background: linear-gradient(135deg, #6aa9ff, #020816); }
.swatch-nostromo { background: linear-gradient(135deg, #ff9f1a, #2a1400); }
.swatch-atrium   { background: linear-gradient(135deg, #c97e3a, #ebe5d6); }

/* ============================================================
   GAME LAYOUT
   ============================================================ */

.game {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr 280px;
  grid-template-rows: 64px 1fr 72px;
  grid-template-areas:
    "topbar topbar topbar"
    "build  .      right"
    "bottom bottom bottom";
  gap: 14px;
  padding: 14px;
}

/* ============================================================
   3D VIEWPORT (background layer)
   ============================================================ */

.viewport {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.viewport-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.viewport-vignette {
  position: absolute;
  inset: 0;
  background: var(--vignette);
  pointer-events: none;
}
html[data-theme="nostromo"] .viewport::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0,0,0,0.18) 3px,
    transparent 4px
  );
  pointer-events: none;
  mix-blend-mode: multiply;
}

/* ============================================================
   PANEL — shared
   ============================================================ */

.topbar, .build-menu, .right-stack > section, .bottombar {
  position: relative;
  z-index: 1;
  background: var(--surface);
  backdrop-filter: var(--backdrop);
  -webkit-backdrop-filter: var(--backdrop);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
}

.panel-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: var(--tracking-display);
  color: var(--text-dim);
  text-transform: uppercase;
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border);
}

/* ============================================================
   TOP BAR
   ============================================================ */

.topbar {
  grid-area: topbar;
  display: flex;
  align-items: stretch;
  padding: 0 16px;
  gap: 16px;
}

.ship-id {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 16px;
  border-right: 1px solid var(--border);
}
.ship-id__label {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: var(--tracking-display);
  color: var(--accent-1);
  text-shadow: var(--glow-accent);
}
.ship-id__name {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
}

/* ---------- Energy meter — prominent slot, always visible ---------- */
.energy-meter {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-right: 1px solid var(--border);
}
.energy-meter__icon {
  font-size: 22px;
  color: var(--accent-1);
  filter: drop-shadow(var(--glow-accent));
}
.energy-meter__col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.energy-meter__value {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.energy-meter__cap {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-faint);
}
.energy-meter__delta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ok);
  letter-spacing: 0.04em;
}

/* ---------- Resources, tier-coded ---------- */
.resources {
  display: flex;
  gap: 14px;
  flex: 1;
  align-items: center;
  flex-wrap: wrap;
}
.res {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  border-left: 2px solid var(--tier);
  background: color-mix(in srgb, var(--tier) 6%, transparent);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.res.tier-basic  { --tier: var(--tier-basic); }
.res.tier-mid    { --tier: var(--tier-mid); }
.res.tier-exotic { --tier: var(--tier-exotic); }

.res__icon {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--tier);
  letter-spacing: 0.04em;
  text-transform: none;
  min-width: 22px;
}
.res__value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.res__delta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
}
.res__delta--up   { color: var(--ok); }
.res__delta--down { color: var(--crit); }

/* ---------- Population, group-coded ---------- */
.population-stat {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
}
.pop-grp {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pop-grp--research  { --grp: var(--grp-research); }
.pop-grp--construct { --grp: var(--grp-construct); }
.pop-grp--digit     { --grp: var(--grp-digit); }
.pop-grp__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--grp);
  box-shadow: 0 0 8px color-mix(in srgb, var(--grp) 65%, transparent);
}
.pop-grp__label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--grp);
  letter-spacing: 0.05em;
}
.pop-grp__count {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   BUILD MENU (left)
   ============================================================ */

.build-menu {
  grid-area: build;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Wrapper: holds all four sections, scrollable */
.build-sections {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.build-section {
  padding: 4px 8px 8px;
}
.build-section__title {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--grp);
  padding: 8px 8px 6px;
  border-bottom: 1px solid color-mix(in srgb, var(--grp) 28%, transparent);
  margin-bottom: 4px;
  text-transform: uppercase;
}
.build-section--core      { --grp: var(--text-dim); }
.build-section--research  { --grp: var(--grp-research); }
.build-section--construct { --grp: var(--grp-construct); }
.build-section--digit     { --grp: var(--grp-digit); }

.build-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.build-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 13px;
  letter-spacing: 0.03em;
  transition: background 0.15s, color 0.15s;
  text-align: left;
}
.build-item:hover {
  background: color-mix(in srgb, var(--grp) 14%, transparent);
  color: var(--text);
}
.build-item.active {
  background: color-mix(in srgb, var(--grp) 22%, transparent);
  color: var(--grp);
  box-shadow:
    inset 2px 0 0 var(--grp),
    0 0 12px color-mix(in srgb, var(--grp) 30%, transparent);
}
.bi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--surface-strong);
  color: var(--text-dim);
  flex-shrink: 0;
}
.build-item:hover .bi-icon { color: var(--text); }
.build-item.active .bi-icon {
  border-color: var(--grp);
  color: var(--grp);
}

.build-detail {
  margin: 8px;
  padding: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.bd-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.bd-stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.btn-primary {
  width: 100%;
  padding: 8px;
  background: var(--accent-1);
  color: var(--bg);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: var(--tracking-display);
  text-transform: uppercase;
  border-radius: var(--radius);
  transition: filter 0.15s;
}
html[data-theme="atrium"] .btn-primary { color: #fff; }
.btn-primary:hover { filter: brightness(1.15); }

/* ============================================================
   RIGHT STACK — sector map + alerts
   ============================================================ */

.right-stack {
  grid-area: right;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}
.sector-map { padding-bottom: 12px; }
.ark-schematic {
  display: block;
  width: 100%;
  padding: 12px 14px 4px;
  box-sizing: border-box;
}
.sector-stats {
  padding: 0 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sector-stats li {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}
.sector-stats strong {
  color: var(--text);
  font-weight: 600;
}

.alerts {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.alert-list {
  padding: 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.alert {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-left: 2px solid var(--text-faint);
  background: var(--surface-strong);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.alert__tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--text-faint);
}
.alert__msg { font-size: 12px; color: var(--text); }
.alert--info { border-left-color: var(--accent-1); }
.alert--info .alert__tag { color: var(--accent-1); }
.alert--warn { border-left-color: var(--warn); }
.alert--warn .alert__tag { color: var(--warn); }
.alert--crit {
  border-left-color: var(--crit);
  animation: pulse 1.6s ease-in-out infinite;
}
.alert--crit .alert__tag { color: var(--crit); }

@keyframes pulse {
  0%, 100% { background: var(--surface-strong); }
  50%      { background: color-mix(in srgb, var(--crit) 18%, var(--surface-strong)); }
}

/* ============================================================
   VIEWPORT — sector interior view (Ixion-style)
   ============================================================ */

/* ---------- Building face shadings — derived from group color ---------- */
.bld-research-front  { fill: var(--grp-research); fill-opacity: 0.85; }
.bld-research-top    { fill: color-mix(in srgb, var(--grp-research) 62%, white); fill-opacity: 0.9; }
.bld-research-side   { fill: color-mix(in srgb, var(--grp-research) 50%, black); fill-opacity: 0.88; }

.bld-construct-front { fill: var(--grp-construct); fill-opacity: 0.85; }
.bld-construct-top   { fill: color-mix(in srgb, var(--grp-construct) 62%, white); fill-opacity: 0.9; }
.bld-construct-side  { fill: color-mix(in srgb, var(--grp-construct) 50%, black); fill-opacity: 0.88; }

.bld-digit-front     { fill: var(--grp-digit); fill-opacity: 0.85; }
.bld-digit-top       { fill: color-mix(in srgb, var(--grp-digit) 62%, white); fill-opacity: 0.9; }
.bld-digit-side      { fill: color-mix(in srgb, var(--grp-digit) 50%, black); fill-opacity: 0.88; }

/* server rack window strips — match the digit group color */
.bld-rack {
  fill: color-mix(in srgb, var(--grp-digit) 80%, white);
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--grp-digit) 70%, transparent));
}

/* warm window glow on habitats / labs / workshops */
.window-glow {
  fill: rgba(255, 220, 130, 0.85);
  filter: drop-shadow(0 0 4px rgba(255, 200, 100, 0.5));
}

/* empty build-plot placeholder */
.empty-plot {
  fill: rgba(255, 255, 255, 0.03);
  stroke: var(--text-faint);
  stroke-width: 1.5;
  stroke-dasharray: 6 6;
}

/* antenna blink lights — staggered cycles per group */
.bld-research-front + .bld-research-side ~ .ant-blink,
.bld:nth-child(odd) .ant-blink {
  animation: ant-blink 2s ease-in-out infinite;
}
.bld:nth-child(even) .ant-blink {
  animation: ant-blink 2.6s ease-in-out infinite -0.7s;
}
@keyframes ant-blink {
  0%, 80%, 100% { opacity: 0.45; }
  85%           { opacity: 1; }
}

/* warm window-glow flicker */
.window-glow:nth-child(odd) {
  animation: window-flicker 4s ease-in-out infinite;
}
.window-glow:nth-child(even) {
  animation: window-flicker 5.4s ease-in-out infinite -1.5s;
}
@keyframes window-flicker {
  0%, 100% { opacity: 0.7; }
  50%      { opacity: 1; }
}

/* server rack flicker */
.bld-rack:nth-child(odd) {
  animation: rack-flicker 3.2s ease-in-out infinite;
}
.bld-rack:nth-child(even) {
  animation: rack-flicker 4.5s ease-in-out infinite -1s;
}
@keyframes rack-flicker {
  0%, 100% { opacity: 0.85; }
  50%      { opacity: 1; }
}

/* Respect user motion preference */
@media (prefers-reduced-motion: reduce) {
  .ant-blink,
  .window-glow,
  .bld-rack {
    animation: none !important;
  }
}

/* ============================================================
   SECTOR OVERLAY — sector ID + adjacent navigation hints
   sits over the viewport, between build menu and right-stack
   ============================================================ */

.sector-overlay {
  position: absolute;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
  z-index: 2;
}

.sector-id {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 32px;
  background: var(--surface-strong);
  backdrop-filter: var(--backdrop);
  -webkit-backdrop-filter: var(--backdrop);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  pointer-events: auto;
}
.sector-id__num {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent-1);
  text-shadow: var(--glow-accent);
  line-height: 1;
}
.sector-id__name {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-top: 4px;
}
.sector-id__meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.sector-nav {
  display: flex;
  gap: 18px;
}
.sector-nav__btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: color-mix(in srgb, var(--surface-strong) 65%, transparent);
  backdrop-filter: var(--backdrop);
  -webkit-backdrop-filter: var(--backdrop);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  pointer-events: auto;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.sector-nav__btn:hover {
  color: var(--accent-1);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}
.sector-nav__arrow {
  font-size: 11px;
  opacity: 0.7;
}

/* ============================================================
   BOTTOM BAR
   ============================================================ */

.bottombar {
  grid-area: bottom;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  gap: 24px;
}

.objective {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}
.obj-label {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: var(--tracking-display);
  color: var(--accent-2);
  padding: 4px 8px;
  border: 1px solid var(--accent-2);
  border-radius: var(--radius);
}
.obj-text {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.time-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tc-btn {
  width: 38px; height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 12px;
  transition: all 0.15s;
}
.tc-btn:hover { color: var(--text); border-color: var(--border-strong); }
.tc-btn.active {
  background: var(--accent-1);
  border-color: var(--accent-1);
  color: var(--bg);
  box-shadow: var(--glow-accent);
}
html[data-theme="atrium"] .tc-btn.active { color: #fff; }
.game-date {
  margin-left: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
}

/* ============================================================
   THEME-SPECIFIC OVERRIDES
   ============================================================ */

/* Nostromo: harder edges, double border, all-caps */
html[data-theme="nostromo"] .topbar,
html[data-theme="nostromo"] .build-menu,
html[data-theme="nostromo"] .right-stack > section,
html[data-theme="nostromo"] .bottombar {
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
html[data-theme="nostromo"] .build-item,
html[data-theme="nostromo"] .alert__msg,
html[data-theme="nostromo"] .obj-text,
html[data-theme="nostromo"] .bd-name {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
html[data-theme="nostromo"] .res__value { letter-spacing: 0.05em; }

/* Atrium: softer everything */
html[data-theme="atrium"] .ship-id__label { text-shadow: none; }
html[data-theme="atrium"] .res__icon { filter: none; }
