:root {
  color-scheme: light;
  --bg: #0f141e;
  --panel: #232c3c;
  --text: #eef2f9;
  --accent: #f5c469;
  --muted: #aab6c8;
}

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

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #0b1019;
  color: var(--text);
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  padding: 24px 28px 12px;
  background: #232c3c;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: start;
}

.site-header h1 {
  font-size: clamp(22px, 2.8vw, 30px);
  letter-spacing: 1px;
  margin-bottom: 6px;
}


.site-header p {
  color: var(--muted);
  font-size: 14px;
}

.summary {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text);
}

.summary-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.loading {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.site-footer {
  position: static;
  padding: 8px 18px;
  background: rgba(35, 44, 60, 0.9);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.site-footer a {
  color: var(--accent);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.leaflet-control-attribution {
  margin-bottom: 32px;
}

.leaflet-bottom {
  bottom: 0;
}


.data-filter {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  justify-items: start;
}

.data-filter > span {
  white-space: nowrap;
}

.data-filter select {
  background: #0b1813;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

.toggle-filter {
  align-items: start;
  width: fit-content;
}

.toggle-filter > span:first-child {
  line-height: 1.2;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  margin-top: 2px;
  justify-self: start;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  position: relative;
  transition: background 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.toggle-track::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  top: 50%;
  left: 3px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: #f7f9fc;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.toggle-switch input:checked + .toggle-track {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-track::after {
  transform: translate(20px, -50%);
}

.data-filter input {
  background: #0b1813;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 14px;
  min-width: 200px;
}

.data-filter input::placeholder {
  color: rgba(170, 182, 200, 0.7);
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.search-row button {
  background: var(--accent);
  color: #121926;
  border: none;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.search-row button:hover {
  filter: brightness(0.95);
}

.search-filter {
  min-width: 280px;
}

#source-filter select {
  max-width: 100%;
}

#source-filter {
  min-width: 280px;
}

#source-filter select {
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  align-self: end;
}

.reset-button {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

.reset-button:hover {
  border-color: rgba(255, 255, 255, 0.4);
}

.share-button {
  background: var(--accent);
  color: #121926;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.share-button:hover {
  filter: brightness(0.95);
}

#map {
  flex: 1;
  height: auto;
  width: 100%;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

main {
  flex: 1;
  display: flex;
  min-height: 0;
}


.leaflet-container {
  background: #0b111b;
}

.cluster-icon {
  background: none;
  border: none;
}

.cluster-icon__bubble {
  width: 100%;
  height: 100%;
  background: var(--cluster-color, rgba(245, 196, 105, 0.95));
  border: 2px solid rgba(18, 25, 38, 0.7);
  border-radius: 50%;
  color: #121926;
  display: grid;
  place-items: center;
  font-weight: 700;
  position: relative;
}

.cluster-icon__icon {
  position: absolute;
  inset: 16%;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.leaflet-container .cluster-icon__icon--image img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain;
}

.cluster-icon__icon--text {
  font-size: clamp(12px, 3vw, 22px);
}

.cluster-icon__count {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--count-tone, hsl(215 28% 45%));
  color: #0f141e;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.2px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.node-marker {
  background: none;
  border: none;
}

.node-marker__bubble {
  width: var(--node-size);
  height: var(--node-size);
  background: var(--node-color);
  border-radius: 50%;
  border: 2px solid rgba(18, 25, 38, 0.7);
  display: grid;
  place-items: center;
  color: #121926;
  font-weight: 700;
  font-size: clamp(10px, calc(var(--node-size) * 0.25), 14px);
  position: relative;
}

.node-marker__bubble--dot {
  width: 10px;
  height: 10px;
  border-width: 1px;
  box-shadow: none;
}

.node-marker__icon {
  position: absolute;
  inset: 14%;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.leaflet-container .node-marker__icon--image img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  display: block;
  object-fit: contain;
}

.node-marker__icon--text {
  font-size: clamp(12px, calc(var(--node-size) * 0.45), 22px);
}

.node-marker__bubble span {
  line-height: 1;
}

.node-marker__count {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--count-tone, hsl(215 28% 45%));
  color: #0f141e;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.2px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.map-tooltip {
  background: rgba(18, 25, 38, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #f7f9fc;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  min-width: 320px;
  max-width: 440px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.map-tooltip .leaflet-tooltip-tip {
  background: rgba(18, 25, 38, 0.95);
}

.tooltip__title {
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 15px;
}

.tooltip__meta {
  color: rgba(231, 241, 236, 0.78);
  font-size: 13px;
  margin-bottom: 2px;
}

.tooltip__summary {
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 13px;
  font-weight: 700;
  color: #f3f6fb;
}

.tooltip__table {
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 6px;
}

.tooltip__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  font-size: 13px;
  padding: 2px 0;
}

.tooltip__row--header {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.3px;
  color: rgba(231, 241, 236, 0.75);
  padding-bottom: 4px;
}

.tooltip__row--others {
  font-style: italic;
  color: rgba(231, 241, 236, 0.75);
  border-top: 1px dashed rgba(255, 255, 255, 0.24);
  padding-top: 6px;
  margin-top: 4px;
  font-size: 13px;
}

.tooltip__note {
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 75, 75, 0.12);
  border: 1px solid rgba(255, 75, 75, 0.35);
  color: #ff6b6b;
  font-size: 12px;
  line-height: 1.3;
}

@media (max-width: 720px) {
  #map {
    height: calc(100vh - 112px);
  }

  .site-header {
    padding: 20px 18px 10px;
  }

  .filters-row {
    flex-direction: column;
    align-items: flex-start;
  }

}

@media (max-width: 1100px) {
  .filters-row {
    grid-template-columns: 1fr;
  }
}
