:root {
  --bg: #0b0e14;
  --panel: rgba(18, 22, 32, 0.88);
  --line: rgba(255, 255, 255, 0.12);
  --text: #e8ecf4;
  --muted: #8b95a8;
  --accent: #4fd1c5;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, "PingFang TC", "Helvetica Neue", sans-serif;
  overscroll-behavior: none;
}

#map { position: absolute; inset: 0; background: var(--bg); }

#panel {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  z-index: 1000;
  width: 260px;
  max-width: calc(100vw - 24px);
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

#panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

#panel h1 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: 0.04em; }

#collapse {
  width: 26px; height: 26px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
#collapse:hover { color: var(--text); }

#body { padding: 12px 14px 14px; }
#panel.collapsed #body { display: none; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.stat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 9px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.stat .v {
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.stat .k { font-size: 10.5px; color: var(--muted); }

.row { display: block; margin-bottom: 13px; font-size: 12px; color: var(--muted); }
.row > span:first-child { display: block; margin-bottom: 5px; }
.row b { color: var(--text); font-variant-numeric: tabular-nums; }

.row.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  cursor: pointer;
}
.row.check span { margin: 0; }

.range-label {
  display: block;
  color: var(--text);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 5px;
}

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

select {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 7px;
  font: inherit;
  font-size: 12px;
}

.note {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.45;
}

.leaflet-control-attribution {
  background: rgba(11, 14, 20, 0.75) !important;
  color: var(--muted) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--muted) !important; }

@media (max-width: 560px) {
  #panel { width: calc(100vw - 24px); }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .stat .v { font-size: 14px; }
}

#sources { display: flex; flex-direction: column; gap: 5px; }

.src {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
}

.src input { margin: 0; accent-color: var(--accent); }

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

.src .n {
  margin-left: auto;
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}
