/* ============================================================
   盛禾社区 · H5 样式（移动端优先，桌面端居中列布局）
   ============================================================ */

:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --card-2: #f7f8fa;
  --text: #252933;
  --text-2: #7b818c;
  --text-3: #a9b0ba;
  --border: #e5e9ef;
  --accent: #ff7a45;
  --accent-deep: #f0662e;
  --accent-2: #ff4d94;
  --danger: #f53f3f;
  --ok: #00b578;
  --gold: #f7b500;
  --shadow: 0 1px 2px rgba(20, 30, 50, .04), 0 4px 16px rgba(20, 30, 50, .05);
  --shadow-lg: 0 8px 32px rgba(20, 30, 50, .14);
  --r: 14px;
  --blur: saturate(1.4) blur(14px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 58px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #121417;
  --card: #1b1e24;
  --card-2: #22262d;
  --text: #e8eaed;
  --text-2: #8f96a1;
  --text-3: #5c6470;
  --border: #2a2f38;
  --accent: #ff8f63;
  --accent-deep: #f2762f;
  --accent-2: #ff6ea9;
  --shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior-y: none;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
::selection { background: rgba(255, 122, 69, .25); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- 整体布局：手机全宽，桌面居中列 ---------- */
#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
}

.view {
  flex: 1;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
}
.view.no-tabbar { padding-bottom: calc(72px + var(--safe-b)); }

@media (min-width: 600px) {
  body {
    background:
      radial-gradient(600px 400px at 12% -5%, rgba(255, 122, 69, .15), transparent 60%),
      radial-gradient(700px 500px at 90% 15%, rgba(255, 77, 148, .12), transparent 60%),
      radial-gradient(500px 400px at 50% 110%, rgba(0, 181, 120, .08), transparent 60%),
      #0d1017;
  }
  [data-theme="light"] body { background-color: #e8edf3; }
  #app {
    box-shadow: var(--shadow-lg);
    min-height: 100dvh;
  }
  .topbar, .tabbar, .action-bar {
    left: 50% !important;
    transform: translateX(-50%);
    width: 100%;
    max-width: 520px;
  }
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border);
}

.topbar .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: .5px;
  cursor: pointer;
  user-select: none;
}
.topbar .logo .logo-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 15px;
  box-shadow: 0 2px 8px rgba(255, 118, 69, .4);
}
.topbar .logo em {
  font-style: normal;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.topbar .spacer { flex: 1; }

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: var(--text-2);
  transition: background .15s, color .15s, transform .1s;
}
.icon-btn:active { transform: scale(.9); background: var(--card-2); }
.icon-btn svg { width: 21px; height: 21px; }

.topbar .search-pill {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 17px;
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text-3);
  font-size: 13px;
  cursor: pointer;
  min-width: 0;
}
.topbar .search-pill svg { width: 15px; height: 15px; flex: none; }
.topbar .search-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 40;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-top: 1px solid var(--border);
}
.tabbar.hidden { display: none; }

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10.5px;
  color: var(--text-3);
  position: relative;
  transition: color .15s;
  -webkit-user-select: none; user-select: none;
}
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--accent); font-weight: 600; }
.tab:active svg { transform: scale(.88); }
.tab .tab-badge {
  position: absolute;
  top: 6px; left: calc(50% + 4px);
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  font-weight: 600;
}
.tab .tab-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 12px;
}

.tab-fab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tab-fab button {
  width: 40px; height: 40px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 10px rgba(255, 118, 69, .35);
  transition: transform .15s;
}
.tab-fab button:active { transform: scale(.9) rotate(-4deg); }
.tab-fab svg { width: 22px; height: 22px; }

/* ---------- 通用组件 ---------- */
.avatar {
  width: 38px; height: 38px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  background:
    linear-gradient(135deg, hsl(var(--h, 210) 78% 60%), hsl(calc(var(--h, 210) + 45) 80% 50%));
  -webkit-user-select: none; user-select: none;
}
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; font-size: 22px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 3px 10px rgba(255, 118, 69, .32);
  transition: transform .12s, opacity .15s;
  -webkit-user-select: none; user-select: none;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn.ghost {
  background: none;
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.btn.plain {
  background: var(--card-2);
  color: var(--text-2);
  box-shadow: inset 0 0 0 1px var(--border);
}
.btn.danger { background: var(--danger); box-shadow: none; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }

.chip {
  flex: none;
  height: 30px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  border-radius: 15px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  -webkit-user-select: none; user-select: none;
}
.chip.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(255, 118, 69, .32);
}
.chip-row {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }

.tag-link {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
}

/* 区块标题 */
.sec-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 14px 10px;
  font-size: 16px;
  font-weight: 800;
}
.sec-title .line {
  width: 4px; height: 16px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
.sec-title .more {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-3);
  cursor: pointer;
}

/* ---------- 卡片信息流 ---------- */
.post-card {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  margin: 0 12px 12px;
  overflow: hidden;
  cursor: pointer;
  animation: cardIn .35s both;
  animation-delay: calc(var(--i, 0) * 45ms);
  transition: transform .12s;
}
.post-card:active { transform: scale(.985); }

.post-card .cover {
  height: 92px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg,
    hsl(var(--h, 210) 80% 62%), hsl(calc(var(--h, 210) + 45) 85% 52%));
}
.post-card .cover::before {
  content: attr(data-ch);
  position: absolute;
  right: -6px; bottom: -26px;
  font-size: 84px;
  font-weight: 800;
  color: rgba(255, 255, 255, .16);
  line-height: 1;
}
.post-card .cover::after {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .14) 1px, transparent 1.6px);
  background-size: 18px 18px;
  mask-image: linear-gradient(180deg, transparent, #000);
}
.post-card .cover .cover-tags {
  position: absolute;
  left: 10px; bottom: 8px;
  display: flex;
  gap: 6px;
}
.post-card .cover .cover-tags span {
  font-size: 11px;
  color: #fff;
  background: rgba(0, 0, 0, .22);
  backdrop-filter: blur(4px);
  padding: 2px 8px;
  border-radius: 10px;
}

.post-card .body { padding: 12px 14px 10px; }
.post-card h3 {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card .excerpt {
  margin-top: 5px;
  font-size: 13px;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card .meta {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
}
.post-card .meta .author-name { color: var(--text-2); font-weight: 500; cursor: pointer; }
.post-card .meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); flex: none; }
.post-card .meta .grow { flex: 1; }
.post-card .meta .m { display: flex; align-items: center; gap: 3px; }
.post-card .meta svg { width: 14px; height: 14px; }

/* 骨架屏 */
.skel { margin: 0 12px 12px; border-radius: var(--r); background: var(--card); box-shadow: var(--shadow); padding: 14px; }
.skel .bar {
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--card-2) 25%, var(--border) 45%, var(--card-2) 65%);
  background-size: 300% 100%;
  animation: shimmer 1.2s infinite linear;
}
.skel .bar + .bar { margin-top: 10px; }
.skel .bar.w60 { width: 60%; }
.skel .bar.w90 { width: 90%; }

/* 空状态 */
.empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-3);
}
.empty .emoji { font-size: 44px; display: block; margin-bottom: 10px; }
.empty p { font-size: 14px; }

/* ---------- 首页 tab 分段器 ---------- */
.segment {
  display: flex;
  gap: 20px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  position: sticky;
  z-index: 30;
  top: 54px;
}
.segment .seg {
  padding: 11px 2px 9px;
  font-size: 15px;
  color: var(--text-2);
  position: relative;
  cursor: pointer;
  -webkit-user-select: none; user-select: none;
}
.segment .seg.active { color: var(--text); font-weight: 700; }
.segment .seg.active::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 0;
  transform: translateX(-50%);
  width: 22px; height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.chip-row.sticky-chips {
  position: sticky;
  z-index: 30;
  top: calc(54px + 41px);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

/* ---------- 文章详情 ---------- */
.post-detail { padding-bottom: 0; }
.detail-hero {
  height: 148px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg,
    hsl(var(--h, 210) 80% 62%), hsl(calc(var(--h, 210) + 45) 85% 50%));
}
.detail-hero::before {
  content: attr(data-ch);
  position: absolute;
  right: -10px; bottom: -40px;
  font-size: 140px;
  font-weight: 800;
  color: rgba(255, 255, 255, .15);
  line-height: 1;
}
.detail-hero::after {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .16) 1px, transparent 1.6px);
  background-size: 20px 20px;
  mask-image: linear-gradient(180deg, transparent 20%, #000);
}

.detail-body {
  background: var(--card);
  border-radius: 20px 20px 0 0;
  margin-top: -22px;
  position: relative;
  padding: 20px 16px 16px;
}
.detail-body h1 { font-size: 22px; line-height: 1.4; font-weight: 800; }
.detail-body .tags { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }

.author-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  padding: 12px;
  border-radius: 12px;
  background: var(--card-2);
  cursor: pointer;
}
.author-row .info { flex: 1; min-width: 0; }
.author-row .name { font-weight: 700; font-size: 14.5px; }
.author-row .bio {
  font-size: 12px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.author-row .time { margin-left: auto; flex: none; font-size: 11px; color: var(--text-3); }

/* Markdown 正文 */
.md {
  font-size: 15.5px;
  line-height: 1.85;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.md p { margin: 12px 0; }
.md h2, .md h3, .md h4 { margin: 22px 0 10px; font-weight: 800; }
.md h2 { font-size: 18.5px; padding-left: 10px; border-left: 4px solid var(--accent); }
.md h3 { font-size: 16.5px; }
.md h4 { font-size: 15px; color: var(--text-2); }
.md ul, .md ol { padding-left: 22px; margin: 10px 0; }
.md li { margin: 5px 0; }
.md blockquote {
  margin: 14px 0;
  padding: 10px 14px;
  border-left: 4px solid var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 8%, transparent);
  border-radius: 0 10px 10px 0;
  color: var(--text-2);
  font-size: 14.5px;
}
.md blockquote p { margin: 2px 0; }
.md code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: .86em;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 5px;
}
.md pre {
  margin: 14px 0;
  padding: 14px;
  border-radius: 12px;
  background: #0d1117;
  color: #dbe4f0;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.65;
  border: 1px solid rgba(255, 255, 255, .08);
}
[data-theme="dark"] .md pre { border-color: var(--border); }
.md pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.md pre { position: relative; }
.md pre[data-lang]:not([data-lang=""])::before {
  content: attr(data-lang);
  position: absolute;
  top: 8px; right: 12px;
  font-size: 10.5px;
  color: #7d8ca3;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.md a { color: var(--accent); border-bottom: 1px dashed color-mix(in srgb, var(--accent) 50%, transparent); }
.md hr { border: 0; height: 1px; background: var(--border); margin: 20px 0; }
.md strong { font-weight: 700; }

/* 详情底部操作栏 + 评论输入 */
.detail-fixed {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 45;
  padding: 10px 12px calc(10px + var(--safe-b));
  background: color-mix(in srgb, var(--card) 90%, transparent);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-fixed .act {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 8px;
  height: 38px;
  border-radius: 12px;
  color: var(--text-2);
  font-size: 13px;
  flex: 1;
  transition: color .15s, transform .1s;
}
.detail-fixed .act:active { transform: scale(.88); }
.detail-fixed .act svg { width: 21px; height: 21px; }
.detail-fixed .act.on.heart { color: var(--danger); }
.detail-fixed .act.on.star { color: var(--gold); }
.detail-fixed .act.pop svg { animation: pop .4s ease; }
/* ---------- 个人主页 ---------- */
.profile {
  padding: 22px 16px 18px;
  background:
    radial-gradient(400px 160px at 85% -20%, color-mix(in srgb, var(--accent-2) 22%, transparent), transparent 70%),
    radial-gradient(360px 180px at 10% -20%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 70%),
    var(--card);
  border-radius: 0 0 22px 22px;
  box-shadow: var(--shadow);
}
.profile .row1 { display: flex; align-items: center; gap: 14px; }
.profile .p-name { font-size: 19px; font-weight: 800; }
.profile .p-bio { margin-top: 3px; font-size: 13px; color: var(--text-2); }
.profile .p-edit { margin-left: auto; flex: none; }
.profile .stats {
  margin-top: 16px;
  display: flex;
  text-align: center;
}
.profile .stats div { flex: 1; cursor: default; }
.profile .stats b { display: block; font-size: 17px; }
.profile .stats span { font-size: 11.5px; color: var(--text-3); }

.me-tabs { display: flex; gap: 8px; padding: 14px; }
.me-tabs .chip { flex: 1; justify-content: center; }

/* ---------- 热榜 ---------- */
.rank-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  margin: 0 12px 10px;
  padding: 14px;
  cursor: pointer;
  animation: cardIn .35s both;
  animation-delay: calc(var(--i, 0) * 35ms);
}
.rank-card .rank {
  flex: none;
  width: 26px;
  font-size: 17px;
  font-weight: 900;
  font-style: italic;
  color: var(--text-3);
  text-align: center;
}
.rank-card:nth-child(1) .rank { color: var(--gold); }
.rank-card:nth-child(2) .rank { color: #9aa7b8; }
.rank-card:nth-child(3) .rank { color: #c98a5e; }
.rank-card .r-main { flex: 1; min-width: 0; }
.rank-card h4 {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rank-card .r-meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 10px;
}
.rank-card .heat {
  color: #ff742e;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 3px;
}
.rank-card .heat svg { width: 13px; height: 13px; }

/* ---------- 消息 ---------- */
.notif-row {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  align-items: flex-start;
}
.notif-row.unread { background: color-mix(in srgb, var(--accent) 5%, var(--card)); }
.notif-row .n-ico {
  flex: none;
  width: 38px; height: 38px;
  border-radius: 12px;
  display: grid; place-items: center;
}
.notif-row .n-ico svg { width: 19px; height: 19px; }
.notif-row[data-type="like"] .n-ico { background: rgba(245, 63, 63, .12); color: var(--danger); }
.notif-row[data-type="comment"] .n-ico { background: rgba(30, 128, 255, .12); color: var(--accent); }
.notif-row[data-type="follow"] .n-ico { background: rgba(0, 181, 120, .12); color: var(--ok); }
.notif-row .n-main { flex: 1; min-width: 0; font-size: 14px; }
.notif-row .n-main b { font-weight: 700; }
.notif-row .n-sub {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}
.notif-row .n-dot {
  flex: none;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  margin-top: 8px;
}

/* ---------- 发布页 ---------- */
.compose { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.compose .field {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 4px 0;
}
.compose input, .compose textarea {
  width: 100%;
  border: 0;
  background: none;
  padding: 12px 14px;
  font-size: 16px;
}
.compose input { font-weight: 700; }
.compose textarea {
  min-height: 46dvh;
  resize: vertical;
  line-height: 1.7;
  font-size: 15px;
}
.compose input:focus, .compose textarea:focus { outline: none; }
.compose input::placeholder, .compose textarea::placeholder { color: var(--text-3); }
.compose .hint {
  padding: 0 16px 12px;
  font-size: 11.5px;
  color: var(--text-3);
}
.compose .toolbar {
  display: flex;
  gap: 4px;
  padding: 6px 10px;
  border-top: 1px dashed var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.compose .toolbar button {
  flex: none;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--text-2);
  background: var(--card-2);
}
.compose .toolbar button:active { background: var(--border); }
.compose .cover-pick { display: flex; align-items: center; gap: 8px; padding: 0 2px; font-size: 12.5px; color: var(--text-2); }
.compose .hue-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, hsl(var(--h) 80% 60%), hsl(calc(var(--h) + 45) 85% 50%));
  cursor: pointer;
  border: 2px solid var(--card);
  box-shadow: var(--shadow);
}

/* ---------- 搜索页 ---------- */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 30;
}
.search-box input {
  flex: 1;
  height: 38px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 19px;
  padding: 0 16px;
  font-size: 14px;
}
.search-box input:focus { outline: none; border-color: var(--accent); }
.hot-words { padding: 6px 14px 16px; }

/* ---------- 弹层 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(10, 14, 22, .45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn .2s both;
}
.overlay.center { align-items: center; padding: 24px; }
.sheet {
  width: 100%;
  max-width: 520px;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 10px 18px calc(22px + var(--safe-b));
  animation: slideUp .28s cubic-bezier(.2, .9, .3, 1) both;
}
.overlay.center .sheet { border-radius: 18px; animation: popIn .22s cubic-bezier(.2, .9, .3, 1) both; }
.sheet .grabber {
  width: 38px; height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 4px auto 14px;
}
.sheet h3 { font-size: 18px; text-align: center; margin-bottom: 16px; }
.sheet .x {
  position: absolute;
  right: 14px; top: 16px;
}
.sheet { position: relative; }

.auth-tabs { display: flex; background: var(--card-2); border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.auth-tabs button {
  flex: 1;
  height: 32px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text-2);
}
.auth-tabs button.on { background: var(--card); color: var(--text); font-weight: 700; box-shadow: var(--shadow); }

.field-wrap { display: flex; flex-direction: column; gap: 10px; }
.field-wrap input {
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-2);
  padding: 0 14px;
  font-size: 15px;
}
.field-wrap input:focus { outline: none; border-color: var(--accent); }
.form-err { font-size: 12.5px; color: var(--danger); min-height: 18px; }
.demo-tip {
  margin-top: 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-3);
}
.demo-tip b { color: var(--accent); cursor: pointer; }

/* ---------- Toast / 下拉刷新 ---------- */
#toast-root {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 24px);
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  max-width: 78%;
  background: rgba(28, 32, 40, .92);
  color: #fff;
  font-size: 13.5px;
  padding: 9px 16px;
  border-radius: 20px;
  animation: toastIn .25s cubic-bezier(.2, .9, .3, 1) both;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.toast.out { animation: toastOut .25s both; }

.ptr {
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: height .2s;
}
.ptr .spin {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.ptr.active { height: 44px; }

/* ---------- 动画 ---------- */
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(60%); opacity: .5; } to { transform: none; opacity: 1; } }
@keyframes popIn { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -150% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop {
  0% { transform: scale(1); } 35% { transform: scale(1.45); } 70% { transform: scale(.85); } 100% { transform: scale(1); }
}
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.94); } }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.page-anim { animation: pageIn .25s ease both; }

/* ---------- 杂项 ---------- */
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-3); font-size: 12px; }
.loading-end {
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  padding: 14px 0 4px;
}
.stat-hero {
  margin: 12px;
  padding: 14px 16px;
  border-radius: var(--r);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 6px 20px rgba(255, 118, 69, .32);
  display: flex;
}
.stat-hero div { flex: 1; text-align: center; }
.stat-hero b { display: block; font-size: 18px; font-weight: 800; }
.stat-hero span { font-size: 11.5px; opacity: .85; }

/* 备案号：每个页面内容末尾，居中显示（自留避让底部导航的空间） */
.icp-bar {
  display: block;
  text-align: center;
  color: var(--text-2);
  font-size: 12px;
  letter-spacing: .3px;
  padding: 48px 12px calc(var(--tabbar-h) + var(--safe-b) + 16px);
  text-decoration: none;
}
body:has(#tabbar.hidden) .icp-bar { padding-bottom: calc(88px + var(--safe-b) + 8px); }
.icp-bar:active { color: var(--accent); }

/* ================= 商城 / 商家 ================= */
.prod-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px 12px 0;
}
.prod-card {
  background: var(--card);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .05);
  cursor: pointer;
  animation: cardIn .35s both;
  animation-delay: calc(var(--i, 0) * .03s);
}
.prod-card:active { transform: scale(.98); }
.p-cover {
  position: relative;
  aspect-ratio: 1 / .82;
  background: linear-gradient(135deg,
    hsl(var(--h, 210) 80% 62%), hsl(calc(var(--h, 210) + 45) 85% 50%));
  overflow: hidden;
}
.p-cover::before {
  content: attr(data-ch);
  position: absolute;
  right: -6px; bottom: -22px;
  font-size: 72px;
  font-weight: 800;
  color: rgba(255, 255, 255, .18);
  line-height: 1;
}
.p-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.off-badge {
  position: absolute;
  top: 8px; right: 8px;
  z-index: 1;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 10.5px;
  padding: 3px 7px;
  border-radius: 6px;
}
.prod-card .p-body { padding: 9px 10px 10px; }
.prod-card h4 {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 36px;
}
.p-price { margin-top: 5px; color: var(--accent); font-weight: 800; font-size: 17px; }
.p-price i { font-style: normal; font-size: 12px; margin-right: 1px; }
.p-meta { display: flex; align-items: center; margin-top: 6px; font-size: 11px; color: var(--text-3); }
.p-shop {
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.p-shop:active { color: var(--accent); }
.p-wants { display: inline-flex; align-items: center; gap: 2px; }
.p-wants svg { width: 11px; height: 11px; }
.grow { flex: 1; }
.btn svg { width: 16px; height: 16px; flex: none; }

/* 商品详情 */
.p-hero { height: 230px; }
.mall-shop-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 24px);
  margin: 0 12px 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--accent) 14%, var(--card)),
    color-mix(in srgb, var(--accent-2) 12%, var(--card)));
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.mall-shop-entry:active { transform: scale(.98); }
.mall-shop-entry .mse-ico {
  width: 34px; height: 34px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}
.mall-shop-entry .mse-ico svg { width: 17px; height: 17px; }
.mall-shop-entry .mse-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mall-shop-entry .mse-main b { font-size: 13.5px; font-weight: 700; }
.mall-shop-entry .mse-main span { font-size: 11.5px; color: var(--text-3); }
.mall-shop-entry .mse-arrow { color: var(--text-3); font-size: 18px; flex: none; }
.d-price { display: flex; align-items: baseline; color: var(--accent); margin-top: 8px; }
.d-price b { font-size: 26px; font-weight: 800; }
.tag-link {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 20px;
}
.p-detail {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 14.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}
.want-btn.wanted { background: var(--danger); }
.want-btn.pop svg { animation: pop .4s ease; }

/* 店铺主页 / 商家中心 */
.shop-head {
  position: relative;
  overflow: hidden;
  padding: 22px 16px 16px;
  color: #fff;
  background: linear-gradient(135deg,
    hsl(var(--h, 210) 80% 60%), hsl(calc(var(--h, 210) + 45) 85% 48%));
}
.shop-head::after {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .14) 1px, transparent 1.6px);
  background-size: 20px 20px;
  pointer-events: none;
}
.shop-logo {
  width: 52px; height: 52px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .22);
  border-radius: 14px;
  font-size: 24px;
  font-weight: 800;
  color: #fff;
}
.s-stats { display: flex; gap: 14px; margin-top: 14px; font-size: 12px; opacity: .92; position: relative; z-index: 1; }
.shop-notice {
  margin: 12px 12px 0;
  padding: 11px 13px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--gold, #f5a623) 12%, var(--card));
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.shop-card {
  margin: 12px 12px 0;
  background: var(--card);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .05);
}
.shop-card .stats { display: flex; margin-top: 12px; text-align: center; }
.shop-card .stats div { flex: 1; }
.shop-card .stats b { display: block; font-size: 17px; }
.shop-card .stats span { font-size: 11.5px; color: var(--text-3); }

.status-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  vertical-align: middle;
}
.status-badge.pending { background: rgba(245, 166, 35, .14); color: #d48806; }
.status-badge.approved { background: rgba(0, 181, 120, .13); color: var(--ok); }
.status-badge.rejected { background: rgba(245, 63, 63, .12); color: var(--danger); }
.status-badge.off { background: rgba(120, 120, 130, .14); color: var(--text-3); }

/* 我的页服务入口 */
.me-links {
  margin: 12px 12px 0;
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .05);
}
.me-links .link-row {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 13px 14px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.me-links .link-row:last-child { border-bottom: 0; }
.me-links .link-row:active { background: var(--bg); }
.me-links .link-row::after { content: "›"; margin-left: auto; color: var(--text-3); font-size: 17px; }
.me-links .l-ico {
  width: 30px; height: 30px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  color: var(--accent);
}
.me-links .l-ico svg { width: 16px; height: 16px; }

/* 商品管理行（商家中心 / 管理员审核） */
.mng-row {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 12px 10px;
  padding: 11px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .05);
  cursor: pointer;
}
.mng-thumb {
  width: 52px; height: 52px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(135deg,
    hsl(var(--h, 210) 80% 62%), hsl(calc(var(--h, 210) + 45) 85% 50%));
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  position: relative;
}
.mng-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mng-main { flex: 1; min-width: 0; }
.mng-title {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mng-sub { margin-top: 4px; font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mng-ops { display: flex; align-items: center; gap: 6px; flex: none; }
.st-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 12px;
  margin-right: 4px;
}
.st-chip.on { background: rgba(0, 181, 120, .13); color: var(--ok); }
.st-chip.off { background: rgba(120, 120, 130, .14); color: var(--text-3); }

/* 通知：商城类新类型着色 */
.notif-row[data-type="want"] .n-ico { background: rgba(245, 63, 63, .12); color: var(--danger); }
.notif-row[data-type="shop_ok"] .n-ico { background: rgba(0, 181, 120, .13); color: var(--ok); }
.notif-row[data-type="shop_no"] .n-ico { background: rgba(245, 63, 63, .12); color: var(--danger); }

/* 6 格 tabbar 窄屏缩一档 */
@media (max-width: 359px) {
  .tab { font-size: 9.5px; gap: 2px; }
  .tab svg { width: 20px; height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- 购物车 / 订单 / 入驻主体 ---------- */
/* 商城页：搜索框 + 购物车入口 */
.mall-search-row { display: flex; align-items: center; gap: 8px; margin: 10px 12px 8px; }
.mall-search-row .search-box { flex: 1; margin: 0; }
.cart-entry {
  position: relative; width: 40px; height: 40px; flex: none;
  border-radius: 12px; background: var(--card); box-shadow: var(--shadow);
  display: grid; place-items: center; color: var(--text); border: none;
}
.cart-entry svg { width: 20px; height: 20px; }
.cart-entry:active { transform: scale(.94); }
.cart-badge {
  position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px;
  border-radius: 8px; background: var(--accent); color: #fff;
  font-size: 10px; line-height: 16px; padding: 0 4px; text-align: center;
}
.cart-badge.hide { display: none; }
/* 我的页 link-row 右侧数量 */
.row-sub { margin-left: auto; color: var(--text-3); font-size: 13px; }
/* 购物车分组卡 */
.cart-group {
  margin: 10px 12px; background: var(--card); border-radius: 14px;
  box-shadow: var(--shadow); overflow: hidden;
}
.cg-head {
  display: flex; align-items: center; gap: 6px; padding: 10px 12px;
  font-size: 13.5px; color: var(--text-2); border-bottom: 1px solid var(--border); cursor: pointer;
}
.cg-head svg { width: 15px; height: 15px; }
.cg-total { margin-left: auto; color: var(--text-3); font-size: 12.5px; }
.cart-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.cart-row.unavailable { opacity: .45; }
.qty-step { display: flex; align-items: center; flex: none; gap: 2px; }
.qs-btn {
  width: 28px; height: 28px; border: none; border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1;
  display: grid; place-items: center; padding: 0;
}
.qs-btn svg { width: 14px; height: 14px; }
.qs-btn:disabled { opacity: .4; }
.qs-num { min-width: 30px; text-align: center; font-size: 14px; font-weight: 600; }
/* 底部结算条 */
.cart-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px calc(10px + var(--safe-b));
  background: color-mix(in srgb, var(--card) 90%, transparent);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-top: 1px solid var(--border);
}
.cb-total { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.cb-total b { color: var(--accent); font-size: 18px; margin-left: 2px; }
.cart-bar .btn { height: 40px; }
/* 商品详情：想要 + 加购双按钮 */
.detail-fixed .cart-add { margin-left: 2px; }
.detail-fixed .act:disabled { opacity: .4; }
.btn:disabled { opacity: .5; }
/* 订单卡 */
.order-card {
  margin: 10px 12px; background: var(--card); border-radius: 14px;
  box-shadow: var(--shadow); padding: 12px;
}
.oc-head {
  display: flex; align-items: center; gap: 6px; font-size: 14px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.oc-head svg { width: 15px; height: 15px; color: var(--text-2); flex: none; }
.oc-head .grow + .status-badge { margin-left: auto; }
.oc-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.oc-item .mng-thumb { width: 44px; height: 44px; }
.oc-line { font-size: 13.5px; font-weight: 600; flex: none; }
.oc-foot {
  display: flex; align-items: center; padding-top: 8px;
  border-top: 1px solid var(--border); font-size: 13px;
}
.oc-total { color: var(--accent); }
.oc-ops { display: flex; justify-content: flex-end; padding-top: 10px; }
.status-badge.done { background: rgba(0, 181, 120, .13); color: var(--ok); }
.status-badge.cancelled { background: rgba(120, 120, 130, .14); color: var(--text-3); }
/* 入驻主体徽标（管理员审核页） */
.entity-badge {
  display: inline-block; font-size: 10.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 20px; vertical-align: middle;
  background: rgba(120, 120, 130, .13); color: var(--text-2);
}
.entity-badge.org { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
/* 商家中心订单 Tab 的二级过滤 */
.seg-sub { margin: 0 12px 10px; }

/* ---------- 商家资质卡（公开） ---------- */
.biz-card {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--card-2);
  font-size: 13px;
}
.biz-head {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 13.5px; margin-bottom: 4px;
}
.biz-head .entity-badge { margin-left: auto; }
.biz-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; color: var(--text-2); min-height: 30px;
}
.biz-row > span { flex: none; width: 60px; color: var(--text-3); }
.biz-row b { color: var(--text); font-weight: 600; word-break: break-all; }
.biz-tel {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--accent); font-weight: 600; text-decoration: none;
}
.biz-tel svg { width: 14px; height: 14px; }
.biz-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; letter-spacing: .5px; }
/* 执照缩略块 + 大图 */
.biz-lic {
  position: relative; flex: none; width: 52px; height: 68px;
  border-radius: 8px; overflow: hidden; cursor: pointer;
  background: var(--bg); border: 1px solid var(--border);
  display: grid; place-items: center;
}
.biz-lic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.biz-lic .lic-tag {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-style: normal; font-size: 9px; line-height: 15px; text-align: center;
  color: #fff; background: rgba(0, 0, 0, .45);
  pointer-events: none;
}
.biz-lic.bad { background: var(--bg); }
.biz-lic.bad::after { content: '🖼️'; font-size: 16px; }
.lic-big {
  display: block; width: 100%; max-height: 58vh; object-fit: contain;
  border-radius: 12px; background: var(--bg); margin-top: 12px;
}
.lic-big.bad {
  height: 120px; object-fit: unset;
  display: grid; place-items: center;
  color: var(--text-3); font-size: 13px;
}
