:root {
  --control-edge-gap: 10px;
  --window-bg: rgba(255, 255, 255, 0.9);
  --panel-radius: 4px;
  --panel-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
  --panel-font: 12px/1.2 "Sora", sans-serif;
}

html, body, #map-layout, #map-pane-2d, #map-pane-3d, #map, #map3d {
  margin: 0;
  height: 100%;
}

body {
  font-family: "Sora", sans-serif;
}

#map-layout {
  display: flex;
  width: 100%;
}

#map-pane-2d,
#map-pane-3d {
  min-width: 0;
  position: relative;
}

#map-pane-2d {
  width: 66.6667%;
}

#map-pane-3d {
  width: 33.3333%;
}

#map-pane-3d {
  border-left: 1px solid rgba(0, 0, 0, 0.08);
}

.map3d-status {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 1200;
  background: var(--window-bg);
  box-shadow: var(--panel-shadow);
  border-radius: var(--panel-radius);
  font: var(--panel-font);
  color: #333;
  padding: 6px 8px;
  pointer-events: none;
}

.leaflet-container .leaflet-interactive:focus,
.leaflet-container a.leaflet-active,
.leaflet-container .leaflet-interactive.leaflet-active {
  outline: none;
}

.tile-layer-grayscale {
  filter: grayscale(100%);
}

.tile-layer-desaturated {
  filter: grayscale(65%) saturate(55%);
}

.tile-layer-grayscale-soft {
  filter: grayscale(100%) brightness(1.08) contrast(0.9);
}

.tile-layer-blackwhite {
  filter: grayscale(100%) contrast(1.45) brightness(1.02);
}

.tile-layer-grayscale-dark {
  filter: grayscale(100%) brightness(0.72) contrast(1.2);
}

.leaflet-top .leaflet-control {
  margin-top: var(--control-edge-gap);
}

.leaflet-bottom .leaflet-control {
  margin-bottom: var(--control-edge-gap);
}

.leaflet-left .leaflet-control {
  margin-left: var(--control-edge-gap);
}

.leaflet-right .leaflet-control {
  margin-right: var(--control-edge-gap);
}

.leaflet-control-layers {
  background: var(--window-bg);
  border-radius: var(--panel-radius);
  box-shadow: var(--panel-shadow);
  font: var(--panel-font);
  border: none;
  width: 260px;
}

.leaflet-control-zoom.leaflet-bar {
  background: var(--window-bg);
  border-radius: var(--panel-radius);
  box-shadow: var(--panel-shadow);
  border: none;
  overflow: hidden;
}

.leaflet-touch .leaflet-control-zoom.leaflet-bar {
  border: none;
  box-shadow: var(--panel-shadow);
}

.leaflet-control-zoom.leaflet-bar a {
  width: 28px;
  height: 28px;
  line-height: 28px;
  font: 600 14px/28px "Sora", sans-serif;
  color: #333;
  background: transparent;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.leaflet-control-zoom.leaflet-bar a:last-child {
  border-bottom: none;
}

.leaflet-control-zoom.leaflet-bar a:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #111;
}

.leaflet-touch .leaflet-control-layers {
  border: none;
  box-shadow: var(--panel-shadow);
}

.leaflet-control-layers-expanded {
  color: #333;
  padding: 8px 10px;
}

.leaflet-control-layers-separator {
  margin: 6px 0;
}

.leaflet-control-layers-list label {
  margin-bottom: 6px;
}

.leaflet-control-layers-list label:last-child {
  margin-bottom: 0;
}

.location-filter-inline {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.location-filter-inline__title {
  font-weight: 600;
  margin-bottom: 6px;
}

.location-filter-inline label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.presets-group button {
  font-family: "Sora", sans-serif;
}

.ui-panel {
  background: var(--window-bg);
  padding: 8px 10px;
  border-radius: var(--panel-radius);
  box-shadow: var(--panel-shadow);
  font: var(--panel-font);
  width: 260px;
}

/* make tree plots control scrollable when expanded */
.treeplot-group .control-content {
  max-height: 360px;
  overflow-y: auto;
}

.ui-panel--tight {
  padding: 6px 8px;
}

.ui-panel--wide {
  width: 340px;
}

.ui-panel--narrow {
  width: 180px;
}

.control-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  cursor: pointer;
}

.control-title {
  font-weight: bold;
}

.control-title--with-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-weight: bold;
}

.control-title--with-toggle input {
  margin: 0;
}

.control-toggle {
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.control-title--with-toggle input {
  cursor: pointer;
}

.control-content {
  display: none;
}

.control-muted {
  color: #666;
}

.control-label {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 4px;
}

.control-label--spaced {
  margin-bottom: 8px;
}

.control-section {
  margin-bottom: 10px;
}

.control-row {
  display: flex;
  gap: 8px;
}

.control-row--between {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.control-row--align {
  align-items: center;
}

.control-play {
  width: 28px;
  height: 24px;
}

.control-flex {
  flex: 1;
}

.control-subtitle {
  font-weight: bold;
  margin-bottom: 4px;
}

.control-space-8 {
  margin-bottom: 8px;
}

.control-select {
  width: 100%;
}

.control-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
  border: 1px solid rgba(0,0,0,0.12);
}

.leaflet-tooltip.protected-area-tooltip {
  font-family: "Sora", sans-serif;
}

/* Multi-select dropdown for species */
.multi-select { position: relative; }
.multi-select-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2000;
  background: var(--window-bg);
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: var(--panel-shadow);
  padding: 6px;
  margin-top: 6px;
}
.multi-select-actions { display:flex; gap:6px; margin-bottom:6px; }
.multi-select-list { max-height: 180px; overflow-y: auto; padding-right: 6px; }
.multi-select-row { display:flex; align-items:center; gap:8px; margin-bottom:6px; }
.multi-select-row .legend-swatch { width:14px; height:14px; border-radius:3px; }

.control-space-top-6 {
  margin-top: 6px;
}

.control-space-top-8 {
  margin-top: 8px;
}

.control-space-top-10 {
  margin-top: 10px;
}

.control-button {
  width: 100%;
}

.control-button--mb-6 {
  margin-bottom: 6px;
}

.ortho-inline-hint,
.radar-info-inline {
  font-size: 11px;
  color: #666;
  margin: 2px 0 0 20px;
}

.debug-toggle {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  z-index: 1000;
  margin: 0;
  width: 220px;
  max-width: 220px;
  box-sizing: border-box;
}

.leaflet-top .leaflet-control.debug-toggle {
  margin-top: var(--control-edge-gap);
}

.debug-label {
  display: flex;
  gap: 6px;
  align-items: center;
}

.debug-box {
  display: none;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 6px 8px;
  border-radius: var(--panel-radius);
  font: var(--panel-font);
  margin-top: 4px;
}

.debug-box--compact {
  padding: 6px 10px;
}

.debug-box--api {
  padding: 6px 8px;
  font: 12px/1.2 monospace;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.debug-status {
  margin-bottom: 6px;
}

.debug-track {
  width: 120px;
  height: 8px;
  background: #333;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: #4caf50;
}

.progress-text {
  margin-top: 6px;
}

.debug-title {
  font-weight: bold;
  margin-bottom: 6px;
}

.debug-list {
  max-height: 90px;
  overflow: auto;
}

.debug-list--spaced {
  margin-bottom: 6px;
}

.api-debug-content {
  max-height: 110px;
  overflow: auto;
  width: 100%;
  box-sizing: border-box;
  padding-right: 4px;
}

.api-debug-pre {
  margin: 0 0 8px 0;
  white-space: pre-wrap;
}

.coords-debug {
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 6px 8px;
  border-radius: var(--panel-radius);
  box-shadow: var(--panel-shadow);
  font: var(--panel-font);
}

.weather-widget {
  color: #000;
}

.weather-title {
  font-weight: bold;
  margin-bottom: 6px;
}

.weather-toggle {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
}

.weather-toggles {
  margin-top: 2px;
}

.photo-marker {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
}

.photo-marker__image {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
  object-fit: cover;
  display: block;
}

.cluster-photo {
  position: relative;
  width: 30px;
  height: 30px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  display: block;
}

.marker-cluster .cluster-photo {
  background: transparent;
}

.cluster-photo__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cluster-count-only {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin: 5px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
}

.cluster-count {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  color: #fff;
  font-weight: 700;
  font-family: "Sora", sans-serif;
}

.marker-cluster div,
.marker-cluster span {
  font-family: "Sora", sans-serif;
}

.popup-image {
  display: block;
  margin-top: 6px;
  max-width: 180px;
  border-radius: 4px;
}
