/* tripplanner 样式 - 移动优先 */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: #f4f6f8; color: #222; }
body { padding-bottom: 40px; }
.hidden { display: none !important; }
.mt8 { margin-top: 8px; }
.flex1 { flex: 1; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg,#1f6feb,#4f9cf9); color: #fff;
  padding: 14px 16px; box-shadow: 0 2px 10px rgba(31,111,235,.3);
}
.brand { font-size: 18px; font-weight: 700; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.btn-user, .btn-icon {
  background: rgba(255,255,255,.2); border: none; color: #fff; cursor: pointer;
  width: 38px; height: 38px; border-radius: 50%; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.btn-user:hover, .btn-icon:hover { background: rgba(255,255,255,.35); }

.view { max-width: 640px; margin: 0 auto; padding: 14px; }

/* 认证 */
.auth-card {
  background: #fff; border-radius: 18px; padding: 30px 24px; margin-top: 36px;
  box-shadow: 0 6px 24px rgba(0,0,0,.07); text-align: center;
}
.auth-card h1 { font-size: 24px; color: #1f6feb; }
.auth-card .sub { color: #888; margin: 10px 0 24px; line-height: 1.7; }
.tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 20px; }
.tab { padding: 8px 24px; border-radius: 20px; border: 1px solid #ddd; background: #f7f8fa; cursor: pointer; color: #555; }
.tab.active { background: #1f6feb; color: #fff; border-color: #1f6feb; }
#form-auth { text-align: left; max-width: 320px; margin: 0 auto; }

.field { margin-bottom: 14px; text-align: left; }
.field label { display: block; font-size: 13px; color: #666; margin-bottom: 6px; }
.field input {
  width: 100%; padding: 11px 12px; border: 1px solid #ddd; border-radius: 10px;
  font-size: 15px; background: #fff;
}
.field input:focus { outline: none; border-color: #1f6feb; }
.row { display: flex; gap: 8px; align-items: center; }
.row input { flex: 1; }

.btn-primary {
  width: 100%; padding: 13px; border: none; border-radius: 12px; background: #1f6feb;
  color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn-primary:hover { background: #1a5fd0; }
.btn-primary:disabled { background: #9bb8f0; cursor: not-allowed; }
#btn-restart { margin-top: 18px; }
.btn-ghost {
  padding: 11px 16px; border: 1px solid #ddd; border-radius: 12px; background: #fff;
  color: #555; font-size: 14px; cursor: pointer;
}
.btn-ghost:hover { background: #f0f2f5; }
.btn-ghost.link { border: none; color: #1f6feb; background: none; padding: 6px 0; font-size: 13px; }
.btn-danger { padding: 11px 16px; border: 1px solid #f0b4b4; border-radius: 12px; background: #fff; color: #d33; font-size: 14px; cursor: pointer; }
.err { color: #d33; font-size: 13px; min-height: 18px; margin: 6px 0; }
.hint { color: #999; font-size: 12px; }

/* 面板/步骤卡片 */
.panel { background: #fff; border-radius: 16px; padding: 18px; margin-bottom: 14px; box-shadow: 0 2px 12px rgba(0,0,0,.05); }
.step-card { border-left: 4px solid #1f6feb; }
.step-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.step-no {
  width: 24px; height: 24px; border-radius: 50%; background: #1f6feb; color: #fff;
  font-size: 13px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}

.banner { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.banner.warn { background: #fff6e6; color: #8a5a00; border: 1px solid #ffd591; }
.banner a { color: #1f6feb; font-weight: 600; }

.loc-result { background: #eef4ff; border-radius: 10px; padding: 10px 12px; margin-top: 10px; font-size: 13px; color: #1f6feb; word-break: break-all; }

/* 时长输入 */
.dur-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dur-row .dur-input, .addr-input {
  flex: 1; min-width: 0; padding: 12px 14px; border: 1.5px solid #d4dae2; border-radius: 10px;
  font-size: 15px; font-family: inherit; background: #fff; text-align: center;
}
.dur-row .dur-input:focus, .addr-input:focus { outline: none; border-color: #1f6feb; }
.dur-row span { color: #666; }

/* 结果 */
.result-head { background: linear-gradient(135deg,#1f6feb,#4f9cf9); color: #fff; border: none; }
.result-head .rh-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.result-head .rh-meta { font-size: 13px; opacity: .9; line-height: 1.7; }

.timeline-item {
  background: #fff; border-radius: 14px; padding: 14px 16px; margin-bottom: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,.05); position: relative; border-left: 4px solid #ccc;
}
.timeline-item.type-meal { border-left-color: #ff9f43; }
.timeline-item.type-outdoor { border-left-color: #2ecc71; }
.timeline-item.type-indoor { border-left-color: #1f6feb; }
.timeline-item.type-ent { border-left-color: #9b59b6; }
.timeline-item.type-hotel { border-left-color: #f368e0; }
.ti-head { display: flex; justify-content: space-between; align-items: center; }
.ti-tag { font-size: 16px; font-weight: 700; }
.ti-time { font-size: 13px; color: #1f6feb; font-weight: 600; }
.ti-reason { font-size: 13px; color: #666; margin: 6px 0 10px; }
.poi-list { display: flex; flex-direction: column; gap: 8px; }
.poi-item { border: 1px solid #eef0f3; border-radius: 10px; padding: 10px 12px; background: #fcfdfe; }
.poi-clickable { cursor: pointer; transition: border-color .15s, background .15s; }
.poi-clickable:hover, .poi-clickable:active { border-color: #1f6feb; background: #f0f6ff; }
.poi-route-hint { font-size: 11px; color: #1f6feb; font-weight: 600; margin-left: 4px; }
.poi-item .pname { font-size: 14px; font-weight: 600; }
.poi-item .pmeta { font-size: 12px; color: #888; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 8px; }
.poi-item .badge { background: #eef4ff; color: #1f6feb; border-radius: 5px; padding: 0 6px; font-size: 12px; }
.poi-item .tel { color: #1f6feb; text-decoration: none; }
.poi-empty { text-align: center; color: #999; padding: 12px; font-size: 13px; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: #fff; border-radius: 16px; width: 100%; max-width: 420px; box-shadow: 0 8px 30px rgba(0,0,0,.2); overflow: hidden; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid #f0f0f0; }
.modal-head h2 { font-size: 17px; }
.modal-close { font-size: 24px; border: none; background: none; cursor: pointer; color: #999; line-height: 1; }
.profile-body, .history-body { padding: 18px; }
.profile-body hr { border: none; border-top: 1px solid #f0f0f0; margin: 16px 0; }
.key-state { font-size: 13px; }
.key-state.ok { color: #22a06b; }
.key-state.bad { color: #d33; }
.history-item { border: 1px solid #eef0f3; border-radius: 10px; padding: 12px; margin-bottom: 10px; cursor: pointer; }
.history-item:hover { border-color: #1f6feb; }
.history-item .haddr { font-size: 14px; font-weight: 600; }
.history-item .hmeta { font-size: 12px; color: #888; margin-top: 4px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: rgba(30,30,30,.92); color: #fff; padding: 10px 22px; border-radius: 24px;
  font-size: 14px; z-index: 99; max-width: 85%;
}

/* 加载屏/旋转 */
.center { text-align: center; }
.spinner {
  width: 34px; height: 34px; margin: 10px auto;
  border: 3px solid #e0e4ea; border-top-color: #1f6feb;
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 模式选择 seg */
.seg-row {
  display: flex; gap: 8px; margin-bottom: 14px;
}
.seg-btn {
  flex: 1; padding: 10px 6px; border-radius: 10px; border: 1.5px solid #d4dae2;
  background: #fff; color: #4a5568; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.seg-btn.active {
  border-color: #1f6feb; background: #eef4ff; color: #1f6feb;
}
.mode-sub { }

/* 地址输入行 (统一样式) */
.addr-row {
  display: flex; gap: 8px;
}
.addr-go { flex-shrink: 0; padding: 12px 20px; }

/* 随机候选列表 */
.suggest { margin-top: 14px; }
.suggest-title {
  font-size: 13px; color: #718096; font-weight: 600; margin-bottom: 8px;
}
.suggest-item {
  padding: 10px 14px; border: 1px solid #e6eaef; border-radius: 10px; margin-bottom: 8px;
  background: #fff; cursor: pointer; transition: all .15s;
  display: flex; justify-content: space-between; align-items: center;
}
.suggest-item:active { background: #eef4ff; border-color: #1f6feb; }
.si-name { font-weight: 600; color: #1a202c; font-size: 15px; }
.si-meta { font-size: 12px; color: #718096; margin-top: 2px; }
.si-dist { font-size: 13px; color: #1f6feb; font-weight: 600; flex-shrink: 0; }

/* 进度条 */.progress-wrap { margin-top: 14px; }
.progress-track {
  height: 10px; background: #e8ecf1; border-radius: 6px; overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #1f6feb, #4f9cf5);
  border-radius: 6px; transition: width .35s ease;
}
.progress-text {
  margin-top: 8px; font-size: 13px; color: #4a5568; display: flex; align-items: center; gap: 6px;
  min-height: 18px;
}
.progress-text::before {
  content: '';
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid #cbd5e1; border-top-color: #1f6feb; border-radius: 50%;
  animation: spin .8s linear infinite; flex-shrink: 0;
}

/* 角色标签 */
.role-tag {
  display: inline-block; padding: 4px 12px; border-radius: 14px; font-size: 13px; font-weight: 600;
  margin-bottom: 14px; background: #eef4ff; color: #1f6feb;
}

/* 密钥显示 */
.key-display {
  background: #f5f7fa; border: 1px dashed #cbd5e1; border-radius: 10px;
  padding: 12px; font-size: 13px; color: #555; text-align: center; word-break: break-all;
}

/* 粘贴弹窗 textarea */
textarea#paste-key-input {
  width: 100%; padding: 11px 12px; border: 1px solid #ddd; border-radius: 10px;
  font-size: 14px; font-family: inherit; resize: vertical; min-height: 56px;
}
textarea#paste-key-input:focus { outline: none; border-color: #1f6feb; }

/* ===== 三条路线方案 ===== */
.routes-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.route-tab {
  flex: 1; min-width: 140px; padding: 12px 10px; border-radius: 12px; border: 1.5px solid #d4dae2;
  background: #fff; cursor: pointer; text-align: left; transition: all .15s; position: relative;
}
.route-tab.active { border-color: #1f6feb; background: #eef4ff; }
.route-tab .rt-rank {
  position: absolute; top: 8px; right: 8px; font-size: 11px; font-weight: 700; color: #fff;
  background: #1f6feb; border-radius: 8px; padding: 2px 7px;
}
.route-tab .rt-rank.best { background: #f59e0b; }
.route-tab .rt-title { font-weight: 700; color: #1a202c; font-size: 14px; margin-bottom: 3px; }
.route-tab .rt-stats { font-size: 12px; color: #718096; }
.route-tab .rt-score { font-size: 12px; color: #1f6feb; font-weight: 600; margin-top: 3px; }

.route-map-wrap { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid #e6eaef; background: #eef3f8; }
#route-canvas { width: 100%; height: 300px; display: block; }
.route-to-map { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid #e6eaef; background: #eef3f8; }
#rto-canvas { width: 100%; height: 320px; display: block; }
.route-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(238,243,248,.85); color: #718096; font-weight: 600; font-size: 14px; z-index: 2;
}
.route-meta { margin-top: 12px; font-size: 13px; color: #4a5568; line-height: 1.7; }
.route-meta .rm-title { font-weight: 700; color: #1a202c; font-size: 15px; margin-bottom: 4px; }
.route-meta .rm-stops { color: #718096; }
.route-to-meta { margin-top: 12px; font-size: 13px; color: #4a5568; text-align: center; }

/* ===== 互动路线卡片 ===== */
.route-card .modal-card { max-width: 460px; }
