/* ==========================================================================
   GeoX PalaeoCoast — Nordic Slate Design System
   Technical, Restrained, Editorial, Cinematic Dark Aesthetic
   Matching GeoX Raster Lab (Sentinel Lab)
   ========================================================================== */

:root {
  /* GeoX Nordic Slate Palette */
  --bg-void: #03060c;
  --bg-surface: #090d16;
  --bg-elevated: #0f1523;
  --bg-card: rgba(15, 21, 35, 0.88);
  --bg-card-hover: rgba(21, 28, 46, 0.94);

  --border-subtle: rgba(56, 189, 248, 0.12);
  --border-hover: rgba(56, 189, 248, 0.32);
  --border-active: #00d2ff;

  --accent-cyan: #00d2ff;
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;
  --accent-glow: rgba(0, 210, 255, 0.18);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-panel: 0 16px 36px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--border-subtle);
  --shadow-glow: 0 0 24px var(--accent-glow);

  --transition-fast: 0.18s ease;
  --transition-base: 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select {
  font: inherit;
  color: inherit;
}

select {
  color-scheme: dark;
}

option,
select option {
  background-color: #090d16 !important;
  color: #f8fafc !important;
  font-size: 12px;
}

optgroup,
select optgroup {
  background-color: #0f1523 !important;
  color: var(--accent-cyan) !important;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

/* Top Navigation Bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
  padding: 0 20px;
  background: rgba(9, 13, 22, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 1000;
  flex: none;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #0b3038, #0e4b57);
  border: 1px solid rgba(0, 210, 255, 0.35);
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  color: var(--accent-cyan);
  text-decoration: none;
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.25);
}

.brand-title {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.brand-title a {
  color: var(--text-primary);
  text-decoration: none;
}

.brand-title span {
  color: var(--accent-cyan);
}

.brand-title .brand-status {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: normal;
  white-space: nowrap;
}

.brand-badge {
  padding: 3px 8px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.topbar-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.study-area-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  flex: none;
  margin-left: 6px;
}

.region-nav {
  display: flex;
  align-items: center;
  gap: 3px;
}

.region-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.region-pill:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.region-pill.active {
  background: rgba(0, 210, 255, 0.12);
  border-color: rgba(0, 210, 255, 0.35);
  color: var(--accent-cyan);
  font-weight: 600;
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.15);
}

.region-pill small {
  color: var(--text-muted);
  font-size: 10px;
  font-family: var(--font-mono);
}

.region-pill.active small {
  color: rgba(0, 210, 255, 0.7);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

#language {
  font-family: var(--font-mono);
  font-weight: 600;
  width: 38px;
  justify-content: center;
  padding: 6px 0;
}

/* Main Workspace / Viewport */
.workspace {
  position: relative;
  width: 100vw;
  height: calc(100vh - 54px);
  overflow: hidden;
  background: var(--bg-void);
  display: block;
}

.map-shell {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#map {
  width: 100%;
  height: 100%;
  background: #06090e;
}

.leaflet-container {
  font-family: var(--font-sans);
  background: #06090e;
}

.leaflet-control-attribution {
  background: rgba(9, 13, 22, 0.8) !important;
  color: var(--text-muted) !important;
  font-size: 9px !important;
  backdrop-filter: blur(8px);
  border-radius: 4px 0 0 0;
  border-top: 1px solid var(--border-subtle);
  border-left: 1px solid var(--border-subtle);
}

.leaflet-control-attribution a {
  color: var(--accent-cyan) !important;
}

.leaflet-control-zoom {
  border: 1px solid var(--border-subtle) !important;
  box-shadow: var(--shadow-panel) !important;
  border-radius: var(--radius-sm) !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-subtle) !important;
  backdrop-filter: blur(12px);
}

.leaflet-control-zoom a:hover {
  background: var(--bg-elevated) !important;
  color: var(--accent-cyan) !important;
}

/* Floating Glass Panels */
.panel {
  position: absolute;
  z-index: 500;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-panel);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.2) transparent;
  max-height: calc(100% - 32px);
  pointer-events: auto;
}

.panel::-webkit-scrollbar {
  width: 5px;
}

.panel::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.2);
  border-radius: 3px;
}

.panel::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.4);
}

.controls {
  top: 16px;
  left: 16px;
  width: 336px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.inspector {
  top: 16px;
  right: 16px;
  width: 348px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Intro Card in Left Panel */
.intro-card {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent-cyan);
  margin: 0 0 4px;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.intro-card h1 {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text-primary);
  line-height: 1.35;
}

.intro-card p:not(.eyebrow) {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

/* Sections & Headings */
.panel section {
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
  margin: 0;
}

.section-title > span {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: rgba(0, 210, 255, 0.1);
  color: var(--accent-cyan);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.section-title h2 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  margin: 0;
}

/* Form Controls */
.panel label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
}

.panel select, .panel input[type=text], .panel input:not([type]) {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12px;
  outline: none;
  transition: all var(--transition-fast);
  width: 100%;
}

.panel select:focus, .panel input[type=text]:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.25);
}

.notice {
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid var(--accent-amber);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 11px;
  color: #fde68a;
  line-height: 1.4;
}

/* Time Slider Row */
.time-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 4px;
}

#age {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--accent-cyan);
  text-shadow: 0 0 14px rgba(0, 210, 255, 0.35);
}

.panel input[type=range] {
  accent-color: var(--accent-cyan);
  width: 100%;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  cursor: pointer;
}

.time-axis {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.primary, .calculate {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  width: 100%;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.primary {
  background: rgba(0, 210, 255, 0.12);
  border-color: rgba(0, 210, 255, 0.3);
  color: var(--accent-cyan);
}

.primary:hover {
  background: rgba(0, 210, 255, 0.22);
  border-color: var(--accent-cyan);
  box-shadow: var(--shadow-glow);
}

/* Segmented Buttons */
.segmented {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.segmented button {
  flex: 1;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 4px;
  text-align: center;
  cursor: pointer;
  border: 0;
  background: transparent;
  transition: all var(--transition-fast);
}

.segmented button:hover {
  color: var(--text-primary);
}

.segmented button.active {
  background: rgba(0, 210, 255, 0.14);
  color: var(--accent-cyan);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.segmented button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.comparison-help {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 4px 0 0;
}

.comparison-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 4px;
}

.comparison-stats article {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.comparison-stats small {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
}

.comparison-stats b {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
  margin-top: 3px;
  display: block;
}

#deltaStats {
  grid-column: 1 / -1;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--accent-cyan);
  margin: 2px 0 0;
  background: rgba(0, 210, 255, 0.06);
  padding: 6px 8px;
  border-radius: 4px;
}

/* Process Layers */
.process-time-note {
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.layer-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.layer-row {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 8px;
  align-items: start;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  transition: all var(--transition-fast);
}

.layer-row:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-hover);
}

.layer-row:has(input:checked) {
  border-color: rgba(0, 210, 255, 0.35);
  background: rgba(0, 210, 255, 0.04);
}

.layer-row > input[type=checkbox] {
  accent-color: var(--accent-cyan);
  margin-top: 3px;
  cursor: pointer;
}

.layer-copy {
  min-width: 0;
}

.layer-copy label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}

.layer-copy small {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.35;
}

.opacity-control {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.opacity-control input[type=range] {
  flex: 1;
  accent-color: var(--accent-cyan);
  height: 4px;
}

.layer-row.is-empty {
  opacity: 0.45;
}

.layer-swatch {
  width: 14px;
  height: 8px;
  border-radius: 4px;
  flex: none;
}

.layer-swatch.paleo_elevation {
  background: linear-gradient(90deg, #10384b, #4f93a0, #d9c89e, #8da672, #e8e3d8);
}

.layer-swatch.terrain_change {
  background: linear-gradient(90deg, #4a63a8, #f3efe1, #cb5b3e);
}

.layer-swatch.coastline {
  background: #f5c34c;
}

.layer-swatch.sensitivity {
  background: #ee7c3f;
}

.layer-swatch.basins {
  background: #9d7bb3;
  border: 1px solid #725982;
}

.layer-swatch.ice_extent {
  background: #dff2f7;
  border: 1px solid #79adbf;
}

.layer-swatch.palaeodrainage {
  background: #3aa6b7;
}

.layer-swatch.relative_height_anomaly {
  background: linear-gradient(90deg, #344b89, #f3efe1, #8f382e);
}

.layer-swatch.erosion {
  background: #c9573b;
}

.layer-swatch.deposition {
  background: #398b72;
}

.layer-glyphs {
  display: inline-flex;
  gap: 2px;
  font-weight: 900;
}

.layer-glyphs i {
  font-style: normal;
  line-height: 1;
}

.layer-glyphs i:first-child {
  color: #df8b74;
}

.layer-glyphs i:last-child {
  color: #8499c7;
}

.motion-display {
  width: 100%;
  margin-top: 6px;
  padding: 5px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 10.5px;
}

/* Right Panel: Cell Analysis */
.empty-cell {
  text-align: center;
  color: var(--text-muted);
  padding: 20px 8px;
}

.crosshair {
  font-size: 32px;
  color: var(--accent-cyan);
  text-shadow: 0 0 16px rgba(0, 210, 255, 0.4);
  margin-bottom: 6px;
}

.empty-cell p {
  font-size: 11px;
  line-height: 1.45;
}

.cell-coordinates {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-cyan);
  margin-bottom: 6px;
}

.equation {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 11px;
}

.equation > div {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.08);
  color: var(--text-secondary);
}

.equation .total {
  background: rgba(0, 210, 255, 0.12);
  color: var(--accent-cyan);
  font-weight: 700;
  border-top: 1px solid rgba(0, 210, 255, 0.35);
  border-bottom: 0;
}

.cell-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}

.cell-metrics div {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px;
}

.cell-metrics dt {
  font-size: 9.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cell-metrics dd {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 3px;
}

/* Legend */
.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
  margin: 6px 0;
}

.swatch {
  width: 20px;
  height: 10px;
  border-radius: 2px;
  flex: none;
}

.gradient {
  height: 10px;
  border-radius: 3px;
  margin: 6px 0;
  border: 1px solid var(--border-subtle);
}

.legend-scale {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.legend-note {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 6px;
}

/* Quality & Resolution */
.quality-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quality-list div {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.quality-list dt {
  color: var(--text-muted);
}

.quality-list dd {
  color: var(--text-primary);
  font-family: var(--font-mono);
  margin: 0;
}

.warning {
  font-size: 10.5px;
  line-height: 1.4;
  border-left: 3px solid var(--accent-amber);
  padding: 8px 10px;
  background: rgba(245, 158, 11, 0.08);
  color: #fde68a;
  border-radius: var(--radius-sm);
  margin-top: 6px;
}

/* Floating Toolbar on the Map */
.map-toolbar {
  position: absolute;
  z-index: 500;
  top: 16px;
  left: 366px;
  pointer-events: auto;
}

.map-toolbar form {
  position: relative;
  display: flex;
  height: 38px;
  border-radius: var(--radius-sm);
  overflow: visible;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-panel);
}

.map-toolbar input {
  width: 230px;
  padding: 0 12px 0 32px;
  background: transparent;
  border: 0;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
}

.map-toolbar input::placeholder {
  color: var(--text-muted);
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-cyan);
  font-size: 15px;
  pointer-events: none;
}

.map-toolbar form > button[type=submit] {
  width: 36px;
  min-width: 36px;
  border: 0;
  background: rgba(0, 210, 255, 0.12);
  color: var(--accent-cyan);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-toolbar form > button[type=submit]:hover {
  background: rgba(0, 210, 255, 0.25);
}

.search-results {
  position: absolute;
  top: 44px;
  left: 0;
  width: min(340px, calc(100vw - 32px));
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-panel);
  padding: 4px;
  z-index: 600;
}

.search-results[hidden] {
  display: none !important;
}

.map-toolbar form .search-results button {
  display: block;
  width: 100% !important;
  min-width: 100%;
  height: auto;
  padding: 8px 10px;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.map-toolbar form .search-results button:hover,
.map-toolbar form .search-results button:focus-visible {
  background: rgba(0, 210, 255, 0.12);
}

.search-results strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-cyan);
}

.search-results small {
  display: block;
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-attribution {
  display: block;
  color: var(--text-muted);
  font-size: 9px;
  padding: 6px 10px;
  text-decoration: none;
  border-top: 1px solid var(--border-subtle);
}

/* Badges on Bottom Left */
.map-badges {
  position: absolute;
  left: 366px;
  bottom: 16px;
  z-index: 500;
  display: flex;
  gap: 6px;
  pointer-events: none;
}

.map-badges span {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-secondary);
  box-shadow: var(--shadow-panel);
}

/* North Orientation Compass */
.orientation {
  position: absolute;
  right: 380px;
  top: 16px;
  z-index: 500;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-panel);
  display: grid;
  place-items: center;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.orientation i {
  position: absolute;
  top: 2px;
  border: 4px solid transparent;
  border-bottom: 10px solid var(--accent-rose);
}

/* Dialog (Method / Sources) */
dialog {
  max-width: 720px;
  width: calc(100% - 32px);
  max-height: 85vh;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

dialog::backdrop {
  background: rgba(3, 6, 12, 0.85);
  backdrop-filter: blur(8px);
}

.dialog-close {
  position: absolute;
  right: 16px;
  top: 14px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.dialog-close:hover {
  color: var(--text-primary);
}

.data-status {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
}

.data-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.data-card b {
  font-size: 12px;
  color: var(--text-primary);
  display: block;
}

.data-card span {
  font-size: 10px;
  color: var(--accent-cyan);
  margin: 3px 0;
  display: block;
  font-family: var(--font-mono);
}

.data-card p {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

/* Motion symbols and leaflet markers */
.motion-marker {
  background: transparent;
  border: 0;
}

.motion-symbol {
  display: grid;
  place-items: center;
  width: var(--symbol-size);
  height: var(--symbol-size);
  color: var(--motion-color);
  font-size: calc(var(--symbol-size) * 1.08);
  font-weight: 900;
  line-height: 0.8;
  text-shadow: 0 0 4px #000, 0 1px 3px rgba(0, 210, 255, 0.6);
  cursor: pointer;
}

.uplift.level-low { --motion-color: #df8b74; }
.uplift.level-medium { --motion-color: #f59e0b; }
.uplift.level-high { --motion-color: #f43f5e; }
.subsidence.level-low { --motion-color: #38bdf8; }
.subsidence.level-medium { --motion-color: #00d2ff; }
.subsidence.level-high { --motion-color: #3b82f6; }

.leaflet-popup-content-wrapper {
  background: rgba(9, 13, 22, 0.95) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-subtle) !important;
  box-shadow: var(--shadow-panel) !important;
  border-radius: var(--radius-sm) !important;
  backdrop-filter: blur(12px);
}

.leaflet-popup-tip {
  background: rgba(9, 13, 22, 0.95) !important;
  border: 1px solid var(--border-subtle) !important;
}

.leaflet-tooltip {
  background: rgba(9, 13, 22, 0.92) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-sm) !important;
  font-family: var(--font-mono) !important;
  box-shadow: var(--shadow-panel) !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* Mobile & Responsive */
.mobile-scenario-control, .mobile-time-dock, .mobile-actions, .mobile-sheet, .mobile-sheet-backdrop {
  display: none;
}

.mobile-sheet[hidden], .mobile-sheet-backdrop[hidden] {
  display: none !important;
}

@media (max-width: 1100px) {
  .brand-status { display: none; }
  .controls { width: 300px; }
  .inspector { width: 310px; }
  .map-toolbar { left: 330px; }
  .map-badges { left: 330px; }
  .orientation { right: 340px; }
}

@media (max-width: 900px) {
  body.mobile-sheet-open {
    overflow: hidden;
  }

  .topbar {
    padding: 0 10px;
    height: 48px;
    gap: 8px;
  }
  .brand-badge { display: none; }
  .brand-title span { display: none; }
  .region-pill small { display: none; }
  .region-pill { padding: 4px 8px; font-size: 11px; }
  .topbar-actions .btn span { display: none; }
  .topbar-actions .btn { padding: 6px 8px; }

  .workspace {
    position: relative;
    width: 100vw;
    height: calc(100vh - 48px);
    height: calc(100dvh - 48px);
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: block;
  }

  .map-shell {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }

  .controls { display: none !important; }
  .inspector { display: none !important; }

  .map-toolbar {
    left: 10px;
    right: 56px;
    top: 10px;
  }
  .map-toolbar form {
    width: 100%;
  }
  .map-toolbar input {
    width: 100%;
    min-width: 0;
  }

  .orientation {
    right: 10px;
    top: 10px;
  }

  /* Mobile Top Scenario Bar */
  .mobile-scenario-control {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    position: absolute;
    z-index: 500;
    top: 56px;
    left: 10px;
    right: 10px;
    padding: 6px 10px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-panel);
  }
  .mobile-scenario-control label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
  }
  .mobile-scenario-control select {
    min-width: 0;
    width: 100%;
    height: 28px;
    border: 0;
    background: transparent;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    outline: 0;
    padding: 0 4px;
  }

  /* Mobile Bottom Time Dock */
  .mobile-time-dock {
    display: block;
    position: fixed;
    z-index: 700;
    left: 10px;
    right: 10px;
    bottom: calc(58px + env(safe-area-inset-bottom, 0px));
    padding: 8px 12px 6px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-panel);
    color: var(--text-primary);
  }
  .mobile-time-head {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 8px;
  }
  .mobile-time-head > span:first-child {
    font-size: 9.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  .mobile-time-head output {
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent-cyan);
  }
  .mobile-time-head button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 36px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: rgba(0, 210, 255, 0.12);
    color: var(--accent-cyan);
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
  }
  .mobile-time-dock > input[type=range] {
    width: 100%;
    height: 22px;
    margin: 2px 0 0;
    accent-color: var(--accent-cyan);
  }
  .mobile-time-dock .time-axis {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: var(--text-muted);
    font-family: var(--font-mono);
  }

  .map-badges {
    left: 10px;
    right: 64px;
    bottom: calc(146px + env(safe-area-inset-bottom, 0px));
  }
  .map-badges span {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .map-badges span:last-child {
    display: none;
  }

  .leaflet-control-zoom {
    margin-bottom: calc(146px + env(safe-area-inset-bottom, 0px)) !important;
    margin-right: 10px !important;
  }

  /* Mobile Bottom Navigation Tabs */
  .mobile-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 800;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-subtle);
    padding: 6px 8px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    gap: 6px;
  }
  .mobile-actions:has(#mobileComparisonButton[hidden]) {
    grid-template-columns: repeat(2, 1fr);
  }
  .mobile-actions button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
  }
  .mobile-actions button[hidden] {
    display: none !important;
  }
  .mobile-actions button.active {
    background: rgba(0, 210, 255, 0.14);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
  }

  /* Mobile Sheet Modal & Drawer */
  .mobile-sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(3, 6, 12, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 900;
  }
  .mobile-sheet-backdrop[hidden] {
    display: none !important;
  }

  .mobile-sheet {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: min(80vh, 650px);
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    border-radius: 18px 18px 0 0;
    z-index: 1000;
    box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.85);
    padding: 14px 16px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    animation: sheet-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .mobile-sheet[hidden] {
    display: none !important;
  }

  .mobile-sheet-handle {
    width: 38px;
    height: 4px;
    border-radius: 2px;
    background: var(--border-subtle);
    margin: 0 auto 10px;
  }

  .mobile-sheet > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 10px;
    margin-bottom: 12px;
  }
  .mobile-sheet > header h2 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-primary);
    margin: 0;
  }
  .mobile-sheet > header button {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
  }

  .mobile-sheet-content {
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .mobile-sheet-content > .in-mobile-sheet {
    display: block !important;
    margin: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
  }
}

@keyframes sheet-in {
  from {
    transform: translateY(24px);
    opacity: 0.4;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
