:root {
  --paper: #f7f2e7;
  --paper-2: #fbf8f0;
  --ink: #2b2a26;
  --muted: #8a8377;
  --line: #e4dbc9;
  --seal: #b5442e;
  --seal-soft: #f3e3dd;
  --jade: #2f6b5a;
  --jade-soft: #e3ede8;
  --gold: #b98a3c;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(60, 48, 30, .06), 0 10px 30px rgba(60, 48, 30, .05);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 50% -10%, rgba(185, 138, 60, .10), transparent 70%),
    var(--paper);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 10px;
  background: linear-gradient(var(--paper) 70%, rgba(247, 242, 231, .86));
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: baseline; gap: 8px; flex: 1; min-width: 0; }
.brand .mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--seal); color: #fff8ec;
  font-family: var(--serif); font-size: 18px; font-weight: 700;
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 1.5px rgba(255, 248, 236, .55);
  flex: none;
}
.brand h1 {
  font-family: var(--serif); font-size: 18px; margin: 0; font-weight: 700; letter-spacing: .5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand .sub { font-size: 11px; color: var(--muted); letter-spacing: .5px; white-space: nowrap; }

.icon-btn {
  border: 1px solid var(--line); background: var(--paper-2); color: var(--ink);
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font-size: 16px; cursor: pointer; flex: none;
}

/* 页面 */
.page { padding: 4px 16px 20px; }
.page-title { font-family: var(--serif); font-size: 21px; margin: 10px 0 4px; }
.page-sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

/* 渠道横幅 */
.banner {
  display: flex; align-items: center; gap: 10px;
  background: var(--jade-soft); border: 1px solid #cfe0d8; color: #24574a;
  border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px;
}
.banner b { font-weight: 600; }

/* 分类筛选 */
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--paper-2); color: var(--muted);
  border-radius: 999px; padding: 5px 11px; font-size: 12.5px; cursor: pointer; transition: .15s;
}
.chip.active { background: var(--ink); border-color: var(--ink); color: #fdf9ef; }

.searchbar { display: flex; gap: 8px; margin-bottom: 12px; }
.searchbar input {
  flex: 1; border: 1px solid var(--line); background: var(--paper-2); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; color: var(--ink); outline: none;
}
.searchbar input:focus { border-color: var(--gold); }

/* 帖子卡片 */
.feed { display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; cursor: pointer; transition: transform .12s;
}
.card:active { transform: scale(.996); }
.card-main { padding: 14px; display: flex; gap: 12px; }
.card-cover {
  width: 86px; height: 86px; border-radius: 10px; flex: none; object-fit: cover;
  background: linear-gradient(135deg, #efe6d3, #e6dcc6); display: grid; place-items: center;
  font-size: 26px; color: #a99b82; overflow: hidden;
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { min-width: 0; flex: 1; }
.card-kicker { display: flex; gap: 6px; align-items: center; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.kind-tag { background: var(--jade-soft); color: #2a5f50; border-radius: 5px; padding: 1px 6px; font-size: 11px; }
.card-title { font-family: var(--serif); font-size: 16px; font-weight: 600; margin: 0 0 4px; line-height: 1.45; }
.card-desc {
  font-size: 13px; color: #6f685c; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin: 0;
}
.card-meta { margin-top: 8px; display: flex; gap: 10px; font-size: 11px; color: var(--muted); }
.card-foot {
  border-top: 1px dashed var(--line); padding: 7px 14px; display: flex; justify-content: space-between;
  font-size: 11px; color: var(--muted); background: rgba(255, 255, 255, .28);
}

/* 空态 */
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .big { font-size: 34px; margin-bottom: 8px; }
.empty p { font-size: 13px; margin: 4px 0; }

/* 按钮 */
.btn {
  border: none; border-radius: 10px; padding: 11px 18px; font-size: 15px; cursor: pointer;
  background: var(--ink); color: #fdf9ef; font-family: var(--sans); transition: .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.seal { background: var(--seal); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn.jade { background: var(--jade); }

/* 表单 */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: #5d574b; margin-bottom: 6px; font-weight: 600; }
.field .hint { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 6px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); background: var(--paper-2); border-radius: 10px;
  padding: 11px 12px; font-size: 15px; color: var(--ink); outline: none; font-family: var(--sans);
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.65; }
.field input:focus, .field textarea:focus { border-color: var(--gold); }
.counter { text-align: right; font-size: 11px; color: var(--muted); margin-top: 4px; }

.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cat-opt {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 8px; text-align: center;
  background: var(--paper-2); cursor: pointer; font-size: 13px;
}
.cat-opt .ico { font-size: 22px; display: block; margin-bottom: 4px; }
.cat-opt.active { border-color: var(--jade); background: var(--jade-soft); color: #235347; font-weight: 600; }

.photo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.photo-cell {
  position: relative; aspect-ratio: 1; border-radius: 9px; overflow: hidden;
  border: 1px dashed var(--line); background: var(--paper-2);
}
.photo-cell img { width: 100%; height: 100%; object-fit: cover; }
.photo-add { display: grid; place-items: center; color: var(--muted); font-size: 22px; cursor: pointer; border-style: dashed; }
.photo-del {
  position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff; border: none; font-size: 12px; display: grid; place-items: center; cursor: pointer;
}

/* 详情 */
.detail-hero { margin: 0 -16px; }
.detail-hero .imgs { display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 0 16px; }
.detail-hero img { width: 82%; border-radius: 12px; scroll-snap-align: center; flex: none; }
.detail-title { font-family: var(--serif); font-size: 23px; line-height: 1.4; margin: 16px 0 8px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.detail-content { font-size: 16px; line-height: 1.85; white-space: pre-wrap; word-break: break-word; }
.detail-note {
  margin-top: 16px; padding: 12px; border-left: 3px solid var(--gold); background: #f6efdf;
  border-radius: 6px; font-size: 13px; color: #6a5a3d;
}
.author { display: flex; align-items: center; gap: 10px; margin: 18px 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2); }
.avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--jade-soft); display: grid; place-items: center; color: var(--jade); font-family: var(--serif); }
.verified { color: var(--jade); font-size: 11px; border: 1px solid #cfe0d8; background: var(--jade-soft); border-radius: 4px; padding: 1px 5px; }
.unverified { color: var(--muted); font-size: 11px; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }

.actions { display: flex; gap: 10px; margin-top: 18px; }
.actions .btn { flex: 1; }

/* 我的 */
.profile { display: flex; align-items: center; gap: 14px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.profile .avatar-lg { width: 56px; height: 56px; border-radius: 50%; background: var(--jade-soft); color: var(--jade); display: grid; place-items: center; font-family: var(--serif); font-size: 24px; }
.profile h2 { font-family: var(--serif); font-size: 19px; margin: 0 0 2px; }
.profile .meta { font-size: 12px; color: var(--muted); }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.stat { background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; }
.stat b { display: block; font-family: var(--serif); font-size: 20px; }
.stat span { font-size: 11px; color: var(--muted); }

.list-group { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--paper-2); margin-top: 14px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.list-item:last-child { border-bottom: none; }
.list-item .ico { width: 26px; text-align: center; }
.list-item .grow { flex: 1; }
.list-item .arrow { color: #bdb3a0; }

.status-chip { font-size: 11px; padding: 2px 7px; border-radius: 5px; }
.s-pending { background: #f6ecd3; color: #8a6a1f; }
.s-approved { background: var(--jade-soft); color: #2a5f50; }
.s-rejected { background: var(--seal-soft); color: #9b3a27; }
.s-offline { background: #ececec; color: #777; }

/* 标签栏 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around; align-items: center;
  max-width: 560px; margin: 0 auto;
  background: rgba(251, 248, 240, .94); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding: 8px 0 calc(6px + env(safe-area-inset-bottom));
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 11px; color: var(--muted); cursor: pointer; background: none; border: none; flex: 1; padding: 2px 0; font-family: var(--sans); }
.tab .ti { font-size: 19px; line-height: 1.2; }
.tab.active { color: var(--ink); font-weight: 600; }
.tab.pub .ti { width: 40px; height: 40px; border-radius: 50%; background: var(--seal); color: #fff8ec; display: grid; place-items: center; margin-top: -18px; box-shadow: 0 6px 14px rgba(181, 68, 46, .28); }

/* 弹层 */
.modal-mask { position: fixed; inset: 0; background: rgba(35, 30, 22, .45); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.modal {
  background: var(--paper-2); width: 100%; max-width: 560px; border-radius: 18px 18px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); max-height: 82vh; overflow-y: auto;
  animation: up .18s ease-out;
}
@keyframes up { from { transform: translateY(20px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal h3 { font-family: var(--serif); margin: 0 0 10px; font-size: 18px; }
.modal p { font-size: 14px; color: #5d574b; }
.modal .close { float: right; border: none; background: none; font-size: 20px; color: var(--muted); cursor: pointer; }
.copy-box { background: #f4eddd; border: 1px dashed var(--line); border-radius: 10px; padding: 12px; font-size: 13px; white-space: pre-wrap; line-height: 1.7; color: #4d463a; }

/* 登录 */
.auth-wrap { padding: 28px 22px; }
.auth-logo { text-align: center; margin-bottom: 22px; }
.auth-logo .mark { width: 54px; height: 54px; font-size: 30px; margin: 0 auto 10px; border-radius: 14px; }
.auth-logo h1 { font-family: var(--serif); font-size: 25px; margin: 0; }
.auth-logo p { color: var(--muted); font-size: 12px; letter-spacing: 1px; margin: 4px 0 0; }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }
.code-row .btn { flex: none; min-width: 108px; }
.dev-hint { font-size: 12px; color: var(--seal); background: var(--seal-soft); border-radius: 8px; padding: 8px 10px; margin-bottom: 12px; }
.agree { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; margin: 14px 0; }
.agree input { margin-top: 3px; }
.agree a { color: var(--jade); text-decoration: none; }
.divider { display: flex; align-items: center; gap: 10px; color: #bdb3a0; font-size: 12px; margin: 20px 0; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%);
  background: rgba(43, 42, 38, .92); color: #fdf9ef; padding: 9px 16px; border-radius: 20px;
  font-size: 13px; z-index: 99; opacity: 0; pointer-events: none; transition: .2s; max-width: 80vw; text-align: center;
}
#toast.show { opacity: 1; }

.loading { text-align: center; color: var(--muted); font-size: 13px; padding: 30px 0; }
.skeleton { height: 96px; border-radius: 14px; background: linear-gradient(90deg, #efe8da 25%, #f7f2e7 37%, #efe8da 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; margin-bottom: 12px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

@media (min-width: 561px) {
  body { background: #efe9dd; }
  #app { background: var(--paper); box-shadow: 0 0 40px rgba(60, 48, 30, .12); min-height: 100vh; }
  .tabbar { box-shadow: 0 -4px 20px rgba(60, 48, 30, .06); }
}
