:root {
  /* Expedition identity: cream / beige / sand with terracotta, Mars rust and charcoal */
  --cream: #fbf7f0;
  --offwhite: #f6f1e8;
  --beige: #efe5d5;
  --sand: #e3d3b9;
  --taupe: #cbbba6;
  --terracotta: #c4704f;
  --rust: #a94a2a;
  --brown: #7a5a43;
  --charcoal: #2b2725;

  --bg: var(--offwhite);
  --panel: var(--cream);
  --surface: var(--beige);
  --chart: #f8f2e8;
  --grid: #e8dccb;
  --fg: var(--charcoal);
  --muted: #7d7166;
  --line: #e2d6c4;
  --accent: var(--rust);
  --measured: #3f6f7d;
  --derived: #7a5a8f;
  --estimated: #b5622f;

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Manrope", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg);
  font: 14px/1.5 var(--font-body); }
body { display: flex; flex-direction: column; }
/* Science Lab (original explorer) keeps its two-column layout inside its view */
#view-lab { display: flex; flex: 1; min-height: 0; }
#panel { width: 340px; flex: none; overflow-y: auto; background: var(--panel);
  border-right: 1px solid var(--line); padding: 16px 18px; }
#map { flex: 1; background: #000; }
h1 { font-family: var(--font-display); font-size: 22px; margin: 0; color: var(--rust); font-weight: 600; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  margin: 18px 0 6px; }
h3 { font-size: 13px; margin: 8px 0 4px; font-weight: 600; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
section { border-top: 1px solid var(--line); }
header + section { border-top: none; }
.mono { font-family: var(--font-mono); font-size: 12px; white-space: pre; }

.layer-row { display: flex; align-items: center; gap: 6px; padding: 3px 0; }
.layer-row label { flex: 1; cursor: pointer; }
.layer-row input[type=range] { width: 70px; }

.badge { display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 6px;
  border-radius: 8px; color: #fff; text-transform: uppercase; letter-spacing: .04em; cursor: help; }
.badge.measured { background: var(--measured); }
.badge.derived { background: var(--derived); }
.badge.estimated { background: var(--estimated); color: #fff; }
.trust-legend, .caveats ul { padding-left: 0; list-style: none; margin: 0; font-size: 12px; color: var(--muted); }
.trust-legend li, .caveats li { margin: 4px 0; }
.caveats li::before { content: "• "; color: var(--accent); }

#mission-layers h3 { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--terracotta); margin: 12px 0 2px; }
.ml-read { margin-top: 10px; background: var(--surface); border-radius: 10px; padding: 8px 10px; font-size: 12px; }
.ml-read p { margin: 4px 0; }
.ramp { height: 10px; border-radius: 3px; border: 1px solid var(--line); }
.ramp-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }

.small { font-size: 12px; color: var(--muted); }
button { background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 6px;
  padding: 3px 8px; cursor: pointer; font-size: 12px; font-family: inherit; }
button:hover { border-color: var(--accent); }
.replay-head { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.replay-head .mono { margin-left: auto; }
#sol-slider { width: 100%; accent-color: var(--accent); }
.ticks { position: relative; height: 8px; margin: -2px 7px 4px; }
.ticks i { position: absolute; top: 0; width: 1px; height: 6px; background: var(--muted); }
.ticks i.on { background: var(--accent); }

.kv { width: 100%; border-collapse: collapse; font-size: 12px; }
.kv td { padding: 1px 0; vertical-align: top; }
.kv td:first-child { color: var(--muted); width: 40%; }
.kv .badge { margin-left: 4px; }
.pending { color: var(--estimated); font-style: italic; }
.inst-counts { font-size: 11px; color: var(--muted); margin: 6px 0; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.gallery figure { margin: 0; position: relative; aspect-ratio: 1; background: #000; cursor: zoom-in; overflow: hidden; }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery figcaption { position: absolute; left: 0; right: 0; bottom: 0; font-size: 9px; padding: 1px 3px;
  background: rgba(0,0,0,.65); color: #ddd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#lightbox { position: fixed; inset: 0; z-index: 5000; background: rgba(0,0,0,.88); display: flex;
  align-items: center; justify-content: center; cursor: zoom-out; padding: 16px; }
#lightbox[hidden] { display: none; }
#lightbox figure { margin: 0; max-width: 100%; max-height: 100%; text-align: center; }
#lightbox img { max-width: 100%; max-height: calc(100vh - 90px); }
#lightbox figcaption { font-size: 12px; color: var(--muted); margin-top: 6px; }
#lightbox a { color: var(--accent); }

.stop-label { background: none; border: none; box-shadow: none; color: #fff; font-weight: 700;
  font-size: 10px; text-shadow: 0 0 3px #000; padding: 0; }
.plan-pick { display: flex; gap: 6px; align-items: center; font-size: 12px; margin-bottom: 6px; flex-wrap: wrap; }
select { background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 4px; font-size: 12px; }
#profile { width: 100%; height: 130px; background: var(--chart); border: 1px solid var(--line); border-radius: 4px;
  margin-top: 6px; cursor: crosshair; }
#profile text { fill: var(--muted); font-size: 9px; font-family: ui-monospace, Consolas, monospace; }
.warn { font-size: 12px; color: #6b3518; background: #f7e3d3; border-left: 3px solid var(--estimated);
  padding: 4px 6px; margin: 6px 0; }
details summary { cursor: pointer; margin-top: 8px; }
.src-pending { color: var(--estimated); font-style: italic; }
#pnr-slider { width: 100%; accent-color: #e62828; }
.sw { display: inline-block; width: 10px; height: 10px; vertical-align: middle; border-radius: 2px; }
.walks { width: 100%; border-collapse: collapse; font-size: 12px; }
.walks th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; border-bottom: 1px solid var(--line); }
.walks td { padding: 2px 2px; border-bottom: 1px solid var(--grid); }
.walks tr.w { cursor: pointer; }
.walks tr.w:hover, .walks tr.sel { background: var(--surface); }
.walks .flag { color: var(--estimated); }
.iso-label { background: rgba(0,0,0,.6); border: none; color: #9fe; font-size: 10px; padding: 0 3px; box-shadow: none; }
button.primary { margin-top: 10px; width: 100%; background: var(--accent); color: var(--cream); font-weight: 700;
  border: none; padding: 7px; font-size: 13px; }
#summary { position: fixed; inset: 0; z-index: 4000; background: rgba(43,39,37,.55); backdrop-filter: blur(4px); overflow-y: auto;
  display: flex; justify-content: center; align-items: flex-start; padding: 24px 16px; }
#summary[hidden] { display: none; }
.sum-card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 24px 60px -24px rgba(60,40,25,.35);
  max-width: 820px; width: 100%; padding: 18px 20px 22px; }
.sum-title { font-size: 14px; margin-top: 0; }
#sum-close { position: absolute; right: 12px; top: 12px; }
.headline { display: flex; align-items: center; justify-content: center; gap: 24px; margin: 6px 0 10px; text-align: center; }
.headline > div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.headline b { font-size: 46px; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.headline span { font-size: 12px; color: var(--muted); }
.headline .vs { font-size: 14px; color: var(--muted); }
.caveat { font-size: 12px; color: var(--fg); background: var(--surface); border-left: 3px solid var(--accent);
  padding: 6px 10px; margin: 8px 0 14px; }
.sum-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.sum-card h3 { color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: .08em; margin: 14px 0 4px; }
.sum-card .kv td:first-child { width: 55%; }
.sum-card .kv td { padding: 3px 0; border-bottom: 1px solid var(--grid); }
.sum-card .kv .note { display: block; font-size: 10px; color: var(--muted); }
#rad-chart { width: 100%; height: 150px; background: var(--chart); border: 1px solid var(--line); border-radius: 4px; margin-top: 8px; }
#rad-chart text { fill: var(--muted); font-size: 10px; font-family: ui-monospace, Consolas, monospace; }
@media (max-width: 720px) { .sum-grid { grid-template-columns: 1fr; } .headline b { font-size: 34px; } }
.leaflet-container { background: #000; }
.home-btn { display: block; width: 30px; height: 30px; line-height: 30px; text-align: center;
  background: #fff; color: #333; font-size: 18px; text-decoration: none; }
.map-badge { position: absolute; z-index: 1000; right: 8px; bottom: 22px; }

@media (max-width: 720px) {
  #view-lab { flex-direction: column-reverse; }
  #panel { width: 100%; height: 45%; border-right: none; border-top: 1px solid var(--line); }
  #map { height: 55%; flex: none; }
}
