/* ============ 旅游导览图 · 前台样式（移动端优先） ============ */
:root {
  --green: #0e9f6e;
  --green-d: #057a55;
  --green-l: #ecfdf5;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f4f7f5;
  --card: #ffffff;
  --radius: 14px;
  --topbar-h: 52px;
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ============ 首页 ============ */
.hero {
  position: relative;
  background: linear-gradient(155deg, #0f766e 0%, #0e9f6e 55%, #34d399 100%);
  color: #fff;
  padding: 64px 24px 90px;
  overflow: hidden;
}
.hero-mountains { position: absolute; left: 0; right: 0; bottom: -2px; width: 100%; height: 110px; }
.hero-inner { position: relative; z-index: 1; }
.hero-kicker { font-size: 11px; letter-spacing: 3px; opacity: .75; margin-bottom: 10px; }
.hero h1 { font-size: 32px; font-weight: 600; letter-spacing: 2px; }
.hero-sub { margin-top: 10px; font-size: 14px; opacity: .88; }

.home { max-width: 560px; margin: -56px auto 0; padding: 0 16px; position: relative; z-index: 2; display: flex; flex-direction: column; gap: 14px; }

.entry-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 18px;
  box-shadow: 0 6px 20px rgba(6, 78, 59, .08);
  transition: transform .15s ease;
}
.entry-card:active { transform: scale(.98); }
.entry-icon {
  width: 54px; height: 54px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.entry-icon svg { width: 28px; height: 28px; }
.entry-icon-route { background: var(--green-l); color: var(--green-d); }
.entry-icon-spot { background: #fff7ed; color: #ea580c; }
.entry-text { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.entry-text strong { font-size: 17px; font-weight: 600; }
.entry-text small { font-size: 12.5px; color: var(--muted); }
.entry-arrow { font-size: 24px; color: #cbd5e1; }

.home-footer {
  max-width: 560px; margin: 26px auto 0; padding: 0 16px 30px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: #9ca3af;
}
.home-footer a { color: #9ca3af; text-decoration: underline; }

/* ============ 地图页通用 ============ */
.map-page { overflow: hidden; }
#map { position: absolute; inset: 0; }

.topbar {
  position: absolute; top: 0; left: 0; right: 0; height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px; z-index: 60;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { flex: 1; text-align: center; font-size: 16px; font-weight: 600; }
.topbar .back {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: var(--ink); background: #fff;
  border: 1px solid var(--line); line-height: 1; padding-bottom: 3px;
}
.topbar-btn {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  font-size: 13px; padding: 5px 12px; border-radius: 16px;
}

/* 顶部按钮下方的下拉清单（默认隐藏；点击顶部入口展开，点击地图空白处收起）
   挂在 .home-bar 内，top:100% 自动贴合各断点下的条高；
   宽度由 home.js 按「线路/景点」按钮组跨度精确设置，此处为兜底默认值 */
.home-bar > .drawer {
  position: absolute; top: calc(100% + 8px); right: 12px; z-index: 55;
  width: 232px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 14px 38px rgba(15, 23, 42, .20);
  max-height: calc(100vh - 130px);
  display: flex; flex-direction: column;
  padding: 12px;
  opacity: 0; transform: translateY(-8px) scale(.98);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity .2s ease, transform .22s cubic-bezier(.32, .72, .35, 1);
}
.home-bar > .drawer.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.drawer-title { font-size: 14.5px; font-weight: 600; margin-bottom: 8px; flex-shrink: 0; display: flex; align-items: center; gap: 8px; min-width: 0; }
.drawer-tip { font-size: 12px; font-weight: 400; color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#route-list-wrap { overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ============ 路线清单 ============ */
.route-list { list-style: none; display: flex; flex-direction: column; gap: 7px; padding-bottom: 4px; }
.route-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 11px;
  background: #fff;
}
.route-item .row1 { display: flex; align-items: center; gap: 8px; }
.route-check { position: relative; width: 20px; height: 20px; flex-shrink: 0; }
.route-check input { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.checkbox-ui {
  position: absolute; inset: 0; border-radius: 5px;
  border: 2px solid #cbd5e1; background: #fff;
  transition: all .15s;
  pointer-events: none;
}
.route-check input:checked + .checkbox-ui {
  background: var(--c, var(--green));
  border-color: var(--c, var(--green));
}
.route-check input:checked + .checkbox-ui::after {
  content: ""; position: absolute; left: 5px; top: 1px;
  width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.route-main { flex: 1; min-width: 0; cursor: pointer; }
.route-name { font-size: 14px; font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route-meta { font-size: 11.5px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route-expand {
  border: none; background: none; color: #9ca3af; font-size: 16px;
  width: 24px; height: 24px; cursor: pointer; transition: transform .15s;
  flex-shrink: 0;
}
.route-item.open .route-expand { transform: rotate(90deg); }

.route-detail { display: none; margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 7px; }
.route-item.open .route-detail { display: block; }
.route-intro { font-size: 12.5px; color: var(--muted); margin-bottom: 7px; }
.seg-list { display: flex; flex-direction: column; gap: 5px; }
.seg { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.seg-no {
  width: 19px; height: 19px; border-radius: 50%; color: #fff;
  font-size: 10.5px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.seg-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg-dist { color: var(--green-d); font-size: 12px; font-weight: 600; white-space: nowrap; }

/* 地图上的途经点与距离 */
.wp-pin {
  width: 22px; height: 22px; border-radius: 50%;
  color: #fff; font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.amap-marker .wp-pin { box-sizing: border-box; }
/* 线路途经点标记：数字圆 + 名称标签，点击弹出详情卡片 */
.wp-pin-wrap { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.wp-pin-wrap .wp-name {
  background: rgba(255,255,255,.94); border: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink); padding: 2px 8px; border-radius: 12px;
  white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

/* ============ 景点分类清单（下拉面板内） ============ */
.cat-list {
  display: flex; flex-direction: column; gap: 5px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.cat-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: 1px solid var(--line); border-radius: 9px;
  padding: 6px 11px; background: #fff; cursor: pointer;
  font-size: 13.5px; font-family: inherit; color: var(--ink); text-align: left;
  transition: border-color .15s, background .15s;
}
.cat-item:hover { border-color: #a7f3d0; background: #f0fdf4; }
.cat-item:active { background: #f3f4f6; }
.cat-item.active { border-color: var(--green); background: var(--green-l); }
.cat-dot {
  width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line);
}
.cat-dot.all { background: linear-gradient(135deg, #0e9f6e, #2563eb); }
.cat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.cat-count {
  font-size: 11.5px; color: var(--muted); background: #f3f4f6;
  border-radius: 9px; padding: 1px 8px; flex-shrink: 0;
}
.cat-item.active .cat-count { background: #fff; color: var(--green-d); }
.cat-error {
  padding: 18px 12px; text-align: center; color: #991b1b; font-size: 13px;
  background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px;
}

/* 地图上的景点标记 */
.spot-pin { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.spot-pin .dot { width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); flex-shrink: 0; }
.spot-pin .label {
  background: rgba(255,255,255,.94); border: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink); padding: 2px 8px; border-radius: 12px;
  white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

/* ============ 景点详情卡片 ============ */
.spot-card {
  position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 80;
  background: var(--card); border-radius: 16px;
  box-shadow: 0 12px 36px rgba(15, 23, 42, .22);
  max-height: 72vh; overflow-y: auto;
  transform: translateY(120%); transition: transform .25s ease;
  padding-bottom: 14px;
}
.spot-card.show { transform: none; }
.card-close {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  width: 30px; height: 30px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.45); color: #fff; font-size: 17px; line-height: 1; cursor: pointer;
}
.card-imgs {
  display: flex; gap: 8px; overflow-x: auto; padding: 12px 12px 0;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
}
.card-imgs::-webkit-scrollbar { display: none; }
.card-imgs img {
  width: 150px; height: 104px; object-fit: cover; border-radius: 10px;
  scroll-snap-align: start; cursor: zoom-in; flex-shrink: 0; background: #f3f4f6;
}
.card-imgs .no-img {
  width: 100%; height: 104px; border-radius: 10px; background: var(--green-l);
  color: var(--green-d); display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.card-body { padding: 12px 16px 0; }
.card-tags { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.card-tags .tag { font-size: 11.5px; padding: 2px 9px; border-radius: 6px; font-weight: 500; }
.card-tags .county { font-size: 12px; color: var(--muted); }

/* ============ 定位（我的位置） ============ */
/* 定位按钮固定在屏幕最右侧，与左下角标注文字同一行（垂直对齐由 JS 精确计算） */
.locate-btn {
  position: fixed; right: 12px; bottom: 8px; z-index: 60;
  width: 32px; height: 32px; border-radius: 50%;
  background: #fff; border: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(15, 60, 45, .18);
  color: #2563eb; display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0; transition: transform .12s;
  pointer-events: auto;
}
.locate-btn:active { transform: scale(.92); }
.locate-btn svg { width: 18px; height: 18px; }
.locate-btn.loading svg { animation: locate-spin 1s linear infinite; }
.locate-btn.loading { color: #9ca3af; }
@keyframes locate-spin { to { transform: rotate(360deg); } }
.me-pin { position: relative; }
/* 定位提示条 */
.toast {
  position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%) translateY(8px);
  z-index: 95; max-width: 86vw; padding: 9px 14px; border-radius: 10px;
  background: rgba(17, 24, 39, .92); color: #fff; font-size: 12.5px; line-height: 1.5;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
  box-shadow: 0 4px 14px rgba(0,0,0,.25); text-align: center; white-space: pre-line;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: rgba(185, 28, 28, .93); }
.me-pin .me-dot {
  display: block; width: 20px; height: 20px; border-radius: 50%;
  background: #2563eb; border: 3px solid #fff;
  box-shadow: 0 0 0 7px rgba(37, 99, 235, .22), 0 2px 8px rgba(0, 0, 0, .35);
}
.card-body h2 { font-size: 18px; font-weight: 600; }
/* 名称后面的「距您XX公里」角标 */
.card-body .dist {
  margin-left: 8px; font-size: 12px; color: #2563eb; font-weight: 600;
  white-space: nowrap; vertical-align: 2px;
}
/* 「导航去这里」按钮：距离后面，手机唤起导航 App / 电脑打开高德网页导航 */
.card-body .nav-go {
  display: inline-block; margin-left: 10px; vertical-align: 2px;
  padding: 3px 12px; border-radius: 999px;
  background: #2563eb; color: #fff; font-size: 12.5px; font-weight: 600;
  text-decoration: none; white-space: nowrap; line-height: 1.5;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .32);
  transition: transform .12s, box-shadow .12s;
}
.card-body .nav-go:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37, 99, 235, .42); color: #fff; }
.card-body .nav-go:active { transform: translateY(0); box-shadow: 0 1px 4px rgba(37, 99, 235, .3); }
.card-body p { margin-top: 8px; font-size: 13.5px; color: #4b5563; line-height: 1.7; white-space: pre-wrap; }

/* 左下角标注文字：独立元素（不修改高德署名 DOM），由 JS 定位到署名文字正后方，
 * 字体 / 字号 / 行高 / 颜色由 JS 从高德署名文字复制，保持视觉一致 */
.map-credit {
  margin-left: 0; /* 与署名的间距由 JS 定位控制 */
  white-space: nowrap;
  line-height: 1.5;
}
/* 兜底：高德署名未加载出来时，标注文字固定在左下角 */
.bottom-bar {
  position: fixed; left: 12px; bottom: 8px; z-index: 60;
  display: flex; align-items: center;
  pointer-events: none; /* 不挡地图操作 */
}
.bottom-bar .map-credit { margin-left: 0; color: rgba(55, 65, 81, .82); }
@media (max-width: 480px) {
  .locate-btn { width: 28px; height: 28px; }
  .locate-btn svg { width: 16px; height: 16px; }
}

/* ============ 全屏看图 ============ */
.viewer {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.94);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.viewer.show { opacity: 1; pointer-events: auto; }
.viewer img { max-width: 92%; max-height: 86%; object-fit: contain; cursor: grab; }
.viewer img:active { cursor: grabbing; }
.viewer-close, .viewer-nav {
  position: absolute; border: none; background: rgba(255,255,255,.14);
  color: #fff; border-radius: 50%; cursor: pointer;
  width: 42px; height: 42px; font-size: 24px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.viewer-close { top: 16px; right: 16px; }
.viewer-nav.prev { left: 14px; top: 50%; transform: translateY(-50%); }
.viewer-nav.next { right: 14px; top: 50%; transform: translateY(-50%); }
.viewer-count { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,.8); font-size: 13px; }

/* ============ 桌面端适配 ============ */
@media (min-width: 720px) {
  .home { margin-top: -70px; }
  .hero { padding: 90px 24px 120px; }
  .home-bar > .drawer { left: auto; right: 20px; width: 264px; }
  .spot-card { left: 50%; transform: translate(-50%, 120%); width: 480px; }
  .spot-card.show { transform: translate(-50%, 0); }
}

/* ============ 首页地图（合并线路 / 景点图层） ============ */
/* 顶部品牌条 + 入口组（线路 / 景点 / 管理入口，同一行、同尺寸） */
.home-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 60;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 12px; pointer-events: none;
}
.home-bar > * { pointer-events: auto; }
.home-entries { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.home-brand {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 6px 14px 6px 6px; box-shadow: 0 4px 16px rgba(15,23,42,.10);
}
.brand-badge {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(150deg, #0f766e, #10b981);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; overflow: hidden; }
.brand-text strong { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 三个入口统一为 34px 高胶囊，尺寸一致 */
.home-admin,
.promo-card {
  height: 34px; box-sizing: border-box; border-radius: 14px;
  display: inline-flex; align-items: center; white-space: nowrap;
  font-size: 12px; font-family: inherit;
}
.home-admin {
  color: var(--muted); padding: 0 12px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(15,23,42,.08);
}

/* 风景宣传风小按钮：线路 / 景点 */
.promo-card {
  position: relative; overflow: hidden; border: none; cursor: pointer;
  gap: 6px; padding: 0 12px 0 10px; color: #fff; text-align: left;
  box-shadow: 0 4px 14px rgba(6, 78, 59, .25);
  transition: transform .15s ease, box-shadow .15s ease;
}
.promo-card:active { transform: scale(.94); }
.promo-card .promo-sky {
  position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 100%;
  pointer-events: none;
}
.promo-route { background: linear-gradient(150deg, #0f766e 0%, #0e9f6e 62%, #34d399 100%); }
.promo-spot { background: linear-gradient(150deg, #b45309 0%, #f59e0b 56%, #fbbf24 100%); }
.promo-card .promo-icon { position: relative; width: 16px; height: 16px; flex-shrink: 0; }
.promo-card .promo-body { position: relative; display: flex; align-items: baseline; gap: 4px; }
.promo-card strong { font-size: 12px; font-weight: 600; letter-spacing: 1px; }
.promo-card small { font-size: 10px; opacity: .85; }
.promo-card.active {
  box-shadow: 0 0 0 2px rgba(255,255,255,.95), 0 0 0 5px rgba(16,185,129,.38), 0 4px 14px rgba(6,78,59,.3);
}
.promo-spot.active {
  box-shadow: 0 0 0 2px rgba(255,255,255,.95), 0 0 0 5px rgba(245,158,11,.42), 0 4px 14px rgba(120,53,15,.28);
}

/* 中等宽度：先收起副标题，保留计数 */
@media (max-width: 719px) {
  .brand-text small { display: none; }
}

/* 窄屏：进一步收起计数，缩小间距，保证顶部一行放得下 */
@media (max-width: 479px) {
  .home-bar { padding: 8px 10px; gap: 6px; }
  .home-brand { padding: 5px 10px 5px 5px; }
  .home-entries { gap: 6px; }
  .home-admin { padding: 0 9px; }
  .promo-card { padding: 0 9px 0 8px; gap: 5px; }
  .promo-card small { display: none; }
}

/* 极窄屏（≤360px）：只留品牌徽标，入口完整保留 */
@media (max-width: 360px) {
  .brand-text { display: none; }
  .home-brand { padding: 5px; }
}

/* 抽屉双面板 */
.drawer-pane { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.drawer-pane[hidden] { display: none; }

@media (min-width: 720px) {
  .home-bar { padding: 14px 20px; gap: 12px; }
  .home-entries { gap: 10px; }
  .home-admin { font-size: 13px; padding: 0 14px; }
  .promo-card { font-size: 13px; padding: 0 14px 0 11px; gap: 7px; }
  .promo-card strong { font-size: 13px; }
  .promo-card small { font-size: 11px; }
  .brand-text strong { font-size: 16px; }
}
