:root {
  --primary: #0f4c81;
  --primary-dark: #093a63;
  --accent: #d7452f;
  --bg: #eef3f8;
  --card: #ffffff;
  --text: #1f2d3d;
  --muted: #708090;
  --line: #e3eaf2;
  --radius: 14px;
  --shadow: 0 6px 18px rgba(15, 76, 129, 0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overscroll-behavior-y: none;
}

/* 锁定视口：地图铺满，列表作为底部面板浮在地图上 */
body { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ---------- 顶部标题栏 ---------- */
.app-bar {
  position: relative;
  z-index: 30;
  background: linear-gradient(135deg, var(--primary) 0%, #1565a8 100%);
  color: #fff;
  padding: 16px 18px 12px;
  box-shadow: 0 3px 12px rgba(15, 76, 129, 0.28);
}
.app-title { font-size: 21px; font-weight: 800; letter-spacing: 1px; }
.app-title-accent { color: #ffd76a; margin: 0 2px; }
.app-subtitle { margin-top: 4px; font-size: 12px; opacity: 0.9; letter-spacing: 0.4px; }

/* ---------- 筛选条（吸顶，始终在地图上方） ---------- */
.filter-bar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* 手机端：强制筛选条进入独立 GPU 合成层，避免被地图 <canvas> 盖住 */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.chip {
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: #f6f9fc;
  color: var(--text);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: all .18s ease;
}
.chip.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 600;
}

/* ---------- 距离筛选条（我的位置 + 半径） ---------- */
.near-bar {
  position: relative;
  z-index: 22;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.near-locate {
  flex-shrink: 0;
  border: none;
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.near-manual {
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: #f6f9fc;
  color: var(--text);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
}
.near-radii { display: flex; gap: 6px; }
.radius-chip { padding: 6px 12px; font-size: 12px; }
.near-clear {
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
}

/* 手动输入坐标 */
.near-coord {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 16px;
  background: #f6f9fc;
  border-bottom: 1px solid var(--line);
}
.near-coord[hidden] { display: none; }
.near-coord input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  background: #fff;
  color: var(--text);
}
.near-coord button {
  border: none;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}

/* 地图上的提示条（点选位置 / 附近数量） */
.near-hint {
  position: absolute;
  top: 86px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  background: rgba(255,255,255,0.97);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12px;
  color: var(--primary-dark);
  box-shadow: var(--shadow);
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.near-hint[hidden] { display: none; }

/* ---------- 地图（铺满剩余空间） ---------- */
/* isolation 把 ECharts <canvas> 的合成层锁在低层级；overflow:hidden 裁剪画布，
   使其不会越过筛选条盖住按钮。 */
.map-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  z-index: 0;
  isolation: isolate;
  overflow: hidden;
  background: #dce9f5;
}
#map { width: 100%; height: 100%; touch-action: none; }

.map-legend {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 6;
  background: rgba(255,255,255,0.92);
  border-radius: 10px;
  padding: 8px 12px;
  box-shadow: var(--shadow);
  font-size: 12px;
  line-height: 1.7;
}
.map-legend .lg { display: flex; align-items: center; gap: 6px; }
.map-legend .lg-dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}

/* 缩放按钮（移到右上角，避免被底部点位列表面板盖住） */
.map-zoom {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.zoom-btn {
  width: 40px; height: 40px;
  border: none; border-radius: 10px;
  background: rgba(255,255,255,0.94);
  color: var(--primary);
  font-size: 22px; font-weight: 700; line-height: 1;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.zoom-btn:active { background: #eef5fc; }

/* ---------- 底部列表（默认收起，上拉展开） ---------- */
.list-panel {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  /* 高于 near-bar(22)/filter-bar(25) 之下的控件，保证拖拽柄可见、可下拉
     （高度由 JS 按视口实际测量后动态设置为「工具栏下方」，避免 iOS Safari 用
       大 vh 计算导致面板顶部被工具栏盖住、无法拖下的问题） */
  z-index: 24;
  display: flex;
  flex-direction: column;
  height: 78vh;
  background: var(--card);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -6px 20px rgba(15,76,129,0.12);
  transform: translateY(calc(100% - 56px)); /* 默认只露出 56px 拖拽柄 */
  transition: transform .28s ease;
  will-change: transform;
}
.list-panel.open { transform: translateY(0); }

.sheet-handle {
  flex-shrink: 0;
  height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none; /* 允许在柄上拖拽，不触发页面/列表滚动 */
}
.sheet-grabber {
  width: 42px; height: 5px; border-radius: 3px;
  background: #cfd8e3;
}
.sheet-hint { font-size: 12px; color: var(--muted); }

.list-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 16px 12px;
}
.list-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px;
}
.list-title { font-size: 16px; font-weight: 700; color: var(--primary-dark); }
.list-tip { font-size: 12px; color: var(--muted); }

.spot-list { list-style: none; }
.spot-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s ease;
}
.spot-card:active { background: #f2f7fc; }
.spot-card:last-child { border-bottom: none; }
.spot-dot {
  width: 34px; height: 34px; border-radius: 50%;
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; flex-shrink: 0;
}
.spot-info { flex: 1; min-width: 0; }
.spot-name { font-size: 15px; font-weight: 600; }
.spot-admin { font-size: 12px; color: var(--muted); margin-top: 2px; }
.spot-tag {
  flex-shrink: 0;
  font-size: 11px;
  color: #fff;
  padding: 3px 9px;
  border-radius: 999px;
}
.spot-empty { text-align: center; color: var(--muted); padding: 18px 0; font-size: 13px; }

.page-foot {
  text-align: center; font-size: 11px; color: #9aa9b8;
  padding: 12px 0 18px;
}

/* ---------- 详情弹层 ---------- */
.sheet-mask {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(10,30,55,0.45);
  display: none;
  align-items: flex-end;
}
.sheet-mask.show { display: flex; }
.sheet {
  width: 100%; max-width: 560px; margin: 0 auto;
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 20px 20px 30px;
  position: relative;
  animation: sheetUp .22s ease;
}
@keyframes sheetUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.sheet-close {
  position: absolute; top: 14px; right: 16px;
  width: 32px; height: 32px; border: none; background: #eef2f6;
  border-radius: 50%; font-size: 20px; color: var(--muted);
  cursor: pointer; line-height: 1;
}
.sheet-body .sh-title { font-size: 20px; font-weight: 800; color: var(--primary-dark); }
.sheet-body .sh-badge { display: inline-block; margin-top: 8px; color: #fff; padding: 3px 10px; border-radius: 999px; font-size: 12px; }
.sheet-body .sh-desc { margin-top: 12px; color: var(--text); font-size: 14px; line-height: 1.7; }
.sheet-body .sh-meta { margin-top: 12px; font-size: 13px; color: var(--muted); }
