:root {
  --bg: #14171c;
  --panel: rgba(22, 26, 33, 0.92);
  --text: #e8ecf1;
  --muted: #9aa4b2;
  --low: #2ecc71;
  --mid: #f1c40f;
  --high: #e74c3c;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

#map {
  height: 100%;
  width: 100%;
  background: var(--bg);
}

#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: linear-gradient(to bottom, var(--panel), transparent);
  pointer-events: none;
}

.logo { font-weight: 700; font-size: 15px; text-shadow: 0 1px 4px rgba(0,0,0,.6); }

#topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.city-badge {
  color: var(--text);
  max-width: 46vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  font-size: 12px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 99px;
  padding: 4px 10px;
}

.badge.demo { color: var(--mid); }
.badge.live { color: var(--low); }

#legend {
  position: fixed;
  bottom: calc(14px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
  max-width: 96vw;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 99px;
  padding: 7px 16px;
  font-size: 11px;
  color: var(--muted);
}

.legend-sep { opacity: 0.35; }
.legend-meta { color: var(--text); font-size: 10px; }

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: -1px;
}

.dot.low { background: var(--low); }
.dot.mid { background: var(--mid); }
.dot.high { background: var(--high); }

#hint {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 14px;
  pointer-events: none;
}

.hidden { display: none; }

.leaflet-container { font: inherit; }

.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
}

.leaflet-popup-content { margin: 10px 14px; font-size: 13px; line-height: 1.5; }

.leaflet-control-zoom a {
  background: var(--panel) !important;
  color: var(--text) !important;
  border-color: rgba(255,255,255,.08) !important;
}

.leaflet-control-attribution {
  background: rgba(20, 23, 28, .7) !important;
  color: var(--muted) !important;
  font-size: 9px !important;
}

.leaflet-control-attribution a { color: var(--muted) !important; }

.cell-label-wrap {
  background: transparent !important;
  border: none !important;
}

.cell-label-wrap.leaflet-marker-icon {
  cursor: pointer;
}

.cell-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.85), 0 0 6px rgba(0,0,0,.6);
  pointer-events: none;
  user-select: none;
}

.cell-in { color: #7bed9f; font-size: 10px; min-height: 11px; }
.cell-out { color: #70a1ff; font-size: 10px; min-height: 11px; }
.cell-in-empty, .cell-out-empty { opacity: 0.35; }
.cell-now { font-size: 14px; margin: 1px 0; min-height: 16px; }
