/* 路线页（H5）。变量沿用 index.html 里那套 —— 两边配色必须一致，
   否则同一个产品在网页和小程序上像两个东西。 */

#viewRoute { padding: 0 0 calc(var(--route-cta-h, 64px) + 88px); }

.route-map-wrap { position: relative; height: 46vh; min-height: 240px; background: var(--sunken, #f4f2ec); }
/* **z-index: 0 不是可有可无的一行**（和 .map-canvas 同一个理由，写在
   camera-map.css 第 22 行）：腾讯地图 SDK 会往容器里插一个 z-index:1000 的浮层。
   容器要是 z-index:auto，那个 1000 就和工具栏在同一个层叠上下文里比大小，
   工具栏永远输 —— 表现是按钮画得出来、也有选中态，就是**点不动**。
   建了上下文之后，SDK 内部再大的 z-index 也出不来这个容器。 */
.route-canvas { position: absolute; inset: 0; z-index: 0; }
.route-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 24px; text-align: center; color: var(--muted, #94938c); font-size: 14px;
}

.route-panel { padding: 12px 16px 0; }

/* ---------------- 起终点 ---------------- */
.route-ends {
  position: relative; background: var(--card, #fff); border: 1px solid var(--hairline, #ecebe5);
  border-radius: 14px; padding: 4px 12px; box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.route-end {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 13px 44px 13px 22px; font: inherit; font-size: 15px; font-weight: 600;
  color: var(--ink, #1a1a18); position: relative; cursor: pointer;
}
.route-end + .route-end { border-top: 1px solid var(--hairline, #ecebe5); }
.route-end.empty { color: var(--muted, #94938c); font-weight: 400; }
.route-end::before {
  content: ""; position: absolute; left: 2px; top: 50%; transform: translateY(-50%);
  width: 9px; height: 9px; border-radius: 50%; background: var(--green, #1f7a4d);
}
#routeTo::before { border-radius: 2px; background: var(--alert-red, #b23a48); }
.route-swap {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--hairline-2, #dedcd4);
  background: var(--sunken, #f4f2ec); color: var(--body, #5b5b54); cursor: pointer; font-size: 14px;
}

.route-actions { display: flex; gap: 10px; margin-top: 10px; }
.route-mini {
  flex: 1; padding: 10px; border-radius: 12px; border: 1px dashed var(--hairline-2, #dedcd4);
  background: none; color: var(--body, #5b5b54); font: inherit; font-size: 13px; cursor: pointer;
}
.route-mini.busy { opacity: .5; }

.route-vias { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.route-via {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--card, #fff); border: 1px solid var(--hairline, #ecebe5); border-radius: 12px;
}
.rv-n {
  flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--sunken, #f4f2ec);
  color: var(--body, #5b5b54); font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.rv-name { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rv-x { border: 0; background: none; color: var(--muted, #94938c); cursor: pointer; font-size: 13px; }

/* ---------------- 搜索 ---------------- */
.route-search { margin-top: 10px; }
.route-search input {
  width: 100%; padding: 12px 14px; border-radius: 12px; font: inherit; font-size: 15px;
  border: 1px solid var(--hairline-2, #dedcd4); background: var(--card, #fff); color: inherit;
}
.route-pick-hint { margin: 8px 2px 0; font-size: 12px; color: var(--muted, #94938c); }
.route-suggest {
  margin-top: 8px; background: var(--card, #fff); border: 1px solid var(--hairline, #ecebe5);
  border-radius: 12px; overflow: hidden;
}
.route-suggest-item {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 11px 14px; font: inherit; cursor: pointer;
}
.route-suggest-item + .route-suggest-item { border-top: 1px solid var(--hairline, #ecebe5); }
.route-suggest-item:hover { background: var(--sunken, #f4f2ec); }
.rs-title { display: block; font-size: 14px; font-weight: 600; }
.rs-addr { display: block; margin-top: 2px; font-size: 12px; color: var(--muted, #94938c); }

.route-plan-btn {
  width: 100%; margin-top: 0; padding: 14px; border: 0; border-radius: 13px;
  background: var(--green, #1f7a4d); color: #fff; font: inherit; font-size: 16px;
  font-weight: 700; cursor: pointer;
}
.route-plan-btn:disabled { background: var(--sunken, #f4f2ec); color: var(--muted, #94938c); cursor: not-allowed; }

.route-err {
  margin-top: 14px; padding: 12px 14px; border-radius: 12px;
  background: var(--red-tint, #fdecea); color: var(--on-tint-red, #82232f); font-size: 13px;
}

/* ---------------- 四档口味 ---------------- */
.route-prefers {
  display: flex; gap: 6px; margin-top: 16px; padding: 4px;
  background: var(--sunken, #f4f2ec); border-radius: 12px;
}
.route-prefer {
  flex: 1; min-width: 0; padding: 8px 2px; border: 0; border-radius: 9px;
  background: none; font: inherit; cursor: pointer; text-align: center;
}
.route-prefer.on { background: var(--card, #fff); box-shadow: 0 1px 5px rgba(0,0,0,.06); }
.rp-t { display: block; font-size: 13px; font-weight: 600; color: var(--muted, #94938c); }
.route-prefer.on .rp-t { color: var(--green-700, #155f3b); }
.rp-s {
  display: block; margin-top: 3px; font-size: 10px; color: var(--muted, #94938c);
  white-space: nowrap; font-variant-numeric: tabular-nums;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}

/* ---------------- 结论 ---------------- */
.route-verdict { margin-top: 12px; padding: 14px 15px; border-radius: 14px; border: 1px solid; }
.route-verdict.ok { background: var(--green-tint, #e8f3ec); border-color: var(--green-300, #a9d3bc); }
.route-verdict.warn { background: var(--amber-tint, #fdf3e3); border-color: var(--amber-line, #e5d3a8); }
.route-verdict.bad { background: var(--red-tint, #fdecea); border-color: rgba(178,58,72,.3); }
.route-verdict.mute { background: var(--sunken, #f4f2ec); border-color: var(--hairline-2, #dedcd4); }
.rv-h { display: flex; align-items: center; gap: 9px; }
.rv-ico {
  flex: none; width: 22px; height: 22px; border-radius: 50%; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.route-verdict.ok .rv-ico { background: var(--green, #1f7a4d); }
.route-verdict.warn .rv-ico { background: var(--amber, #c8862b); }
.route-verdict.bad .rv-ico { background: var(--alert-red, #b23a48); }
.route-verdict.mute .rv-ico { background: var(--muted, #94938c); }
.rv-t { font-size: 15px; font-weight: 700; }
.rv-p { margin: 8px 0 0; font-size: 13px; line-height: 1.6; color: var(--body, #5b5b54); }

.route-metrics {
  display: flex; margin-top: 10px; background: var(--card, #fff);
  border: 1px solid var(--hairline, #ecebe5); border-radius: 14px; overflow: hidden;
}
.route-metric { flex: 1; padding: 12px 6px; text-align: center; }
.route-metric + .route-metric { border-left: 1px solid var(--hairline, #ecebe5); }
.rm-v { font-size: 21px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.rm-v span { margin-left: 2px; font-size: 11px; font-weight: 500; color: var(--muted, #94938c); }
.route-metric.cost .rm-v { color: var(--alert-red, #b23a48); }
.rm-k { margin-top: 6px; font-size: 11px; color: var(--muted, #94938c); }

.route-sect { padding: 18px 2px 8px; font-size: 12px; font-weight: 600; color: var(--muted, #94938c); }

/* ---------------- 候选 / 点位 ---------------- */
.route-cands, .route-cams { list-style: none; margin: 0; padding: 0; }
.route-cand {
  padding: 12px 14px; background: var(--card, #fff); border: 1px solid var(--hairline, #ecebe5);
  border-radius: 12px; margin-bottom: 8px; cursor: pointer;
}
.route-cand.on { border-color: var(--green, #1f7a4d); background: var(--green-tint, #e8f3ec); }
.rc-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rc-top b { font-size: 16px; }
.rc-top span { font-size: 12px; color: var(--muted, #94938c); }
.rc-top em {
  font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: var(--green-tint, #e8f3ec); color: var(--green-700, #155f3b);
}
.route-cand.on .rc-top em { background: #fff; }
.rc-sub { margin-top: 4px; font-size: 12px; color: var(--body, #5b5b54); }
.rc-roads {
  margin-top: 4px; font-size: 11px; color: var(--muted, #94938c);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}

.route-cam {
  display: flex; gap: 10px; padding: 11px 14px; background: var(--card, #fff);
  border: 1px solid var(--hairline, #ecebe5); border-radius: 12px; margin-bottom: 8px;
}
.rc-n {
  flex: none; width: 21px; height: 21px; border-radius: 50%; color: #fff;
  font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  background: var(--alert-red, #b23a48);
}
.rc-n.outer { background: var(--ring-out-text, #3f5e80); }
.rc-name { font-size: 13px; font-weight: 600; line-height: 1.45; }
.rc-meta { margin-top: 3px; font-size: 11px; color: var(--muted, #94938c); }
.route-note {
  margin: 4px 2px 0; padding: 11px 13px; border-radius: 12px;
  background: var(--sunken, #f4f2ec); font-size: 12px; line-height: 1.6; color: var(--body, #5b5b54);
}

/* ---------------- 拖动把手 ----------------
   放在地图和面板之间。touch-action:none 是必须的 —— 少了它，
   浏览器会先把手势判成滚动，touchmove 里的 preventDefault 就来不及了。 */
.route-grip {
  display: flex; align-items: center; justify-content: center;
  height: 22px; margin-top: -9px; position: relative; z-index: 2;
  background: var(--canvas, #fafaf7); border-radius: 12px 12px 0 0;
  cursor: ns-resize; touch-action: none;
}
.route-grip-bar { width: 38px; height: 4px; border-radius: 999px; background: var(--hairline-2, #dedcd4); }
.route-grip:active .route-grip-bar { background: var(--green, #1f7a4d); }
/* 拖动时关掉过渡，否则手指到哪儿地图慢半拍到哪儿，像卡了 */
.route-map-wrap.dragging { transition: none; }

/* 路线页的图层按钮。位置沿用地图页那套 .map-rail / .map-tool 样式，
   只把它定位到地图右侧 —— 两页的按钮长得一样，用户不用重新认。 */
/* .map-rail 自带 bottom:20px，只覆盖 top 的话上下都定死，按钮会被拉长。 */
.route-rail { top: 12px; bottom: auto; }
.route-cam { cursor: pointer; }
.route-cam:active { background: var(--sunken, #f4f2ec); }

/* ---------------- 算路线时的等待态 ----------------
   避让是一处一处试绕行，慢的路线要 40 秒。只给一个转圈的话，用户在第 15 秒
   就会以为卡死了 —— 所以把"在干什么、等了多久、大概还要多久"都摆出来。
   进度条按时间估，最多走到 92%，剩下那截等真的返回再填满。 */
.route-planning {
  margin: 14px 0 0; padding: 18px 18px 16px; border-radius: 16px;
  background: var(--card, #fff); border: 1px solid var(--hairline, #ecebe5);
}
.rpg-top { display: flex; align-items: center; gap: 10px; }
.rpg-spin {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 2px solid var(--hairline-2, #dedcd4); border-top-color: var(--green, #1f7a4d);
  animation: rpg-spin .8s linear infinite;
}
@keyframes rpg-spin { to { transform: rotate(360deg); } }
.rpg-stage { font-size: 14.5px; font-weight: 600; color: var(--ink, #1a1a18); }
.rpg-bar {
  margin-top: 13px; height: 3px; border-radius: 3px;
  background: var(--sunken, #f4f2ec); overflow: hidden;
}
.rpg-bar i { display: block; height: 100%; border-radius: 3px;
  background: var(--green, #1f7a4d); transition: width .6s linear; }
.rpg-meta { margin-top: 9px; font-size: 12px; color: var(--muted, #94938c); }
@media (prefers-reduced-motion: reduce) {
  .rpg-spin { animation: none; }
  .rpg-bar i { transition: none; }
}

/* 改过起终点、还没重算时的提醒。旧结果不藏 —— 用户可能只是想对比一下；
   但必须说清楚它已经不对应当前的起终点了。 */
.route-stale {
  margin: 0 0 12px; padding: 10px 13px; border-radius: 12px;
  background: var(--warn-tint, #fef9ec); border: 1px solid var(--amber-line, #e5d3a8);
  color: var(--warn-text, #8b6914); font-size: 12.5px; line-height: 1.7;
}

/* ---------------- 算完之后：起终点收成一行 ---------------- */
.route-brief {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 11px 12px;
  background: var(--card, #fff); border: 1px solid var(--hairline, #ecebe5); border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.04); font: inherit; text-align: left; cursor: pointer;
}
.rb-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--green, #1f7a4d); }
.rb-dot.to { border-radius: 2px; background: var(--alert-red, #b23a48); }
.rb-t { min-width: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-arrow { color: var(--muted, #94938c); font-size: 12px; }
.rb-edit {
  flex: none; margin-left: auto; padding: 5px 12px; border-radius: 999px;
  background: var(--sunken, #f4f2ec); color: var(--body, #5b5b54); font-size: 12px; font-weight: 600;
}
/* 指标行住进结论卡，别再另起一块卡片 */
.route-verdict .route-metrics {
  margin-top: 12px; padding-top: 10px; border: 0; border-top: 1px solid rgba(0,0,0,.07);
  border-radius: 0; background: transparent;
}
.route-verdict .route-metric { padding: 0 4px; }
.route-verdict .route-metric + .route-metric { border-left: 0; }
/* 候选折叠 */
.route-cands-more {
  width: 100%; padding: 12px; margin-bottom: 8px; border: 1px dashed var(--hairline-2, #dedcd4);
  border-radius: 12px; background: none; color: var(--green-700, #155f3b);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
/* 吸底栏。bottom 由 JS 量 .tabbar 的高度写进 --route-cta-bottom */
.route-cta {
  position: fixed; left: 0; right: 0; bottom: var(--route-cta-bottom, 62px); z-index: 5;
  padding: 10px 16px; background: rgba(250,250,247,.96);
  border-top: 1px solid var(--hairline, #ecebe5); backdrop-filter: blur(8px);
}
.route-plan-btn.red { background: var(--alert-red, #b23a48); }
