:root {
  --bg: #071018;
  --bg-deep: #05080d;
  --elevated: #0d1520;
  --surface: rgba(14, 24, 36, 0.72);
  --fg: #e8eef6;
  --muted: #8aa0b8;
  --border: rgba(148, 163, 184, 0.18);
  --amber: #f59e0b;
  --amber-dim: #b45309;
  --cyan: #22d3ee;
  --cyan-dim: #0891b2;
  --ok: #22c55e;
  --warn: #fbbf24;
  --bad: #ef4444;
  --ore: #c45c26;
  --radius: 14px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --font-display: "Orbitron", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --space: 8px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg-deep); color: var(--fg); }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; }
b { font-variant-numeric: tabular-nums; }

.ambient { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.blob {
  position: absolute; width: 42vw; height: 42vw; border-radius: 50%;
  filter: blur(80px); opacity: 0.14; animation: drift 18s ease-in-out infinite alternate;
}
.blob-a { background: #1d4ed8; top: -10%; left: -8%; }
.blob-b { background: #b45309; bottom: -12%; right: -10%; animation-delay: -7s; }
.scanlines {
  position: absolute; inset: 0; opacity: 0.05;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, #000 3px);
  pointer-events: none;
}
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(6%, 8%) scale(1.12); }
}

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: grid; grid-template-columns: 1fr auto auto auto;
  align-items: center; gap: 16px;
  padding: 10px 20px;
  background: rgba(5, 8, 13, 0.78);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); }
.brand-mark { width: 36px; height: 36px; color: var(--ok); }
.brand-name { font-family: var(--font-display); font-weight: 900; letter-spacing: 0.18em; font-size: 13px; }
.brand-sub { color: var(--muted); font-size: 10px; letter-spacing: 0.22em; }

.tabs { display: flex; gap: 6px; }
.tab {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 8px 16px; border-radius: 999px; letter-spacing: 0.16em; font-size: 11px;
  transition: color 200ms var(--ease), border-color 200ms var(--ease), background 200ms var(--ease);
}
.tab:hover, .tab:focus-visible { color: var(--fg); border-color: #64748b; outline: none; }
.tab.is-active { color: var(--fg); background: rgba(255,255,255,0.06); border-color: #94a3b8; }

.mode-switch {
  display: flex; padding: 3px; border-radius: 999px;
  background: #0b1220; border: 1px solid var(--border);
}
.mode-btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; background: transparent; color: var(--muted);
  padding: 8px 16px; border-radius: 999px; letter-spacing: 0.12em; font-size: 11px;
  transition: background 220ms var(--ease), color 220ms var(--ease), box-shadow 220ms var(--ease);
}
.mode-btn svg { width: 16px; height: 16px; fill: currentColor; }
.mode-btn[data-mode="rover"].is-on {
  background: linear-gradient(180deg, #92400e, #78350f); color: #fff7ed;
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.35);
}
.mode-btn[data-mode="drone"].is-on {
  background: linear-gradient(180deg, #0e7490, #155e75); color: #ecfeff;
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.35);
}

.clock-block { text-align: right; }
.clock { font-family: var(--font-display); font-size: 16px; letter-spacing: 0.08em; }
.clock-label { font-size: 10px; color: var(--muted); letter-spacing: 0.16em; }

.view { position: relative; z-index: 1; }
.view[hidden] { display: none !important; }

.hero {
  position: relative; min-height: 100dvh;
  display: grid; place-items: end start;
  overflow: hidden;
}
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-copy {
  position: relative; z-index: 2; padding: 8vw 8vw 12vh;
  max-width: 820px;
}
.eyebrow {
  letter-spacing: 0.32em; font-size: 11px; color: var(--muted); margin: 0 0 12px;
}
.hero-title {
  font-family: var(--font-display); font-weight: 900; font-size: clamp(42px, 8vw, 92px);
  line-height: 0.92; margin: 0 0 20px; letter-spacing: 0.04em;
}
.hero-title .line { display: block; }
.hero-title .accent { color: var(--ok); text-shadow: 0 0 24px rgba(34, 197, 94, 0.35); }
.lede { max-width: 52ch; color: #cbd5e1; margin: 0 0 28px; }
.hero-stats { display: flex; gap: 28px; margin-bottom: 28px; flex-wrap: wrap; }
.hero-stats b { display: block; font-family: var(--font-display); font-size: 28px; }
.hero-stats span { color: var(--muted); font-size: 11px; letter-spacing: 0.12em; }

.cta {
  background: var(--ok); color: #052e16; border: 0; border-radius: 999px;
  padding: 12px 22px; font-weight: 700; letter-spacing: 0.12em; font-size: 12px;
  box-shadow: 0 0 24px rgba(34, 197, 94, 0.28);
  transition: transform 180ms var(--ease), filter 180ms var(--ease);
}
.cta:hover { transform: scale(0.98); filter: brightness(1.08); }
.cta:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.cta-amber { background: var(--amber); color: #1c1003; box-shadow: 0 0 24px rgba(245,158,11,0.3); }
.cta-cyan { background: var(--cyan); color: #083344; box-shadow: 0 0 24px rgba(34,211,238,0.3); }

.scroll-hint {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; color: var(--muted);
  letter-spacing: 0.28em; font-size: 10px;
}
.scroll-hint span {
  width: 1px; height: 36px; background: linear-gradient(#22c55e, transparent);
  animation: drip 1.6s var(--ease) infinite;
}
@keyframes drip { 0% { transform: scaleY(0.3); opacity: 0; } 40% { opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

.cross-section, .process, .fleet {
  padding: 80px 6vw; position: relative;
}
.section-head { margin-bottom: 32px; }
.section-head h2 {
  font-family: var(--font-display); font-size: clamp(24px, 4vw, 40px); margin: 6px 0 0;
  letter-spacing: 0.08em;
}
.mine-svg { width: 100%; height: auto; background: #0a1018; border: 1px solid var(--border); border-radius: var(--radius); }
.haul-road { stroke-dashoffset: 0; animation: dash 8s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -180; } }
.lamp { animation: pulse 2.4s ease-in-out infinite; }
.lamp.l2 { animation-delay: 0.4s; } .lamp.l3 { animation-delay: 0.8s; } .lamp.l4 { animation-delay: 1.2s; }
@keyframes pulse { 50% { opacity: 0.35; } }
.cut-legend { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 16px; color: var(--muted); font-size: 12px; }
.swatch { display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: middle; border-radius: 3px; }
.swatch.rock { background: #3a4458; } .swatch.ore { background: var(--ore); }
.swatch.road { background: var(--amber); } .swatch.shaft { background: var(--ok); }

.flow { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.flow-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; min-height: 240px;
}
.step-num { font-family: var(--font-display); color: var(--ok); font-size: 18px; }
.flow-card h3 { margin: 8px 0; font-family: var(--font-display); font-size: 14px; letter-spacing: 0.08em; }
.flow-card p { color: var(--muted); margin: 0 0 16px; font-size: 12px; }
.mini-viz { height: 48px; border-radius: 8px; background: #0b1220; overflow: hidden; position: relative; }
.blast span {
  position: absolute; bottom: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--amber);
  animation: blast 1.6s ease-in infinite;
}
.blast span:nth-child(1) { left: 16%; animation-delay: 0s; }
.blast span:nth-child(2) { left: 32%; animation-delay: 0.2s; }
.blast span:nth-child(3) { left: 48%; animation-delay: 0.1s; }
.blast span:nth-child(4) { left: 64%; animation-delay: 0.35s; }
.blast span:nth-child(5) { left: 80%; animation-delay: 0.15s; }
@keyframes blast { 0% { transform: translateY(10px) scale(0.4); opacity: 0; } 40% { opacity: 1; } 100% { transform: translateY(-28px) scale(1.4); opacity: 0; } }
.haul .bar {
  position: absolute; top: 18px; left: -40%; width: 36%; height: 12px; background: var(--amber);
  border-radius: 3px; animation: haul 3.2s linear infinite;
}
@keyframes haul { to { left: 110%; } }
.drift { background: linear-gradient(90deg, #0b1220 40%, #1e293b 50%, #0b1220 60%); background-size: 200% 100%; animation: tunnel 2.8s linear infinite; }
@keyframes tunnel { to { background-position: 200% 0; } }
.survey { background: repeating-linear-gradient(90deg, #083344 0 10px, #0b1220 10px 20px); }

.fleet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.fleet-card {
  border: 1px solid var(--border); border-radius: 18px; padding: 24px; background: var(--surface);
}
.rover-card { box-shadow: inset 0 0 0 1px rgba(245,158,11,0.18); }
.drone-card { box-shadow: inset 0 0 0 1px rgba(34,211,238,0.18); }
.fleet-art { margin-bottom: 12px; }
.fleet-card h3 { font-family: var(--font-display); letter-spacing: 0.1em; }
.fleet-card p { color: var(--muted); }
.fleet-card ul { padding-left: 18px; color: #cbd5e1; }
.fleet-card .cta { margin-top: 12px; }

.ops { padding: 18px 20px 40px; min-height: calc(100dvh - 64px); }
.ops-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.ops-head h2 { font-family: var(--font-display); margin: 4px 0 0; font-size: 22px; letter-spacing: 0.08em; }
.status-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px;
  font-size: 11px; letter-spacing: 0.12em; color: var(--muted);
}
.pill.ok { color: #bbf7d0; border-color: rgba(34,197,94,0.5); background: rgba(34,197,94,0.08); }
.pill.warn { color: #fde68a; border-color: rgba(251,191,36,0.5); background: rgba(251,191,36,0.08); }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.panel-h {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 14px; font-size: 11px; letter-spacing: 0.14em; color: var(--muted);
  border-bottom: 1px solid var(--border); background: rgba(2,6,23,0.35);
}
.rec { color: var(--bad); display: inline-flex; align-items: center; gap: 6px; }
.rec i { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); animation: rec 1s steps(1) infinite; }
.rec.cyan { color: var(--cyan); }
.rec.cyan i { background: var(--cyan); }
@keyframes rec { 50% { opacity: 0.2; } }

.cam-wrap { position: relative; background: #05080d; }
.cam-wrap canvas { display: block; width: 100%; height: auto; }
.cam-hud {
  position: absolute; left: 12px; right: 12px; bottom: 12px;
  display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  font-size: 11px; color: #bbf7d0; text-shadow: 0 0 8px #052e16;
}
.cyan-hud { color: #a5f3fc; text-shadow: 0 0 8px #083344; }

.rover-theme { --accent: var(--amber); }
.drone-theme { --accent: var(--cyan); }
.rover-head h2 { color: #fde68a; }
.drone-head h2 { color: #a5f3fc; }

.rover-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  grid-template-rows: auto auto;
  gap: 14px;
}
.cam-panel { grid-column: 1; grid-row: 1 / span 2; }
.radar-panel, .chassis-panel { grid-column: 2; }
#radar { display: block; width: 100%; height: auto; background: radial-gradient(circle, #052e16 0%, #020617 70%); }
.radar-meta, .gauges-row { display: flex; gap: 12px; padding: 12px; align-items: center; flex-wrap: wrap; }
.radar-meta div, .kpi { flex: 1; min-width: 70px; }
.radar-meta b, .kpi b, .fm b, .comp-read b {
  display: block; font-family: var(--font-display); font-size: 18px; color: var(--fg);
}
.radar-meta span, .kpi span, .fm span { color: var(--muted); font-size: 10px; letter-spacing: 0.1em; }
.dial { text-align: center; color: var(--muted); font-size: 10px; letter-spacing: 0.12em; }
.kpi-stack { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; flex: 1; }

.gas-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
.compartment {
  position: relative; border-radius: 16px; padding: 16px 16px 12px;
  background: linear-gradient(180deg, #12100c, #0a0c10);
  border: 1px solid rgba(245,158,11,0.28);
  box-shadow: inset 0 0 0 6px rgba(15, 23, 42, 0.55), 0 10px 30px rgba(0,0,0,0.35);
}
.compartment.co { border-color: rgba(239,68,68,0.35); }
.compartment.aqi { border-color: rgba(34,197,94,0.32); }
.comp-seal {
  position: absolute; top: 8px; right: 12px; font-size: 9px; letter-spacing: 0.2em; color: var(--muted);
}
.compartment header { display: flex; align-items: center; gap: 10px; }
.compartment h3 { margin: 0; font-family: var(--font-display); font-size: 13px; letter-spacing: 0.1em; }
.led {
  width: 10px; height: 10px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 10px var(--ok);
}
.led.warn { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.led.bad { background: var(--bad); box-shadow: 0 0 10px var(--bad); }
.comp-read { display: flex; align-items: baseline; gap: 8px; }
.comp-read b { font-size: 32px; }
.comp-note { color: var(--muted); font-size: 11px; margin: 6px 0 8px; }
.sparkline canvas { width: 100%; height: 48px; display: block; }

.drone-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.map3d { width: 100%; height: 360px; background: #020617; }
.map-legend {
  display: flex; justify-content: space-between; padding: 8px 12px; color: var(--muted); font-size: 11px;
}
.drone-aux { display: grid; grid-template-columns: 1.4fr 1fr 0.9fr; gap: 14px; margin-top: 14px; }
.flight-metrics { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; padding: 12px; }
#horizon, #surveyGrid { display: block; width: 100%; height: auto; }
.coverage { padding: 8px 12px 14px; color: var(--muted); font-size: 11px; }
.cov-bar { height: 8px; background: #0b1220; border-radius: 99px; overflow: hidden; margin-bottom: 6px; }
.cov-bar i { display: block; height: 100%; width: 41%; background: linear-gradient(90deg, #0891b2, #22d3ee); }
.rotors { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
.rotor {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px; text-align: center;
}
.rotor canvas { width: 72px; height: 72px; }
.rotor b { display: block; font-size: 12px; }
.rotor span { color: var(--muted); font-size: 10px; }

@media (max-width: 1100px) {
  .flow, .fleet-grid, .drone-grid, .gas-row, .drone-aux { grid-template-columns: 1fr 1fr; }
  .rover-grid { grid-template-columns: 1fr; }
  .cam-panel { grid-column: auto; grid-row: auto; }
  .flight-metrics { grid-template-columns: repeat(3, 1fr); }
  .topbar { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .flow, .fleet-grid, .drone-grid, .gas-row, .drone-aux { grid-template-columns: 1fr; }
  .hero-title { font-size: 40px; }
  .mode-btn { padding: 8px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
