:root {
  color-scheme: dark;
  --bg: #0b1220;
  --card: #111a2b;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --stroke: #1f2937;
  --municipality: #4f46e5;
  --municipality-hover: #4338ca;
  --municipality-active: #ea580c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: radial-gradient(circle at top, #17233a 0%, var(--bg) 62%);
  color: var(--text);
}

.layout {
  min-height: 100vh;
  max-width: 940px;
  margin: 0 auto;
  padding: 16px 16px 10px;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto minmax(600px, 1fr);
  gap: 8px;
  align-content: start;
}

.header,
.map-card {
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.header,
.legend-card,
.map-card,
.map-panel {
  min-width: 500px;
}

.header {
  grid-column: 1 / -1;
  padding: 12px;
  text-align: center;
}

.header h1 {
  margin: 0 0 8px;
  font-size: 1.4rem;
}

.header p {
  margin: 0;
  color: var(--muted);
}

.map-card {
  height: 100%;
  padding: 12px;
}

.maps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  height: 100%;
  min-height: 600px;
}

.map-panel {
  background: #0f1728;
  border: 1px solid #263247;
  border-radius: 10px;
  height: 100%;
  padding: 12px;
}

.map-panel h3 {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: #cbd5e1;
}

#map-mainland {
  width: 100%;
  height: 100%;
  min-height: 600px;
  display: block;
}

#map-mainland {
  cursor: grab;
  touch-action: pan-x pan-y;
}

#map-mainland:active {
  cursor: grabbing;
}

.municipality {
  stroke: var(--stroke);
  stroke-width: 0.5;
  cursor: pointer;
  transition: fill 100ms ease, stroke-width 100ms ease;
}

.municipality:hover {
  filter: brightness(0.92);
}

.municipality.active {
  stroke: #000000;
  stroke-width: 1.3;
}

.detail-title {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #293548;
  padding-bottom: 4px;
}

.legend-card {
  grid-column: 1 / -1;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  padding: 12px;
}

.legend-card h2 {
  margin: 0 0 10px;
  font-size: 1rem;
}

#legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  border: 1px solid #334155;
}

.mix-legend {
  width: 100%;
  max-width: 940px;
}

.mix-legend-head,
.mix-legend-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
}

.mix-legend-head {
  margin-bottom: 6px;
  font-weight: 600;
}

.mix-legend-bar-wrap {
  position: relative;
}

.mix-legend-bar {
  position: relative;
  height: 16px;
  border-radius: 4px;
  border: 1px solid #334155;
}

.mix-pointer {
  position: absolute;
  top: -8px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid #0f1728;
  box-shadow: 0 0 0 1px #64748b;
  transform: translateX(-50%);
  pointer-events: none;
}

.mix-pointer::after {
  content: "";
  position: absolute;
  top: 11px;
  left: 50%;
  width: 2px;
  height: 12px;
  transform: translateX(-50%);
  background: rgba(248, 250, 252, 0.75);
}

.mix-legend-ticks {
  margin-top: 6px;
  color: #9ca3af;
}

.mix-legend-badges {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mix-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: normal;
  padding: 6px 8px;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #0f1728;
}

.mix-marker-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid #0f1728;
  box-shadow: 0 0 0 1px #64748b;
}

@media (max-width: 980px) {
  .header,
  .legend-card,
  .map-card,
  .map-panel {
    min-width: 0;
    width: 100%;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 12px 10px 8px;
    gap: 7px;
  }

  .maps-grid {
    grid-template-columns: 1fr;
  }

  .header {
    padding: 10px;
  }

  .header h1 {
    font-size: 1.2rem;
  }

  .header p {
    font-size: 0.9rem;
    line-height: 1.35;
  }

  .legend-card {
    padding: 10px;
  }

  .map-card {
    padding: 10px;
  }

  .map-panel {
    padding: 10px;
  }

  .mix-legend-head,
  .mix-legend-ticks {
    font-size: 0.8rem;
  }

  .mix-legend-badges {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .mix-badge {
    justify-content: center;
    text-align: center;
    font-size: 0.8rem;
  }

  .site-footer {
    padding: 0 12px 14px;
  }
}

@media (max-width: 560px) {
  .header h1 {
    font-size: 1.05rem;
  }

  .header p {
    font-size: 0.84rem;
  }

  .map-panel h3 {
    font-size: 0.82rem;
  }

  #map-mainland {
    min-height: 600px;
  }

  .mix-legend-ticks {
    font-size: 0.74rem;
  }

  .mix-badge {
    font-size: 0.76rem;
  }
}

.site-footer {
  position: fixed;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 30;
  text-align: center;
  padding: 0;
}

.site-footer a {
  color: #e5e7eb;
  font-size: 0.8rem;
  text-decoration: none;
  opacity: 1;
}

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