:root {
  color-scheme: dark;
  --bg: #07101d;
  --panel: #0b1726;
  --panel-strong: #0f2032;
  --line: rgba(148, 163, 184, 0.19);
  --line-strong: rgba(148, 163, 184, 0.34);
  --text: #e8f1f8;
  --muted: #91a5b8;
  --soft: #bfd0dc;
  --accent: #38bdf8;
  --warm: #f59e0b;
  --danger: #fb7185;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  --radius: 14px;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }

body {
  background:
    radial-gradient(circle at 62% 0%, rgba(14, 116, 144, 0.2), transparent 34rem),
    linear-gradient(180deg, #07111f 0%, #050b14 100%);
}

button, input, select { font: inherit; }

button, select, input { color: var(--text); }

button:focus-visible, input:focus-visible, select:focus-visible, [tabindex="0"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app-shell { min-height: 100vh; display: grid; grid-template-rows: auto auto 1fr; }

.topbar {
  min-height: 88px;
  padding: 18px 24px 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 13, 24, 0.72);
  backdrop-filter: blur(14px);
}

h1, h2, h3, p { margin: 0; }

h1 { font-size: clamp(1.45rem, 2vw, 2rem); letter-spacing: 0.015em; }

h2 { font-size: 1rem; line-height: 1.35; }

h3 { font-size: 0.9rem; }

.eyebrow {
  color: #66d4ff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.topbar-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.82rem; }

.audit-badge,
.data-grade {
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.08);
  color: #a9e6fb;
  padding: 6px 9px;
  border-radius: 999px;
}

.audit-badge {
  border-color: rgba(52, 211, 153, 0.38);
  background: rgba(52, 211, 153, 0.09);
  color: #9cebc9;
}

.audit-badge.has-gap {
  border-color: rgba(245, 158, 11, 0.48);
  background: rgba(245, 158, 11, 0.1);
  color: #f8c978;
}

.timeline {
  min-height: 94px;
  padding: 12px 24px;
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.play-button, .text-button, .close-button, .map-controls button {
  border: 1px solid var(--line-strong);
  background: rgba(15, 32, 50, 0.86);
  border-radius: 9px;
  cursor: pointer;
}

.play-button {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.play-button:hover, .map-controls button:hover { border-color: rgba(56, 189, 248, 0.7); }

.year-track { display: grid; grid-template-columns: repeat(6, minmax(76px, 1fr)); gap: 8px; align-items: end; }

.year-button {
  position: relative;
  height: 66px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  color: var(--soft);
}

.year-button::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  height: var(--bar-height, 16%);
  min-height: 5px;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.72), rgba(14, 116, 144, 0.2));
  transition: height 180ms ease, background 180ms ease;
}

.year-button span { position: relative; z-index: 1; display: block; font-weight: 700; margin-top: 4px; }

.year-button small { position: relative; z-index: 1; color: var(--muted); font-size: 0.72rem; }

.year-button:hover, .year-button.active { border-color: rgba(56, 189, 248, 0.48); background: rgba(56, 189, 248, 0.08); }

.year-button.active::before { background: linear-gradient(180deg, var(--warm), rgba(180, 83, 9, 0.28)); }

.workspace {
  min-height: calc(100vh - 183px);
  display: grid;
  grid-template-columns: 244px minmax(530px, 1fr) 310px;
  gap: 0;
}

.filters, .results-panel {
  background: rgba(8, 20, 34, 0.82);
  border-right: 1px solid var(--line);
  padding: 18px;
  overflow-y: auto;
}

.results-panel { border-right: 0; border-left: 1px solid var(--line); padding: 0; }

.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }

.text-button { padding: 5px 8px; color: #a7dff3; font-size: 0.78rem; }

.field-label { display: block; margin: 16px 0 7px; color: var(--soft); font-size: 0.82rem; font-weight: 650; }

.search-input, select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #081321;
  padding: 0 11px;
}

.search-input::placeholder { color: #64798d; }

select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #8298aa 50%), linear-gradient(135deg, #8298aa 50%, transparent 50%); background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }

.range-row { display: flex; justify-content: space-between; gap: 8px; align-items: flex-end; }

.range-row output { color: #8eddf8; font-size: 0.76rem; white-space: nowrap; padding-bottom: 6px; }

input[type="range"] { width: 100%; accent-color: var(--accent); }

.reading-guide { margin-top: 26px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(15, 32, 50, 0.48); }

.reading-guide p { margin-top: 8px; color: var(--muted); font-size: 0.78rem; line-height: 1.65; }

.map-panel { position: relative; min-height: 600px; overflow: hidden; background: linear-gradient(135deg, rgba(7, 17, 31, 0.72), rgba(6, 28, 43, 0.52)); }

.map-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(148, 163, 184, 0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(148, 163, 184, 0.045) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 92%);
}

.map-summary {
  position: absolute;
  z-index: 5;
  top: 18px;
  left: 18px;
  display: flex;
  gap: 6px;
}

.map-summary div { min-width: 116px; padding: 10px 12px; background: rgba(5, 15, 26, 0.78); border: 1px solid var(--line); border-radius: 10px; backdrop-filter: blur(10px); }

.map-summary strong { display: block; font-size: 1.25rem; color: #f3f8fb; }

.map-summary span { display: block; margin-top: 3px; font-size: 0.7rem; color: var(--muted); }

#mapSvg { width: 100%; height: 100%; min-height: 650px; display: block; touch-action: none; cursor: grab; }

#mapSvg.dragging { cursor: grabbing; }

.province { fill: #10283a; stroke: #47738a; stroke-width: 0.8; vector-effect: non-scaling-stroke; transition: fill 150ms ease; }

.province:hover { fill: #16364b; }

.province-label { fill: #7893a5; font-size: 10px; text-anchor: middle; pointer-events: none; user-select: none; }

.project-marker { cursor: pointer; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.4)); transition: opacity 150ms ease; }

.spider-marker { filter: drop-shadow(0 4px 7px rgba(0, 0, 0, 0.58)); }

.spider-leg { stroke: rgba(142, 221, 248, 0.52); stroke-width: 1.2; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; pointer-events: none; }

.cluster-marker { cursor: pointer; filter: drop-shadow(0 5px 9px rgba(0, 0, 0, 0.5)); }

.cluster-halo { fill: rgba(56, 189, 248, 0.08); stroke: rgba(56, 189, 248, 0.4); stroke-width: 2; vector-effect: non-scaling-stroke; }

.cluster-core { fill: #10344c; stroke: #8eddf8; stroke-width: 2.2; vector-effect: non-scaling-stroke; }

.cluster-marker.expanded .cluster-core { fill: #07101d; stroke: #f59e0b; }

.cluster-marker:hover .cluster-core, .cluster-marker:focus .cluster-core { stroke: #ffffff; stroke-width: 3; }

.cluster-count { fill: #ffffff; font-size: 12px; font-weight: 800; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }

.project-marker:hover .marker-core, .project-marker:focus .marker-core { stroke: #ffffff; stroke-width: 2.5; }

.marker-halo { fill: none; stroke-width: 2; opacity: 0.25; }

.marker-core { stroke: rgba(5, 12, 20, 0.85); stroke-width: 1.5; vector-effect: non-scaling-stroke; }

.marker-core.planned { fill: #07101d !important; stroke-width: 2.4; }

.tooltip { position: absolute; z-index: 20; max-width: 280px; pointer-events: none; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(4, 12, 22, 0.94); box-shadow: var(--shadow); font-size: 0.76rem; line-height: 1.45; }

.tooltip strong { display: block; font-size: 0.82rem; margin-bottom: 3px; }

.tooltip span { color: var(--muted); }

.map-controls { position: absolute; z-index: 6; right: 16px; top: 16px; display: grid; gap: 5px; }

.map-controls button { width: 36px; height: 36px; font-size: 1.05rem; }

.map-legend { position: absolute; z-index: 6; left: 18px; right: 18px; bottom: 16px; display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(5, 15, 26, 0.9); backdrop-filter: blur(10px); }

.legend-group { display: flex; align-items: flex-start; gap: 10px; }

.legend-status-group { padding-top: 8px; border-top: 1px solid rgba(148, 163, 184, 0.18); }

.legend-title { flex: 0 0 auto; padding-top: 1px; color: #d7e5ee; font-size: 0.7rem; font-weight: 700; white-space: nowrap; }

.legend-items { display: flex; flex-wrap: wrap; gap: 7px 14px; }

.legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--soft); font-size: 0.68rem; }

.legend-swatch { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08); }

.legend-swatch-planned { width: 10px; height: 10px; background: #07101d; border: 2px solid #94a3b8; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18); }

.legend-item-emphasis { color: #d7e5ee; }

.legend-cluster-swatch { width: 17px; height: 17px; display: inline-grid; place-items: center; border: 1.5px solid #8eddf8; border-radius: 50%; background: #10344c; color: #ffffff; font-size: 0.58rem; font-style: normal; font-weight: 800; line-height: 1; }

.results-heading { padding: 18px 18px 14px; margin: 0; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; background: rgba(8, 20, 34, 0.96); }

.results-heading-actions { display: flex; align-items: center; gap: 7px; }

.clear-cluster-button { min-height: 30px; padding: 0 9px; border: 1px solid rgba(56, 189, 248, 0.38); border-radius: 999px; background: rgba(56, 189, 248, 0.08); color: #a9e6fb; cursor: pointer; font-size: 0.7rem; }

.clear-cluster-button:hover { border-color: rgba(56, 189, 248, 0.74); background: rgba(56, 189, 248, 0.14); }

.result-count { min-width: 34px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 999px; color: #8eddf8; font-size: 0.78rem; }

.results-list { max-height: calc(100vh - 286px); overflow-y: auto; }

.result-card { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; padding: 14px 18px; cursor: pointer; }

.result-card:hover, .result-card.active { background: rgba(56, 189, 248, 0.065); }

.result-card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }

.tech-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }

.result-card time { color: var(--muted); font-size: 0.72rem; margin-left: auto; }

.result-card h3 { font-size: 0.86rem; line-height: 1.45; margin-bottom: 6px; }

.result-meta { display: flex; flex-wrap: wrap; gap: 5px 9px; color: var(--muted); font-size: 0.72rem; }

.result-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.status-pill,
.origin-pill { display: inline-flex; padding: 4px 7px; border-radius: 999px; background: rgba(148, 163, 184, 0.12); color: #bdcbd6; font-size: 0.68rem; }

.origin-pill { border: 1px solid rgba(52, 211, 153, 0.3); background: rgba(52, 211, 153, 0.08); color: #9cebc9; }

.empty-state { padding: 28px 18px; color: var(--muted); font-size: 0.82rem; line-height: 1.6; }

.detail-drawer { position: fixed; z-index: 50; top: 0; right: 0; width: min(480px, 92vw); height: 100vh; background: #081522; border-left: 1px solid var(--line-strong); box-shadow: var(--shadow); transform: translateX(103%); transition: transform 220ms ease; overflow-y: auto; }

.detail-drawer.open { transform: translateX(0); }

.drawer-backdrop { position: fixed; z-index: 40; inset: 0; background: rgba(0, 0, 0, 0.46); backdrop-filter: blur(2px); }

.detail-header { position: sticky; top: 0; z-index: 2; padding: 20px 22px 18px; display: flex; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); background: rgba(8, 21, 34, 0.96); }

.detail-header h2 { font-size: 1.18rem; line-height: 1.45; }

.close-button { flex: 0 0 auto; width: 36px; height: 36px; font-size: 1.4rem; }

.detail-body { padding: 20px 22px 36px; }

.detail-status { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; padding: 14px; border-radius: 10px; background: rgba(56, 189, 248, 0.07); border: 1px solid rgba(56, 189, 248, 0.18); }

.detail-status strong { font-size: 1rem; }

.detail-status time { color: var(--muted); font-size: 0.75rem; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 22px; }

.detail-grid div, .detail-section { padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(15, 32, 50, 0.34); }

.detail-grid dt, .detail-section h3 { margin: 0 0 6px; color: var(--muted); font-size: 0.7rem; font-weight: 600; }

.detail-grid dd { margin: 0; color: var(--text); font-size: 0.82rem; line-height: 1.5; }

.detail-section { margin-top: 12px; }

.detail-section p { color: var(--soft); font-size: 0.8rem; line-height: 1.65; }

.source-links { display: grid; gap: 8px; }

.source-links a { display: block; padding: 7px 9px; border: 1px solid rgba(121, 216, 250, 0.22); border-radius: 7px; color: #79d8fa; font-size: 0.78rem; line-height: 1.35; text-decoration: none; word-break: break-word; }

.source-links a:hover { border-color: rgba(121, 216, 250, 0.62); background: rgba(121, 216, 250, 0.08); }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 214px minmax(470px, 1fr) 276px; }
  .map-summary div { min-width: 96px; }
}

@media (max-width: 920px) {
  .topbar { align-items: flex-start; flex-direction: column; gap: 10px; }
  .timeline { padding-inline: 14px; grid-template-columns: 78px minmax(0, 1fr); }
  .year-track { overflow-x: auto; grid-template-columns: repeat(6, 104px); }
  .workspace { display: flex; flex-direction: column; }
  .map-panel { order: 1; }
  .filters { order: 2; }
  .results-panel { order: 3; }
  .filters { border-right: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
  .filters .panel-heading, .filters .reading-guide { grid-column: 1 / -1; }
  .map-panel { min-height: 560px; }
  #mapSvg { min-height: 560px; }
  .results-panel { border-left: 0; border-top: 1px solid var(--line); }
  .results-list { max-height: none; }
}

@media (max-width: 600px) {
  .topbar { padding: 15px; }
  .topbar-meta { align-items: flex-start; flex-direction: column; }
  .timeline { grid-template-columns: 1fr; }
  .play-button { width: 90px; }
  .filters { grid-template-columns: 1fr; padding: 15px; }
  .filters .panel-heading, .filters .reading-guide { grid-column: auto; }
  .map-summary { left: 10px; top: 10px; right: 52px; gap: 4px; }
  .map-summary div { min-width: 0; flex: 1; padding: 8px; }
  .map-summary strong { font-size: 1rem; }
  .map-summary span { font-size: 0.61rem; }
  .map-legend { left: 10px; right: 10px; bottom: 10px; max-height: 96px; overflow-y: auto; }
  .legend-group { display: grid; gap: 6px; }
  .province-label { font-size: 8px; }
  .detail-grid { grid-template-columns: 1fr; }
}

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