:root {
  --paper: #f7f1e6;
  --card: #fffbf3;
  --ink: #3b342d;
  --muted: #8c8072;
  --accent: #b5673a;
  --accent-soft: #e8cfa8;
  --line: #e2d5bf;
  --shadow: 0 8px 24px rgba(92, 70, 48, 0.1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

.handwrite {
  font-family: "STKaiti", "KaiTi", "Noto Serif CJK SC", "Songti SC", serif;
  letter-spacing: 1px;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px 18px calc(96px + env(safe-area-inset-bottom));
}

.paper-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.paper-card::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 6px;
  background: repeating-linear-gradient(-45deg, rgba(181,103,58,.16) 0, rgba(181,103,58,.16) 3px, transparent 3px, transparent 8px);
  border-radius: 0 0 8px 8px;
}

.tape {
  position: absolute;
  width: 100px;
  height: 26px;
  background: linear-gradient(90deg, rgba(232,207,168,.9), rgba(232,207,168,.35));
  box-shadow: 0 2px 6px rgba(92,70,48,.12);
  z-index: 2;
}
.tape-left { top: -8px; left: 18px; transform: rotate(-4deg); }
.tape-right { top: -6px; right: 16px; transform: rotate(5deg); }

.tag {
  display: inline-block;
  padding: 2px 10px;
  margin: 0 6px 6px 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  background: #fffdf8;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: #a6534a; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

/* hero */
.hero {
  position: relative;
  text-align: center;
  padding: 40px 16px 22px;
}
.hero-title { font-size: 40px; font-weight: 700; line-height: 1.1; }
.hero-sub { margin-top: 6px; color: var(--muted); font-size: 14px; letter-spacing: 3px; }
.hero-meta { margin-top: 14px; color: var(--accent); font-size: 12px; }
.hero-line { width: 80px; height: 2px; margin: 16px auto 0; background: var(--accent-soft); }

/* map hero */
.map-hero {
  position: relative;
  height: 250px;
  margin-bottom: 26px;
  overflow: hidden;
}
.home-map-canvas { width: 100%; height: 100%; display: block; }
.map-hero-overlay {
  position: absolute;
  top: 0; left: 0; right: 0;
  text-align: center;
  padding: 18px 10px 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(247,241,230,.92), rgba(247,241,230,0));
}
.map-hero-overlay .hero-title { font-size: 32px; }
.map-hero-overlay .hero-sub { font-size: 12px; margin-top: 2px; }
.map-hero-overlay .hero-meta { margin-top: 6px; font-size: 11px; }
.map-markers { position: absolute; inset: 0; }
.map-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 3px 8px rgba(92,70,48,.3);
  cursor: pointer;
  z-index: 3;
}
.map-marker:active { transform: translate(-50%, -50%) scale(1.15); }
.map-hint {
  position: absolute;
  left: 12px; bottom: 12px;
  background: rgba(255,251,243,.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11px;
  color: var(--muted);
}

.cover-map { width: 100%; height: 100%; display: block; }

/* timeline */
.timeline-item { display: flex; align-items: flex-start; margin-bottom: 22px; }
.date-stamp { width: 74px; flex-shrink: 0; padding-top: 22px; text-align: center; }
.stamp-day { display: block; font-size: 30px; font-weight: 700; color: var(--accent); line-height: 1; }
.stamp-month, .stamp-week { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.record-card { flex: 1; min-width: 0; overflow: hidden; cursor: pointer; }
.cover-frame { height: 150px; position: relative; overflow: hidden; }
.cover-frame .cover,
.cover-frame .cover-photo { height: 100%; }
.cover-frame .cover-photo { width: 100%; object-fit: cover; display: block; }
.cover {
  height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.cover::before {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.08) 0, rgba(255,255,255,.08) 1px, transparent 1px, transparent 5px);
}
.cover-photo { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-emoji { font-size: 42px; filter: drop-shadow(0 3px 5px rgba(0,0,0,.15)); }
.cover-title { margin-top: 4px; color: #fff; font-size: 18px; text-shadow: 0 2px 6px rgba(0,0,0,.25); }
.card-body { padding: 14px 16px 12px; }
.card-title { font-size: 19px; font-weight: 600; line-height: 1.35; }
.card-excerpt { margin-top: 6px; font-size: 14px; color: var(--muted); }
.card-tags { margin-top: 10px; }
.card-footer { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.more { color: var(--accent); font-weight: 600; }
.end-note { text-align: center; color: var(--muted); font-size: 13px; margin: 24px 0 10px 74px; }

.fab {
  position: fixed;
  right: 20px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  width: 58px; height: 58px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 30px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(181,103,58,.35);
  z-index: 30;
  cursor: pointer;
}

/* forms */
.section { margin-bottom: 22px; }
.label { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.hint { font-size: 11px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.input, .textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  padding: 11px 12px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
}
.textarea { min-height: 130px; resize: vertical; }
.row { display: flex; gap: 10px; align-items: center; }
.row .input { flex: 1; }
.pill {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  padding: 9px 12px;
  font-size: 13px;
  min-width: 130px;
  text-align: center;
}
.photo-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-item { width: 92px; height: 92px; position: relative; border-radius: 6px; overflow: hidden; }
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-del {
  position: absolute; top: 0; right: 0;
  width: 24px; height: 24px; line-height: 22px; text-align: center;
  background: rgba(59,52,45,.7); color: #fff; border-radius: 0 0 0 8px; cursor: pointer;
}
.photo-add {
  width: 92px; height: 92px;
  border: 2px dashed var(--line);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; color: var(--accent); background: #fffdf8; cursor: pointer;
}
.moods { display: flex; flex-wrap: wrap; gap: 8px; }
.mood { padding: 6px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 13px; color: var(--muted); cursor: pointer; }
.mood.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.cover-picker { display: flex; overflow-x: auto; gap: 10px; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.cover-option { width: 76px; flex-shrink: 0; text-align: center; padding: 4px; border: 2px solid transparent; border-radius: 8px; cursor: pointer; }
.cover-option.active { border-color: var(--accent); background: #fffdf8; }
.cover-mini { width: 66px; height: 50px; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 24px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.4); }
.cover-name { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.route-box { background: #f4eee1; border: 1px dashed var(--accent-soft); border-radius: 8px; padding: 10px 12px; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.route-remove { color: var(--accent); cursor: pointer; margin-left: 10px; }
.coord { margin-top: 6px; font-size: 11px; color: var(--muted); }
.save-bar { margin-top: 28px; }
.save-btn { width: 100%; min-height: 50px; border-radius: 999px; background: var(--accent); color: #fff; border: none; font-size: 16px; font-weight: 600; letter-spacing: 3px; box-shadow: 0 8px 18px rgba(181,103,58,.25); }

/* detail */
.detail-hero { padding-bottom: 16px; }
.detail-cover { height: 210px; }
.detail-cover .cover-emoji { font-size: 56px; }
.detail-cover .cover-title { font-size: 22px; }
.detail-body { padding: 16px 20px 0; }
.detail-title { font-size: 24px; font-weight: 700; line-height: 1.35; }
.detail-meta { margin-top: 6px; font-size: 13px; color: var(--muted); }
.detail-location { margin-top: 4px; font-size: 13px; color: var(--accent); }
.content-card { margin-top: 18px; padding: 18px 20px; }
.section-label { color: var(--accent); font-size: 16px; margin-bottom: 10px; }
.content-text { white-space: pre-wrap; line-height: 1.9; font-size: 15px; color: #4a423a; }
.photo-gallery { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-gallery img { width: 92px; height: 92px; object-fit: cover; border-radius: 6px; cursor: pointer; }
.route-map { width: 100%; height: 230px; border-radius: 6px; display: block; }
.route-summary { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.actions { display: flex; gap: 12px; margin-top: 26px; }
.actions .btn { flex: 1; }

/* footprint */
.map-card { padding: 8px; height: 280px; }
.route-map-small { width: 100%; height: 100%; border-radius: 5px; display: block; }
.map-label { position: absolute; right: 16px; bottom: 16px; background: rgba(255,251,243,.9); padding: 3px 10px; border-radius: 999px; font-size: 11px; color: var(--muted); }
.stats { display: flex; margin-top: 14px; padding: 16px 0; }
.stat { flex: 1; text-align: center; border-right: 1px dashed var(--line); }
.stat:last-child { border-right: none; }
.stat-num { font-size: 20px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 11px; color: var(--muted); }
.demo-row { text-align: center; font-size: 12px; color: var(--muted); margin-top: 12px; text-decoration: underline; cursor: pointer; }
.section-title { margin: 28px 0 12px; font-size: 17px; font-weight: 600; padding-left: 10px; border-left: 4px solid var(--accent-soft); }
.route-item { padding: 14px 16px; margin-bottom: 12px; cursor: pointer; }
.route-item.selected { border-color: var(--accent); }
.route-head { display: flex; justify-content: space-between; align-items: center; }
.route-time { font-size: 14px; font-weight: 600; }
.route-dist { color: var(--accent); font-size: 16px; font-weight: 700; }
.route-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.route-action { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); text-align: right; font-size: 12px; color: var(--accent); }

/* mine */
.mine-hero { padding: 34px 16px 22px; }
.avatar { width: 72px; height: 72px; line-height: 72px; margin: 0 auto 12px; border-radius: 50%; background: var(--accent-soft); color: #6b4a2f; font-size: 34px; border: 3px solid #fff; box-shadow: 0 4px 12px rgba(92,70,48,.12); }
.mine-stats { display: flex; flex-wrap: wrap; padding: 18px 0; }
.mine-stat { width: 50%; text-align: center; padding: 10px 0; }
.mine-stat .num { font-size: 22px; font-weight: 700; color: var(--accent); }
.mine-stat .label { font-size: 11px; color: var(--muted); }
.note-card { margin-top: 18px; padding: 18px 20px; }
.note-title { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.note-text { font-size: 13px; color: var(--muted); line-height: 1.8; }
.storage { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--accent); }
.mine-btn { width: 100%; min-height: 46px; margin-top: 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); font-size: 14px; cursor: pointer; }
.mine-btn.danger { color: #a6534a; }
.footer { text-align: center; color: var(--muted); font-size: 13px; margin-top: 34px; }

/* preview */
.preview-mask { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(30,26,22,.94); z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; }
.preview-mask img { max-width: 100%; max-height: 78vh; object-fit: contain; }
.preview-tip { margin-top: 18px; color: rgba(255,255,255,.7); font-size: 12px; }
.preview-actions { display: flex; gap: 10px; margin-top: 14px; }
.preview-actions .btn { border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.1); color: #fff; }

/* bottom nav */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-width: 720px;
  margin: 0 auto;
  height: calc(62px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fbf7ef;
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 40;
}
.nav-item { flex: 1; text-align: center; padding-top: 8px; color: var(--muted); font-size: 11px; cursor: pointer; }
.nav-item.active { color: var(--accent); font-weight: 600; }
.nav-icon { display: block; font-size: 20px; line-height: 1.2; }

/* recorder bar */
.recorder-bar {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(59,52,45,.93);
  color: #fff;
  padding: 7px 10px 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
  white-space: nowrap;
}
.rec-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ff6b57;
  animation: rec-pulse 1.2s infinite;
}
@keyframes rec-pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.75); }
}
.recorder-bar button {
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  padding: 4px 12px;
}

/* toast */
.toast {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(59,52,45,.9);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 300;
  max-width: 80%;
  text-align: center;
}

.empty { text-align: center; padding: 80px 10px; }
.empty-emoji { font-size: 56px; }
.empty-title { margin-top: 10px; font-size: 20px; font-weight: 600; }
.empty-desc { margin: 8px 0 24px; font-size: 13px; color: var(--muted); }
