/* ==========================================================================
   旅日記 · 行程手帐 —— 日系小清新样式
   ========================================================================== */
:root {
  --bg: #f3efe6;
  --card: #fffdf8;
  --card-soft: #faf5ec;
  --ink: #443d35;
  --ink-soft: #6e635a;
  --muted: #a49482;
  --line: #e8ddcd;
  --line-soft: #f1e9db;

  --sage: #7fae94;
  --sage-deep: #5d9277;
  --sage-pale: #e4f0e8;
  --sage-ink: #46745d;

  --sakura: #ebaeb6;
  --sakura-deep: #d98995;
  --sakura-pale: #fbebec;

  --apricot: #f2bd94;
  --sky: #9fc0d8;

  --shadow-sm: 0 2px 8px rgba(130, 108, 76, 0.08);
  --shadow-md: 0 10px 26px rgba(130, 108, 76, 0.14);
  --shadow-lg: 0 18px 44px rgba(120, 96, 66, 0.2);

  --r-xl: 24px;
  --r-lg: 18px;
  --r-md: 13px;
  --r-sm: 9px;

  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI",
    "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
}

button { font-family: var(--font); }
input, textarea { font-family: var(--font); }

#app { position: relative; width: 100%; height: 100%; }

/* ---------- 地图 ---------- */
#map {
  position: absolute;
  inset: 0;
  background: #eef0e8;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-lg);
  background: rgba(255, 252, 246, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-md);
}

.brand { display: flex; align-items: center; gap: 11px; user-select: none; }
.brand-mark {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-size: 20px;
  background: linear-gradient(140deg, #8fbfa5, #63997c);
  box-shadow: 0 6px 14px rgba(99, 153, 124, 0.4), inset 0 -3px 6px rgba(0,0,0,.08);
  letter-spacing: 0;
}
.brand-text b {
  display: block;
  font-size: 18px;
  letter-spacing: 6px;
  line-height: 1.1;
}
.brand-text i {
  display: block;
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1.5px;
  margin-top: 3px;
}
.topbar .spacer { flex: 1; }
.topbar .btn-icon-ghost {
  border: 1px solid var(--line);
  background: #fffdf8;
  color: var(--ink-soft);
}

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, #8fbfa5, #63997c);
  color: #fff;
  box-shadow: 0 8px 18px rgba(99, 153, 124, 0.35);
}
.btn-primary:hover { box-shadow: 0 10px 22px rgba(99, 153, 124, 0.45); }

.btn-sakura {
  background: linear-gradient(135deg, #f2bcc2, #e795a0);
  color: #fff;
  box-shadow: 0 8px 18px rgba(231, 149, 160, 0.3);
}

.btn-ghost {
  background: var(--card);
  border-color: var(--line);
  color: var(--ink-soft);
}
.btn-ghost:hover { background: var(--card-soft); }

.btn-soft {
  background: var(--sage-pale);
  color: var(--sage-ink);
}
.btn-soft:hover { background: #d6e9dc; }

.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }

.btn-icon-ghost {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fffdf8;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 15px;
  transition: 0.2s;
}
.btn-icon-ghost:hover { background: var(--sage-pale); color: var(--sage-ink); }
.btn-icon-ghost.mini {
  width: 27px; height: 27px;
  font-size: 12px;
  border-radius: 9px;
}

/* ---------- 侧边面板 ---------- */
.panel {
  position: absolute;
  top: 86px;
  left: 14px;
  bottom: 14px;
  z-index: 50;
  width: 368px;
  max-width: calc(100vw - 40px);
  display: flex;
  flex-direction: column;
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s;
}
.panel.hidden-panel {
  transform: translateX(calc(-100% - 30px));
  opacity: 0;
  pointer-events: none;
}

.panel-tabs {
  display: flex;
  gap: 6px;
  padding: 12px 12px 0;
}
.tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 6px 10px;
  border-radius: 13px 13px 6px 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  letter-spacing: 1px;
  border-bottom: 2px solid transparent;
  transition: 0.2s;
}
.tab-btn.active {
  color: var(--sage-deep);
  background: var(--sage-pale);
  border-bottom-color: var(--sage);
}
.tab-btn .cnt {
  font-size: 10.5px;
  background: var(--sakura-pale);
  color: var(--sakura-deep);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 4px;
  font-weight: 700;
}

.panel-body { flex: 1; overflow-y: auto; padding: 12px 14px 16px; }
.panel-view { display: none; }
.panel-view.active { display: block; }

.panel-foot {
  padding: 10px 14px 14px;
  border-top: 1px dashed var(--line);
  background: #fffdf8;
  display: flex;
  gap: 8px;
}

/* ---------- 表单 ---------- */
.field { position: relative; margin-bottom: 12px; }
.field > label, .mini-label {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 2px;
  margin: 0 0 5px 4px;
  font-weight: 600;
}
.field > label .lbl-emoji { margin-right: 3px; letter-spacing: 0; }

.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fffefb;
  color: var(--ink);
  border-radius: var(--r-md);
  padding: 10px 13px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus, .textarea:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(127, 174, 148, 0.22);
}
.textarea { min-height: 74px; resize: vertical; line-height: 1.6; }
.input::placeholder, .textarea::placeholder { color: #c6b8a6; }

.input-wrap { position: relative; }
.input-wrap .btn-abs {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: var(--sage-pale);
  color: var(--sage-ink);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.input-wrap .btn-abs:hover { background: #d6e9dc; }

/* 联想列表 */
.ac-list {
  display: none;
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 4px);
  z-index: 80;
  background: #fffefb;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  max-height: 210px;
  overflow-y: auto;
  padding: 5px;
}
.ac-item {
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.ac-item:hover { background: var(--sage-pale); }
.ac-item b { font-weight: 600; color: var(--ink); white-space: nowrap; }
.ac-item span {
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ac-empty { padding: 10px; text-align: center; color: var(--muted); font-size: 12px; }

/* ---------- 分段选择（驾车/步行 与 偏好） ---------- */
.seg-row { display: flex; gap: 8px; margin-bottom: 14px; }
.seg {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--card-soft);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: 0.2s;
}
.seg.active {
  background: var(--card);
  border-color: var(--sage);
  color: var(--sage-ink);
  box-shadow: var(--shadow-sm);
}
.seg-row.seg-sm { gap: 5px; }
.seg-row.seg-sm .seg { font-size: 12px; padding: 6px 2px; }

/* ---------- 起点/终点卡片 ---------- */
.point-card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 11px 12px 2px;
  margin-bottom: 12px;
  background: #fffefb;
  position: relative;
}
.point-card .point-tag {
  position: absolute;
  top: -9px;
  left: 12px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  letter-spacing: 2px;
  color: #fff;
}
.point-card.start .point-tag { background: var(--sage); }
.point-card.end .point-tag { background: var(--sakura-deep); }

/* ---------- 途经点列表 ---------- */
.section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  margin: 4px 2px 10px;
  letter-spacing: 1px;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--line) 0 6px, transparent 6px 12px);
}
.section-title .cnt {
  font-size: 10.5px;
  background: var(--sakura-pale);
  color: var(--sakura-deep);
  border-radius: 999px;
  padding: 1px 7px;
  font-weight: 700;
  margin-left: 6px;
}

.via-row {
  display: flex;
  align-items: center;
  gap: 9px;
  background: #fffefb;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 8px 9px;
  margin-bottom: 8px;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.via-row:hover { box-shadow: var(--shadow-sm); border-color: #dccfb9; }
.via-num {
  width: 26px; height: 26px;
  flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--sage-ink);
  background: var(--sage-pale);
  border: 1px solid rgba(127, 174, 148, 0.5);
}
.via-main { flex: 1; min-width: 0; }
.via-name {
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.via-note {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.via-type { font-size: 13px; flex: none; }
.via-actions { display: flex; gap: 4px; flex: none; }

.add-dash-btn {
  width: 100%;
  border: 1.5px dashed #c9bda9;
  background: transparent;
  color: var(--muted);
  border-radius: var(--r-md);
  padding: 11px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  margin-bottom: 12px;
}
.add-dash-btn:hover {
  color: var(--sage-deep);
  border-color: var(--sage);
  background: var(--sage-pale);
}

/* ---------- 汇总与步骤 ---------- */
.summary-card {
  margin-top: 14px;
  border-radius: var(--r-lg);
  padding: 13px 15px;
  background: linear-gradient(135deg, #eef6f0, #e4efe7);
  border: 1px solid #d8e8dd;
}
.summary-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.sum-stat { flex: 1; }
.sum-stat .v {
  font-size: 19px;
  font-weight: 800;
  color: var(--sage-deep);
  letter-spacing: 0.5px;
}
.sum-stat .v small { font-size: 11px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.sum-stat .k { font-size: 10.5px; color: var(--muted); letter-spacing: 2px; margin-top: 2px; }
.summary-meta { font-size: 12px; color: var(--ink-soft); margin-top: 6px; display: flex; gap: 10px; flex-wrap: wrap; }
.route-legend { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.route-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink-soft);
  font-size: 11px;
}
.route-legend i { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(255,255,255,.8); }
.clear-route {
  border: none;
  background: #fff;
  color: var(--muted);
  font-size: 11.5px;
  border-radius: 999px;
  padding: 5px 11px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.clear-route:hover { color: var(--sakura-deep); }

.steps-block { margin-top: 12px; }
.steps-block .steps-title {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 2px;
  font-weight: 700;
  margin: 0 0 8px 4px;
}
.steps-list { list-style: none; margin: 0; padding: 0; }
.step-item {
  position: relative;
  padding: 0 0 14px 26px;
  font-size: 12.8px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.step-item::before {
  content: "";
  position: absolute;
  left: 7px; top: 5px; bottom: 0;
  width: 2px;
  background: repeating-linear-gradient(180deg, #d5cbb9 0 4px, transparent 4px 8px);
}
.step-item:last-child { padding-bottom: 2px; }
.step-item:last-child::before { display: none; }
.step-item .dot {
  position: absolute;
  left: 1px; top: 3px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fffefb;
  border: 2px solid var(--sage);
}
.step-item b { color: var(--sage-deep); font-weight: 700; }
.step-item .d {
  float: right;
  font-size: 11px;
  color: var(--muted);
  background: #f4ecdf;
  border-radius: 999px;
  padding: 0 8px;
  margin-left: 8px;
}

/* ---------- 旅程存档 ---------- */
.trip-card {
  background: #fffefb;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 13px 14px;
  margin-bottom: 11px;
  cursor: pointer;
  transition: 0.2s;
}
.trip-card:hover { box-shadow: var(--shadow-md); border-color: #d9ccb8; transform: translateY(-1px); }
.trip-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.trip-head .name {
  flex: 1;
  font-weight: 700;
  font-size: 15px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.trip-stamp {
  font-size: 10px;
  color: var(--sakura-deep);
  background: var(--sakura-pale);
  border-radius: 999px;
  padding: 2px 9px;
  letter-spacing: 1px;
  font-weight: 700;
}
.trip-meta { font-size: 11.5px; color: var(--muted); line-height: 1.8; }
.trip-meta b { color: var(--sage-deep); font-weight: 700; }
.trip-stops {
  margin-top: 7px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.trip-stop-chip {
  font-size: 11px;
  background: var(--card-soft);
  border: 1px solid var(--line-soft);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 2px 9px;
  max-width: 150px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.trip-card .trip-foot { display: flex; gap: 6px; margin-top: 10px; }
.trip-card .trip-foot .btn { flex: 1; }

.empty-tip {
  text-align: center;
  padding: 34px 14px;
  color: var(--muted);
}
.empty-tip .big { font-size: 40px; margin-bottom: 8px; }
.empty-tip p { font-size: 13px; line-height: 1.9; margin: 4px 0; }

.archive-head { display: flex; gap: 8px; margin-bottom: 12px; }
.archive-head .btn { flex: 1; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: absolute;
  inset: 0;
  z-index: 200;
  background: rgba(80, 66, 50, 0.32);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-mask.open { display: flex; }
.modal-card {
  width: 430px;
  max-width: 100%;
  max-height: 88%;
  overflow-y: auto;
  background: var(--card);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid #fff;
  padding: 18px 20px 16px;
  animation: popIn 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes popIn {
  from { transform: translateY(14px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.modal-head .m-title {
  flex: 1;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 2px;
}
.modal-head .m-title small {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0;
  font-weight: 600;
  margin-top: 2px;
}
.modal-head .close-x {
  border: none;
  background: var(--card-soft);
  color: var(--muted);
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
}
.modal-head .close-x:hover { background: var(--sakura-pale); color: var(--sakura-deep); }

.type-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.type-chip {
  border: 1px solid var(--line);
  background: var(--card-soft);
  border-radius: 999px;
  font-size: 12.5px;
  padding: 6px 11px;
  cursor: pointer;
  color: var(--ink-soft);
  transition: 0.15s;
}
.type-chip.active {
  background: var(--sage-pale);
  border-color: var(--sage);
  color: var(--sage-ink);
  font-weight: 700;
}
.type-chip .tc-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
}

.modal-foot { display: flex; gap: 8px; margin-top: 4px; }
.modal-foot .btn { flex: 1; }

.pick-hint {
  font-size: 11.5px;
  color: var(--sage-ink);
  background: var(--sage-pale);
  border-radius: var(--r-sm);
  padding: 8px 11px;
  margin-bottom: 12px;
  line-height: 1.6;
  display: none;
}
.pick-hint.show { display: block; }

/* ---------- Toast ---------- */
#toast {
  position: absolute;
  top: 78px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  z-index: 300;
  background: rgba(68, 61, 53, 0.92);
  color: #fff7ec;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  max-width: 86vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.warn { background: rgba(217, 137, 149, 0.95); }
#toast.ok { background: rgba(93, 146, 119, 0.95); }

/* ---------- 加载遮罩 ---------- */
#loading {
  position: absolute;
  inset: 0;
  z-index: 400;
  background: linear-gradient(160deg, #fbf7ee, #f1efe5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  transition: opacity 0.5s;
}
#loading.fade-out { opacity: 0; pointer-events: none; }
.loader-ring {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 5px solid #e3e0d4;
  border-top-color: var(--sage);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading .l-text { color: var(--muted); font-size: 13px; letter-spacing: 3px; }
#loading .l-brand { font-size: 22px; letter-spacing: 8px; color: var(--sage-deep); font-weight: 800; }
#loading .l-sub { font-size: 11px; color: var(--muted); letter-spacing: 2px; }

/* ---------- 展开气泡 ---------- */
#bubble {
  display: none;
  position: absolute;
  left: 20px;
  bottom: 26px;
  z-index: 45;
  width: 54px; height: 54px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(140deg, #8fbfa5, #63997c);
  color: #fff;
  font-size: 22px;
  box-shadow: 0 10px 22px rgba(99, 153, 124, 0.45);
  cursor: pointer;
}
#bubble:active { transform: scale(0.94); }

/* ---------- 地图上的图钉 ---------- */
.map-pin {
  position: relative;
  width: 34px;
  height: 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.map-pin .pin-body {
  width: 30px; height: 30px;
  border-radius: 50% 50% 50% 4px;
  transform: rotate(-45deg);
  display: grid;
  place-items: center;
  box-shadow: 0 6px 12px rgba(90, 74, 54, 0.3);
  border: 2px solid #fffefb;
}
.map-pin .pin-txt {
  transform: rotate(45deg);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  font-style: normal;
}
.map-pin .pin-shadow {
  position: absolute;
  bottom: 0;
  left: 50%;
  margin-left: -7px;
  width: 14px; height: 6px;
  background: rgba(90, 74, 54, 0.25);
  border-radius: 50%;
  filter: blur(1.5px);
}
.map-pin.start .pin-body { background: linear-gradient(140deg, #8fbfa5, #5d9277); }
.map-pin.end .pin-body { background: linear-gradient(140deg, #f2bcc2, #e795a0); }
.map-pin.via .pin-body {
  background: linear-gradient(140deg, #fdf3df, #f7e3bc);
  border-color: #fffefb;
}
.map-pin.via .pin-txt { color: #8a7a5f; }
.map-pin .pin-emoji {
  font-size: 12px;
  font-weight: 700;
  color: #8a7a5f;
}

.route-transfer-marker {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 2px solid #fffdf6;
  border-radius: 50%;
  color: #fff;
  background: #526158;
  box-shadow: 0 4px 10px rgba(53, 64, 57, 0.38);
  font-size: 13px;
  line-height: 1;
}

/* ---------- 图例 ---------- */
.legend {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 20px;
  z-index: 45;
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--ink-soft);
  box-shadow: var(--shadow-md);
  display: flex;
  gap: 12px;
  align-items: center;
  user-select: none;
}
.legend .lg-item { display: flex; align-items: center; gap: 5px; }
.legend .swatch {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.sw-start { background: var(--sage); }
.sw-end { background: var(--sakura-deep); }
.sw-via { background: #f0dcae; border: 1px solid #d9bc7d; }
.legend .hint-dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--sakura); margin: 0 2px;
}

/* ---------- 地图控件微调 ---------- */
.amap-logo { opacity: 0.75; }
.amap-copyright { opacity: 0.8; }

/* ---------- 滚动条 ---------- */
.panel-body::-webkit-scrollbar,
.modal-card::-webkit-scrollbar,
.ac-list::-webkit-scrollbar { width: 6px; }
.panel-body::-webkit-scrollbar-thumb,
.modal-card::-webkit-scrollbar-thumb,
.ac-list::-webkit-scrollbar-thumb {
  background: #e0d5c2;
  border-radius: 999px;
}
.panel-body::-webkit-scrollbar-track,
.modal-card::-webkit-scrollbar-track,
.ac-list::-webkit-scrollbar-track { background: transparent; }

/* ---------- 小屏适配 ---------- */
@media (max-width: 720px) {
  .topbar {
    top: 8px; left: 8px; right: 8px;
    padding: 8px 11px;
  }
  .brand-text i { display: none; }
  .brand-text b { font-size: 16px; letter-spacing: 4px; }
  .panel {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-width: none;
    max-height: 62vh;
    border-radius: 20px;
  }
  .panel.hidden-panel {
    transform: translateY(calc(100% + 20px));
  }
  #bubble { left: 16px; bottom: 16px; }
  .legend { left: 50%; transform: translateX(-50%); bottom: 12px; }
  .legend .lg-hint { display: none; }
  #toast { top: 66px; }
}

/* ==========================================================================
   v2 增补样式（分天行程 / 媒体 / 分享 / 备份）
   ========================================================================== */

.panel-tabs.tabs3 .tab-btn { font-size: 13px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line);
  background: var(--card-soft);
  color: var(--ink-soft);
  border-radius: 999px;
  font-size: 12.5px;
  padding: 7px 13px;
  cursor: pointer;
  transition: 0.15s;
}
.chip.active {
  background: var(--sage-pale);
  border-color: var(--sage);
  color: var(--sage-ink);
  font-weight: 700;
}
.soft-hr { border: none; border-top: 1px dashed var(--line); margin: 16px 0; }
.share-tip { font-size: 12px; color: var(--muted); margin-bottom: 12px; letter-spacing: 1px; }
.share-note {
  font-size: 11.5px; color: var(--muted); line-height: 1.7;
  background: var(--card-soft); border-radius: var(--r-sm); padding: 8px 10px;
}
.check-line {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--ink-soft); margin: 6px 0; cursor: pointer;
}
.check-line input { accent-color: var(--sage-deep); width: 15px; height: 15px; }
.archive-sub { font-size: 11.5px; color: var(--muted); margin: -4px 2px 12px; line-height: 1.6; }
.backup-reminder { display: flex; align-items: center; gap: 9px; margin: 0 0 12px; padding: 9px 10px; border: 1px solid #ead8b7; background: #fff9eb; border-radius: var(--r-md); color: #80633c; font-size: 11.5px; line-height: 1.55; }
.backup-reminder span { flex: 1; min-width: 0; }
.backup-preview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin: 8px 0; }
.backup-preview > div { text-align: center; padding: 9px 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-soft); }
.backup-preview b { display: block; color: var(--sage-deep); font-size: 18px; }
.backup-preview span { display: block; color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.restore-meta { margin: 7px 0; color: var(--muted); font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }

/* 分天卡片 */
.day-card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: #fffefb;
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color .2s;
}
.day-card.is-active { border-color: var(--sage); box-shadow: 0 0 0 3px rgba(127,174,148,.14); }
.day-head {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px 6px;
  border-bottom: 1px dashed var(--line-soft);
  background: #fdf9f1;
}
.day-tag {
  flex: none; font-size: 11px; font-weight: 800; letter-spacing: 1px;
  color: #fff; background: var(--sage);
  padding: 3px 9px; border-radius: 999px;
}
.day-head .day-title {
  flex: 1; min-width: 0; font-size: 13px; padding: 5px 8px;
  border: 1px solid transparent; background: transparent; border-radius: 8px;
}
.day-head .day-title:focus {
  border-color: var(--sage); background: #fff; box-shadow: none;
}
.day-head .day-date {
  width: 126px; flex: none; font-size: 11.5px; padding: 5px 6px;
}
.day-items { padding: 6px 8px 8px; }

.stop-row {
  display: flex; align-items: center; gap: 8px;
  border-radius: var(--r-md);
  padding: 6px 7px;
  background: var(--card);
}
.stop-row:hover { background: var(--sage-pale); }
.stop-row.is-wish { opacity: .72; }
.stop-row + .stop-row { margin-top: 4px; }
.stop-seq {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 800; color: var(--sage-ink);
  background: var(--sage-pale); border: 1px solid rgba(127,174,148,.5);
}
.stop-main { flex: 1; min-width: 0; }
.stop-name {
  font-size: 13px; font-weight: 700; line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stop-sub {
  font-size: 11px; color: var(--muted); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stop-acts { flex: none; display: flex; gap: 3px; align-items: center; }
.btn-icon-ghost.mini.danger:hover { background: var(--sakura-pale); color: var(--sakura-deep); }
.mini-sel {
  border: 1px solid var(--line); border-radius: 7px; font-size: 10.5px;
  color: var(--muted); padding: 2px 2px; background: #fff;
  max-width: 66px;
}
.empty-tip.small { padding: 18px 8px; }

/* 起点/终点 地图选点 */
.input-wrap .btn-abs.picking {
  background: var(--sakura);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(235,174,182,.35);
}
/* 攻略信息折叠区 */
.guide-details { margin: 10px 0 6px; border: 1px dashed var(--line); border-radius: var(--r-md); padding: 8px 10px; }
.guide-details summary {
  cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--sage-ink);
  letter-spacing: 1px; user-select: none;
}
.guide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; margin-top: 8px; }
.guide-grid .field.full { grid-column: 1 / -1; }
.guide-grid .field { margin-bottom: 8px; }
.guide-grid .field > label { margin-bottom: 3px; }

.score-row { display: flex; gap: 5px; padding-top: 5px; }
.score-dot {
  width: 30px; height: 30px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card-soft);
  color: #d8cbb6; font-size: 16px; cursor: pointer;
}
.score-dot.on { color: #f0b26a; background: #fdf3e0; border-color: #ecc48a; }

/* 媒体 */
.media-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; min-height: 6px; }
.media-tile {
  position: relative; width: 64px; height: 64px;
  border-radius: 12px; overflow: hidden;
  background: var(--card-soft); border: 1px solid var(--line);
}
.media-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tile .media-audio {
  width: 100%; height: 100%; display: grid; place-items: center;
  font-size: 11px; color: var(--sage-ink); background: var(--sage-pale);
}
.media-del {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  border: none; background: rgba(40,30,20,.55); color: #fff;
  font-size: 10px; cursor: pointer; line-height: 1;
}

/* 分享弹窗内容 */
.share-card { width: 480px; }
.share-help { font-size: 12px; color: var(--muted); line-height: 1.8; margin: 10px 0 0; }
.share-btns { display: flex; gap: 8px; margin-top: 12px; }
.share-btns .btn { flex: 1; }
.textarea.tall { min-height: 220px; font-size: 13px; line-height: 1.7; }
.warn-box {
  margin-top: 10px; border-radius: var(--r-md);
  background: var(--sakura-pale); border: 1px solid #f3cdd1;
  padding: 8px 11px; font-size: 12px; color: #8a5a61;
}
.warn-box.ok { background: var(--sage-pale); border-color: #cfe2d5; color: var(--sage-ink); }
.warn-item { line-height: 1.7; }
.warn-item b { color: var(--sakura-deep); margin-right: 4px; }
#shareBody .mini-label { margin-top: 4px; }

/* 站点弹窗尺寸略加宽 */
.modal-card { width: 470px; }

/* 分享/存档按钮的加载态 */
.btn:disabled { opacity: .6; }

/* 分天行程标题行（含智能排序入口） */
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-title .btn-icon-ghost.mini {
  padding: 3px 9px; font-size: 11.5px; color: var(--sage-deep);
  border-color: #d5e4da; background: var(--sage-pale); border-radius: 20px;
}
.section-title .btn-icon-ghost.mini:hover { background: #dceee2; }

/* 周边好去处弹窗 */
.poi-card { width: 470px; max-height: 80vh; display: flex; flex-direction: column; }
.poi-card .modal-head { flex: none; }
.poi-card .mini-label { margin: 10px 0 6px; }
#poiList {
  flex: 1 1 auto; overflow-y: auto; margin-top: 4px;
  min-height: 120px; max-height: 52vh;
}
.poi-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--card-soft); border: 1px solid var(--line-soft);
  border-radius: 13px; padding: 8px 12px; margin-bottom: 7px;
}
.poi-item .poi-name { font-weight: 700; font-size: 13px; color: var(--ink); }
.poi-item .poi-meta {
  flex: 1 1 auto; font-size: 11px; color: var(--muted); min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.poi-item .btn { flex: none; }
.poi-item .btn:hover { background: var(--sage-pale); border-color: #cfe0d2; color: var(--sage-deep); }

/* 组合出行（分程编辑） */
.mix-plan {
  border: 1px dashed #e0d3bd; background: #fdfaf2; border-radius: var(--r-md);
  padding: 9px 11px; margin: 2px 0 12px;
}
.mix-head {
  font-size: 12px; font-weight: 700; color: var(--sage-deep); margin-bottom: 8px; letter-spacing: .5px;
}
.mix-row {
  display: flex; align-items: center; gap: 8px; padding: 5px 0;
  border-bottom: 1px dashed var(--line-soft);
}
.mix-row:last-child { border-bottom: none; }
.mix-seg-name {
  flex: 1 1 auto; min-width: 0; font-size: 11.5px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mix-dist { color: var(--muted); font-size: 10px; margin-left: 4px; }
.mix-sel { max-width: 112px; flex: none; font-size: 11px; }

/* 起终点失败兜底 */
.endpoint-help { display: none; border: 1px solid #efd0d4; background: #fff7f8; border-radius: var(--r-md); padding: 10px 12px; margin: 2px 0 12px; }
.endpoint-help.show { display: block; }
.endpoint-help b { display: block; color: #925962; font-size: 12.5px; margin-bottom: 4px; }
.endpoint-help p { margin: 0 0 8px; color: #8e7478; font-size: 11.5px; line-height: 1.6; }
.endpoint-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* 语音与轻记录 */
.media-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.media-actions label { cursor: pointer; }
.rec-state { display: none; margin-top: 7px; color: var(--sakura-deep); font-size: 11.5px; }
.rec-state.show { display: block; }
.rec-state.recording::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #dc6674; margin-right: 6px; animation: recPulse 1s infinite; }
.media-tile audio { width: 58px; height: 30px; margin-top: 17px; }
.media-missing { display: grid; place-items: center; width: 100%; height: 100%; font-size: 10px; color: var(--sakura-deep); background: var(--sakura-pale); }
@keyframes recPulse { 50% { opacity: .25; } }

/* 撤销提示 */
#undoToast { position: absolute; left: 50%; bottom: 24px; z-index: 310; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; display: flex; align-items: center; gap: 12px; background: rgba(68,61,53,.94); color: #fff7ec; padding: 9px 11px 9px 16px; border-radius: 999px; box-shadow: var(--shadow-md); font-size: 12.5px; transition: .22s; }
#undoToast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#undoToast button { border: none; border-radius: 999px; padding: 5px 11px; background: #fff5e7; color: #755642; font-weight: 800; cursor: pointer; }

/* 分天工具 */
.day-tools { display: flex; gap: 3px; flex: none; }
.day-note { padding: 0 10px 8px 42px; color: var(--muted); font-size: 10.5px; }

/* 分段文案编辑器 */
.copy-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.copy-stat { flex: 1; min-width: 140px; font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.copy-section { border: 1px solid var(--line); background: #fffefb; border-radius: var(--r-md); padding: 8px; margin-top: 8px; }
.copy-section-head { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.copy-section-head b { flex: 1; font-size: 12px; color: var(--ink); }
.copy-state { border-radius: 999px; padding: 2px 7px; background: var(--sage-pale); color: var(--sage-ink); font-size: 10px; }
.copy-state.edited { background: #fdf0d6; color: #9a6b2e; }
.copy-state.manual { background: #e8eefb; color: #526f9d; }
.copy-state.locked { background: var(--sakura-pale); color: var(--sakura-deep); }
.warn-ignore { float: right; border: 1px solid #edbdc4; border-radius: 999px; background: #fff; color: #a15d68; font-size: 10.5px; padding: 2px 7px; cursor: pointer; }
.copy-section textarea { min-height: 76px; font-size: 12.5px; line-height: 1.65; }
.copy-section textarea:disabled { background: #f7f3ec; color: #756d64; }
.copy-section-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.copy-section-actions .btn { padding: 5px 8px; font-size: 10.5px; }
.copy-warning-hits { margin-top: 8px; font-size: 11px; color: #8a5a61; line-height: 1.7; }
.poster-cover-row { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.poster-cover-row .btn { flex: 1; }

@media (max-width: 720px) {
  .modal-card { width: 100%; max-height: 92%; padding: 15px 14px 13px; }
  .share-card { width: 100%; }
  .copy-section-actions .btn { flex: 1; }
  .media-actions .btn, .media-actions label { flex: 1; }
}
