:root {
  --bg: #FAF7F5;
  --surface: #FFFFFF;
  --surface-soft: #F3EEEC;
  --ink: #1D1A1C;
  --ink-2: #595256;
  --ink-3: #8D8589;
  --line: rgba(29, 26, 28, 0.09);

  --rose: #B83E58;
  --rose-bg: #FCEEEF;
  --plum: #4F3D63;
  --plum-bg: #F2EEF7;
  --amber: #BA6920;
  --amber-bg: #FDF3E6;
  --teal: #1D685C;
  --teal-bg: #E8F4F1;

  --amap: #1677FF;
  --xhs: #FF2442;
  --dy: #161823;

  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow: 0 2px 10px rgba(29, 26, 28, 0.045);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: #ECE6E4;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, a { font-family: inherit; }

.app-shell {
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.06);
  padding-bottom: calc(74px + var(--safe-bottom));
}

/* 顶部吸顶栏 */
.top-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(250, 247, 245, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding: calc(10px + var(--safe-top)) 15px 10px;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.eyebrow {
  font-size: 11px;
  color: var(--ink-3);
}

.app-title {
  margin: 1px 0 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.badge-live {
  flex-shrink: 0;
  background: var(--rose);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.weather-strip {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 11.5px;
  color: var(--ink-2);
}

.sunset-pill {
  font-weight: 700;
  color: var(--plum);
  background: var(--plum-bg);
  padding: 2px 7px;
  border-radius: 6px;
}

/* 主区 */
.main-content { padding: 12px 14px 20px; }

.tab-panel { display: none; }
.tab-panel.is-active {
  display: block;
  animation: fadeIn 0.16s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 路线控制卡 */
.control-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px 13px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}

.control-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.control-kicker {
  font-size: 12px;
  font-weight: 700;
  color: var(--rose);
}

.control-sub {
  font-size: 11.5px;
  color: var(--ink-3);
}

.route-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 9px;
}

.route-btn {
  border: 1.5px solid var(--line);
  background: var(--surface-soft);
  border-radius: 11px;
  padding: 8px 7px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.route-btn.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.route-btn-tag {
  font-size: 10.5px;
  font-weight: 700;
  opacity: 0.78;
}

.route-btn-name {
  font-size: 12.5px;
  font-weight: 700;
  margin-top: 2px;
  line-height: 1.3;
}

.return-toggle-row {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.return-label {
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 600;
}

.segmented-sm {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-soft);
  padding: 3px;
  border-radius: 9px;
  gap: 3px;
}

.seg-btn {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 6px;
  border-radius: 7px;
  cursor: pointer;
}

.seg-btn.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.strategy-tip {
  background: var(--amber-bg);
  border: 1px solid rgba(186, 105, 32, 0.2);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 12.5px;
  color: #6B3E13;
  line-height: 1.48;
  margin-bottom: 12px;
}

/* 时间线 */
.timeline-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 12px 14px;
}

.tl-header {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.tl-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.tl-desc {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--ink-2);
}

.tl-item {
  position: relative;
  padding: 12px 0 12px 16px;
  border-left: 1.5px solid var(--line);
}

.tl-item:last-child { padding-bottom: 4px; }

.tl-dot {
  position: absolute;
  left: -5.5px;
  top: 17px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--ink-3);
}

.tl-item.kind-train .tl-dot { border-color: var(--plum); background: var(--plum-bg); }
.tl-item.kind-shop .tl-dot { border-color: var(--rose); background: var(--rose-bg); }
.tl-item.kind-photo .tl-dot { border-color: var(--amber); background: var(--amber-bg); }
.tl-item.kind-food .tl-dot { border-color: var(--teal); background: var(--teal-bg); }

.tl-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.tl-time {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
}

.tl-transit {
  font-size: 11px;
  font-weight: 600;
  color: var(--plum);
  background: var(--plum-bg);
  padding: 1px 7px;
  border-radius: 999px;
}

.tl-name {
  margin-top: 3px;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.badge-kind {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
}
.bk-train { background: var(--plum-bg); color: var(--plum); }
.bk-shop { background: var(--rose-bg); color: var(--rose); }
.bk-photo { background: var(--amber-bg); color: var(--amber); }
.bk-food { background: var(--teal-bg); color: var(--teal); }

.tl-note {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
}

.tl-subbox {
  margin-top: 6px;
  padding: 7px 9px;
  border-radius: 8px;
  background: var(--surface-soft);
  font-size: 12px;
  color: var(--ink);
  line-height: 1.48;
}

/* 操作按钮 */
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.act-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  cursor: pointer;
}

.act-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
.act-amap { background: #EEF5FF; border-color: rgba(22, 119, 255, 0.22); color: var(--amap); }
.act-xhs { background: #FFF0F2; border-color: rgba(255, 36, 66, 0.22); color: var(--xhs); }
.act-dy { background: #F2F2F5; border-color: rgba(22, 24, 35, 0.16); color: var(--dy); }
.act-12306 { background: var(--plum-bg); border-color: rgba(79, 61, 99, 0.22); color: var(--plum); }

/* 筛选条与通用卡片 */
.section-intro {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.section-intro h2 { margin: 0; font-size: 16px; }
.section-intro p { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-2); }

.filter-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }

.chip-btn {
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
}
.chip-btn.is-active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.spot-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 13px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

.spot-title {
  margin: 5px 0 0;
  font-size: 15.5px;
  font-weight: 700;
}

.meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.meta-chip {
  font-size: 11.5px;
  color: var(--ink-2);
  background: var(--surface-soft);
  padding: 2px 8px;
  border-radius: 6px;
}

.spot-desc {
  margin-top: 7px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
}

.spot-tip {
  margin-top: 7px;
  padding: 7px 9px;
  border-radius: 8px;
  background: var(--rose-bg);
  color: #6B2334;
  font-size: 12px;
  line-height: 1.45;
}

.spot-tip.is-amber {
  background: var(--amber-bg);
  color: #6B3E13;
}

/* 高铁与安全 */
.prep-section { margin-bottom: 18px; }
.prep-title { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.prep-sub { margin: 0 0 10px; font-size: 12.5px; color: var(--ink-2); }

.live-query-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 10px;
}

.query-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
}

.query-12306 { background: var(--plum); color: #fff; }
.query-amap { background: #EEF5FF; color: var(--amap); border: 1px solid rgba(22, 119, 255, 0.25); }

.train-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

.train-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--plum);
}

.train-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}
.train-row:last-child { border-bottom: 0; padding-bottom: 0; }

.train-code { font-weight: 700; color: var(--ink); }
.train-time { font-weight: 700; color: var(--rose); }
.train-note { font-size: 11.5px; color: var(--ink-3); }

.tip-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  margin-bottom: 8px;
}
.tip-title { font-size: 13.5px; font-weight: 700; }
.tip-desc { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.48; }

.checklist-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 4px 13px;
  box-shadow: var(--shadow);
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.check-item:last-child { border-bottom: 0; }
.check-item input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--rose); flex-shrink: 0; }
.check-text { font-size: 13.5px; }
.check-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.check-item.is-done .check-text { text-decoration: line-through; color: var(--ink-3); }

/* 底部导航 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding: 6px 6px calc(6px + var(--safe-bottom));
}

.nav-item {
  border: 0;
  background: transparent;
  color: var(--ink-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 2px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.nav-item svg { width: 20px; height: 20px; }
.nav-item.is-active { color: var(--rose); }

.toast {
  position: fixed;
  bottom: calc(82px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: rgba(29, 26, 28, 0.92);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 60;
  white-space: nowrap;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
