:root {
  --bg: #0f172a;
  --panel: rgba(15, 23, 42, 0.96);
  --card: rgba(255, 255, 255, 0.08);
  --card-border: rgba(255, 255, 255, 0.12);
  --text: #f8fafc;
  --muted: #a8b3c7;
  --accent: #facc15;
  --green: #22c55e;
  --shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
  --radius-lg: 22px;
  --radius-md: 14px;
  --sidebar-width: 390px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}
button, input { font: inherit; }
button { cursor: pointer; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  width: 100%;
  height: 100vh;
  background: var(--bg);
  transition: grid-template-columns .22s ease;
}
body.sidebar-collapsed .app-shell { grid-template-columns: 0 1fr; }
body.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
  padding-left: 0;
  padding-right: 0;
  overflow: hidden;
  border-right-color: transparent;
}

.sidebar {
  position: relative;
  z-index: 600;
  height: 100vh;
  padding: 22px;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(15,23,42,.98), rgba(15,23,42,.92));
  border-right: 1px solid rgba(255,255,255,.12);
  box-shadow: var(--shadow);
  transition: transform .22s ease, padding .22s ease, border-color .22s ease;
}
.sidebar::-webkit-scrollbar { width: 10px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(148,163,184,.35); border-radius: 999px; }
.sidebar__header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-weight: 800;
}
h1 {
  margin: 0;
  font-size: 29px;
  line-height: 1.05;
  letter-spacing: -0.04em;
}
.sidebar__close { display: none; }

.card {
  padding: 16px;
  margin: 14px 0;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  background: var(--card);
  backdrop-filter: blur(18px);
}
.field-label, .section-title {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  color: #e2e8f0;
  font-weight: 750;
}
.search-row { display: flex; gap: 8px; }
.search-input {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--radius-md);
  outline: none;
  color: var(--text);
  background: rgba(15,23,42,.76);
}
.search-input:focus { border-color: rgba(250,204,21,.75); box-shadow: 0 0 0 3px rgba(250,204,21,.12); }
.search-hint { margin-top: 10px; color: var(--muted); font-size: 12px; }
.btn {
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 13px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(255,255,255,.08);
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); background: rgba(255,255,255,.13); border-color: rgba(255,255,255,.22); }
.btn:active { transform: translateY(0); }
.btn--ghost { white-space: nowrap; }
.btn--glass {
  background: rgba(15, 23, 42, .78);
  border-color: rgba(255,255,255,.18);
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  backdrop-filter: blur(12px);
}
.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  color: var(--text);
  background: rgba(255,255,255,.09);
}

.list-card__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.point-list { display: grid; gap: 8px; max-height: calc(100vh - 260px); overflow-y: auto; padding-right: 2px; }
.point-list::-webkit-scrollbar { width: 8px; }
.point-list::-webkit-scrollbar-thumb { background: rgba(148,163,184,.32); border-radius: 999px; }
.point-empty {
  padding: 12px;
  border: 1px dashed rgba(255,255,255,.14);
  border-radius: 16px;
  color: var(--muted);
  background: rgba(15,23,42,.35);
  line-height: 1.4;
}
.point-item {
  width: 100%;
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 10px;
  text-align: left;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 16px;
  padding: 11px;
  color: var(--text);
  background: rgba(15,23,42,.5);
}
.point-item:hover, .point-item.is-active { border-color: rgba(250,204,21,.5); background: rgba(255,255,255,.1); }
.point-item__name { display: block; font-weight: 850; line-height: 1.2; }
.point-item__meta { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(255,255,255,.16);
  flex: 0 0 auto;
}
.dot--green { background: var(--green); }

.map-area { position: relative; min-width: 0; }
.map {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: #dbeafe;
  cursor: grab;
  touch-action: none;
  overscroll-behavior: contain;
  user-select: none;
  -webkit-user-select: none;
}
.map.is-dragging { cursor: grabbing; }
.map.is-pinching { cursor: zoom-in; }

.osm-pane {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
}
.osm-tile-pane { z-index: 1; }
.osm-marker-pane { z-index: 2; }
.osm-popup-pane {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  transform-origin: 0 0;
}
.osm-tile {
  position: absolute;
  width: 256px;
  height: 256px;
  max-width: none;
  max-height: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.osm-marker {
  position: absolute;
  z-index: 3;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 4px 14px rgba(15,23,42,.28), 0 0 0 3px rgba(34,197,94,.22);
  transform: translate(-50%, -50%);
  transition: width .12s ease, height .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.osm-marker.is-hovered,
.osm-marker:hover,
.osm-marker.is-selected {
  width: 24px;
  height: 24px;
  border-width: 3px;
  box-shadow: 0 8px 22px rgba(15,23,42,.34), 0 0 0 4px rgba(250,204,21,.32);
}
.osm-marker.is-selected { border-color: #facc15; }

.osm-zoom-control {
  position: absolute;
  right: 18px;
  bottom: 24px;
  z-index: 10;
  display: grid;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15,23,42,.22);
}
.osm-zoom-control button {
  width: 42px;
  height: 42px;
  border: 0;
  border-bottom: 1px solid rgba(15,23,42,.12);
  color: #0f172a;
  background: rgba(255,255,255,.95);
  font-size: 25px;
  font-weight: 800;
  line-height: 1;
}
.osm-zoom-control button:last-child { border-bottom: 0; }
.osm-zoom-control button:hover { background: #f8fafc; }

.osm-attribution {
  position: absolute;
  right: 8px;
  bottom: 4px;
  z-index: 9;
  padding: 2px 6px;
  border-radius: 4px;
  color: #1f2937;
  background: rgba(255,255,255,.86);
  font-size: 11px;
  line-height: 1.35;
}
.osm-attribution a { color: #1d4ed8; text-decoration: none; }
.osm-attribution a:hover { text-decoration: underline; }

.map-topbar {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  z-index: 500;
  display: flex;
  gap: 12px;
  align-items: center;
  pointer-events: none;
}
.map-topbar > * { pointer-events: auto; }

.home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
}
.map-title {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 16px;
  color: var(--text);
  background: rgba(15,23,42,.78);
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  backdrop-filter: blur(12px);
}
.map-title span { color: var(--muted); font-size: 12px; }

.legend { display: none !important; }
.loading {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 700;
  transform: translate(-50%, -50%);
  padding: 14px 18px;
  border-radius: 16px;
  color: var(--text);
  background: rgba(15,23,42,.9);
  box-shadow: var(--shadow);
}
.loading.is-hidden { display: none; }
.loading.is-error { background: rgba(127,29,29,.95); }

.osm-popup {
  position: absolute;
  min-width: 220px;
  max-width: 290px;
  padding: 14px 15px 13px;
  border-radius: 14px;
  color: #0f172a;
  background: #ffffff;
  box-shadow: 0 14px 40px rgba(15,23,42,.28);
  transform: translate(-50%, calc(-100% - 18px));
  pointer-events: auto;
}
.osm-popup::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -9px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  transform: translateX(-50%) rotate(45deg);
}
.osm-popup h3 {
  margin: 0 28px 8px 0;
  font-size: 19px;
  line-height: 1.15;
}
.osm-popup__close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  color: #334155;
  background: #f1f5f9;
  font-size: 18px;
  line-height: 1;
}
.osm-popup__meta {
  margin: 10px 0;
  font-size: 13px;
  color: #334155;
}
.osm-popup__links {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 12px;
}
.osm-popup__links a {
  color: #1d4ed8;
  text-decoration: none;
  font-weight: 750;
}
.osm-popup__links a:hover { text-decoration: underline; }

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 9999;
  color: white;
  background: #0f172a;
}

@media (max-width: 1100px) {
  :root { --sidebar-width: 360px; }
}

@media (max-width: 840px) {
  body { overflow: hidden; }
  .app-shell { grid-template-columns: 1fr; }
  body.sidebar-collapsed .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    top: auto;
    width: auto;
    height: min(76vh, 620px);
    padding: 16px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 24px;
    transform: translateY(calc(100% + 20px));
    transition: transform .22s ease;
  }
  .sidebar.is-open { transform: translateY(0); }
  .sidebar__close { display: inline-grid; }
  .sidebar__header { margin-bottom: 12px; }
  h1 { font-size: 23px; }
  .card { padding: 13px; margin: 10px 0; border-radius: 18px; }
  .search-row { gap: 7px; }
  .search-input { padding: 11px 12px; }
  .btn { padding: 10px; }
  .point-list { max-height: calc(76vh - 245px); }
  .map-topbar { top: calc(12px + env(safe-area-inset-top)); left: 12px; right: 12px; flex-wrap: wrap; }
  .map-title { display: none; }
  .osm-zoom-control { right: 12px; bottom: calc(22px + env(safe-area-inset-bottom)); }
  .osm-popup { min-width: 200px; max-width: 245px; }
  .osm-popup__links a { padding: 4px 0; }
}
