/* 路线层：叠加在地图上，随 mapCanvas 一起缩放拖动 */
.route-layer {
  position: absolute;
  z-index: 7;
  inset: 0;
  pointer-events: none;
}
.route-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.route-line {
  fill: none;
  stroke-width: 28;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 74 44;
  opacity: 0.88;
  filter: drop-shadow(0 0 0.25px rgba(255,255,255,0.9));
}
.route-stop-badge {
  stroke: #fff;
  stroke-width: 14;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.25));
}
.route-stop-label {
  fill-opacity: 0.95;
  stroke-opacity: 0.58;
  stroke-width: 8;
  filter: drop-shadow(0 1px 1.6px rgba(28,52,41,0.18));
}
.route-stop-leader {
  stroke-width: 12;
  stroke-dasharray: 28 18;
  opacity: 0.82;
}
.route-stop-number,
.route-stop-name {
  font-family: Bahnschrift, Arial, sans-serif;
  pointer-events: none;
  user-select: none;
}
.route-stop-number {
  fill: #fff;
  font-size: 56px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.route-stop-name {
  fill: #24342f;
  font-family: STKaiti, KaiTi, "Microsoft YaHei", sans-serif;
  font-size: 72px;
  font-weight: 800;
  letter-spacing: 1.5px;
}

body.route-active .hotspot-layer {
  visibility: hidden;
  opacity: 0;
}
body.route-active .hotspot-anchor {
  visibility: hidden;
  opacity: 0;
}

/* 路线入口：固定在标题栏下方 */
.route-entry-bar {
  position: fixed;
  z-index: 19;
  top: max(82px, calc(env(safe-area-inset-top) + 68px));
  left: max(14px, env(safe-area-inset-left));
  pointer-events: none;
}
.route-entry-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0.85rem 1.3rem;
  border: 1px solid rgba(255,255,255,0.78);
  border-radius: 999px;
  color: var(--moss-dark);
  background: rgba(245,247,242,0.96);
  box-shadow: 0 12px 32px rgba(28,52,41,0.22);
  backdrop-filter: blur(14px);
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 150ms ease, background 150ms ease;
}
.route-entry-button:hover { background: white; transform: translateY(-1px); }
.route-entry-button svg { flex: 0 0 auto; }

/* 顶部路线状态胶囊：默认隐藏（hidden 属性优先于 display），仅路线激活时显示 */
.route-status-pill[hidden] { display: none; }
.route-status-pill {
  position: absolute;
  z-index: 13;
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.5rem 0.6rem 0.5rem 0.9rem;
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(245,247,242,0.96);
  box-shadow: 0 10px 28px rgba(28,52,41,0.2);
  backdrop-filter: blur(14px);
  font-size: 0.78rem;
  animation: route-pill-arrive 220ms ease-out both;
  pointer-events: auto;
}
.route-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brick);
  box-shadow: 0 0 0 2px rgba(185,78,61,0.22);
}
.route-status-name { font-weight: 800; }
.route-status-duration { color: var(--ink-soft); font-size: 0.7rem; }
.route-status-pill > button {
  width: 26px;
  height: 26px;
  margin-left: 2px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: white;
  background: var(--ink-soft);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

@keyframes route-pill-arrive {
  from { transform: translate(-50%, -12px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* 路线选择抽屉 */
.route-sheet[hidden] { display: none; }
.route-sheet {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: 18px;
}
.route-backdrop { position: absolute; inset: 0; background: rgba(22,39,32,0.58); backdrop-filter: blur(5px); }
.route-dialog {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(720px, calc(100dvh - 36px));
  overflow-y: auto;
  padding: 22px;
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: 24px;
  background: rgba(245,247,242,0.98);
  box-shadow: 0 30px 80px rgba(0,0,0,0.3);
  animation: modal-rise 220ms ease-out both;
}
.route-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.route-heading p { margin: 0 0 3px; color: var(--brick); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.12em; }
.route-heading h2 { margin: 0; font-family: STKaiti, KaiTi, "Microsoft YaHei", sans-serif; font-size: 1.45rem; }
.route-heading > button { width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; color: white; background: var(--moss-dark); font-size: 1.45rem; cursor: pointer; }
.route-hint { margin: 12px 0 15px; color: var(--ink-soft); font-size: 0.8rem; line-height: 1.55; }
.route-cards { display: grid; gap: 12px; }
.route-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto 1fr;
  gap: 6px 12px;
  width: 100%;
  padding: 16px;
  border: 1px solid rgba(36,52,47,0.12);
  border-radius: 18px;
  color: var(--ink);
  background: rgba(255,255,255,0.62);
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}
.route-card:hover { border-color: rgba(63,99,60,0.38); background: white; transform: translateY(-1px); }
.route-card-badge {
  grid-row: 1 / span 2;
  align-self: center;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px 16px 16px 4px;
  color: white;
  font-size: 0.72rem;
  font-weight: 900;
}
.route-card strong { font-size: 1.05rem; }
.route-card small { color: var(--ink-soft); font-size: 0.7rem; }
.route-card-desc {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.6;
}

body.route-sheet-open { overflow: hidden; }

@media (max-width: 720px) {
  .route-sheet { padding: 0; }
  .route-dialog { width: 100%; max-height: 86dvh; padding: 19px 16px calc(16px + env(safe-area-inset-bottom)); border-width: 1px 0 0; border-radius: 24px 24px 0 0; }
  .route-dialog::before { content: ""; display: block; width: 42px; height: 4px; margin: -10px auto 10px; border-radius: 999px; background: rgba(36,52,47,0.22); }
  .route-entry-bar { top: max(72px, calc(env(safe-area-inset-top) + 58px)); left: max(10px, env(safe-area-inset-left)); }
  .route-entry-button { padding: 0.75rem 1.1rem; font-size: 0.88rem; }
  .route-status-pill {
    top: max(72px, calc(env(safe-area-inset-top) + 58px));
    right: max(10px, env(safe-area-inset-right));
    left: auto;
    max-width: calc(100% - 160px);
    transform: none;
    white-space: nowrap;
    animation-name: route-pill-arrive-mobile;
  }
}

@media (max-width: 380px) {
  .route-status-duration { display: none; }
}

@keyframes route-pill-arrive-mobile {
  from { transform: translateY(-12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes modal-rise { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
