/* =========================================================
   拾页 · 二手书市集
   ========================================================= */

:root {
  --paper: #f6f1e6;
  --paper-deep: #ece2cf;
  --card: #fffdf7;
  --ink: #221d17;
  --ink-2: #4b4237;
  --muted: #8a7f6e;
  --line: #e4d9c4;
  --line-soft: #efe7d8;
  --accent: #b3452c;
  --accent-deep: #8d2f1c;
  --green: #2f6b57;
  --gold: #b58a3c;
  --shadow-sm: 0 1px 2px rgba(52, 40, 24, .05), 0 4px 14px rgba(52, 40, 24, .06);
  --shadow-md: 0 2px 6px rgba(52, 40, 24, .07), 0 14px 30px rgba(52, 40, 24, .1);
  --radius: 16px;
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", ui-serif, Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --tabbar-h: 66px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: .01em;
  background-image:
    radial-gradient(circle at 12% 0%, rgba(179, 69, 44, .05), transparent 46%),
    radial-gradient(circle at 88% 4%, rgba(47, 107, 87, .05), transparent 42%);
  background-attachment: fixed;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, p { margin: 0; }
s { color: var(--muted); }

::selection { background: rgba(179, 69, 44, .18); }

/* ---------- 骨架 ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(246, 241, 230, .82);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid rgba(228, 217, 196, .7);
}
.topbar-in {
  max-width: 1180px; margin: 0 auto;
  height: 60px; padding: 0 16px;
  display: flex; align-items: center; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(145deg, var(--accent), var(--accent-deep));
  color: #fff8ec;
  display: grid; place-items: center;
  font-family: var(--font-serif); font-size: 17px; font-weight: 700;
  box-shadow: 0 3px 8px rgba(141, 47, 28, .28), inset 0 1px 0 rgba(255, 255, 255, .25);
  letter-spacing: -.04em;
}
.brand-name {
  font-family: var(--font-serif); font-size: 19px; font-weight: 700;
  letter-spacing: .14em; margin-right: -.14em;
}
.brand-sub { font-size: 10px; color: var(--muted); letter-spacing: .22em; margin-top: -3px; }

.topnav { display: none; gap: 4px; margin-left: 8px; }
.topnav a {
  padding: 7px 13px; border-radius: 999px; font-size: 14px; color: var(--ink-2);
  transition: background .18s, color .18s;
}
.topnav a:hover { background: rgba(255, 253, 247, .8); }
.topnav a.active { background: var(--ink); color: var(--paper); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: rgba(255, 253, 247, .7);
  color: var(--ink-2); transition: .18s;
}
.icon-btn:hover { background: var(--card); border-color: #d6c8ad; }
.icon-btn svg { width: 19px; height: 19px; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(145deg, #fdf6e8, #ece0c8);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-size: 18px; line-height: 1;
  overflow: hidden;
}
.avatar--sm { width: 30px; height: 30px; font-size: 15px; }
.avatar--lg { width: 62px; height: 62px; font-size: 30px; }

.view { flex: 1; width: 100%; padding-bottom: calc(var(--tabbar-h) + 26px + env(safe-area-inset-bottom)); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.page { animation: rise .34s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 首页 hero ---------- */
.hero { padding: 30px 0 8px; position: relative; }
.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(28px, 7.4vw, 46px);
  line-height: 1.22; font-weight: 700; letter-spacing: .01em;
}
.hero h1 em {
  font-style: normal; color: var(--accent);
  position: relative; white-space: nowrap;
}
.hero h1 em::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 7px;
  background: rgba(179, 69, 44, .16); border-radius: 50%;
  transform: rotate(-.6deg);
}
.hero-sub { margin-top: 12px; color: var(--ink-2); font-size: 14.5px; max-width: 30em; }
.hero-sub b { color: var(--accent-deep); font-weight: 600; }

.hero-search {
  margin-top: 20px; display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 6px 6px 18px;
  box-shadow: var(--shadow-sm);
  max-width: 620px;
  transition: border-color .2s, box-shadow .2s;
}
.hero-search:focus-within { border-color: #cbb795; box-shadow: 0 0 0 4px rgba(179, 69, 44, .07), var(--shadow-sm); }
.hero-search svg { width: 19px; height: 19px; color: var(--muted); flex-shrink: 0; }
.hero-search input {
  flex: 1; min-width: 0; border: 0; outline: none; background: none;
  font-size: 15px; padding: 6px 0;
}
.hero-search input::placeholder { color: #a99d89; }
.hero-search .btn { border-radius: 999px; padding: 9px 20px; }

.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.hero-tags button {
  font-size: 12.5px; color: var(--ink-2); padding: 5px 12px;
  border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 253, 247, .55);
  transition: .18s;
}
.hero-tags button:hover { border-color: #cbb795; background: var(--card); color: var(--accent-deep); }

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  margin: 26px 0 8px; background: var(--line-soft);
  border: 1px solid var(--line-soft); border-radius: 14px; overflow: hidden;
}
.stat { background: rgba(255, 253, 247, .55); padding: 14px 12px; text-align: center; }
.stat b {
  display: block; font-family: var(--font-serif); font-size: 21px;
  font-weight: 700; letter-spacing: .02em;
}
.stat span { font-size: 11.5px; color: var(--muted); letter-spacing: .08em; }

/* ---------- 区块 ---------- */
.section { margin-top: 30px; }
.section-head {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px;
}
.section-head h2 {
  font-family: var(--font-serif); font-size: 20px; font-weight: 700;
  letter-spacing: .04em; display: flex; align-items: center; gap: 8px;
}
.section-head h2::before {
  content: ""; width: 4px; height: 16px; border-radius: 2px;
  background: linear-gradient(var(--accent), var(--gold)); display: inline-block;
}
.section-head .more { margin-left: auto; font-size: 13px; color: var(--muted); }
.section-head .more:hover { color: var(--accent); }

/* ---------- 分类 ---------- */
.cats { display: flex; gap: 10px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 72px;
}
.cat i {
  width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center;
  background: var(--card); border: 1px solid var(--line); font-size: 22px; font-style: normal;
  box-shadow: var(--shadow-sm);
  transition: transform .2s, border-color .2s;
}
.cat:hover i { transform: translateY(-3px); border-color: #cbb795; }
.cat span { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }

/* ---------- 书卡 ---------- */
.grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 820px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1080px) { .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.book-card {
  position: relative; background: var(--card); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 10px 10px 12px;
  box-shadow: var(--shadow-sm);
  transition: transform .22s cubic-bezier(.2, .8, .3, 1), box-shadow .22s, border-color .22s;
  cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 9px;
  width: 100%;
}
.book-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: #ddcfb4; }
.book-card:active { transform: translateY(-1px) scale(.995); }

.cover {
  position: relative; aspect-ratio: 3 / 4.1; width: 100%;
  border-radius: 5px 9px 9px 5px;
  background:
    linear-gradient(155deg, var(--c1, #c96a4b) 0%, var(--c2, #8c2f22) 88%);
  box-shadow:
    inset -7px 0 14px rgba(0, 0, 0, .22),
    inset 0 0 0 1px rgba(255, 255, 255, .14),
    0 5px 14px rgba(52, 40, 24, .18);
  overflow: hidden;
  display: flex; flex-direction: column;
  color: #fdf7ea;
  isolation: isolate;
}
.cover::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 7px;
  background: linear-gradient(90deg, rgba(0, 0, 0, .3), rgba(0, 0, 0, .04));
  z-index: 2;
}
.cover::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .055) 0 1px, transparent 1px 3px),
    linear-gradient(200deg, rgba(255, 255, 255, .18), transparent 42%);
  mix-blend-mode: soft-light;
}
.cover-frame {
  position: relative; z-index: 2;
  flex: 1; display: flex; flex-direction: column;
  padding: 10px 9px 9px 14px;
  border: 1px solid rgba(253, 247, 234, .22);
  border-radius: 2px 6px 6px 2px;
  margin: 8px 8px 8px 10px;
  overflow: hidden;
}
.cover-cat {
  font-size: 8.5px; letter-spacing: .18em; opacity: .72;
  text-transform: uppercase; margin-bottom: auto;
}
.cover-title {
  font-family: var(--font-serif); font-weight: 700;
  font-size: var(--cover-title, 15px); line-height: 1.3;
  letter-spacing: .03em;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .18);
}
.cover-author {
  margin-top: 6px; font-size: 9px; opacity: .8; letter-spacing: .06em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.fav-btn {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(20, 14, 8, .18); color: #fdf7ea;
  backdrop-filter: blur(6px);
  font-size: 15px; line-height: 1;
  transition: transform .18s, background .18s;
}
.fav-btn:hover { transform: scale(1.08); background: rgba(20, 14, 8, .3); }
.fav-btn.on { color: #ffd9cf; background: rgba(141, 47, 28, .5); }

.bc-body { display: flex; flex-direction: column; gap: 3px; padding: 0 2px; }
.bc-title {
  font-size: 13.5px; font-weight: 600; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.bc-meta { font-size: 11.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.dot { width: 3px; height: 3px; border-radius: 50%; background: #c9bca5; flex-shrink: 0; }
.bc-price { display: flex; align-items: baseline; gap: 7px; margin-top: 2px; }
.bc-price b {
  font-family: var(--font-serif); font-size: 17px; color: var(--accent-deep); font-weight: 700;
  letter-spacing: -.02em;
}
.bc-price b i { font-size: 11px; font-style: normal; margin-right: 1px; }
.bc-price s { font-size: 11px; }
.bc-seller { font-size: 10.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.badge-sold {
  position: absolute; inset: 10px 10px auto; aspect-ratio: 3 / 4.1;
  border-radius: 6px; background: rgba(34, 29, 23, .55);
  display: grid; place-items: center; z-index: 4;
  color: #fff8ec; font-family: var(--font-serif); letter-spacing: .3em; font-size: 13px;
  backdrop-filter: blur(1.5px);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 20px; border-radius: 11px;
  font-size: 14.5px; font-weight: 600; letter-spacing: .02em;
  background: var(--ink); color: #fdf8ee;
  border: 1px solid transparent;
  transition: transform .16s, opacity .16s, background .16s, border-color .16s;
  white-space: nowrap;
}
.btn:hover { opacity: .92; }
.btn:active { transform: scale(.98); }
.btn--accent { background: linear-gradient(150deg, #bd4b31, var(--accent-deep)); box-shadow: 0 4px 12px rgba(141, 47, 28, .22); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--card); border-color: #cbb795; }
.btn--soft { background: rgba(179, 69, 44, .08); color: var(--accent-deep); }
.btn--block { width: 100%; }
.btn--sm { padding: 7px 13px; font-size: 12.5px; border-radius: 9px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ---------- 分类条 / 筛选 ---------- */
.filterbar {
  position: sticky; top: 60px; z-index: 30;
  background: rgba(246, 241, 230, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
  margin: 0 -16px; padding: 10px 16px;
}
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255, 253, 247, .6);
  font-size: 13px; color: var(--ink-2); transition: .18s;
}
.chip:hover { border-color: #cbb795; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.filters-row { display: flex; gap: 8px; align-items: center; margin-top: 9px; overflow-x: auto; scrollbar-width: none; }
.filters-row::-webkit-scrollbar { display: none; }
.select {
  appearance: none; border: 1px solid var(--line); background: rgba(255, 253, 247, .7);
  border-radius: 9px; padding: 6px 26px 6px 10px; font-size: 12.5px; color: var(--ink-2);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%238a7f6e' stroke-width='1.4' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 9px center;
}
.result-line { display: flex; align-items: center; gap: 8px; margin: 16px 0 12px; font-size: 13px; color: var(--muted); }
.result-line b { color: var(--ink); font-weight: 600; }

/* ---------- 详情 ---------- */
.back-row { display: flex; align-items: center; gap: 10px; padding: 16px 0 6px; }
.back-btn {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink-2);
  padding: 6px 12px 6px 8px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(255, 253, 247, .6);
}
.back-btn:hover { background: var(--card); }
.back-btn svg { width: 16px; height: 16px; }

.detail { display: grid; gap: 26px; padding: 10px 0 20px; }
@media (min-width: 860px) { .detail { grid-template-columns: 340px 1fr; gap: 44px; align-items: start; padding-top: 20px; } }

.detail-cover { display: flex; justify-content: center; }
.detail-cover .cover {
  width: min(280px, 62vw);
  --cover-title: 25px;
  border-radius: 6px 12px 12px 6px;
  box-shadow: inset -9px 0 18px rgba(0, 0, 0, .25), inset 0 0 0 1px rgba(255, 255, 255, .14), 0 18px 40px rgba(52, 40, 24, .26);
}
.detail-cover .cover-frame { padding: 18px 16px 16px 20px; margin: 12px 12px 12px 14px; }
.detail-cover .cover-cat { font-size: 10px; }
.detail-cover .cover-author { font-size: 12px; }

.detail-title { font-family: var(--font-serif); font-size: clamp(23px, 5.4vw, 32px); line-height: 1.3; font-weight: 700; }
.detail-author { margin-top: 8px; color: var(--ink-2); font-size: 14px; }
.detail-author span { color: var(--muted); }

.price-block {
  margin-top: 20px; padding: 16px 18px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(179, 69, 44, .07), rgba(181, 138, 60, .06));
  border: 1px solid rgba(179, 69, 44, .16);
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
}
.price-now { font-family: var(--font-serif); font-size: 34px; font-weight: 700; color: var(--accent-deep); line-height: 1; letter-spacing: -.03em; }
.price-now i { font-size: 16px; font-style: normal; margin-right: 2px; }
.price-was { font-size: 13px; color: var(--muted); margin-bottom: 3px; }
.price-off { margin-left: auto; font-size: 11.5px; color: var(--green); background: rgba(47, 107, 87, .09); padding: 3px 9px; border-radius: 999px; font-weight: 600; }

.tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.tag {
  font-size: 12px; padding: 4px 11px; border-radius: 999px;
  background: rgba(255, 253, 247, .8); border: 1px solid var(--line); color: var(--ink-2);
}
.tag--cond { background: rgba(47, 107, 87, .07); border-color: rgba(47, 107, 87, .2); color: var(--green); }

.meta-rows { margin-top: 22px; border-top: 1px solid var(--line-soft); }
.meta-row { display: flex; gap: 14px; padding: 11px 2px; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.meta-row dt { width: 62px; flex-shrink: 0; color: var(--muted); font-size: 13px; }
.meta-row dd { margin: 0; color: var(--ink-2); word-break: break-word; }

.desc-title { font-family: var(--font-serif); font-size: 16px; margin: 22px 0 8px; letter-spacing: .06em; }
.desc { font-size: 14px; color: var(--ink-2); line-height: 1.85; white-space: pre-wrap; }

.seller-card {
  display: flex; align-items: center; gap: 12px; margin-top: 22px;
  padding: 14px; border-radius: 14px; background: rgba(255, 253, 247, .75);
  border: 1px solid var(--line-soft);
}
.seller-card .who { flex: 1; min-width: 0; }
.seller-card .who b { font-size: 14px; display: block; }
.seller-card .who span { font-size: 12px; color: var(--muted); }
.seller-card .who p { font-size: 12px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.detail-actions {
  position: sticky; bottom: calc(var(--tabbar-h) + 8px + env(safe-area-inset-bottom));
  margin-top: 24px; display: flex; gap: 10px; z-index: 20;
  background: rgba(246, 241, 230, .9); backdrop-filter: blur(10px);
  padding: 10px 0; border-radius: 14px;
}
@media (min-width: 860px) {
  .detail-actions { position: static; bottom: auto; margin-top: 26px; }
}
.detail-actions .btn { flex: 1; }
.buy-hint { font-size: 12px; color: var(--muted); text-align: center; margin-top: 10px; }

/* ---------- 表单 ---------- */
.form-card {
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: 18px; padding: 20px 18px; box-shadow: var(--shadow-sm);
}
.form-grid { display: grid; gap: 15px; }
@media (min-width: 700px) { .form-grid--2 { grid-template-columns: 1fr 1fr; } .span-2 { grid-column: span 2; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; color: var(--muted); letter-spacing: .06em; }
.field > label b { color: var(--accent); font-weight: 400; }
.input, .textarea, .select-full {
  width: 100%; border: 1px solid var(--line); background: #fffef9;
  border-radius: 11px; padding: 11px 13px; font-size: 14.5px; outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.input:focus, .textarea:focus { border-color: #c9a98a; box-shadow: 0 0 0 3px rgba(179, 69, 44, .08); }
.textarea { min-height: 108px; resize: vertical; line-height: 1.7; }
.hint { font-size: 11.5px; color: var(--muted); }
.form-row { display: flex; gap: 10px; align-items: center; }

.palette-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.palette-dot {
  width: 34px; height: 34px; border-radius: 9px; border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
  transition: transform .16s;
}
.palette-dot.on { border-color: var(--ink); transform: scale(1.06); }

/* ---------- 认证 ---------- */
.auth-card {
  max-width: 400px; margin: 44px auto; background: var(--card);
  border: 1px solid var(--line-soft); border-radius: 20px;
  padding: 30px 24px; box-shadow: var(--shadow-md);
}
.auth-mark { display: flex; justify-content: center; margin-bottom: 18px; }
.auth-title { font-family: var(--font-serif); font-size: 24px; text-align: center; font-weight: 700; letter-spacing: .06em; }
.auth-sub { text-align: center; color: var(--muted); font-size: 13px; margin-top: 6px; }
.tabs { display: flex; gap: 4px; background: var(--line-soft); border-radius: 12px; padding: 4px; margin: 20px 0 18px; }
.tabs button { flex: 1; padding: 9px; border-radius: 9px; font-size: 13.5px; color: var(--muted); font-weight: 600; }
.tabs button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.auth-form { display: grid; gap: 12px; }
.demo-tip {
  margin-top: 16px; padding: 11px 13px; border-radius: 11px;
  background: rgba(181, 138, 60, .08); border: 1px dashed rgba(181, 138, 60, .35);
  font-size: 12.5px; color: #7d6427; line-height: 1.7;
}
.demo-tip button { color: var(--accent-deep); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 我的 ---------- */
.profile-hero {
  display: flex; align-items: center; gap: 16px;
  padding: 26px 0 20px;
}
.profile-hero .who { flex: 1; min-width: 0; }
.profile-hero h2 { font-family: var(--font-serif); font-size: 22px; font-weight: 700; }
.profile-hero p { font-size: 12.5px; color: var(--muted); }
.profile-stats { display: flex; gap: 22px; margin-top: 8px; }
.profile-stats div { font-size: 12px; color: var(--muted); }
.profile-stats b { display: block; font-family: var(--font-serif); font-size: 19px; color: var(--ink); }

.menu-list { border-radius: 16px; overflow: hidden; background: var(--card); border: 1px solid var(--line-soft); box-shadow: var(--shadow-sm); }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 14px 16px; text-align: left; font-size: 14px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .16s;
}
.menu-item:last-child { border-bottom: 0; }
.menu-item:hover { background: #faf5ea; }
.menu-item .mi { width: 26px; text-align: center; font-size: 16px; }
.menu-item .arrow { margin-left: auto; color: #c3b7a2; font-size: 15px; }
.menu-item .count { margin-left: auto; font-size: 12px; color: var(--muted); }
.menu-item .count + .arrow { margin-left: 8px; }

.order-card {
  background: var(--card); border: 1px solid var(--line-soft); border-radius: 15px;
  padding: 14px; display: flex; flex-direction: column; gap: 11px; box-shadow: var(--shadow-sm);
}
.order-head { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.order-head .pill {
  margin-left: auto; font-size: 11.5px; padding: 3px 9px; border-radius: 999px; font-weight: 600;
}
.pill--pending { background: rgba(181, 138, 60, .13); color: #8a6820; }
.pill--paid { background: rgba(47, 107, 87, .1); color: var(--green); }
.pill--shipped { background: rgba(60, 90, 150, .1); color: #3a5a96; }
.pill--completed { background: rgba(34, 29, 23, .08); color: var(--ink-2); }
.pill--cancelled { background: rgba(34, 29, 23, .06); color: #a09585; }
.order-body { display: flex; gap: 11px; align-items: center; }
.order-body .cover { width: 48px; flex-shrink: 0; aspect-ratio: 3 / 4.1; --cover-title: 5px; border-radius: 3px 5px 5px 3px; }
.order-body .cover .cover-frame { margin: 3px; padding: 3px; border: 0; }
.order-body .cover .cover-cat, .order-body .cover .cover-author { display: none; }
.order-body .info { flex: 1; min-width: 0; }
.order-body .info b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-body .info span { font-size: 11.5px; color: var(--muted); }
.order-body .price { font-family: var(--font-serif); font-size: 16px; color: var(--accent-deep); font-weight: 700; }
.order-foot { display: flex; gap: 8px; justify-content: flex-end; }
.order-foot .btn { flex: 0 0 auto; }

/* ---------- 消息 ---------- */
.convo-list { display: flex; flex-direction: column; gap: 10px; }
.convo {
  display: flex; gap: 12px; align-items: center; text-align: left;
  padding: 13px 14px; background: var(--card); border: 1px solid var(--line-soft);
  border-radius: 15px; box-shadow: var(--shadow-sm); width: 100%;
  transition: border-color .18s, transform .18s;
}
.convo:hover { border-color: #ddcfb4; transform: translateX(2px); }
.convo .body { flex: 1; min-width: 0; }
.convo .top { display: flex; align-items: baseline; gap: 8px; }
.convo .top b { font-size: 14px; }
.convo .top time { margin-left: auto; font-size: 11px; color: var(--muted); }
.convo .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo .preview { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread-dot {
  min-width: 18px; height: 18px; border-radius: 999px; background: var(--accent);
  color: #fff; font-size: 10.5px; display: grid; place-items: center; padding: 0 5px; font-weight: 600;
}

.chat { display: flex; flex-direction: column; height: calc(100dvh - 60px - 66px - env(safe-area-inset-bottom)); }
@media (min-width: 860px) { .chat { height: calc(100dvh - 60px - 40px); max-width: 760px; margin: 0 auto; } }
.chat-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.chat-head .who b { font-size: 14px; display: block; }
.chat-head .who span { font-size: 11.5px; color: var(--muted); }
.chat-book {
  font-size: 11.5px; color: var(--muted); padding: 6px 12px;
  background: rgba(181, 138, 60, .07); border-radius: 8px; margin: 10px 0 0;
  display: flex; align-items: center; gap: 6px;
}
.chat-body { flex: 1; overflow-y: auto; padding: 16px 0; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 76%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.6; position: relative; word-break: break-word; }
.msg--them { align-self: flex-start; background: var(--card); border: 1px solid var(--line-soft); border-bottom-left-radius: 5px; }
.msg--me { align-self: flex-end; background: linear-gradient(150deg, #b84a30, #97341f); color: #fff8ee; border-bottom-right-radius: 5px; box-shadow: 0 3px 10px rgba(141, 47, 28, .18); }
.msg time { display: block; font-size: 10px; opacity: .6; margin-top: 3px; text-align: right; }
.chat-input { display: flex; gap: 8px; padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-soft); background: var(--paper); }
.chat-input input {
  flex: 1; min-width: 0; border: 1px solid var(--line); background: #fffef9;
  border-radius: 999px; padding: 11px 16px; outline: none; font-size: 14.5px;
}
.chat-input input:focus { border-color: #c9a98a; }

/* ---------- 底部标签栏 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 253, 247, .94);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border-top: 1px solid var(--line);
  display: flex; align-items: stretch;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 10px; color: var(--muted); letter-spacing: .04em;
  padding-top: 8px; position: relative;
}
.tab svg { width: 22px; height: 22px; }
.tab.on { color: var(--accent-deep); }
.tab.on svg { stroke-width: 2.1; }
.tab-badge {
  position: absolute; top: 5px; left: 50%; margin-left: 6px;
  min-width: 15px; height: 15px; border-radius: 999px; background: var(--accent);
  color: #fff; font-size: 9.5px; display: grid; place-items: center; padding: 0 4px;
}
.tab--sell { flex: 0 0 62px; }
.tab--sell .plus {
  width: 42px; height: 42px; border-radius: 14px;
  background: linear-gradient(150deg, #bf4c32, var(--accent-deep));
  color: #fff8ec; display: grid; place-items: center;
  box-shadow: 0 5px 14px rgba(141, 47, 28, .3), inset 0 1px 0 rgba(255, 255, 255, .22);
  margin-top: -12px; transition: transform .18s;
}
.tab--sell:active .plus { transform: scale(.94); }
.tab--sell .plus svg { width: 22px; height: 22px; }
.tab--sell span { margin-top: 2px; }

@media (min-width: 860px) {
  .tabbar { display: none; }
  .topnav { display: flex; }
  .view { padding-bottom: 60px; }
}

/* ---------- 空状态 / 加载 ---------- */
.empty { text-align: center; padding: 54px 20px; color: var(--muted); }
.empty .em { font-size: 34px; opacity: .8; }
.empty p { margin-top: 10px; font-size: 13.5px; }
.empty .btn { margin-top: 16px; }

.skeleton { background: linear-gradient(90deg, #efe7d8 25%, #f7f1e4 37%, #efe7d8 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 10px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- 模态 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(30, 24, 16, .4); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .2s both;
}
@media (min-width: 640px) { .overlay { align-items: center; padding: 20px; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  background: var(--paper); width: 100%; max-width: 460px;
  border-radius: 20px 20px 0 0; padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  animation: sheetUp .3s cubic-bezier(.2, .85, .3, 1) both;
  max-height: 88dvh; overflow-y: auto;
}
@media (min-width: 640px) { .sheet { border-radius: 20px; padding-bottom: 22px; } }
@keyframes sheetUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h3 { font-family: var(--font-serif); font-size: 19px; margin-bottom: 4px; }
.sheet .sheet-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 16px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet-actions .btn { flex: 1; }
.sheet-close { position: absolute; right: 14px; top: 12px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px); z-index: 200;
  background: rgba(34, 29, 23, .92); color: #fdf8ee;
  padding: 10px 18px; border-radius: 999px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: .25s;
  max-width: 86vw; text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 860px) { .toast { bottom: 30px; } }

/* ---------- 杂项 ---------- */
.divider { height: 1px; background: var(--line-soft); margin: 20px 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.page-title { font-family: var(--font-serif); font-size: 24px; font-weight: 700; padding: 22px 0 4px; letter-spacing: .04em; }
.page-sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.link { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 交易须知 ---------- */
.help-list { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.help-list li { position: relative; padding-left: 18px; font-size: 13.5px; color: var(--ink-2); line-height: 1.7; }
.help-list li::before {
  content: ""; position: absolute; left: 4px; top: .62em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent); opacity: .55;
}
.help-list b { color: var(--ink); }
