:root {
  --sidebar-bg-top: #2d3828;
  --sidebar-bg-bottom: #171d15;
  --sidebar-surface-strong: rgba(41, 51, 36, 0.98);
  --sidebar-surface-soft: rgba(27, 34, 24, 0.95);
  --sidebar-panel: rgba(255, 255, 255, 0.06);
  --sidebar-panel-border: rgba(175, 198, 146, 0.14);
  --sidebar-text-soft: #c9d1bc;
  --sidebar-accent: #9ab86a;
  --sidebar-accent-strong: #6f8d47;
  --sidebar-accent-cool: #d6c07a;
  --sidebar-radial-glow: rgba(154, 184, 106, 0.2);
  --sidebar-hero-gradient: linear-gradient(135deg, rgba(111, 141, 71, 0.28), rgba(214, 192, 122, 0.12) 48%, rgba(255, 255, 255, 0.04));
  --sidebar-link-hover-bg: rgba(111, 141, 71, 0.24);
  --sidebar-link-alt-bg: rgba(214, 192, 122, 0.14);
  --sidebar-link-alt-border: rgba(214, 192, 122, 0.22);
  --sidebar-button-gradient: linear-gradient(180deg, rgba(154, 184, 106, 0.16), rgba(255, 255, 255, 0.04));
  --sidebar-button-hover-gradient: linear-gradient(180deg, rgba(111, 141, 71, 0.3), rgba(214, 192, 122, 0.1));
  --sidebar-category-gradient: linear-gradient(180deg, rgba(154, 184, 106, 0.08), rgba(255, 255, 255, 0.02));
  --sidebar-category-hover-gradient: linear-gradient(180deg, rgba(111, 141, 71, 0.2), rgba(255, 255, 255, 0.045));
  --sidebar-category-expanded-gradient: linear-gradient(180deg, rgba(111, 141, 71, 0.28), rgba(214, 192, 122, 0.08));
  --sidebar-item-hover-gradient: linear-gradient(90deg, rgba(154, 184, 106, 0.14), rgba(255, 255, 255, 0.04));
  --sidebar-item-selected-gradient: linear-gradient(90deg, rgba(111, 141, 71, 0.3), rgba(214, 192, 122, 0.18) 72%, rgba(255, 255, 255, 0.05));
  --sidebar-item-selected-border: rgba(175, 198, 146, 0.28);
  --sidebar-checkbox-border: rgba(201, 209, 188, 0.44);
  --sidebar-checkbox-checked-border: #bfd59c;
  --sidebar-checkbox-checked-shadow: 0 0 0 4px rgba(111, 141, 71, 0.18), 0 6px 12px rgba(63, 79, 40, 0.28);
  --sidebar-footer-gradient: linear-gradient(180deg, rgba(29, 37, 25, 0.96), rgba(20, 26, 18, 1));
  --sidebar-count-gradient: linear-gradient(180deg, rgba(154, 184, 106, 0.12), rgba(255, 255, 255, 0.035));
  --sidebar-scrollbar-gradient: linear-gradient(180deg, rgba(111, 141, 71, 0.58), rgba(130, 116, 72, 0.82));
  --sidebar-scrollbar-hover-gradient: linear-gradient(180deg, rgba(154, 184, 106, 0.78), rgba(176, 156, 92, 0.95));
}

.legend-container {
  font: 14px 'Segoe UI', system-ui, sans-serif;
  color: #ffffff;
  overflow-y: auto;
  pointer-events: auto;
}

body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
}

.legend-hidden {
  display: none;
  visibility: hidden;
  opacity: 0;
  height: 0;
  width: 0;
  padding: 0;
  margin: 0;
  border: none;
}

.legend-container.legend-hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  background-color: transparent !important;
}


.legend-container h4 {
  text-align: center;
  font-size: 16px;
  margin: 0px 0px 15px;
  color: #fff;
}

.legend-container .legend-row {
  display: flex; /* 使用 flexbox 布局 */
}

.legend-container span {
  position: relative;
  bottom: 3px;
}

.legend-container i {
  width: 20px;
  height: 20px;
  float: left;
  margin: 0 12px 0 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.legend-container i.icon {
  background-size: 20px;
}

.leaflet-touch .leaflet-bar a{
  width: 50px;
  background-color: var(--sidebar-bg-top);
  color: #fff;
}

.leaflet-touch .leaflet-bar :hover{
  background-color: var(--sidebar-surface-soft);
  color: #fff;
}

/* 侧边栏筛选样式 */
.sidebar-filter {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background:
    radial-gradient(circle at top, var(--sidebar-radial-glow), transparent 34%),
    linear-gradient(180deg, var(--sidebar-bg-top) 0%, var(--sidebar-bg-bottom) 100%);
  border-right: 1px solid var(--sidebar-panel-border);
  box-shadow: 8px 0 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}

.sidebar-filter span {
  position: static !important;
  bottom: auto !important;
}

.sidebar-header {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--sidebar-panel-border);
  background: linear-gradient(180deg, var(--sidebar-surface-strong), var(--sidebar-surface-soft));
  backdrop-filter: blur(10px);
}

.sidebar-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 13px 14px;
  border: 1px solid var(--sidebar-panel-border);
  border-radius: 14px;
  background: var(--sidebar-hero-gradient);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
  text-align: center;
}

.sidebar-hero-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.sidebar-hero-subtitle {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--sidebar-text-soft);
}

.sidebar-hero-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 0;
}

.sidebar-hero #map-tx,
.sidebar-hero #qq-group-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--sidebar-panel-border);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.22s ease;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.sidebar-hero #map-tx:hover,
.sidebar-hero #qq-group-link:hover {
  transform: translateY(-1px);
  background: var(--sidebar-link-hover-bg);
  border-color: var(--sidebar-panel-border);
}

.sidebar-hero #qq-group-link {
  background: var(--sidebar-link-alt-bg);
  border-color: var(--sidebar-link-alt-border);
}

.sidebar-ad {
  display: block;
  overflow: hidden;
  box-sizing: border-box;
  width: 264px;
  min-width: 264px;
  max-width: 264px;
  height: 80px;
  min-height: 80px;
  max-height: 80px;
  margin: 0 auto 16px;
  border-radius: 16px;
  border: 1px solid var(--sidebar-panel-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
  flex: 0 0 264px;
}

.sidebar-ad.hidden {
  display: none;
}

.sidebar-ad-anchor {
  display: block;
  box-sizing: border-box;
  width: 264px;
  min-width: 264px;
  max-width: 264px;
  height: 80px;
  min-height: 80px;
  max-height: 80px;
  text-decoration: none;
}

.sidebar-ad-image {
  display: block;
  box-sizing: border-box;
  width: 264px;
  min-width: 264px;
  max-width: 264px;
  height: 80px;
  min-height: 80px;
  max-height: 80px;
  object-fit: cover;
  object-position: center;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-ad-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 264px;
  height: 80px;
  padding: 12px;
  text-align: center;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
  line-height: 1.7;
  border-radius: 16px;
}

.sidebar-header h3 {
  margin: 0 0 10px 0;
  font-size: 18px;
  line-height: 1.2;
  color: #fff;
  display: flex;
  align-items: center;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.header-icon {
  margin-right: 10px;
  font-size: 25px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.header-icon iconify-icon {
  width: 20px;
  height: 20px;
  color: var(--sidebar-accent);
}

.header-icon iconify-icon {
  width: 20px;
  height: 20px;
  color: var(--sidebar-accent);
}

.filter-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.marker-size-control {
  margin-top: 10px;
  padding: 10px 12px 9px;
  border: 1px solid var(--sidebar-panel-border);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(14, 24, 29, 0.2));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02), 0 8px 18px rgba(0, 0, 0, 0.14);
}

.marker-size-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  color: #f5f1eb;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

#marker-size-value {
  position: static;
  bottom: auto;
  color: var(--sidebar-accent-cool);
  font-size: 14px;
  font-weight: 800;
}

.marker-size-slider {
  width: 100%;
  appearance: none;
  height: 5px;
  border-radius: 999px;
  outline: none;
  background: linear-gradient(90deg, rgba(111, 141, 71, 0.92), rgba(214, 192, 122, 0.92));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.marker-size-slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: #f5f1eb;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
}

.marker-size-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: #f5f1eb;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
}

.marker-size-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  color: var(--sidebar-text-soft);
  font-size: 11px;
}

.sidebar-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 0;
}

.filter-btn {
  padding: 8px 10px;
  background: var(--sidebar-button-gradient);
  color: #f5f1eb;
  border: 1px solid var(--sidebar-panel-border);
  border-radius: 9px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: all 0.22s ease;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
}

.filter-btn:hover {
  transform: translateY(-1px);
  background: var(--sidebar-button-hover-gradient);
  border-color: var(--sidebar-panel-border);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.filter-btn:active {
  transform: translateY(0);
}

.category {
  margin: 8px 9px 0;
  border: 1px solid var(--sidebar-panel-border);
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(8, 17, 21, 0.22));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.category:last-child {
  margin-bottom: 8px;
}

.category-header {
  position: relative;
  padding: 8px 10px;
  min-height: 36px;
  background: var(--sidebar-category-gradient);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: all 0.22s ease;
  user-select: none;
}

.category-header:hover {
  background: var(--sidebar-category-hover-gradient);
}

.category-header.expanded {
  background: var(--sidebar-category-expanded-gradient);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.06);
}

.category-icon {
  position: relative;
  font-size: 25px;
  margin-right: 12px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 34px;
  text-align: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px var(--sidebar-panel-border);
  overflow: hidden;
}

.category-icon iconify-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
}

.category-icon.icon-infra iconify-icon {
  color: #66d1ff;
}

.category-icon.icon-commerce iconify-icon {
  color: #ffd166;
}

.category-icon.icon-resource iconify-icon {
  color: #9bff8a;
}

.category-icon.icon-spawn iconify-icon {
  color: #ff8fb1;
}

.category-icon.icon-hostile iconify-icon {
  color: #ff7b7b;
}

.category-icon.icon-vehicle iconify-icon {
  color: #8fb8ff;
}

.category-icon.icon-danger iconify-icon {
  color: #ffb347;
}

.category-name {
  flex: 1;
  position: static;
  bottom: auto;
  display: flex;
  align-items: center;
  min-height: 18px;
  line-height: 1;
  font-size: 12px;
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.category-toggle {
  position: static;
  bottom: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 18px;
  line-height: 1;
  font-size: 14px;
  color: #c6ceb7;
  transition: transform 0.22s ease, color 0.22s ease;
  width: 16px;
  text-align: center;
}

.category-header.expanded .category-toggle {
  color: #fff;
  transform: rotate(180deg);
}

.category-items {
  display: none;
  padding: 4px 5px 5px;
  background: linear-gradient(180deg, rgba(8, 17, 21, 0.3), rgba(255, 255, 255, 0.025));
}

.filter-item {
  position: relative;
  display: flex;
  align-items: center;
  padding: 5px 7px;
  min-height: 32px;
  margin: 3px 0;
  border: 1px solid var(--sidebar-panel-border);
  border-radius: 11px;
  cursor: pointer;
  transition: all 0.22s ease;
  user-select: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(14, 24, 29, 0.18));
}

.filter-item:hover {
  background: var(--sidebar-item-hover-gradient);
  border-color: var(--sidebar-panel-border);
  transform: translateX(2px);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.14);
}

.filter-item.selected {
  background: var(--sidebar-item-selected-gradient);
  border-color: var(--sidebar-item-selected-border);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.2);
}

.item-checkbox {
  width: 13px;
  height: 13px;
  border: 2px solid var(--sidebar-checkbox-border);
  border-radius: 4px;
  margin-right: 6px;
  position: relative;
  flex-shrink: 0;
  transition: all 0.22s ease;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.item-checkbox.checked {
  background: linear-gradient(180deg, var(--sidebar-accent), var(--sidebar-accent-strong));
  border-color: var(--sidebar-checkbox-checked-border);
  box-shadow: var(--sidebar-checkbox-checked-shadow);
}

.item-checkbox.checked::after {
  content: '✓';
  position: absolute;
  color: white;
  font-size: 9px;
  font-weight: bold;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.item-icon {
  width: 22px;
  height: 22px;
  margin-right: 7px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  flex-shrink: 0;
  border-radius: 0;
  box-shadow: none;
}

.item-name {
  flex: 1;
  position: static;
  bottom: auto;
  display: flex;
  align-items: center;
  min-height: 16px;
  line-height: 1.1;
  font-size: 11px;
  color: #d8e1de;
  letter-spacing: 0.15px;
  transition: color 0.22s ease, transform 0.22s ease;
}

.filter-item.selected .item-name {
  color: #fff;
  font-weight: 600;
  transform: translateX(1px);
}

.sidebar-footer {
  margin-top: auto;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--sidebar-panel-border);
  background: var(--sidebar-footer-gradient);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.selected-count {
  font-size: 12px;
  color: #c9d1bc;
  text-align: center;
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--sidebar-count-gradient);
  border: 1px solid var(--sidebar-panel-border);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02), 0 8px 18px rgba(0, 0, 0, 0.16);
}

#selected-count {
  position: static;
  bottom: auto;
  color: var(--sidebar-accent-cool);
  font-weight: 800;
  font-size: 16px;
  text-shadow: 0 0 14px rgba(214, 192, 122, 0.22);
}


/* 滚动条样式 */
.sidebar-content::-webkit-scrollbar {
  width: 8px;
}

.sidebar-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-content::-webkit-scrollbar-thumb {
  background: var(--sidebar-scrollbar-gradient);
  border-radius: 999px;
}

.sidebar-filter::-webkit-scrollbar-thumb:hover {
  background: var(--sidebar-scrollbar-hover-gradient);
}

@media (max-width: 900px) {
  .sidebar-header {
    padding: 14px;
  }

  .category {
    margin: 8px 8px 0;
  }

  .category-header {
    padding: 8px 9px;
  }

  .category-items {
    padding: 4px 4px 5px;
  }

  .filter-item {
    padding: 5px 6px;
  }

}
