:root {
  --space: #05070d;
  --panel: rgba(13, 17, 28, 0.82);
  --panel-edge: rgba(255, 255, 255, 0.09);
  --ink: #e9ecf4;
  --ink-dim: #9aa3b8;
  --accent: #ffd166;
  --danger: #ff8a7a;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--space);
  color: var(--ink);
  font: 14px/1.45 Inter, system-ui, sans-serif;
}

/* Faint starfield behind the globe. */
body {
  background:
    radial-gradient(1px 1px at 12% 18%, #fff8 50%, transparent),
    radial-gradient(1px 1px at 72% 12%, #fff6 50%, transparent),
    radial-gradient(1.5px 1.5px at 85% 64%, #fff7 50%, transparent),
    radial-gradient(1px 1px at 33% 82%, #fff5 50%, transparent),
    radial-gradient(1px 1px at 55% 40%, #fff4 50%, transparent),
    radial-gradient(1px 1px at 92% 30%, #fff5 50%, transparent),
    radial-gradient(1.5px 1.5px at 6% 66%, #fff6 50%, transparent),
    radial-gradient(1px 1px at 46% 6%, #fff5 50%, transparent),
    radial-gradient(ellipse at 50% 120%, #1a1f3a 0%, var(--space) 60%);
}

#map { position: absolute; inset: 0; }

.panel {
  position: absolute;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

.search-panel { top: 16px; left: 16px; width: 340px; padding: 18px 18px 14px; }

h1 {
  margin: 0;
  font: 700 28px/1.1 Fraunces, Georgia, serif;
  letter-spacing: -0.01em;
  background: linear-gradient(90deg, #fff1b8, #ffa64d 45%, #cf3471 80%, #6f2c9c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline { margin: 6px 0 14px; color: var(--ink-dim); }

form { display: flex; gap: 8px; }

input[type="search"] {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--panel-edge);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font: inherit;
  outline: none;
}
input[type="search"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.18); }

button {
  font: inherit;
  cursor: pointer;
  color: var(--ink);
}

form button {
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #1b1408;
  font-weight: 600;
}
form button:hover { filter: brightness(1.08); }

.msg { margin: 8px 0 0; min-height: 1.2em; color: var(--ink-dim); font-size: 13px; }
.msg.error { color: var(--danger); }

.status {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  color: var(--ink-dim);
  font-size: 12px;
  white-space: nowrap;
}
.status::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite alternate;
}
@keyframes pulse { from { opacity: 0.3; } to { opacity: 1; } }

.legend { left: 16px; bottom: 28px; width: 460px; padding: 12px 14px 10px; }
.legend-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 500; }
.toggles { display: flex; gap: 6px; }

.seg { display: flex; border: 1px solid var(--panel-edge); border-radius: 8px; overflow: hidden; }
.seg button, .chip {
  padding: 4px 10px;
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  font-size: 12px;
}
.chip { border: 1px solid var(--panel-edge); border-radius: 8px; }
.seg button[aria-pressed="true"], .chip[aria-pressed="true"] { background: rgba(255, 209, 102, 0.16); color: var(--accent); }

.bands { display: grid; grid-template-columns: repeat(9, 1fr); gap: 3px; margin: 10px 0 4px; padding: 0; list-style: none; }
.bands li { cursor: default; }
.bands .sw { height: 14px; border-radius: 3px; transition: transform 0.12s; }
.bands li:first-child .sw { border-radius: 7px 3px 3px 7px; }
.bands li:last-child .sw { border-radius: 3px 7px 7px 3px; }
.bands li:hover .sw { transform: scaleY(1.4); }
.bands .lb { margin-top: 4px; font-size: 10.5px; color: var(--ink-dim); text-align: center; white-space: nowrap; }

.credit { margin: 6px 0 0; font-size: 11px; color: #6c7488; }
.seg.tenure { display: inline-flex; margin-top: 8px; }

.card { right: 16px; top: 16px; width: 300px; padding: 14px 16px; pointer-events: none; }
.card h2 { margin: 0; font: 600 15px/1.3 Inter, sans-serif; }
.card .place { color: var(--ink-dim); font-size: 12px; }
.card .headline { display: flex; align-items: center; gap: 8px; margin: 10px 0 2px; font: 500 18px/1.2 Fraunces, Georgia, serif; }
.card .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.card .units { color: var(--ink-dim); font-size: 12px; margin-bottom: 10px; }
.card .row { display: grid; grid-template-columns: 74px 1fr 34px; align-items: center; gap: 8px; font-size: 11.5px; color: var(--ink-dim); }
.card .row + .row { margin-top: 3px; }
.card .track { height: 8px; background: rgba(255, 255, 255, 0.05); border-radius: 4px; overflow: hidden; }
.card .fill { height: 100%; border-radius: 4px; }
.card .pct { text-align: right; font-variant-numeric: tabular-nums; }

.pin {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.18), 0 0 18px rgba(255, 255, 255, 0.6);
  animation: ping 2.4s ease-out infinite;
}
@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55), 0 0 18px rgba(255, 255, 255, 0.6); }
  100% { box-shadow: 0 0 0 26px rgba(255, 255, 255, 0), 0 0 18px rgba(255, 255, 255, 0.6); }
}

.maplibregl-ctrl-attrib { background: rgba(5, 7, 13, 0.6) !important; color: #6c7488; font-size: 10px; }
.maplibregl-ctrl-attrib a { color: #8d95aa !important; }
.maplibregl-ctrl-group { background: var(--panel) !important; border: 1px solid var(--panel-edge); }
.maplibregl-ctrl-group button + button { border-top-color: var(--panel-edge) !important; }
.maplibregl-ctrl-icon { filter: invert(0.85); }

@media (max-width: 720px) {
  .search-panel { left: 16px; right: 16px; width: auto; padding: 14px; }
  h1 { font-size: 22px; }
  .tagline { display: none; }
  form { margin-top: 10px; }
  .legend { left: 16px; right: 16px; bottom: 34px; width: auto; }
  .bands .lb { font-size: 9px; }
  .bands li:nth-child(even) .lb { visibility: hidden; }
  .card { top: auto; bottom: 160px; left: 16px; right: 16px; width: auto; }
  .status { top: auto; bottom: 160px; }
  .maplibregl-ctrl-bottom-right .maplibregl-ctrl-group { display: none; }
}
