:root {
  --bg: #f6f5f1;
  --card: #ffffff;
  --ink: #1f1f1d;
  --ink-2: #5f5e5a;
  --ink-3: #9a9891;
  --line: #e6e4dd;
  --accent: #1d4ed8;
  --accent-bg: #e6eefb;
  --warn-bg: #fbeedb;
  --warn-ink: #8a5a0f;
  --ok-bg: #e5f3e2;
  --ok-ink: #2f6b1e;
  --cold-bg: #e3eef8;
  --cold-ink: #1b4f80;
  --radius: 12px;
  --tab-h: 58px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141412; --card: #1f1f1c; --ink: #ecebe6; --ink-2: #b3b1a9; --ink-3: #7d7b74;
    --line: #2f2e2a; --accent: #7ea6ff; --accent-bg: #1e2a44; --warn-bg: #3a2c12; --warn-ink: #f2c275;
    --ok-bg: #1f3319; --ok-ink: #a8d99a; --cold-bg: #172a3d; --cold-ink: #9cc4ee;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 -apple-system, "PingFang SC", "Helvetica Neue", "Noto Sans SC", sans-serif; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; }
a { color: var(--accent); text-decoration: none; }

.top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: calc(env(safe-area-inset-top) + 10px) 16px 8px; border-bottom: 0.5px solid var(--line); }
.top-title { font-size: 17px; font-weight: 600; }
.top-sub { font-size: 12px; color: var(--ink-3); }

.view { padding: 12px 16px calc(var(--tab-h) + env(safe-area-inset-bottom) + 16px); max-width: 640px; margin: 0 auto; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--card); border-top: 0.5px solid var(--line); display: flex; z-index: 10; }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--ink-3); }
.tabs button .ic { font-size: 20px; line-height: 1; }
.tabs button.on { color: var(--accent); font-weight: 600; }

h2 { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 18px 0 8px; letter-spacing: .02em; }
h2:first-child { margin-top: 4px; }
.card { background: var(--card); border: 0.5px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.card.accent { background: var(--accent-bg); border-color: transparent; }
.card.warn { background: var(--warn-bg); border-color: transparent; color: var(--warn-ink); }
.muted { color: var(--ink-3); font-size: 13px; }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 12px; background: var(--accent-bg); color: var(--accent); margin-right: 4px; }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); }
.pill.ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill.cold { background: var(--cold-bg); color: var(--cold-ink); }
.btn { display: inline-block; padding: 8px 14px; border-radius: 10px; border: 0.5px solid var(--line); background: var(--card); font-size: 14px; }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* day strip */
.strip { display: flex; gap: 6px; overflow-x: auto; padding: 6px 2px 10px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.strip::-webkit-scrollbar { display: none; }
.dcell { flex: none; width: 52px; height: 64px; border-radius: 10px; border: 0.5px solid var(--line); background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; color: var(--ink-3); scroll-snap-align: center; position: relative; }
.dcell b { font-size: 15px; color: var(--ink-2); }
.dcell .d { font-size: 10px; }
.dcell.past { opacity: .55; }
.dcell.past b::after { content: " ✓"; font-size: 10px; color: var(--ok-ink); }
.dcell.now { background: var(--accent-bg); border: 1.5px solid var(--accent); transform: scale(1.08); }
.dcell.now b { color: var(--accent); }
.dcell.future { opacity: .7; }
.dcell .badge { position: absolute; top: -5px; right: -3px; font-size: 11px; background: var(--card); border-radius: 50%; line-height: 1; }
.legend { font-size: 11px; color: var(--ink-3); display: flex; gap: 12px; margin: 0 0 6px; }

/* day header */
.dayhead { padding: 14px; border-radius: var(--radius); background: linear-gradient(135deg, var(--accent) 0%, #4f7be8 100%); color: #fff; margin-bottom: 10px; }
.dayhead .k { font-size: 12px; opacity: .85; }
.dayhead .t { font-size: 20px; font-weight: 600; margin: 2px 0; }
.dayhead .w { font-size: 13px; opacity: .95; }
.seg { display: flex; border: 0.5px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.seg button { flex: 1; padding: 8px; font-size: 14px; color: var(--ink-2); }
.seg button.on { background: var(--accent-bg); color: var(--accent); font-weight: 600; }

/* timeline */
.tl { position: relative; padding-left: 18px; }
.tl::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.stop { position: relative; margin-bottom: 12px; }
.stop::before { content: ""; position: absolute; left: -17px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); border: 2px solid var(--bg); }
.stop.in::before { background: var(--accent); }
.stop.free::before { background: #e08a2e; }
.stop .tm { font-size: 12px; color: var(--ink-3); }
.stop .nm { font-weight: 600; }
.stop .nt { font-size: 13px; color: var(--ink-2); }
.free-card { background: var(--accent-bg); border-radius: 10px; padding: 10px 12px; }
.free-card .h { font-weight: 600; }
.idea { display: flex; justify-content: space-between; background: var(--card); border-radius: 8px; padding: 6px 10px; margin-top: 6px; font-size: 14px; }
.idea span:last-child { color: var(--ink-3); font-size: 12px; }

/* checklist */
.chk { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 0.5px solid var(--line); }
.chk:last-child { border-bottom: 0; }
.chk input { width: 20px; height: 20px; accent-color: var(--accent); }
.chk.done label { text-decoration: line-through; color: var(--ink-3); }
.chk label { flex: 1; }

/* chat */
.chat { display: flex; flex-direction: column; gap: 8px; min-height: 200px; }
.bub { max-width: 85%; padding: 8px 12px; border-radius: 14px; font-size: 15px; }
.bub.me { align-self: flex-end; background: var(--accent); color: #fff; }
.bub.ai { align-self: flex-start; background: var(--card); border: 0.5px solid var(--line); }
.askbar { position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); display: flex; gap: 8px; padding: 8px 0; background: var(--bg); }
.askbar input { flex: 1; padding: 10px 12px; border-radius: 12px; border: 0.5px solid var(--line); background: var(--card); font: inherit; color: var(--ink); }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 0.5px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--ink-2); }
textarea { width: 100%; min-height: 90px; border-radius: 10px; border: 0.5px solid var(--line); background: var(--card); color: var(--ink); font: inherit; padding: 10px; }
.route { padding-left: 4px; }
.route .rc { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 0.5px solid var(--line); font-size: 14px; }
.route .rc b { min-width: 68px; color: var(--ink-3); font-weight: 500; font-size: 12px; }
.center { text-align: center; }

/* 小地图 */
.map { background: var(--card); border: 0.5px solid var(--line); border-radius: var(--radius); padding: 8px 8px 4px; margin-bottom: 10px; }
.map svg { width: 100%; height: auto; display: block; }
.map.compact svg { max-height: 190px; }
.map .land { fill: var(--surface-map, #ece9df); stroke: var(--line); stroke-width: 1.5; stroke-linejoin: round; }
@media (prefers-color-scheme: dark) { .map .land { fill: #2a2a26; } }
.map .rt { stroke: var(--ink-3); stroke-width: 2; stroke-dasharray: 5 5; opacity: .5; }
.map .rt.lit { stroke: var(--accent); stroke-dasharray: none; opacity: 1; stroke-width: 3; }
.map .city { cursor: pointer; }
.map .city circle { fill: var(--card); stroke: var(--ink-3); stroke-width: 2; }
.map .city.past circle { fill: var(--accent); stroke: var(--accent); }
.map .city.now circle { fill: #e08a2e; stroke: #fff; stroke-width: 2.5; }
.map .city.now .pulse { fill: none; stroke: #e08a2e; stroke-width: 2; animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { r: 7; opacity: .9; } 100% { r: 22; opacity: 0; } }
.map .city text { font-size: 12px; fill: var(--ink-2); paint-order: stroke; stroke: var(--card); stroke-width: 3px; stroke-linejoin: round; }
.map .city.future text { fill: var(--ink-3); }
.map .city.now text { fill: var(--ink); font-weight: 600; }
.map-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); padding: 4px 4px 0; }
