/* MissionOps interface. Dark "Mars dusk" theme: basalt surfaces, regolith ochre for actions, cyan for science data. */
:root {
  --bg: #0c0e12; --surface: rgba(17, 19, 24, .9); --surface-2: #1a1d24; --line: rgba(255, 255, 255, .09);
  --ink: #eef0f3; --quiet: #9aa1ad; --faint: #6b7280;
  --accent: #f0a35e; --accent-ink: #1b1108; --science: #5cc8d6; --ok: #5fd08a; --warn: #f2c14e; --bad: #f0685c;
  --r: 14px; --shadow: 0 8px 28px rgba(0, 0, 0, .45), 0 1px 0 rgba(255, 255, 255, .04) inset;
  --gap: 12px; --sheet-w: 372px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 13px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
.num { font-variant-numeric: tabular-nums; }
#map { position: fixed; inset: 0; background: #14100d; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- top-left: search + tabs ---- */
#top { position: fixed; top: var(--gap); left: var(--gap); width: var(--sheet-w); z-index: 1100; display: grid; gap: 8px; }
.search { position: relative; display: flex; align-items: center; gap: 8px; padding: 0 6px 0 12px; height: 46px; border-radius: 23px; }
.logo { width: 22px; height: 22px; color: var(--accent); flex: none; }
#q { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--ink); font: inherit; font-size: 14px; outline: none; }
#q::placeholder { color: var(--faint); }
.icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; }
.icon:hover { background: rgba(255, 255, 255, .08); }
.icon svg { width: 18px; height: 18px; }
.results { position: absolute; top: 52px; left: 0; right: 0; margin: 0; padding: 6px; list-style: none; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); max-height: 300px; overflow: auto; }
.results li { padding: 8px 10px; border-radius: 9px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.results li:hover, .results li.sel { background: rgba(255, 255, 255, .07); }
.results small { color: var(--quiet); }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px; border-radius: 12px; }
.tabs button { border: 0; background: transparent; padding: 7px 0; border-radius: 9px; color: var(--quiet); font-weight: 600; letter-spacing: .01em; }
.tabs button[aria-selected=true] { background: var(--accent); color: var(--accent-ink); }

/* ---- sheet ---- */
#sheet { position: fixed; left: var(--gap); top: 118px; bottom: var(--gap); width: var(--sheet-w); z-index: 1050; overflow: auto; padding: 4px 14px 16px; scrollbar-width: thin; scrollbar-color: #3a3f4a transparent; transition: transform .22s ease, opacity .22s ease; }
body.sheet-closed #sheet { transform: translateX(calc(-100% - 24px)); opacity: 0; pointer-events: none; }
h3 { margin: 16px 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--quiet); display: flex; justify-content: space-between; align-items: center; }
h3 .tag { font-weight: 600; letter-spacing: 0; text-transform: none; }
p { margin: 6px 0; }
.q { color: var(--quiet); } .small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.row > .grow { flex: 1; min-width: 0; }
.opt { display: flex; align-items: center; gap: 10px; padding: 7px 8px; margin: 0 -8px; border-radius: 9px; cursor: pointer; }
.opt:hover { background: rgba(255, 255, 255, .05); }
.opt input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; flex: none; }
.sub { color: var(--quiet); font-size: 11.5px; display: block; }
input[type=range] { width: 100%; accent-color: var(--accent); margin: 2px 0; }
select, input[type=text], input[type=number], input[type=datetime-local] { width: 100%; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; font: inherit; color-scheme: dark; }
.btn { border: 1px solid var(--line); background: var(--surface-2); border-radius: 9px; padding: 7px 11px; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: rgba(255, 255, 255, .25); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.armed { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 3px rgba(240, 163, 94, .18); }
.btn.ghost { background: transparent; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 11px; border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; padding: 7px 4px; border-radius: 8px; color: var(--quiet); font-weight: 600; }
.seg button.on { background: rgba(255, 255, 255, .12); color: var(--ink); }
.box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 8px 0; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 8px; margin: 4px 0; }
.stat b { display: block; font-size: 17px; font-weight: 650; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--quiet); font-size: 11.5px; }
.legend { display: grid; gap: 3px; margin: 6px 0 2px; font-size: 12px; }
.legend div { display: flex; justify-content: space-between; }
.sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 7px; vertical-align: -1px; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 20px; font-size: 11px; font-weight: 650; background: rgba(255, 255, 255, .09); color: var(--quiet); }
.tag.ok { background: rgba(95, 208, 138, .16); color: var(--ok); } .tag.warn { background: rgba(242, 193, 78, .16); color: var(--warn); } .tag.bad { background: rgba(240, 104, 92, .18); color: var(--bad); }
.tag.model { background: rgba(92, 200, 214, .14); color: var(--science); }
.checks { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 5px; }
.checks li { display: grid; grid-template-columns: 16px 1fr; gap: 8px; font-size: 12.5px; }
.checks li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; background: var(--ok); }
.checks li.warn::before { background: var(--warn); } .checks li.bad::before { background: var(--bad); } .checks li.info::before { background: var(--faint); }
canvas.chart { width: 100%; height: 96px; display: block; margin-top: 8px; }
.pt { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 8px; padding: 7px 0; }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--ok); justify-self: center; }
.dot.b { border-color: var(--bad); border-radius: 4px; }
.zone { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: start; padding: 9px 0; border-top: 1px solid var(--line); }
.zone:first-child { border-top: 0; }
.zone i { width: 12px; height: 12px; border-radius: 50%; margin-top: 3px; }
.linkbig { font-size: 26px; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ---- status chips (top right) ---- */
#chips { position: fixed; top: var(--gap); right: var(--gap); z-index: 1000; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; max-width: calc(100vw - var(--sheet-w) - 48px); }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px 11px; box-shadow: var(--shadow); backdrop-filter: blur(14px); line-height: 1.2; }
.chip { white-space: nowrap; }
.chip small { display: block; color: var(--quiet); font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; }
.chip b { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.chip.bad b { color: var(--bad); } .chip.warn b { color: var(--warn); }

/* ---- time bar, readout, map controls ---- */
#timebar { position: fixed; bottom: var(--gap); left: 50%; transform: translateX(calc(-50% + var(--sheet-w) / 2)); z-index: 1000; display: flex; align-items: center; gap: 12px; padding: 8px 12px; width: min(600px, calc(100vw - var(--sheet-w) - 150px)); }
body.sheet-closed #timebar { transform: translateX(-50%); }
.tb-main { flex: 1; min-width: 0; }
#tbLabel { font-size: 12px; color: var(--quiet); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tbLabel b { color: var(--ink); }
.tb-ticks { display: flex; justify-content: space-between; color: var(--faint); font-size: 10px; margin-top: -2px; }
#tbDate { width: 178px; flex: none; }
.pill { border: 1px solid var(--line); background: var(--surface-2); border-radius: 20px; padding: 6px 12px 6px 24px; font-weight: 650; position: relative; flex: none; }
.pill::before { content: ""; position: absolute; left: 10px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--faint); }
.pill.on { color: var(--ok); border-color: rgba(95, 208, 138, .4); } .pill.on::before { background: var(--ok); box-shadow: 0 0 0 4px rgba(95, 208, 138, .18); }
#readout { position: fixed; right: var(--gap); top: 66px; z-index: 1000; padding: 7px 12px; font-size: 12px; border-radius: 10px; max-width: 46vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mapctl { position: fixed; right: var(--gap); bottom: var(--gap); z-index: 1000; display: grid; gap: 8px; }
#mapctl .card { border-radius: 12px; }
#mapctl > .icon { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.zoom { display: grid; } .zoom .icon { width: 38px; height: 38px; border-radius: 0; font-size: 20px; line-height: 1; } .zoom .icon + .icon { border-top: 1px solid var(--line); }
#toast { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); z-index: 1200; padding: 9px 16px; border-radius: 22px; border-color: var(--accent); font-weight: 600; }
body.picking #map { cursor: crosshair; }
body.picking .leaflet-interactive { cursor: crosshair; }

/* ---- Leaflet overrides ---- */
.leaflet-container { font: inherit; background: #14100d; }
.leaflet-control-attribution { background: rgba(12, 14, 18, .7) !important; color: var(--faint) !important; font-size: 10px; border-radius: 8px 0 0 0; }
.leaflet-control-attribution a { color: var(--quiet) !important; }
.leaflet-bottom.leaflet-right { right: 60px; bottom: 44px; }
.leaflet-popup-content-wrapper { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.leaflet-popup-tip { background: var(--surface-2); }
.leaflet-popup-content { margin: 11px 13px; font-size: 12.5px; line-height: 1.5; }
.leaflet-popup-content .btn { margin: 8px 6px 0 0; padding: 5px 10px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--quiet); }
.leaflet-tooltip { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.leaflet-tooltip::before { display: none; }
.pin { width: 22px; height: 22px; border-radius: 50% 50% 50% 2px; transform: rotate(-45deg); border: 2px solid #0c0e12; box-shadow: 0 2px 8px rgba(0, 0, 0, .6); background: var(--ok); }
.pin.b { background: var(--bad); }
.site { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: #0c0e12; border: 2px solid var(--accent); color: var(--accent); font-size: 12px; font-weight: 800; box-shadow: 0 2px 8px rgba(0, 0, 0, .6); }
.site.depot { border-color: var(--science); color: var(--science); } .site.rover { border-color: #fff; color: #fff; border-radius: 50%; }
.scale { position: fixed; left: calc(var(--sheet-w) + 28px); bottom: 18px; z-index: 999; color: var(--ink); font-size: 11px; text-shadow: 0 1px 3px #000; pointer-events: none; }
body.sheet-closed .scale { left: 18px; }
.scale i { display: block; height: 5px; border: 2px solid var(--ink); border-top: 0; margin-top: 2px; box-shadow: 0 1px 2px rgba(0, 0, 0, .6); }

/* ---- small screens: the sheet becomes a bottom drawer ---- */
@media (max-width: 760px) {
  :root { --sheet-w: calc(100vw - 24px); }
  #sheet { top: auto; height: 46vh; bottom: 0; left: 0; width: 100vw; border-radius: 18px 18px 0 0; }
  body.sheet-closed #sheet { transform: translateY(110%); }
  #chips { top: 118px; left: var(--gap); right: var(--gap); max-width: none; justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; }
  #timebar { left: var(--gap); right: var(--gap); width: auto; transform: none !important; bottom: calc(46vh + 8px); }
  body.sheet-closed #timebar { bottom: var(--gap); }
  #tbDate, #readout, .scale { display: none; }
  .chip b { font-size: 13px; } .chip { padding: 5px 9px; }
  #mapctl { bottom: calc(46vh + 70px); } body.sheet-closed #mapctl { bottom: 76px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ------------------------------------------------ rover panoramas on the map */
.ph-pin { width: 44px; height: 44px; border-radius: 50%; padding: 2px; background: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.55); position: relative; cursor: pointer; transition: transform .15s ease; }
.ph-pin::after { content: ''; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%); border: 6px solid transparent; border-top: 7px solid #fff; border-bottom: 0; }
.ph-pin img { width: 40px !important; height: 40px !important; max-width: none; border-radius: 50%; object-fit: cover; display: block; }
.ph-pin:hover { transform: translateY(-2px) scale(1.08); }
.ph-pin.unv { background: #cfd3da; }
.ph-card .leaflet-popup-content-wrapper { background: var(--surface-2); color: var(--ink); border-radius: 16px; padding: 0; overflow: hidden; box-shadow: var(--shadow); }
.ph-card .leaflet-popup-content { margin: 0; width: 280px !important; }
.ph-card .leaflet-popup-tip { background: var(--surface-2); }
.ph-card-in img { width: 100%; aspect-ratio: 2 / 1; object-fit: cover; display: block; }
.ph-body { padding: 12px 14px 14px; display: grid; gap: 6px; }
.ph-body b { font-size: 15px; } .ph-body p { margin: 0; color: var(--quiet); font-size: 12.5px; line-height: 1.45; }
.ph-body .tag.warn { color: var(--warn); }
.ph-act { display: flex; gap: 8px; margin-top: 4px; } .ph-act .btn { flex: 1; background: var(--accent); color: var(--accent-ink); border: 0; font-weight: 600; padding: 9px 12px; border-radius: 10px; cursor: pointer; }

/* ------------------------------------------------ immersive 3D view */
#v3d { position: fixed; inset: 0; z-index: 2000; background: #120d0a; overflow: hidden; font-size: 13px; color: var(--ink); }
#v3d[hidden] { display: none; }
.im-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#v3d[data-mode="ground"] .im-canvas { cursor: grab; } .im-canvas.grab { cursor: grabbing !important; }
.im-card { background: rgba(18, 15, 13, .72); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3); border: 1px solid rgba(255,255,255,.08); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.im-fade { position: absolute; inset: 0; background: #120d0a; opacity: 1; pointer-events: none; }
.im-top { position: absolute; top: 14px; left: 14px; display: flex; gap: 10px; align-items: flex-start; max-width: min(520px, calc(100vw - 120px)); }
.im-back { display: flex; align-items: center; gap: 4px; height: 40px; padding: 0 14px 0 8px; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; flex: none; }
.im-back svg { width: 20px; height: 20px; }
.im-title { padding: 10px 14px; display: grid; gap: 4px; }
.im-title b { font-size: 16px; letter-spacing: -.01em; } .im-title span { color: var(--quiet); font-size: 12px; }
.im-title p { margin: 2px 0; color: #d9d4ce; line-height: 1.45; } .im-title small { color: var(--faint); font-size: 11px; }
.im-badge { justify-self: start; font-size: 11.5px !important; padding: 3px 8px; border-radius: 999px; }
.im-badge.ok { background: rgba(95,208,138,.14); color: var(--ok) !important; } .im-badge.warn { background: rgba(242,193,78,.14); color: var(--warn) !important; }
.im-right { position: absolute; top: 14px; right: 14px; display: grid; gap: 8px; justify-items: end; }
.im-compass { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); cursor: pointer; padding: 0; position: relative; }
.im-compass svg { width: 44px; height: 44px; } .im-hdg { position: absolute; bottom: -18px; font-size: 11px; color: var(--quiet); white-space: nowrap; text-shadow: 0 1px 3px #000; }
.im-sun { margin-top: 12px; padding: 7px 11px; display: grid; text-align: right; font-size: 12px; } .im-sun small { color: var(--quiet); font-size: 10.5px; }
.im-bottom { position: absolute; left: 0; right: 0; bottom: 14px; display: grid; gap: 10px; justify-items: center; pointer-events: none; padding: 0 14px 0 200px; }
.im-bottom > * { pointer-events: auto; }
.im-seg { display: inline-flex; padding: 4px; gap: 2px; background: rgba(18,15,13,.72); backdrop-filter: blur(14px); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; }
.im-seg button { background: none; border: 0; color: var(--quiet); font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 9px; cursor: pointer; }
.im-seg button[aria-pressed="true"] { background: #fff; color: #17110d; }
.im-seg.small { margin-top: 6px; justify-self: start; } .im-seg.small button { padding: 5px 10px; font-size: 12px; }
.im-ex { display: flex; align-items: center; gap: 8px; padding: 8px 12px; color: var(--quiet); }
.im-strip { display: flex; gap: 8px; overflow-x: auto; max-width: 100%; padding: 2px 2px 4px; scrollbar-width: none; }
.im-strip::-webkit-scrollbar { display: none; }
.im-chip { flex: none; display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; background: rgba(18,15,13,.72); backdrop-filter: blur(14px); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; color: var(--ink); font: inherit; cursor: pointer; text-align: left; transition: border-color .15s, transform .15s; }
.im-chip:hover { transform: translateY(-1px); border-color: rgba(255,255,255,.25); }
.im-chip[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.im-chip img { width: 72px; height: 40px; object-fit: cover; border-radius: 8px; }
.im-chip span { display: grid; } .im-chip b { font-size: 12.5px; } .im-chip small { color: var(--quiet); font-size: 11px; }
.im-mini { position: absolute; left: 14px; bottom: 14px; width: 168px; height: 168px; padding: 0; overflow: hidden; cursor: pointer; }
#v3d[data-mode="overview"] .im-mini { cursor: default; }
.im-labels { position: absolute; inset: 0; pointer-events: none; }
.im-pin { position: absolute; left: 0; top: 0; pointer-events: auto; display: grid; justify-items: center; gap: 3px; background: none; border: 0; padding: 0; cursor: pointer; color: #fff; font: inherit; }
.im-pin img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; border: 2.5px solid #fff; box-shadow: 0 6px 18px rgba(0,0,0,.5); transition: transform .15s; }
.im-pin span { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: rgba(18,15,13,.75); white-space: nowrap; }
.im-pin:hover img { transform: scale(1.1); }
.im-pin.far img { width: 34px; height: 34px; } .im-pin.far span { font-size: 10.5px; }
.im-pin[hidden] { display: none; }
.im-flat { position: absolute; inset: 90px 12% 150px; display: grid; place-items: center; pointer-events: none; }
.im-flat[hidden] { display: none; } .im-flat img { max-width: 100%; max-height: 100%; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.6); border: 2px solid rgba(255,255,255,.8); }
.im-toast { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 10px 16px; }
.im-toast[hidden] { display: none; }
@media (max-width: 760px) {
  .im-mini { display: none; } .im-bottom { padding: 0 10px; } .im-title p { display: none; }
  .im-top { max-width: calc(100vw - 100px); } .im-compass { width: 52px; height: 52px; } .im-sun { display: none; }
}
.im-layers-btn { display: flex; align-items: center; gap: 6px; padding: 8px 12px; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.im-layers-btn svg { width: 18px; height: 18px; } .im-layers-btn[aria-expanded="true"] { background: #fff; color: #17110d; }
.im-layers { width: 270px; max-height: calc(100vh - 330px); overflow: auto; padding: 8px 12px 10px; display: grid; gap: 2px; }
.im-layers[hidden] { display: none; }
.im-layers h4 { margin: 8px 0 2px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.im-layers label { display: flex; gap: 10px; align-items: flex-start; padding: 6px 2px; cursor: pointer; }
.im-layers label span { display: grid; } .im-layers small { color: var(--quiet); font-size: 11px; }
.im-layers label.dis { opacity: .6; cursor: default; } .im-layers input { accent-color: var(--accent); margin-top: 2px; }
.im-ann { position: absolute; left: 0; top: 0; pointer-events: none; display: flex; align-items: center; gap: 6px; padding: 4px 9px 4px 5px; border-radius: 999px; background: rgba(18,15,13,.78); backdrop-filter: blur(8px); font-size: 11.5px; white-space: nowrap; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.im-ann[hidden] { display: none; } .im-ann small { color: var(--quiet); margin-left: 4px; } .im-ann:not(.im-sitelab) { padding-left: 9px; }
.im-ann.a { background: var(--accent); color: var(--accent-ink); } .im-ann.b { background: #fff; color: #17110d; }
.im-site { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: 11px; background: #fff; color: #17110d; }
.im-site.base { background: var(--accent); } .im-site.depot { background: var(--science); } .im-site.rover { background: #fff; }
.im-labels.no-photos .im-pin { display: none; }

/* place names, samples, geology (2D) */
.pn { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; pointer-events: auto; cursor: pointer; color: #f4ede4; font: 600 11px/1 system-ui, sans-serif; letter-spacing: .02em;
  text-shadow: 0 0 3px #000, 0 0 6px rgba(0,0,0,.85), 0 1px 1px #000; }
.pn.l { font-size: 13px; letter-spacing: .06em; }
.pn.xl { font-size: 16px; letter-spacing: .22em; text-transform: uppercase; font-weight: 700; color: rgba(255,240,225,.92); }
.pn.inf { font-style: italic; font-weight: 500; color: #ffd9b0; font-size: 11.5px; }
.smp { position: absolute; transform: translate(-50%, -50%); min-width: 20px; height: 20px; padding: 0 5px; display: grid; place-items: center; border-radius: 999px; background: #0c0e12;
  border: 2px solid var(--c); color: #fff; font: 700 10.5px/1 system-ui, sans-serif; white-space: nowrap; box-shadow: 0 0 0 2px rgba(0,0,0,.35), 0 2px 8px rgba(0,0,0,.6); cursor: pointer; }
.smp::after { content: ''; position: absolute; inset: -6px; border-radius: inherit; border: 1.5px solid var(--c); opacity: .35; }
.smp-card { line-height: 1.45; } .leaflet-popup-content hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.legend .lg-h { display: block; color: var(--quiet); font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; margin-top: 6px; }
.legend div[title] { cursor: help; }

/* place names, samples, geology (3D) */
.im-ann.im-name { background: none; box-shadow: none; backdrop-filter: none; padding: 0; color: #fff4ea; font-weight: 600; font-size: 12px; text-shadow: 0 0 3px #000, 0 0 8px rgba(0,0,0,.9); }
.im-ann.im-name.l { font-size: 14px; letter-spacing: .06em; }
.im-ann.im-name.xl { font-size: 18px; letter-spacing: .3em; text-transform: uppercase; }
.im-ann.im-name.inf { font-style: italic; font-weight: 500; color: #ffd9b0; }
.im-ann.im-smplab { padding-left: 4px; }
.im-smp { display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; border: 2px solid var(--c); font: 700 10px/1 system-ui; font-style: normal; color: #fff; background: #0c0e12; }
.im-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 8px; margin: 4px 0 8px; font-size: 10.5px; color: var(--quiet); }
.im-legend span { display: flex; gap: 5px; align-items: center; } .im-legend i { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.im-unit { display: flex; gap: 6px; align-items: baseline; font-size: 11.5px; margin: 4px 0; color: var(--quiet); }
.im-unit i { width: 10px; height: 10px; border-radius: 2px; flex: none; transform: translateY(1px); } .im-unit strong { color: var(--ink); font-weight: 600; }
.pn.inf { transform: translate(-50%, -26px); }            /* informal area names sit above the sample pins they are named after */
.im-pin.crowd > span { display: none; }                  /* a pin crowded by a nearer one keeps only its photo bubble */

/* phone refinements */
html, body { overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
@media (max-width: 760px) {
  #sheet { height: 42vh; height: 42dvh; padding-bottom: calc(16px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
  #timebar { bottom: calc(42vh + 8px); bottom: calc(42dvh + 8px); }
  body.sheet-closed #timebar { bottom: calc(var(--gap) + env(safe-area-inset-bottom)); }
  #mapctl { bottom: calc(42vh + 70px); bottom: calc(42dvh + 70px); right: calc(var(--gap) + env(safe-area-inset-right)); }
  body.sheet-closed #mapctl { bottom: calc(76px + env(safe-area-inset-bottom)); }
  #top { top: calc(var(--gap) + env(safe-area-inset-top)); }
  input, select, textarea { font-size: 16px; }                         /* stops iOS zooming into fields */
  .tabs button, .btn, .seg button, .opt { min-height: 40px; }
  #mapctl > .icon, .zoom .icon { width: 44px; height: 44px; }
  .pn { font-size: 10px; } .pn.l { font-size: 11.5px; } .pn.xl { font-size: 13px; letter-spacing: .12em; } .pn.inf { display: none; }
  .im-ann.im-name { font-size: 10.5px; } .im-ann.im-name.xl { font-size: 13px; letter-spacing: .15em; }
  .im-layers { width: min(270px, calc(100vw - 28px)); max-height: 46vh; }
  .leaflet-popup-content { max-width: 70vw; font-size: 13px; }
  .leaflet-control-attribution { display: none; }
}

/* Executable mission, using the existing map and panel. */
.tabs { grid-template-columns: repeat(4, 1fr); }
.mission-title { margin-top: 16px; }
[data-pane=mission] h2 { font-size: 19px; line-height: 1.3; margin: 10px 0; letter-spacing: -.02em; }
[data-pane=mission] label:not(.opt) { display: grid; gap: 6px; margin: 12px 0; color: var(--quiet); }
[data-pane=mission] textarea { width: 100%; min-height: 90px; resize: vertical; font: inherit; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 10px; }
[data-pane=mission] input[type=number] { width: 100%; }
[data-pane=mission] fieldset { border: 1px solid var(--line); border-radius: 9px; margin: 12px 0; }
[data-pane=mission] legend { color: var(--quiet); }
.mission-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mission-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.mission-primary { width: 100%; padding: 11px !important; background: var(--accent) !important; color: var(--accent-ink) !important; font-weight: 700; }
button:disabled { cursor: not-allowed; opacity: .45; }
.mission-evidence img { display: block; width: 100%; height: auto; border-radius: 7px; }
.mission-details { margin: 12px 0; padding: 10px 0; border-top: 1px solid var(--line); }
.mission-details summary { cursor: pointer; color: var(--science); }
.mission-details li { margin-bottom: 5px; }
.mission-error, .mission-storage { color: var(--warn); border-left: 2px solid var(--warn); padding: 8px; }
.mission-heading { font-size: 28px; color: var(--accent); font-variant-numeric: tabular-nums; margin: 8px 0; }
[data-pane=mission] progress { width: 100%; height: 8px; accent-color: var(--accent); }
.mission-pin { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #15181e; border: 2px solid #f0a35e; color: #f0a35e; font-weight: 800; box-shadow: 0 2px 8px #000; }
.mission-pin.rover { border-color: #5cc8d6; color: #5cc8d6; border-radius: 7px; transform: translateY(-22px); }
.mission-pin.base { border-color: #eee; color: #eee; }
.mission-alert { position: fixed; top: 100px; right: 16px; z-index: 1100; padding: 12px; border-color: var(--science); }
.mission-alert[hidden] { display: none; }
@media (max-width: 760px) { .mission-alert { top: 112px; left: 12px; right: 12px; } }
@media (prefers-reduced-motion: reduce) { #sheet { transition: none; } }
.mission-pin.dest { border-color: #f0685c; color: #fff; background: #f0685c; }
.mission-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .mission-title h2 { flex: 1; }
.mission-title [data-mission=abort] { border: 1px solid #f0685c; color: #f0685c; padding: 6px 12px; }
