/* ========== 全局重置 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { background: var(--color-bg); scrollbar-gutter: stable; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; background: var(--color-bg); min-height: 100vh; color: var(--color-text); -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; outline: none; font-family: inherit; background: transparent; }
input, select, textarea { font-family: inherit; outline: none; }

/* ========== Lucide 图标：JS 替换前的尺寸兜底 ==========
 * createIcons() 会内联 SVG 并生成真实宽高；此规则仅为替换前预留占位，
 * 避免图标尚未渲染时元素塌缩为 0 宽导致导航/卡片跳动（白屏/闪烁）。
 * 已内联 style="width/height" 的图标由行内样式覆盖；lucide 动画类继续生效。 */
i[data-lucide] {
  display: inline-block;
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
  vertical-align: -0.24em;
}

/* ========== 全局统一滚动条 ========== */
/* ========== 只给Firefox ========== */
@supports (-moz-appearance:none) {
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--color-text-disabled) transparent;
  }
}

/* ========== Chrome / Edge / Safari WebKit ========== */
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
/* 彻底干掉上下箭头按钮 */
*::-webkit-scrollbar-button {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}
*::-webkit-scrollbar-thumb {
  background: var(--color-text-placeholder);
  border-radius: var(--radius-md);
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}
*::-webkit-scrollbar-corner {
  background: transparent;
}


/* ========== 顶部导航栏 ========== */
.navbar { background: var(--nav-bg); color: white; box-shadow: var(--nav-shadow); position: sticky; top: 0; z-index: 100; }
.nav-inner { max-width: var(--width-container); margin: 0 auto; padding: 0 var(--space-5); display: flex; align-items: center; justify-content: space-between; height: var(--nav-height); }
.nav-inner.sm { max-width: var(--width-container-sm); height: 60px; }
.nav-inner.xl { max-width: var(--width-container-xl); height: 60px; }
.logo { font-size: var(--font-title); font-weight: bold; display: flex; align-items: center; gap: var(--space-2); }
.nav-inner.sm .logo { font-size: 20px; }
.logo-icon { width: 36px; height: 36px; background: white; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; color: var(--color-primary); font-weight: bold; font-size: 20px; }
.nav-inner.sm .logo-icon { width: 34px; height: 34px; font-size: 18px; }
.back-btn { padding: var(--space-1) var(--space-3); background: rgba(255,255,255,0.2); border-radius: var(--radius-sm); color: white; display: flex; align-items: center; gap: var(--space-1); transition: all var(--trans-base); }
.back-btn:hover { background: rgba(255,255,255,0.3); }
.nav-links { display: flex; gap: var(--space-1); }
.nav-link { padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm); transition: all var(--trans-base); font-size: var(--font-md); cursor: pointer; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,0.2); }
.nav-right { display: flex; align-items: center; gap: var(--space-3); }
.btn { padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm); font-size: var(--font-base); transition: all var(--trans-base); font-weight: 500; }
.btn-primary { background: white; color: var(--color-primary); }
.btn-primary:hover { background: var(--color-surface-hot); transform: translateY(-1px); box-shadow: var(--shadow-btn-sm); }
.btn-outline { background: transparent; border: 1.5px solid white; color: white; }
.btn-outline:hover { background: rgba(255,255,255,0.15); }
.user-menu { display: flex; align-items: center; gap: var(--space-3); position: relative; }
.avatar { width: 38px; height: 38px; border-radius: var(--radius-pill); background: var(--color-gradient); display: flex; align-items: center; justify-content: center; color: white; font-weight: bold; border: 2px solid white; overflow: hidden; object-fit: cover; }
.nav-inner.sm .avatar { width: 34px; height: 34px; }
.gold-badge { position: relative; background: rgba(255,255,255,0.2); padding: 4px 10px; border-radius: var(--radius-round); font-size: var(--font-sm); display: flex; align-items: center; gap: var(--space-1); cursor: default; }
/* 金币悬浮提示（自定义 tooltip，不使用 title） */
.gold-badge .gold-tip { display: block; position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%) translateY(-4px); white-space: nowrap; background: #1f2937; color: #fbbf24; font-size: 12px; font-weight: 500; padding: 6px 10px; border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,0.25); opacity: 0; visibility: hidden; transition: opacity .18s, transform .18s, visibility .18s; z-index: 60; }
.gold-badge .gold-tip-arrow { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-bottom-color: #1f2937; }
.gold-badge:hover .gold-tip { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.msg-icon { position: relative; cursor: pointer; padding: var(--space-2); }
.msg-icon svg { width: 22px; height: 22px; }
.msg-badge { position: absolute; top: 2px; right: 0; background: var(--color-danger); color: white; font-size: 10px; padding: 1px 5px; border-radius: var(--radius-round); min-width: 16px; text-align: center; }

/* 用户头像上的消息角标 */
.user-trigger { position: relative; display: flex; align-items: center; gap: var(--space-1); cursor: pointer; }
.avatar-msg-badge { position: absolute; top: -4px; right: -4px; background: var(--color-danger); color: white; font-size: 9px; padding: 1px 4px; border-radius: 8px; min-width: 14px; text-align: center; font-weight: 700; box-shadow: 0 2px 6px rgba(255,59,48,0.35); border: 1.5px solid white; z-index: 2; }

/* 下拉菜单项中的消息角标 */
.dropdown-item { position: relative; }
.item-msg-badge { margin-left: auto; background: var(--color-danger); color: white; font-size: 10px; padding: 1px 6px; border-radius: var(--radius-round); min-width: 16px; text-align: center; font-weight: 700; box-shadow: 0 2px 6px rgba(255,59,48,0.35); }

/* ========== 用户下拉菜单 ========== */
.user-dropdown { position: relative; }
.user-trigger { display: flex; align-items: center; gap: var(--space-2); color: white; cursor: pointer; padding: var(--space-1) var(--space-2); border-radius: var(--radius-sm); transition: background var(--trans-base); }
.user-trigger:hover { background: rgba(255,255,255,0.15); }
.user-trigger .caret { font-size: 11px; opacity: 0.7; transition: transform var(--trans-base); }
.user-dropdown.open .user-trigger .caret { transform: rotate(180deg); }
.dropdown-panel { min-width: 150px; position: absolute; top: calc(100% + 8px); right: 0; background: white; border-radius: var(--radius-xl); box-shadow: var(--shadow-dropdown); padding: var(--space-1); z-index: 200; opacity: 0; visibility: hidden; transform: translateY(-6px); transition: all var(--trans-base); }
.user-dropdown.open .dropdown-panel { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-item { display: flex; align-items: center; gap: var(--space-2); padding: 10px 14px; border-radius: var(--radius-sm); color: #444; font-size: var(--font-base); font-weight: 500; cursor: pointer; transition: all var(--trans-fast); }
.dropdown-item:hover { background: var(--color-surface-hot); color: var(--color-primary); }
.dropdown-item .di-icon { width: 18px; text-align: center; font-size: 15px; }
.dropdown-divider { height: 1px; background: var(--color-border); margin: var(--space-1) 8px; }
.dropdown-item.danger:hover { background: var(--color-danger-soft); color: var(--color-danger); }
.dropdown-item.admin-link { color: var(--color-primary); font-weight: 600; }
.dropdown-item.admin-link:hover { background: linear-gradient(135deg,var(--color-surface-hot),#ffecdb); }

/* ========== 账号管理弹窗（account_switch.php） ========== */
.acct-mgr-list { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; }
.acct-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); transition: background var(--trans-fast); }
.acct-item:not(.current) { cursor: pointer; }
.acct-item:not(.current):hover { background: var(--color-surface-hot, #fff5f0); }
.acct-avatar { width: 32px; height: 32px; min-width: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark, #e5511a)); color: white; font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.acct-info { flex: 1; min-width: 0; }
.acct-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--font-base); color: #444; font-weight: 500; }
.acct-item:not(.current):hover .acct-name { color: var(--color-primary); }
.acct-item.current .acct-name { color: var(--color-primary); }
.acct-sub { font-size: 12px; color: var(--color-text-placeholder, #999); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-badge-cur { font-size: 11px; font-weight: 600; color: var(--color-primary); background: rgba(255,255,255,0.75); padding: 3px 10px; border-radius: var(--radius-round, 999px); white-space: nowrap; }
.acct-btn { flex: none; padding: 5px 12px; border-radius: var(--radius-round, 999px); font-size: 12px; font-weight: 600; transition: all var(--trans-fast); }
.acct-btn.switch {background: var(--color-primary); color: white;}
.acct-btn.remove { background: transparent; color: var(--color-danger); }
.acct-loading { padding: 24px 0; text-align: center; font-size: var(--font-base); color: var(--color-text-placeholder, #999); }
.acct-add-btn { display: block; width: 100%; margin-top: 10px; padding: 10px; border: 1.5px dashed #d9d9d9; border-radius: var(--radius-xl); background: transparent; color: #666; font-size: var(--font-base); font-weight: 500; cursor: pointer; transition: all var(--trans-fast); }
.acct-add-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.acct-add-btn.primary { border: none; background: var(--color-gradient, linear-gradient(135deg, #ff8a4c, #ff6b35)); color: white; box-shadow: var(--shadow-btn, 0 4px 12px rgba(255,107,53,0.3)); }
.acct-add-btn.primary:hover { transform: translateY(-1px); }
.acct-add-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.acct-tip { margin-top: 10px; font-size: 12px; color: var(--color-text-placeholder, #999); text-align: center; }
.acct-tabs { display: flex; gap: 6px; margin-bottom: 14px; background: #f5f5f7; border-radius: var(--radius-xl); padding: 4px; }
.acct-tab { flex: 1; text-align: center; padding: 7px 0; font-size: var(--font-base); color: #888; border-radius: var(--radius-lg); cursor: pointer; transition: all var(--trans-fast); }
.acct-tab.active { background: white; color: var(--color-primary); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.acct-field { margin-bottom: 12px; }
.acct-field label { display: block; font-size: 13px; color: #666; margin-bottom: 5px; font-weight: 500; }
.acct-field input { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1.5px solid #e5e5e5; border-radius: var(--radius-xl); font-size: var(--font-base); outline: none; transition: border-color var(--trans-fast); background: #fff; }
.acct-field input:focus { border-color: var(--color-primary); }
.acct-code-row { display: flex; gap: 8px; }
.acct-code-row input { flex: 1; min-width: 0; }
.acct-code-row button { flex: none; padding: 0 14px; border: none; border-radius: var(--radius-xl); background: var(--color-primary); color: white; font-size: 13px; font-weight: 600; cursor: pointer; }
.acct-code-row button:disabled { opacity: 0.6; cursor: not-allowed; }
.acct-captcha-img { flex: none; height: 38px; border-radius: var(--radius-xl); border: 1px solid #f0e0d0; cursor: pointer; }
.acct-back { display: inline-block; margin-top: 12px; font-size: 13px; color: var(--color-text-placeholder, #999); text-decoration: none; }
.acct-back:hover { color: var(--color-primary); }

@media (max-width: 900px) { .nav-links { display: none; } }
@media (max-width: 500px) { .user-trigger span.nickname { display: none; } .dropdown-panel { right: -10px; } }

/* ========== 导航栏搜索框 ========== */
.nav-search { display: flex; align-items: center; background: rgba(255,255,255,0.18); border-radius: var(--radius-round); padding: 0 var(--space-1) 0 var(--space-3); flex: 1; max-width: 320px; margin: 0 var(--space-4); height: 40px; transition: all var(--trans-base); }
.nav-search:focus-within { background: white; box-shadow: var(--shadow-sm); }
.nav-search input { flex: 1; min-width: 0; background: transparent; border: none; color: white; font-size: var(--font-base); padding: 7px 0 7px 10px; outline: none; }
.nav-search input::placeholder { color: rgba(255,255,255,0.75); }
.nav-search:focus-within input { color: #333; }
.nav-search:focus-within input::placeholder { color: var(--color-text-placeholder); }
.nav-search button { background: transparent; color: white; padding: var(--space-1) var(--space-2); font-size: var(--font-base); border-radius: var(--radius-pill); display: flex; align-items: center; justify-content: center; transition: color var(--trans-base); }
.nav-search:focus-within button { color: var(--color-primary); }
@media (max-width: 700px) { .nav-search { display: none; } }

/* ========== 导航栏搜索记录下拉 ========== */
.nav-search { position: relative; }
.nav-search-history {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  z-index: 200;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
}
.nsh-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px 4px;
  font-size: 12px; color: var(--color-text-muted); font-weight: 600;
}
.nsh-clear-all {
  font-size: 12px; color: var(--color-danger); cursor: pointer;
  transition: opacity var(--trans-fast);
}
.nsh-clear-all:hover { opacity: 0.7; }
.nsh-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--trans-fast);
}
.nsh-item:hover { background: var(--color-surface-hot); }
.nsh-item .nsh-ico { color: var(--color-text-muted); flex-shrink: 0; display: flex; }
.nsh-item .nsh-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: #333; }
.nsh-item .nsh-del {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-muted); flex-shrink: 0;
  transition: all var(--trans-fast);
}
.nsh-item .nsh-del:hover { background: var(--color-danger-soft); color: var(--color-danger); }
.nsh-empty { padding: 20px; text-align: center; color: var(--color-text-muted); font-size: 13px; }

/* ========== 通用卡片 / 布局 ========== */
.container { max-width: var(--width-container); margin: var(--space-6) auto; padding: 0 var(--space-5); }
.container.sm { max-width: var(--width-container-sm); }
.container.xl { max-width: var(--width-container-xl); margin: var(--space-5) auto; }
.card { background: var(--color-surface); border-radius: var(--radius-xl); /*box-shadow: var(--shadow-md);*/ padding: var(--space-5); margin-bottom: var(--space-5); }
/* ========== 通用返回按钮 ========== */
.page-back-btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-round);
  color: var(--color-text-secondary);
  font-size: var(--font-sm);
  font-weight: 500;
  text-decoration: none;
  transition: all var(--trans-fast);
  margin-bottom: var(--space-3);
  margin-top: var(--space-3);
}
.page-back-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateX(-2px);
}
.card-title { font-size: var(--font-lg); font-weight: 700; margin-bottom: var(--space-3); color: #333; display: flex; align-items: center; gap: var(--space-2); }
.card-title::before { content: ''; width: 4px; height: 16px; background: var(--color-gradient); border-radius: 2px; }

/* ========== Toast 提示 ========== */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  color: white;
  z-index: 9999;
  font-size: var(--font-base);
  animation: toastIn .3s;
}

/* 退出动画类：通过 JS 动态添加此 class 触发退出 */
.toast.toast-out {
  animation: toastOut .3s forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
}

.toast.success {
  background: linear-gradient(135deg, var(--color-success), #45a049);
}
.toast.error {
  background: linear-gradient(135deg, var(--color-danger), #da190b);
}
.toast.info {
  background: linear-gradient(135deg, var(--color-info), #007bff);
}

/* ========== 加载 / 空状态 ========== */
.loading { text-align: center; padding: var(--space-10) var(--space-5); color: var(--color-text-muted); }
.spinner { display: inline-block; width: 32px; height: 32px; border: 3px solid var(--color-border-warm); border-top-color: var(--color-primary); border-radius: var(--radius-pill); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: var(--space-10) var(--space-5); color: var(--color-text-disabled); }
.empty svg { width: 64px; height: 64px; margin-bottom: var(--space-3); opacity: 0.5; }

/* ========== 滚动加载指示器（home/search/profile/my-posts 等无限滚动页面复用） ========== */
.scroll-loader { text-align: center; padding: var(--space-8) var(--space-5); display: none; }
.scroll-loader.active { display: block; }
.scroll-loader .spinner-sm { display: inline-block; width: 28px; height: 28px; border: 3px solid var(--color-border-warm); border-top-color: var(--color-primary); border-radius: var(--radius-pill); animation: spin .8s linear infinite; }
.scroll-loader .loader-text { margin-top: var(--space-2); font-size: var(--font-sm); color: var(--color-text-placeholder); }
.scroll-end { text-align: center; padding: var(--space-6) var(--space-5); font-size: var(--font-sm); color: var(--color-text-disabled); display: none; }
.scroll-end.active { display: block; }

/* ========== 分页 ========== */
.pagination { display: flex; justify-content: center; gap: var(--space-1); margin-top: var(--space-5); flex-wrap: wrap; }
.page-btn { min-width: 38px; height: 38px; padding: 0 var(--space-3); border-radius: var(--radius-md); background: white; border: 1px solid var(--color-border-warm); color: #666; transition: all var(--trans-base); display: flex; align-items: center; justify-content: center; font-weight: 600; text-decoration: none; font-size: var(--font-base); cursor: pointer; }
.page-btn:hover:not(:disabled):not(.active) { border-color: var(--color-primary); color: var(--color-primary); transform: translateY(-1px); }
.page-btn.active { background: var(--color-gradient); color: white; border-color: transparent; box-shadow: var(--shadow-btn-sm); }
.page-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ========== Tag 标签 ========== */
.tag { padding: 2px 10px; border-radius: var(--radius-round); font-size: var(--font-sm); background: #fff0e6; color: var(--color-primary); font-weight: 500; }
.tag.cat-music { background: var(--color-success-soft); color: #43a047; }
.tag.cat-video { background: #e3f2fd; color: #1976d2; }
.tag.cat-image { background: #fce4ec; color: #d81b60; }
.tag.cat-word { background: var(--color-purple-soft); color: #7b1fa2; }
/* 置顶徽章：左上角斜带（类似 shop 页 owned-ribbon，放左侧） */
.pin-ribbon,.rec-ribbon {
  background: linear-gradient(135deg, #ff9800, #ff5722);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(255, 87, 34, 0.3);
  pointer-events: none;
}
/* 推荐徽章：左上角第二条斜带（位于置顶带下方） */
.rec-ribbon {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* ========== 帖子卡片置顶/推荐功能菜单（仅本人帖子显示） ========== */
.post-card-menu {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.pcm-btn {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
  border-radius: 6px;
  /* overflow: hidden; */
  position: relative;
}
.pcm-btn:hover { transform: translateY(-1px); }
.pcm-btn svg { width: 25px; height: 25px; }
.pcm-tip {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.82);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s, visibility 0.18s;
  z-index: 20;
  line-height: 1.4;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.pcm-tip::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: transparent;
  border-bottom-color: rgba(0,0,0,0.82);
}
.pcm-btn:hover .pcm-tip { opacity: 1; visibility: visible; }

/* ========== 道具选择弹窗（置顶/推荐卡） ========== */
.card-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #f0e6df;
  border-radius: 10px;
  margin-bottom: 8px;
  background: #fffaf5;
  transition: all 0.15s;
}
.card-picker-item:hover { border-color: #ffb88a; background: #fff5f0; }
.cpi-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #fff0e6, #ffe3d0);
}
.cpi-info { flex: 1; min-width: 0; }
.cpi-name { font-size: 14px; font-weight: 600; color: #333; }
.cpi-meta { font-size: 12px; color: #b5a89f; margin-top: 2px; }
.cpi-dur {
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: linear-gradient(135deg, #fff5f0, #fff8e7);
  color: #ff6b35;
  border: 1px solid #ffd4b8;
  flex-shrink: 0;
}
.cpi-btn {
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  background: linear-gradient(135deg, #ff6b35, #f7931e);
  color: white;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(255,107,53,0.25);
  transition: all 0.15s;
}
.cpi-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(255,107,53,0.35); }
.cpi-btn:disabled { background: #eee; color: #aaa; cursor: not-allowed; box-shadow: none; transform: none; }
.card-picker-empty { text-align: center; padding: 26px 10px; color: #bbb; font-size: 13px; }
.card-picker-empty .go-shop { color: #ff6b35; font-weight: 600; text-decoration: none; }
.card-picker-empty .go-shop:hover { text-decoration: underline; }
/* 快捷购买区（我的卡片 / 商城卡片 分段标题与样式） */
.cps-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: #8a7a70;
  margin: 14px 0 8px;
  padding-top: 12px;
  border-top: 1px dashed #f0e6df;
}
.cps-section-title:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.cps-gold {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #f7931e;
  font-weight: 700;
  font-size: 12px;
}
.cps-price { color: #f7931e; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.cps-buy-btn {
  background: linear-gradient(135deg, #43b748, #7cc242);
  box-shadow: 0 2px 8px rgba(67,183,72,0.25);
}
.cps-buy-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(67,183,72,0.35); }
.cps-buy-btn:disabled { background: #eee; color: #aaa; cursor: not-allowed; box-shadow: none; transform: none; }

/* ========== 帖子卡片（post-card 统一布局，供 home/profile/my-posts 等页面复用） ========== */
.post-list { display: flex; flex-direction: column; gap: var(--space-4); }
.post-card {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-xl);
  transition: all var(--trans-base);
  cursor: pointer;
  background: var(--color-surface);
}
.post-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.post-cover { width: 160px; height: 110px; border-radius: var(--radius-md); background: var(--color-surface-soft); display: flex; align-items: center; justify-content: center; font-size: 32px; color: white; flex-shrink: 0; overflow: hidden; object-fit: cover; }
.post-cover img { width: 100%; height: 100%; object-fit: cover; }
.post-content { flex: 1; display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.post-header { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.post-title { font-size: var(--font-xl); font-weight: 600; color: var(--color-text-strong); line-height: 1.4; overflow: hidden; text-overflow: ellipsis;word-break: break-all; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.post-excerpt { font-size: var(--font-sm); color: var(--color-text-muted); line-height: 1.5; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.post-tags { display: flex; gap: var(--space-1); overflow: hidden; }
.post-tags .tag { flex-shrink: 0; }
.post-meta { display: flex; align-items: center; justify-content: space-between; font-size: var(--font-sm); color: var(--color-text-disabled); gap: var(--space-2); flex-wrap: wrap; margin-top: auto; }
.post-author { display: flex; align-items: center; gap: var(--space-2); }
.post-author .avatar { width: 32px; height: 32px; font-size: 12px; border-width: 1.5px; }
.author-name { color: #666; font-weight: 500; }
/* 作者头衔徽章：钻石💎/皇冠👑/新手⭐/自定义文本 */
.author-title-badge {
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 2px; flex-shrink: 0; vertical-align: middle;
}
.author-title-badge i { display: block; }
.atb-star { color: #f5a623; }
.atb-gem { color: #4f7cff; }
.atb-crown { color: #e8a33d; }
.atb-text {
  font-size: 11px; font-weight: 600; line-height: 1.6;
  padding: 0 6px; border-radius: 6px;
  background: linear-gradient(135deg, #fff3e6, #ffe8cc);
  color: #ff6b35; border: 1px solid #ffd4b8;
  max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* ===== 公共用户信息组件（统一「用户名 + 头衔 + 管理员 + VIP」徽章列） =====
 * 服务端 userInfoBadgeHtml() 与前端同名函数输出，尺寸可经 opt 自定义 */
.uci-wrap { display: inline-flex; align-items: center; gap: 3px; flex-wrap: wrap; min-width: 0; vertical-align: middle; }
.uci-name { display: inline-block; color: inherit; font-weight: 600; text-decoration: none; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; line-height: 1.4; }
.uci-name:hover { color: var(--color-primary); }
.uci-admin { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; background: linear-gradient(135deg, #9c27b0, #673ab7); color: #fff; font-size: 10px; border-radius: 8px; font-weight: 600; flex-shrink: 0; white-space: nowrap; vertical-align: middle; line-height: 1.5; }
.uci-vip { display: inline-flex; align-items: center; gap: 3px; padding: 1px 9px 1px 5px; background: linear-gradient(135deg, #ef4444, #b91c1c); color: #fff; font-size: 10px; font-weight: 800; clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%); flex-shrink: 0; white-space: nowrap; vertical-align: middle; line-height: 1.5; }
.uci-vip.uci-quarter { background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; clip-path: polygon(18% 0, 82% 0, 100% 50%, 82% 100%, 18% 100%, 0 50%); }
.uci-vip.uci-year { background: linear-gradient(150deg, #3a3a46, #000); color: #e6c15c; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%); text-shadow: 0 1px 2px rgba(0,0,0,.35); }
/* 帖子卡片作者行名称还原原配色 */
.post-author .uci-name { color: #666; font-weight: 500; }
.post-author .uci-name:hover { color: var(--color-primary); }
.post-stats { display: flex; gap: 14px; }
.stat { display: flex; align-items: center; gap: 4px; }
.stat svg { width: 14px; height: 14px; }
.post-actions { display: flex; gap: var(--space-1); }
@keyframes cardFadeIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.post-card.new-card { animation: cardFadeIn .4s ease-out; }
@media (max-width: 600px) {
  .post-cover { width: 110px; height: 80px; font-size: 26px; }
  .post-card { padding: var(--space-3); gap: var(--space-3); }
  .post-stats { gap: 10px; font-size: var(--font-xs); }
}
/* 移动端专属帖子卡片（renderPostCard/renderCard 在移动端输出 .post-card-mobile）：
 * 不展示封面：顶部作者行（右侧关注/菜单） + 中间标题/正文/标签 + 底部统计 */
@media (max-width: 768px) {
  .post-card.post-card-mobile {
    flex-direction: column;
    gap: 0;
    padding: var(--space-3);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-3);
    width: 100%;
  }
  /* 移动端隐藏封面（新结构不含封面，此规则为旧结构兜底） */
  .post-card.post-card-mobile .post-cover { display: none; }
  /* 顶部：作者行 + （右侧）关注按钮 + 置顶/推荐菜单 */
  .post-card.post-card-mobile .pm-top { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
  .post-card.post-card-mobile .pm-author { flex: 1; min-width: 0; }
  .post-card.post-card-mobile .post-author { min-width: 0; }
  .post-card.post-card-mobile .post-author .uci-name { max-width: 100px; }
  .pm-follow {
    flex: none;
    margin-left: auto;
    min-width: 62px;
    text-align: center;
    border: 1px solid var(--color-primary);
    background: transparent;
    color: var(--color-primary);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 0;
    border-radius: 999px;
    cursor: pointer;
    line-height: 1.4;
  }
  .pm-follow.followed { background: #f3f3f3; border-color: #e2e2e2; color: #999; }
  /* 中间：徽章(置顶/推荐) + 标题 + 正文 + 标签 */
  .post-card.post-card-mobile .pm-body { padding-top: var(--space-2); min-width: 0; }
  .post-card.post-card-mobile .pm-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
  .post-card.post-card-mobile .post-title { font-size: var(--font-lg); -webkit-line-clamp: 2; margin-bottom: 4px; }
  .post-card.post-card-mobile .post-excerpt { -webkit-line-clamp: 3; }
  .post-card.post-card-mobile .post-tags { margin-top: 6px; }
  /* 底部：浏览量等统计 */
  .post-card.post-card-mobile .pm-bottom {
    display: flex;
    align-items: center;
    padding-top: var(--space-2);
    margin-top: 6px;
    border-top: 1px solid var(--color-border);
  }
  .post-card.post-card-mobile .post-stats { justify-content: space-between; width: 100%; }
  /* 移动端「我的帖子」卡片：操作区（编辑/删除）换行成独立一行 */
  .post-card.post-card-mobile .pm-bottom { flex-wrap: wrap; }
  .post-card.post-card-mobile .post-actions { flex: 0 0 100%; justify-content: flex-end; padding-top: var(--space-2); }
  .post-card.post-card-mobile .mp-actions { justify-content: flex-end; }
  /* 桌面端卡片头结构在移动端卡片中不会出现，仅为兜底隐藏 */
  .post-card.post-card-mobile .post-header { display: none; }
  .post-card.post-card-mobile .post-content { padding: 0; }
  /* SSR 在桌面 UA 下输出的是普通 .post-card（无 .post-card-mobile 类），
   * 移动视口下也降级为移动布局：纵向堆叠 + 隐藏封面，避免窄屏仍显示 PC 卡片样式 */
  .post-card:not(.post-card-mobile) { flex-direction: column; gap: var(--space-2); }
  .post-card:not(.post-card-mobile) .post-cover { display: none; }
  .post-card:not(.post-card-mobile) .post-meta {
    margin-top: 6px;
    padding-top: var(--space-2);
    border-top: 1px solid var(--color-border);
  }
  .post-card:not(.post-card-mobile) .post-stats { justify-content: space-between; width: 100%; }
}

/* ========== 通用弹窗 ========== */
/* z-index 由 ModalStack 运行时动态分配（多弹窗叠加时后打开者置顶），此处仅为基础值 */
.modal-mask { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000; align-items: center; justify-content: center; padding: var(--space-5); animation: fadeIn .2s; }
.modal-mask.show { display: flex; }
.modal { background: white; border-radius: var(--radius-3xl); padding: var(--space-6); width: 100%; max-width: 380px; box-shadow: var(--shadow-modal); animation: slideUp .3s; position: relative; max-height: calc(100vh - 48px); overflow-y: auto; }
.modal-close-btn { position: absolute; top: 12px; right: 14px; width: 30px; height: 30px; border: none; background: none; border-radius: 50%; color: #999; font-size: 20px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all var(--trans-fast); }
.modal-close-btn:hover { background: #f2f2f2; color: #333; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.modal-title { font-size: var(--font-2xl); font-weight: 700; margin-bottom: var(--space-3); color: #333; display: flex; align-items: center; gap: var(--space-2); padding-right: 34px; }
.modal-actions { display: flex; gap: var(--space-2); }
.modal-btn { flex: 1; padding: var(--space-3); border-radius: var(--radius-md); font-size: var(--font-base); font-weight: 600; transition: all var(--trans-base); border: none; cursor: pointer; }
.modal-btn.cancel { background: #f5f5f5; color: #666; }
.modal-btn.cancel:hover { background: #eee; }
.modal-btn.confirm { background: var(--color-gradient); color: white; box-shadow: var(--shadow-btn); }
.modal-btn.confirm:hover { transform: translateY(-1px); }
.modal-btn.confirm:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.modal-body { margin-bottom: var(--space-4); word-break: break-word; }
.modal-body p { margin-bottom: var(--space-2); line-height: 1.6; }
.modal-body p:last-child { margin-bottom: 0; }
/* 弹窗内表单（后台添加/编辑弹窗等场景） */
.modal-body .form-row { margin-bottom: 14px; }
.modal-body .form-row:last-child { margin-bottom: 0; }
.modal-body .form-label { display: block; font-size: 13px; font-weight: 600; color: #555; margin-bottom: 6px; }
.modal-body .form-input { width: 100%; padding: 9px 12px; border: 1px solid #e0e0e0; border-radius: 8px; font-size: 13px; outline: none; transition: border-color .2s; box-sizing: border-box; font-family: inherit; }
.modal-body .form-input:focus { border-color: var(--color-primary); }
.modal-body .form-select { width: 100%; padding: 9px 12px; border: 1px solid #e0e0e0; border-radius: 8px; font-size: 13px; background: white; outline: none; box-sizing: border-box; cursor: pointer; }
.modal-body textarea.form-input { resize: vertical; min-height: 70px; }

/* 后台分类一键添加弹窗 */
.cat-batch-tip { background: #fff8e6; border: 1px solid #ffe2a8; color: #8a6d1a; border-radius: 8px; padding: 8px 12px; font-size: 12px; margin-bottom: 14px; }
.cat-batch-group { margin-bottom: 14px; }
.cat-batch-group:last-child { margin-bottom: 0; }
.cat-batch-gtitle { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 700; color: #333; margin-bottom: 8px; }
.cat-batch-addch { padding: 4px 10px; font-size: 12px; }
#catChList .cat-ch-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.cat-ch-del { flex: none; width: 30px; height: 30px; border: 1px solid #e0e0e0; background: #fff; color: #e02020; font-size: 16px; line-height: 1; border-radius: 6px; cursor: pointer; }
.cat-ch-del:hover { border-color: #e02020; background: #fff1f0; }
.cat-ch-empty { font-size: 12px; color: #aaa; background: #fafafa; border: 1px dashed #ddd; border-radius: 8px; padding: 14px; text-align: center; }

/* ======== 分类搜索框 + 分类树固定高度（home/search/profile 共用） ======== */
.cat-search-box { position: relative; margin-bottom: 10px; }
.cat-search-ico {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--color-text-disabled); pointer-events: none;
}
.cat-search {
  width: 100%; padding: 7px 12px 7px 31px;
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  font-size: 13px; background: var(--color-surface); color: var(--color-text);
  box-sizing: border-box; font-family: inherit; outline: none;
  transition: border-color .2s;
}
.cat-search:focus { border-color: var(--color-primary); }
.cat-search::placeholder { color: var(--color-text-disabled); }
/* 分类过多时固定高度，超出滚动 */
.cat-tree { max-height: 440px; overflow-y: auto; }
.cat-tree::-webkit-scrollbar { width: 6px; }
.cat-tree::-webkit-scrollbar-thumb { background: rgba(0,0,0,.18); border-radius: 3px; }
.cat-tree::-webkit-scrollbar-track { background: transparent; }

/* ========== 旧版简版页脚（兼容后台/单页 footerSize='xl' 场景） ========== */
.footer { max-width: var(--width-container); margin: 0 auto; padding: var(--space-8) var(--space-5); text-align: center; color: var(--color-text-disabled); font-size: var(--font-sm); line-height: 1.8; }
.footer.xl { max-width: var(--width-container-xl); color: var(--color-text-disabled); font-size: var(--font-xs); padding: var(--space-6) var(--space-5); }
.footer a { color: var(--color-secondary); }
.footer a:hover { color: var(--color-primary); text-decoration: underline; }

/* ========== 新版丰富页脚（四列 + 版权底栏） ========== */
.site-footer {
  margin-top: var(--space-10);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: var(--font-sm);
}
.footer-inner {
  max-width: var(--width-container);
  margin: 0 auto;
  padding: var(--space-8) var(--space-5) var(--space-6);
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: var(--space-6);
}
/* 后台大宽度场景 */
.site-footer.xl .footer-inner { max-width: var(--width-container-xl); font-size: var(--font-xs); }

.site-footer .footer-col { min-width: 0; }
.footer-col-title {
  font-size: var(--font-md);
  font-weight: 700;
  color: var(--color-text-strong);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.footer-col-title::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--color-gradient);
  border-radius: var(--radius-xs);
}

/* 品牌列 */
.footer-brand .footer-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.footer-logo-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--color-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  box-shadow: var(--shadow-btn-sm);
}
.footer-logo-text {
  font-size: var(--font-2xl);
  font-weight: 800;
  color: var(--color-text-strong);
  letter-spacing: 0.5px;
}
.footer-slogan {
  color: var(--color-text-soft);
  line-height: 1.7;
  margin-bottom: var(--space-4);
  font-size: var(--font-sm);
}
.footer-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  background: var(--color-bg-soft);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
}
.footer-stats .stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.footer-stats .stat-item b {
  font-size: var(--font-lg);
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1;
}
.footer-stats .stat-item span {
  font-size: var(--font-xs);
  color: var(--color-text-muted);
}

/* 链接列 */
.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.footer-links li a {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 2px;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: all var(--trans-fast);
  border-radius: var(--radius-sm);
}
.footer-links li a:hover {
  color: var(--color-primary);
  background: var(--color-surface-hot);
  padding-left: var(--space-2);
}
.footer-link-icon { font-size: 13px; width: 16px; text-align: center; }

/* 底部版权栏 */
.footer-bottom {
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-soft);
}
.footer-bottom-inner {
  max-width: var(--width-container);
  margin: 0 auto;
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  color: var(--color-text-disabled);
  font-size: var(--font-sm);
  line-height: 1.7;
}
.site-footer.xl .footer-bottom-inner {
  max-width: var(--width-container-xl);
  font-size: var(--font-xs);
  padding: var(--space-3) var(--space-5);
}
.fb-copy b { color: var(--color-primary); font-weight: 700; }
.fb-meta { display: inline-flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.fb-sep { color: var(--color-border); }
.icp-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: inherit;
  text-decoration: none;
  transition: color var(--trans-fast);
}
.icp-link:hover { color: var(--color-primary); }

/* 响应式：≤900 改为两列，≤600 改为一列 */
@media (max-width: 900px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .footer-inner { grid-template-columns: 1fr; gap: var(--space-5); padding: var(--space-6) var(--space-4) var(--space-4); }
  .footer-stats { gap: var(--space-1); padding: var(--space-2); }
  .footer-bottom-inner { flex-direction: column; align-items: flex-start; }
}

/* ========== 全局悬浮按钮组（右侧：发布 + 返回顶部） ========== */
.fab-wrap {
  position: fixed;
  right: var(--space-5);
  bottom: var(--space-5);
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}
.fab-btn {
  width: 56px; height: 56px; border-radius: var(--radius-pill);
  background: var(--color-gradient);
  color: white;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px;
  box-shadow: 0 8px 24px rgba(255,107,53,0.35);
  cursor: pointer; border: none; transition: all .25s;
}
.fab-btn:hover { box-shadow: 0 12px 32px rgba(255,107,53,0.5); transform: translateY(-2px); }
.fab-btn:active { transform: translateY(0); }
.fab-btn-txt { font-size: 11px; font-weight: 700; line-height: 1; }
.fab-top-btn {
  width: 56px; height: 56px; border-radius: var(--radius-pill);
  background: var(--color-surface);
  border: 1px solid var(--color-border-warm);
  color: var(--color-text-muted);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  cursor: pointer; transition: all .25s;
  opacity: 0; visibility: hidden; transform: translateY(10px);
}
.fab-top-btn.show { opacity: 1; visibility: visible; transform: translateY(0); }
.fab-top-btn:hover { color: var(--color-primary); border-color: var(--color-primary); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(255,107,53,0.2); }
@media (max-width: 600px) {
  .fab-wrap { right: var(--space-3); bottom: var(--space-4); gap: var(--space-2); }
  .fab-btn { width: 50px; height: 50px; }
  .fab-top-btn { width: 40px; height: 40px; }
}

/* ========== 移动端适配：汉堡菜单侧滑导航 + 底部 TabBar ========== */
/* --- 汉堡菜单按钮（默认隐藏，移动端显示） --- */
.nav-toggle {
  display: none;
  flex: none;
  width: 40px; height: 40px;
  margin-right: var(--space-2);
  border: none; border-radius: var(--radius-md);
  background: rgba(255,255,255,0.16);
  color: white;
  align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--trans-fast);
}
.nav-toggle:hover { background: rgba(255,255,255,0.28); }
.nav-toggle svg { width: 22px; height: 22px; }

/* --- 移动端页面标题（居中显示，桌面隐藏） --- */
.mobile-title {
  display: none;
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: var(--font-md);
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}

/* --- 侧滑抽屉遮罩 --- */
.mobile-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s;
}
.mobile-mask.show { opacity: 1; visibility: visible; }

/* --- 侧滑抽屉（从左往右移出） --- */
.mobile-drawer {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: min(300px, 82vw);
  z-index: 1001;
  background: var(--color-surface);
  box-shadow: var(--shadow-dropdown);
  transform: translateX(-100%);
  transition: transform .28s cubic-bezier(.32,.72,.28,1);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.mobile-drawer.open { transform: translateX(0); }
.md-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}
.md-logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; color: var(--color-text-strong); text-decoration: none; }
.md-logo .logo-icon { width: 32px; height: 32px; font-size: 17px; flex: none; }
.md-close {
  width: 34px; height: 34px; border: none; border-radius: var(--radius-md);
  background: var(--color-bg-soft); color: var(--color-text-muted);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.md-close svg { width: 18px; height: 18px; }
.md-nav { display: flex; flex-direction: column; padding: var(--space-2); flex: 1; min-height: 0; overflow-y: auto; }
.md-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-md);
  color: var(--color-text-strong); font-size: var(--font-md); font-weight: 500;
  text-decoration: none; position: relative; transition: all var(--trans-fast);
}
.md-item:hover, .md-item.active { background: var(--color-surface-hot); color: var(--color-primary); }
.md-ico { width: 20px; height: 20px; flex: none; }
.md-divider { height: 1px; background: var(--color-border); margin: var(--space-2) 14px; }
.md-account { padding: var(--space-3) var(--space-4); }
.md-btns { display: flex; flex-direction: column; gap: 10px; }
.md-login-btn {
  display: block; width: 100%; text-align: center; padding: 11px;
  border-radius: var(--radius-md); font-weight: 600; font-size: var(--font-md);
  text-decoration: none; transition: all var(--trans-fast);
}
.md-login-btn.primary { background: var(--color-gradient); color: #fff; box-shadow: var(--shadow-btn-sm); }
.md-login-btn.primary:hover { transform: translateY(-1px); }
.md-login-btn.ghost { background: var(--color-bg-soft); color: var(--color-text-strong); border: 1.5px solid var(--color-border); }

/* --- 抽屉底部：用户信息 + 金币（固定贴底） --- */
.md-foot {
  flex: none;
  border-top: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-soft);
}
.md-u-card { display: flex; align-items: center; gap: 12px; }
.md-u-avatar {
  width: 42px; height: 42px; flex: none; border-radius: 50%;
  background: var(--color-gradient); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700; overflow: hidden;
}
.md-u-info { min-width: 0; }
.md-u-name { font-weight: 600; color: var(--color-text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-u-gold { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 13px; color: var(--color-primary); font-weight: 500; }

/* --- 底部 TabBar（默认隐藏，移动端显示） --- */
.mobile-tabbar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 99;
  background: rgba(255,255,255,0.97);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
  padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: blur(8px);
}
.tabbar-inner {
  display: flex; align-items: stretch; height: 56px;
  max-width: var(--width-container); margin: 0 auto;
}
.tabbar-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--color-text-muted); text-decoration: none;
  font-size: 11px; position: relative; cursor: pointer; border: none; background: none;
}
.tabbar-item svg { width: 22px; height: 22px; }
.tabbar-item.active { color: var(--color-primary); font-weight: 600; }
.tabbar-badge {
  position: absolute; top: 5px; left: calc(50% + 8px);
  background: var(--color-danger); color: white; font-size: 9px;
  padding: 1px 5px; border-radius: var(--radius-round); min-width: 16px;
  text-align: center; font-weight: 700; box-shadow: 0 2px 6px rgba(255,59,48,0.35);
}
.tabbar-center { margin-top: -32px; }
.tabbar-center .tabbar-fab {
  width: 58px; height: 58px; border-radius: var(--radius-pill);
  background: var(--color-gradient); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  /* box-shadow: 0 6px 18px rgba(255,107,53,0.4); */
  border: 3px solid var(--color-surface); font-size: 13px; font-weight: 700;
}
.tabbar-center .tabbar-fab svg { width: 22px; height: 22px; }

@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .mobile-title { display: block; }
  /* 移动端去掉 logo，去掉头部用户/金币信息（已移入抽屉底部） */
  .logo { display: none; }
  .nav-right { display: none; }
  .site-footer { display: none; }
  .mobile-tabbar { display: block; }
  /* 移动端顶栏固定：header 脱离文档流置顶。sticky 在部分移动 webview 下不可靠，
     故移动端改 fixed 并让正文顶部让位（各分类/排序栏再在此基础上额外下移）。 */
  .navbar { position: fixed; top: 0; left: 0; right: 0; width: 100%; }
  body { padding-top: var(--nav-height); padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
  /* 右侧悬浮按钮上移到 TabBar 之上；发布已由 TabBar 中间按钮承载，仅保留返回顶部 */
  .fab-wrap { bottom: calc(72px + env(safe-area-inset-bottom)); }
  .fab-btn { display: none; }
  .fab-top-btn { width: 44px; height: 44px; }

  .mobile-search-btn { display: flex; }
  .mobile-title { margin-right: 0; }
}

/* --- 移动端 Header 搜索图标按钮（移动端显示，桌面隐藏） --- */
.mobile-search-btn {
  display: none;
  flex: none;
  width: 40px; height: 40px;
  margin-left: var(--space-2);
  border: none; border-radius: var(--radius-md);
  background: rgba(255,255,255,0.16);
  color: white;
  align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--trans-fast);
}
.mobile-search-btn:hover { background: rgba(255,255,255,0.28); }
.mobile-search-btn svg { width: 21px; height: 21px; }

/* --- 移动端搜索面板（点击搜索图标后从 Header 下方展开） --- */
.mobile-search {
  display: none;
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  z-index: 95;
  padding: var(--space-3);
}
.mobile-search.open { display: block; }
.ms-inner { display: flex; align-items: center; gap: var(--space-2); }
.ms-back {
  flex: none;
  width: 40px; height: 40px;
  border: none; border-radius: var(--radius-md);
  background: var(--color-bg-soft); color: var(--color-text-strong);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.ms-back svg { width: 20px; height: 20px; }
.ms-form { flex: 1; display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.ms-field {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: var(--space-2);
  height: 40px; padding: 0 14px;
  background: var(--color-bg-soft);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-round);
  transition: border-color var(--trans-fast);
}
.ms-field:focus-within { border-color: var(--color-primary); }
.ms-field-ico { width: 18px; height: 18px; flex: none; color: var(--color-text-muted); }
.ms-field input { flex: 1; min-width: 0; border: none; background: transparent; font-size: var(--font-base); color: var(--color-text-strong); }
.ms-field input::placeholder { color: var(--color-text-placeholder); }
.ms-go {
  flex: none; height: 40px; padding: 0 18px;
  background: var(--color-gradient); color: #fff;
  border: none; border-radius: var(--radius-round);
  font-size: var(--font-base); font-weight: 600;
}
.ms-history { margin-top: var(--space-3); max-height: 46vh; overflow-y: auto; }
.msh-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px var(--space-2);
  font-size: 13px; color: var(--color-text-muted); font-weight: 600;
}
.msh-clear {
  display: flex; align-items: center; gap: 4px;
  border: none; background: transparent;
  color: var(--color-text-muted); font-size: 12px; cursor: pointer;
}
.msh-clear svg { width: 13px; height: 13px; }

/* 移动端搜索按钮：基础规则在前，此处补充覆盖以确保移动端生效（避免后被基类 display:none 覆盖） */
@media (max-width: 768px) {
  .mobile-search-btn { display: flex; }
}
