:root {
  color-scheme: dark;
  --bg: #11151f;
  --bg2: #1d2433;
  --panel: rgba(21, 26, 40, 0.9);
  --line: rgba(188, 205, 240, 0.22);
  --text: #eef4ff;
  --muted: #afbdd9;
  --auto: #f4b24b;
  --policy: #69a8ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 16%, rgba(244, 178, 75, 0.2), transparent 42%),
    radial-gradient(circle at 85% 84%, rgba(105, 168, 255, 0.22), transparent 42%),
    linear-gradient(145deg, var(--bg), var(--bg2));
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(58px);
  pointer-events: none;
  z-index: -1;
}

.orb-a {
  width: 260px;
  height: 260px;
  top: -70px;
  left: -50px;
  background: rgba(244, 178, 75, 0.22);
}

.orb-b {
  width: 300px;
  height: 300px;
  right: -100px;
  bottom: -90px;
  background: rgba(105, 168, 255, 0.2);
}

.shell {
  width: min(1360px, 96vw);
  margin: 0 auto;
  padding: 18px 0 26px;
}

.app {
  display: grid;
  gap: 12px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.hero {
  padding: 16px 18px;
  display: grid;
  gap: 10px;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #afc7ff;
}

h1 {
  margin: 2px 0 0;
  font-family: "Baloo 2", "Noto Sans SC", sans-serif;
  font-size: clamp(1.65rem, 2.5vw, 2.2rem);
}

.hero-note {
  margin: 6px 0 0;
  line-height: 1.65;
  color: var(--muted);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-links a {
  color: #ebf4ff;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.06);
}

.controls {
  padding: 12px;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.control-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 11, 21, 0.5);
  padding: 10px;
  display: grid;
  gap: 8px;
}

label {
  font-size: 13px;
  color: #dce8ff;
}

input[type="range"] {
  width: 100%;
}

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

.mode-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.btn {
  border: 1px solid rgba(175, 199, 255, 0.45);
  border-radius: 10px;
  background: rgba(175, 199, 255, 0.16);
  color: var(--text);
  padding: 6px 12px;
  cursor: pointer;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.05);
}

.btn:hover {
  background: rgba(175, 199, 255, 0.26);
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.check-line {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: #dde7fd;
}

.legend-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.source-note {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.source-note a {
  color: #bcd8ff;
}

.stats {
  padding: 10px 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  padding: 8px;
}

.stat-card b {
  display: block;
  font-size: 18px;
}

.stat-card span {
  font-size: 12px;
  color: var(--muted);
}

.map-panel {
  padding: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 10px;
}

.map-canvas {
  min-height: 640px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.event-side {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: rgba(7, 10, 18, 0.75);
}

.event-side h3 {
  margin: 0 0 8px;
}

.event-list {
  display: grid;
  gap: 8px;
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
}

.event-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.event-card.active {
  border-color: rgba(244, 178, 75, 0.8);
  box-shadow: 0 0 0 1px rgba(244, 178, 75, 0.45) inset;
}

.event-media {
  height: 130px;
  background: linear-gradient(140deg, #2a3957, #435684);
  position: relative;
}

.event-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.event-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 40px;
}

.event-body {
  padding: 8px;
}

.event-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.event-title {
  margin: 6px 0 0;
  font-size: 1rem;
}

.event-desc {
  margin: 6px 0 0;
  color: #dbe8ff;
  font-size: 13px;
  line-height: 1.55;
}

.bars {
  margin-top: 8px;
  display: grid;
  gap: 5px;
}

.bar-row {
  display: grid;
  grid-template-columns: 44px 1fr 30px;
  gap: 6px;
  align-items: center;
  font-size: 11px;
}

.bar-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f4b24b, #69a8ff);
}

.maplibregl-popup-content {
  background: rgba(8, 11, 20, 0.95);
  border: 1px solid var(--line);
  color: var(--text);
}

.maplibregl-popup-close-button {
  color: #deebff;
}

@media (max-width: 1160px) {
  .control-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-panel {
    grid-template-columns: 1fr;
  }

  .map-canvas {
    min-height: 520px;
  }

  .event-list {
    max-height: none;
  }
}

@media (max-width: 760px) {
  .shell {
    width: 95vw;
  }

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

  .map-canvas {
    min-height: 460px;
  }
}
