/* 旅藏 · 温暖旅行手帐 + 精致收藏柜 */
:root {
  --bg: #f7f3ec;
  --card: #fffdf9;
  --ink: #3b332a;
  --ink-soft: #8a7f70;
  --accent: #c96f3d;
  --accent-soft: #f3e0d2;
  --line: #e8e0d4;
  --ok: #4d7c57;
  --warn: #b8862f;
  --err: #b0492f;
  --radius: 16px;
  --shadow: 0 2px 14px rgba(59, 51, 42, 0.07);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  background: var(--bg); color: var(--ink);
  font-size: 15px; line-height: 1.55;
}
.app { max-width: 560px; margin: 0 auto; padding: 0 14px 88px; min-height: 100vh; }
h1, h2, h3 { font-weight: 600; margin: 0; }
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }

/* PIN 门 */
.pin-gate { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 99; padding: 20px; }
.pin-card { background: var(--card); border-radius: var(--radius); padding: 28px 22px; max-width: 340px; width: 100%; box-shadow: var(--shadow); text-align: center; }
.pin-card h1 { font-size: 18px; margin-bottom: 8px; }
.pin-card p { color: var(--ink-soft); font-size: 13px; }
.pin-card input { width: 100%; margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 16px; text-align: center; }
.pin-error { color: var(--err) !important; }

/* 底部导航 */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; background: rgba(255, 253, 249, 0.96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { flex: 1; text-align: center; padding: 8px 0 6px; color: var(--ink-soft); font-size: 11px; }
.tabbar a.active { color: var(--accent); }
.tab-ic { display: block; font-size: 19px; margin-bottom: 1px; }

/* 页头 */
.page-head { display: flex; align-items: center; gap: 10px; padding: 16px 2px 10px; }
.page-head h1 { font-size: 20px; flex: 1; }
.page-head .back { color: var(--ink-soft); font-size: 22px; line-height: 1; }

/* 分段切换 */
.seg { display: flex; background: #efe8dc; border-radius: 12px; padding: 3px; margin: 6px 0 12px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 9px; font-size: 14px; color: var(--ink-soft); }
.seg button.active { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }

/* 卡片墙 */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card .ph { aspect-ratio: 1; background: #eee5d8 center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: #c9bba6; font-size: 30px; position: relative; }
.card .body { padding: 10px 12px 12px; }
.card .name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta { color: var(--ink-soft); font-size: 12px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-block; font-size: 10px; padding: 2px 7px; border-radius: 99px; margin-right: 4px; }
.badge.collected { background: #e5efe7; color: var(--ok); }
.badge.seen { background: #f4e9d8; color: var(--warn); }
.badge.model3d { background: var(--accent-soft); color: var(--accent); position: absolute; top: 8px; left: 8px; margin: 0; }
.badge.sample { background: #ececec; color: #999; }

/* 列表行 */
.row-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 10px; }
.row-card .title { font-weight: 600; }
.row-card .sub { color: var(--ink-soft); font-size: 13px; margin-top: 2px; }

/* 按钮 */
.btn { display: inline-block; border: 0; border-radius: 12px; padding: 11px 18px; font-size: 15px; cursor: pointer; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: #efe8dc; color: var(--ink); }
.btn-line { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-danger { background: transparent; border: 1px solid #eccfc5; color: var(--err); }
.btn-block { display: block; width: 100%; text-align: center; }
.btn:disabled { opacity: 0.5; }
.btn-row { display: flex; gap: 10px; margin: 12px 0; }
.btn-row .btn { flex: 1; text-align: center; }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; background: #fff; color: var(--ink); font-family: inherit;
}
.field textarea { min-height: 84px; resize: vertical; }
.field .hint { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 7px 14px; font-size: 13px; color: var(--ink); }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* 照片条 */
.photo-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px; }
.photo-strip .p { flex: 0 0 auto; width: 84px; height: 84px; border-radius: 10px; background-size: cover; background-position: center; position: relative; border: 2px solid transparent; }
.photo-strip .p.cover { border-color: var(--accent); }
.photo-strip .p .del { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; border: 0; font-size: 11px; line-height: 20px; text-align: center; }
.photo-strip .p .cv { position: absolute; bottom: 2px; left: 2px; font-size: 9px; background: var(--accent); color: #fff; border-radius: 4px; padding: 1px 4px; }

/* 详情 */
.hero-photos { display: flex; gap: 8px; overflow-x: auto; border-radius: var(--radius); }
.hero-photos .hp { flex: 0 0 auto; width: 78vw; max-width: 420px; aspect-ratio: 1; border-radius: var(--radius); background-size: cover; background-position: center; }
.kv { display: flex; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv .k { flex: 0 0 96px; color: var(--ink-soft); font-size: 13px; }
.kv .v { flex: 1; }
.section-title { font-size: 15px; font-weight: 600; margin: 20px 2px 10px; display: flex; align-items: center; justify-content: space-between; }
.section-title .act { font-size: 13px; font-weight: 400; color: var(--accent); }
model-viewer { width: 100%; height: 340px; border-radius: var(--radius); background: radial-gradient(circle at 50% 40%, #fff 0%, #efe7da 100%); --poster-color: transparent; }
.note-box { background: #fbf6ee; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 12px; color: var(--ink-soft); margin: 10px 0; }

/* 扫描 */
.scan-wrap { position: relative; border-radius: var(--radius); overflow: hidden; background: #222; }
.scan-wrap video { width: 100%; display: block; aspect-ratio: 3/4; object-fit: cover; }
.scan-overlay { position: absolute; inset: 0; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between; padding: 14px; }
.scan-guide { color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.6); font-size: 14px; background: rgba(0,0,0,.35); border-radius: 10px; padding: 8px 12px; }
.angle-track { display: flex; gap: 4px; }
.angle-dot { flex: 1; height: 4px; border-radius: 2px; background: rgba(255,255,255,.35); }
.angle-dot.done { background: #7fd08a; }
.shutter-row { display: flex; align-items: center; justify-content: center; gap: 26px; padding: 16px 0 4px; }
.shutter { width: 68px; height: 68px; border-radius: 50%; border: 4px solid var(--accent); background: #fff; box-shadow: var(--shadow); }
.shutter:active { transform: scale(0.94); }
.scan-count { color: var(--ink-soft); font-size: 13px; text-align: center; }

/* 任务页 */
.stage-bar { display: flex; align-items: center; gap: 8px; margin: 14px 0; }
.stage-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.stage-dot.on { background: var(--accent); }
.stage-dot.err { background: var(--err); }
.stage-line { flex: 1; height: 2px; background: var(--line); }
.progress-track { height: 8px; border-radius: 4px; background: #eee5d8; overflow: hidden; margin: 8px 0 4px; }
.progress-fill { height: 100%; background: var(--accent); width: 0; transition: width .5s; }
.err-box { background: #fbf0ec; border: 1px solid #eccfc5; color: var(--err); border-radius: 12px; padding: 12px; font-size: 13px; white-space: pre-wrap; word-break: break-all; }

/* 分享卡片画布 */
.share-canvas-wrap { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; text-align: center; }
.share-canvas-wrap canvas { max-width: 100%; border-radius: 10px; }

/* 时间线 */
.timeline { border-left: 2px solid var(--line); margin-left: 8px; padding-left: 16px; }
.timeline .tl-item { position: relative; margin-bottom: 14px; }
.timeline .tl-item::before { content: ""; position: absolute; left: -21px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.tl-date { font-size: 12px; color: var(--ink-soft); }

/* 空态与提示 */
.empty { text-align: center; color: var(--ink-soft); padding: 40px 20px; font-size: 14px; }
.empty .big { font-size: 38px; margin-bottom: 8px; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: rgba(43,36,29,.92); color: #fff; padding: 10px 18px; border-radius: 99px; font-size: 13px; z-index: 90; max-width: 84vw; text-align: center; }
.loading { text-align: center; color: var(--ink-soft); padding: 30px; }
.search-box { display: flex; gap: 8px; margin-bottom: 10px; }
.search-box input { flex: 1; padding: 10px 14px; border: 1px solid var(--line); border-radius: 99px; font-size: 14px; background: #fff; }
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 6px; }
.filter-row .chip { flex: 0 0 auto; }
.qr-img { width: 220px; height: 220px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0; }
.stat-cell { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 12px 6px; text-align: center; }
.stat-cell .n { font-size: 20px; font-weight: 700; color: var(--accent); }
.stat-cell .l { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.achv { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.achv .ic { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 17px; }
.achv .t { font-weight: 600; font-size: 14px; }
.achv .d { font-size: 12px; color: var(--ink-soft); }
