/* style.css — 骑行保到(移动端优先,深色主题) */

:root {
  --bg: #0f1523;
  --card: #1a2234;
  --card-line: #2a3550;
  --text: #eef2fb;
  --text-dim: #8b97b3;
  --accent: #4da3ff;
  --green: #34c77b;
  --red: #ff5d5d;
  --yellow: #ffc94d;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(12px + env(safe-area-inset-top)) 14px calc(24px + env(safe-area-inset-bottom));
}

/* ---------- 视图切换 ---------- */
.view { display: none; }
.view.active { display: block; }
.hidden { display: none !important; }

/* ---------- 页头 ---------- */
.page-head { margin: 10px 2px 16px; }
.page-head h1 { font-size: 26px; letter-spacing: 1px; }
.page-head .sub { color: var(--text-dim); font-size: 13px; margin-top: 6px; line-height: 1.5; }
.row-head { display: flex; align-items: baseline; gap: 10px; }

.tag {
  font-size: 12px;
  color: var(--yellow);
  border: 1px solid var(--yellow);
  border-radius: 999px;
  padding: 2px 10px;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.card h2 { font-size: 15px; margin-bottom: 12px; color: var(--accent); }

/* ---------- 表单 ---------- */
.field { display: block; margin-bottom: 12px; }
.field span {
  display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px;
}
input[type="text"], input[type="time"] {
  width: 100%;
  background: #10182b;
  border: 1px solid var(--card-line);
  color: var(--text);
  border-radius: 10px;
  padding: 12px;
  font-size: 16px;
  outline: none;
}
input:focus { border-color: var(--accent); }
.row { display: flex; gap: 8px; }
.row input { flex: 1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 4px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.hint { font-size: 12px; color: var(--text-dim); margin-top: 8px; line-height: 1.6; }
.hint.center { text-align: center; }

/* ---------- 搜索结果 ---------- */
.search-tip { color: var(--text-dim); font-size: 13px; padding: 10px 2px; }
.search-item {
  padding: 10px 8px;
  border-bottom: 1px solid var(--card-line);
  cursor: pointer;
}
.search-item:active { background: #223052; }
.s-name { font-size: 15px; }
.s-addr { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* ---------- 按钮 ---------- */
.btn {
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 15px;
  cursor: pointer;
  transition: opacity .15s;
}
.btn:active { opacity: .75; }
.btn.primary { background: var(--accent); color: #04121f; font-weight: 700; }
.btn.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--card-line);
}
.btn.danger { background: var(--red); color: #fff; }
.btn.big { width: 100%; padding: 16px; font-size: 17px; margin-bottom: 12px; }

/* ---------- 统计 ---------- */
.stat-grid { display: flex; gap: 10px; margin-bottom: 12px; }
.stat {
  flex: 1;
  background: #10182b;
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
}
.stat em {
  font-style: normal;
  font-size: 17px;
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
  word-break: break-all;
}
.stat span { font-size: 11px; color: var(--text-dim); }

.plan-lines p { font-size: 14px; margin: 6px 0; color: var(--text); }
.plan-lines .accent { color: var(--yellow); font-weight: 600; }
.plan-lines strong { color: var(--accent); }

/* ---------- 检查点表 ---------- */
.cp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cp-table th {
  text-align: left; color: var(--text-dim); font-weight: 400;
  padding: 6px 4px; border-bottom: 1px solid var(--card-line); font-size: 12px;
}
.cp-table td { padding: 8px 4px; border-bottom: 1px solid rgba(42, 53, 80, .45); }
.cp-table td:last-child { color: var(--accent); font-variant-numeric: tabular-nums; }

/* ---------- 地图 ---------- */
.map-card { padding: 8px; }
.map-slot { min-height: 240px; border-radius: 10px; overflow: hidden; }
.map-card.small .map-slot { min-height: 160px; }
.map-el { width: 100%; height: 240px; }
.map-card.small .map-el { height: 160px; }

.amap-container { background: #10182b; }

/* 骑行人小圆点标记 */
.dot-marker {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(76, 217, 100, .25);
}

/* ---------- 骑行页 ---------- */
.delta-wrap {
  text-align: center;
  padding: 26px 10px 20px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  border: 1px solid var(--card-line);
}
.delta-wrap.green { background: linear-gradient(180deg, #12331f, #0f1523); border-color: var(--green); }
.delta-wrap.red { background: linear-gradient(180deg, #3a1518, #0f1523); border-color: var(--red); }
.delta-wrap.yellow { background: linear-gradient(180deg, #33290f, #0f1523); border-color: var(--yellow); }

.delta-label { font-size: 15px; color: var(--text-dim); margin-bottom: 6px; }
.eta-big {
  font-size: 72px;
  font-weight: 800;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
}
.delta-sub {
  margin-top: 10px;
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.delta-wrap.green .delta-sub, .delta-wrap.green .eta-big { color: var(--green); }
.delta-wrap.red .delta-sub, .delta-wrap.red .eta-big { color: var(--red); }
.delta-wrap.yellow .delta-sub { color: var(--yellow); }

.ride-msg {
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  min-height: 20px;
  margin-bottom: 10px;
}

.next-line { border-top: 1px solid var(--card-line); padding-top: 10px; }
.next-line p { font-size: 15px; margin: 4px 0; }
.next-line .accent { color: var(--yellow); font-variant-numeric: tabular-nums; }
#ride-need { color: var(--red); font-size: 14px; }

.done { text-align: center; }
.done h2 { color: var(--green); font-size: 22px; }
.done p { color: var(--text-dim); margin: 8px 0 14px; }

/* ---------- 加载与错误 ---------- */
.center-msg { text-align: center; padding: 40px 16px; color: var(--text-dim); }
.spinner {
  width: 34px; height: 34px;
  margin: 0 auto 14px;
  border: 3px solid var(--card-line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.card.error { border-color: var(--red); }
.card.error p { color: var(--red); margin-bottom: 12px; font-size: 14px; line-height: 1.6; }
.card.error .btn { margin: 0 6px 8px 0; }

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(30px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: #2a3550;
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all .25s;
  max-width: 86vw;
  z-index: 999;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 小屏时缩小 ETA 大字 */
@media (max-width: 360px) {
  .eta-big { font-size: 58px; }
}
