:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --paper: #ffffff;
  --ink: #202124;
  --muted: #667085;
  --line: #d7dce5;
  --teal: #0f8b8d;
  --coral: #ee6c4d;
  --violet: #6d5dfc;
  --shadow: 0 20px 50px rgba(32, 33, 36, 0.11);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 248, 251, 0.92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--teal), var(--violet));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.brand strong {
  display: block;
  font-size: 15px;
}

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

.nav-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 14px;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--teal);
}

.lang-switch {
  display: flex;
  gap: 4px;
}

.lang-switch button {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}

.lang-switch button.active {
  border-color: var(--teal);
  color: var(--teal);
}

.badge-archive {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e8f4f4;
  color: var(--teal);
  border: 1px solid #c5e8e8;
}

/* 总览地图布局 */
.overview-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 57px);
  min-height: 520px;
}

.map-stage {
  flex: 1;
  position: relative;
  min-height: 0;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.year-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 5;
  font-size: clamp(42px, 8vw, 72px);
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  opacity: 0.88;
  pointer-events: none;
}

.type-tags {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.type-tags button,
.view-toggle button {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.type-tags button.active {
  border-color: var(--teal);
  background: #e8f4f4;
  color: var(--teal);
}

.view-toggle {
  position: absolute;
  top: 56px;
  right: 16px;
  z-index: 5;
  display: flex;
  gap: 6px;
}

.view-toggle.hidden {
  display: none;
}

.view-toggle button.active {
  border-color: var(--violet);
  background: #f0edff;
  color: var(--violet);
}

#map-root {
  width: 100%;
  height: 100%;
}

#map-root svg {
  display: block;
}

.map-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  box-shadow: var(--shadow);
  z-index: 10;
  max-width: 240px;
  opacity: 0;
  transition: opacity 0.15s;
}

.map-tooltip.visible {
  opacity: 1;
}

.load-overlay {
  position: absolute;
  inset: 0;
  background: rgba(247, 248, 251, 0.75);
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
}

.load-overlay.hidden {
  display: none;
}

.progress-bar {
  width: min(320px, 80%);
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--teal);
  transition: width 0.2s;
}

.timeline-bar {
  padding: 12px 20px 16px;
  background: var(--paper);
  border-top: 1px solid var(--line);
}

.timeline-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.timeline-controls button {
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.timeline-controls button.active {
  border-color: var(--teal);
  color: var(--teal);
}

#timeline-track {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.year-chip {
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}

.year-chip.active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

.site-footer {
  padding: 10px 20px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: var(--bg);
}

/* 分类页 */
.page-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.hero-block {
  margin-bottom: 28px;
}

.hero-block h1 {
  font-size: clamp(24px, 4vw, 32px);
  margin: 0 0 8px;
}

.hero-block p {
  color: var(--muted);
  max-width: 720px;
}

.chart-grid {
  display: grid;
  gap: 20px;
}

.chart-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(32, 33, 36, 0.06);
}

.chart-card h2 {
  font-size: 15px;
  margin: 0 0 12px;
}

.chart-card svg {
  width: 100%;
  height: auto;
}

.methodology {
  margin-top: 24px;
  padding: 16px;
  background: #f0f4f8;
  border-radius: 10px;
  font-size: 14px;
}

.primary-btn {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-size: 14px;
}

.about-section {
  margin-bottom: 24px;
}

.about-section h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

@media (max-width: 640px) {
  .type-tags {
    top: auto;
    bottom: 8px;
    right: 8px;
    left: 8px;
    justify-content: center;
  }
  .view-toggle {
    top: auto;
    bottom: 48px;
    right: 8px;
    left: 8px;
    justify-content: center;
  }
  .year-badge {
    font-size: 36px;
  }
}
