:root {
  --brand: #2f6bff;
  --brand-soft: #eaf1ff;
  --accent: #ff6a3d;
  --amap: #07c160;
  --baidu: #4e6ef2;
  --gov: #2f7df6;
  --tuo: #12b886;
  --bg: #eef1f6;
  --card: #ffffff;
  --text: #1d2533;
  --muted: #8b93a3;
  --line: #eef1f5;
  --shadow: 0 10px 30px rgba(23, 38, 67, 0.14);
  --shadow-sm: 0 2px 10px rgba(23, 38, 67, 0.08);
  --r: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

.app { height: 100%; display: flex; flex-direction: column; }

/* ---------- 顶部栏 ---------- */
.appbar {
  flex: 0 0 auto;
  background: var(--card);
  padding: calc(env(safe-area-inset-top) + 12px) 16px 10px;
  box-shadow: 0 1px 0 var(--line);
  z-index: 20;
}
.appbar__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.appbar__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.appbar__brand { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.appbar__title { font-size: 19px; font-weight: 800; letter-spacing: 0.3px; }
.appbar__sub { font-size: 11.5px; color: var(--muted); }
.appbar__ver { font-size: 10.5px; color: var(--accent); opacity: .8; letter-spacing: .3px; margin-top: 1px; }

.seg { display: flex; padding: 3px; background: var(--bg); border-radius: 999px; flex: 0 0 auto; }
.seg__btn {
  display: flex; align-items: center; gap: 5px;
  border: 0; background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 700; padding: 7px 13px; border-radius: 999px;
  cursor: pointer; transition: all 0.18s; white-space: nowrap;
}
.seg__btn.active { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }

.search {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  margin-top: 12px; padding: 0 14px; height: 44px;
  background: var(--bg); border-radius: 14px; color: var(--muted);
  transition: box-shadow 0.15s, background 0.15s;
}
.search:focus-within { background: #fff; box-shadow: 0 0 0 2px var(--brand); }
.search input { flex: 1; border: 0; outline: 0; background: transparent; padding: 0; font-size: 14px; color: var(--text); }
.suggest {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: #fff; border-radius: 16px; box-shadow: var(--shadow);
  padding: 6px; z-index: 30; max-height: 56vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.suggest[hidden] { display: none; }
.suggest__item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  border: 0; background: transparent; padding: 12px 12px; border-radius: 12px;
  cursor: pointer; text-align: left; transition: background 0.12s;
}
.suggest__item:active { background: #f4f7fb; }
.suggest__dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.suggest__dot--gov { background: var(--gov); }
.suggest__dot--tuo { background: var(--tuo); border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--tuo); }
.suggest__name { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest__sub { flex: 0 0 auto; font-size: 12px; color: var(--muted); }

.chips { display: flex; gap: 8px; margin-top: 11px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 6px 14px; font-size: 12.5px;
  background: var(--bg); color: #4a5160; border: 1px solid transparent;
  border-radius: 999px; cursor: pointer; white-space: nowrap; transition: all 0.15s;
}
.chip.active { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); font-weight: 700; }

/* ---------- 内容区 ---------- */
.container { flex: 1 1 auto; position: relative; min-height: 0; }

.stage { position: absolute; inset: 0; background: #f4f7fb; overflow: hidden; }
.handmap { position: absolute; inset: 0; touch-action: none; }
.handmap svg { width: 100%; height: 100%; display: block; }
.metro-canvas { position: absolute; inset: 0; transform-origin: 0 0; transition: transform .28s cubic-bezier(.22,1,.36,1); will-change: transform; }
.metro-canvas.no-anim { transition: none; }
.metro-canvas svg { width: 100%; height: 100%; display: block; }
.amapmap { position: absolute; inset: 0; width: 100%; height: 100%; background: #eef1f4; }
.amapmap[hidden] { display: none; }
.amap-error { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.6; }
.amap-error b { color: var(--accent); }
/* ---------- 真实地图：自绘圆点覆盖层（不依赖高德 Marker，必定可见/可点） ---------- */
.amap-overlay { position: absolute; inset: 0; z-index: 6; pointer-events: none; overflow: hidden; }
.amap-dot {
  position: absolute; transform: translate(-50%, -50%);
  pointer-events: auto; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.amap-dot__pin {
  display: block; width: 20px; height: 20px; margin: 0 auto;
  border-radius: 50%; background: #ff6a3d; border: 3px solid #fff;
  box-sizing: border-box; box-shadow: 0 2px 7px rgba(0, 0, 0, 0.4);
  transition: transform 0.12s;
}
.amap-dot--tuo .amap-dot__pin { background: #f97316; }   /* 托班园：橙 */
.amap-dot--gov .amap-dot__pin { background: #3b82f6; }   /* 公办园：蓝 */
.amap-dot.is-active { z-index: 30; }
.amap-dot.is-active .amap-dot__pin { transform: scale(1.5); box-shadow: 0 0 0 5px rgba(249, 115, 22, 0.35); }
.amap-dot__label {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.96); color: #1f2a3d;
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 9px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18); white-space: nowrap;
  border: 1px solid #eef1f5; pointer-events: none;
}

/* 地铁图元素 */
.metro text { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
.st__title { font-size: 22px; font-weight: 800; fill: #243049; }
.st__sub { font-size: 13px; font-weight: 500; fill: #7b8497; }
.st__compass { font-size: 13px; font-weight: 700; fill: #9aa3b2; }
.st__region { font-size: 19px; font-weight: 800; paint-order: stroke; stroke: #fff; stroke-width: 5px; }
.st__focus { cursor: pointer; }
.st__regionbg { cursor: pointer; }
.st__label { font-size: 12.5px; font-weight: 700; fill: #1f2a3d; paint-order: stroke; stroke: #fff; stroke-width: 4px; pointer-events: auto; cursor: pointer; }
.st__hublabel { font-size: 13px; font-weight: 800; fill: #243049; paint-order: stroke; stroke: #fff; stroke-width: 4px; }
.st__dot { cursor: pointer; transition: transform 0.12s; transform-box: fill-box; transform-origin: center; }
.st__hit { cursor: pointer; }
.st { cursor: pointer; }
.st:hover .st__dot { transform: scale(1.25); }
.st.is-active .st__dot { transform: scale(1.6); }
.st.is-active .st__label { fill: var(--accent); font-weight: 800; }

/* 图例 */
.legend {
  position: absolute; left: 12px; bottom: 12px; right: 12px;
  display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center;
  background: rgba(255, 255, 255, 0.92); padding: 8px 12px; border-radius: 13px;
  font-size: 11.5px; color: #4a5160; box-shadow: var(--shadow-sm);
  max-width: calc(100% - 24px);
}
.legend__item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.legend__line { width: 16px; height: 5px; border-radius: 3px; }
.legend__note { color: var(--muted); }
.legend__dot { width: 11px; height: 11px; border-radius: 50%; border: 2px solid #aaa; background: #fff; }

/* ---------- 列表 ---------- */
.listview {
  position: absolute; inset: 0; background: #f7f9fc;
  display: flex; flex-direction: column; z-index: 15;
}
body.view-map .listview { display: none; }
.listview__bar {
  flex: 0 0 auto; padding: 12px 16px 8px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.listview__title { font-size: 16px; font-weight: 800; color: var(--text); }
.listview__count { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.list { list-style: none; margin: 0; padding: 4px 14px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; }
.list__card {
  display: flex; gap: 12px; padding: 14px; margin-bottom: 10px;
  background: var(--card); border-radius: 16px;
  box-shadow: 0 2px 10px rgba(23,38,67,0.05);
  cursor: pointer; transition: transform 0.12s, box-shadow 0.12s;
}
.list__card:active { transform: scale(0.99); box-shadow: 0 1px 6px rgba(23,38,67,0.06); }
.list__thumb {
  flex: 0 0 auto; width: 64px; height: 64px; border-radius: 12px;
  background: linear-gradient(135deg, #e8f0ff, #f0f5ff);
  display: flex; align-items: center; justify-content: center;
  color: var(--brand); font-size: 13px; font-weight: 700;
  overflow: hidden; object-fit: cover;
}
.list__thumb img { width: 100%; height: 100%; object-fit: cover; }
.list__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.list__topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.list__name { font-size: 15.5px; font-weight: 700; color: var(--text); line-height: 1.35; flex: 1; }
.list__type { flex: 0 0 auto; font-size: 11px; padding: 4px 9px; border-radius: 10px; background: #fff0ea; color: var(--accent); font-weight: 700; white-space: nowrap; }
.list__type--gov { background: var(--brand-soft); color: var(--gov); }
.list__type--tuo { background: #e6f7f1; color: var(--tuo); }
.list__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.list__tag {
  font-size: 11px; padding: 3px 8px; border-radius: 8px;
  background: #f0f7f0; color: #2a9d5a; font-weight: 600;
  border: 1px solid #e0f0e4;
}
.list__tag--huipu { background: #fff6e8; color: #e67e22; border-color: #fce8cc; }
.list__tag--tuo { background: #e6f7f1; color: var(--tuo); border-color: #d0eee3; }
.list__tag--op { background: #eef1f6; color: #6b7280; border-color: #e2e6ee; }
.list__addr { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list__addr::before { content: "📍"; margin-right: 3px; font-size: 11px; }

/* ---------- 底部标签栏 ---------- */
.tabbar {
  flex: 0 0 auto; display: flex; background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); z-index: 20;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 0; background: transparent; color: var(--muted);
  padding: 8px 0 7px; font-size: 11.5px; font-weight: 600; cursor: pointer; transition: color 0.15s;
}
.tab svg { opacity: 0.55; transition: opacity 0.15s; }
.tab.active { color: var(--brand); }
.tab.active svg { opacity: 1; }

/* ---------- 详情底部抽屉 ---------- */
.mask { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.42); opacity: 0; visibility: hidden; transition: opacity 0.25s; z-index: 40; }
.mask.show { opacity: 1; visibility: visible; }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--card); border-radius: 22px 22px 0 0;
  padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 30px rgba(23, 38, 67, 0.18);
  transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  max-height: 82vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.sheet.show { transform: translateY(0); }
.sheet__grip { display: block; width: 40px; height: 4px; border-radius: 2px; background: #e2e6ee; margin: 6px auto 10px; }
.sheet__close { position: absolute; top: 12px; right: 14px; border: 0; background: var(--bg); color: var(--muted); width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.sheet__name { font-size: 21px; margin: 4px 0 10px; line-height: 1.3; padding-right: 36px; }
.sheet__tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.sheet__tag { display: inline-block; font-size: 12px; padding: 4px 12px; border-radius: 12px; background: #fff0ea; color: var(--accent); font-weight: 700; }
.sheet__tag--gov { background: var(--brand-soft); color: var(--gov); }
.sheet__tag--tuo { background: #e6f7f1; color: var(--tuo); }
.sheet__tag--huipu { background: #fff6e8; color: #e67e22; }
.sheet__tag--op { background: #eef1f6; color: #5b6472; }
.sheet__meta { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet__meta li { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; padding: 11px 12px; background: #f7f9fc; border-radius: 12px; color: #3a4252; }
.sheet__meta li.span2 { grid-column: 1 / -1; }
.sheet__meta li .mi { flex: 0 0 auto; color: var(--brand); margin-top: 2px; }
.sheet__meta li span { flex: 1; line-height: 1.5; }
.sheet__meta li .tel { color: #2f6bff; font-weight: 700; text-decoration: none; margin-left: 6px; background: #eaf1ff; padding: 2px 9px; border-radius: 9px; font-size: 12.5px; white-space: nowrap; }
.sheet__intro { font-size: 13px; line-height: 1.75; color: #5d6675; margin: 4px 0 18px; background: #f7f9fc; padding: 13px 15px; border-radius: 13px; }

.sheet__nav { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin: 2px 0 12px; }
.navbtn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  border: 0; cursor: pointer; text-decoration: none;
  padding: 15px 0; border-radius: 14px; color: #fff; font-size: 15.5px; font-weight: 800;
  transition: transform 0.12s, opacity 0.15s;
}
.navbtn:active { transform: scale(0.97); opacity: 0.9; }
.navbtn--amap { background: linear-gradient(135deg, #ff8a1f, #ff5a2e); box-shadow: 0 8px 18px rgba(255, 106, 61, 0.32); }
.navbtn--baidu { background: linear-gradient(135deg, #5b7cfa, #3a5bf0); box-shadow: 0 8px 18px rgba(58, 91, 240, 0.3); }
.sheet__copy {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; background: var(--bg); color: var(--muted);
  font-size: 13px; font-weight: 600; padding: 11px 0; border-radius: 12px; cursor: pointer;
}
.sheet__copy:active { background: #e6eaf1; }

/* ---------- 导航方式选择 ---------- */
.actionsheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--card); border-radius: 20px 20px 0 0; padding: 8px 12px calc(12px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.actionsheet.show { transform: translateY(0); }
.actionsheet__head { text-align: center; font-size: 13px; color: var(--muted); padding: 12px 0 8px; font-weight: 600; }
.actionsheet__item {
  display: flex; align-items: center; gap: 13px; width: 100%;
  border: 0; background: transparent; color: var(--text);
  font-size: 16px; font-weight: 600; padding: 15px 10px; border-radius: 14px; cursor: pointer; text-align: left;
}
.actionsheet__item:active { background: #f4f7fb; }
.as-ic { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 11px; display: flex; align-items: center; justify-content: center; }
.as-ic--amap { background: var(--amap); }
.as-ic--baidu { background: var(--baidu); }
.as-ic--copy { background: #6b7688; }
.actionsheet__item--cancel { justify-content: center; color: var(--muted); font-weight: 700; margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0; }

/* ---------- 导览图缩放控件 ---------- */
.mapctrl { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 9px; z-index: 18; }
.mapctrl[hidden] { display: none; }
.mapctrl__btn {
  width: 40px; height: 40px; border: 0; border-radius: 13px;
  background: #fff; color: #2c3548; box-shadow: 0 3px 10px rgba(23, 38, 67, 0.18);
  font-size: 24px; font-weight: 700; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background 0.12s, transform 0.1s;
}
.mapctrl__btn:active { background: #eef2f8; transform: scale(0.94); }
.mapctrl__btn:disabled { opacity: 0.4; }
.mapctrl__reset { font-size: 13px; font-weight: 800; color: var(--brand); }

.maphint {
  position: absolute; top: 12px; left: 12px; z-index: 17;
  background: rgba(33, 43, 64, 0.82); color: #fff; font-size: 12px; font-weight: 600;
  padding: 7px 12px; border-radius: 999px; box-shadow: 0 3px 10px rgba(23, 38, 67, 0.22);
  transition: opacity 0.4s, transform 0.4s; pointer-events: none;
}
.maphint.hide { opacity: 0; transform: translateY(-6px); }

/* ---------- 点机构后的浮层按钮（手机端更灵敏） ---------- */
.pinpop {
  position: absolute; z-index: 19;
  transform: translate(-50%, calc(-100% - 12px));
  max-width: 78vw;
}
.pinpop[hidden] { display: none; }
.pinpop__card {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border-radius: 14px; padding: 9px 10px 9px 14px;
  box-shadow: 0 10px 26px rgba(23, 38, 67, 0.28);
  border: 1px solid #eef1f5;
}
.pinpop__name {
  font-size: 14px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw;
}
.pinpop__go {
  flex: 0 0 auto; border: 0; background: var(--accent); color: #fff;
  font-size: 13.5px; font-weight: 800; padding: 10px 15px; border-radius: 11px;
  cursor: pointer; transition: transform 0.1s, opacity 0.15s;
}
.pinpop__go:active { transform: scale(0.96); opacity: 0.92; }
.pinpop__close {
  position: absolute; top: -11px; right: -11px;
  width: 25px; height: 25px; border-radius: 50%;
  background: #2c3548; color: #fff; border: 2px solid #fff;
  font-size: 15px; line-height: 1; display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 2px 7px rgba(0, 0, 0, 0.3); padding: 0;
}
.pinpop::after {
  content: ""; position: absolute; left: 50%; bottom: -7px;
  transform: translateX(-50%); border: 7px solid transparent; border-top-color: #fff;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 22%; transform: translateX(-50%) translateY(10px);
  background: rgba(20, 28, 44, 0.92); color: #fff; font-size: 13.5px; font-weight: 600;
  padding: 11px 20px; border-radius: 12px; opacity: 0; visibility: hidden;
  transition: opacity 0.2s, transform 0.2s; z-index: 60; pointer-events: none;
}
.toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* 列表缩略图：有照片时只渲染图片（无文字占位），无图才回退文字，永不裂图 */
.list__thumb { position: relative; }
.list__thumb-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.list__thumb-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }
.list__thumb.has-photo { cursor: pointer; }
.list__thumb.has-photo::after {
  content: ""; position: absolute; right: 4px; bottom: 4px; width: 14px; height: 14px;
  border-radius: 50%; background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 2px rgba(47, 107, 255, 0.35);
}

/* 全屏照片查看器：点列表缩略图打开，横滑切换，与详情卡完全分离 */
.viewer {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(13, 20, 35, 0.94);
  display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0.2s;
}
.viewer.show { opacity: 1; visibility: visible; }
.viewer[hidden] { display: none; }
.viewer__close {
  position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 14px; z-index: 2;
  width: 38px; height: 38px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 20px; line-height: 1;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.viewer__track {
  flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.viewer__track::-webkit-scrollbar { display: none; }
.viewer__slide {
  flex: 0 0 100%; scroll-snap-align: center;
  display: flex; align-items: center; justify-content: center; padding: 20px 14px;
}
.viewer__slide img { max-width: 100%; max-height: 82vh; object-fit: contain; border-radius: 12px; }
.viewer__count {
  flex: 0 0 auto; text-align: center; color: rgba(255, 255, 255, 0.85);
  font-size: 12.5px; font-weight: 600;
  padding: 0 16px calc(16px + env(safe-area-inset-bottom));
}

/* 小屏适配：右上角三选一（列表/导览/地图）收紧尺寸，标题防挤压换行 */
@media (max-width: 420px) {
  .seg__btn { padding: 7px 9px; font-size: 12px; gap: 4px; }
  .appbar__title { font-size: 16.5px; }
  .appbar__sub, .appbar__ver { display: none; }
}

/* 幼儿园托班类型标签（紫）— 与社区托育点(绿)、托育机构(蓝)区分 */
.list__type--kg { background: #f1e8ff; color: #7c3aed; }
.sheet__tag--kg { background: #f1e8ff; color: #7c3aed; }
/* 开班/收托状态标签（青蓝） */
.list__tag--note { background: #e6f4ff; color: #0369a1; border: 1px solid #cfe8fb; }
.sheet__tag--note { background: #e6f4ff; color: #0369a1; }