/* Layout: one-screen map app. Top bar, a survey-line panel on the left (a bottom drawer on phones), map fills the rest.
   Palette borrows from a hydrographic chart: pale chart-paper ground, navy ink, and chart magenta for the selected line. */
:root {
  --paper: #eef3f5;
  --surface: #ffffff;
  --ink: #0f2533;
  --muted: #566b78;
  --rule: #d3dee4;
  --accent: #a8246f;
  --accent-ink: #ffffff;
  --accent-soft: #f6e4ee;
  --track: #1d4a63;
  --shadow: 0 1px 2px rgba(15, 37, 51, 0.08), 0 6px 18px rgba(15, 37, 51, 0.10);
  --stage: #e3ebef;
  --stage-grid: #9fb3bf;
  --water: #6fa8c7;
  --font-display: "Barlow Semi Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-data: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --panel-width: 22rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0b1620;
    --surface: #102230;
    --ink: #e3edf2;
    --muted: #8ba2b0;
    --rule: #213848;
    --accent: #f26bb6;
    --accent-ink: #1a0712;
    --accent-soft: #3a1830;
    --track: #9cc6dc;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 22px rgba(0, 0, 0, 0.35);
    --stage: #18303f;
    --stage-grid: #3d5a6b;
    --water: #7fb6d6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0b1620;
  --surface: #102230;
  --ink: #e3edf2;
  --muted: #8ba2b0;
  --rule: #213848;
  --accent: #f26bb6;
  --accent-ink: #1a0712;
  --accent-soft: #3a1830;
  --track: #9cc6dc;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 22px rgba(0, 0, 0, 0.35);
  --stage: #18303f;
  --stage-grid: #3d5a6b;
  --water: #7fb6d6;
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* Elements with the hidden attribute stay hidden even when a rule below gives them display: flex */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.45 var(--font-body);
}
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.eyebrow {
  font: 600 0.75rem/1.2 var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.note { color: var(--muted); font-size: 0.85rem; margin: 0; }
.data { font-family: var(--font-data); font-variant-numeric: tabular-nums; }

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-block: 0.7rem;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  position: relative;
  z-index: 1100;
}
.brand { min-width: 0; }
.brand h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: 0.01em; line-height: 1.15; }
.summary { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.85rem; }
.summary .data { color: var(--ink); font-size: 0.8rem; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.25rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 0.85rem/1 var(--font-display);
  letter-spacing: 0.03em;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { filter: brightness(1.08); }
.button.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.button.ghost:hover { border-color: var(--ink); filter: none; }
.panel-toggle { display: none; }

/* App body */
.app { flex: 1; display: flex; min-height: 0; position: relative; }
.panel {
  width: var(--panel-width);
  flex: 0 0 var(--panel-width);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: hidden;
  padding-block: 1rem 0;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: 16px;
  background: var(--paper);
  border-right: 1px solid var(--rule);
}
.map-wrap { flex: 1; position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: var(--paper); }

/* Selected line detail */
.detail {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--accent);
  border-radius: 4px;
  padding: 0.85rem 0.9rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  flex: none;
  max-height: 46%;
  overflow-y: auto;
}
/* Only the list scrolls; the line details, filters and list tools above it stay in place. */
.list-scroll {
  flex: 1 1 auto;
  min-height: 6rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-inline: -6px;
  padding: 0 6px 1.25rem;
}
.list-head, .list-tools { flex: none; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.detail-head h2 { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.detail-head .note { margin-top: 0.25rem; }
.close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  padding: 0.2rem 0.35rem;
  cursor: pointer;
  border-radius: 3px;
}
.close:hover { color: var(--ink); background: var(--paper); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; margin: 0; }
.stats div { min-width: 0; }
.stats dt { font: 600 0.68rem/1.2 var(--font-display); letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.stats dd { margin: 0.15rem 0 0; font: 500 0.95rem/1.2 var(--font-data); font-variant-numeric: tabular-nums; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.75rem; margin: 0; font-size: 0.85rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.downloads { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.downloads .button { font-size: 0.8rem; min-height: 2rem; }

/* Line list */
.list-head { display: flex; flex-direction: column; gap: 0.4rem; }
#line-filter {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
}
.line-list { display: flex; flex-direction: column; gap: 0.9rem; }
.location-filter {
  width: 100%;
  padding: 0.45rem 1.9rem 0.45rem 0.65rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--ink);
  font: 600 0.9rem/1.2 var(--font-body);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23889' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 0.65rem center;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.location-filter:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.list-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: -0.4rem;
  padding: 0.35rem 0.4rem;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--rule);
}
.check-all { display: inline-flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.list-tools input, .set-check { width: 1rem; height: 1rem; margin: 0; accent-color: var(--accent); cursor: pointer; flex: none; }
.list-tools-actions { display: inline-flex; gap: 0.6rem; }
.text-button {
  border: 0;
  background: none;
  padding: 0.2rem 0;
  color: var(--muted);
  font: 600 0.72rem/1 var(--font-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
}
.text-button:hover { color: var(--accent); }
.collapse {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 1.3rem;
  height: 1.3rem;
  margin: 0 -0.35rem 0 -0.2rem;
  padding: 0;
  border-radius: 3px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.collapse:hover { background: var(--surface); }
.collapse:hover .chev { color: var(--ink); }
.zoom-to {
  display: flex;
  min-width: 0;
  flex: 1;
  padding: 0.1rem 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.zoom-to.location-title { align-items: center; gap: 0.5rem; }
.zoom-to.group-title { flex-direction: column; overflow: hidden; }
.zoom-to.group-title > * { max-width: 100%; }
.zoom-to:hover h3, .zoom-to:hover .location-name { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.zoom-to:focus-visible, .collapse:focus-visible, .text-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.chev { width: 0.7rem; height: 0.7rem; flex: none; color: var(--muted); transform: rotate(90deg); transition: transform 0.12s ease; }
.collapse[aria-expanded="false"] .chev { transform: none; }
.location { display: flex; flex-direction: column; gap: 0.6rem; }
.location-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.4rem;
}
.location-name { font: 700 0.85rem/1.2 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.location-count { margin-left: auto; font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.location-head .chev { color: var(--accent); }
.location-body { display: flex; flex-direction: column; gap: 0.9rem; }
.group { display: flex; flex-direction: column; gap: 0.15rem; }
.group-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.4rem 0.3rem;
  border-bottom: 1px solid var(--rule);
}
.group-head h3 { font-size: 1rem; font-weight: 600; }
.group-head .note { font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
}
.line-row:hover { background: var(--surface); }
.line-row.selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.line-row input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--accent); cursor: pointer; }
.line-main { min-width: 0; }
.line-name { font: 600 1rem/1.15 var(--font-display); letter-spacing: 0.02em; }
.line-sub { font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line-depth { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; }
.line-depth .data { font-size: 0.75rem; color: var(--muted); }
.depth-bar { width: 3.25rem; height: 6px; border-radius: 3px; background: var(--rule); position: relative; overflow: hidden; }
.depth-bar span { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.line-row.hidden-line .line-main, .line-row.hidden-line .line-depth { opacity: 0.45; }

/* About */
.about { margin-top: auto; padding-top: 0.9rem; border-top: 1px solid var(--rule); font-size: 0.85rem; }
.about > * + * { margin-top: 0.5rem; }
.about summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 0.35rem; }
.about summary::-webkit-details-marker { display: none; }
.about summary::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.12s ease;
}
.about[open] summary::before { transform: rotate(45deg); }
.about p { margin: 0; max-width: 65ch; }
.refs { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.75rem; margin: 0; }
.refs dt { color: var(--muted); }
.refs dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Map overlays */
.legend {
  position: absolute;
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  z-index: 800;
  width: 15.5rem;
  max-width: calc(100% - 24px);
  padding: 0.6rem 0.75rem 0.55rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: var(--shadow);
}
.legend-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.3rem; }
.legend-title { font: 600 0.75rem/1.2 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.legend-unit { font: 400 0.72rem/1 var(--font-data); color: var(--muted); }
.legend-select {
  display: block;
  width: 100%;
  margin-bottom: 0.45rem;
  padding: 0.3rem 1.8rem 0.3rem 0.5rem;
  font: 600 0.9rem/1.2 var(--font-body);
  color: var(--ink);
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23889' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 0.55rem center;
  border: 1px solid var(--rule);
  border-radius: 3px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.legend-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.legend-select:disabled { cursor: default; background-image: none; }
.probe-label { font: 600 0.68rem/1.2 var(--font-display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.probe-depth { font: 400 0.8rem/1.3 var(--font-data); color: var(--muted); }
#legend-ramp { display: block; width: 100%; height: 12px; border-radius: 2px; }
.legend-ticks { display: flex; justify-content: space-between; margin-top: 0.25rem; font: 400 0.72rem/1 var(--font-data); font-variant-numeric: tabular-nums; }
.legend-note { margin-top: 0.35rem; font-size: 0.75rem; color: var(--ink); }
.scale-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.45rem; flex-wrap: wrap; }
.scale-mode { display: inline-flex; border: 1px solid var(--rule); border-radius: 3px; overflow: hidden; }
.scale-mode button {
  border: 0;
  padding: 0.2rem 0.5rem;
  font: 600 0.72rem/1.2 var(--font-body);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.scale-mode button + button { border-left: 1px solid var(--rule); }
.scale-mode button[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); }
.scale-mode button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.scale-note { font-size: 0.7rem; color: var(--muted); line-height: 1.25; flex: 1; min-width: 6rem; }

/* Location markers shown when the surveys are too small to see at the current zoom */
.site-marker { background: none; border: 0; }
.site-pin {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-13px, -50%);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 3px 10px 3px 4px;
  white-space: nowrap;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 999px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.site-dot {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1.5px var(--accent);
}
.site-text { display: flex; flex-direction: column; line-height: 1.15; }
.site-text b { font: 600 0.85rem/1.15 var(--font-display); letter-spacing: 0.01em; }
.site-text small { font-size: 0.7rem; color: var(--muted); }
.site-marker:hover .site-pin, .site-marker:focus-visible .site-pin { border-color: var(--accent); }
.site-marker:focus-visible { outline: none; }
.legend-hint { margin-top: 0.4rem; font-size: 0.75rem; color: var(--muted); }
.probe {
  position: absolute;
  z-index: 900;
  pointer-events: none;
  padding: 0.45rem 0.6rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: var(--shadow);
  font-size: 0.78rem;
  line-height: 1.35;
  white-space: nowrap;
}
.probe { display: flex; flex-direction: column; gap: 0.1rem; }
.probe strong { font: 600 1.05rem/1.1 var(--font-data); font-variant-numeric: tabular-nums; }
.probe .data { color: var(--muted); font-size: 0.72rem; }
.data-ink { font-family: var(--font-data); font-variant-numeric: tabular-nums; }

/* Area selection */
.select-tools a { display: flex; align-items: center; justify-content: center; }
.select-tools svg { width: 18px; height: 18px; }
.select-tools a.active { background: var(--accent); color: var(--accent-ink); }
.leaflet-container.drawing, .leaflet-container.drawing .leaflet-interactive { cursor: crosshair !important; }
.select-bar {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 950;
  width: max-content;
  max-width: min(26rem, calc(100% - 120px));
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--accent);
  border-radius: 4px;
  box-shadow: var(--shadow);
  font-size: 0.85rem;
}
.select-bar p { margin: 0; }
.select-bar strong { font-size: 1rem; }
.select-meta { color: var(--muted); font-size: 0.8rem; }
.select-meta .data-ink { color: var(--ink); }
.select-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.15rem; }
.select-actions .button { min-height: 2rem; font-size: 0.8rem; }
.button[disabled] { opacity: 0.45; cursor: not-allowed; filter: none; }

/* Leaflet controls follow the theme */
.leaflet-container { font-family: var(--font-body); background: var(--paper); }
.leaflet-bar a, .leaflet-control-layers { background: var(--surface); color: var(--ink); border-color: var(--rule); }
.leaflet-bar a:hover { background: var(--paper); }
.leaflet-control-layers { border-radius: 4px; box-shadow: var(--shadow); }
.leaflet-control-layers-expanded { padding: 0.5rem 0.75rem; }
.leaflet-control-attribution { background: rgba(255, 255, 255, 0.8); color: #33454f; }
.leaflet-control-attribution a { color: #1d4a63; }
.leaflet-control-scale-line { background: rgba(255, 255, 255, 0.75); color: #0f2533; border-color: #0f2533; }

/* Phones and narrow windows: the panel becomes a drawer over the bottom of the map */
@media (max-width: 760px) {
  .panel-toggle { display: inline-flex; }
  .brand h1 { font-size: 1.15rem; }
  #download-all { display: none; }
  .panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    width: auto;
    max-height: 62%;
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    padding-bottom: 0;
    border-right: 0;
    border-top: 1px solid var(--rule);
    box-shadow: 0 -8px 24px rgba(15, 37, 51, 0.18);
    transform: translateY(100%);
    transition: transform 0.22s ease;
  }
  .panel.open { transform: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail { max-height: 40%; }
  .panel { height: 62%; }
  .list-scroll { padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px)); }
  .legend { width: 12rem; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
  .select-bar { left: 52px; right: 56px; transform: none; width: auto; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .panel { transition: none; }
}

/* 3D view of the interpolated bed: covers the map while it is open */
.view-tabs {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 1200; display: flex;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; box-shadow: var(--shadow); overflow: hidden;
}
.view-tabs button { border: 0; background: none; padding: 0.45rem 0.9rem; font: 600 0.85rem/1 var(--font-display); letter-spacing: 0.03em; color: var(--muted); cursor: pointer; white-space: nowrap; }
.view-tabs button + button { border-left: 1px solid var(--rule); }
.view-tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.view-tabs button:hover:not([aria-selected="true"]) { background: var(--paper); }
.view3d { position: absolute; inset: 0; z-index: 1100; background: var(--stage); }
.stage3d { position: absolute; inset: 0; }
.stage3d canvas { display: block; touch-action: none; }
.views3d { position: absolute; top: 12px; left: max(12px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; box-shadow: var(--shadow); overflow: hidden; }
.views3d button { border: 0; background: none; padding: 0.4rem 0.6rem; font: 600 0.78rem/1 var(--font-display); letter-spacing: 0.03em; cursor: pointer; text-align: left; color: var(--ink); }
.views3d button + button { border-top: 1px solid var(--rule); }
.views3d button:hover { background: var(--paper); }
.controls3d {
  position: absolute; right: max(12px, env(safe-area-inset-right, 0px)); bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  width: 17rem; max-width: calc(100% - 24px); max-height: calc(100% - 28px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; box-shadow: var(--shadow); font-size: 0.85rem;
}
.controls3d summary { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.6rem 0.8rem; cursor: pointer; list-style: none; }
.controls3d summary::-webkit-details-marker { display: none; }
.bed-title { font: 600 0.95rem/1.2 var(--font-display); }
.controls3d-body { display: flex; flex-direction: column; gap: 0.55rem; padding: 0 0.8rem 0.75rem; }
#ramp3d { display: block; width: 100%; height: 12px; border-radius: 2px; }
.controls3d .legend-ticks { margin-top: -0.3rem; }
.toggle3d { display: grid; grid-template-columns: auto 1fr auto; gap: 0.5rem; align-items: center; cursor: pointer; }
.toggle3d input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--accent); }
.toggle3d > span:nth-child(2) { display: inline-flex; align-items: center; gap: 0.4rem; }
.toggle3d .data { font-size: 0.72rem; color: var(--muted); }
.swatch3d { width: 0.8rem; height: 0.8rem; border-radius: 50%; background: #7fcdbb; flex: none; }
.swatch3d.ping { box-shadow: 0 0 0 2px var(--ink) inset; }
.slider3d { display: grid; grid-template-columns: 1fr auto; gap: 0.15rem 0.5rem; align-items: center; }
.slider3d input { grid-column: 1 / -1; width: 100%; margin: 0; accent-color: var(--accent); }
.slider3d output { font: 500 0.75rem/1 var(--font-data); }
.controls3d .button { justify-content: center; font-size: 0.8rem; min-height: 2rem; }
.caveat3d { margin: 0; font-size: 0.75rem; color: var(--muted); border-top: 1px solid var(--rule); padding-top: 0.5rem; }
.probe3d { pointer-events: none; }
.probe3d .kind { font: 600 0.68rem/1.2 var(--font-display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.probe3d .kind.measured { color: var(--accent); }
.message3d { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); max-width: 22rem; margin: 0; padding: 0.8rem 1rem; text-align: center; background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; color: var(--muted); }
.open-3d {
  flex: none; display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.25rem 0.45rem; border-radius: 3px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink); font: 600 0.72rem/1 var(--font-display); letter-spacing: 0.04em; cursor: pointer;
}
.open-3d svg { width: 13px; height: 13px; color: var(--accent); }
.open-3d:hover, .open-3d[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 760px) {
  .view-tabs { left: auto; right: 56px; transform: none; }
  .views3d { top: 56px; }
  .controls3d { width: auto; left: max(12px, env(safe-area-inset-left, 0px)); max-height: 55%; }
}
.attr3d { position: absolute; left: 0; bottom: 0; margin: 0; padding: 2px 6px; font-size: 0.7rem; color: var(--muted); background: var(--surface); opacity: 0.85; border-top-right-radius: 3px; }
.attr3d a { color: inherit; }
.map-note {
  position: absolute; top: 56px; left: 50%; transform: translateX(-50%); z-index: 1200; margin: 0;
  max-width: min(26rem, calc(100% - 24px)); padding: 0.55rem 0.8rem; text-align: center; font-size: 0.85rem;
  background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-radius: 4px; box-shadow: var(--shadow);
}
.select3d { display: flex; flex-direction: column; gap: 0.25rem; }
.select3d .legend-select { margin-bottom: 0; }

/* Disclaimer shown each time the site is opened */
.disclaimer {
  position: fixed; inset: 0; z-index: 5000; display: grid; place-items: center;
  padding: calc(16px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: rgba(8, 20, 28, 0.55);
}
.disclaimer-card {
  width: 100%; max-width: 34rem; max-height: 100%; overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.9rem; padding: 1.25rem 1.35rem 1.2rem;
  background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-top: 3px solid var(--accent); border-radius: 4px; box-shadow: var(--shadow);
}
.disclaimer-card h2 { font: 700 1.35rem/1.15 var(--font-display); text-wrap: balance; }
.disclaimer-text { display: flex; flex-direction: column; gap: 0.6rem; font-size: 0.95rem; line-height: 1.5; }
.disclaimer-text p { margin: 0; max-width: 65ch; }
.disclaimer-card .button { align-self: flex-end; min-width: 9rem; justify-content: center; cursor: pointer; }
.disclaimer-card .button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
