/* ============================================================
   筑智论坛 · 设计系统 v2 (参照 lcz.me / Discourse)
   扁平化 · 多色系(浅蓝默认 / 深色 / 绿) · 小圆角 · 实心控件
   ============================================================ */

/* ---------- 浅色(默认, LCZ-Blue 风格) ---------- */
:root, [data-theme="light"] {
  --bg: #f7f8fa;
  --bg-soft: #eef1f5;
  --bg-elev: #ffffff;
  --card: #ffffff;
  --card-hover: #f2f6fb;
  --border: #d7dce3;
  --border-soft: #e3e8ee;
  --text: #22262b;
  --text-dim: #5c6672;
  --text-faint: #8b95a1;
  --accent: #0b6cc9;          /* 经典蓝 */
  --accent-2: #0a5aa8;
  --accent-soft: rgba(11,108,201,.10);
  --accent-grad: #0b6cc9;     /* 扁平: 纯色代替渐变 */
  --on-accent: #ffffff;
  --ok: #1a8a4b;
  --warn: #b7791f;
  --danger: #c0392b;
  --shadow: 0 1px 3px rgba(16,24,40,.08);
  --shadow-lg: 0 8px 28px rgba(16,24,40,.14);
  --radius: 7px;
  --radius-lg: 10px;
  --glow: 0 0 0 3px rgba(11,108,201,.16);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "JetBrains Mono", monospace;
  --maxw: 1120px;
  color-scheme: light;
}

/* ---------- 深色(夜间) ---------- */
[data-theme="dark"] {
  --bg: #14181c;
  --bg-soft: #1b2026;
  --bg-elev: #1f252b;
  --card: #1e242a;
  --card-hover: #242b32;
  --border: #333c45;
  --border-soft: #2a323a;
  --text: #e6eaee;
  --text-dim: #a4b0bb;
  --text-faint: #6f7c88;
  --accent: #4aa3e0;
  --accent-2: #63b3ea;
  --accent-soft: rgba(74,163,224,.14);
  --accent-grad: #3d8fd0;
  --on-accent: #0d1116;
  --ok: #3fb27a;
  --warn: #d9a441;
  --danger: #e0644f;
  --shadow: 0 1px 3px rgba(0,0,0,.35);
  --shadow-lg: 0 8px 28px rgba(0,0,0,.5);
  --glow: 0 0 0 3px rgba(74,163,224,.20);
  color-scheme: dark;
}

/* ---------- 绿色变体(LCZ-Green 风格) ---------- */
[data-theme="green"] {
  --bg: #f5f8f4;
  --bg-soft: #ecf2ea;
  --bg-elev: #ffffff;
  --card: #ffffff;
  --card-hover: #f1f6ee;
  --border: #d3ddd0;
  --border-soft: #e0e8dc;
  --text: #1f2a20;
  --text-dim: #556356;
  --text-faint: #83917f;
  --accent: #2f7d43;
  --accent-2: #276b38;
  --accent-soft: rgba(47,125,67,.10);
  --accent-grad: #2f7d43;
  --on-accent: #ffffff;
  --shadow: 0 1px 3px rgba(20,40,26,.08);
  --shadow-lg: 0 8px 28px rgba(20,40,26,.14);
  --glow: 0 0 0 3px rgba(47,125,67,.16);
  color-scheme: light;
}

/* ===================== 基础 ===================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  transition: background .18s, color .18s;
  overflow-x: hidden;
}
/* Discourse 风格: 干净的纯色底, 仅顶栏一条分隔线 */
body::before { display: none; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
::selection { background: var(--accent-soft); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ===================== 顶栏(实心, Discourse) ===================== */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 18px;
  padding: 9px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 6px;
  background: var(--accent-grad); color: var(--on-accent);
  font-weight: 800; font-size: 19px;
  display: grid; place-items: center;
}
.brand-text { font-weight: 700; font-size: 16.5px; color: var(--text); white-space: nowrap; }
.brand-text em {
  font-style: normal; font-size: 10px; font-weight: 700; color: var(--accent);
  font-family: var(--mono); letter-spacing: .6px; margin-left: 6px;
  vertical-align: 2px;
}

/* 一级导航: 实心底部高亮, Discourse 风格 */
.nav-links { display: flex; gap: 2px; }
.nav-links a {
  color: var(--text-dim); padding: 8px 13px; border-radius: 6px;
  font-size: 14.5px; font-weight: 500; transition: all .15s; white-space: nowrap;
  text-decoration: none; position: relative;
}
.nav-links a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.nav-links a.active { color: var(--accent); font-weight: 600; background: var(--accent-soft); }

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

.search-box { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 11px; color: var(--text-faint); pointer-events: none; }
.search-box input {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 17px;
  color: var(--text); padding: 7px 14px 7px 33px; width: 200px; font-size: 13.5px;
  outline: none; transition: all .18s;
}
.search-box input::placeholder { color: var(--text-faint); }
.search-box input:focus { border-color: var(--accent); box-shadow: var(--glow); width: 236px; }

.icon-btn {
  width: 34px; height: 34px; flex-shrink: 0;
  background: transparent; border: 1px solid transparent; color: var(--text-dim);
  border-radius: 6px; cursor: pointer; display: grid; place-items: center; transition: all .15s;
}
.icon-btn:hover { color: var(--accent); background: var(--bg-soft); border-color: var(--border-soft); }

.user-area { display: flex; align-items: center; gap: 8px; }
.user-badge {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 12px; font-size: 13.5px; font-weight: 500; white-space: nowrap;
  color: var(--text-dim);
}
.user-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.user-badge.admin .dot { background: var(--warn); }
.role-tag { font-size: 9.5px; font-weight: 700; color: var(--warn); letter-spacing: .5px; }
.btn-link {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  font-size: 13.5px; padding: 5px 9px; border-radius: 6px; transition: all .15s;
}
.btn-link:hover { color: var(--accent); background: var(--bg-soft); }

/* ===================== 分类快捷栏 ===================== */
.catbar {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 4px;
  padding: 0 20px 9px; overflow-x: auto; scrollbar-width: none;
}
.catbar::-webkit-scrollbar { display: none; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 6px; font-size: 13.5px; font-weight: 500;
  color: var(--text-dim); background: transparent; border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; transition: all .15s; flex-shrink: 0;
}
.cat-chip:hover { color: var(--text); background: var(--bg-soft); }
.cat-chip.active { color: var(--on-accent); background: var(--accent-grad); font-weight: 600; }
.cat-chip .cat-ico { font-size: 14px; line-height: 1; }
.cat-n {
  font-size: 11px; font-family: var(--mono); color: var(--text-faint);
  background: var(--bg-soft); border-radius: 4px; padding: 0 5px; min-width: 17px; text-align: center;
}
.cat-chip.active .cat-n { background: rgba(255,255,255,.22); color: inherit; }

/* ===================== 布局 ===================== */
.layout {
  max-width: var(--maxw); margin: 0 auto; padding: 18px 20px 64px;
  display: grid; grid-template-columns: minmax(0,1fr) 280px; gap: 20px;
}
.content { min-width: 0; }
.sidebar { display: flex; flex-direction: column; gap: 14px; }

/* ===================== 视图头 ===================== */
.view-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 14px;
}
.view-title { font-size: 20px; font-weight: 700; letter-spacing: .2px; }
.view-title small { font-size: 13px; font-weight: 400; color: var(--text-faint); margin-left: 8px; }
.view-sub { font-size: 13px; color: var(--text-faint); margin-top: 2px; }
.head-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* 排序切换: 扁平分段控件 */
.seg { display: flex; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 6px; padding: 2px; }
.seg button {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  padding: 5px 14px; border-radius: 4px; font-size: 13.5px; font-weight: 500; transition: all .15s;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--bg-elev); color: var(--accent); font-weight: 600; box-shadow: var(--shadow); }

/* ===================== 按钮(实心) ===================== */
.btn {
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--text);
  padding: 8px 16px; border-radius: 6px; cursor: pointer;
  font-size: 14px; font-weight: 500; transition: all .15s;
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
}
.btn:hover { border-color: var(--text-faint); background: var(--bg-soft); }
.btn-primary { background: var(--accent-grad); border-color: var(--accent-grad); color: var(--on-accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--on-accent); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* ===================== 帖子列表(Discourse 行式) ===================== */
.topic-list {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.topic-card {
  display: flex; gap: 13px; padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft); cursor: pointer; position: relative;
  transition: background .12s;
}
.topic-card:last-child { border-bottom: none; }
.topic-card:hover { background: var(--card-hover); }
.topic-card.pinned { background: var(--accent-soft); }
.topic-card.pinned:hover { background: var(--card-hover); }

.avatar {
  width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 16px;
  color: var(--on-accent); user-select: none;
}
.topic-main { flex: 1; min-width: 0; }
.topic-title {
  font-size: 15.5px; font-weight: 600; color: var(--text); line-height: 1.45;
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.topic-card:hover .topic-title { color: var(--accent); }
.pin-badge {
  font-size: 10px; font-weight: 700; color: var(--on-accent);
  background: var(--accent-grad); border-radius: 3px;
  padding: 1px 6px; flex-shrink: 0;
}
.topic-excerpt {
  color: var(--text-dim); font-size: 13.5px; margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.topic-meta {
  display: flex; align-items: center; gap: 11px; margin-top: 6px;
  font-size: 12.5px; color: var(--text-faint); flex-wrap: wrap;
}
.cat-chip-sm {
  background: var(--accent-soft); color: var(--accent);
  border-radius: 4px; padding: 1px 8px; font-size: 11.5px; font-weight: 600;
}
.meta-item { display: inline-flex; align-items: center; gap: 4px; }
.topic-side {
  display: flex; gap: 16px; align-items: center; justify-content: center;
  flex-shrink: 0; padding-left: 8px;
}
.stat { display: flex; flex-direction: column; align-items: center; min-width: 34px; }
.stat-num { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--text-dim); line-height: 1.2; }
.stat-num.like { color: var(--text-faint); }
.stat-label { font-size: 10px; color: var(--text-faint); }

/* ===================== 首屏欢迎区(简洁横幅) ===================== */
.hero {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 16px;
}
.hero h1 { font-size: 22px; font-weight: 800; color: var(--text); }
.hero p { color: var(--text-dim); font-size: 13.5px; margin-top: 4px; }
.hero-stats { display: flex; gap: 24px; margin-top: 14px; flex-wrap: wrap; }
.hero-stat b { font-family: var(--mono); font-size: 18px; color: var(--accent); display: block; line-height: 1.2; }
.hero-stat span { font-size: 12px; color: var(--text-faint); }

/* ===================== 版块网格 ===================== */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 12px; }
.cat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 17px; cursor: pointer; transition: all .15s;
}
.cat-card:hover { border-color: var(--accent); background: var(--card-hover); }
.cat-card .ico { font-size: 22px; margin-bottom: 8px; }
.cat-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.cat-card p { font-size: 12.8px; color: var(--text-dim); line-height: 1.55; min-height: 40px; }
.cat-card .count {
  margin-top: 11px; font-family: var(--mono); font-size: 12px; color: var(--accent);
}

/* ===================== 标签云 ===================== */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud a {
  background: var(--card); border: 1px solid var(--border); border-radius: 5px;
  padding: 6px 13px; font-size: 13px; color: var(--text-dim); transition: all .15s;
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
}
.tag-cloud a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.tag-cloud a b { font-family: var(--mono); font-size: 11px; color: var(--accent); }

/* ===================== 分页 ===================== */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.pagination button {
  background: var(--card); border: 1px solid var(--border); color: var(--text-dim);
  min-width: 36px; height: 36px; border-radius: 5px; cursor: pointer;
  font-size: 13.5px; font-weight: 500; transition: all .15s;
}
.pagination button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pagination button.active { background: var(--accent-grad); color: var(--on-accent); font-weight: 700; border-color: var(--accent-grad); }
.pagination button:disabled { opacity: .4; cursor: default; }

/* ===================== 空态 ===================== */
.empty {
  text-align: center; padding: 52px 22px; color: var(--text-faint);
  border: 1px dashed var(--border); border-radius: var(--radius); background: var(--card);
}
.empty .big { font-size: 40px; margin-bottom: 10px; }
.empty p { font-size: 14px; }

/* ===================== 侧边栏 ===================== */
.widget {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 16px;
}
.widget h3 {
  font-size: 12.5px; font-weight: 700; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 11px;
  display: flex; align-items: center; gap: 6px;
}
.widget-stats { display: flex; flex-direction: column; gap: 9px; }
.wstat { display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; }
.wstat .k { color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.wstat .v { font-family: var(--mono); font-weight: 700; color: var(--accent); }
.widget-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.widget-tags a {
  font-size: 12.5px; color: var(--text-dim); background: var(--bg-soft);
  border: 1px solid var(--border-soft); border-radius: 5px; padding: 3px 9px; transition: all .15s;
}
.widget-tags a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.widget-tags a b { color: var(--accent); font-family: var(--mono); font-size: 10.5px; margin-left: 5px; }
.recent-item {
  display: flex; gap: 8px; padding: 7px 0; cursor: pointer;
  border-bottom: 1px solid var(--border-soft); font-size: 13px; line-height: 1.45;
}
.recent-item:last-child { border-bottom: none; padding-bottom: 0; }
.recent-item .r-dot { color: var(--accent); flex-shrink: 0; font-size: 10px; }
.recent-item .r-title {
  color: var(--text-dim); display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; transition: color .15s;
}
.recent-item:hover .r-title { color: var(--accent); }
.side-cta {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.side-cta h3 { font-size: 14.5px; margin-bottom: 6px; color: var(--text); text-transform: none; letter-spacing: 0; display: block; }
.side-cta p { font-size: 12.8px; color: var(--text-dim); margin-bottom: 12px; line-height: 1.55; }

/* ===================== 抽屉(帖子详情) ===================== */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(20,24,28,.5);
  z-index: 90; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.drawer-overlay.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 95vw);
  background: var(--bg-elev); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg); z-index: 100;
  transform: translateX(100%); transition: transform .26s cubic-bezier(.2,.8,.2,1);
  overflow-y: auto; overscroll-behavior: contain;
}
.drawer.open { transform: translateX(0); }
.drawer-inner { padding: 22px 26px 56px; }
.drawer-top {
  position: sticky; top: 0; z-index: 5; margin: -22px -26px 16px;
  padding: 12px 26px; background: var(--bg-elev);
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.drawer-top .crumbs { font-size: 12.5px; color: var(--text-faint); }
.drawer-close {
  background: transparent; border: 1px solid transparent; color: var(--text-faint);
  width: 32px; height: 32px; border-radius: 5px; cursor: pointer; font-size: 20px;
  display: grid; place-items: center; transition: all .15s; flex-shrink: 0;
}
.drawer-close:hover { color: var(--danger); background: var(--bg-soft); }
.topic-detail h1 { font-size: 22px; line-height: 1.4; font-weight: 700; margin-bottom: 12px; }
.detail-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  font-size: 12.5px; color: var(--text-faint); margin-bottom: 16px;
  padding-bottom: 14px; border-bottom: 1px solid var(--border-soft);
}
.detail-author { display: flex; align-items: center; gap: 7px; color: var(--text-dim); font-weight: 500; }
.detail-author .avatar { width: 26px; height: 26px; font-size: 12px; }

/* ---------- Markdown 正文 ---------- */
.detail-body { font-size: 15px; line-height: 1.8; overflow-wrap: break-word; }
.detail-body > *:first-child { margin-top: 0; }
.detail-body p { margin: 0 0 14px; }
.detail-body h1, .detail-body h2, .detail-body h3, .detail-body h4 { font-weight: 700; line-height: 1.4; margin: 24px 0 11px; }
.detail-body h1 { font-size: 20px; }
.detail-body h2 { font-size: 17.5px; }
.detail-body h3 { font-size: 16px; }
.detail-body h4 { font-size: 15px; color: var(--text-dim); }
.detail-body ul, .detail-body ol { margin: 0 0 15px; padding-left: 22px; }
.detail-body li { margin-bottom: 7px; }
.detail-body li::marker { color: var(--text-faint); }
.detail-body strong { color: var(--text); font-weight: 700; }
.detail-body em { color: var(--text-dim); font-style: normal; font-size: 13px; }
.detail-body a { color: var(--accent); }
.detail-body code {
  background: var(--bg-soft); color: var(--accent);
  padding: 2px 5px; border-radius: 4px; font-family: var(--mono); font-size: 13px;
}
.detail-body pre.code-block {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 6px;
  padding: 14px 16px; overflow-x: auto; margin: 14px 0; position: relative;
}
.detail-body pre.code-block::before {
  content: attr(data-lang); position: absolute; top: 7px; right: 12px;
  font-size: 10px; color: var(--text-faint); font-family: var(--mono); text-transform: uppercase;
}
.detail-body pre.code-block code { background: none; padding: 0; color: var(--text); font-size: 13px; line-height: 1.65; }
.detail-body blockquote {
  border-left: 3px solid var(--accent); background: var(--bg-soft);
  padding: 10px 15px; margin: 14px 0; border-radius: 0 5px 5px 0;
  color: var(--text-dim); font-size: 14.2px;
}
.detail-body hr { border: none; border-top: 1px solid var(--border-soft); margin: 22px 0; }
.table-wrap { overflow-x: auto; margin: 15px 0; border: 1px solid var(--border); border-radius: 6px; }
.detail-body table { border-collapse: collapse; width: 100%; font-size: 13.8px; min-width: 420px; }
.detail-body th, .detail-body td { padding: 9px 13px; text-align: left; border-bottom: 1px solid var(--border-soft); }
.detail-body th { background: var(--bg-soft); font-weight: 700; font-size: 13.2px; color: var(--text-dim); white-space: nowrap; }
.detail-body tr:last-child td { border-bottom: none; }

.detail-actions { display: flex; gap: 9px; align-items: center; margin: 20px 0; flex-wrap: wrap; }
.detail-actions .btn.liked { background: var(--ok); border-color: var(--ok); color: #fff; }

.comments { margin-top: 28px; }
.comments-head {
  font-size: 14.5px; font-weight: 700; color: var(--text-dim);
  margin-bottom: 13px; display: flex; align-items: center; gap: 8px;
}
.comment { display: flex; gap: 11px; padding: 13px 0; border-bottom: 1px solid var(--border-soft); }
.comment .avatar { width: 34px; height: 34px; font-size: 14px; }
.comment .c-body { flex: 1; min-width: 0; }
.comment .c-head { display: flex; align-items: baseline; gap: 10px; font-size: 12.5px; }
.comment .c-author { color: var(--accent); font-weight: 600; }
.comment .c-time { color: var(--text-faint); font-size: 11.5px; }
.comment .c-content { margin-top: 4px; font-size: 14px; line-height: 1.65; overflow-wrap: break-word; }
.comment .c-del { margin-left: auto; background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 12px; }
.comment .c-del:hover { color: var(--danger); }
.comment-form { margin-top: 16px; }
.comment-form textarea, .composer textarea {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); padding: 11px 13px; font-size: 14px;
  font-family: var(--font); outline: none; resize: vertical; line-height: 1.65; transition: border-color .15s;
}
.comment-form textarea:focus, .composer textarea:focus { border-color: var(--accent); box-shadow: var(--glow); }

/* ===================== 发帖表单 ===================== */
.composer {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 19px 20px;
}
.composer h3 { font-size: 16.5px; margin-bottom: 14px; }
.composer input[type="text"], .composer select {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); padding: 10px 13px; font-size: 14px;
  font-family: var(--font); outline: none; transition: border-color .15s;
}
.composer input[type="text"]:focus, .composer select:focus { border-color: var(--accent); box-shadow: var(--glow); }
.composer .row { display: flex; gap: 11px; margin: 11px 0; }
.composer .row > * { flex: 1; }
.composer .hint { font-size: 12.5px; color: var(--text-faint); margin: 9px 0 13px; line-height: 1.6; }
.composer .hint code { color: var(--accent); background: var(--accent-soft); padding: 1px 5px; border-radius: 3px; }
.composer-foot { display: flex; justify-content: flex-end; gap: 9px; }
.field-label { font-size: 12.5px; color: var(--text-dim); margin-bottom: 5px; display: block; font-weight: 500; }

/* ===================== 弹窗 ===================== */
[hidden] { display: none !important; }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20,24,28,.55);
  z-index: 200; display: grid; place-items: center; padding: 20px;
}
.modal {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  width: min(400px, 100%); padding: 24px 24px 22px; position: relative;
  box-shadow: var(--shadow-lg); animation: pop .2s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }
.modal-close {
  position: absolute; top: 13px; right: 15px; background: none; border: none;
  color: var(--text-faint); font-size: 22px; cursor: pointer; line-height: 1;
}
.modal-close:hover { color: var(--danger); }
.modal-title { font-size: 19px; font-weight: 700; margin-bottom: 16px; }
.tabs { display: flex; gap: 2px; background: var(--bg-soft); padding: 3px; border-radius: 6px; margin-bottom: 17px; }
.tabs .tab {
  flex: 1; background: none; border: none; color: var(--text-dim); cursor: pointer;
  padding: 8px; border-radius: 4px; font-size: 14px; font-weight: 500; transition: all .15s;
}
.tabs .tab.active { background: var(--bg-elev); color: var(--accent); font-weight: 600; box-shadow: var(--shadow); }
.auth-form .field { display: block; margin-bottom: 13px; }
.auth-form .field span { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 5px; font-weight: 500; }
.auth-form input {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); padding: 11px 13px; font-size: 14px; outline: none;
  font-family: var(--font); transition: border-color .15s;
}
.auth-form input:focus { border-color: var(--accent); box-shadow: var(--glow); }
.form-msg { font-size: 12.5px; color: var(--danger); min-height: 18px; margin-bottom: 9px; }

/* ===================== 提示 & 回到顶部 ===================== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg-elev); border-radius: 6px;
  padding: 11px 20px; z-index: 300; font-size: 13.8px;
  box-shadow: var(--shadow-lg); animation: toastIn .2s; max-width: 90vw;
}
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%,10px); } to { opacity: 1; transform: translate(-50%,0); } }

.to-top {
  position: fixed; right: 22px; bottom: 24px; z-index: 70;
  width: 40px; height: 40px; border-radius: 6px;
  background: var(--card); border: 1px solid var(--border); color: var(--text-dim);
  cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow); transition: all .15s;
}
.to-top:hover { color: var(--accent); border-color: var(--accent); }

/* ===================== 骨架屏 ===================== */
.skeleton {
  background: var(--card); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 15px 16px; margin-bottom: 0;
}
.sk-line { height: 12px; border-radius: 4px; background: var(--bg-soft); margin-bottom: 8px; animation: pulse 1.4s ease-in-out infinite; }
.sk-line.w60 { width: 60%; } .sk-line.w90 { width: 90%; } .sk-line.w35 { width: 35%; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

/* ===================== 响应式 ===================== */
@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { order: 2; }
}
@media (max-width: 780px) {
  body { font-size: 14.5px; }
  .topbar-inner { flex-wrap: wrap; gap: 10px; padding: 9px 15px; }
  .nav-links { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a { padding: 6px 11px; font-size: 14px; }
  .topbar-right { margin-left: auto; }
  .search-box { flex: 1; min-width: 0; }
  .search-box input, .search-box input:focus { width: 100%; }
  .catbar { padding: 0 15px 8px; }
  .layout { padding: 14px 15px 56px; gap: 14px; }
  .hero { padding: 17px 16px; }
  .hero h1 { font-size: 19px; }
  .hero-stats { gap: 16px; margin-top: 12px; }
  .hero-stat b { font-size: 16px; }
  .topic-card { padding: 12px 13px; gap: 10px; }
  .avatar { width: 34px; height: 34px; font-size: 14px; }
  .topic-title { font-size: 14.8px; }
  .topic-side { gap: 10px; padding-left: 4px; }
  .stat { min-width: 28px; }
  .cat-grid { grid-template-columns: 1fr 1fr; }
  .cat-card { padding: 14px; }
  .cat-card p { min-height: 0; font-size: 12.3px; }
  .cat-card .ico { font-size: 19px; margin-bottom: 5px; }
  .drawer { width: 100vw; border-left: none; }
  .drawer-inner { padding: 16px 16px 48px; }
  .drawer-top { margin: -16px -16px 14px; padding: 11px 16px; }
  .topic-detail h1 { font-size: 19px; }
  .detail-body { font-size: 14.8px; }
  .to-top { right: 14px; bottom: 16px; width: 36px; height: 36px; }
  .toast { bottom: 16px; font-size: 13.3px; padding: 10px 16px; }
  .view-title { font-size: 18px; }
}
@media (max-width: 420px) {
  .cat-grid { grid-template-columns: 1fr; }
  .brand-text em { display: none; }
}
