html, body { height: 100%; margin: 0; }

/* deck.gl tooltip overlay */
.deckgl-tooltip {
  display: none;
  position: absolute;
  z-index: 10;
  pointer-events: none;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.4;
  max-width: 320px;
  background-color: rgba(0, 0, 0, 0.8);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transform: translate(10px, 10px);
}

/* ===================================================================
   Dark mode (v1.13.0): .deckgl-dark on the map div, set by the runtime
   when <html data-bs-theme="dark"> or set_dark_mode(). deck.gl's widgets
   read these custom properties from their container; the legend below
   gets its own dark colours.
   =================================================================== */
.deckgl-map.deckgl-dark .deck-widget-container {
  --button-background: rgba(24, 26, 30, 0.9);
  --button-stroke: rgba(255, 255, 255, 0.12);
  --button-inner-stroke: rgba(255, 255, 255, 0.05);
  --button-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.35);
  --button-icon-idle: rgba(230, 232, 236, 0.85);
  --button-icon-hover: #fff;
  --button-text: #e6e8ec;
  --menu-background: rgba(24, 26, 30, 0.95);
  --menu-border: rgba(255, 255, 255, 0.12);
  --menu-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.35);
  --menu-text: #e6e8ec;
  --menu-item-hover: rgba(255, 255, 255, 0.08);
  --range-track-color: rgba(255, 255, 255, 0.25);
  --range-thumb-color: #e6e8ec;
  --icon-compass-north-color: #ff6b6b;
  --icon-compass-south-color: #9aa0a6;
}
.deckgl-map.deckgl-dark .deck-legend-ctrl {
  background: #1a1c20;
  color: #e6e8ec;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12);
}
.deckgl-map.deckgl-dark .deck-legend-header { background: #24272c; }
.deckgl-map.deckgl-dark .deck-legend-header:hover { background: #2c3036; }
.deckgl-map.deckgl-dark .deck-legend-row:hover { background: rgba(255, 255, 255, 0.06); }

/* ===================================================================
   Layer legend widget (layer_legend_widget / _DeckLayerLegendWidget)
   =================================================================== */
.deck-legend-ctrl {
  /* MapLibreOverlay mounts deck.gl's widget container inside MapLibre's
     control corner, which MapLibre styles `pointer-events: none` (its own
     controls and deck.gl's widgets opt back in). Without this the legend's
     checkboxes are unclickable: every click falls through to the canvas. */
  pointer-events: auto;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 0 0 2px rgba(0,0,0,.1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 12px;
  color: #333;
  min-width: 140px;
  max-width: 260px;
  overflow: hidden;
}

.deck-legend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6px 10px;
  margin: 0;
  border: none;
  background: #f0f0f0;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  color: #333;
  line-height: 1.4;
}
.deck-legend-header:hover { background: #e4e4e4; }

.deck-legend-arrow {
  font-size: 10px;
  margin-left: 6px;
}

.deck-legend-body {
  padding: 4px 0;
}

.deck-legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  cursor: default;
  white-space: nowrap;
}
.deck-legend-row:hover {
  background: #f7f7f7;
}

.deck-legend-cb {
  margin: 0;
  flex-shrink: 0;
  cursor: pointer;
}

/* ---------- swatch base ---------- */
.deck-legend-swatch {
  display: inline-block;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,.15);
}

/* circle (default for ScatterplotLayer) */
.deck-legend-sh-circle {
  width: 12px; height: 12px;
  border-radius: 50%;
}

/* rectangle (GeoJsonLayer fill / ColumnLayer) */
.deck-legend-sh-rect {
  width: 16px; height: 12px;
  border-radius: 2px;
}

/* line (PathLayer / LineLayer) */
.deck-legend-sh-line {
  width: 20px; height: 3px;
  border-radius: 1px;
  border: none;
}

/* arc (ArcLayer — gradient swatch) */
.deck-legend-sh-arc {
  width: 24px; height: 4px;
  border-radius: 2px;
  border: none;
}

/* gradient (HeatmapLayer / HexagonLayer colorRange) */
.deck-legend-sh-gradient {
  width: 40px; height: 10px;
  border-radius: 2px;
}

.deck-legend-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

