/* =====================================================================
   Tibet坐标 · 西藏文保旅游点位地图样式
   无外部字体 / 无 UI 框架依赖，纯手写，支持暗色模式与移动端
   ===================================================================== */

:root {
  --bg: #f2f3f0;
  --panel: #ffffff;
  --panel-2: #f7f7f5;
  --ink: #1c201d;
  --ink-2: #4c554f;
  --muted: #747d76;
  --line: #dde1dc;
  --line-2: #ecefeb;
  --accent: #9d2724;
  --accent-ink: #ffffff;
  --warn-bg: #fff8e1;
  --warn-line: #f0c33c;
  --warn-ink: #6b4e00;
  --focus: #1d6f56;
  --shadow: 0 8px 28px rgba(27, 36, 30, .12), 0 2px 8px rgba(27, 36, 30, .08);
  --radius: 12px;
  --topbar-h: 64px;

  /* 分类色（自定义属性也方便在 JS 里读） */
  --c-guobao: #b3261e;
  --c-world: #7b1fa2;
  --c-a5: #c2410c;
  --c-a4: #d97706;
  --c-scenic: #047857;
  --c-village: #0d9488;
  --c-oldtown: #1d4ed8;
  --c-oldvillage: #0284c7;
  --c-oldcity: #4f46e5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --panel: #1b1e23;
    --panel-2: #202429;
    --ink: #eceef1;
    --ink-2: #c3c8d0;
    --muted: #9aa2ad;
    --line: #2c3138;
    --line-2: #262a30;
    --accent: #e05555;
    --accent-ink: #1b1e23;
    --warn-bg: #3a2f12;
    --warn-line: #7a6420;
    --warn-ink: #f6dfa0;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .34);
  }
}

* {
  box-sizing: border-box;
}

/* 关键：类选择器上的 display 会覆盖 UA 的 [hidden]{display:none}，
   导致带 hidden 属性的横幅/遮罩仍然显示。这里统一兜住。 */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

html {
  height: 100dvh;
}

body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.55 "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  -webkit-text-size-adjust: 100%;
  min-height: 100svh;
  min-height: 100dvh;
  overflow: hidden;
}

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

button,
summary,
label,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 28%, transparent);
  outline-offset: 2px;
}

code {
  font-family: Consolas, "Courier New", monospace;
  font-size: .92em;
  background: var(--line-2);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ---------------- 顶部栏 ---------------- */
.topbar {
  flex: none;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: env(safe-area-inset-top) 18px 0;
  background: var(--panel);
  background: color-mix(in srgb, var(--panel) 95%, transparent);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 10px rgba(24, 32, 27, .04);
  z-index: 1300;
  backdrop-filter: blur(12px);
}

.brand {
  min-width: 0;
  flex: 1;
}

.brand h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 720;
  letter-spacing: -.15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand .sub {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.counter {
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  white-space: nowrap;
}

.counter-label {
  color: var(--muted);
  margin-right: 5px;
}

.counter strong {
  font-size: 15px;
  color: var(--accent);
  font-weight: 700;
  margin-right: 3px;
}

.dim {
  color: var(--muted);
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px 11px;
  cursor: pointer;
  color: var(--ink-2);
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}

.ghost-btn:hover {
  background: var(--panel-2);
  border-color: var(--muted);
}

.ghost-btn:active,
.icon-btn:active,
.map-tool-btn:active,
.mini:active {
  transform: translateY(1px);
}

.ghost-btn.small {
  font-size: 12px;
  padding: 4px 9px;
}

.primary-btn {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 18px;
  cursor: pointer;
  font-weight: 600;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-2);
  flex: none;
}

.only-mobile {
  display: none;
}

/* ---------------- 横幅 ---------------- */
.banner {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-bottom: 1px solid var(--warn-line);
  font-size: 12.5px;
  z-index: 39;
}

.banner code {
  background: rgba(0, 0, 0, .07);
}

.banner-close {
  margin-left: auto;
  background: none;
  border: 0;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  padding: 0 4px;
}

/* ---------------- 主体布局 ---------------- */
.layout {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

.sidebar {
  flex: none;
  width: 316px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 1200;
}

.sidebar-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 13px 14px 12px;
  border-bottom: 1px solid var(--line-2);
}

.sidebar-title {
  display: block;
  font-weight: 700;
  font-size: 14px;
}

.filter-status {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  color: var(--muted);
}

.sidebar-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 14px calc(26px + env(safe-area-inset-bottom));
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.field {
  margin-bottom: 12px;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
}

.search-wrap {
  position: relative;
}

.search-wrap svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-wrap .text-input {
  padding-left: 36px;
}

.text-input,
.select-input {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.text-input:focus,
.select-input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 14%, transparent);
  background: var(--panel);
}

.field-inline {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hint {
  margin: 5px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

/* 折叠分组 */
.group {
  border-top: 1px solid var(--line-2);
  padding: 2px 0 6px;
}

.group:first-of-type {
  border-top: 0;
}

.group>summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 10px 3px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-2);
  user-select: none;
}

.group>summary::-webkit-details-marker {
  display: none;
}

.group>summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  opacity: .65;
  transition: transform .15s;
}

.group[open]>summary::before {
  transform: rotate(90deg);
}

.group-count {
  margin-left: auto;
  font-style: normal;
  font-weight: 500;
  font-size: 11px;
  color: var(--muted);
}

.group-actions {
  display: flex;
  gap: 6px;
  padding: 0 2px 8px;
}

.mini {
  font-size: 11.5px;
  min-height: 28px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
}

.mini:hover {
  border-color: var(--muted);
  color: var(--ink-2);
}

/* 复选列表 */
.checklist {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.checklist.cols2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px 8px;
}

.check {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 5px 4px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.5px;
  line-height: 1.35;
}

.check:hover {
  background: var(--panel-2);
}

.check input {
  flex: none;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.check .lab {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.check .num {
  flex: none;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.swatch {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, .18);
}

/* 类型图标（筛选行 / 图例）：与地图标记同一套素材 */
.swatch-ico {
  flex: none;
  width: 16px;
  height: 18px;
  object-fit: contain;
  -webkit-user-drag: none;
}

/* 行政区划图层的线型色标 */
.swatch-line {
  flex: none;
  width: 16px;
  height: 0;
  border-top-width: 2px;
  border-top-style: solid;
}

.swatch-line.city {
  border-color: #6f5f86;
}

.swatch-line.county {
  border-color: #a07a52;
  border-top-style: dashed;
}

/* 行政区划图层：悬停提示 */
.leaflet-tooltip.bnd-tip {
  background: rgba(28, 26, 36, .9);
  border: 0;
  color: #fff;
  font-size: 12px;
  padding: 2px 7px;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}

.leaflet-tooltip.bnd-tip::before {
  display: none;
}

/* 快捷图例 */
.legend {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 8px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 12.5px;
  background: var(--panel-2);
  border: 1px solid transparent;
  text-align: left;
  width: 100%;
}

.legend-item:hover {
  border-color: var(--line);
  background: var(--panel);
}

.legend-item[aria-pressed="false"] {
  opacity: .52;
  text-decoration: none;
  filter: grayscale(.82);
}

.legend-item .num {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------------- 地图 ---------------- */
.mapwrap {
  flex: 1;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
  background: var(--bg);
}

.map-tools {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 900;
  display: flex;
  gap: 8px;
}

.map-tool-btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid rgba(65, 74, 68, .18);
  border-radius: 11px;
  color: var(--ink-2);
  background: var(--panel);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: 0 3px 14px rgba(23, 31, 26, .12);
  backdrop-filter: blur(12px);
  cursor: pointer;
  font-weight: 650;
}

.map-tool-btn:hover {
  background: var(--panel);
  border-color: var(--muted);
}

.map-tool-btn em {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--panel-2);
  border-radius: 999px;
  padding: 1px 6px;
}

.map-tool-icon {
  width: 40px;
  padding: 0;
}

.legend-panel {
  position: absolute;
  top: 60px;
  right: 12px;
  z-index: 910;
  width: 286px;
  max-height: calc(100% - 84px);
  overflow-y: auto;
  padding: 13px;
  border: 1px solid rgba(65, 74, 68, .16);
  border-radius: 14px;
  color: var(--ink);
  background: var(--panel);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.legend-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.legend-head strong,
.legend-head span {
  display: block;
}

.legend-head strong {
  font-size: 14px;
}

.legend-head span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.legend-head .icon-btn {
  width: 32px;
  height: 32px;
}

.legend-actions {
  display: flex;
  gap: 6px;
  margin: 10px 0 8px;
}

.legend-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.legend-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line-2);
}

.boundary-quick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.boundary-quick-item {
  min-width: 0;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--ink-2);
  background: var(--panel-2);
  cursor: pointer;
  font-size: 12px;
}

.boundary-quick-item:hover {
  border-color: var(--line);
}

.boundary-quick-item[aria-pressed="false"] {
  opacity: .5;
}

.boundary-quick-item em {
  margin-left: auto;
  color: var(--muted);
  font-size: 10.5px;
  font-style: normal;
}

.legend-note {
  margin: 7px 2px 0;
  color: var(--muted);
  font-size: 10.5px;
}

.mobile-about {
  width: 100%;
  margin-top: 14px;
}

.map-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
  padding: 24px;
  z-index: 500;
}

.mapscale-note {
  position: absolute;
  right: 8px;
  bottom: 6px;
  z-index: 420;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--ink-2);
  background: rgba(255, 255, 255, .9);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 7px;
  max-width: 62%;
  text-align: right;
  pointer-events: none;
}

.leaflet-bar a {
  color: var(--ink-2);
}

.leaflet-control-zoom a {
  width: 34px;
  height: 34px;
  line-height: 34px;
}

/* 自定义标记：28x32 位图图标（img/pin-<code>.png，资源 112x128，4 倍图） */
.pin {
  width: 28px;
  height: 32px;
  position: relative;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .32));
}

/* 内联 SVG 仅在该类型图标缺失时兜底，二者不会同时可见 */
.pin svg,
.pin img {
  display: block;
  width: 28px;
  height: 32px;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* 低精度弱化模式（config.LOW_PRECISION_MODE = "faded" 时启用，默认 "plain"） */
.pin.faded {
  opacity: .78;
}

.pin.faded img {
  filter: grayscale(.7) contrast(.92);
}

/* 聚合簇 */
.cluster-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .72), 0 2px 6px rgba(0, 0, 0, .28);
  letter-spacing: -.3px;
}

@media (prefers-color-scheme: dark) {
  .cluster-icon {
    box-shadow: 0 0 0 3px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .5);
  }
}

/* 弹窗 */
.leaflet-popup-content {
  margin: 0;
  width: 324px !important;
}

/* 设计稿：卡片自带内边距与圆角，leaflet 外框只留投影。
   ⚠️ Leaflet 默认把 wrapper 背景写死为 #fff、文字写死为 #333，
   不跟随主题。必须显式接到 --panel / --ink，否则深色主题下卡片会是白底黑字。 */
.leaflet-popup-content-wrapper {
  border-radius: 14px;
  padding: 0;
  overflow: hidden;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}

/* 小三角同样跟随卡片底色，否则深色下会露出白尖 */
.leaflet-popup-tip {
  background: var(--panel);
}

/* 关闭按钮跟随主题 */
.leaflet-container a.leaflet-popup-close-button {
  color: var(--muted);
}

.leaflet-container a.leaflet-popup-close-button:hover {
  color: var(--ink);
}

.pop {
  padding: 14px 15px 13px;
}

.leaflet-popup-content p {
  margin: 0;
}

@media (max-width: 420px) {
  .leaflet-popup-content {
    width: 258px !important;
  }
}

/* 深色主题：分类色提亮一档
   （色块与胶囊都用 --cat 作底，深色背景下原始分类色对比度偏低） */
@media (prefers-color-scheme: dark) {
  .pop .pop-mark,
  .pop .pop-pill {
    background: var(--cat-dark, var(--cat));
  }
}

/* ---------- 信息卡片 ---------- */

/* 标题：色块 + 名称 */
.pop-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 20px;
}

.pop-mark {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  border-radius: 4px;
  background: var(--cat, var(--accent));
}

.pop h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -.2px;
  color: var(--ink);
}

/* 标签行 */
.pop-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.pop-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--cat, var(--accent));
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.pop-tail {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* 地区面包屑 */
.pop-crumbs {
  margin-top: 9px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.45;
}

.pop-crumbs .sep {
  color: var(--line);
  font-style: normal;
  font-weight: 400;
  padding: 0 3px;
}

/* 关键字段 */
.pop-rows {
  margin: 12px 0 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 18px;
  align-items: baseline;
}

.pop-rows dt {
  font-size: 13.5px;
  color: var(--muted);
  white-space: nowrap;
}

.pop-rows dd {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.pop-rows dd .em {
  color: var(--ink-2);
}

.pop-rows dd .num {
  font-variant-numeric: tabular-nums;
  letter-spacing: .1px;
}

/* 溯源信息块 */
.pop-src {
  margin-top: 13px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 8px;
  font-size: 12.5px;
  line-height: 1.5;
}

.pop-src .k {
  color: var(--muted);
  white-space: nowrap;
}

.pop-src .v {
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.pop .note {
  margin-top: 9px;
  padding: 7px 9px;
  border-radius: 7px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-2);
  max-height: 168px;
  overflow-y: auto;
  overflow-wrap: anywhere;
}

.pop .warnbox {
  margin-top: 10px;
  padding: 6px 9px;
  border-radius: 7px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn-ink);
  font-size: 11.5px;
}

.pop .src {
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--muted);
}

.pop .src a {
  color: var(--focus);
}

/* 主按钮行：小红书 / 抖音 */
.pop .acts {
  display: flex;
  gap: 9px;
  margin-top: 13px;
}

.pop .acts a {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 700;
  padding: 10px 8px;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: filter .15s ease;
}

.pop .acts a:hover {
  filter: brightness(1.08);
}

.pop .acts a.xhs {
  background: #ff2442;
  color: #fff;
}

.pop .acts a.dy {
  background: var(--ink);
  color: var(--panel);
}

/* 次级操作 */
.pop .acts-sub {
  display: flex;
  margin-top: 7px;
}

.pop .acts-sub button {
  flex: 0 0 auto;
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}

.pop .acts-sub button:hover {
  border-color: var(--muted);
  color: var(--ink-2);
}

/* ---------------- 对话框 ---------------- */
.dlg {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--ink);
  padding: 0;
  max-width: 640px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow);
}

.dlg::backdrop {
  background: rgba(0, 0, 0, .42);
}

.dlg form {
  padding: 20px 22px 16px;
  max-height: 78vh;
  overflow-y: auto;
}

.dlg h2 {
  margin: 0 0 12px;
  font-size: 17px;
}

.dlg h3 {
  margin: 16px 0 6px;
  font-size: 13px;
  color: var(--accent);
}

.dlg ul {
  margin: 0;
  padding-left: 20px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.dlg li {
  margin: 3px 0;
}

.dlg-foot {
  margin-top: 18px;
  text-align: right;
}

/* ---------------- 遮罩（移动端抽屉） ---------------- */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .38);
  z-index: 1100;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  :root {
    --topbar-h: 56px;
  }

  .topbar {
    gap: 10px;
    padding-right: 10px;
    padding-left: max(10px, env(safe-area-inset-left));
  }

  .only-mobile {
    display: inline-flex;
  }

  .brand h1 {
    font-size: 15px;
  }

  .brand .sub {
    display: none;
  }

  #aboutBtn {
    padding: 6px 9px;
    font-size: 12px;
  }

  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    width: min(92vw, 360px);
    transform: translateX(-101%);
    transition: transform .24s cubic-bezier(.22, .8, .32, 1);
    box-shadow: var(--shadow);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mapscale-note {
    max-width: 74%;
    font-size: 10px;
  }

  .map-tools {
    top: 10px;
    right: max(10px, env(safe-area-inset-right));
  }

  .map-tool-btn {
    min-height: 42px;
  }

  .legend-panel {
    top: 62px;
    right: max(10px, env(safe-area-inset-right));
    width: min(306px, calc(100% - 20px));
    max-height: calc(100% - 86px - env(safe-area-inset-bottom));
  }

  .check {
    min-height: 42px;
  }

  .mini {
    min-height: 36px;
  }

  .ghost-btn,
  .primary-btn,
  .icon-btn,
  .text-input,
  .select-input {
    min-height: 42px;
  }

  .leaflet-control-zoom a {
    width: 40px;
    height: 40px;
    line-height: 40px;
  }
}

@media (max-width: 520px) {
  .brand h1 {
    font-size: 14px;
  }

  .counter {
    min-width: 44px;
    padding: 6px 9px;
    text-align: center;
    font-size: 11.5px;
  }

  .counter strong {
    font-size: 14px;
    margin: 0;
  }

  .counter-label,
  .counter .dim {
    display: none;
  }

  #aboutBtn {
    display: none;
  }

  .map-tool-btn span {
    display: none;
  }

  .map-tool-btn {
    padding: 0 9px;
  }

  .map-tool-icon {
    width: 42px;
  }

  .legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }

  .legend-item {
    min-width: 0;
    align-items: flex-start;
  }

  .legend-item .lab {
    line-height: 1.25;
  }

  .legend-item .num {
    display: none;
  }

  .mapscale-note {
    right: 6px;
    bottom: max(5px, env(safe-area-inset-bottom));
    max-width: calc(100% - 70px);
  }
}

/* =====================================================================
   轻量查询界面：地图全屏、搜索优先、筛选按需出现
   ===================================================================== */
:root {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --panel-2: #f5f5f7;
  --ink: #1d1d1f;
  --ink-2: #515154;
  --muted: #7d7d82;
  --line: rgba(29, 29, 31, .1);
  --line-2: rgba(29, 29, 31, .075);
  --accent: #8f2424;
  --focus: #0071e3;
  --topbar-h: 64px;
  --shadow: 0 18px 50px rgba(20, 20, 24, .14), 0 2px 12px rgba(20, 20, 24, .08);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  height: var(--topbar-h);
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .88);
  box-shadow: none;
  backdrop-filter: saturate(180%) blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand-mark {
  flex: none;
  width: 22px;
  height: 25px;
  object-fit: contain;
}

.brand h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.35px;
}

.brand .sub {
  margin-top: -1px;
  font-size: 10.5px;
}

.topbar-right {
  gap: 8px;
}

.counter {
  padding: 5px 11px;
  border: 0;
  background: var(--panel-2);
}

.layout,
.mapwrap {
  width: 100%;
}

.sidebar {
  position: absolute;
  top: 82px;
  bottom: auto;
  left: 16px;
  width: 360px;
  max-height: calc(100% - 104px);
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(150%) blur(24px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(.985);
  transform-origin: top left;
  transition: opacity .18s ease, transform .2s cubic-bezier(.22, .8, .32, 1);
}

.sidebar.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.sidebar-head {
  padding: 15px 16px 13px;
}

.sidebar-title {
  font-size: 15px;
  letter-spacing: -.15px;
}

.panel-body {
  padding: 10px 16px 18px;
}

.panel-intro {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.group {
  padding: 2px 0 7px;
}

.group>summary {
  min-height: 44px;
  padding: 10px 2px;
  font-size: 13px;
}

#f_type {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

#f_type .check {
  position: relative;
  min-width: 0;
  min-height: 48px;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--panel-2);
}

#f_type .check input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}

#f_type .check:has(input:checked) {
  border-color: rgba(143, 36, 36, .2);
  background: rgba(143, 36, 36, .07);
}

#f_type .check:not(:has(input:checked)) {
  opacity: .48;
  filter: grayscale(.8);
}

#f_type .lab {
  font-size: 11.5px;
  line-height: 1.25;
}

#f_type .num {
  display: none;
}

.search-dock {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 900;
  width: min(520px, calc(100% - 330px));
  min-width: 360px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(29, 29, 31, .1);
  border-radius: 18px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 8px 30px rgba(20, 20, 24, .12), 0 1px 4px rgba(20, 20, 24, .06);
  backdrop-filter: saturate(180%) blur(20px);
}

.search-dock .search-wrap {
  flex: 1;
  min-width: 0;
}

.search-dock .text-input {
  height: 40px;
  padding: 8px 8px 8px 36px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font-size: 14px;
}

.search-dock .text-input:focus {
  box-shadow: none;
  background: var(--panel-2);
}

.filter-btn {
  flex: none;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: #1d1d1f;
  color: #fff;
  cursor: pointer;
  font-weight: 650;
}

.filter-btn em {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #fff;
  color: #1d1d1f;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
  font-style: normal;
}

.search-result-hint {
  position: absolute;
  top: calc(100% + 8px);
  left: 10px;
  margin: 0;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(29, 29, 31, .82);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
  font-size: 11px;
  backdrop-filter: blur(10px);
}

.map-tools {
  top: 16px;
  right: 16px;
}

.map-tool-btn {
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid rgba(29, 29, 31, .1);
  border-radius: 16px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 8px 26px rgba(20, 20, 24, .11), 0 1px 4px rgba(20, 20, 24, .05);
  backdrop-filter: saturate(180%) blur(20px);
}

.map-tool-icon {
  width: 52px;
  padding: 0;
}

.legend-panel {
  top: 80px;
  right: 16px;
  width: 310px;
  max-height: calc(100% - 104px);
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(160%) blur(24px);
}

.legend-head strong {
  font-size: 15px;
}

.legend-head span {
  font-size: 11.5px;
}

.legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.legend-item {
  min-height: 46px;
  align-items: flex-start;
  padding: 7px 9px;
  border-radius: 12px;
}

.legend-item .lab {
  font-size: 11.5px;
  line-height: 1.24;
}

.legend-item .num {
  display: none;
}

.map-settings-panel {
  width: 292px;
}

.settings-label {
  margin: 16px 1px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.basemap-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.basemap-options button {
  min-height: 58px;
  padding: 8px 5px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--ink-2);
  cursor: pointer;
}

.basemap-options button strong,
.basemap-options button span {
  display: block;
}

.basemap-options button strong {
  font-size: 12px;
}

.basemap-options button span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.basemap-options button[aria-pressed="true"] {
  border-color: #1d1d1f;
  background: #1d1d1f;
  color: #fff;
}

.basemap-options button[aria-pressed="true"] span {
  color: rgba(255, 255, 255, .65);
}

.basemap-health {
  margin: 7px 2px 0;
  color: var(--muted);
  font-size: 10.5px;
}

.settings-switches {
  gap: 6px;
}

.switch-row {
  min-height: 44px;
  padding: 7px 9px;
  border-radius: 12px;
  background: var(--panel-2);
}

.switch-row input {
  position: relative;
  width: 34px;
  height: 20px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  appearance: none;
  background: #d1d1d6;
  transition: background .18s ease;
}

.switch-row input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform .18s ease;
}

.switch-row input:checked {
  background: #34c759;
}

.switch-row input:checked::after {
  transform: translateX(14px);
}

.backdrop {
  background: transparent;
}

.leaflet-control-zoom {
  border: 0 !important;
  border-radius: 14px !important;
  box-shadow: 0 8px 22px rgba(20, 20, 24, .12) !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  width: 42px;
  height: 42px;
  line-height: 42px;
  border-color: var(--line) !important;
}

.mapscale-note {
  right: auto;
  left: 12px;
  bottom: 10px;
  max-width: 54%;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, .82);
  color: var(--muted);
  text-align: left;
  backdrop-filter: blur(12px);
}

@media (max-width: 900px) {
  :root {
    --topbar-h: 56px;
  }

  .topbar {
    padding: 0 max(10px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  }

  .brand-mark {
    display: none;
  }

  .brand h1 {
    font-size: 15px;
  }

  .search-dock {
    top: 10px;
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    width: auto;
    min-width: 0;
    border-radius: 16px;
  }

  .filter-btn {
    min-height: 42px;
  }

  .map-tools {
    top: 72px;
    right: max(10px, env(safe-area-inset-right));
  }

  .map-tool-btn {
    min-height: 44px;
    border-radius: 14px;
  }

  .map-tool-icon {
    width: 44px;
  }

  .legend-panel {
    top: 126px;
    right: max(10px, env(safe-area-inset-right));
    width: min(310px, calc(100% - 20px));
    max-height: calc(100% - 148px - env(safe-area-inset-bottom));
  }

  .sidebar {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: min(78dvh, 720px);
    border: 0;
    border-radius: 24px 24px 0 0;
    opacity: 1;
    transform: translateY(103%);
    transform-origin: bottom center;
    transition: transform .26s cubic-bezier(.22, .8, .32, 1);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .sidebar.open {
    transform: translateY(0);
  }

  .backdrop {
    background: rgba(0, 0, 0, .28);
    backdrop-filter: blur(2px);
  }

  .mapscale-note {
    right: auto;
    left: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    max-width: calc(100% - 74px);
  }
}

@media (max-width: 520px) {
  .brand h1 {
    font-size: 14.5px;
  }

  #aboutBtn {
    display: inline-flex;
  }

  .topbar-right {
    gap: 5px;
  }

  .counter {
    min-width: 42px;
  }

  .search-dock .text-input {
    font-size: 13px;
  }

  .filter-btn {
    padding: 0 10px;
  }

  .filter-btn span {
    display: none;
  }

  .map-tool-btn {
    padding: 0 10px;
  }

  .map-tool-btn span {
    display: none;
  }

  #f_type {
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* 打印：只出地图 */
@media print {
  .topbar,
  .sidebar,
  .banner,
  .backdrop,
  .mapscale-note {
    display: none !important;
  }
}
