:root {
  --bg: #dfe6ec;
  --panel: rgba(255, 255, 255, 0.94);
  --text: #1d2733;
  --muted: #5b6878;
  --accent: #0b5ea8;
  --border: #c9d2dc;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

#topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 12px; background: #fff; border-bottom: 1px solid var(--border);
  z-index: 1000;
}
#topbar .logo { height: 32px; }
#topbar .title { display: flex; flex-direction: column; flex: 1; min-width: 0; }
#topbar .title span { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#topbar .back { color: var(--accent); text-decoration: none; font-size: 13px; white-space: nowrap; }
#panel-toggle { display: none; font-size: 20px; background: none; border: 0; cursor: pointer; }

#map { flex: 1; background: var(--bg); }
.leaflet-container { background: var(--bg); font: inherit; }

#panel {
  position: absolute; top: 58px; right: 10px; width: 270px; z-index: 1000;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; box-shadow: 0 2px 8px rgba(0,0,0,.12);
  display: flex; flex-direction: column; gap: 8px;
}
#panel label { display: flex; flex-direction: column; gap: 3px; font-weight: 600; font-size: 12px; }
#panel label.check { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; font-size: 13px; }
#panel select, #panel input[type=range] { width: 100%; font: inherit; font-weight: 400; }
#panel select { padding: 4px; border: 1px solid var(--border); border-radius: 4px; background: #fff; }
.muted { color: var(--muted); font-weight: 400; }
.hint { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

#legend {
  position: absolute; right: 10px; bottom: 74px; z-index: 1000;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; max-height: 42vh; overflow-y: auto; font-size: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
#legend .lt { font-weight: 600; margin-bottom: 4px; }
#legend .row { display: flex; align-items: center; gap: 6px; line-height: 15px; }
#legend .sw { width: 22px; height: 12px; border: 1px solid rgba(0,0,0,.15); flex: none; }
#legend .note { color: var(--muted); max-width: 180px; margin-top: 4px; }

#timebar {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 14px; z-index: 1000;
  width: min(760px, calc(100% - 20px));
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
#timebar button {
  display: inline-flex; align-items: center; justify-content: center; color: var(--text);
  font-size: 15px; width: 34px; height: 30px; border: 1px solid var(--border);
  border-radius: 4px; background: #fff; cursor: pointer;
}
#timebar button:hover { background: #eef3f8; }
#time { flex: 1; min-width: 160px; }
#timelabel { width: 100%; text-align: center; font-size: 13px; }
#timelabel b { color: var(--accent); }

#status {
  position: absolute; top: 58px; left: 56px; z-index: 1000;
  background: #fff4d6; border: 1px solid #e6c56f; border-radius: 6px; padding: 6px 10px; font-size: 13px;
}

/* velocity readout sits above the timebar */
.leaflet-bottom.leaflet-left { margin-bottom: 80px; }
.leaflet-control-velocity { background: var(--panel) !important; padding: 3px 6px; border-radius: 4px; font-size: 12px; }

.place-label {
  background: none; border: 0; box-shadow: none; padding: 0;
  font-size: 12px; font-weight: 600; color: #222;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff;
}
.place-label::before { display: none; }

.vpop table { border-collapse: collapse; }
.vpop td { padding: 1px 6px 1px 0; }
.vpop tr.shown td { font-weight: 700; }
.vpop .sub { color: var(--muted); font-size: 11px; }

@media (max-width: 700px) {
  #panel-toggle { display: block; }
  #topbar .back { display: none; }
  #panel { display: none; left: 10px; right: 10px; width: auto; }
  #panel.open { display: flex; }
  #legend { bottom: 96px; max-height: 30vh; }
}
