/* ============ 旅迹 · 设计基线 ============ */
:root {
  --brand: #e4572e;
  --brand-soft: #fdf0eb;
  --brand-dark: #c1441f;
  --teal: #17706e;
  --teal-soft: #e6f2f1;
  --gold: #d99b28;

  --bg: #f6f4f1;
  --surface: #ffffff;
  --surface-2: #fbfaf8;
  --line: #e9e5df;
  --line-strong: #d9d3ca;

  --ink: #1f2328;
  --ink-2: #4a5158;
  --muted: #8b9099;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(31, 35, 40, .04), 0 8px 24px rgba(31, 35, 40, .06);
  --shadow-lg: 0 12px 40px rgba(31, 35, 40, .12);
  --sidebar: 232px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #dcd7cf; border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #c8c2b8; }

/* ============ 通用零件 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); cursor: pointer; font-weight: 500; font-size: 14px;
  transition: .16s ease; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgba(0,0,0,.05); border-color: transparent; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.input, .textarea, .select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface); outline: none; transition: .15s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.textarea { resize: vertical; min-height: 84px; line-height: 1.7; }
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-2);
}
.chip-loc { background: var(--teal-soft); border-color: #cfe6e4; color: var(--teal); font-weight: 500; }
.chip-brand { background: var(--brand-soft); border-color: #f7dcd2; color: var(--brand-dark); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hr { height: 1px; background: var(--line); margin: 14px 0; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.center-col { display: flex; flex-direction: column; align-items: center; justify-content: center; }

.avatar {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 15px;
  letter-spacing: .5px; user-select: none;
}
.avatar.sm { width: 30px; height: 30px; border-radius: 9px; font-size: 12px; }
.avatar.lg { width: 62px; height: 62px; border-radius: 18px; font-size: 22px; }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty .big { font-size: 34px; margin-bottom: 10px; opacity: .55; }

/* ============ 布局 ============ */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex: none; position: sticky; top: 0; height: 100vh;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 20px 14px;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.logo .mark {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), #f2994a); color: #fff; font-size: 18px;
}
.logo b { font-size: 17px; letter-spacing: .5px; }
.logo span { display: block; font-size: 11px; color: var(--muted); letter-spacing: 1.5px; font-weight: 400; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px;
  color: var(--ink-2); font-weight: 500; cursor: pointer; transition: .14s;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { background: var(--brand-soft); color: var(--brand-dark); }
.nav a .ic { width: 20px; text-align: center; font-size: 16px; }
.nav a .badge {
  margin-left: auto; background: var(--brand); color: #fff; font-size: 11px;
  min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px;
}
.side-foot { margin-top: auto; }
.side-user {
  display: flex; align-items: center; gap: 10px; padding: 9px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line); cursor: pointer;
}
.side-user:hover { border-color: var(--line-strong); }

.main { flex: 1; min-width: 0; }
.page { max-width: 720px; margin: 0 auto; padding: 26px 20px 80px; }
.page.wide { max-width: 1080px; }
.page-head { margin-bottom: 18px; }
.page-head h1 { margin: 0 0 3px; font-size: 22px; letter-spacing: .5px; }
.page-head p { margin: 0; color: var(--muted); font-size: 13.5px; }

.tabs { display: flex; gap: 6px; margin: 16px 0; flex-wrap: wrap; }
.tabs button {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-size: 13.5px; color: var(--ink-2); transition: .14s;
}
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.mobile-bar { display: none; }

/* ============ 打卡卡片 ============ */
.composer { padding: 16px; margin-bottom: 18px; }
.composer .top { display: flex; gap: 12px; }
.composer textarea {
  border: none; outline: none; resize: none; width: 100%; min-height: 26px;
  font-size: 15.5px; line-height: 1.7; background: transparent; padding: 8px 0;
}
.composer .tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }
.thumbs .t { position: relative; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.thumbs .t img { width: 100%; height: 100%; object-fit: cover; }
.thumbs .t button {
  position: absolute; top: 3px; right: 3px; width: 19px; height: 19px; border-radius: 50%;
  border: none; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 11px; line-height: 1; padding: 0;
}

.post { padding: 16px 18px; margin-bottom: 14px; }
.post .head { display: flex; gap: 12px; align-items: flex-start; }
.post .name { font-weight: 600; }
.post .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.post .text { margin: 10px 0 0; white-space: pre-wrap; line-height: 1.75; word-break: break-word; }
.post .loc-line { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

.grid-img { display: grid; gap: 5px; margin-top: 11px; border-radius: 12px; overflow: hidden; }
.grid-img.n1 { grid-template-columns: minmax(0, 62%); }
.grid-img.n2 { grid-template-columns: 1fr 1fr; }
.grid-img.n3, .grid-img.n4, .grid-img.n5, .grid-img.n6,
.grid-img.n7, .grid-img.n8, .grid-img.n9 { grid-template-columns: repeat(3, 1fr); }
.grid-img img { width: 100%; aspect-ratio: 1/1; object-fit: cover; cursor: zoom-in; background: var(--surface-2); }
.grid-img.n1 img { aspect-ratio: 4/3; }

.actions { display: flex; gap: 4px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.act {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 9px;
  border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 13.5px; transition: .14s;
}
.act:hover { background: var(--surface-2); color: var(--ink-2); }
.act.on { color: var(--brand); }
.act.on.fav { color: var(--gold); }

.interact { margin-top: 11px; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.likers { font-size: 13px; color: var(--ink-2); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cmt { font-size: 13.5px; padding: 3px 0; line-height: 1.65; }
.cmt b { font-weight: 600; color: var(--teal); cursor: pointer; }
.cmt .del { color: var(--muted); font-size: 12px; cursor: pointer; margin-left: 6px; }
.cmt-input { display: flex; gap: 8px; margin-top: 8px; }
.cmt-input input { flex: 1; padding: 6px 11px; border-radius: 8px; border: 1px solid var(--line-strong); outline: none; font-size: 13.5px; }

/* ============ 足迹 ============ */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { padding: 14px 16px; text-align: left; }
.stat .n { font-size: 26px; font-weight: 700; letter-spacing: -.5px; line-height: 1.2; }
.stat .l { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

#map-canvas { width: 100%; height: 460px; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.map-wrap { position: relative; padding: 0; overflow: hidden; }
.map-fallback { height: 460px; display: grid; place-items: center; text-align: center; padding: 30px; }
.map-legend {
  position: absolute; left: 14px; bottom: 14px; background: rgba(255,255,255,.94);
  border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; font-size: 12.5px;
  color: var(--ink-2); box-shadow: var(--shadow); backdrop-filter: blur(6px);
}
.map-toolbar { position: absolute; right: 14px; top: 14px; display: flex; flex-direction: column; gap: 6px; }
.map-toolbar .btn { background: rgba(255,255,255,.95); box-shadow: var(--shadow); }

.region-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.region {
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 8px; text-align: center;
  background: var(--surface-2); color: var(--muted); cursor: pointer; transition: .18s; position: relative;
}
.region .ic { font-size: 21px; filter: grayscale(1); opacity: .38; transition: .18s; }
.region .nm { font-size: 12.5px; margin-top: 3px; font-weight: 500; }
.region .ct { font-size: 11px; opacity: .8; }
.region.lit {
  background: linear-gradient(160deg, #fff8f3, #fdeee6);
  border-color: #f4d3c3; color: var(--brand-dark); box-shadow: 0 2px 10px rgba(228,87,46,.09);
}
.region.lit .ic { filter: none; opacity: 1; }
.region:hover { transform: translateY(-2px); border-color: var(--brand); }
.zone-title { font-size: 12.5px; color: var(--muted); margin: 16px 0 8px; font-weight: 600; letter-spacing: 1px; }

/* ============ 路书 ============ */
.rb-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 14px; }
.rb-card { overflow: hidden; cursor: pointer; transition: .18s; }
.rb-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.rb-cover { height: 116px; background: linear-gradient(135deg, #17706e, #2a9d8f); position: relative; }
.rb-cover img { width: 100%; height: 100%; object-fit: cover; }
.rb-cover .days {
  position: absolute; right: 10px; top: 10px; background: rgba(0,0,0,.42); color: #fff;
  padding: 2px 9px; border-radius: 999px; font-size: 12px; backdrop-filter: blur(4px);
}
.rb-body { padding: 13px 15px 15px; }
.rb-body h3 { margin: 0 0 5px; font-size: 16px; }
.rb-foot { display: flex; gap: 12px; font-size: 12.5px; color: var(--muted); margin-top: 9px; }

.day-block { margin-bottom: 14px; }
.day-head { display: flex; align-items: center; gap: 10px; padding: 10px 4px; }
.day-no {
  width: 40px; height: 40px; border-radius: 12px; background: var(--ink); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; line-height: 1.1;
}
.day-no small { font-size: 9px; font-weight: 400; opacity: .7; display: block; }
.timeline { position: relative; padding-left: 19px; margin-left: 20px; border-left: 2px dashed var(--line-strong); }
.tl-item { position: relative; padding: 11px 0; }
.tl-item::before {
  content: ''; position: absolute; left: -25px; top: 18px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong);
}
.tl-item.k-transport::before { border-color: #3b82f6; }
.tl-item.k-hotel::before { border-color: #8b5cf6; }
.tl-item.k-sight::before { border-color: var(--brand); }
.tl-item.k-food::before { border-color: #f59e0b; }
.tl-item.k-fun::before { border-color: #ec4899; }
.tl-card { padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.tl-card:hover { border-color: var(--line-strong); }
.tl-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-time { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; color: var(--ink-2); min-width: 42px; }
.tl-title { font-weight: 600; }
.tl-cost { margin-left: auto; font-weight: 600; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.tl-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }

.kind-tag { font-size: 11.5px; padding: 1px 8px; border-radius: 6px; font-weight: 500; }
.kt-transport { background: #eff6ff; color: #1d4ed8; }
.kt-hotel { background: #f5f3ff; color: #6d28d9; }
.kt-sight { background: var(--brand-soft); color: var(--brand-dark); }
.kt-food { background: #fffbeb; color: #b45309; }
.kt-fun { background: #fdf2f8; color: #be185d; }
.kt-other { background: var(--surface-2); color: var(--ink-2); }

.cost-bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--surface-2); margin: 10px 0; }
.cost-bar i { display: block; height: 100%; }
.cost-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.cost-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px; }

/* ============ 聊天 ============ */
.chat-shell { display: grid; grid-template-columns: 264px 1fr; height: calc(100vh - 52px); border-radius: var(--radius); overflow: hidden; }
.chat-side { border-right: 1px solid var(--line); overflow-y: auto; background: var(--surface-2); }
.conv { display: flex; gap: 10px; padding: 12px 14px; cursor: pointer; border-bottom: 1px solid var(--line); }
.conv:hover { background: #fff; }
.conv.on { background: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.conv .cn { font-weight: 600; font-size: 14px; }
.conv .cm { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .dot { margin-left: auto; background: var(--brand); color: #fff; font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; }

.chat-main { display: flex; flex-direction: column; background: var(--surface); min-width: 0; }
.chat-head { padding: 12px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.chat-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 3px; background: var(--surface-2); }
.bubble-row { display: flex; gap: 9px; margin: 5px 0; align-items: flex-end; }
.bubble-row.me { flex-direction: row-reverse; }
.bubble {
  max-width: min(62%, 460px); padding: 9px 13px; border-radius: 14px; background: #fff;
  border: 1px solid var(--line); line-height: 1.65; word-break: break-word; white-space: pre-wrap;
}
.bubble-row.me .bubble { background: var(--brand); color: #fff; border-color: var(--brand); }
.bubble-time { font-size: 11px; color: var(--muted); align-self: flex-end; margin-bottom: 3px; }
.chat-input { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 10px; background: var(--surface); }
.chat-day { text-align: center; font-size: 12px; color: var(--muted); margin: 12px 0 6px; }

/* ============ 好友 / 我的 ============ */
.user-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: none; }
.fav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.place-card { padding: 13px 15px; }
.place-card h4 { margin: 0 0 4px; font-size: 15px; }

/* ============ 弹层 ============ */
.mask {
  position: fixed; inset: 0; background: rgba(20, 22, 25, .48); z-index: 60;
  display: grid; place-items: center; padding: 20px; backdrop-filter: blur(2px);
  animation: fade .18s ease;
}
.modal {
  background: var(--surface); border-radius: 18px; width: min(560px, 100%);
  max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: pop .2s ease;
}
.modal-head { padding: 17px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.x { border: none; background: transparent; font-size: 20px; cursor: pointer; color: var(--muted); line-height: 1; }

@keyframes fade { from { opacity: 0 } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98) } }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 90; display: grid; place-items: center; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 92vh; object-fit: contain; border-radius: 6px; }

#toast { position: fixed; left: 50%; top: 24px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: rgba(31,35,40,.94); color: #fff; padding: 9px 18px; border-radius: 999px;
  font-size: 13.5px; box-shadow: var(--shadow-lg); animation: pop .18s ease;
}
.toast.err { background: #b42318; }

/* 点亮新地域的庆祝层 */
.unlock { text-align: center; padding: 34px 24px; }
.unlock .ic { font-size: 62px; animation: bump .55s ease; }
.unlock h2 { margin: 12px 0 4px; font-size: 21px; }
@keyframes bump { 0% { transform: scale(.3); opacity: 0 } 60% { transform: scale(1.18) } 100% { transform: scale(1) } }

/* ============ 登录页 ============ */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; }
.auth-art {
  background: linear-gradient(150deg, #1d3f3d 0%, #17706e 45%, #e4572e 130%);
  color: #fff; padding: 56px 52px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.auth-art::after {
  content: '📍'; position: absolute; right: -20px; bottom: -30px; font-size: 260px; opacity: .09; transform: rotate(-12deg);
}
.auth-art h1 { font-size: 38px; margin: 0 0 14px; letter-spacing: 2px; }
.auth-art p { font-size: 15px; opacity: .88; max-width: 380px; line-height: 1.85; }
.auth-feat { display: flex; flex-direction: column; gap: 13px; margin-top: 26px; position: relative; z-index: 1; }
.auth-feat div { display: flex; gap: 10px; align-items: center; font-size: 14px; opacity: .93; }
.auth-form { display: grid; place-items: center; padding: 40px; background: var(--surface); }
.auth-box { width: min(360px, 100%); }
.auth-box h2 { margin: 0 0 6px; font-size: 23px; }
.demo-tip { margin-top: 18px; padding: 11px 14px; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 10px; font-size: 12.5px; color: var(--ink-2); line-height: 1.8; }
.demo-tip code { background: #fff; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); font-size: 12px; }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .mobile-bar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: rgba(255,255,255,.97); border-top: 1px solid var(--line); backdrop-filter: blur(10px);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .mobile-bar a { flex: 1; text-align: center; padding: 6px 0; font-size: 10.5px; color: var(--muted); position: relative; }
  .mobile-bar a .ic { display: block; font-size: 19px; margin-bottom: 1px; }
  .mobile-bar a.on { color: var(--brand); }
  .page { padding: 18px 14px 92px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { padding: 36px 28px; }
  .auth-art h1 { font-size: 30px; }
  .chat-shell { grid-template-columns: 1fr; height: calc(100vh - 150px); }
  .chat-side.hide-m { display: none; }
  .chat-main.hide-m { display: none; }
  .bubble { max-width: 78%; }
}
