:root {
  color-scheme: dark;
  --bg: #031420;
  --bg2: #052033;
  --panel: rgba(8, 30, 46, 0.86);
  --line: rgba(146, 214, 255, 0.25);
  --text: #eaf7ff;
  --muted: #9dc3db;
  --accent: #35c0a6;
  --warn: #ff6e59;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(37, 108, 166, 0.32), transparent 38%),
    radial-gradient(circle at 82% 82%, rgba(53, 192, 166, 0.2), transparent 40%),
    linear-gradient(155deg, var(--bg), var(--bg2));
  color: var(--text);
  min-height: 100vh;
}

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

.orb-a {
  width: 220px;
  height: 220px;
  top: -40px;
  left: -40px;
  background: rgba(67, 160, 255, 0.4);
}

.orb-b {
  width: 280px;
  height: 280px;
  right: -90px;
  bottom: -80px;
  background: rgba(54, 210, 173, 0.26);
}

.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);
  backdrop-filter: blur(10px);
}

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

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

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

.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: #dcf4ff;
  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(4, 20, 33, 0.6);
  padding: 10px;
  display: grid;
  gap: 8px;
}

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

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

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

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

.btn {
  border: 1px solid rgba(123, 196, 236, 0.4);
  border-radius: 10px;
  background: rgba(123, 196, 236, 0.16);
  color: var(--text);
  padding: 6px 12px;
  cursor: pointer;
}

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

.btn:hover {
  background: rgba(123, 196, 236, 0.28);
}

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

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

.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.05);
}

.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: #9ddfff;
}

.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;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) 360px;
  position: relative;
}

.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(3, 17, 29, 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(53, 192, 166, 0.8);
  box-shadow: 0 0 0 1px rgba(53, 192, 166, 0.4) inset;
}

.event-media {
  height: 130px;
  background: linear-gradient(140deg, #184666, #1b7a65);
  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: #d6edf9;
  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, #35c0a6, #8cc7ff);
}

.meteor-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12px;
}

.meteor-flash.show {
  display: flex;
}

.meteor-card {
  border: 1px solid rgba(255, 110, 89, 0.55);
  border-radius: 999px;
  background: rgba(59, 16, 9, 0.9);
  color: #ffd6cd;
  padding: 6px 14px;
  font-size: 13px;
}

.maplibregl-popup-content {
  background: rgba(4, 17, 29, 0.95);
  border: 1px solid var(--line);
  color: var(--text);
}

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

@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;
  }
}
