@keyframes proximity-hit-pulse-keyframes {
  0% {
    transform: scale(1);
    opacity: 0.55;
  }
  45% {
    transform: scale(1.5);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.proximity-hit-pulse {
  animation: proximity-hit-pulse-keyframes 230ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes herp-soft-pulse-keyframes {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(var(--herp-pulse-max-scale, 1.11));
  }
}

.herp-soft-pulse {
  animation: herp-soft-pulse-keyframes var(--herp-pulse-duration-ms, 3200ms) ease-in-out infinite;
  animation-delay: var(--herp-pulse-delay-ms, 0ms);
  transform-origin: center center;
  will-change: transform;
}
: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: 100%;
}

#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);
}

.tile-layer-berlin-outline {
  filter: grayscale(100%) contrast(3) brightness(0.86);
}

.berlin-scale-label {
  color: #111;
  font: 700 11px/1.2 "Sora", sans-serif;
  text-shadow: 0 0 2px #fff, 0 0 4px #fff;
  white-space: nowrap;
}

.berlin-scale-image {
  filter: grayscale(100%) contrast(2.1) brightness(1.04);
}

.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;
}

.map-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.map-settings-title {
  font-weight: 700;
}

.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;
}

.reference-city-inline {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.reference-city-inline__title {
  font-weight: 600;
  margin-bottom: 6px;
}

.reference-city-inline label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.reference-city-inline label:last-child {
  margin-bottom: 0;
}

.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-load-status {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: #5f6368;
  background: rgba(95, 99, 104, 0.08);
}

.control-load-status--inline {
  margin-left: 4px;
  text-transform: none;
  font-size: 10px;
  padding: 0 5px;
}

.control-load-status[data-state="loading"] {
  color: #8a5300;
  background: rgba(255, 171, 0, 0.18);
  border-color: rgba(255, 171, 0, 0.55);
}

.control-load-status[data-state="loaded"] {
  color: #0c5f2a;
  background: rgba(52, 168, 83, 0.18);
  border-color: rgba(52, 168, 83, 0.55);
}

.control-load-status[data-state="error"] {
  color: #8f1d1d;
  background: rgba(217, 48, 37, 0.16);
  border-color: rgba(217, 48, 37, 0.55);
}

.control-load-status[data-state="off"],
.control-load-status[data-state="idle"] {
  color: #5f6368;
  background: rgba(95, 99, 104, 0.08);
  border-color: rgba(95, 99, 104, 0.32);
}

.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;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: rotate(0deg);
  transition: transform 0.18s ease;
}

.control-toggle[aria-expanded="true"] {
  transform: rotate(90deg);
}

.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-toggle--stacked {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.weather-toggle--stacked input[type="range"] {
  width: 100%;
}

.weather-toggles {
  margin-top: 2px;
}

.proximity-group .control-content .control-flex[type="range"] {
  width: 100%;
}

.photo-marker {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
}

.photo-marker--unknown {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
  background: rgba(0, 0, 0, 0.5);
}

.photo-marker__unknown {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}

.photo-marker--wildtrax {
  background: rgba(178, 28, 31, 0.92);
  border-color: #ffd7d9;
  box-shadow: 0 0 0 1px rgba(97, 11, 14, 0.6), 0 0 5px rgba(0, 0, 0, 0.45);
}

.camera-trap-marker--wildtrax .photo-marker__unknown {
  color: #fff3f3;
}

.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;
}

@keyframes camera-trap-live-flash-keyframes {
  0% {
    transform: scale(0.8);
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.95), 0 0 0 0 rgba(255, 214, 102, 0.75);
  }
  42% {
    transform: scale(1.46);
    box-shadow: 0 0 30px 14px rgba(255, 255, 255, 0.94), 0 0 42px 20px rgba(255, 214, 102, 0.78);
  }
  72% {
    transform: scale(1.12);
    box-shadow: 0 0 18px 8px rgba(255, 255, 255, 0.54), 0 0 28px 12px rgba(255, 214, 102, 0.46);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0), 0 0 0 0 rgba(255, 214, 102, 0);
  }
}

.camera-trap-live-flash {
  animation: camera-trap-live-flash-keyframes 780ms cubic-bezier(0.22, 0.8, 0.24, 1);
  will-change: transform, box-shadow;
}

.camera-trap-live-photo {
  width: 56px;
  height: 56px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2), 0 0 14px rgba(255, 255, 255, 0.55);
}

.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-photo--unknown {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
}

.cluster-photo__unknown {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
}

.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;
}

.popup-image--zoomable-wrap {
  position: relative;
  display: inline-block;
  transform-origin: center center;
  transition: transform 0.18s ease;
  z-index: 1;
}

.popup-image--zoomable-wrap:hover {
  transform: scale(1.9);
  z-index: 30;
}

.wildtrax-image-figure .popup-image {
  margin-top: 0;
}

.wildtrax-image-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.wildtrax-image-overlay rect {
  fill: rgba(255, 193, 7, 0.16);
  stroke: #ffc107;
  stroke-width: 0.7;
}

.wildtrax-popup-gallery {
  margin-top: 6px;
}

.wildtrax-popup-annotations {
  margin-top: 8px;
}

.wildtrax-annotations summary {
  cursor: pointer;
  font-weight: 600;
}

.wildtrax-annotation-toolbar {
  margin-top: 6px;
  margin-bottom: 6px;
}

.wildtrax-annotation-search {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 6px;
  padding: 4px 6px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  font: 12px/1.2 "Sora", sans-serif;
}

.wildtrax-annotation-modes {
  display: flex;
  gap: 6px;
}

.wildtrax-annotation-mode {
  width: auto;
  padding: 4px 6px;
  font: 11px/1.2 "Sora", sans-serif;
}

.wildtrax-annotation-mode.is-active {
  background: rgba(32, 33, 36, 0.14);
}

.wildtrax-annotation-list {
  margin: 6px 0 0 0;
  padding: 0;
  list-style: none;
  max-height: 160px;
  overflow-y: auto;
}

.wildtrax-annotation-item {
  padding: 4px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.wildtrax-annotation-entry {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.wildtrax-annotation-entry:hover .wildtrax-annotation-species {
  text-decoration: underline;
}

.wildtrax-annotation-item:last-child {
  border-bottom: none;
}

.wildtrax-annotation-species {
  font-weight: 600;
}

.wildtrax-annotation-time {
  font-size: 11px;
}

.wildtrax-gallery-controls {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  justify-content: center;
}

.spotted-feed-panel {
  width: 280px;
}

.spotted-feed-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.spotted-feed-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  padding: 4px 6px;
  cursor: pointer;
}

.spotted-feed-thumb {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.spotted-feed-thumb__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.spotted-feed-thumb__fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.spotted-feed-name {
  font-weight: 600;
  font-size: 12px;
  line-height: 1.2;
  color: #222;
  word-break: break-word;
}

.spotted-feed-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.spotted-feed-coords {
  font-size: 10px;
  line-height: 1.2;
  color: #666;
}

.settings-drawer-toggle {
  display: none;
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1300;
  border: none;
  border-radius: var(--panel-radius);
  box-shadow: var(--panel-shadow);
  background: var(--window-bg);
  font: var(--panel-font);
  font-weight: 600;
  color: #333;
  padding: 7px 10px;
  cursor: pointer;
}

.settings-drawer-backdrop {
  display: none;
}

@media (max-width: 1024px) {
  .settings-drawer-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .settings-drawer-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 1180;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .leaflet-top.leaflet-right {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(88vw, 336px);
    max-width: 336px;
    margin: 0;
    padding: 10px;
    box-sizing: border-box;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: -4px 0 14px rgba(0, 0, 0, 0.2);
    transform: translateX(calc(100% + 16px));
    transition: transform 0.24s ease;
    z-index: 1190;
  }

  .leaflet-right .leaflet-control {
    margin-right: 0;
  }

  body.settings-drawer-open .leaflet-top.leaflet-right {
    transform: translateX(0);
  }

  body.settings-drawer-open .settings-drawer-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
}
