/* ============================================================
   AI 社区 · 设计系统（企业级极简）
   原则：中性色为主 · 单一强调色 · 细边框 · 克制留白 · 层级清晰
   ============================================================ */
:root {
  /* 品牌（唯一强调色，克制使用） */
  --brand: #5a5fd6;
  --brand-hover: #4f54c4;
  --brand-soft: rgba(90, 95, 214, .1);
  --brand-ring: rgba(90, 95, 214, .22);

  /* 间距（8pt 网格） */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;

  /* 圆角（克制，偏小） */
  --r-xs: 6px; --r-sm: 8px; --r-md: 10px; --r-lg: 12px; --r-full: 999px;

  /* 字号 */
  --fs-xs: 11px; --fs-sm: 12px; --fs-md: 13.5px; --fs-base: 14.5px;
  --fs-lg: 16px; --fs-xl: 18px; --fs-2xl: 21px;

  /* 动效 */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --dur: .15s;

  /* 字体 */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Fira Code", ui-monospace, Consolas, "Courier New", monospace;
}

/* ============ 主题 ============ */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d11;
  --surface: #12151a;
  --surface-2: #191d23;
  --surface-3: #20252c;
  --border: #262b33;
  --border-soft: #1c2128;
  --text: #eceff4;
  --text-2: #9aa3b0;
  --text-3: #667080;
  --code-bg: #0d0f13;
  --header: rgba(11, 13, 17, .82);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 10px 30px rgba(0,0,0,.4);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f1f2f5;
  --surface-3: #e8eaee;
  --border: #e3e5ea;
  --border-soft: #eceef2;
  --text: #171a20;
  --text-2: #5a606b;
  --text-3: #98a0ad;
  --code-bg: #0d0f13;
  --header: rgba(255,255,255,.85);
  --shadow-sm: 0 1px 2px rgba(20,30,60,.05);
  --shadow-md: 0 10px 30px rgba(20,30,60,.1);
}

/* ============ 基础 ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: var(--fs-base);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; display: block; }
input, textarea, select { font-family: inherit; }
::selection { background: var(--brand-ring); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 布局骨架 ============ */
.app { display: grid; grid-template-rows: auto 1fr; min-height: 100dvh; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: var(--header);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--border-soft);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 10px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
}
.brand-mark svg { width: 17px; height: 17px; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.2px; }
.brand-sub { display: none; }

.topbar-search {
  flex: 1; max-width: 440px; margin: 0 auto;
  display: flex; align-items: center; gap: 9px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 7px 12px;
  color: var(--text-3); transition: border-color var(--dur) var(--ease);
}
.topbar-search:focus-within { border-color: var(--brand); }
.topbar-search svg { width: 15px; height: 15px; flex: none; }
.topbar-search input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 13.5px; }
.topbar-search input::placeholder { color: var(--text-3); }
.topbar-search kbd {
  font-family: var(--font); font-size: 10.5px; color: var(--text-3);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 5px; padding: 0 5px; flex: none;
}
.topbar-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.icon-btn {
  position: relative; width: 34px; height: 34px; border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--text-2);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.has-dot::after {
  content: ""; position: absolute; top: 7px; right: 8px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand); border: 2px solid var(--bg);
}
.i-sun { display: none; }
[data-theme="light"] .i-moon { display: none; }
[data-theme="light"] .i-sun { display: block; }

/* 头像 */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  overflow: hidden; border: 1px solid var(--border); flex: none;
  font-weight: 600; color: #fff; font-size: 13px; user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-md { width: 34px; height: 34px; }
.avatar-sm { width: 28px; height: 28px; font-size: 11.5px; }
.avatar-lg { width: 64px; height: 64px; font-size: 24px; }
.avatar-ring { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border); }

/* 侧栏 */
.sidebar {
  display: none;
  position: sticky; top: 51px; align-self: start;
  height: calc(100dvh - 51px); overflow-y: auto;
  padding: var(--sp-5) var(--sp-3); gap: var(--sp-5); flex-direction: column;
  border-right: 1px solid var(--border-soft);
}
.side-nav { display: flex; flex-direction: column; gap: 1px; }
.side-label {
  font-size: 10.5px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .7px; padding: 2px 10px 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r-sm); color: var(--text-2);
  font-weight: 500; font-size: 13.5px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); }
.nav-ic { width: 18px; display: grid; place-items: center; }
.nav-ic svg { width: 17px; height: 17px; }
.side-cta { margin: 2px 6px 0; font-size: 13.5px; gap: 7px; padding: 9px; }
.side-cta svg { width: 15px; height: 15px; }
.side-board .dot { width: 7px; height: 7px; border-radius: 2px; flex: none; }

/* 主内容 */
.main {
  max-width: 1180px; width: 100%; margin: 0 auto;
  padding: var(--sp-5) 16px 96px;
  animation: viewIn .22s var(--ease);
}
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 底部导航 */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  display: flex; align-items: stretch; justify-content: space-around;
  background: var(--header); backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-top: 1px solid var(--border-soft);
  padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 5px 0; color: var(--text-3); font-size: 10.5px; border-radius: var(--r-sm);
  transition: color var(--dur) var(--ease);
}
.tab-ic { width: 22px; height: 22px; display: grid; place-items: center; }
.tab-ic svg { width: 21px; height: 21px; }
.tab-lb { font-weight: 500; }
.tab.active { color: var(--brand); }
.tab.active .tab-ic svg { stroke-width: 2.1; }
.tab-fab { justify-content: center; }
.fab {
  width: 48px; height: 48px; border-radius: var(--r-md);
  background: var(--brand); color: #fff;
  display: grid; place-items: center; margin-top: -22px;
  border: 3px solid var(--bg); transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.fab:hover { background: var(--brand-hover); }
.fab:active { transform: scale(.95); }
.fab svg { width: 22px; height: 22px; }

/* ============ 通用组件 ============ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin: 2px 0 var(--sp-4); gap: var(--sp-3); }
.h-title { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.4px; }
.h-sub { font-size: var(--fs-sm); color: var(--text-3); margin-top: 2px; }

/* 分段筛选 */
.segmented {
  display: inline-flex; gap: 2px; padding: 2px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); margin-bottom: var(--sp-4);
}
.segmented .chip {
  padding: 5px 14px; border-radius: 6px;
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
  transition: all var(--dur) var(--ease); white-space: nowrap;
}
.segmented .chip.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* 卡片（边框主导，无阴影、无上浮） */
.card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); padding: var(--sp-4); margin-bottom: var(--sp-3);
  transition: border-color var(--dur) var(--ease);
}
.card.hoverable:hover { border-color: var(--border); }

/* 徽标（中性） */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: var(--r-xs);
  font-size: 11px; font-weight: 500; letter-spacing: .2px;
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border-soft); flex: none;
}

/* 标签 */
.tag {
  display: inline-flex; padding: 2px 9px; border-radius: var(--r-xs);
  background: var(--surface-2); color: var(--text-2);
  font-size: 11.5px; font-weight: 500;
  transition: color var(--dur) var(--ease);
}
.tag:hover { color: var(--brand); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--r-sm); font-weight: 500; font-size: 13.5px;
  background: var(--brand); color: #fff;
  transition: background var(--dur) var(--ease);
}
.btn:hover { background: var(--brand-hover); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { background: var(--surface-2); }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: var(--sp-2); }
.btn svg { width: 15px; height: 15px; }

/* ============ 帖子卡片 ============ */
.post-card { padding: 0; overflow: hidden; }
.post-body { padding: var(--sp-4); }
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.post-meta { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.post-author { font-size: 13px; font-weight: 600; white-space: nowrap; }
.post-sub { font-size: 12px; color: var(--text-3); }
.post-title { font-size: var(--fs-base); font-weight: 600; line-height: 1.45; margin-bottom: 6px; letter-spacing: -.15px; }
.post-title a { transition: color var(--dur) var(--ease); }
.post-title a:hover { color: var(--brand); }
.post-excerpt {
  font-size: var(--fs-md); color: var(--text-2); margin-bottom: var(--sp-3);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--sp-3); }
.post-foot {
  display: flex; align-items: center; gap: 2px; padding-top: var(--sp-3);
  border-top: 1px solid var(--border-soft); color: var(--text-3); font-size: 12.5px;
}
.act {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 9px; border-radius: var(--r-xs); color: var(--text-3);
  font-size: 12.5px; font-weight: 500; transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.act:hover { background: var(--surface-2); color: var(--text); }
.act svg { width: 15px; height: 15px; }
.act.liked { color: var(--brand); }
.act.liked svg { fill: var(--brand); stroke: var(--brand); }
.act.booked { color: var(--brand); }
.act.booked svg { fill: var(--brand); stroke: var(--brand); }
.post-foot .spacer { flex: 1; }

/* ============ 分组版块导航 ============ */
.group-card { padding: var(--sp-5) var(--sp-4); margin-bottom: var(--sp-4); }
.group-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--sp-4); }
.group-title { font-size: var(--fs-base); font-weight: 600; letter-spacing: -.2px; }
.group-count { font-size: 12px; color: var(--text-3); }
.board-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3) var(--sp-3); }
.board-item {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 8px; margin: -8px; border-radius: var(--r-sm); cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.board-item:hover { background: var(--surface-2); }
.board-item:active { opacity: .8; }
.bicon {
  width: 40px; height: 40px; border-radius: var(--r-sm); flex: none;
  display: grid; place-items: center; color: #fff;
  font-weight: 600; font-size: 16px;
}
.board-item-text { min-width: 0; display: flex; flex-direction: column; }
.board-item-name { font-size: 13.5px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-item-stats { font-size: 11.5px; color: var(--text-3); margin-top: 2px; white-space: nowrap; }
/* 版块图标：扁平、低饱和单色 */
.ic-cyan   { background: #3d8ba3; }
.ic-green  { background: #3f8f6e; }
.ic-red    { background: #b05163; }
.ic-amber  { background: #a8833f; }
.ic-purple { background: #6f63ad; }
.ic-blue   { background: #4f6fa3; }
.ic-orange { background: #a87845; }
.ic-pink   { background: #a85e80; }

/* ============ 帖子详情 ============ */
.post-detail .post-title { font-size: var(--fs-xl); font-weight: 650; letter-spacing: -.3px; }
.md-body { font-size: var(--fs-base); line-height: 1.8; }
.md-body h1, .md-body h2, .md-body h3 { margin: 24px 0 10px; line-height: 1.35; letter-spacing: -.2px; }
.md-body h1 { font-size: 22px; }
.md-body h2 { font-size: 18px; }
.md-body h3 { font-size: 15.5px; }
.md-body p { margin: 12px 0; }
.md-body ul, .md-body ol { margin: 10px 0 10px 22px; }
.md-body li { margin: 5px 0; }
.md-body li::marker { color: var(--text-3); }
.md-body blockquote {
  border-left: 2px solid var(--border); padding: 8px 14px;
  background: var(--surface-2); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--text-2); margin: 14px 0;
}
.md-body code {
  font-family: var(--mono); font-size: 12.5px; background: var(--surface-2);
  padding: 1.5px 6px; border-radius: 5px; color: var(--text);
}
.md-body pre {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: var(--r-sm); overflow: hidden; margin: 14px 0;
}
.md-body pre .code-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px; background: var(--surface-3); border-bottom: 1px solid var(--border);
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
}
.md-body pre .code-head .copy-btn {
  font-family: var(--font); font-size: 11px; font-weight: 500; color: var(--text-2);
  padding: 2px 8px; border-radius: 5px; border: 1px solid var(--border);
  transition: all var(--dur) var(--ease);
}
.md-body pre .code-head .copy-btn:hover { color: var(--brand); border-color: var(--brand); }
.md-body pre code {
  background: none; padding: 13px 14px; color: #d6dbe3;
  font-size: 12.5px; line-height: 1.65; display: block; overflow-x: auto; white-space: pre;
}
.md-body table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 13px; }
.md-body th, .md-body td { border: 1px solid var(--border); padding: 8px 11px; text-align: left; }
.md-body th { background: var(--surface-2); font-weight: 600; }

/* 作者卡 */
.author-card { display: flex; align-items: center; gap: 13px; }
.author-info { flex: 1; min-width: 0; }
.author-name { font-weight: 600; font-size: 14px; }
.author-sub { font-size: 12px; color: var(--text-3); }

/* 评论区 */
.comment { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border-soft); }
.comment:last-child { border-bottom: none; }
.comment-body { flex: 1; min-width: 0; }
.comment-top { display: flex; align-items: baseline; gap: 8px; }
.comment-author { font-size: 13px; font-weight: 600; }
.comment-time { font-size: 11.5px; color: var(--text-3); }
.comment-text { font-size: var(--fs-md); margin-top: 3px; }
.comment-actions { display: flex; gap: 2px; margin-top: 7px; }
.comment-actions .act { font-size: 12px; padding: 3px 7px; }
.comment-input { display: flex; gap: 12px; padding: var(--sp-4) 0 0; }
.comment-input textarea {
  flex: 1; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 10px 13px; color: var(--text);
  font-size: 13.5px; resize: none; min-height: 42px; outline: none;
  transition: border-color var(--dur) var(--ease);
}
.comment-input textarea:focus { border-color: var(--brand); }

/* ============ 表单 ============ */
.field { margin-bottom: var(--sp-4); }
.field label { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field label .hint { font-weight: 400; color: var(--text-3); font-size: 11.5px; }
.input, .textarea, .select {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 10px 13px; color: var(--text); font-size: 14px;
  transition: border-color var(--dur) var(--ease);
}
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--brand); }
.textarea { min-height: 200px; resize: vertical; font-family: var(--mono); font-size: 13px; line-height: 1.7; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2398a0ad' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }

/* Markdown 工具栏 */
.md-toolbar {
  display: flex; gap: 2px; padding: 5px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-bottom: none; border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.md-toolbar button {
  width: 30px; height: 28px; border-radius: 6px; display: grid; place-items: center;
  color: var(--text-2); font-size: 12.5px; transition: all var(--dur) var(--ease);
}
.md-toolbar button:hover { background: var(--surface-3); color: var(--text); }
.md-toolbar + .textarea { border-radius: 0 0 var(--r-sm) var(--r-sm); }

/* AI 助手 */
.ai-assist {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 11px 13px; margin-bottom: var(--sp-4);
}
.ai-assist .ai-ic {
  width: 32px; height: 32px; border-radius: var(--r-sm); flex: none;
  background: var(--brand-soft); color: var(--brand); display: grid; place-items: center;
}
.ai-assist .ai-ic svg { width: 17px; height: 17px; }
.ai-assist-text { flex: 1; min-width: 0; }
.ai-assist-text b { font-size: 13px; display: block; font-weight: 600; }
.ai-assist-text span { font-size: 11.5px; color: var(--text-3); }
.ai-assist-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.ai-btn { padding: 5px 11px; border-radius: var(--r-xs); background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; font-weight: 500; color: var(--text-2); transition: all var(--dur) var(--ease); white-space: nowrap; }
.ai-btn:hover { color: var(--brand); border-color: var(--brand); }

/* ============ 用户主页 ============ */
.profile-hero {
  border-radius: var(--r-lg); overflow: hidden;
  background: var(--surface); border: 1px solid var(--border-soft); margin-bottom: var(--sp-3);
}
.profile-cover { height: 96px; background: var(--surface-2); border-bottom: 1px solid var(--border-soft); }
.profile-main { padding: 0 var(--sp-5) var(--sp-5); margin-top: -32px; }
.profile-main .avatar-lg { margin-bottom: 10px; }
.profile-name { font-size: var(--fs-lg); font-weight: 700; }
.profile-bio { font-size: 12.5px; color: var(--text-2); margin: 3px 0 14px; }
.profile-stats { display: flex; gap: 26px; }
.pstat b { display: block; font-size: 16px; letter-spacing: -.2px; }
.pstat span { font-size: 11.5px; color: var(--text-3); }
.profile-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: var(--sp-3); }
.ptab { padding: 9px 14px; font-size: 13px; font-weight: 500; color: var(--text-3); border-bottom: 2px solid transparent; transition: all var(--dur) var(--ease); }
.ptab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ============ 空态 / 提示 ============ */
.empty { text-align: center; color: var(--text-3); padding: 56px 20px; }
.empty .big { font-size: 40px; margin-bottom: 10px; }
.empty p { font-size: 13px; }
mark { background: rgba(90,95,214,.2); color: inherit; border-radius: 3px; padding: 0 2px; }

.toasts { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--surface-3); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 8px 16px; font-size: 12.5px; font-weight: 500;
  box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 7px;
  animation: toastIn .22s var(--ease);
}
.toast svg { width: 14px; height: 14px; color: var(--brand); }
.toast.out { animation: toastOut .2s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px) scale(.97); } }
.toast.err { border-color: var(--danger, #d0697e); color: #d0697e; }

/* ============ 加载态 / 弹窗 ============ */
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 48px 20px; color: var(--text-3); font-size: 13px; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--brand);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 120;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s var(--ease); padding: 20px;
}
.modal-mask.show { opacity: 1; }
.modal {
  width: 380px; max-width: 100%; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
  transform: translateY(10px) scale(.98); transition: transform .22s var(--ease);
}
.modal-mask.show .modal { transform: none; }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 18px; }
.modal-body { margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* 登录/注册 双标签 */
.auth-tabs {
  display: flex; gap: 2px; padding: 3px; margin-bottom: 18px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
}
.auth-tab {
  flex: 1; padding: 7px 0; border-radius: 6px; font-size: 13.5px; font-weight: 600;
  color: var(--text-2); transition: all var(--dur) var(--ease);
}
.auth-tab.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }

/* 密码显示切换 */
.pwd-wrap { position: relative; }
.pwd-wrap .input { padding-right: 52px; }
.pwd-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 12px; font-weight: 600; color: var(--text-3);
  padding: 3px 7px; border-radius: var(--r-xs); transition: color var(--dur) var(--ease);
}
.pwd-toggle:hover { color: var(--brand); }
.auth-tip { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* 顶栏小按钮 */
.btn-xs { padding: 5px 12px; font-size: 12.5px; border-radius: var(--r-xs); }

/* ---------- 新增组件 ---------- */
.av-link { display: inline-flex; flex: none; }
.av-link:hover .avatar { border-color: var(--brand); }

.section-head {
  font-size: 15px; font-weight: 700; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between;
}

.load-more { text-align: center; padding: 18px 0 4px; }
.load-end { text-align: center; padding: 18px 0 4px; font-size: 12.5px; color: var(--text-3); }

.search-meta { color: var(--text-3); margin-bottom: 14px; font-size: 13px; }

.announce-bar {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-sm); padding: 10px 14px; margin-bottom: 12px;
  font-size: 13px; color: var(--text-2);
}
.announce-bar svg { width: 16px; height: 16px; flex: none; color: var(--brand); }
.announce-bar b { color: var(--text); font-weight: 600; }

/* 楼中楼 */
.comment-reply { margin-left: 34px; padding-left: 12px; border-left: 2px solid var(--border-soft); }
.reply-hint {
  font-size: 12px; color: var(--text-3); margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px;
}
.reply-cancel {
  font-size: 11.5px; color: var(--text-3); border: 1px solid var(--border);
  padding: 1px 7px; border-radius: var(--r-xs);
}
.reply-cancel:hover { color: var(--danger); border-color: var(--danger); }

.danger-text { color: var(--danger); }
.danger-text:hover { color: var(--danger); background: rgba(208,105,126,.1); }

/* 举报选项 */
.report-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.report-opt {
  padding: 6px 13px; border-radius: var(--r-xs); font-size: 12.5px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  transition: all var(--dur) var(--ease);
}
.report-opt.active { border-color: var(--brand); color: var(--brand); background: rgba(90,95,214,.08); }

/* ---------- 媒体与上传 ---------- */
.upload-area { border: 1px dashed var(--border); border-radius: var(--r-sm); padding: 12px; transition: border-color var(--dur) var(--ease); }
.upload-area.drag { border-color: var(--brand); background: rgba(90,95,214,.05); }
.upload-trigger {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 16px; border-radius: var(--r-xs); cursor: pointer;
  color: var(--text-3); font-size: 13px; transition: color var(--dur) var(--ease);
}
.upload-trigger:hover { color: var(--brand); }
.upload-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin-top: 10px; }
.upload-list:empty { display: none; }
.upload-item {
  position: relative; aspect-ratio: 1; border-radius: var(--r-xs);
  overflow: hidden; background: var(--surface-2); border: 1px solid var(--border);
}
.upload-item img, .upload-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.upload-mask {
  position: absolute; inset: 0; background: rgba(0,0,0,.5);
  display: grid; place-items: center;
}
.upload-err {
  position: absolute; inset: 0; background: rgba(176,81,99,.9); color: #fff;
  font-size: 10.5px; padding: 6px; display: grid; place-items: center; text-align: center;
}
.upload-del {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: rgba(0,0,0,.6); color: #fff;
  font-size: 14px; line-height: 1; display: grid; place-items: center;
}
.upload-del:hover { background: var(--danger); }

.media-grid { display: grid; gap: 6px; margin: 12px 0; grid-template-columns: repeat(3, 1fr); }
.media-grid:has(> :nth-child(1):last-child) { grid-template-columns: 1fr; }
.media-grid:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, 1fr); }
.media-grid.compact { max-height: 220px; overflow: hidden; }
.media-item { display: block; border-radius: var(--r-xs); overflow: hidden; background: var(--surface-2); }
.media-item img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4/3; transition: transform var(--dur) var(--ease); }
.media-item:hover img { transform: scale(1.03); }
.media-video { margin: 12px 0; border-radius: var(--r-sm); overflow: hidden; background: #000; }
.media-video video { width: 100%; max-height: 70vh; display: block; }

.lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.92);
  display: none; align-items: center; justify-content: center; flex-direction: column; gap: 16px;
}
.lightbox img { max-width: 94vw; max-height: 86vh; object-fit: contain; }
.lightbox-close { position: absolute; top: 16px; right: 20px; font-size: 30px; color: #fff; line-height: 1; }
.lightbox-nav { display: flex; align-items: center; gap: 16px; color: #fff; font-size: 13px; }
.lightbox-nav button { color: #fff; font-size: 26px; padding: 0 8px; }
/* 通知 */
.notif {
  display: flex; gap: 10px; padding: 13px 0;
  border-bottom: 1px solid var(--border-soft);
}
.notif:last-child { border-bottom: none; }
.notif-dot {
  width: 6px; height: 6px; border-radius: 50%; flex: none;
  margin-top: 7px; background: transparent;
}
.notif.unread .notif-dot { background: var(--brand); }
.notif-text { font-size: 13.5px; }
.notif.unread .notif-text { font-weight: 500; }
.notif-time { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
#authArea { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 400px) {
  .btn-xs { padding: 5px 9px; font-size: 12px; }
}

/* ============ 响应式 ============ */
@media (max-width: 899px) { .topbar-search { display: none; } }
@media (min-width: 900px) {
  .app {
    grid-template-columns: 220px 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas: "top top" "side main";
  }
  .topbar { grid-area: top; }
  .sidebar { grid-area: side; display: flex; }
  .main { grid-area: main; padding: var(--sp-6) 24px var(--sp-10); }
  .tabbar { display: none; }
  .board-grid { grid-template-columns: repeat(3, 1fr); }
}
