:root {
  --bg: #0c121c;
  --panel: rgba(12, 18, 28, 0.88);
  --line: rgba(255, 255, 255, 0.12);
  --text: #e7eef8;
  --muted: #93a0b5;
  --cyan: #3ee0c5;
  --amber: #f0b429;
  --danger: #ff5d73;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg);
}

#map { position: absolute; inset: 0; background: #0b1018; }
.leaflet-container { font-family: inherit; background: #0b1018; }

.topbar, .panel, .inspector, .player, .legend, .jumps, .banner {
  position: absolute;
  z-index: 800;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.topbar {
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
}
.brand { display: flex; gap: 10px; align-items: center; min-width: 140px; }
.brand strong { display: block; letter-spacing: 0.04em; }
.brand .sub { color: var(--muted); font-size: 12px; }
.mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: radial-gradient(circle at 30% 30%, #8ff6e7, var(--cyan) 42%, #12685c);
}
#search-form { position: relative; flex: 1; }
#search {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}
#search-results {
  list-style: none;
  margin: 6px 0 0;
  padding: 6px;
  position: absolute;
  left: 0; right: 0;
  background: #121a27;
  border: 1px solid var(--line);
  border-radius: 10px;
  max-height: 240px;
  overflow: auto;
}
#search-results button {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--text);
  border: 0;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
}
#search-results button:hover { background: rgba(255,255,255,0.06); }

button.ghost, .jumps button, .player button, .speed select, #opt-color, #opt-speed {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  cursor: pointer;
}

.jumps {
  top: 76px;
  left: 12px;
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 12px;
  flex-wrap: wrap;
  max-width: min(640px, calc(100% - 24px));
}
.jumps button { padding: 6px 10px; font-size: 13px; }

.panel, .inspector {
  top: 128px;
  right: 12px;
  width: min(280px, calc(100% - 24px));
  padding: 12px 14px 14px;
  border-radius: 14px;
}
.inspector { top: auto; bottom: 108px; }
.panel-head, .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.panel h2, .inspector h2 { margin: 0; font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase; }
.row { margin: 10px 0; font-size: 14px; }
.row label { cursor: pointer; }
.row input[type="range"] { width: 120px; }
#opt-color { max-width: 160px; }
.hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.panel.is-collapsed .row, .panel.is-collapsed .hint { display: none; }

.legend {
  left: 12px;
  bottom: 108px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 12px;
  color: var(--muted);
}
.legend i {
  width: 120px; height: 8px; border-radius: 99px; display: block;
  background: linear-gradient(90deg, #2f6fed, #3ee0c5, #d6f25c, #f0b429, #ff5d73, #d946ef);
}

.player {
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
}
.player button { min-width: 42px; font-size: 16px; }
#play { min-width: 72px; }
#scrub { flex: 1; accent-color: var(--cyan); }
.time { min-width: 148px; }
.time strong { display: block; font-size: 14px; }
.time span { color: var(--muted); font-size: 12px; }
.time span.forecast { color: var(--amber); }
.speed { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }

.banner {
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 12px;
  color: #ffd0d6;
  border-color: rgba(255, 93, 115, 0.45);
  max-width: min(520px, calc(100% - 24px));
}

.cell-icon { background: transparent; border: 0; }
.cell-icon span {
  display: block;
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.35);
}

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; }
  #locate { width: 100%; }
  .panel { top: auto; bottom: 168px; }
  .jumps { display: none; }
  .legend { display: none; }
  .time { min-width: 96px; }
  .speed { display: none; }
}
