:root {
  --bg: #0b0d12;
  --panel: #12151d;
  --panel-2: #171b26;
  --line: #232838;
  --text: #e7e9ee;
  --muted: #9aa1b2;
  --accent: #ec4899;
  --accent-2: #f97316;
  --good: #22c55e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

button, input, select { font: inherit; color: inherit; }

.hidden { display: none !important; }

.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 13, 18, .92);
  backdrop-filter: blur(8px);
  position: relative;
  z-index: 1200;
}

.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-name {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: .06em;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sub { color: var(--muted); font-size: 12px; }

.top-actions { display: flex; align-items: center; gap: 12px; }
.progress-mini { color: var(--muted); font-size: 12px; white-space: nowrap; }
.progress-mini span:first-child { color: var(--text); font-weight: 600; }

.ghost-btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
}
.ghost-btn:hover { border-color: var(--accent); }

.layout { display: flex; height: calc(100% - 56px); }

.sidebar {
  width: 312px;
  min-width: 312px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 12px;
  gap: 10px;
  overflow: hidden;
}

.search-wrap { position: relative; }
#search {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  outline: none;
}
#search:focus { border-color: var(--accent); }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  z-index: 1300;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
}
.search-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,.04); }
.search-item:last-child { border-bottom: 0; }
.search-item:hover { background: rgba(236, 72, 153, .12); }
.search-item .si-name { font-weight: 600; }
.search-item .si-meta { color: var(--muted); font-size: 12px; }
.search-empty { padding: 12px; color: var(--muted); }

.quick-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.check { display: flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; user-select: none; }
.check input { accent-color: var(--accent); }
#districtFilter {
  flex: 1;
  max-width: 165px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
}

.progress-wrap { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.progress-bar { height: 6px; background: #0a0c10; border-radius: 999px; overflow: hidden; }
#progressFill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s ease; }
.progress-text { margin-top: 6px; color: var(--muted); font-size: 12px; }
.progress-text span:first-child { color: var(--text); font-weight: 600; }

.list-actions { display: flex; gap: 14px; padding: 0 2px; }
.link-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; font-size: 12px; }
.link-btn:hover { color: var(--accent); }

.category-list { flex: 1; overflow-y: auto; padding-right: 2px; }
.cat-group { margin-bottom: 10px; }
.cat-group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  padding: 6px 2px 4px;
}
.cat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}
.cat-row:hover { background: rgba(255, 255, 255, .04); }
.cat-row input { accent-color: var(--accent); }
.cat-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.cat-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.cat-visited { color: var(--good); font-size: 11px; min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }

.sidebar-footer { display: flex; gap: 8px; }
.sidebar-footer .ghost-btn { flex: 1; }

.map { flex: 1; background: #2f90b0; }

/* POI icons & clusters */
.poi-marker { display: flex; align-items: center; justify-content: center; }
.poi-marker img.poi-img {
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .65));
}
.poi-marker .poi-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, .6);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .5);
}
.poi-marker.visited { opacity: .4; filter: grayscale(.9); }
.poi-cluster {
  background: rgba(18, 21, 29, .92);
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .5);
}
.poi-cluster span { line-height: 1; }

/* Leaflet dark chrome */
.leaflet-container { background: #2f90b0; font: inherit; }
.leaflet-control-scale-line {
  background: rgba(11, 13, 18, .7) !important;
  color: #c7cbd6 !important;
  border-color: rgba(255, 255, 255, .35) !important;
  font-size: 10px !important;
  line-height: 1.4 !important;
  padding: 1px 5px !important;
}
.leaflet-control-attribution {
  background: rgba(11, 13, 18, .85) !important;
  color: var(--muted) !important;
  font-size: 11px !important;
}
.leaflet-control-attribution a { color: #c7cbd6 !important; }
.leaflet-bar a {
  background: var(--panel-2) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: #141826;
  color: var(--text);
  border: 1px solid var(--line);
}
.leaflet-popup-content { margin: 12px 14px; }
.popup-name { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.popup-unnamed { color: var(--muted); font-style: italic; }
.popup-meta { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.popup-chip {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 6px;
  margin-bottom: 4px;
  background: rgba(255, 255, 255, .08);
}
.popup-actions { display: flex; gap: 8px; margin-top: 6px; }
.popup-btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
}
.popup-btn.primary { border-color: var(--accent); color: #fff; background: rgba(236, 72, 153, .18); }
.popup-btn:hover { border-color: var(--accent); }
.popup-coords { color: var(--muted); font-size: 11px; margin-top: 6px; font-variant-numeric: tabular-nums; }

.mobile-filters { display: none; }

@media (max-width: 820px) {
  .sidebar {
    position: fixed;
    z-index: 1100;
    top: 56px;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 24px 0 60px rgba(0, 0, 0, .5);
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-filters {
    display: block;
    position: absolute;
    z-index: 1000;
    top: 68px;
    left: 12px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer;
  }
  .brand-sub { display: none; }
}