:root {
  --bg: #000000;
  --panel: #0f131a;
  --panel-muted: #a9b2bf;
  --text-main: #edf1f7;
  --text-sub: #b7c0cd;
  --stroke-soft: rgba(152, 170, 191, 0.25);
  --ok: #29c17e;
  --warn: #f4b400;
  --down: #e14b4b;
  --route-cold: #3b82f6;
  --route-hot: #ef4444;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #071123 0%, #02060d 48%, #000000 100%);
  color: var(--text-main);
}
.stack {
  display: flex;
  flex-direction: column;
}
.hero-map {
  height: 100vh;
  min-height: 100vh;
  position: relative;
  border-bottom: 1px solid var(--stroke-soft);
}
.topbar {
  position: absolute;
  z-index: 2;
  top: 18px;
  left: 20px;
  background: rgba(10, 16, 27, 0.65);
  border: 1px solid rgba(151, 167, 186, 0.34);
  border-radius: 14px;
  padding: 11px 13px;
  backdrop-filter: blur(10px) saturate(120%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.topbar h1 { margin: 0; font-size: 1.45rem; letter-spacing: 0.1px; font-weight: 700; }
.topbar p { margin: 4px 0 0; color: var(--text-sub); font-size: 1.04rem; }
.map-hint {
  position: absolute;
  z-index: 2;
  right: 20px;
  bottom: 22px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(151, 167, 186, 0.35);
  background: rgba(10, 16, 27, 0.72);
  color: #cfd8e5;
  font-size: 0.88rem;
  line-height: 1.2;
  backdrop-filter: blur(9px) saturate(120%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}
.map-hint.hidden {
  opacity: 0;
  transform: translateY(4px);
}
.panel {
  background: linear-gradient(180deg, rgba(7, 11, 19, 0.96) 0%, rgba(4, 8, 13, 0.98) 100%);
  color: var(--text-main);
  padding: 22px;
  overflow: auto;
}
.summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.summary-prop { margin-top: -6px; margin-bottom: 16px; }
.controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.control {
  background: linear-gradient(180deg, rgba(28, 37, 49, 0.35) 0%, rgba(18, 25, 35, 0.3) 100%);
  border: 1px solid rgba(148, 166, 186, 0.16);
  border-radius: 12px;
  padding: 10px 12px;
}
.control label {
  display: block;
  color: #d5dfeb;
  font-size: 0.82rem;
  margin-bottom: 8px;
}
.control-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}
.control input[type="range"] {
  width: 100%;
  accent-color: #7cb9ff;
}
.control span {
  color: #c8d3e0;
  font-size: 0.82rem;
  min-width: 54px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.card {
  background: linear-gradient(180deg, rgba(30, 40, 54, 0.38) 0%, rgba(20, 28, 38, 0.3) 100%);
  border: 1px solid var(--stroke-soft);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.card .k { font-size: .8rem; color: #cbd3df; }
.card .v { font-size: 1.2rem; font-weight: 700; margin-top: 4px; color: #f2f6fb; }
.chart-wrap { margin-top: 14px; }
.chart-wrap h2 { margin: 6px 0 10px; font-size: 0.95rem; font-weight: 650; color: #dbe3ed; }
.chart {
  height: 220px;
  background: linear-gradient(180deg, rgba(18, 26, 36, 0.4) 0%, rgba(9, 15, 24, 0.35) 100%);
  border: 1px solid rgba(148, 166, 186, 0.16);
  border-radius: 14px;
}
.ping-list {
  max-height: 220px;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid rgba(148, 166, 186, 0.16);
  background: linear-gradient(180deg, rgba(18, 26, 36, 0.4) 0%, rgba(9, 15, 24, 0.35) 100%);
}
.ping-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(148, 166, 186, 0.1);
  font-size: 0.88rem;
}
.ping-row:last-child { border-bottom: 0; }
.ping-link {
  color: #d7e1ed;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ping-latency {
  color: #8fd0ff;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.ping-jitter {
  color: #afbdcd;
  font-variant-numeric: tabular-nums;
}
.ping-empty {
  color: #afbdcd;
  padding: 12px;
  font-size: 0.9rem;
}
#map { width: 100%; height: 100%; position: relative; }
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left {
  opacity: 0.7;
}
@media (max-width: 980px) {
  .hero-map { height: 100svh; min-height: 100svh; }
  .grid { grid-template-columns: 1fr; }
  .controls { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .summary { grid-template-columns: 1fr 1fr; }
  .topbar { left: 12px; right: 12px; }
  .map-hint {
    left: 12px;
    right: auto;
    bottom: 16px;
    max-width: calc(100vw - 24px);
  }
}
