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

html,
body {
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  padding: 8px 12px;
  background: #0f766e;
  color: #fff;
  text-decoration: none;
  border-radius: 0 0 6px 0;
}

.skip-link:focus {
  left: 0;
}

.seo-lead {
  font-size: 13px;
  color: #64748b;
  line-height: 1.4;
  margin: 4px 0 8px;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #e8eef4;
}

.map-loader {
  position: absolute;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e8eef4;
  color: #475569;
  font-size: 15px;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.map-loader.hidden {
  opacity: 0;
}

.panel-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.panel-toggle {
  display: none;
  position: fixed;
  bottom: max(16px, env(safe-area-inset-bottom));
  right: max(16px, env(safe-area-inset-right));
  z-index: 1001;
  padding: 12px 18px;
  border: none;
  border-radius: 999px;
  background: #1e40af;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(30, 64, 175, 0.45);
}

.panel-toggle:active {
  transform: scale(0.97);
}

.panel {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  width: min(320px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
  padding: 14px 16px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  font-size: 14px;
  line-height: 1.4;
  transition: transform 0.25s ease;
}

@media (max-width: 768px) {
  .panel-toggle {
    display: block;
  }

  .panel-backdrop {
    display: block;
  }

  body.panel-open .panel-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .panel {
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-height: min(78vh, 100dvh);
    border-radius: 14px 14px 0 0;
    transform: translateY(105%);
  }

  body.panel-open .panel {
    transform: translateY(0);
  }

  .leaflet-control-zoom {
    margin-bottom: 72px !important;
  }
}

@media (min-width: 769px) {
  .panel {
    transform: none !important;
  }
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel h1 {
  font-size: 1.15rem;
  font-weight: 700;
}

.panel-edit-link {
  font-size: 12px;
  font-weight: 600;
  color: #1e40af;
  text-decoration: none;
  white-space: nowrap;
}

.panel-edit-link:hover {
  text-decoration: underline;
}

.panel h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin: 12px 0 6px;
}

.hint {
  margin-top: 4px;
  color: #475569;
  font-size: 12px;
}

.search-section h2 {
  margin-top: 0;
}

.search-wrap {
  position: relative;
}

.search-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
}

.search-input:focus {
  outline: 2px solid #93c5fd;
  border-color: #3b82f6;
}

.search-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 1100;
  max-height: 220px;
  overflow-y: auto;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.search-suggestions.hidden {
  display: none;
}

.search-suggestions li {
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
}

.search-suggestions li:hover,
.search-suggestions li.active {
  background: #eff6ff;
}

.search-suggestions .suggest-type {
  display: block;
  font-size: 11px;
  color: #64748b;
  margin-top: 1px;
}

.search-suggestions .suggest-empty {
  color: #64748b;
  cursor: default;
}

.search-suggestions .suggest-empty:hover {
  background: transparent;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}

.toolbar button {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  background: #1e40af;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.toolbar button:hover {
  background: #1d4ed8;
}

.check {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #334155;
}

.status {
  font-size: 12px;
  color: #64748b;
}

.status.error {
  color: #b91c1c;
}

.filters label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0;
  cursor: pointer;
}

.map-style-select {
  width: 100%;
  margin-top: 2px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
}

.map-style-select:focus {
  outline: 2px solid #93c5fd;
  border-color: #3b82f6;
}

.legend-block {
  margin-bottom: 10px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 3px 0;
  font-size: 13px;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.legend-shape {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.update-info {
  font-size: 12px;
  color: #475569;
  line-height: 1.45;
}

.update-info strong {
  display: block;
  color: #1e293b;
  font-weight: 600;
  margin-bottom: 6px;
}

.update-changes {
  margin: 0;
  padding: 0 0 0 16px;
  list-style: disc;
}

.update-changes li {
  margin: 2px 0;
}

/* Markers */
.speleo-marker {
  background: transparent !important;
  border: none !important;
}

.speleo-marker .inner {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.speleo-marker.circle .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: none;
}

.speleo-marker.cross .cross {
  position: relative;
  width: 14px;
  height: 14px;
}

.speleo-marker.cross .cross::before,
.speleo-marker.cross .cross::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 14px;
  background: currentColor;
  border: none;
  box-shadow: none;
  border-radius: 1px;
}

.speleo-marker.cross .cross::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.speleo-marker.cross .cross::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.hg,
.legend-hg .hg {
  display: block;
  width: 12px;
  height: 12px;
  position: relative;
  box-sizing: border-box;
}

.hg::before,
.hg::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
}

.hg::before {
  top: 0;
  transform: translateX(-50%);
  border-top: 8px solid currentColor;
}

.hg::after {
  bottom: 0;
  transform: translateX(-50%);
  border-bottom: 8px solid currentColor;
}

.legend-hg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}

.leaflet-popup-content {
  margin: 10px 12px;
  line-height: 1.45;
  font-size: 13px;
}

.leaflet-popup-content strong {
  font-size: 14px;
}

.popup-meta {
  color: #64748b;
  margin-top: 4px;
}
