/* ==========================================================================
   一站论坛 · 全站样式
   设计原则：
     1. 全部颜色走 CSS 变量，切换主题只换变量，不重复写一套暗色规则
     2. 只用 transform / opacity 做动画，保证 60fps，不触发 layout
     3. 移动优先，断点 640 / 960 / 1200
     4. 尊重 prefers-reduced-motion
   ========================================================================== */

/* ---------- 1. 主题变量 ---------- */
:root {
  --brand-1: #2f6df6;
  --brand-2: #7b5cff;
  --brand-grad: linear-gradient(135deg, var(--brand-1), var(--brand-2));

  --bg: #f6f7fb;
  --bg-soft: #eef1f7;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --surface-hover: #f2f5fa;
  --border: #e4e8f0;
  --border-strong: #d2d9e6;

  --text: #1a2233;
  --text-2: #4a5568;
  --text-3: #8792a8;
  --text-inv: #ffffff;

  --primary: #2f6df6;
  --primary-soft: #e8f0ff;
  --success: #16a34a;
  --success-soft: #e7f7ee;
  --warn: #d97706;
  --warn-soft: #fef3e2;
  --danger: #dc2626;
  --danger-soft: #fdeaea;
  --gold: #f59e0b;

  --radius-s: 8px;
  --radius: 14px;
  --radius-l: 20px;

  --shadow-1: 0 1px 2px rgba(20, 30, 60, .05), 0 2px 8px rgba(20, 30, 60, .04);
  --shadow-2: 0 4px 14px rgba(20, 30, 60, .08), 0 12px 32px rgba(20, 30, 60, .06);
  --shadow-3: 0 10px 40px rgba(20, 30, 60, .14);

  --header-h: 62px;
  --container: 1200px;
  --ease: cubic-bezier(.16, 1, .3, 1);

  --glass: rgba(255, 255, 255, .78);
  --glass-border: rgba(255, 255, 255, .6);

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0d1017;
  --bg-soft: #12161f;
  --surface: #161b26;
  --surface-2: #1b2130;
  --surface-hover: #202737;
  --border: #262e3d;
  --border-strong: #354054;

  --text: #e6eaf2;
  --text-2: #a9b3c6;
  --text-3: #6d7891;
  --text-inv: #0d1017;

  --primary: #5b8cff;
  --primary-soft: #1b2740;
  --success: #34d399;
  --success-soft: #10291f;
  --warn: #fbbf24;
  --warn-soft: #2b2110;
  --danger: #f87171;
  --danger-soft: #2c1618;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 4px 16px rgba(0, 0, 0, .45);
  --shadow-3: 0 12px 44px rgba(0, 0, 0, .6);

  --glass: rgba(22, 27, 38, .78);
  --glass-border: rgba(255, 255, 255, .07);

  color-scheme: dark;
}

/* ---------- 2. 基础重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.7 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei UI", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .25s var(--ease), color .25s var(--ease);
  overflow-wrap: break-word;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; transition: color .18s var(--ease); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
h1, h2, h3, h4 { margin: 0 0 .6em; line-height: 1.35; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.1rem); }
h2 { font-size: clamp(1.25rem, 1.05rem + .8vw, 1.5rem); }
h3 { font-size: 1.08rem; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.4em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
code, pre, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
::selection { background: var(--primary); color: #fff; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 999;
  background: var(--primary); color: #fff; padding: 10px 16px; border-radius: var(--radius-s);
}
.skip-link:focus { left: 8px; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 16px; }
.container-wide { max-width: 1440px; }
.icon { flex: none; vertical-align: -.15em; }
.rot180 { transform: rotate(180deg); }
.muted { color: var(--text-3); }
.tc { text-align: center; }
.nowrap { white-space: nowrap; }
.clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 3. 头部 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  height: var(--header-h);
  display: flex; align-items: center; gap: 10px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.05rem; letter-spacing: -.02em; flex: none; }
.brand-mark { display: grid; place-items: center; transition: transform .4s var(--ease); }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.08); }
.brand-text { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.main-nav { display: none; align-items: center; gap: 2px; margin-left: 10px; }
.nav-link {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 8px 13px; border-radius: 10px;
  color: var(--text-2); font-weight: 500; font-size: .94rem;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.nav-link:hover { background: var(--surface-hover); color: var(--text); }
.nav-link.is-active { color: var(--primary); background: var(--primary-soft); }

.nav-drop { position: relative; }
.nav-drop-panel {
  position: absolute; top: calc(100% + 10px); left: 0; min-width: 300px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-3); padding: 8px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
  opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.98);
  transition: all .22s var(--ease);
}
.nav-drop.open .nav-drop-panel { opacity: 1; visibility: visible; transform: none; }
.nav-drop-panel a {
  padding: 9px 11px; border-radius: 9px; font-size: .9rem;
  display: flex; align-items: baseline; justify-content: space-between; gap: 6px;
}
.nav-drop-panel a:hover { background: var(--surface-hover); }
.nav-drop-panel em { font-style: normal; color: var(--text-3); font-size: .78rem; }
.nav-drop-panel .drop-all { grid-column: 1 / -1; color: var(--primary); font-weight: 600; justify-content: center; }

.header-search {
  flex: 1; max-width: 380px; margin: 0 auto; position: relative; display: none;
}
.header-search input {
  width: 100%; height: 38px; padding: 0 40px 0 36px;
  background: var(--bg-soft); border: 1px solid transparent; border-radius: 999px;
  transition: all .2s var(--ease);
}
.header-search input:focus {
  background: var(--surface); border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft); outline: none;
}
.header-search .search-icon { position: absolute; left: 12px; top: 11px; color: var(--text-3); }
.header-search kbd {
  position: absolute; right: 10px; top: 8px; font-size: .72rem; color: var(--text-3);
  border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; background: var(--surface);
}
.header-search input:focus + kbd, .header-search input:not(:placeholder-shown) + kbd { opacity: 0; }

.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.icon-btn {
  position: relative; width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; color: var(--text-2);
  transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); transform: translateY(-1px); }
.icon-btn:active { transform: scale(.94); }
.dot-num {
  position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--danger); color: #fff; font-size: .66rem; font-style: normal; font-weight: 700;
  line-height: 17px; text-align: center; border-radius: 9px; border: 2px solid var(--surface);
}

/* 主题按钮：三态各显示一个图标 */
.theme-btn .ico-sun, .theme-btn .ico-moon, .theme-btn .ico-auto { display: none; }
[data-theme-pref="light"] .theme-btn .ico-sun,
[data-theme-pref="dark"] .theme-btn .ico-moon,
[data-theme-pref="system"] .theme-btn .ico-auto { display: block; }
html:not([data-theme-pref]) .theme-btn .ico-auto { display: block; }
.theme-btn svg { transition: transform .5s var(--ease); }
.theme-btn:hover svg { transform: rotate(35deg); }

.avatar-btn img { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--border); object-fit: cover; transition: border-color .2s; }
.avatar-btn:hover img { border-color: var(--primary); }
.user-drop { position: relative; }
.user-drop-panel {
  position: absolute; right: 0; top: calc(100% + 10px); width: 232px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-3); padding: 6px; z-index: 120;
  opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.97);
  transition: all .22s var(--ease);
}
.user-drop.open .user-drop-panel { opacity: 1; visibility: visible; transform: none; }
.ud-head { display: flex; gap: 10px; align-items: center; padding: 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.ud-head img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.ud-head strong { display: block; font-size: .95rem; }
.ud-head span { font-size: .78rem; color: var(--text-3); display: flex; align-items: center; gap: 4px; }
.user-drop-panel a, .ud-logout button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 11px; border-radius: 9px; font-size: .9rem; color: var(--text-2); text-align: left;
}
.user-drop-panel a:hover, .ud-logout button:hover { background: var(--surface-hover); color: var(--text); }
.ud-logout { margin-top: 4px; border-top: 1px solid var(--border); padding-top: 4px; }
.ud-logout button { color: var(--danger); }

.btn-post span { display: none; }
.nav-toggle { width: 38px; height: 38px; display: grid; place-content: center; gap: 4px; border-radius: 10px; }
.nav-toggle span { display: block; width: 18px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .3s var(--ease), opacity .3s; }

.scroll-progress {
  position: absolute; left: 0; bottom: -1px; height: 2px; width: 0;
  background: var(--brand-grad); transition: width .1s linear;
}

/* ---------- 4. 抽屉 ---------- */
.drawer { position: fixed; inset: 0; z-index: 200; }
.drawer[hidden] { display: none; }
.drawer-mask { position: absolute; inset: 0; background: rgba(10, 14, 25, .5); backdrop-filter: blur(2px); animation: fade .25s var(--ease); }
.drawer-panel {
  position: absolute; left: 0; top: 0; bottom: 0; width: min(84vw, 320px);
  background: var(--surface); display: flex; flex-direction: column;
  padding: 14px; overflow-y: auto; box-shadow: var(--shadow-3);
  animation: slideIn .3s var(--ease);
}
@keyframes fade { from { opacity: 0 } }
@keyframes slideIn { from { transform: translateX(-100%) } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.drawer-head .brand-text { font-weight: 800; font-size: 1.05rem; }
.drawer-search { display: flex; gap: 6px; margin-bottom: 14px; }
.drawer-search input { flex: 1; height: 38px; padding: 0 12px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; }
.drawer-search button { width: 38px; border-radius: 10px; background: var(--primary); color: #fff; display: grid; place-items: center; }
.drawer-nav { display: flex; flex-direction: column; gap: 2px; }
.drawer-nav a { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; font-weight: 500; }
.drawer-nav a:hover { background: var(--surface-hover); }
.drawer-cats { margin-top: 16px; }
.drawer-title { font-size: .78rem; color: var(--text-3); margin: 0 0 8px 12px; letter-spacing: .04em; }
.drawer-cats a { display: inline-block; padding: 5px 11px; margin: 0 4px 6px 0; background: var(--bg-soft); border-radius: 999px; font-size: .84rem; }
.drawer-foot { margin-top: auto; padding-top: 16px; display: grid; gap: 8px; }

/* ---------- 5. 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 18px; border-radius: 11px;
  font-weight: 600; font-size: .92rem; white-space: nowrap;
  border: 1px solid transparent;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s, opacity .18s;
}
.btn:active { transform: scale(.97); }
.btn:disabled, .btn.is-loading { opacity: .55; pointer-events: none; }
.btn-sm { height: 34px; padding: 0 13px; font-size: .86rem; border-radius: 9px; }
.btn-lg { height: 48px; padding: 0 26px; font-size: 1rem; border-radius: 13px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand-grad); color: #fff; box-shadow: 0 4px 14px rgba(47, 109, 246, .28); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(47, 109, 246, .38); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-hover); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover { filter: brightness(.97); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-plain { color: var(--text-2); }
.btn-plain:hover { background: var(--surface-hover); }

/* ---------- 6. 卡片与布局 ---------- */
.site-main { min-height: 60vh; padding: 22px 0 56px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.card-pad { padding: 18px; }
.card-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-hd h2, .card-hd h3 { margin: 0; font-size: 1rem; display: flex; align-items: center; gap: 7px; }
.card-hd .more { font-size: .84rem; color: var(--text-3); }
.card-hd .more:hover { color: var(--primary); }

.layout { display: grid; gap: 20px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 960px) { .layout { grid-template-columns: minmax(0, 1fr) 300px; } }
.sidebar { display: grid; gap: 16px; position: sticky; top: calc(var(--header-h) + 18px); }
@media (max-width: 959px) { .sidebar { position: static; } }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.flex { display: flex; gap: 10px; align-items: center; }
.flex-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* ---------- 7. 帖子列表 ---------- */
.thread-list { display: flex; flex-direction: column; }
.thread {
  display: flex; gap: 12px; padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  transition: background .18s var(--ease);
}
.thread:last-child { border-bottom: 0; }
.thread:hover { background: var(--surface-hover); }
.thread-avatar { flex: none; }
.thread-avatar img { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; }
.thread-body { min-width: 0; flex: 1; }
.thread-title {
  display: block; font-size: 1.02rem; font-weight: 600; margin-bottom: 5px;
  transition: color .18s var(--ease);
}
.thread-title:hover { color: var(--primary); }
.thread-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: .8rem; color: var(--text-3); }
.thread-meta a { color: var(--text-3); }
.thread-meta a:hover { color: var(--primary); }
.thread-meta i { font-style: normal; display: inline-flex; align-items: center; gap: 3px; }
.thread-excerpt { font-size: .88rem; color: var(--text-2); margin: 6px 0 0; }
.thread-cover { flex: none; width: 108px; height: 72px; border-radius: 10px; overflow: hidden; background: var(--bg-soft); }
.thread-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.thread:hover .thread-cover img { transform: scale(1.06); }
.thread-side { flex: none; display: none; flex-direction: column; align-items: center; justify-content: center; min-width: 58px; gap: 2px; }
.thread-side b { font-size: 1.05rem; font-weight: 700; }
.thread-side span { font-size: .7rem; color: var(--text-3); }
@media (min-width: 640px) { .thread-side { display: flex; } }

.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 7px; border-radius: 6px; font-size: .72rem; font-weight: 600; line-height: 1.6;
  background: var(--bg-soft); color: var(--text-2);
}
.badge-top { background: var(--danger-soft); color: var(--danger); }
.badge-digest { background: var(--warn-soft); color: var(--warn); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-gold { background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff; }

/* ---------- 8. 帖子详情 ---------- */
.post-head { padding: 22px 22px 16px; border-bottom: 1px solid var(--border); }
.post-head h1 { margin-bottom: 12px; }
.post-author { display: flex; align-items: center; gap: 10px; }
.post-author img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.post-author .pa-name { font-weight: 600; }
.post-author .pa-meta { font-size: .8rem; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; }
.post-body { padding: 22px; font-size: 1.02rem; line-height: 1.85; }
.post-body h2 { margin: 1.6em 0 .7em; padding-left: 11px; border-left: 4px solid var(--primary); }
.post-body h3 { margin: 1.4em 0 .6em; }
.post-body img { border-radius: 10px; margin: 14px auto; box-shadow: var(--shadow-1); }
.post-body a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.post-body blockquote {
  margin: 16px 0; padding: 12px 16px; border-left: 3px solid var(--border-strong);
  background: var(--bg-soft); border-radius: 0 10px 10px 0; color: var(--text-2);
}
.post-body pre {
  background: #0f1420; color: #dfe6f2; padding: 14px 16px; border-radius: 12px;
  overflow-x: auto; font-size: .88rem; line-height: 1.6;
}
.post-body :not(pre) > code { background: var(--bg-soft); padding: 2px 6px; border-radius: 5px; font-size: .88em; color: var(--danger); }
.post-body table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: .92rem; }
.post-body th, .post-body td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.post-body th { background: var(--bg-soft); font-weight: 600; }
.post-body .video-wrap { position: relative; padding-bottom: 56.25%; height: 0; margin: 16px 0; }
.post-body .video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 12px; }

.post-toc { font-size: .88rem; }
.post-toc a { display: block; padding: 5px 0 5px 10px; border-left: 2px solid var(--border); color: var(--text-2); }
.post-toc a:hover, .post-toc a.active { border-color: var(--primary); color: var(--primary); }
.post-toc .lv3 { padding-left: 22px; }

.post-actions { display: flex; gap: 10px; justify-content: center; padding: 8px 0 24px; }
.act-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 22px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--text-2); font-weight: 600;
  transition: all .2s var(--ease);
}
.act-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); color: var(--text); }
.act-btn.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.act-btn.on svg { fill: currentColor; }

.post-tags { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 22px 18px; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 11px;
  background: var(--bg-soft); border-radius: 999px; font-size: .82rem; color: var(--text-2);
  transition: all .18s var(--ease);
}
.tag-chip:hover { background: var(--primary-soft); color: var(--primary); transform: translateY(-1px); }

/* ---------- 9. 评论 ---------- */
.comment { display: flex; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.comment:target { background: var(--primary-soft); animation: flash 1.6s var(--ease); }
@keyframes flash { 0%, 100% { background: var(--primary-soft) } 50% { background: transparent } }
.comment > img { width: 38px; height: 38px; border-radius: 50%; flex: none; object-fit: cover; }
.cm-body { flex: 1; min-width: 0; }
.cm-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.cm-head .cm-name { font-weight: 600; font-size: .92rem; }
.cm-head .cm-floor { margin-left: auto; font-size: .76rem; color: var(--text-3); }
.cm-text { font-size: .95rem; line-height: 1.75; }
.cm-text img { max-height: 320px; border-radius: 8px; }
.cm-foot { display: flex; gap: 14px; margin-top: 7px; font-size: .8rem; color: var(--text-3); }
.cm-foot button:hover { color: var(--primary); }
.cm-children { margin-top: 10px; padding: 10px 12px; background: var(--bg-soft); border-radius: 10px; display: grid; gap: 9px; }
.cm-child { font-size: .88rem; }
.cm-child .cn { color: var(--primary); font-weight: 600; }

.reply-box { padding: 16px 18px; }
.reply-box textarea {
  width: 100%; min-height: 92px; padding: 12px 14px; resize: vertical;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px;
  transition: all .2s var(--ease);
}
.reply-box textarea:focus { background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); outline: none; }
.reply-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }

/* ---------- 10. 表单 ---------- */
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 6px; color: var(--text-2); }
.form-row label .req { color: var(--danger); }
.input, .form-row input[type=text], .form-row input[type=email], .form-row input[type=password],
.form-row input[type=number], .form-row input[type=url], .form-row input[type=search],
.form-row select, .form-row textarea {
  width: 100%; min-height: 42px; padding: 10px 13px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.form-row textarea { min-height: 110px; resize: vertical; line-height: 1.7; }
.input:focus, .form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft);
}
.form-hint { font-size: .78rem; color: var(--text-3); margin-top: 5px; }
.form-err { font-size: .8rem; color: var(--danger); margin-top: 5px; }
.form-row.has-err input, .form-row.has-err textarea { border-color: var(--danger); }
.checkbox { display: inline-flex; align-items: center; gap: 7px; font-size: .88rem; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--primary); }

.auth-wrap { max-width: 420px; margin: 5vh auto; }
.auth-card { padding: 30px 28px; }
.auth-card h1 { font-size: 1.5rem; text-align: center; margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--text-3); font-size: .88rem; margin-bottom: 24px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: .88rem; color: var(--text-3); }
.auth-foot a { color: var(--primary); font-weight: 600; }
.captcha-row { display: flex; gap: 10px; }
.captcha-row img { height: 42px; border-radius: 10px; cursor: pointer; border: 1px solid var(--border); }

/* ---------- 11. 商城 ---------- */
.prod-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .28s var(--ease), box-shadow .28s var(--ease), border-color .28s;
}
.prod-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-2); border-color: var(--border-strong); }
.prod-thumb { position: relative; aspect-ratio: 1 / 1; background: var(--bg-soft); overflow: hidden; }
.prod-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.prod-card:hover .prod-thumb img { transform: scale(1.07); }
.prod-flag { position: absolute; top: 9px; left: 9px; display: flex; gap: 5px; }
.prod-info { padding: 12px 13px 14px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.prod-name { font-size: .93rem; font-weight: 600; line-height: 1.5; }
.prod-price { display: flex; align-items: baseline; gap: 7px; margin-top: auto; }
.price { color: var(--danger); font-weight: 800; font-size: 1.15rem; }
.price small { font-size: .72rem; font-weight: 600; }
.price-old { color: var(--text-3); text-decoration: line-through; font-size: .8rem; }
.prod-sub { display: flex; justify-content: space-between; font-size: .76rem; color: var(--text-3); }
.stars { display: inline-flex; gap: 1px; color: var(--gold); }

.prod-detail { display: grid; gap: 26px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .prod-detail { grid-template-columns: 440px minmax(0, 1fr); } }
.gallery-main { aspect-ratio: 1/1; border-radius: var(--radius); overflow: hidden; background: var(--bg-soft); border: 1px solid var(--border); }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.gallery-thumbs img { width: 62px; height: 62px; border-radius: 9px; object-fit: cover; border: 2px solid transparent; cursor: pointer; flex: none; }
.gallery-thumbs img.on { border-color: var(--primary); }
.sku-group { margin-bottom: 16px; }
.sku-group h4 { font-size: .85rem; color: var(--text-3); margin-bottom: 8px; font-weight: 600; }
.sku-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.sku-opt {
  padding: 8px 15px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); font-size: .88rem; transition: all .18s var(--ease);
}
.sku-opt:hover { border-color: var(--primary); }
.sku-opt.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.sku-opt:disabled { opacity: .4; text-decoration: line-through; cursor: not-allowed; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.qty button { width: 34px; height: 36px; font-size: 1.1rem; color: var(--text-2); }
.qty button:hover { background: var(--surface-hover); }
.qty input { width: 52px; height: 36px; text-align: center; border: 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border); background: var(--surface); }
.price-block { background: var(--bg-soft); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; }
.price-block .price { font-size: 2rem; }

.cart-line { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.cart-line img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; flex: none; background: var(--bg-soft); }
.cart-line.invalid { opacity: .5; }
.cart-bar {
  position: sticky; bottom: 0; display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; background: var(--glass); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius);
}
.order-steps { display: flex; gap: 4px; margin-bottom: 20px; }
.order-steps li { flex: 1; list-style: none; text-align: center; font-size: .8rem; color: var(--text-3); padding: 9px 4px; border-radius: 9px; background: var(--bg-soft); }
.order-steps li.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* ---------- 12. 侧栏组件 ---------- */
.side-list { display: flex; flex-direction: column; }
.side-item { display: flex; gap: 10px; padding: 10px 16px; align-items: flex-start; transition: background .18s; }
.side-item:hover { background: var(--surface-hover); }
.side-rank { flex: none; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: .72rem; font-weight: 700; background: var(--bg-soft); color: var(--text-3); }
.side-item:nth-child(1) .side-rank { background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff; }
.side-item:nth-child(2) .side-rank { background: linear-gradient(135deg, #94a3b8, #64748b); color: #fff; }
.side-item:nth-child(3) .side-rank { background: linear-gradient(135deg, #d97706, #b45309); color: #fff; }
.side-item .st { font-size: .88rem; line-height: 1.5; }
.side-item .sm { font-size: .74rem; color: var(--text-3); }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; }
.stat-cell { background: var(--surface); padding: 14px; text-align: center; }
.stat-cell b { display: block; font-size: 1.3rem; font-weight: 800; background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-cell span { font-size: .76rem; color: var(--text-3); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; padding: 16px; }

/* ---------- 13. 分页 / 空态 ---------- */
.pager { display: flex; justify-content: center; align-items: center; gap: 5px; flex-wrap: wrap; margin: 26px 0 6px; }
.pager a, .pager span {
  min-width: 38px; height: 38px; padding: 0 11px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border); font-size: .88rem; color: var(--text-2);
  transition: all .18s var(--ease);
}
.pager a:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }
.pager .cur { background: var(--brand-grad); color: #fff; border-color: transparent; font-weight: 700; }
.pager .gap { border: 0; background: none; }

.empty { text-align: center; padding: 56px 20px; color: var(--text-3); }
.empty svg { margin: 0 auto 14px; opacity: .35; }
.empty p { margin: 0 0 16px; font-size: .95rem; }

.crumbs, .breadcrumb { font-size: .84rem; color: var(--text-3); margin-bottom: 16px; }
.crumbs a, .breadcrumb a { color: var(--text-3); }
.crumbs a:hover, .breadcrumb a:hover { color: var(--primary); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.crumbs .sep { opacity: .5; }
.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.breadcrumb li + li::before { content: '/'; margin-right: 6px; opacity: .45; }
.breadcrumb .crumb-current { color: var(--text-2); font-weight: 500; }

.tabs { display: flex; gap: 3px; overflow-x: auto; border-bottom: 1px solid var(--border); padding: 0 6px; }
.tabs a, .tabs button {
  padding: 12px 15px; font-size: .92rem; font-weight: 500; color: var(--text-3);
  border-bottom: 2px solid transparent; white-space: nowrap; transition: all .18s var(--ease);
}
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs .on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ---------- 14. Toast / 回顶 ---------- */
.toast-wrap { position: fixed; top: calc(var(--header-h) + 14px); left: 50%; transform: translateX(-50%); z-index: 300; display: grid; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 9px; padding: 11px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-3); font-size: .9rem; font-weight: 500;
  animation: toastIn .32s var(--ease);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(.96) } }
.toast.out { animation: toastOut .28s var(--ease) forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px) scale(.97) } }
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-warn { border-left: 3px solid var(--warn); }

.back-top {
  position: fixed; right: 18px; bottom: 22px; z-index: 90;
  width: 44px; height: 44px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-2);
  display: grid; place-items: center; color: var(--text-2);
  transition: transform .25s var(--ease), opacity .25s;
}
.back-top:hover { transform: translateY(-3px); color: var(--primary); }
.back-top[hidden] { display: none; }

/* ---------- 15. 首页 Hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius-l);
  padding: 38px 28px; margin-bottom: 22px;
  background: linear-gradient(135deg, rgba(47, 109, 246, .1), rgba(123, 92, 255, .1));
  border: 1px solid var(--border);
}
.hero::before {
  content: ''; position: absolute; width: 380px; height: 380px; right: -110px; top: -170px;
  background: radial-gradient(circle, rgba(123, 92, 255, .28), transparent 70%);
  filter: blur(30px); pointer-events: none;
}
.hero h1 { font-size: clamp(1.5rem, 1.1rem + 2vw, 2.3rem); margin-bottom: 10px; position: relative; }
.hero p { color: var(--text-2); max-width: 620px; margin-bottom: 20px; position: relative; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; position: relative; }
.hero-hot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; font-size: .84rem; position: relative; }
.hero-hot a { padding: 4px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; }
.hero-hot a:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- 16. 个人主页 ---------- */
.profile-hd { display: flex; gap: 18px; align-items: center; padding: 24px; flex-wrap: wrap; }
.profile-hd > img { width: 84px; height: 84px; border-radius: 24px; object-fit: cover; box-shadow: var(--shadow-2); }
.profile-meta h1 { font-size: 1.4rem; margin-bottom: 4px; }
.profile-sign { color: var(--text-2); font-size: .9rem; }
.profile-nums { display: flex; gap: 22px; margin-top: 10px; }
.profile-nums div { text-align: center; }
.profile-nums b { display: block; font-size: 1.15rem; font-weight: 800; }
.profile-nums span { font-size: .74rem; color: var(--text-3); }

/* ---------- 17. 骨架屏与动画 ---------- */
.skeleton { background: linear-gradient(90deg, var(--bg-soft) 25%, var(--surface-hover) 37%, var(--bg-soft) 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0 } 100% { background-position: -100% 0 } }
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .55s var(--ease), transform .55s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

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

/* ---------- 18. 响应式 ---------- */
@media (min-width: 768px) {
  .header-search { display: block; }
  .btn-post span { display: inline; }
}
@media (min-width: 960px) {
  .main-nav { display: flex; }
  .nav-toggle { display: none; }
  :root { --header-h: 66px; }
}
@media (max-width: 639px) {
  .site-main { padding: 14px 0 40px; }
  .container { padding: 0 12px; }
  .thread { padding: 13px 14px; }
  .thread-cover { width: 84px; height: 60px; }
  .card { border-radius: 12px; }
  .post-head, .post-body { padding: 16px; }
  .hero { padding: 26px 18px; }
}

/* ---------- 19. 底部 ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 40px 0 24px; margin-top: 40px; }
.footer-grid { display: grid; gap: 26px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 1.6fr repeat(4, 1fr); } }
.footer-brand strong { font-size: 1.05rem; display: block; margin-bottom: 8px; }
.footer-brand p { color: var(--text-3); font-size: .86rem; max-width: 280px; }
.footer-stat { display: flex; gap: 16px; font-size: .8rem; color: var(--text-3); }
.footer-stat b { color: var(--text); font-weight: 700; }
.footer-col h3 { font-size: .84rem; color: var(--text-3); letter-spacing: .05em; margin-bottom: 12px; font-weight: 600; }
.footer-col a { display: block; font-size: .87rem; color: var(--text-2); padding: 4px 0; }
.footer-col a:hover { color: var(--primary); }
.footer-theme { display: flex; gap: 5px; margin-top: 12px; flex-wrap: wrap; }
.tm-opt { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: .78rem; color: var(--text-2); }
.tm-opt:hover { border-color: var(--primary); color: var(--primary); }
[data-theme-pref="light"] .tm-opt[data-theme-set="light"],
[data-theme-pref="dark"] .tm-opt[data-theme-set="dark"],
[data-theme-pref="system"] .tm-opt[data-theme-set="system"] { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.footer-links { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--border); font-size: .8rem; color: var(--text-3); display: flex; flex-wrap: wrap; gap: 10px; }
.footer-links a { color: var(--text-3); }
.footer-links a:hover { color: var(--primary); }
.footer-bottom { margin-top: 18px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: .8rem; color: var(--text-3); }
.footer-bottom p { margin: 0; }
.footer-beian { display: flex; gap: 12px; flex-wrap: wrap; }
.footer-beian .dbg { font-family: ui-monospace, monospace; opacity: .7; }

/* ---------- 20. 后台 ---------- */
.adm { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
@media (min-width: 900px) { .adm { grid-template-columns: 220px minmax(0, 1fr); } }
.adm-side { background: var(--surface); border-right: 1px solid var(--border); padding: 16px 12px; }
.adm-side .brand { margin-bottom: 20px; padding: 0 8px; }
.adm-nav { display: grid; gap: 2px; }
.adm-nav a { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 9px; font-size: .9rem; color: var(--text-2); }
.adm-nav a:hover { background: var(--surface-hover); color: var(--text); }
.adm-nav a.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.adm-nav .grp { font-size: .72rem; color: var(--text-3); padding: 14px 12px 5px; letter-spacing: .06em; }
.adm-main { padding: 20px; min-width: 0; }
.adm-hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.adm-hd h1 { font-size: 1.3rem; margin: 0; }
.kpi { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); margin-bottom: 20px; }
.kpi-cell { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.kpi-cell span { font-size: .78rem; color: var(--text-3); display: block; margin-bottom: 6px; }
.kpi-cell b { font-size: 1.6rem; font-weight: 800; }
.kpi-cell em { font-style: normal; font-size: .76rem; color: var(--success); margin-left: 6px; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table.dt { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 640px; }
table.dt th, table.dt td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
table.dt th { background: var(--bg-soft); font-weight: 600; color: var(--text-2); font-size: .82rem; white-space: nowrap; }
table.dt tbody tr:hover { background: var(--surface-hover); }
table.dt td.actions { white-space: nowrap; }
table.dt td.actions button, table.dt td.actions a { font-size: .82rem; color: var(--primary); margin-right: 8px; }
table.dt td.actions .del { color: var(--danger); }

.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-bar input, .filter-bar select { height: 36px; padding: 0 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); font-size: .86rem; }
