/* ==========================================================================
   城市漫游 · 统一视觉规范
   4px 间距基准 / 白底与淡紫 / 系统无衬线字体 / 一套线性图标
   ========================================================================== */

:root {
  /* 颜色：一组用途明确的色值 */
  --paper: #ffffff;
  --surface: #f6f5f8;
  --ink: #242329;
  --muted: #6b6873;
  --brand: #7747bd;
  --brand-ink: #5b3391;
  --lilac: #f1eafb;
  --line: #e7e4ec;
  --lime: #eaf4cc;
  --ok: #26705a;
  --err: #b23a48;
  --map-blue: #357fbd;

  /* 间距：4px 基准 */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s7: 32px;
  --page-x: 20px;

  /* 形状 */
  --r-card: 18px;
  --r-sheet: 24px;
  --r-btn: 16px;
  --r-pill: 999px;

  /* 字号阶梯 */
  --f-page: 26px;
  --lh-page: 34px;
  --f-section: 19px;
  --lh-section: 28px;
  --f-card: 17px;
  --lh-card: 23px;
  --f-body: 16px;
  --lh-body: 28px;
  --f-meta: 14px;
  --lh-meta: 21px;
  --f-note: 13px;
  --lh-note: 19px;
  --f-tag: 12px;

  --tap: 44px;
  --shadow-card: 0 8px 28px rgba(36, 35, 41, 0.08);
  --shadow-sheet: 0 -10px 40px rgba(36, 35, 41, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--surface);
  color: var(--ink);
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: var(--f-body);
  line-height: var(--lh-body);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------- 排版 */
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

h1 {
  font-size: var(--f-page);
  line-height: var(--lh-page);
  font-weight: 680;
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--f-section);
  line-height: var(--lh-section);
  font-weight: 600;
}

h3 {
  font-size: var(--f-card);
  line-height: var(--lh-card);
  font-weight: 600;
}

p {
  font-size: var(--f-body);
  line-height: var(--lh-body);
}

small {
  font-size: var(--f-note);
  line-height: var(--lh-note);
  color: var(--muted);
}

a {
  color: var(--brand-ink);
  text-underline-offset: 3px;
}

mark {
  background: var(--lilac);
  color: var(--ink);
  font-weight: 650;
  border-radius: 4px;
  padding: 0 1px;
}

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------------------------------------------------------------- 按钮 */
button {
  font: inherit;
  color: inherit;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--r-btn);
  min-height: var(--tap);
  padding: 0 var(--s4);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.12s ease;
}

button:hover {
  background: var(--surface);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button[aria-pressed="true"] {
  color: var(--brand-ink);
}

.btn-primary {
  min-height: 50px;
  border: 0;
  border-radius: var(--r-btn);
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  width: 100%;
}

.btn-primary:hover {
  background: #3a3743;
}

.btn-primary svg {
  width: 20px;
  height: 20px;
}

.btn-secondary {
  min-height: 46px;
  border-radius: var(--r-btn);
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
}

.btn-quiet {
  border: 0;
  background: transparent;
  color: var(--brand-ink);
  font-weight: 600;
  padding: 0 var(--s2);
  min-height: var(--tap);
}

.icon-btn {
  width: var(--tap);
  height: var(--tap);
  min-height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink);
}

.icon-btn:hover {
  background: var(--surface);
}

.icon-btn[aria-pressed="true"] {
  color: var(--brand);
}

/* 胶囊只用于筛选与短标签 */
.pill {
  min-height: var(--tap);
  padding: 0 var(--s4);
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.pill[aria-pressed="true"] {
  background: var(--lilac);
  border-color: var(--lilac);
  color: var(--brand-ink);
}

/* ---------------------------------------------------------------- 外壳 */
#experience {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background: var(--paper);
}

#map {
  position: absolute;
  inset: 0;
  z-index: 0;
  isolation: isolate;
  background: var(--surface);
}

/* 二级页面遮住地图，但不把地图容器设为 display:none——
   否则高德地图在 0×0 容器里初始化，回到首页就再也画不出点位 */
#experience.is-page .map-header,
#experience.is-page .map-tools,
#experience.is-page .region-label {
  display: none;
}

/* 顶栏：只放搜索与区域切换 */
.map-header {
  position: absolute;
  z-index: 18;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: calc(env(safe-area-inset-top, 0px) + var(--s3)) var(--page-x) var(--s3);
  background: linear-gradient(var(--paper) 62%, rgba(255, 255, 255, 0));
}

.search-field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: 48px;
  padding: 0 var(--s4);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--muted);
}

.search-field svg {
  flex: 0 0 auto;
  color: var(--muted);
}

.search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 15px;
  color: var(--ink);
  outline-offset: 6px;
}

.search-field input::placeholder {
  color: var(--muted);
}

.district-button {
  flex: 0 0 auto;
  max-width: 42%;
  min-height: 48px;
  padding: 0 var(--s3);
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 0;
  font-size: 14px;
  gap: var(--s1);
}

.district-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#clearSearch {
  flex: 0 0 auto;
}

#experience.is-searching .district-button,
#experience.is-searching .region-label,
#experience.is-searching .map-tools {
  display: none;
}

/* 区域状态：未定位只显示浏览区域名，不冒充“我的位置” */
.region-label {
  position: absolute;
  z-index: 11;
  left: var(--page-x);
  top: calc(env(safe-area-inset-top, 0px) + 76px);
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  max-width: calc(100% - var(--page-x) * 2);
  min-height: 32px;
  padding: 0 var(--s3);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 10px rgba(36, 35, 41, 0.08);
  font-size: var(--f-tag);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.region-label svg {
  width: 15px;
  height: 15px;
  color: var(--brand);
}

/* 地图工具：右下定位，需要时出现“搜索此区域” */
.map-tools {
  position: absolute;
  z-index: 11;
  right: var(--page-x);
  bottom: calc(var(--s7) + 76px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--s2);
}

.map-tools #locate {
  width: 48px;
  height: 48px;
  min-height: 48px;
  border-radius: var(--r-pill);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  color: var(--ink);
}

.map-tools #searchArea {
  min-height: 44px;
  padding: 0 var(--s4);
  border-radius: var(--r-pill);
  background: var(--ink);
  color: #fff;
  border: 0;
  font-size: 14px;
  box-shadow: var(--shadow-card);
}

.map-tools #searchArea[aria-busy="true"] {
  opacity: 0.7;
}

/* 底部四个一级入口 */
.tabbar {
  position: absolute;
  z-index: 20;
  left: var(--s3);
  right: var(--s3);
  bottom: calc(var(--s3) + env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: var(--s1);
  padding: var(--s1);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--line);
  box-shadow: 0 6px 24px rgba(36, 35, 41, 0.1);
}

.tabbar button {
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-height: 52px;
  padding: var(--s1) 2px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  font-size: var(--f-tag);
  line-height: 16px;
  font-weight: 600;
  color: var(--muted);
}

.tabbar button[aria-current="page"] {
  background: var(--lilac);
  color: var(--brand-ink);
}

#experience:not(.has-nav) .tabbar {
  display: none;
}

/* ---------------------------------------------------------------- 地图点 */
.pin {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 50%;
  overflow: visible;
}

.pin::after {
  content: "";
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #b6a9c9;
  box-shadow: 0 0 0 2px #fff;
  transition: transform 0.14s ease;
}

.pin.is-unverified::after {
  background: transparent;
  border: 1.75px solid #9a93a6;
  box-shadow: 0 0 0 2px #fff;
}

.pin.is-stamped::after {
  width: 12px;
  height: 12px;
  background: var(--brand);
  box-shadow: 0 0 0 2px #fff;
}

.pin .pin-check {
  position: absolute;
  right: 7px;
  top: 7px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 1.5px #fff;
}

.pin .pin-check svg {
  width: 9px;
  height: 9px;
}

.pin.selected::after {
  width: 16px;
  height: 16px;
  background: var(--brand-ink);
  box-shadow: 0 0 0 3px #fff, 0 0 0 9px rgba(119, 71, 189, 0.16);
}

.pin-label {
  position: absolute;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  max-width: 148px;
  padding: 3px var(--s2);
  border-radius: 9px;
  background: var(--brand-ink);
  color: #fff;
  font-size: var(--f-tag);
  line-height: 18px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.map-cluster {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--lilac);
  color: var(--brand-ink);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(36, 35, 41, 0.16);
}

.user-dot {
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--map-blue);
  box-shadow: 0 0 0 8px rgba(53, 127, 189, 0.16);
}

#mapEmpty {
  position: absolute;
  z-index: 9;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: var(--s3);
  padding: var(--s7) var(--page-x);
  text-align: center;
  background: var(--surface);
}

#mapEmpty h1 {
  font-size: 24px;
  line-height: 32px;
}

#mapEmpty p {
  font-size: var(--f-meta);
  line-height: var(--lh-meta);
  color: var(--muted);
}

/* ---------------------------------------------------------------- 面板 */
#sheet {
  position: absolute;
  z-index: 14;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--paper);
}

/* 二级页面：整屏白底，顶部返回，底部只放当前任务 */
#sheet.is-page {
  inset: 0;
}

/* 页面包裹层与 #sheet 同列，滚动只发生在 .page-body 上 */
.building-archive,
.theme-detail-view,
.reader,
.next-view,
.passport-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* 地图小卡：底部面板，上角 24px */
#sheet.is-card {
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: var(--shadow-sheet);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.page-bar {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: 56px;
  padding: calc(env(safe-area-inset-top, 0px) + var(--s1)) var(--page-x) var(--s1);
  background: var(--paper);
  border-bottom: 1px solid transparent;
}

.page-bar.is-scrolled {
  border-bottom-color: var(--line);
}

.page-bar h1 {
  flex: 1;
  min-width: 0;
  font-size: 17px;
  line-height: 23px;
  font-weight: 650;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-bar .bar-back {
  border: 0;
  background: transparent;
  min-height: var(--tap);
  padding: 0 0 0 var(--s1);
  color: var(--ink);
  gap: var(--s1);
  font-size: 15px;
}

.page-bar .bar-back svg {
  width: 24px;
  height: 24px;
}

.badge-ai {
  flex: 0 0 auto;
  padding: 2px var(--s2);
  border-radius: 8px;
  background: var(--lilac);
  color: var(--brand-ink);
  font-size: var(--f-tag);
  line-height: 18px;
  font-weight: 600;
}

.page-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 var(--page-x) var(--s6);
  scrollbar-width: thin;
}

.page-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s3) var(--page-x) calc(var(--s3) + env(safe-area-inset-bottom, 0px));
  background: var(--paper);
  border-top: 1px solid var(--line);
}

.page-actions .btn-primary {
  flex: 1;
}

/* 一级页面正文：为底部导航留白 */
.has-nav .page-body {
  padding-bottom: calc(var(--s7) + 76px + env(safe-area-inset-bottom, 0px));
}

/* ---------------------------------------------------------------- 地图小卡 */
.place-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  grid-template-areas:
    "copy photo"
    "actions actions";
  gap: var(--s2) var(--s4);
  padding: var(--s1) var(--page-x) var(--s3);
}

.card-grabber {
  grid-column: 1 / -1;
  width: 40px;
  height: 4px;
  margin: 0 auto var(--s1);
  border-radius: 2px;
  background: var(--line);
}

.place-card-copy {
  grid-area: copy;
  min-width: 0;
  display: block;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0;
  min-height: 0;
  font-weight: 400;
}

.place-card-copy:hover {
  background: transparent;
}

.place-card-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 19px;
  line-height: 25px;
  font-weight: 680;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.place-card-street {
  display: block;
  margin-top: 2px;
  font-size: var(--f-note);
  line-height: var(--lh-note);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.place-card-fact {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: var(--s1);
  font-size: 14px;
  line-height: 20px;
  color: #3f3a48;
}

.place-card-photo {
  grid-area: photo;
  width: 84px;
  height: 84px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
}

.place-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.place-card-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.place-card-actions .btn-primary {
  flex: 1;
  min-height: 44px;
}

.place-card-actions .route-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  display: grid;
  place-items: center;
  color: var(--ink);
}

.place-card-actions .route-btn svg {
  width: 22px;
  height: 22px;
}

/* ---------------------------------------------------------------- 搜索结果 */
#results {
  position: absolute;
  z-index: 16;
  left: 0;
  right: 0;
  top: calc(env(safe-area-inset-top, 0px) + 74px);
  bottom: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

.search-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--s2) var(--page-x) calc(var(--s6) + env(safe-area-inset-bottom, 0px));
}

.search-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s2) 0 var(--s3);
  font-size: var(--f-note);
  color: var(--muted);
}

.person-entry {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 56px;
  padding: var(--s2) var(--s3);
  margin-bottom: var(--s3);
  border-radius: var(--r-card);
  border: 1px solid var(--line);
  background: var(--paper);
  text-align: left;
}

.person-entry[aria-pressed="true"] {
  background: var(--lilac);
  border-color: var(--lilac);
}

.person-entry .person-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--lilac);
  color: var(--brand-ink);
  flex: 0 0 auto;
}

.person-entry strong {
  display: block;
  font-size: 15px;
}

.person-entry small {
  display: block;
}

.search-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.search-group + .search-group {
  border-top: 1px solid var(--line);
}

.search-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 76px;
  padding: var(--s2) 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
}

.search-row:hover {
  background: var(--surface);
}

.search-thumb {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  display: grid;
  place-items: center;
  color: var(--brand);
}

.search-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.search-thumb--icon img,
.search-thumb--icon svg {
  width: 26px;
  height: 26px;
}

.search-row-copy {
  flex: 1;
  min-width: 0;
}

.search-row-copy strong {
  display: block;
  font-size: 16px;
  line-height: 23px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-row-copy small {
  display: block;
  font-size: var(--f-note);
  line-height: var(--lh-note);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-row-arrow {
  flex: 0 0 auto;
  color: #a9a3b2;
}

.search-stories {
  margin: 0 0 var(--s2) 64px;
  min-height: 36px;
  padding: 0 var(--s3);
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 0;
  font-size: var(--f-note);
  color: var(--brand-ink);
}

.search-story-list {
  margin: 0 0 var(--s3) 64px;
  padding: 0;
}

.search-story {
  width: 100%;
  min-height: 52px;
  padding: var(--s2) 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
  display: flex;
  align-items: center;
  gap: var(--s2);
  border-bottom: 1px solid var(--line);
}

.search-story strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.search-story small {
  font-size: var(--f-tag);
  line-height: 16px;
}

.search-empty {
  padding: var(--s7) 0 var(--s5);
  text-align: center;
}

.search-empty strong {
  display: block;
  font-size: 17px;
  margin-bottom: var(--s2);
}

.search-empty p {
  font-size: var(--f-meta);
  color: var(--muted);
  margin-bottom: var(--s5);
}

.search-empty .empty-actions {
  display: flex;
  gap: var(--s2);
  justify-content: center;
  flex-wrap: wrap;
}

.search-empty .empty-actions button {
  min-height: 44px;
  border-radius: var(--r-pill);
  padding: 0 var(--s5);
  font-size: 14px;
}

/* ---------------------------------------------------------------- 区域面板 */
.region-sheet {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  padding: var(--s2) var(--page-x) calc(var(--s4) + env(safe-area-inset-bottom, 0px));
}

.region-head {
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.region-head h2 {
  flex: 1;
  font-size: 19px;
  line-height: 26px;
  font-weight: 650;
}

.region-scope {
  display: flex;
  gap: var(--s2);
}

.region-scope button {
  flex: 1;
  min-height: var(--tap);
  border-radius: var(--r-pill);
  font-size: 14px;
}

.region-scope button[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.district-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s2);
}

.district-cell {
  min-height: var(--tap);
  padding: 0 var(--s1);
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s1);
}

.district-cell svg {
  width: 16px;
  height: 16px;
}

.district-cell[aria-pressed="true"] {
  background: var(--lilac);
  border-color: var(--lilac);
  color: var(--brand-ink);
}

.region-note {
  font-size: var(--f-note);
  line-height: var(--lh-note);
  color: var(--muted);
}

.region-loading {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--f-meta);
  color: var(--muted);
  padding: var(--s3) 0;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------------------------------------------------------------- 建筑档案 */
.archive-hero {
  margin: 0 0 var(--s4);
  height: clamp(180px, 46vw, 220px);
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--surface);
}

.archive-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.archive-title {
  font-size: var(--f-page);
  line-height: var(--lh-page);
  font-weight: 680;
  letter-spacing: -0.02em;
}

.archive-address {
  margin-top: var(--s1);
  font-size: var(--f-meta);
  line-height: var(--lh-meta);
  color: var(--muted);
}

.archive-visit {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin: var(--s4) 0 0;
}

.visit-item {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  min-height: 40px;
  padding: 0 var(--s3);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: var(--f-note);
  line-height: var(--lh-note);
  color: var(--ink);
}

.visit-item svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.visit-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  font-size: var(--f-note);
  color: var(--brand-ink);
  background: transparent;
  border: 0;
  padding: 0;
}

.archive-story {
  margin-top: var(--s5);
  display: grid;
  gap: var(--s4);
}

.archive-story p {
  font-size: var(--f-body);
  line-height: var(--lh-body);
  color: #33303a;
}

.archive-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s2) var(--s4);
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
}

.archive-facts.is-single {
  grid-template-columns: minmax(0, 1fr);
}

.archive-facts > div {
  min-width: 0;
}

.archive-facts dt {
  font-size: var(--f-tag);
  line-height: 18px;
  color: var(--muted);
}

.archive-facts dd {
  margin: 2px 0 0;
  font-size: 14px;
  line-height: 21px;
  color: var(--ink);
}

.archive-details {
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
}

.archive-details h2 {
  font-size: var(--f-section);
  line-height: var(--lh-section);
  margin-bottom: var(--s3);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s3);
}

.detail-grid figure {
  min-width: 0;
}

.detail-grid .detail-image {
  height: 104px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}

.detail-grid .detail-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-grid .detail-image.is-left img {
  object-position: 50% 72%;
}

.detail-grid .detail-image.is-up img {
  object-position: 50% 22%;
}

.detail-grid figcaption strong {
  display: block;
  margin-top: var(--s2);
  font-size: 14px;
  line-height: 21px;
  font-weight: 600;
}

.detail-grid figcaption small {
  display: block;
  font-size: var(--f-tag);
  line-height: 18px;
}

.archive-views {
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
}

.archive-views h2 {
  font-size: var(--f-section);
  line-height: var(--lh-section);
  margin-bottom: var(--s3);
}

.view-grid {
  display: grid;
  gap: var(--s2);
}

.view-grid button {
  justify-content: flex-start;
  gap: var(--s3);
  min-height: 56px;
  padding: var(--s3) var(--s4);
  border-radius: var(--r-card);
  background: var(--surface);
  border: 0;
  text-align: left;
  font-weight: 600;
}

.view-grid button svg {
  color: var(--brand);
  flex: 0 0 auto;
}

.view-grid button small {
  display: block;
  font-size: var(--f-tag);
  line-height: 18px;
}

.view-grid button span {
  flex: 1;
  min-width: 0;
}

.view-grid button span strong {
  display: block;
  font-size: 15px;
  line-height: 21px;
}

.view-grid button > svg:last-child {
  color: #a9a3b2;
}

.archive-themes,
.archive-stories {
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
}

.archive-themes h2,
.archive-stories h2 {
  font-size: var(--f-section);
  line-height: var(--lh-section);
  margin-bottom: var(--s3);
}

.theme-chip {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--line);
}

.theme-chip:last-child {
  border-bottom: 0;
}

.theme-chip-open {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--s3);
  border: 0;
  background: transparent;
  padding: 0;
  min-height: 56px;
  text-align: left;
}

.theme-chip-open img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex: 0 0 auto;
}

.theme-chip-open .chip-copy {
  flex: 1;
  min-width: 0;
}

.theme-chip-open .chip-relation {
  display: block;
  font-size: var(--f-tag);
  line-height: 16px;
  color: var(--brand-ink);
  font-weight: 600;
}

.theme-chip-open strong {
  display: block;
  font-size: 15px;
  line-height: 21px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-chip-save {
  flex: 0 0 auto;
  width: var(--tap);
  height: var(--tap);
  min-height: var(--tap);
  border: 0;
  background: transparent;
}

.archive-sources {
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
}

.archive-sources h2 {
  font-size: var(--f-section);
  line-height: var(--lh-section);
  margin-bottom: var(--s2);
}

.source-row {
  display: block;
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
}

.source-row:last-child {
  border-bottom: 0;
}

.source-row strong {
  display: block;
  font-size: var(--f-meta);
  line-height: var(--lh-meta);
  font-weight: 600;
}

.source-row small {
  display: block;
  font-size: var(--f-tag);
  line-height: 18px;
}

.source-row blockquote {
  margin: var(--s2) 0 0;
  padding-left: var(--s3);
  border-left: 3px solid var(--lilac);
  font-size: var(--f-note);
  line-height: 20px;
  color: var(--muted);
}

.source-meta {
  margin-top: var(--s3);
  font-size: var(--f-tag);
  line-height: 18px;
  color: var(--muted);
}

/* 进度点 */
.dots {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  border: 1.5px solid #b3aabd;
  background: transparent;
}

.dot.is-done {
  background: var(--brand);
  border-color: var(--brand);
}

/* ---------------------------------------------------------------- 到访与盖章 */
.stamp-bar {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  width: 100%;
}

.stamp-status {
  display: flex;
  align-items: center;
  gap: var(--s1);
  font-size: var(--f-note);
  line-height: var(--lh-note);
  color: var(--muted);
}

.stamp-status.is-near {
  color: var(--ok);
}

.stamp-status.is-warn {
  color: var(--err);
}

.stamp-status svg {
  width: 16px;
  height: 16px;
}

.stamp-row {
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.stamp-row .btn-primary {
  flex: 1;
}

.stamp-row .btn-secondary {
  flex: 0 0 auto;
  padding: 0 var(--s4);
}

.stamp-done {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
}

.stamp-done .stamp-copy {
  flex: 1;
  min-width: 0;
}

.stamp-done .stamp-copy strong {
  display: block;
  font-size: 15px;
  line-height: 21px;
}

.stamp-done .stamp-copy small {
  display: block;
}

/* 轻点即可完成；按住只是可选的仪式 */
.stamp-hold {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.stamp-hold .stamp-fill {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: left;
}

.stamp-hold .stamp-label {
  position: relative;
  z-index: 1;
}

.stamp-hold.is-holding .stamp-fill {
  animation: stamp-fill 0.9s linear forwards;
}

.stamp-hold:hover .stamp-fill {
  background: #6636a6;
}

@keyframes stamp-fill {
  to {
    transform: scaleX(1);
  }
}

/* ---------------------------------------------------------------- 向导 */
.guide-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--s5);
}

.guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding-top: var(--s2);
}

.guide-head h1 {
  font-size: var(--f-page);
  line-height: var(--lh-page);
}

.guide-mark {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex: 0 0 auto;
}

.guide-tasks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s2);
  padding: var(--s1);
  border-radius: var(--r-card);
  background: var(--surface);
}

.guide-tasks button {
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  font-size: 15px;
  color: var(--muted);
  gap: var(--s2);
}

.guide-tasks button[aria-selected="true"] {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(36, 35, 41, 0.07);
}

.guide-tasks svg {
  width: 20px;
  height: 20px;
}

.guide-field {
  display: grid;
  gap: var(--s2);
}

.field-label {
  font-size: var(--f-note);
  line-height: var(--lh-note);
  font-weight: 650;
  color: var(--ink);
}

.field-help {
  font-size: var(--f-tag);
  line-height: 18px;
  color: var(--muted);
}

.place-field {
  position: relative;
}

.place-input {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: 52px;
  padding: 0 var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  background: var(--paper);
}

.place-input svg {
  color: var(--muted);
  flex: 0 0 auto;
}

.place-input input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 16px;
  outline-offset: 6px;
}

.place-suggest {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 264px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--paper);
  box-shadow: var(--shadow-card);
  padding: var(--s1);
}

.place-option {
  display: flex;
  align-items: center;
  gap: var(--s2);
  width: 100%;
  min-height: 48px;
  padding: var(--s1) var(--s3);
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
}

.place-option.is-active,
.place-option:hover {
  background: var(--surface);
}

.place-option[aria-selected="true"] {
  background: var(--lilac);
}

.place-option span {
  flex: 1;
  min-width: 0;
}

.place-option strong {
  display: block;
  font-size: 15px;
  line-height: 21px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.place-option small {
  display: block;
  font-size: var(--f-tag);
  line-height: 17px;
}

.place-empty {
  font-size: var(--f-note);
  color: var(--muted);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

.pill-row button {
  min-height: var(--tap);
  padding: 0 var(--s4);
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 14px;
  font-weight: 600;
}

.pill-row button[aria-pressed="true"] {
  background: var(--lilac);
  border-color: var(--lilac);
  color: var(--brand-ink);
}

.time-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s2);
}

.time-row button {
  flex-direction: column;
  gap: 0;
  min-height: 56px;
  padding: var(--s1);
  border-radius: 14px;
  font-size: 16px;
  font-weight: 650;
}

.time-row button small {
  font-size: var(--f-tag);
  line-height: 14px;
  font-weight: 400;
}

.time-row button[aria-pressed="true"] {
  background: var(--lilac);
  border-color: var(--lilac);
  color: var(--brand-ink);
}

.scope-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  align-self: flex-start;
  min-height: 36px;
  padding: 0 var(--s1) 0 var(--s3);
  border-radius: var(--r-pill);
  background: var(--lilac);
  color: var(--brand-ink);
  font-size: var(--f-note);
  font-weight: 600;
}

.scope-pill button {
  width: 30px;
  height: 30px;
  min-height: 30px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
}

.scope-pill svg {
  width: 16px;
  height: 16px;
}

.guide-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: grid;
  gap: var(--s2);
  padding: var(--s3) 0 calc(var(--s1) + env(safe-area-inset-bottom, 0px));
  background: var(--paper);
}

/* 根向导页保留底栏时，操作区落在底栏上方 */
.has-nav .guide-actions {
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}

.guide-status {
  font-size: var(--f-tag);
  line-height: 18px;
  color: var(--muted);
  min-height: 18px;
}

.guide-status.is-error {
  color: var(--err);
}

/* ---------------------------------------------------------------- AI 阅读 */
.reader {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.view-tabs {
  display: flex;
  gap: var(--s1);
  padding: 0 var(--page-x) var(--s3);
}

.view-tabs button {
  flex: 1;
  min-height: 40px;
  padding: 0 var(--s1);
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.view-tabs button[aria-pressed="true"] {
  background: var(--lilac);
  border-color: var(--lilac);
  color: var(--brand-ink);
}

.reader-body {
  display: grid;
  gap: var(--s4);
}

.reader-body.is-loading {
  opacity: 0.55;
}

.reader-h2 {
  font-size: 20px;
  line-height: 28px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.reader-p {
  font-size: var(--f-body);
  line-height: var(--lh-body);
  color: #33303a;
}

.reader-figure {
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--surface);
}

.reader-figure img {
  width: 100%;
  height: auto;
  display: block;
}

.reader-note {
  padding: var(--s3) var(--s4);
  border-radius: var(--r-card);
  background: var(--lilac);
  font-size: var(--f-note);
  line-height: var(--lh-note);
  color: var(--brand-ink);
}

.cite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  margin: 0 1px;
  padding: 0 5px;
  border: 0;
  border-radius: 6px;
  background: var(--surface);
  color: var(--brand-ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  vertical-align: 2px;
}

.cite[aria-expanded="true"] {
  background: var(--brand);
  color: #fff;
}

/* 来源：手机优先底部面板 */
.cite-sheet {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 68dvh;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  background: var(--paper);
  box-shadow: var(--shadow-sheet);
  padding: var(--s2) 0 calc(var(--s4) + env(safe-area-inset-bottom, 0px));
}

.cite-sheet-head {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s1) var(--page-x) var(--s2);
}

.cite-sheet-head strong {
  flex: 1;
  font-size: 16px;
}

.cite-sheet-body {
  overflow-y: auto;
  padding: 0 var(--page-x);
}

.source-card {
  display: grid;
  gap: var(--s2);
  padding: var(--s4) 0;
  border-top: 1px solid var(--line);
}

.source-card:first-child {
  border-top: 0;
}

.source-card .source-title {
  font-size: 16px;
  line-height: 23px;
  font-weight: 600;
}

.source-card .source-publisher {
  font-size: var(--f-tag);
  line-height: 18px;
  color: var(--muted);
}

.source-card blockquote {
  margin: 0;
  padding-left: var(--s3);
  border-left: 3px solid var(--lilac);
  font-size: var(--f-meta);
  line-height: 22px;
  color: #4b4654;
}

.source-card a {
  font-size: var(--f-meta);
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(20, 18, 26, 0.34);
}

/* ---------------------------------------------------------------- 下一站 */
.next-place h1 {
  font-size: 24px;
  line-height: 32px;
  letter-spacing: -0.02em;
}

.next-address {
  margin-top: var(--s1);
  font-size: var(--f-meta);
  line-height: var(--lh-meta);
  color: var(--muted);
}

.route-frame {
  position: relative;
  height: 200px;
  margin-top: var(--s4);
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--surface);
}

.route-frame > div {
  position: absolute;
  inset: 0;
}

.route-status {
  position: absolute;
  inset: auto var(--s3) var(--s3);
  padding: var(--s1) var(--s2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  font-size: var(--f-tag);
  line-height: 18px;
  color: var(--muted);
}

.next-times {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-top: var(--s4);
}

.time-item {
  display: inline-flex;
  align-items: baseline;
  gap: var(--s1);
  min-height: 40px;
  padding: 0 var(--s3);
  border-radius: var(--r-pill);
  background: var(--lime);
  color: #414a26;
  font-size: var(--f-meta);
}

.time-item b {
  font-size: 17px;
  font-weight: 700;
}

.next-total {
  margin-top: var(--s2);
  font-size: var(--f-note);
  line-height: var(--lh-note);
  color: var(--muted);
}

.next-reasons {
  margin-top: var(--s6);
}

.next-reasons h2 {
  font-size: var(--f-section);
  line-height: var(--lh-section);
  margin-bottom: var(--s3);
}

.reason {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: var(--s3);
  padding: var(--s3) 0;
  border-top: 1px solid var(--line);
}

.reason:first-child {
  border-top: 0;
  padding-top: 0;
}

.reason-num {
  width: 20px;
  height: 20px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
}

.reason p {
  font-size: var(--f-body);
  line-height: var(--lh-body);
  color: #33303a;
}

.reason .reason-note {
  margin-top: var(--s1);
  font-size: var(--f-tag);
  line-height: 18px;
  color: var(--muted);
}

.reason-figure {
  margin-top: var(--s3);
}

.reason-figure img {
  width: 100%;
  height: auto;
  border-radius: var(--r-card);
  display: block;
}

.reason-figure figcaption {
  margin-top: var(--s1);
  font-size: var(--f-tag);
  line-height: 18px;
}

.theme-bar {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-top: var(--s6);
  padding: var(--s2);
  border-radius: var(--r-card);
  background: var(--surface);
}

.theme-bar img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex: 0 0 auto;
}

.theme-bar .theme-bar-copy {
  flex: 1;
  min-width: 0;
}

.theme-bar .theme-bar-copy span {
  display: block;
  font-size: var(--f-tag);
  line-height: 16px;
  color: var(--muted);
}

.theme-bar .theme-bar-copy strong {
  display: block;
  font-size: 15px;
  line-height: 21px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.next-source {
  margin-top: var(--s4);
  display: flex;
  align-items: center;
  gap: var(--s2);
  justify-content: space-between;
  font-size: var(--f-tag);
  line-height: 18px;
  color: var(--muted);
}

.next-source button {
  min-height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand-ink);
  font-size: var(--f-tag);
  font-weight: 600;
  gap: var(--s1);
}

.evidence {
  margin-top: var(--s3);
  padding-top: var(--s3);
  border-top: 1px solid var(--line);
}

.evidence h2 {
  font-size: 16px;
  line-height: 23px;
  margin-bottom: var(--s2);
}

/* 问题页 */
.problem {
  display: grid;
  gap: var(--s3);
  padding: var(--s7) 0 var(--s5);
}

.problem .problem-mark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--err);
  display: grid;
  place-items: center;
}

.problem h1 {
  font-size: 21px;
  line-height: 29px;
}

.problem p {
  font-size: var(--f-meta);
  line-height: var(--lh-meta);
  color: var(--muted);
}

.problem-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-top: var(--s2);
}

.problem-actions button {
  min-height: var(--tap);
  border-radius: var(--r-pill);
  padding: 0 var(--s4);
  font-size: 14px;
}

/* ---------------------------------------------------------------- 主题瀑布流 */
.themes-head {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) 0 var(--s3);
}

.themes-head h1 {
  flex: 1;
  font-size: var(--f-page);
  line-height: var(--lh-page);
}

.theme-filters {
  display: flex;
  gap: var(--s2);
  padding-bottom: var(--s4);
  overflow-x: auto;
  scrollbar-width: none;
}

.theme-filters::-webkit-scrollbar {
  display: none;
}

.theme-filters button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 var(--s4);
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.theme-filters button[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s3);
  align-items: start;
}

.theme-card {
  position: relative;
  min-width: 0;
}

.theme-card-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: var(--r-card);
  text-align: left;
  overflow: visible;
  min-height: 0;
}

.theme-card-open:hover {
  background: transparent;
}

.theme-cover {
  position: relative;
  display: block;
  width: 100%;
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--surface);
}

.theme-cover.ratio-4x5 {
  aspect-ratio: 4 / 5;
}

.theme-cover.ratio-1x1 {
  aspect-ratio: 1 / 1;
}

.theme-cover.ratio-4x3 {
  aspect-ratio: 4 / 3;
}

.theme-cover > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 没有可靠主题照片时用文字封面，不冒充现场照片 */
.theme-cover.is-text {
  display: grid;
  align-content: end;
  gap: var(--s1);
  padding: var(--s3);
  background: linear-gradient(160deg, #f4edff 0%, #eaf4cc 100%);
}

.theme-cover.is-text .cover-kicker {
  font-size: var(--f-tag);
  line-height: 16px;
  color: var(--brand-ink);
  font-weight: 650;
}

.theme-cover.is-text .cover-title {
  font-size: 17px;
  line-height: 23px;
  font-weight: 680;
  color: var(--ink);
}

.cover-tag {
  position: absolute;
  left: var(--s2);
  top: var(--s2);
  padding: 2px var(--s2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: #4b4654;
  font-size: var(--f-tag);
  line-height: 18px;
  font-weight: 600;
}

.theme-save {
  position: absolute;
  right: var(--s1);
  top: var(--s1);
  width: var(--tap);
  height: var(--tap);
  min-height: var(--tap);
  border: 0;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: 0 1px 6px rgba(36, 35, 41, 0.12);
}

.theme-save[aria-pressed="true"] {
  color: var(--brand);
}

.theme-save svg {
  width: 20px;
  height: 20px;
}

.theme-card-copy {
  padding: var(--s2) 2px 0;
}

.theme-card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 15px;
  line-height: 22px;
  font-weight: 650;
}

.theme-card-region {
  margin-top: 2px;
  font-size: var(--f-tag);
  line-height: 18px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-card .dots {
  margin-top: var(--s1);
}

.themes-empty {
  padding: var(--s7) 0;
  text-align: center;
  color: var(--muted);
}

.themes-empty strong {
  display: block;
  font-size: 17px;
  color: var(--ink);
  margin-bottom: var(--s2);
}

/* ---------------------------------------------------------------- 主题详情 */
.theme-hero {
  margin: 0 0 var(--s4);
  height: clamp(180px, 44vw, 210px);
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--surface);
  position: relative;
}

.theme-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.theme-hero.is-text {
  display: grid;
  align-content: end;
  gap: var(--s1);
  padding: var(--s4);
  background: linear-gradient(160deg, #f4edff 0%, #eaf4cc 100%);
}

.theme-hero.is-text .cover-kicker {
  font-size: var(--f-tag);
  color: var(--brand-ink);
  font-weight: 650;
}

.theme-hero.is-text .cover-title {
  font-size: 20px;
  line-height: 28px;
  font-weight: 680;
}

.theme-title {
  font-size: var(--f-page);
  line-height: var(--lh-page);
  font-weight: 680;
  letter-spacing: -0.02em;
}

.theme-lead {
  margin-top: var(--s2);
  font-size: var(--f-body);
  line-height: var(--lh-body);
  color: #33303a;
}

.theme-meta {
  display: flex;
  align-items: center;
  gap: var(--s1);
  margin-top: var(--s3);
  font-size: var(--f-meta);
  line-height: var(--lh-meta);
  color: var(--muted);
}

.theme-meta svg {
  width: 16px;
  height: 16px;
}

.theme-progress {
  margin-top: var(--s3);
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--f-note);
  line-height: var(--lh-note);
  color: var(--muted);
}

.station-group {
  margin-top: var(--s6);
}

.station-group > h2 {
  font-size: var(--f-section);
  line-height: var(--lh-section);
  margin-bottom: var(--s1);
}

.station-group > p {
  font-size: var(--f-note);
  line-height: var(--lh-note);
  color: var(--muted);
  margin-bottom: var(--s2);
}

.station-list {
  display: grid;
}

.station {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 80px;
  padding: var(--s2) 0;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.station:last-child {
  border-bottom: 0;
}

.station:hover {
  background: var(--surface);
}

.station.is-current {
  background: var(--lilac);
  border-radius: 12px;
  padding-left: var(--s2);
  padding-right: var(--s2);
}

.station-art {
  flex: 0 0 auto;
  width: 68px;
  height: 68px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  display: grid;
  place-items: center;
  color: var(--brand);
}

.station-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.station-copy {
  flex: 1;
  min-width: 0;
}

.station-copy strong {
  display: block;
  font-size: 16px;
  line-height: 23px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.station-copy small {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: var(--f-tag);
  line-height: 18px;
  color: var(--muted);
}

.station-copy small svg {
  width: 14px;
  height: 14px;
}

.station-state {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--ok);
}

.station-state .hollow {
  width: 12px;
  height: 12px;
  border: 1.5px solid #b3aabd;
  border-radius: 50%;
}

.readonly-note {
  margin-top: var(--s2);
  font-size: var(--f-tag);
  line-height: 18px;
  color: var(--muted);
}

/* ---------------------------------------------------------------- 护照 */
.passport-head {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) 0 var(--s3);
}

.passport-head h1 {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--f-page);
  line-height: var(--lh-page);
}

.passport-head h1 svg {
  color: var(--brand);
  flex: 0 0 auto;
}

.passport-status {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  min-height: 32px;
  padding: 0 var(--s1) 0 var(--s3);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: var(--f-tag);
  line-height: 18px;
  color: var(--muted);
}

.passport-status[data-state="saved"] {
  color: var(--ok);
}

.passport-status[data-state="pending"] {
  color: var(--err);
}

/* 状态变化时短暂强调，随后回到安静的常态 */
.passport-status.is-pulse {
  animation: status-pulse 1.3s ease-out 1;
}

@keyframes status-pulse {
  0% {
    background: var(--lilac);
    box-shadow: 0 0 0 3px rgba(119, 71, 189, 0.16);
  }
  70% {
    background: var(--lilac);
    box-shadow: 0 0 0 3px rgba(119, 71, 189, 0);
  }
  100% {
    background: var(--surface);
    box-shadow: none;
  }
}

.passport-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s2);
  margin: var(--s3) 0 var(--s6);
}

.stat {
  padding: var(--s3);
  border-radius: var(--r-card);
  background: var(--surface);
  text-align: center;
}

.stat b {
  display: block;
  font-size: 24px;
  line-height: 30px;
  font-weight: 700;
  color: var(--brand-ink);
}

.stat span {
  display: block;
  font-size: var(--f-tag);
  line-height: 18px;
  color: var(--muted);
}

.passport-section {
  margin-bottom: var(--s6);
}

.section-head {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s3);
}

.section-head h2 {
  flex: 1;
  font-size: var(--f-section);
  line-height: var(--lh-section);
}

.section-head button {
  min-height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand-ink);
  font-size: var(--f-note);
  font-weight: 600;
  gap: 2px;
}

.continue-card {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 72px;
  padding: var(--s2) 0;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.continue-card:last-child {
  border-bottom: 0;
}

.continue-card img {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  flex: 0 0 auto;
}

.continue-copy {
  flex: 1;
  min-width: 0;
}

.continue-copy strong {
  display: block;
  font-size: 16px;
  line-height: 23px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.continue-copy small {
  display: block;
  font-size: var(--f-tag);
  line-height: 18px;
}

.continue-card .dots {
  margin-top: 2px;
}

.stamp-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s3);
}

.stamp-cell {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  min-height: 0;
  text-align: left;
}

/* 章面：有专属图用专属图，没有时用一致的中性章面 + 建筑名 */
.stamp-art {
  display: block;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--lilac);
  flex: 0 0 auto;
}

.stamp-cell .stamp-art {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
}

.stamp-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.stamp-art.is-neutral {
  display: grid;
  place-items: center;
  background: #f8f4fd;
  border: 1px dashed #c9b4e8;
}

.stamp-art.is-neutral .seal {
  display: grid;
  justify-items: center;
  gap: 1px;
  color: var(--brand-ink);
  padding: 2px;
  text-align: center;
}

.stamp-art.is-neutral .seal b {
  font-size: 10px;
  line-height: 13px;
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
}

.stamp-art.is-neutral .seal small {
  font-size: 7px;
  line-height: 9px;
  color: #7a63a0;
}

.stamp-cell strong {
  display: block;
  margin-top: var(--s1);
  font-size: 14px;
  line-height: 19px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stamp-cell time {
  display: block;
  font-size: var(--f-tag);
  line-height: 16px;
  color: var(--muted);
}

.stamp-hero {
  display: grid;
  place-items: center;
  padding: var(--s5) 0 var(--s4);
}

.stamp-hero .stamp-art {
  width: 160px;
  height: 160px;
  border-radius: 20px;
}

.stamp-hero .seal b {
  font-size: 20px;
  line-height: 26px;
}

.stamp-hero .seal small {
  font-size: 10px;
  line-height: 14px;
}

.stamp-month {
  margin-bottom: var(--s5);
}

.stamp-month h2 {
  font-size: var(--f-tag);
  line-height: 18px;
  color: var(--muted);
  font-weight: 650;
  margin-bottom: var(--s2);
}

/* 空态：随内容收紧，不预留固定空白 */
.empty-inline {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3);
  border-radius: var(--r-card);
  background: var(--surface);
  color: var(--brand);
}

.empty-inline img {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  flex: 0 0 auto;
}

.empty-inline div {
  flex: 1;
  min-width: 0;
}

.empty-inline strong {
  display: block;
  font-size: 15px;
  color: var(--ink);
}

.empty-inline small {
  display: block;
}

.medal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s3);
}

.medal-cell {
  display: grid;
  gap: var(--s1);
  justify-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  min-height: 0;
  text-align: center;
}

.medal-cell .medal-art {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface);
  display: grid;
  place-items: center;
}

.medal-cell .medal-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.medal-cell.is-locked .medal-art img {
  filter: grayscale(1);
  opacity: 0.45;
}

.medal-cell strong {
  font-size: var(--f-tag);
  line-height: 17px;
  font-weight: 600;
  color: var(--muted);
}

.medal-cell.is-earned strong {
  color: var(--ink);
}

.medal-progress {
  font-size: var(--f-tag);
  line-height: 16px;
  color: var(--muted);
}

/* 设置分组 */
.settings-group {
  margin-bottom: var(--s5);
}

.settings-group > h2 {
  font-size: var(--f-tag);
  line-height: 18px;
  font-weight: 650;
  color: var(--muted);
  margin-bottom: var(--s2);
}

.settings-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 52px;
  padding: var(--s1) 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink);
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-row .row-value {
  margin-left: auto;
  font-size: var(--f-note);
  color: var(--muted);
}

.settings-row svg {
  color: var(--muted);
  flex: 0 0 auto;
  margin-left: auto;
}

.settings-row.is-danger {
  color: var(--err);
}

.sync-warning {
  display: grid;
  gap: var(--s1);
  padding: var(--s3);
  border-radius: var(--r-card);
  background: #fdf6e3;
  margin-bottom: var(--s4);
}

.sync-warning strong {
  font-size: 14px;
}

.sync-warning small {
  color: #7a6a45;
}

/* ---------------------------------------------------------------- 奖励 */
#celebration {
  border: 0;
  padding: 0;
  border-radius: var(--r-sheet);
  background: var(--paper);
  color: var(--ink);
  width: min(360px, calc(100vw - 32px));
  max-height: 88dvh;
  overflow: visible;
}

#celebration::backdrop {
  background: rgba(20, 18, 26, 0.42);
}

.reward {
  display: grid;
  justify-items: center;
  gap: var(--s2);
  padding: var(--s6) var(--s5) var(--s5);
  text-align: center;
}

.reward h2 {
  font-size: 21px;
  line-height: 29px;
}

.reward .stamp-art {
  width: 116px;
  height: 116px;
  border-radius: 18px;
  margin: var(--s2) 0;
}

.reward .stamp-art .seal b {
  font-size: 16px;
  line-height: 22px;
}

.reward .stamp-art .seal small {
  font-size: 9px;
  line-height: 12px;
}

.reward .reward-medal {
  width: 124px;
  height: 124px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface);
  margin: var(--s2) 0;
}

.reward .reward-medal img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.reward .reward-name {
  font-size: 18px;
  line-height: 26px;
  font-weight: 650;
}

.reward .reward-date {
  font-size: var(--f-note);
  color: var(--muted);
}

.reward .reward-dots {
  margin: var(--s1) 0;
}

.reward-actions {
  display: grid;
  gap: var(--s2);
  width: 100%;
  margin-top: var(--s3);
}

.reward-demo {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: 1px var(--s2);
  border-radius: 8px;
  background: var(--lime);
  color: #414a26;
  font-size: var(--f-tag);
  line-height: 18px;
  font-weight: 600;
}

#celebration.is-dropping .stamp-art,
#celebration.is-dropping .reward-medal {
  animation: stamp-drop 0.6s cubic-bezier(0.3, 1.4, 0.5, 1) both;
}

#celebration.is-settled .stamp-art,
#celebration.is-settled .reward-medal {
  animation: none;
}

@keyframes stamp-drop {
  0% {
    transform: scale(1.5) rotate(-8deg);
    opacity: 0;
  }
  62% {
    transform: scale(0.94) rotate(2deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

/* ---------------------------------------------------------------- 账号 */
.auth-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--s2) var(--page-x) var(--s6);
  display: grid;
  align-content: start;
  gap: var(--s4);
}

.auth-mark {
  display: grid;
  justify-items: center;
  padding: var(--s5) 0 var(--s1);
}

.auth-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--lilac);
  color: var(--brand-ink);
  display: grid;
  place-items: center;
}

.auth-form {
  display: grid;
  gap: var(--s4);
}

.auth-field {
  display: grid;
  gap: var(--s2);
}

.auth-field .field-row {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: 52px;
  padding: 0 var(--s3) 0 var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  background: var(--paper);
}

.auth-field .field-row:focus-within {
  border-color: var(--brand);
}

.auth-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 16px;
  outline: none;
}

.auth-field .field-row button {
  width: 40px;
  height: 40px;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.field-error {
  font-size: var(--f-tag);
  line-height: 18px;
  color: var(--err);
}

.field-error:empty {
  display: none;
}

.auth-links {
  display: grid;
  gap: var(--s1);
  justify-items: center;
  margin-top: var(--s2);
}

.auth-links button {
  min-height: var(--tap);
  border: 0;
  background: transparent;
  color: var(--brand-ink);
  font-size: var(--f-meta);
  font-weight: 600;
}

.auth-legal {
  font-size: var(--f-tag);
  line-height: 18px;
  color: var(--muted);
  text-align: center;
}

.verify-box {
  display: grid;
  gap: var(--s3);
  justify-items: center;
  padding: var(--s3) 0;
  text-align: center;
}

.verify-address {
  width: 100%;
  padding: var(--s3) var(--s4);
  border-radius: var(--r-btn);
  background: var(--surface);
  font-size: 15px;
  font-weight: 650;
  word-break: break-all;
}

.verify-help {
  margin-top: var(--s4);
  border-top: 1px solid var(--line);
  padding-top: var(--s3);
}

.verify-help summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: var(--f-meta);
  font-weight: 600;
  color: var(--brand-ink);
}

.verify-help p {
  font-size: var(--f-note);
  line-height: var(--lh-note);
  color: var(--muted);
  margin-bottom: var(--s2);
}

/* ---------------------------------------------------------------- 提示 */
#toast {
  position: fixed;
  z-index: 40;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  max-width: calc(100vw - 32px);
  padding: var(--s2) var(--s4);
  border-radius: var(--r-pill);
  background: rgba(36, 35, 41, 0.94);
  color: #fff;
  font-size: var(--f-note);
  line-height: var(--lh-note);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#toast:not(:empty) {
  opacity: 1;
}

.demo-badge {
  position: absolute;
  z-index: 22;
  left: 50%;
  transform: translateX(-50%);
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  padding: 1px var(--s3);
  border-radius: var(--r-pill);
  background: var(--lime);
  color: #414a26;
  font-size: var(--f-tag);
  line-height: 20px;
  font-weight: 650;
}

#experience.is-page .demo-badge {
  left: auto;
  right: var(--page-x);
  transform: none;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  z-index: 30;
}

/* ---------------------------------------------------------------- 无障碍 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* 窄屏：320px 长建筑名不压按钮 */
@media (max-width: 360px) {
  :root {
    --page-x: 16px;
  }
  .place-card {
    grid-template-columns: minmax(0, 1fr) 72px;
  }
  .place-card-photo {
    width: 72px;
    height: 72px;
  }
  .tabbar button {
    font-size: 11px;
  }
  .time-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .archive-facts {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* 桌面：内容居中，保持手机节奏 */
@media (min-width: 720px) {
  #sheet.is-page {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(720px, 100vw);
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
  .page-body,
  .page-bar,
  .page-actions {
    padding-left: 32px;
    padding-right: 32px;
  }
  #sheet.is-card {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(560px, calc(100vw - 32px));
  }
  .place-card {
    padding-left: 32px;
    padding-right: 32px;
  }
  .search-body,
  .themes-head,
  .theme-filters,
  .region-sheet,
  .stamp-bar {
    max-width: 720px;
    margin: 0 auto;
  }
  .theme-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .theme-hero,
  .archive-hero {
    max-width: 640px;
  }
  .tabbar {
    width: min(440px, calc(100vw - 48px));
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
}

/* editorial-v1：档案页导言 / 时间轴 / 事实清单 */
.archive-lead p { font-size: 1.02rem; line-height: 1.82; color: #2c2a26; }
.archive-fact-list ul, .archive-timeline ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.archive-fact-list li, .archive-timeline li { border-left: 2px solid #e2ddd3; padding-left: 12px; }
.archive-fact-list p { margin: 0 0 4px; line-height: 1.75; }
.archive-fact-list small { color: #8a8378; font-size: 0.78rem; }
.archive-fact-list a, .archive-timeline a { color: #6b6357; }
.archive-timeline li { display: grid; grid-template-columns: 66px 1fr; gap: 10px; align-items: start; }
.tl-year { font-variant-numeric: tabular-nums; font-weight: 600; color: #6b6357; }
.tl-text { line-height: 1.7; }
