:root {
  --bg: #0c0a09;
  --bg-1: #1c1917;
  --bg-2: #292524;
  --line: rgba(255,255,255,0.1);
  --text: #fef3c7;
  --text-dim: rgba(254, 243, 199, 0.65);
  --accent: #fbbf24;
  --green: #84cc16;
  --red: #dc2626;
  --blue: #38bdf8;
  --purple: #a855f7;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, system-ui, sans-serif; font-size: 14px; height: 100%; overflow: hidden; }

#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(28, 25, 23, 0.95); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.brand {
  font-weight: 700; font-size: 16px; white-space: nowrap;
}
.brand span {
  background: linear-gradient(90deg, var(--accent), #f59e0b);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.search-wrap {
  display: flex; gap: 6px; flex: 1; min-width: 200px; max-width: 420px;
}
#search {
  flex: 1; background: var(--bg-1); border: 1px solid var(--line); color: var(--text);
  padding: 7px 12px; border-radius: 7px; font-size: 13px; outline: none;
}
#search:focus { border-color: var(--accent); }
#locate, .icon-btn {
  background: var(--bg-1); border: 1px solid var(--line); color: var(--text);
  padding: 6px 10px; border-radius: 7px; cursor: pointer; font-size: 14px;
}
#locate:hover { background: var(--bg-2); }
.legend {
  display: flex; gap: 10px; font-size: 11px; color: var(--text-dim); flex-wrap: wrap;
}
.legend .li { display: flex; align-items: center; gap: 4px; }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; }

#map {
  position: absolute;
  top: 60px;
  left: 0; right: 0; bottom: 0;
  background: #1c1917;
}

#hint {
  position: fixed;
  top: 75px; left: 50%; transform: translateX(-50%);
  background: rgba(28, 25, 23, 0.95);
  border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 50px;
  font-size: 12px; color: var(--text-dim);
  pointer-events: none;
  z-index: 999;
  max-width: 90vw;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity .2s;
}
#hint.hidden { opacity: 0; }

.status {
  position: fixed;
  bottom: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(28, 25, 23, 0.95);
  border: 1px solid var(--accent);
  padding: 8px 16px; border-radius: 50px;
  font-size: 12px; z-index: 999;
  display: none;
}
.status.show { display: block; }
.status.spinner::before {
  content: ''; display: inline-block; width: 10px; height: 10px;
  border: 2px solid var(--accent); border-top-color: transparent;
  border-radius: 50%; margin-right: 8px; vertical-align: -1px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Marker popups */
.leaflet-popup-content-wrapper {
  background: var(--bg-1) !important; color: var(--text) !important;
  border: 1px solid var(--line);
  border-radius: 10px !important;
}
.leaflet-popup-tip { background: var(--bg-1) !important; }
.leaflet-popup-content { font-family: inherit; margin: 12px 14px !important; min-width: 200px; }
.popup h3 { margin: 0 0 4px; font-size: 15px; color: var(--accent); }
.popup .meta { font-size: 11px; color: var(--text-dim); margin-bottom: 8px; }
.popup .services {
  display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px;
}
.popup .svc {
  font-size: 11px; padding: 2px 7px; border-radius: 50px;
  background: var(--bg-2); border: 1px solid var(--line);
  display: inline-flex; align-items: center; gap: 3px;
}
.popup .svc.yes { background: rgba(132,204,22,0.15); border-color: rgba(132,204,22,0.35); color: var(--green); }
.popup .svc.no { opacity: 0.4; text-decoration: line-through; }
.popup .links { display: flex; gap: 6px; margin-top: 6px; }
.popup .links a {
  font-size: 11px; padding: 3px 8px; border-radius: 5px;
  background: var(--bg-2); border: 1px solid var(--line);
  color: var(--accent); text-decoration: none;
}
.popup .links a:hover { background: var(--bg); }

/* Custom div markers */
.custom-marker {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid white; display: grid; place-items: center;
  font-size: 14px; box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.custom-marker.services    { background: var(--green); }
.custom-marker.rest_area   { background: var(--blue); }
.custom-marker.truck_stop  { background: var(--accent); color: #0c0a09; }
.custom-marker.fuel        { background: var(--red); }

.leaflet-tile-pane { filter: brightness(0.7) saturate(0.8); }
.leaflet-control-attribution { background: rgba(0,0,0,0.7) !important; color: #999 !important; font-size: 9px !important; }
.leaflet-control-attribution a { color: var(--accent) !important; }

@media (max-width: 600px) {
  #topbar { padding: 8px 10px; gap: 6px; }
  .brand { font-size: 14px; }
  .legend { display: none; }
  #hint { font-size: 11px; top: 110px; padding: 6px 12px; }
  #map { top: 110px; }
}
