:root {
  --ink: #17332e;
  --muted: #6f7f79;
  --paper: #f3f0e7;
  --card: #fffdf7;
  --line: #d9d8cf;
  --teal: #087f6d;
  --lime: #d7e75c;
  --sea: #b9dcde;
  --heat-1: #dbe8dc;
  --heat-2: #b8ddc7;
  --heat-3: #78c9ac;
  --heat-4: #2da783;
  --heat-5: #087f6d;
}

* { box-sizing: border-box; }

html { overflow-x: hidden; }

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

[hidden] { display: none !important; }

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

header {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 48px;
  align-items: end;
  padding: 8px 4px 32px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .18em;
}

h1 {
  margin: 0;
  font-size: clamp(42px, 6vw, 78px);
  line-height: .94;
  letter-spacing: -.055em;
}

h2 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -.03em;
}

.intro {
  max-width: 590px;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
}

.toolbar,
.kpis,
.content {
  display: grid;
  gap: 12px;
}

.toolbar {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  padding: 16px;
  border-radius: 20px;
  background: var(--ink);
  color: white;
}

.toolbar > label,
.filter-field {
  min-width: 0;
  color: #c8d3cf;
  font-size: 11px;
  letter-spacing: .08em;
}

.filter-label { display: block; }

.toolbar select {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 7px 20px 6px 0;
  border: 0;
  border-bottom: 1px solid #69807a;
  background: transparent;
  color: white;
  font: inherit;
  font-size: 14px;
}

.toolbar select option { color: var(--ink); }

.region-filter details { position: relative; }

.region-filter summary {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-width: 0;
  padding: 7px 2px 6px 0;
  border-bottom: 1px solid #69807a;
  color: white;
  font-size: 14px;
  letter-spacing: 0;
  list-style: none;
  cursor: pointer;
}

.region-filter summary::-webkit-details-marker { display: none; }

.region-filter summary::after {
  width: 7px;
  height: 7px;
  margin: 0 4px 4px 0;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: '';
  transform: rotate(45deg);
  transition: transform .15s ease;
}

.region-filter details[open] summary::after {
  margin-bottom: -3px;
  transform: rotate(225deg);
}

.region-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  right: 0;
  width: max(100%, 300px);
  max-width: calc(100vw - 40px);
  max-height: 390px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 16px 38px #102f2a40;
  color: var(--ink);
  overscroll-behavior: contain;
}

.region-choice {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 9px 12px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
  cursor: pointer;
}

.region-choice:hover { background: #edf1e8; }

.region-choice-all {
  position: sticky;
  z-index: 1;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  font-weight: 800;
}

.region-choice input {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--teal);
}

.region-choice span { min-width: 0; }

button {
  align-self: stretch;
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  background: var(--lime);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:focus-visible,
select:focus-visible,
.region-filter summary:focus-visible,
.region-choice input:focus-visible {
  outline: 3px solid #2e90ff;
  outline-offset: 2px;
}

.kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 12px 0;
}

.kpis article,
.map-card,
.rank-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
}

.kpis article { padding: 20px 22px; }

.kpis span,
.kpis small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.kpis strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 28px;
  line-height: 1.1;
}

.content { grid-template-columns: minmax(0, 1fr) 330px; }

.map-card,
.rank-card { padding: 24px; }

.section-head {
  display: flex;
  gap: 20px;
  align-items: end;
  justify-content: space-between;
}

.section-head > p {
  max-width: 460px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  text-align: right;
}

.map-section-kicker {
  letter-spacing: .2em;
  white-space: nowrap;
}

.map-section-title {
  display: grid;
  gap: 3px;
  align-items: start;
}

.map-title-label,
.map-title-date { display: block; }

.map-title-label { white-space: nowrap; }

.map-title-date {
  font-size: .72em;
  line-height: 1.05;
  letter-spacing: .01em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.map {
  position: relative;
  aspect-ratio: 6 / 5;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid #cedbd3;
  border-radius: 16px;
  background: #e8eee6;
  isolation: isolate;
}

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

.map-paper { fill: #edf1e8; }

.map-grain {
  fill: #5c776d;
  opacity: .08;
  pointer-events: none;
}

.sea-shape { fill: var(--sea); }

.coast-shadow,
.coast-line,
.river,
.river-edge,
.roads path,
.zone-outlines path,
.landmark path,
.north-arrow path,
.sea-label path {
  fill: none;
  vector-effect: non-scaling-stroke;
}

.coast-shadow {
  stroke: #fffdf7;
  stroke-width: 4;
  opacity: .8;
}

.coast-line {
  stroke: #477a70;
  stroke-width: 1.35;
  stroke-linecap: round;
  filter: url(#rough-line);
}

.river {
  stroke: #83b8b7;
  stroke-width: 5;
  stroke-linecap: round;
}

.river-edge {
  stroke: #477a70;
  stroke-width: .8;
  stroke-dasharray: 7 4;
  opacity: .75;
}

.zone-outlines path {
  fill: #fffdf7;
  fill-opacity: .18;
  stroke: #89a096;
  stroke-width: .75;
  stroke-dasharray: 3.5 2.5;
  filter: url(#rough-line);
}

.zone-outlines path:nth-child(3n + 2) { fill: #dbe8dc; }
.zone-outlines path:nth-child(3n) { fill: #b9dcde; }

.roads path {
  stroke: #aab8af;
  stroke-width: .65;
  stroke-dasharray: 2 3;
  opacity: .65;
}

.wetland path:first-child {
  fill: #d8e8d1;
  stroke: #9db9a1;
  stroke-width: .3;
}

.wetland path:nth-child(2) { fill: #9bcaca; }

.wetland text,
.landmark text,
.area-caption text,
.north-arrow text {
  fill: #5e7c72;
  font-size: 1.45px;
  font-weight: 700;
  letter-spacing: .04em;
}

.landmark path,
.landmark-leader,
.north-arrow path {
  stroke: #426f66;
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.landmark-leader {
  stroke-width: .35;
  stroke-dasharray: 1 1;
  opacity: .65;
}

.landmark text {
  stroke: #edf1e8;
  stroke-width: .5;
  paint-order: stroke fill;
}

.sea-label text {
  fill: #518884;
  font-family: serif;
  font-size: 4px;
  font-weight: 700;
}

.sea-label path {
  stroke: #6ba5a1;
  stroke-width: 1;
  stroke-linecap: round;
}

.region-marker { cursor: pointer; }

.region-leader {
  fill: none;
  stroke: #5d7f75;
  stroke-width: .35;
  stroke-linecap: round;
  stroke-dasharray: 1 1.1;
  vector-effect: non-scaling-stroke;
  opacity: .78;
}

.selection-ring {
  fill: none;
  stroke: var(--lime);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  opacity: 0;
  transition: opacity .16s ease;
}

.region-pillar-fill {
  stroke: none;
  shape-rendering: geometricPrecision;
  transition: y .18s ease, height .18s ease, fill .18s ease;
}

.region-pillar-shell {
  fill: rgba(255, 253, 247, .12);
  stroke: rgba(23, 51, 46, .72);
  stroke-width: 1.25;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 2px 2px rgba(23, 51, 46, .22));
  transition: stroke-width .18s ease, filter .18s ease;
}

.heat-1 { fill: var(--heat-1); background: var(--heat-1); }
.heat-2 { fill: var(--heat-2); background: var(--heat-2); }
.heat-3 { fill: var(--heat-3); background: var(--heat-3); }
.heat-4 { fill: var(--heat-4); background: var(--heat-4); }
.heat-5 { fill: var(--heat-5); background: var(--heat-5); }
.heat-empty { fill: #e3e6df; background: #e3e6df; }

.region-marker:hover .region-pillar-shell,
.region-marker:focus-visible .region-pillar-shell,
.region-marker.is-selected .region-pillar-shell {
  stroke: #17332e;
  stroke-width: 2;
  filter: drop-shadow(0 3px 3px rgba(23, 51, 46, .32));
}

.region-marker:focus { outline: none; }

.region-marker:focus-visible .selection-ring,
.region-marker.is-selected .selection-ring { opacity: 1; }

.region-marker.is-filtered-out .selection-ring,
.region-marker.is-filtered-out .region-pillar-fill,
.region-marker.is-filtered-out .region-pillar-shell,
.region-marker.is-filtered-out .pillar-rate { opacity: 0; }

.pillar-rate {
  fill: var(--ink);
  stroke: #edf1e8;
  stroke-width: .48;
  paint-order: stroke fill;
  font-size: 1.55px;
  font-weight: 900;
  letter-spacing: -.03em;
  pointer-events: none;
}

.region-label {
  fill: var(--ink);
  stroke: #edf1e8;
  stroke-width: .62;
  paint-order: stroke fill;
  font-size: 1.85px;
  font-weight: 850;
  letter-spacing: .01em;
  pointer-events: none;
}

.pillar-hit {
  fill: transparent;
  stroke: transparent;
  pointer-events: all;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-top: 16px;
  color: var(--muted);
  font-size: 11px;
}

.legend b { color: var(--ink); }

.legend span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  white-space: nowrap;
}

.legend span i {
  width: 9px;
  height: 16px;
  border: 1px solid rgba(23, 51, 46, .5);
  border-radius: 3px;
}

.legend em {
  margin-left: auto;
  color: var(--ink);
  font-style: normal;
  font-weight: 700;
}

.ranking {
  display: grid;
  gap: 8px;
  max-height: 735px;
  margin-top: 18px;
  overflow: auto;
  overscroll-behavior: contain;
}

.rank {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 50px;
  padding: 10px;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.rank:hover,
.rank.active { background: #edf1e8; }

.rank > i {
  color: #8a9792;
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
}

.rank-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar {
  height: 4px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 5px;
  background: #e4e7df;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: var(--teal);
}

.rank b {
  font-size: 13px;
  white-space: nowrap;
}

.alt-heatmap {
  display: none;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.alt-heatmap .eyebrow {
  margin-bottom: 6px;
  color: #bd503d;
}

.alt-heatmap-head h3 {
  margin: 0;
  color: #4c2928;
  font-size: 19px;
  line-height: 1.2;
}

.alt-heatmap-head p {
  margin: 8px 0 0;
  color: #8a6963;
  font-size: 11px;
  line-height: 1.55;
}

.alt-heatmap-map {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid #ead5cd;
  border-radius: 14px;
  background: #fff8f3;
}

.alt-map-land { fill: #fff8f3; }
.alt-map-sea { fill: #f0dfe2; }

.alt-map-coast {
  fill: none;
  stroke: #d5a4a0;
  stroke-width: .55;
}

.alt-region-marker {
  color: #d8d0cb;
  cursor: pointer;
  outline: none;
}

.alt-band-1 { color: #fee8c8; }
.alt-band-2 { color: #fdbb84; }
.alt-band-3 { color: #fc8d59; }
.alt-band-4 { color: #e34a33; }
.alt-band-5 { color: #a92d3f; }
.alt-band-empty { color: #d8d0cb; }

.alt-heat-halo {
  fill: currentColor;
  opacity: .22;
}

.alt-heat-core {
  fill: currentColor;
  stroke: #fffaf6;
  stroke-width: .7;
  transition: transform .16s ease, stroke-width .16s ease;
  transform-box: fill-box;
  transform-origin: center;
}

.alt-heat-leader {
  fill: none;
  stroke: #c9a8a0;
  stroke-width: .38;
  stroke-dasharray: 1.2 1.1;
}

.alt-heat-rate {
  fill: white;
  font-size: 2.25px;
  font-weight: 800;
  pointer-events: none;
}

.alt-band-1 .alt-heat-rate,
.alt-band-2 .alt-heat-rate,
.alt-band-empty .alt-heat-rate { fill: #68413a; }

.alt-heat-label {
  fill: #5a3431;
  stroke: #fff8f3;
  stroke-width: .75;
  paint-order: stroke;
  font-size: 2.8px;
  font-weight: 800;
  pointer-events: none;
}

.alt-region-marker:hover .alt-heat-core,
.alt-region-marker:focus-visible .alt-heat-core,
.alt-region-marker.is-selected .alt-heat-core {
  stroke: #5f2030;
  stroke-width: 1.05;
  transform: scale(1.07);
}

.alt-region-marker.is-selected .alt-heat-halo { opacity: .42; }

.alt-region-marker.is-filtered-out .alt-heat-halo,
.alt-region-marker.is-filtered-out .alt-heat-core,
.alt-region-marker.is-filtered-out .alt-heat-rate { opacity: 0; }

.alt-heatmap-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 10px;
  margin-top: 12px;
  color: #81635e;
  font-size: 10px;
}

.alt-heatmap-legend span {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.alt-heatmap-legend i {
  width: 10px;
  height: 10px;
  border: 1px solid #9c6b62;
  border-radius: 50%;
  background: currentColor;
}

.tooltip {
  position: fixed;
  z-index: 20;
  min-width: 220px;
  padding: 13px 15px;
  border-radius: 12px;
  background: #17332ef2;
  box-shadow: 0 12px 35px #17332e40;
  color: white;
  font-size: 12px;
  line-height: 1.7;
  pointer-events: none;
}

.tooltip strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}

.tooltip div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.tooltip b { font-weight: 600; }
.tooltip em { color: var(--lime); font-style: normal; font-weight: 800; }

footer {
  display: flex;
  justify-content: space-between;
  padding: 18px 4px 0;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 1100px) {
  .content { grid-template-columns: minmax(0, 1fr) 300px; }
  .map-card, .rank-card { padding: 20px; }
}

@media (max-width: 900px) {
  header { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .content { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .ranking { max-height: 480px; }
}

@media (max-width: 700px) {
  .shell { width: calc(100% - 24px); padding-top: 20px; }
  header { gap: 20px; padding-bottom: 22px; }
  h1 { font-size: clamp(40px, 14vw, 60px); }
  .intro { font-size: 13px; line-height: 1.65; }
  .toolbar { grid-template-columns: 1fr; border-radius: 16px; }
  .toolbar button { min-height: 46px; margin-top: 3px; }
  .kpis { gap: 8px; }
  .kpis article { padding: 16px; }
  .kpis strong { font-size: 24px; }
  .map-card, .rank-card { padding: 14px; border-radius: 16px; }
  .section-head { display: block; }
  .section-head > p { margin-top: 8px; text-align: left; }
  .map { aspect-ratio: 1 / 1; margin-top: 14px; border-radius: 14px; }
  .region-label { font-size: 3.05px; stroke-width: .9; }
  .pillar-rate { font-size: 2.35px; stroke-width: .72; }
  .wetland text, .landmark text, .area-caption text, .north-arrow text { font-size: 2.15px; }
  .sea-label text { font-size: 5px; }
  .legend { align-items: flex-start; }
  .legend b { width: 100%; }
  .legend em { width: 100%; margin-left: 0; }
  .rank { min-height: 52px; }
  .alt-heatmap { display: block; }
  .tooltip { display: none !important; }
  footer { display: block; line-height: 1.8; }
}

@media (max-width: 360px) {
  .shell { width: calc(100% - 16px); }
  .kpis { grid-template-columns: 1fr; }
  .map-card, .rank-card { padding: 10px; }
  .region-label { font-size: 3.25px; }
  .pillar-rate { font-size: 2.55px; stroke-width: .76; }
  .landmark text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
