:root {
  color-scheme: light;
  --bg: #f5f7f1;
  --ink: #18241f;
  --muted: #617068;
  --panel: #ffffff;
  --line: #dbe3d4;
  --green-1: #e8f4dc;
  --green-2: #b7d997;
  --green-3: #78b95f;
  --green-4: #3e8f55;
  --green-5: #12603f;
  --water: #d9ecf2;
  --accent: #0f6b54;
  --shadow: 0 18px 50px rgba(30, 52, 42, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(141, 190, 115, 0.22), transparent 34rem),
    linear-gradient(180deg, #f8faf4 0%, var(--bg) 100%);
  color: var(--ink);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 24px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 16px 0 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 10px;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  line-height: 0.96;
}

h2 {
  margin-bottom: 4px;
  font-size: 1.05rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.stats article,
.panel,
.map-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.stats article {
  padding: 18px;
}

.stat-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.stats strong {
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  line-height: 1;
}

.map-panel {
  overflow: hidden;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.toolbar p,
.panel-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

#map {
  position: relative;
  height: min(68vh, 660px);
  min-height: 440px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), transparent 55%),
    var(--water);
}

.map-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.municipality {
  cursor: pointer;
  stroke: #ffffff;
  stroke-width: 0.9;
  transition:
    fill 150ms ease,
    stroke 150ms ease,
    stroke-width 150ms ease,
    filter 150ms ease;
}

.municipality:hover,
.municipality:focus-visible {
  filter: drop-shadow(0 4px 8px rgba(9, 47, 34, 0.22));
  outline: none;
  stroke: #183f32;
  stroke-width: 2.2;
}

.map-tooltip {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: min(280px, calc(100% - 32px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 36px rgba(30, 52, 42, 0.16);
  pointer-events: none;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 8px;
}

.rank-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rank-list li {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.rank-list li.species-item {
  grid-template-columns: 2rem 1fr;
}

.rank-number {
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  background: var(--green-1);
  color: var(--accent);
  font-weight: 800;
  font-size: 0.78rem;
}

.rank-title {
  display: block;
  font-weight: 800;
}

.rank-subtitle {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.84rem;
}

.rank-value {
  font-weight: 900;
}

.popup-title {
  display: block;
  margin-bottom: 8px;
  font-size: 1rem;
}

.popup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.popup-grid span {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 0.75rem;
}

.popup-grid strong {
  color: var(--ink);
  font-size: 1rem;
}

footer {
  padding: 22px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 820px) {
  .hero,
  .toolbar,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .stats,
  .content-grid {
    grid-template-columns: 1fr;
  }

  #map {
    height: 68vh;
    min-height: 360px;
  }
}
