/* ===== 基础重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; user-select: none; }

/* ===== 主题变量 ===== */
:root {
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-dark: #1d4ed8;
  --accent: #06b6d4;
  --bg: #f0f2f5;
  --panel-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-dark: #cbd5e1;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 1px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);
  --radius: 8px;
  --radius-sm: 5px;
  --title-h: 38px;
  --status-h: 26px;
  --left-w: 260px;
  --weather-w: 400px;   /* 天气列固定宽度：折叠/展开均不变（用户说的「100」） */
  --guide-w: 400px;     /* 旅游攻略列固定宽度：与天气列等宽，仅展开时显示 */
  --toggle-w: 20px;     /* 中间总开关按钮宽 */
}

/* ===== 整体布局 ===== */
#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  background: var(--bg);
}

/* ===== 标题栏 ===== */
.title-bar {
  height: var(--title-h);
  background: linear-gradient(135deg, #1e293b, #334155);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; flex-shrink: 0; -webkit-app-region: drag;
}
.title-bar-left { display: flex; align-items: center; gap: 8px; }
.app-icon { font-size: 18px; }
.app-title { color: #fff; font-size: 13px; font-weight: 600; letter-spacing: .5px; }
.app-version { color: #94a3b8; font-size: 11px; }
.title-bar-right { display: flex; gap: 4px; -webkit-app-region: no-drag; }
.tb-btn {
  background: rgba(255,255,255,.08); color: #cbd5e1; border: 1px solid rgba(255,255,255,.1);
  padding: 4px 12px; border-radius: 4px; cursor: pointer; font-size: 12px; transition: all .15s;
}
.tb-btn:hover { background: rgba(255,255,255,.2); color: #fff; }
.tb-toggle { display: none; }
.panel-backdrop { display: none; }

/* ===== 工具栏（已整合进左侧编辑页，样式保留备用） ===== */
.tb-label { font-size: 12px; color: var(--text-muted); white-space: nowrap; font-weight: 600; }
.tb-input {
  padding: 5px 8px; border: 1px solid var(--border-dark); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text); background: #fff; transition: border-color .15s;
}
.tb-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,.1); }
/* 路线偏好下拉：去除原生外观，统一为输入框风格 */
#drive-policy {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; padding-right: 26px; cursor: pointer;
}
#drive-policy::-ms-expand { display: none; }
.tb-icon-btn {
  width: 30px; height: 30px; border: 1px solid var(--border-dark); border-radius: var(--radius-sm);
  background: #fff; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.tb-icon-btn:hover { background: #f1f5f9; border-color: var(--primary); }
.search-input { width: 140px; }

/* ===== 全国地点输入建议下拉（自建，替代高德 AutoComplete） ===== */
.amap-suggest-list {
  position: absolute;
  z-index: 2000;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  max-height: 260px;
  overflow-y: auto;
  font-size: 13px;
  color: var(--text);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.amap-suggest-list.hidden { display: none; }
.amap-suggest-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background .12s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.amap-suggest-item:last-child { border-bottom: none; }
.amap-suggest-item:hover,
.amap-suggest-item.active {
  background: #eff6ff;
}
.amap-suggest-item .as-icon {
  flex-shrink: 0;
  font-size: 14px;
  line-height: 1.5;
  opacity: .65;
}
.amap-suggest-item .as-body { min-width: 0; flex: 1; }
.amap-suggest-item .as-name {
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
}
.amap-suggest-item .as-region {
  font-size: 11.5px;
  color: var(--primary);
  font-weight: 600;
  margin-top: 2px;
  line-height: 1.3;
  word-break: break-word;
}
.amap-suggest-item .as-addr {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
  line-height: 1.3;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* 规划按钮 */
.plan-btn {
  padding: 6px 20px; border: none; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; cursor: pointer;
  transition: all .2s; box-shadow: 0 2px 6px rgba(37,99,235,.25);
}
.plan-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(37,99,235,.35); }
.plan-btn:active { transform: translateY(0); }
.plan-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ===== 主体区域 ===== */
.app-body { flex: 1; display: flex; overflow: hidden; }

/* ===== 面板通用 ===== */
.panel { background: var(--panel-bg); overflow-y: auto; flex-shrink: 0; }
.panel::-webkit-scrollbar { width: 5px; }
.panel::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }
.panel::-webkit-scrollbar-track { background: transparent; }

/* ===== 左侧面板 ===== */
.left-panel { width: var(--left-w); border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.panel-section { margin-bottom: 14px; }
.section-header {
  font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .8px; margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1px solid var(--border);
}

/* 路线节点列表 */
.route-points-list { display: flex; flex-direction: column; gap: 6px; }
.route-point-item {
  background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; transition: all .15s;
  animation: slideIn .2s ease;
}
.route-point-item:hover { border-color: var(--primary); box-shadow: 0 1px 4px rgba(37,99,235,.08); }
.route-point-item.is-start { border-left: 3px solid var(--success); }
.route-point-item.is-end { border-left: 3px solid var(--danger); }
.route-point-item.is-waypoint { border-left: 3px solid var(--accent); }
@keyframes slideIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

.rp-top { display: flex; align-items: center; gap: 6px; }
.rp-badge {
  width: 22px; height: 22px; border-radius: 50%; font-size: 11px; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.rp-badge.start { background: var(--success); }
.rp-badge.end { background: var(--danger); }
.rp-badge.waypoint { background: var(--accent); }
.rp-name {
  flex: 1; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: default; user-select: text;
}
.rp-del { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 14px; padding: 0 2px; opacity: .6; }
.rp-del:hover { opacity: 1; }
.rp-detail { display: flex; gap: 8px; flex-wrap: wrap; font-size: 11px; color: var(--text-muted); }
.rp-detail label { display: flex; align-items: center; gap: 3px; }
.rp-detail input { width: 48px; padding: 2px 4px; border: 1px solid var(--border); border-radius: 3px; font-size: 11px; text-align: center; }
.rp-arrival { color: var(--primary); font-weight: 600; }
.rp-gap { color: #0891b2; font-weight: 600; }
.rp-drive { color: var(--text-muted); }
.rp-empty { font-size: 12px; color: var(--text-muted); text-align: center; padding: 16px; }

/* 路线摘要 */
.route-summary { background: #f8fafc; border-radius: var(--radius-sm); padding: 10px; }
.summary-row { display: flex; justify-content: space-between; font-size: 12px; padding: 3px 0; }
.summary-row span:first-child { color: var(--text-muted); }
.summary-row span:last-child { font-weight: 600; }

/* ===== 地图区域 ===== */
.map-container { flex: 1; position: relative; overflow: hidden; min-width: 300px; min-height: 300px; }
#map { width: 100%; height: 100%; }
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--bg); z-index: 50; transition: opacity .3s;
}
.map-loading.hidden { opacity: 0; pointer-events: none; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.map-controls { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 5px; z-index: 10; }
.map-ctrl-btn {
  width: 34px; height: 34px; border: none; border-radius: 6px; background: #fff; cursor: pointer;
  font-size: 16px; box-shadow: var(--shadow); transition: all .15s; display: flex; align-items: center; justify-content: center;
}
.map-ctrl-btn:hover { background: #f1f5f9; }
.map-ctrl-btn.active { background: var(--primary); color: #fff; }
#btn-locate { color: #2563eb; }
#btn-locate.active { background: #2563eb; color: #fff; }
#btn-locate.locating { animation: spin 1s linear infinite; }
#btn-locate-center { color: #f97316; }
#btn-locate-center.active { background: #f97316; color: #fff; }

/* ===== 我的位置 / 路程关联信息卡（地图左上角） ===== */
.loc-panel {
  position: absolute; top: 10px; left: 10px; z-index: 12;
  max-width: 230px; padding: 8px 10px;
  background: rgba(255,255,255,0.94); backdrop-filter: blur(4px);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); font-size: 12px; line-height: 1.5; color: var(--text);
}
.loc-panel.hidden { display: none; }
.loc-row { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; }
.loc-rel { margin-top: 4px; color: #334155; }
.loc-rel b { color: #f97316; }
.loc-hint { color: var(--text-muted); font-weight: 400; }
.loc-end { color: #16a34a; font-weight: 700; }
.loc-action {
  margin-top: 7px; width: 100%; padding: 5px 0;
  border: none; border-radius: 7px; cursor: pointer;
  background: #f1f5f9; color: #334155; font-size: 12px; font-weight: 600;
  transition: background .15s;
}
.loc-action:hover { background: #e2e8f0; }
.loc-action.hidden { display: none; }
/* 把我的位置设为起点：强调为橘色主操作按钮 */
.loc-set-start {
  background: #f97316; color: #fff; margin-top: 7px;
}
.loc-set-start:hover { background: #ea580c; }

/* ===== 路线实时路况图例 ===== */
.traffic-legend {
  position: absolute; right: 10px; bottom: 10px; z-index: 10;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: rgba(255,255,255,0.92); backdrop-filter: blur(4px);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 12px; box-shadow: var(--shadow); font-size: 12px; color: var(--text);
}
.traffic-legend .tl-title { font-weight: 600; color: var(--text-muted); margin-right: 2px; }
.traffic-legend .tl-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.traffic-legend .tl-dot { width: 14px; height: 6px; border-radius: 3px; display: inline-block; }
.tl-smooth { background: #1aad19; }
.tl-slow   { background: #f6c244; }
.tl-jam    { background: #e84b3a; }
.tl-heavy  { background: #8e1b1b; }

/* ===== 右侧面板 ===== */
.right-panel { width: calc(var(--guide-w) + var(--toggle-w) + var(--weather-w)); border-left: 1px solid var(--border); display: flex; flex-direction: column; }
.right-panel.guide-collapsed { width: calc(var(--toggle-w) + var(--weather-w)); }
.right-head { flex-shrink: 0; }
/* 右栏主体：城市列 | 攻略列(等宽) | 中间总开关 | 天气列(等宽) */
.rp-body { flex: 1; min-height: 0; display: flex; overflow: hidden; }
.weather-col { flex: 0 0 var(--weather-w); width: var(--weather-w); min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.weather-scroll { flex: 1; min-height: 0; overflow-y: auto; }

.panel-tabs { display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.tab-btn {
  flex: 1; padding: 8px; border: none; background: none; cursor: pointer; font-size: 12px; font-weight: 600;
  color: var(--text-muted); border-bottom: 2px solid transparent; transition: all .15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { flex: 1; overflow-y: auto; }
.tab-content.hidden { display: none; }
.weather-list { padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.weather-empty { color: var(--text-muted); font-size: 12px; text-align: center; padding: 30px 12px; line-height: 1.8; }

/* 天气面板底部：更新信息 + 强制刷新 */
.weather-footer {
  flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 10px; border-top: 1px solid var(--border); background: #f8fafc; font-size: 11px; color: var(--text-muted);
}
.weather-update-info { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.footer-refresh-btn {
  border: 1px solid var(--border-dark); background: #fff; color: var(--text-muted); border-radius: 4px;
  padding: 3px 10px; cursor: pointer; font-size: 12px; white-space: nowrap; transition: all .15s;
}
.footer-refresh-btn:hover { border-color: var(--primary); color: var(--primary); }
.footer-refresh-btn:disabled { opacity: .5; cursor: not-allowed; }

/* 天气卡片 */
.weather-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.06);
  animation: fadeIn .3s ease; transition: border-color .2s, box-shadow .2s, transform .2s;
}
.weather-card.highlight {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.35), 0 10px 28px rgba(15,23,42,.16);
  transform: translateY(-1px);
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.wc-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px; color: #fff; background: linear-gradient(120deg, #3b82f6, #6366f1);
}
.wc-city { font-size: 14px; font-weight: 700; letter-spacing: .3px; display: flex; align-items: center; }
.wc-seq {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px; margin-right: 7px;
  background: #fff; color: var(--primary); border-radius: 10px;
  font-size: 11px; font-weight: 800; box-shadow: 0 1px 3px rgba(0,0,0,.22); flex-shrink: 0;
}
.wc-arrival { font-size: 11px; opacity: .92; font-weight: 600; margin-top: 1px; }
.wc-days { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 14px; overflow-x: visible; }

/* 旅游攻略列（与天气列等宽，显示当前选中城市的景点） */
.guide-col {
  flex: 0 0 var(--guide-w); width: var(--guide-w); min-width: 0; display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border-right: 1px solid var(--border);
}
.guide-col-head {
  flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; background: linear-gradient(120deg, #6366f1, #8b5cf6); color: #fff;
}
.gch-title { font-size: 13px; font-weight: 700; letter-spacing: .3px; }
.gch-city { font-size: 12px; font-weight: 600; opacity: .95; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guide-col-body { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 12px; }

/* 中间总开关：展开 / 隐藏旅游攻略栏 */
.guide-toggle-btn {
  flex: 0 0 var(--toggle-w); width: var(--toggle-w); border: none; cursor: pointer;
  background: #eef2ff; color: #6366f1; font-size: 16px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border-right: 1px solid var(--border);
  transition: background .15s; touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none;
}
.guide-toggle-btn:hover { background: #e0e7ff; }

/* 折叠态：面板收窄为「总开关 + 天气列」，隐藏攻略列 */
.right-panel.guide-collapsed .guide-col { display: none; }

.guide-loading, .guide-empty { font-size: 12px; color: var(--text-muted); padding: 8px 2px; }
.guide-item { display: flex; gap: 10px; padding: 9px 6px; border-bottom: 1px solid #f1f5f9; cursor: pointer; border-radius: 8px; transition: background .15s; align-items: center; }
.guide-item:hover { background: #f1f5f9; }
.guide-item:active { background: #e2e8f0; }
.guide-item:last-child { border-bottom: none; }
.gi-nav {
  flex-shrink: 0; align-self: center;
  border: none; border-radius: 999px;
  padding: 6px 11px; font-size: 12px; font-weight: 700;
  color: #fff; background: var(--primary, #4f46e5);
  cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 4px rgba(79,70,229,.35);
}
.gi-nav:hover { background: #4338ca; }
.gi-nav:active { transform: scale(.96); }
/* 我的位置标记（蓝点 + 脉冲光环） */
.mk-me {
  width: 18px; height: 18px; border-radius: 50%;
  background: #2563eb; border: 3px solid #fff;
  box-shadow: 0 0 0 2px #2563eb, 0 0 8px rgba(37,99,235,.7);
  position: relative;
}
.mk-me::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(37,99,235,.35);
  transform: translate(-50%, -50%);
  animation: mk-me-pulse 1.6s ease-out infinite;
}
@keyframes mk-me-pulse { 0% { width: 18px; height: 18px; opacity: .7; } 100% { width: 46px; height: 46px; opacity: 0; } }
.gi-rank {
  flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff;
  font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; margin-top: 2px;
}
.gi-photo { width: 56px; height: 56px; border-radius: 9px; object-fit: cover; flex-shrink: 0; background: #eef2f7; }
.gi-photo--empty { display: flex; align-items: center; justify-content: center; font-size: 26px; }
.gi-info { min-width: 0; flex: 1; }
.gi-name { font-weight: 700; font-size: 13px; color: var(--text); line-height: 1.25; }
.gi-type {
  display: inline-block; margin-top: 3px; font-size: 11px; color: #6366f1;
  background: #eef2ff; padding: 1px 7px; border-radius: 5px; font-weight: 600;
}
.gi-desc { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; line-height: 1.45; }
.gi-addr { font-size: 11px; color: #94a3b8; margin-top: 3px; }

/* 天气日签（卡片 & 弹窗共用） */
.weather-day {
  flex: 0 0 auto; min-width: 52px; text-align: center; padding: 9px 5px;
  border-radius: 11px; background: #f8fafc; border: 1px solid transparent;
  transition: all .15s ease; cursor: default;
}
.weather-day:hover { background: #eef2ff; transform: translateY(-1px); }
.weather-day.highlight { background: #e0ecff; border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.wd-date { font-size: 10px; color: #64748b; font-weight: 600; }
.wd-icon { margin: 4px 0 2px; line-height: 0; }
.wd-icon svg { width: 32px; height: 32px; display: inline-block; }
.wd-temp { font-size: 11px; line-height: 1.2; }
.wd-high { color: #ef4444; font-weight: 700; }
.wd-low { color: #3b82f6; font-weight: 600; }
.wd-label { font-size: 9px; color: #94a3b8; margin-top: 2px; }

/* 天气弹窗 */
.weather-popup {
  position: fixed; z-index: 1500; background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 18px 50px rgba(15,23,42,.28); min-width: 320px; max-width: min(820px, 94vw);
  border: 1px solid var(--border); animation: popIn .2s ease;
}
@keyframes popIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
.weather-popup.hidden { display: none; }
.wp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; color: #fff; background: linear-gradient(120deg, #3b82f6, #6366f1);
}
.wp-title { font-size: 15px; font-weight: 700; }
.wp-sub { font-size: 11px; opacity: .9; margin-top: 2px; }
.wp-close { cursor: pointer; color: rgba(255,255,255,.9); font-size: 20px; line-height: 1; padding: 0 2px; transition: color .15s; }
.wp-close:hover { color: #fff; }
.wp-days { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px; overflow-x: visible; }
.wp-loading { text-align: center; padding: 28px; color: var(--text-muted); font-size: 13px; }
.wp-error { text-align: center; padding: 28px; color: var(--danger); font-size: 13px; }

/* 地图天气药丸（悬浮在每个城市标记旁，无需拖动直接展示） */
.map-wx-pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.96); border: 1px solid rgba(15,23,42,.08);
  border-radius: 999px; padding: 3px 9px 3px 5px; box-shadow: 0 3px 10px rgba(15,23,42,.18);
  cursor: default; font-size: 11px; line-height: 1; user-select: none; backdrop-filter: blur(2px);
  pointer-events: none; /* 不拦截点击，确保底部城市标记的编号可点中 */
}
.mwp-icon { width: 22px; height: 22px; display: inline-flex; flex-shrink: 0; }
.mwp-icon svg { width: 22px; height: 22px; }
.mwp-temp { display: inline-flex; align-items: baseline; gap: 2px; font-weight: 800; color: #0f172a; }
.mwp-hi { font-size: 12px; }
.mwp-lo { font-size: 10px; color: #64748b; font-weight: 700; }
.mwp-label { font-size: 10px; color: #475569; font-weight: 600; }

/* ===== 地图标记（高德 content 模式） ===== */
.mk-wp { line-height: 0; filter: drop-shadow(0 2px 3px rgba(0,0,0,.3)); }
.mk-dot { line-height: 0; }
.mk-dot-inner {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 800;
  border: 2.5px solid #fff; box-shadow: 0 2px 5px rgba(0,0,0,.35);
  background: var(--c, #64748b);
}

/* ===== 地图右键菜单 ===== */
.map-context-menu {
  position: fixed; z-index: 2000; background: #fff; border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,.15); border: 1px solid var(--border);
  min-width: 160px; padding: 6px 0; animation: ctxIn .15s ease;
}
.map-context-menu.hidden { display: none; }
@keyframes ctxIn { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }
.context-item {
  padding: 8px 16px; font-size: 13px; cursor: pointer; transition: background .1s;
  display: flex; align-items: center; gap: 6px;
}
.context-item:hover { background: #f1f5f9; }
.context-item.danger { color: var(--danger); }
.context-item.danger:hover { background: #fef2f2; }
.context-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ===== 自动检测城市（路线节点列表中的特殊样式）===== */
.route-point-item.is-auto { border-left: 3px solid #8b5cf6; opacity: .9; }
.rp-badge.auto { background: #8b5cf6; font-size: 10px; }
.rp-auto-tag { font-size: 10px; color: #8b5cf6; background: #f5f3ff; padding: 1px 6px; border-radius: 3px; margin-left: 4px; }

/* ===== 左侧标签页 ===== */
.left-tabs { display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.left-tab-btn {
  flex: 1; padding: 9px 6px; border: none; background: none; cursor: pointer; font-size: 12px; font-weight: 600;
  color: var(--text-muted); border-bottom: 2px solid transparent; transition: all .15s; white-space: nowrap;
}
.left-tab-btn:hover { color: var(--text); background: #f8fafc; }
.left-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: #f8fafc; }
.left-tab-content { flex: 1; overflow-y: auto; padding: 10px; }
.left-tab-content.hidden { display: none; }
.left-summary { flex-shrink: 0; border-bottom: 1px solid var(--border); background: #fbfcfe; margin: 0; padding: 10px; }

/* 编辑标签页顶部「设置区」 */
.edit-setup { flex-shrink: 0; display: flex; flex-direction: column; gap: 7px; padding: 10px; background: #f8fafc; border-bottom: 1px solid var(--border); }
.setup-block { display: flex; align-items: center; gap: 6px; }
.setup-label { font-size: 12px; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.setup-block .tb-input { flex: 1; min-width: 0; }
.setup-block .search-input { flex: 1; min-width: 0; width: auto; }
.setup-plan { width: 100%; margin-top: 2px; }

/* 路线编辑列表 */
.route-edit-list { display: flex; flex-direction: column; gap: 2px; }
.edit-row {
  display: flex; align-items: center; gap: 6px; background: #f8fafc;
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 5px 6px;
  animation: slideIn .15s ease;
}
.edit-row.is-start { border-left: 3px solid var(--success); }
.edit-row.is-end { border-left: 3px solid var(--danger); }
.edit-row.is-waypoint { border-left: 3px solid var(--accent); }
.edit-row:focus-within { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.edit-badge {
  width: 22px; height: 22px; border-radius: 50%; font-size: 11px; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.edit-badge.start { background: var(--success); }
.edit-badge.end { background: var(--danger); }
.edit-badge.waypoint { background: var(--accent); }
.edit-input {
  flex: 1; min-width: 0; padding: 5px 7px; border: 1px solid var(--border); border-radius: 4px;
  font-size: 13px; color: var(--text); background: #fff; user-select: text;
}
.edit-input:focus { outline: none; border-color: var(--primary); }
.edit-input-pending { border-style: dashed; border-color: var(--accent); background: #f0fdff; }
.edit-move { display: flex; flex-direction: column; gap: 1px; flex-shrink: 0; }
.edit-move button {
  width: 20px; height: 13px; border: 1px solid var(--border-dark); background: #fff; color: var(--text-muted);
  cursor: pointer; font-size: 9px; line-height: 1; border-radius: 3px; padding: 0;
}
.edit-move button:hover { background: #f1f5f9; color: var(--primary); }
.edit-del { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 14px; padding: 0 2px; opacity: .55; flex-shrink: 0; }
.edit-del:hover { opacity: 1; }
.edit-spacer { width: 20px; flex-shrink: 0; }
.edit-insert { display: flex; justify-content: center; padding: 1px 0; }
.edit-insert-btn {
  border: 1px dashed var(--border-dark); background: #fff; color: var(--text-muted); cursor: pointer;
  font-size: 11px; border-radius: 4px; padding: 2px 10px; transition: all .15s; width: 100%;
}
.edit-insert-btn:hover { border-color: var(--primary); color: var(--primary); background: #f8fafc; }
.edit-hint { font-size: 10px; color: var(--text-muted); line-height: 1.6; margin-top: 10px; padding: 6px 8px; background: #f8fafc; border-radius: 5px; border: 1px dashed var(--border); }

/* ===== 状态栏 ===== */
.status-bar {
  height: var(--status-h); background: #1e293b; color: #94a3b8; display: flex;
  align-items: center; justify-content: space-between; padding: 0 12px; font-size: 11px; flex-shrink: 0;
}

/* ===== 弹窗 ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 1000; backdrop-filter: blur(2px); }
.modal-overlay.hidden { display: none; }
.modal { background: #fff; border-radius: 10px; width: 400px; max-width: 90vw; max-height: 80vh; box-shadow: var(--shadow-lg); animation: modalIn .2s ease; display: flex; flex-direction: column; }
@keyframes modalIn { from { opacity: 0; transform: scale(.95) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 16px; cursor: pointer; color: var(--text-muted); }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 16px 18px; overflow-y: auto; }

/* 保存槽位 */
.save-slot { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 6px; transition: all .15s; }
.save-slot:hover { border-color: var(--primary); background: #f8fafc; }
.slot-info { flex: 1; }
.slot-name { font-weight: 600; font-size: 13px; }
.slot-date { font-size: 11px; color: var(--text-muted); }
.slot-actions { display: flex; gap: 5px; }
.slot-btn { padding: 3px 10px; border: none; border-radius: 4px; cursor: pointer; font-size: 12px; transition: all .15s; }
.slot-btn.save { background: var(--primary); color: #fff; }
.slot-btn.save:hover { background: var(--primary-dark); }
.slot-btn.load { background: var(--success); color: #fff; }
.slot-btn.load:hover { background: #16a34a; }
.slot-btn.delete { background: var(--danger); color: #fff; }
.slot-btn.delete:hover { background: #dc2626; }
.save-slot.empty .slot-info { color: var(--text-muted); font-style: italic; font-size: 13px; }

/* ===== Toast ===== */
.toast { position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%); background: rgba(30,41,59,.95); color: #fff; padding: 8px 20px; border-radius: 6px; font-size: 13px; z-index: 2000; box-shadow: var(--shadow-lg); transition: all .25s; }
.toast.hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(12px); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

/* ===== 响应式 & 触摸适配 ===== */
@media (max-width: 1280px) { :root { --weather-w: 340px; --guide-w: 340px; } }

/* 平板竖屏 / 小屏：左右面板改为可滑出的抽屉，避免挤压地图 */
@media (max-width: 1024px) {
  .tb-toggle { display: inline-block; }
  .app-body { position: relative; }

  .left-panel {
    position: absolute; top: 0; bottom: 0; left: 0; z-index: 30;
    width: min(84%, 340px); transform: translateX(-105%);
    transition: transform .25s ease; box-shadow: var(--shadow-lg);
  }
  .left-panel.show-left { transform: none; }
  .right-panel {
    position: absolute; top: 0; bottom: 0; right: 0; z-index: 30;
    width: min(88%, 440px); transform: translateX(105%);
    transition: transform .25s ease; box-shadow: var(--shadow-lg);
  }
  .right-panel.show-right { transform: none; }

  .panel-backdrop { display: block; position: absolute; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }
  .panel-backdrop.hidden { display: none; }

  /* 右栏在小屏改为纵向堆叠：攻略段 → 总开关条 → 天气列表 */
  .rp-body { flex-direction: column; }
  .guide-col { flex: none; width: auto; max-height: 38vh; border-right: none; border-bottom: 1px solid var(--border); }
  .guide-toggle-btn { width: 100%; height: 26px; border-right: none; border-bottom: 1px solid var(--border); font-size: 18px; }
  .weather-col { flex: 1 1 auto; width: auto; }

  /* 触摸目标加大，便于手指点按 */
  .tb-icon-btn, .map-ctrl-btn { min-width: 38px; min-height: 38px; }
  .edit-move button, .rp-del, .edit-del { min-width: 34px; min-height: 30px; }
  .tb-input, .edit-input, .search-input { font-size: 16px; padding: 9px 11px; }
  .amap-suggest-item { padding: 12px 13px; }
  .amap-suggest-item .as-name { font-size: 14px; }
  .amap-suggest-item .as-region { font-size: 12.5px; }
  .amap-suggest-item .as-addr { font-size: 12px; }
  .guide-item { padding: 11px 0; }
  .gi-photo { width: 64px; height: 64px; }
  .gi-name { font-size: 14px; }
  .gi-desc { font-size: 12.5px; }
  .tab-btn, .left-tab-btn { padding: 12px 8px; font-size: 13px; }
  .plan-btn { padding: 11px 20px; font-size: 14px; }
  .footer-refresh-btn, .tb-btn { padding: 7px 12px; font-size: 13px; }
  .map-ctrl-btn { font-size: 18px; }
}

/* 触摸滚动优化：明确纵向滚动，避免被地图手势抢占 / 滚动链传导 */
.panel, .weather-scroll, .guide-col-body, .tab-content, .left-tab-content, .modal-body {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

/* 触屏设备取消对 :hover 的依赖（hover 在触屏无意义，仅保留点击态） */
@media (hover: none) {
  .route-point-item:hover { transform: none; }
  .weather-day:hover { background: #f8fafc; }
}
