/* ============================================================
   方块盒子论坛 —— 与官网同源的浅色绿色主题
   ============================================================ */

:root {
  --g50: #e8f5e9;
  --g100: #c8e6c9;
  --g200: #a5d6a7;
  --g300: #81c784;
  --g500: #4caf50;
  --g600: #43a047;
  --g700: #388e3c;
  --g800: #2e7d32;
  --g900: #1b5e20;

  --bg: #f6faf6;
  --bg-tint: #eef6ed;
  --card: #ffffff;
  --card-2: #fbfdfb;
  --line: #e4ece3;
  --line-2: #d3e3d2;
  --ink: #17251a;
  --ink-2: #52665a;
  --ink-3: #87998b;
  --brand: var(--g800);
  --brand-soft: rgba(46, 125, 50, 0.09);
  --brand-line: rgba(46, 125, 50, 0.22);
  --danger: #c62828;
  --danger-soft: #fdecea;
  --warn: #b26a00;
  --warn-soft: #fff5e6;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(23, 37, 26, 0.04), 0 2px 8px rgba(23, 37, 26, 0.04);
  --shadow-md: 0 6px 18px rgba(23, 37, 26, 0.07), 0 16px 40px rgba(23, 37, 26, 0.06);
  --nav-bg: rgba(246, 250, 246, 0.86);
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "HarmonyOS Sans SC", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0e1411;
  --bg-tint: #131b16;
  --card: #151d18;
  --card-2: #18211b;
  --line: #24312a;
  --line-2: #2f4038;
  --ink: #e7f0e9;
  --ink-2: #a7baac;
  --ink-3: #7d9184;
  --brand: #66bb6a;
  --brand-soft: rgba(102, 187, 106, 0.12);
  --brand-line: rgba(102, 187, 106, 0.32);
  --danger: #ef7c74;
  --danger-soft: rgba(198, 40, 40, 0.16);
  --warn: #e0a94a;
  --warn-soft: rgba(178, 106, 0, 0.16);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --nav-bg: rgba(14, 20, 17, 0.86);
  color-scheme: dark;
}

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

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

::selection { background: var(--g100); color: var(--g900); }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: 15px; color: inherit; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }

/* ---------------- 顶栏 ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner { display: flex; align-items: center; gap: 18px; height: 62px; }

.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: 0.2px; flex: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--g600), var(--g800));
  color: #fff; font-size: 16px; box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}
.brand-text { font-size: 17px; }
.brand-text small { font-size: 12px; font-weight: 600; color: var(--ink-3); margin-left: 4px; }

.nav-links { display: flex; align-items: center; gap: 4px; flex: none; }
.nav-links a {
  padding: 7px 12px; border-radius: 999px; font-size: 14.5px; font-weight: 600; color: var(--ink-2);
  transition: background 0.18s, color 0.18s; white-space: nowrap;
}
.nav-links a:hover { background: var(--brand-soft); color: var(--brand); }
.nav-links a.active { background: var(--brand-soft); color: var(--brand); }

.nav-search { margin-left: auto; display: flex; align-items: center; }
.nav-search input {
  width: 190px; height: 36px; padding: 0 12px 0 34px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--card); outline: none;
  font-size: 14px; transition: width 0.2s, border-color 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2387998b' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 11px center; background-size: 15px;
}
.nav-search input:focus { width: 240px; border-color: var(--brand-line); }

.nav-actions { display: flex; align-items: center; gap: 8px; flex: none; }

/* ---------------- 按钮 ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  font-size: 14.5px; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
  background: transparent; color: var(--ink);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--g800); color: #fff; box-shadow: 0 6px 16px rgba(46, 125, 50, 0.24); }
.btn-primary:hover { background: var(--g700); }
[data-theme="dark"] .btn-primary { background: var(--g600); color: #08210b; }
.btn-ghost { border-color: var(--line-2); background: var(--card); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--brand-line); color: var(--brand); }
.btn-danger { background: var(--card); color: var(--ink-2); border-color: var(--line-2); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-2);
  background: var(--card); color: var(--ink-2); cursor: pointer; display: grid; place-items: center;
  transition: 0.2s;
}
.icon-btn:hover { color: var(--brand); border-color: var(--brand-line); }

/* ---------------- 通用卡片 ---------------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.page { flex: 1; padding: 26px 0 56px; }

.section-head {
  display: flex; align-items: center; gap: 10px; margin: 0 0 14px;
}
.section-head h2 { font-size: 18px; font-weight: 800; letter-spacing: -0.2px; }
.section-head .more { margin-left: auto; font-size: 13.5px; color: var(--ink-3); }
.section-head .more:hover { color: var(--brand); }

.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px;
  border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--brand-soft); color: var(--brand);
}
.chip-grey { background: var(--bg-tint); color: var(--ink-2); }
.chip-danger { background: var(--warn-soft); color: var(--warn); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }

.empty {
  padding: 48px 20px; text-align: center; color: var(--ink-3); font-size: 14.5px;
}

/* ---------------- 首页 ---------------- */

.hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 30px 32px;
  background: linear-gradient(135deg, #2e7d32 0%, #43a047 52%, #7cc242 100%);
  color: #fff; box-shadow: 0 14px 34px rgba(46, 125, 50, 0.28);
}
.hero::after {
  content: ""; position: absolute; right: -70px; top: -80px; width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.28), transparent 62%);
}
.hero h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.4px; }
.hero p { margin-top: 6px; font-size: 14.5px; opacity: 0.92; max-width: 640px; }
.hero-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.hero .btn-primary { background: #fff; color: var(--g800); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16); }
.hero .btn-primary:hover { background: #f4fff4; }
.hero .btn-ghost { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.4); color: #fff; }
.hero .btn-ghost:hover { background: rgba(255, 255, 255, 0.24); color: #fff; }

.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 16px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.stat b { display: block; font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
.stat span { font-size: 12.5px; color: var(--ink-3); }

.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; margin-top: 26px; align-items: start; }
.home-grid > * { min-width: 0; }

.board-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.board-grid > * { min-width: 0; }

.board-card {
  display: flex; gap: 12px; padding: 14px 15px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.board-card:hover {
  border-color: var(--brand-line); transform: translateY(-1px); box-shadow: var(--shadow-md);
}
.board-icon {
  width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center;
  background: var(--brand-soft); font-size: 20px;
}
.board-card-body { min-width: 0; flex: 1; }
.board-card h3 { font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.board-card h3 span { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.board-card p { font-size: 13px; color: var(--ink-3); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.thread-list { display: flex; flex-direction: column; }
.thread-row {
  position: relative;
  display: flex; gap: 12px; align-items: center; padding: 11px 14px;
  border-bottom: 1px solid var(--line); transition: background 0.16s;
}
.thread-row:last-child { border-bottom: 0; }
.thread-row:hover { background: var(--card-2); }
.thread-main { min-width: 0; flex: 1; }
.thread-title {
  display: flex; align-items: center; gap: 7px; font-size: 14.5px; font-weight: 700;
  overflow: hidden; white-space: nowrap;
}
.thread-title .row-link { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-title .row-link::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
}
.thread-row:hover .row-link { color: var(--brand); }
.thread-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; overflow: hidden; white-space: nowrap; }
.thread-meta .board-tag { position: relative; z-index: 2; color: var(--brand); font-weight: 600; }
.thread-meta .dot { color: var(--line-2); }
.thread-meta .thread-snippet { overflow: hidden; text-overflow: ellipsis; }

.thread-counts { display: flex; gap: 14px; flex: none; text-align: right; }
.thread-counts div { min-width: 38px; }
.thread-counts b { display: block; font-size: 14px; font-weight: 800; line-height: 1.3; }
.thread-counts span { font-size: 11.5px; color: var(--ink-3); }

.side-card { padding: 16px; }
.side-card + .side-card { margin-top: 16px; }
.side-card h3 { font-size: 15px; font-weight: 800; margin-bottom: 10px; }
.side-list { display: flex; flex-direction: column; gap: 9px; }
.side-list a { font-size: 13.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-list a:hover { color: var(--brand); }
.tips { font-size: 13px; color: var(--ink-3); line-height: 1.9; }
.tips li { list-style: none; }
.tips li::before { content: "·"; color: var(--brand); margin-right: 6px; font-weight: 800; }

.nav-user {
  display: flex; align-items: center; gap: 7px; padding: 3px 10px 3px 3px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--card); max-width: 150px;
}
.nav-user:hover { border-color: var(--brand-line); }
.nav-username { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- 通知 ---------------- */

.nav-bell { position: relative; }
.nav-bell .badge {
  position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--g700); color: #fff; font-size: 10px; font-weight: 800;
  display: grid; place-items: center; line-height: 1;
}

.notif-list { display: flex; flex-direction: column; }
.notif-row {
  display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px;
  border-bottom: 1px solid var(--line); transition: background 0.16s;
}
.notif-row:last-child { border-bottom: 0; }
.notif-row:hover { background: var(--card-2); }
.notif-row.unread { background: var(--brand-soft); }
.notif-body { min-width: 0; flex: 1; }
.notif-actors { display: flex; align-items: center; gap: 2px; flex: none; }
.notif-actors .avatar + .avatar { margin-left: -8px; border: 2px solid var(--card); }
.notif-title { font-size: 14px; font-weight: 700; }
.notif-title a:hover { color: var(--brand); }
.notif-title .light { color: var(--ink-2); font-weight: 600; }
.notif-excerpt { font-size: 13px; color: var(--ink-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-time { font-size: 12px; color: var(--ink-3); flex: none; }
.notif-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--g600); margin-top: 16px; flex: none; }

/* ---------------- 意见反馈 ---------------- */
.feedback-tpl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.feedback-list { display: flex; flex-direction: column; }
.feedback-row { padding: 13px 16px; border-bottom: 1px solid var(--line); }
.feedback-row:last-child { border-bottom: 0; }
.feedback-head { display: flex; align-items: center; gap: 8px; }
.feedback-head .small { font-size: 12.5px; }
.feedback-content { font-size: 14px; line-height: 1.7; margin-top: 7px; word-break: break-word; }
.feedback-reply {
  margin-top: 9px; padding: 9px 12px; border-radius: 10px;
  background: var(--bg-tint); font-size: 13.5px; line-height: 1.65; color: var(--ink-2); word-break: break-word;
}
.feedback-reply b { color: var(--brand); font-size: 12.5px; margin-right: 4px; }

/* 全部反馈列表（仿 GitHub Issues 列表页） */
.fb-tabs { display: flex; gap: 4px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.fb-tab {
  border: 0; background: none; cursor: pointer; padding: 4px 12px; border-radius: 999px;
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink-2);
}
.fb-tab:hover { background: var(--bg-tint); }
.fb-tab.active { background: var(--brand-soft); color: var(--brand); }
.fb-issue { border-bottom: 1px solid var(--line); }
.fb-issue:last-child { border-bottom: 0; }
.fb-issue-head { padding: 12px 16px; cursor: pointer; }
.fb-issue-head:hover { background: var(--card-2); }
.fb-issue.expanded .fb-issue-head { background: var(--bg-tint); }
.fb-issue-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fb-issue-title { font-size: 14.5px; font-weight: 700; word-break: break-word; }
.fb-issue-meta { font-size: 12.5px; color: var(--ink-3); margin-top: 5px; }
.fb-state {
  display: inline-flex; align-items: center; height: 20px; padding: 0 10px; flex: none;
  border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff;
}
.fb-state-open { background: var(--g600); }
.fb-state-resolved { background: #8250df; }
.fb-state-ignored { background: var(--ink-3); }
.fb-issue-detail { padding: 2px 16px 14px; border-top: 1px dashed var(--line); }
.fb-issue-detail .feedback-content { margin-top: 12px; }
.fb-issue-detail .feedback-reply { margin-top: 12px; }

.feedback-admin-row { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.feedback-admin-row:last-child { border-bottom: 0; }
.feedback-admin-main { min-width: 0; flex: 1; }
.feedback-admin-content { font-size: 13.5px; line-height: 1.65; margin-top: 6px; word-break: break-word; white-space: pre-wrap; }
.feedback-admin-meta { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.feedback-admin-actions { display: flex; flex-direction: column; gap: 6px; flex: none; width: 210px; }
.feedback-admin-actions .input { height: 32px; padding: 0 10px; font-size: 13px; }
.feedback-admin-actions .btn-row { display: flex; gap: 6px; }
.feedback-admin-actions .btn-row .btn { flex: 1; }

/* ---------------- 标签 / 点赞 / 收藏 ---------------- */

.tag {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px;
  font-size: 11.5px; font-weight: 700; color: var(--brand); background: var(--brand-soft);
  position: relative; z-index: 2;
}
.tag:hover { background: var(--brand-line); }

.post-tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

.post-actions button.liked, .child-actions button.liked { color: var(--brand); font-weight: 800; }
.bookmark-btn.active { color: var(--brand); border-color: var(--brand-line); background: var(--brand-soft); }

/* ---------------- 楼中楼 ---------------- */

.children {
  margin-top: 16px; padding: 4px 14px 6px; background: var(--card-2);
  border: 1px solid var(--line); border-radius: 12px;
}
.child { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; border-top: 1px dashed var(--line); }
.children > .child:first-child { border-top: 0; }
.children-more { border-top: 1px dashed var(--line); }
.children-more > .child:first-child { border-top: 0; }
.child-body { min-width: 0; flex: 1; }
.child-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); flex-wrap: wrap; }
.child-head .name { font-weight: 800; color: var(--ink); font-size: 13px; }
.child-head .name:hover { color: var(--brand); }
.child-head .floor { margin-left: auto; font-variant-numeric: tabular-nums; }
.child-content { font-size: 14px; line-height: 1.8; margin-top: 4px; word-break: break-word; }
.child-content p { margin: 0 0 6px; }
.child-content p:last-child { margin: 0; }
.child-content img { max-height: 220px; }
.child-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.children-toggle {
  display: inline-flex; align-items: center; gap: 6px; margin: 2px 0 8px; padding: 6px 13px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  font-size: 12.5px; color: var(--ink-2); font-weight: 700; cursor: pointer; transition: 0.16s;
}
.children-toggle:hover { border-color: var(--brand-line); color: var(--brand); }

.reply-target {
  display: flex; align-items: center; gap: 8px; background: var(--brand-soft);
  border: 1px solid var(--brand-line); border-radius: 10px; padding: 7px 12px;
  font-size: 12.5px; color: var(--ink-2); margin-bottom: 10px;
}
.reply-target b { color: var(--ink); }
.reply-target button { margin-left: auto; border: 0; background: none; cursor: pointer; color: var(--ink-3); font-weight: 700; }
.reply-target button:hover { color: var(--danger); }

/* ---------------- @ 候选 / 灯箱 / 标签输入 ---------------- */

.mention-menu {
  position: absolute; z-index: 300; min-width: 220px; max-width: 300px; padding: 6px;
  border-radius: 12px; background: var(--card); border: 1px solid var(--line-2);
  box-shadow: var(--shadow-md);
}
.mention-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px;
  border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left;
}
.mention-item.active, .mention-item:hover { background: var(--brand-soft); }
.mention-name { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.mention-login { margin-left: auto; font-size: 12px; color: var(--ink-3); }

.lightbox {
  position: fixed; inset: 0; z-index: 400; background: rgba(10, 16, 12, 0.84);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); }
.lightbox-close {
  position: absolute; top: 18px; right: 22px; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 24px; cursor: pointer; line-height: 1;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.28); }
.post-content a.img-link { display: inline-block; max-width: 100%; }
.post-content a.img-link:hover img { opacity: 0.92; }

.tag-input-wrap {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 6px 8px; background: var(--card);
}
.tag-input-wrap:focus-within { border-color: var(--brand-line); box-shadow: 0 0 0 3px var(--brand-soft); }
.tag-input-wrap input { border: 0; outline: none; background: none; flex: 1; min-width: 120px; font-size: 14.5px; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); font-size: 12.5px; font-weight: 700;
}
.tag-chip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 13px; line-height: 1; padding: 0; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud a {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 999px;
  background: var(--bg-tint); border: 1px solid var(--line); font-size: 12.5px; font-weight: 700; color: var(--ink-2);
}
.tag-cloud a:hover { border-color: var(--brand-line); color: var(--brand); }
.tag-cloud a b { color: var(--ink-3); font-weight: 600; }

/* ---------------- 图片裁剪 ---------------- */

.crop-mask {
  position: fixed; inset: 0; z-index: 350; background: rgba(10, 16, 12, 0.62);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.crop-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 20px; width: 380px; max-width: 100%; box-shadow: var(--shadow-md);
}
.crop-card.wide { width: 480px; }
.crop-card h3 { font-size: 16px; font-weight: 800; }
.crop-card p { margin: 4px 0 12px; }
.crop-stage {
  margin: 0 auto; border-radius: 16px; overflow: hidden;
  background: #111; cursor: grab; touch-action: none;
}
.crop-stage:active { cursor: grabbing; }
.crop-stage canvas { display: block; width: 100%; height: 100%; }
.crop-zoom { width: 100%; margin: 14px 0 6px; accent-color: var(--g700); }
.crop-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

/* ---------------- 相册 ---------------- */

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.gallery-item {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card);
  display: flex; flex-direction: column;
}
.gallery-thumb { aspect-ratio: 1 / 1; background: var(--bg-tint); display: block; }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-meta { padding: 8px 10px; font-size: 12px; color: var(--ink-3); display: flex; flex-direction: column; gap: 4px; }
.gallery-actions { display: flex; gap: 6px; padding: 0 10px 10px; }
.gallery-actions button {
  flex: 1; border: 1px solid var(--line-2); background: var(--card); border-radius: 8px;
  font-size: 11.5px; font-weight: 700; padding: 5px 0; cursor: pointer; color: var(--ink-2);
  white-space: nowrap;
}
.gallery-actions button:hover { border-color: var(--brand-line); color: var(--brand); }
.gallery-actions button.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ---------------- 头像 ---------------- */

.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none; overflow: hidden;
  display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #fff;
  background: var(--g700); user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-xs { width: 22px; height: 22px; font-size: 10px; }
.avatar-sm { width: 28px; height: 28px; font-size: 12px; }
.avatar-lg { width: 76px; height: 76px; font-size: 30px; }

/* ---------------- 版块页 ---------------- */

.board-head { display: flex; gap: 16px; align-items: flex-start; padding: 20px 22px; }
.board-head .board-icon { width: 52px; height: 52px; font-size: 25px; border-radius: 14px; }
.board-head h1 { font-size: 21px; font-weight: 800; }
.board-head p { font-size: 13.5px; color: var(--ink-3); margin-top: 2px; }
.board-head .actions { margin-left: auto; display: flex; gap: 8px; flex: none; }

.toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; background: var(--bg-tint); padding: 3px; border-radius: 999px; }
.tabs a, .tabs button {
  border: 0; background: transparent; cursor: pointer; font-size: 13px; font-weight: 700;
  color: var(--ink-3); padding: 5px 13px; border-radius: 999px;
}
.tabs a.active, .tabs button.active { background: var(--card); color: var(--brand); box-shadow: var(--shadow-sm); }

/* ---------------- 主题页 ---------------- */

.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); margin-bottom: 14px; flex-wrap: wrap; }
.crumbs a:hover { color: var(--brand); }

body[data-page="thread"] .wrap { max-width: 1200px; }

/* 顶部阅读进度条 / 回到顶部 */
.read-progress {
  position: fixed; left: 0; top: 0; height: 3px; width: 0; z-index: 90;
  background: linear-gradient(90deg, var(--g600), #8bc34a);
  border-radius: 0 3px 3px 0; transition: width 0.12s linear;
}
.to-top {
  position: fixed; right: 26px; bottom: 30px; width: 44px; height: 44px; z-index: 80;
  display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink-2);
  box-shadow: var(--shadow-md); font-size: 18px; font-weight: 700;
  opacity: 0; pointer-events: none; transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s, color 0.2s, border-color 0.2s;
}
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }
.to-top:hover { color: var(--brand); border-color: var(--brand-line); }

/* 两栏布局 */
.thread-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.thread-main { min-width: 0; }
.thread-rail { position: sticky; top: 78px; display: flex; flex-direction: column; gap: 14px; }

/* 主题头 */
.thread-hero { position: relative; overflow: hidden; padding: 24px 26px 22px; }
.thread-hero::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--g700), #7cc242);
}
.thread-flags { display: flex; gap: 6px; margin-bottom: 8px; }
.thread-hero h1 {
  font-size: clamp(20px, 2.1vw, 25px); font-weight: 800; letter-spacing: -0.4px;
  line-height: 1.5; color: var(--ink); text-wrap: balance;
}
.thread-hero .meta {
  display: flex; align-items: center; gap: 10px; margin-top: 14px;
  font-size: 13px; color: var(--ink-3); flex-wrap: wrap;
}
.thread-hero .meta > * { display: inline-flex; align-items: center; gap: 6px; }
.thread-hero .meta a:hover { color: var(--brand); }
.thread-hero .meta .meta-dot { color: var(--line-2); }
.thread-hero .meta .meta-author { color: var(--ink-2); font-weight: 700; }
.thread-hero .meta .board-tag {
  height: 22px; padding: 0 10px; border-radius: 999px; font-size: 12px;
  font-weight: 700; background: var(--brand-soft); color: var(--brand);
}
.thread-hero .meta .bookmark-btn { margin-left: auto; }
.thread-hero .post-tags { margin-top: 12px; }

.floor-list { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }

.post {
  display: flex; gap: 18px; padding: 20px 22px; position: relative;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.post:hover { border-color: var(--line-2); }
.post.is-op { border-color: var(--brand-line); }

.post-side { width: 118px; flex: none; text-align: center; padding-top: 2px; }
.post-side .avatar {
  margin: 0 auto 9px; width: 52px; height: 52px; font-size: 20px;
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.post-side .name {
  display: block; font-size: 13.5px; font-weight: 800; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.post-side .name:hover { color: var(--brand); }
.post-side .role { margin-top: 4px; }
.post-side .role:empty { display: none; }
.post-side .counts {
  display: flex; flex-direction: column; gap: 1px; margin-top: 7px;
  font-size: 11.5px; color: var(--ink-3); line-height: 1.6;
}

.post-body { flex: 1; min-width: 0; }
.post-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); flex-wrap: wrap; }
.post-head .post-time { font-weight: 600; }
.post-head .floor { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.post-content { margin-top: 10px; max-width: 76ch; font-size: 15.5px; line-height: 1.9; word-break: break-word; }
.post-content p { margin: 0 0 8px; }
.post-content p:last-child { margin-bottom: 0; }
.post-content ul, .post-content ol { margin: 6px 0 10px; padding-left: 22px; }
.post-content li { margin: 2px 0; }
.post-content blockquote {
  border-left: 3px solid var(--brand-line); background: var(--bg-tint);
  padding: 8px 12px; margin: 8px 0; border-radius: 0 8px 8px 0; color: var(--ink-2);
}
.post-content code {
  font-family: var(--mono); font-size: 0.9em; background: var(--bg-tint);
  border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px;
}
.post-content pre {
  background: var(--card-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; overflow-x: auto; margin: 10px 0;
}
.post-content pre code { background: none; border: 0; padding: 0; font-size: 13px; line-height: 1.6; }
.post-content a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.post-content img {
  border-radius: 12px; border: 1px solid var(--line);
  margin: 10px 0; max-height: 460px; object-fit: contain;
}
.post-content .mention { color: var(--brand); font-weight: 700; }
.post-content h1, .post-content h2, .post-content h3 { margin: 14px 0 6px; line-height: 1.4; }
.post-content h1 { font-size: 20px; }
.post-content h2 { font-size: 18px; }
.post-content h3 { font-size: 16px; }
.post-content hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.post-content .deleted { color: var(--ink-3); font-style: italic; }

.post-actions {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line);
}
.post-actions .act-gap { flex: 1; }

/* 胶囊操作按钮：楼层、楼中楼、管理员操作共用 */
.post-actions .act, .child-actions .act, .thread-admin .act {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 30px; padding: 0 13px; border-radius: 999px;
  border: 1px solid transparent; background: var(--bg-tint); color: var(--ink-3);
  font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.post-actions .act:hover, .child-actions .act:hover, .thread-admin .act:hover {
  background: var(--brand-soft); color: var(--brand); border-color: var(--brand-line);
}
.post-actions .act.liked, .child-actions .act.liked {
  background: var(--brand-soft); color: var(--brand); border-color: var(--brand-line); font-weight: 800;
}
.post-actions .act.danger:hover, .child-actions .act.danger:hover, .thread-admin .act.danger:hover {
  background: var(--danger-soft); color: var(--danger); border-color: var(--danger);
}
.act .act-ico { font-size: 12px; line-height: 1; }

.thread-admin { margin-top: 14px; padding-top: 0; border-top: 0; }
.thread-admin .act { height: 28px; padding: 0 11px; font-size: 12px; }

.edit-actions { display: flex; gap: 8px; margin-top: 10px; }

.post.flash { animation: post-flash 2.4s ease; }
@keyframes post-flash {
  0%, 100% { background: var(--card); }
  15%, 45% { background: var(--brand-soft); }
}

/* ---------------- 主题右侧栏 ---------------- */

.rail-card { padding: 16px 18px; }
.rail-title {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  font-size: 13px; font-weight: 800; color: var(--ink-2); letter-spacing: 0.02em;
}
.rail-title::before {
  content: ""; width: 3px; height: 13px; border-radius: 2px; background: var(--g600);
}
.rail-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.rail-stats > div { padding: 9px 12px; border-radius: 10px; background: var(--bg-tint); }
.rail-stats b {
  display: block; font-size: 17px; font-weight: 800; line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
.rail-stats span { font-size: 11.5px; color: var(--ink-3); }

.rail-info { display: flex; flex-direction: column; gap: 9px; font-size: 12.5px; }
.rail-info .row { display: flex; align-items: baseline; gap: 10px; }
.rail-info .k { flex: none; width: 52px; color: var(--ink-3); }
.rail-info .v { min-width: 0; color: var(--ink-2); font-weight: 600; overflow-wrap: anywhere; }
.rail-info .v a:hover { color: var(--brand); }
.rail-note {
  margin-top: 12px; padding: 8px 10px; border-radius: 8px;
  background: var(--warn-soft); color: var(--warn); font-size: 12px; line-height: 1.6;
}
.rail-share {
  width: 100%; margin-top: 14px; height: 34px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink-2);
  font-size: 12.5px; font-weight: 700; transition: 0.16s;
}
.rail-share:hover { border-color: var(--brand-line); color: var(--brand); background: var(--brand-soft); }

.rail-list { display: flex; flex-direction: column; }
.rail-thread { display: block; padding: 9px 0; border-top: 1px dashed var(--line); }
.rail-thread:first-child { padding-top: 0; border-top: 0; }
.rail-thread .t {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 13px; font-weight: 600; line-height: 1.6; color: var(--ink-2);
}
.rail-thread:hover .t { color: var(--brand); }
.rail-thread .m { display: block; margin-top: 2px; font-size: 11.5px; color: var(--ink-3); }
.rail-empty { font-size: 12.5px; color: var(--ink-3); padding: 2px 0 4px; }

.rail-tips { font-size: 12.5px; color: var(--ink-3); line-height: 1.9; }
.rail-tips li { list-style: none; }
.rail-tips li::before { content: "✓"; margin-right: 6px; color: var(--g600); font-weight: 700; }

/* ---------------- 编辑器 ---------------- */

.composer { margin-top: 16px; padding: 20px 22px 18px; }
.composer h3 { font-size: 15px; font-weight: 800; margin-bottom: 10px; }
.composer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.composer-head h3 { margin: 0; }
.composer-head .avatar { box-shadow: 0 0 0 3px var(--brand-soft); }
.composer-hint { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.field label .req { color: var(--danger); }
.input, .textarea, .select {
  width: 100%; border: 1px solid var(--line-2); background: var(--card); border-radius: var(--radius-sm);
  padding: 10px 12px; outline: none; transition: border-color 0.18s, box-shadow 0.18s; font-size: 15px;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--brand-line); box-shadow: 0 0 0 3px var(--brand-soft);
}
.textarea { resize: vertical; min-height: 130px; line-height: 1.75; }
.textarea-lg { min-height: 260px; }
.input-hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.form-error {
  background: var(--danger-soft); color: var(--danger); border-radius: 8px;
  padding: 9px 12px; font-size: 13.5px; margin-bottom: 12px;
}
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }
.composer-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.composer-foot .muted { margin-right: auto; font-size: 12px; }
.composer-foot .composer-count {
  font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}

/* Markdown 编辑器：工具栏 + 编辑/预览 */
.md-editor { display: flex; flex-direction: column; gap: 8px; }
.md-toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 2px;
  border: 1px solid var(--line); background: var(--card-2); border-radius: var(--radius-sm);
  padding: 4px 6px;
}
.md-toolbar button {
  border: 1px solid transparent; background: transparent; color: var(--ink-2);
  height: 28px; padding: 0 9px; border-radius: 8px; font-size: 12.5px; cursor: pointer;
  line-height: 1; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.md-toolbar button:hover { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-line); }
.md-toolbar .md-strong { font-weight: 800; }
.md-toolbar .md-em { font-style: italic; font-family: Georgia, "Times New Roman", serif; font-weight: 700; }
.md-toolbar .md-strike { text-decoration: line-through; }
.md-toolbar .md-code { font-family: var(--mono); font-size: 12px; }
.md-mode {
  display: flex; gap: 2px; background: var(--bg-tint); padding: 3px;
  border-radius: 999px; margin-left: auto;
}
.md-mode button {
  height: 24px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 700;
  color: var(--ink-3);
}
.md-mode button.active { background: var(--card); color: var(--brand); box-shadow: var(--shadow-sm); }
.md-mode button:hover { border-color: transparent; background: transparent; color: var(--brand); }
.md-mode button.active:hover { background: var(--card); }
.md-preview {
  border: 1px solid var(--line-2); background: var(--card); border-radius: var(--radius-sm);
  padding: 12px 14px; min-height: 130px; max-height: 480px; overflow-y: auto;
  font-size: 15px; word-break: break-word;
}
.md-preview:empty::before { content: "还没有内容，切回「编辑」写两句吧"; color: var(--ink-3); font-size: 13.5px; }

/* ---------------- 登录 ---------------- */

.auth-wrap { max-width: 430px; margin: 24px auto; }
.auth-card { padding: 26px 26px 22px; }
.auth-card h1 { font-size: 21px; font-weight: 800; }
.auth-card > p { font-size: 13.5px; color: var(--ink-3); margin-top: 4px; margin-bottom: 18px; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 18px; background: var(--bg-tint); padding: 4px; border-radius: 12px; }
.auth-tabs button {
  flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 9px;
  font-size: 14px; font-weight: 700; color: var(--ink-3); cursor: pointer;
}
.auth-tabs button.active { background: var(--card); color: var(--brand); box-shadow: var(--shadow-sm); }
.auth-note { text-align: center; font-size: 12.5px; color: var(--ink-3); margin-top: 16px; }

/* ---------------- 用户页 ---------------- */

.profile-card { padding: 0; display: block; overflow: hidden; }
.profile-cover {
  /* 与上传时的裁剪比例一致：3:1 横图整张完整显示，不再被上下切掉 */
  position: relative; aspect-ratio: 3 / 1; overflow: hidden;
  background:
    radial-gradient(circle at 18% 30%, rgba(255, 255, 255, 0.22), transparent 42%),
    linear-gradient(118deg, var(--g700) 0%, var(--g500) 48%, var(--g800) 100%);
}
.profile-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-cover-hint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.72); font-size: 13px; letter-spacing: 0.4px;
}
.profile-cover-action {
  position: absolute; right: 12px; bottom: 12px; cursor: pointer;
  background: rgba(0, 0, 0, 0.42); color: #fff; border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 600;
  backdrop-filter: blur(6px);
}
.profile-cover-action:hover { background: rgba(0, 0, 0, 0.62); }
.profile-body { padding: 22px; display: flex; gap: 18px; align-items: flex-start; }
.profile-body .info { flex: 1; min-width: 0; }
.profile-card h1 { font-size: 21px; font-weight: 800; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-card .uname { font-size: 13px; color: var(--ink-3); margin-top: 1px; }
.profile-card .bio { font-size: 14px; color: var(--ink-2); margin-top: 8px; white-space: pre-wrap; }
.profile-stats { display: flex; gap: 20px; margin-top: 12px; font-size: 13px; color: var(--ink-3); }
.profile-stats b { color: var(--ink); font-size: 15px; }
.profile-actions { display: flex; gap: 8px; flex: none; }

/* ---------------- 管理后台 ---------------- */

.admin-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.admin-section { margin-top: 18px; padding: 16px 18px; }
.admin-section h2 { font-size: 16px; font-weight: 800; margin-bottom: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 12px; color: var(--ink-3); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.table .nowrap { white-space: nowrap; }
.admin-form { display: grid; grid-template-columns: 1fr 1fr 2fr auto auto; gap: 8px; align-items: end; }
.admin-form .input { height: 36px; padding: 0 10px; }

/* ---------------- 分页 ---------------- */

.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 22px; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: 9px; display: grid; place-items: center;
  font-size: 13.5px; font-weight: 700; border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
}
.pagination a:hover { border-color: var(--brand-line); color: var(--brand); }
.pagination .current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .disabled { opacity: 0.45; pointer-events: none; }

/* ---------------- 提示条 / 骨架 ---------------- */

.toast-stack { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  padding: 10px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 700;
  background: rgba(23, 37, 26, 0.92); color: #fff; box-shadow: var(--shadow-md);
  animation: toast-in 0.22s ease;
}
.toast-error { background: var(--danger); }
.toast-ok { background: var(--g800); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.skeleton { color: var(--ink-3); padding: 40px; text-align: center; font-size: 14px; }

.notice {
  background: var(--warn-soft); color: var(--warn); border: 1px solid rgba(178, 106, 0, 0.25);
  border-radius: 10px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 16px;
}

/* ---------------- 页脚 ---------------- */

.footer { border-top: 1px solid var(--line); padding: 22px 0; margin-top: auto; }
.footer-inner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--ink-3); }
.footer-inner .links { display: flex; gap: 14px; margin-left: auto; }
.footer-inner a:hover { color: var(--brand); }

/* ---------------- 移动端 ---------------- */

@media (max-width: 900px) {
  .home-grid { grid-template-columns: 1fr; }
  .board-grid { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-form { grid-template-columns: 1fr 1fr; }
  .thread-layout { grid-template-columns: 1fr; }
  .thread-rail { position: static; }
  .nav-search input { width: 150px; }
  .brand-text small { display: none; }
}

@media (max-width: 720px) {
  .wrap { padding: 0 14px; }
  .topbar-inner { gap: 8px; }
  .nav-actions { gap: 6px; }
  .nav-user { padding: 3px; }
  .nav-username { display: none; }
  .brand-text { font-size: 15.5px; }
  .nav-links { display: none; }
  .nav-search { display: none; }
  .brand-text small { display: none; }
  .hero { padding: 22px; }
  .hero h1 { font-size: 21px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .thread-counts { display: none; }
  .floor-list { gap: 10px; margin-top: 10px; }
  .post { flex-direction: column; gap: 10px; padding: 16px; }
  .post-side { width: auto; text-align: left; display: flex; align-items: center; gap: 10px; }
  .post-side .avatar { margin: 0; width: 34px; height: 34px; font-size: 15px; box-shadow: none; }
  .post-side .counts { display: none; }
  .post-side .role:empty { display: none; }
  .post-content { font-size: 15px; line-height: 1.85; margin-top: 8px; }
  .post-actions { margin-top: 12px; padding-top: 10px; gap: 4px; }
  .post-actions .act, .child-actions .act { height: 27px; padding: 0 9px; font-size: 12px; }
  .post-actions .act-gap { display: none; }
  .thread-hero { padding: 18px 16px; }
  .thread-hero h1 { font-size: 19px; }
  .thread-hero .meta { gap: 8px; font-size: 12.5px; margin-top: 12px; }
  .thread-hero .meta .meta-dot { display: none; }
  .composer { padding: 16px; }
  .composer-hint { margin-left: 0; width: 100%; }
  .md-toolbar button { padding: 0 7px; }
  .md-mode { margin-left: 0; width: 100%; justify-content: center; }
  .reply-target { font-size: 12px; }
  .to-top { right: 14px; bottom: 20px; width: 40px; height: 40px; }
  .board-head { flex-wrap: wrap; }
  .board-head .actions { margin-left: 0; width: 100%; }
  .profile-body { flex-direction: column; }
  .profile-actions { width: 100%; }
  .footer-inner .links { margin-left: 0; }
  .admin-grid { grid-template-columns: 1fr 1fr; }
  .admin-form { grid-template-columns: 1fr; }
  .table { display: block; overflow-x: auto; }
}

/* ============================================================
   入站答题页
   ============================================================ */

.quiz-card { max-width: 720px; margin: 0 auto; }
.quiz-card h3 { margin-bottom: 6px; }
.quiz-rules { margin: 12px 0 16px; padding: 0; list-style: none; color: var(--ink-2); font-size: 13.5px; }
.quiz-rules li { padding: 5px 0 5px 22px; position: relative; }
.quiz-rules li::before { content: "✓"; position: absolute; left: 2px; color: var(--g600); font-weight: 700; }
.quiz-progress { height: 8px; background: var(--bg-tint); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.quiz-progress > i { display: block; height: 100%; width: 0; background: var(--g600); border-radius: 999px; transition: width 0.2s ease; }
.quiz-progress-label { margin: 8px 0 2px; font-size: 12.5px; color: var(--ink-3); }
.quiz-q { margin: 12px 0 14px; font-size: 16.5px; font-weight: 600; line-height: 1.6; }
.quiz-opts { display: grid; gap: 10px; }
.quiz-opt { text-align: left; padding: 12px 14px; border: 1.5px solid var(--line-2); border-radius: var(--radius-sm); background: var(--card-2); cursor: pointer; font: inherit; color: var(--ink); line-height: 1.55; }
.quiz-opt:hover:not(:disabled) { border-color: var(--g500); background: var(--g50); }
.quiz-opt:disabled { cursor: default; opacity: 0.72; }
.quiz-opt-correct { border-color: var(--g600); background: var(--g50); opacity: 1; }
.quiz-opt-wrong { border-color: var(--danger); background: var(--danger-soft); opacity: 1; }
.quiz-explain { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg-tint); border: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2); line-height: 1.6; }
.quiz-score { font-size: 46px; font-weight: 700; line-height: 1.2; color: var(--brand); }
.quiz-foot { margin-top: 18px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ============================================================
   好友与私信
   ============================================================ */

.friends-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  min-height: 560px;
}
.friends-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.friends-list { flex: 1; overflow-y: auto; padding: 8px; min-height: 380px; max-height: calc(100vh - 220px); }

.friends-list .fr-row:last-child { border-bottom: 0; }
.fr-row {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border-bottom: 1px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.15s;
}
.fr-row:hover { background: var(--card-2); }
.fr-row.active { background: var(--brand-soft); }
.fr-main { flex: 1; min-width: 0; }
.fr-top { display: flex; align-items: center; gap: 6px; }
.fr-name {
  font-weight: 600; font-size: 14px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fr-online {
  width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); flex: none;
}
.fr-online.on { background: var(--g500); box-shadow: 0 0 0 3px var(--brand-soft); }
.fr-badge {
  flex: none; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--g600); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; line-height: 1;
}
.fr-time { margin-left: auto; flex: none; font-size: 12px; color: var(--ink-3); }
.fr-preview {
  font-size: 13px; color: var(--ink-3); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fr-row.active .fr-preview { color: var(--ink-2); }
.fr-actions { display: flex; gap: 6px; flex: none; }
.fr-search { padding: 8px; }
.fr-search .input { width: 100%; }
.tab-dot {
  display: inline-block; width: 7px; height: 7px; margin-left: 5px; border-radius: 50%;
  background: var(--g600); vertical-align: 2px;
}

/* ---------------- 聊天面板 ---------------- */

.chat-panel {
  display: flex; flex-direction: column; overflow: hidden;
  max-height: calc(100vh - 220px); min-height: 420px;
}
.chat-empty {
  flex: 1; display: grid; place-items: center; color: var(--ink-3); font-size: 14px;
}
.chat-main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); background: var(--card-2);
}
.chat-head-name { font-weight: 700; font-size: 14.5px; line-height: 1.4; }
.chat-head-status { font-size: 12px; color: var(--ink-3); line-height: 1.4; }
.chat-head-actions { margin-left: auto; display: flex; gap: 8px; }
.chat-more { padding: 8px 16px 0; text-align: center; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg-row { display: flex; align-items: flex-end; gap: 8px; }
.msg-row.mine { flex-direction: row-reverse; }
.msg-body { display: flex; flex-direction: column; max-width: 72%; }
.msg-row.mine .msg-body { align-items: flex-end; }
.msg-bubble {
  padding: 8px 12px; border-radius: 14px; font-size: 14px; line-height: 1.6;
  background: var(--bg-tint); border: 1px solid var(--line); color: var(--ink);
  white-space: pre-wrap; word-break: break-word;
}
.msg-row.mine .msg-bubble {
  background: var(--brand-soft); border-color: var(--brand-line); color: var(--ink);
}
.msg-time { margin-top: 3px; font-size: 11.5px; color: var(--ink-3); padding: 0 2px; }
.chat-composer {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 12px 16px; border-top: 1px solid var(--line); background: var(--card-2);
}
.chat-composer .textarea { flex: 1; resize: none; min-height: 44px; max-height: 140px; }

@media (max-width: 860px) {
  .friends-layout { grid-template-columns: 1fr; }
  .friends-list { max-height: 300px; min-height: 0; }
  .chat-panel { min-height: 380px; max-height: none; }
}

/* ---------------- 聊天增强：图片 / 引用 / 撤回 / 表情 ---------------- */

.chat-composer { position: relative; }

.chat-tool {
  border: 0; background: transparent; cursor: pointer;
  width: 36px; height: 38px; border-radius: 10px; font-size: 18px; flex: none;
}
.chat-tool:hover { background: var(--bg-tint); }

.msg-text { white-space: pre-wrap; word-break: break-word; }
.msg-quote {
  font-size: 12px; color: var(--ink-3); border-left: 2px solid var(--line-2);
  padding: 1px 0 1px 8px; margin-bottom: 4px; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.msg-image {
  max-width: 220px; max-height: 180px; border-radius: 10px; display: block;
  cursor: zoom-in; border: 1px solid var(--line);
}
.msg-caption { font-size: 13px; margin-top: 4px; }
.msg-withdrawn {
  text-align: center; font-size: 11.5px; color: var(--ink-3);
  padding: 2px 10px;
}
.msg-row.mine .msg-withdrawn { text-align: right; padding-right: 2px; }

.msg-actions {
  display: flex; flex-direction: column; gap: 2px; align-self: center;
  opacity: 0; transition: opacity 0.15s;
}
.msg-row:hover .msg-actions { opacity: 1; }
.msg-actions button {
  border: 1px solid var(--line-2); background: var(--card); cursor: pointer;
  border-radius: 6px; width: 24px; height: 24px; font-size: 12px;
  color: var(--ink-2); display: grid; place-items: center; padding: 0;
}
.msg-actions button:hover { color: var(--brand); border-color: var(--brand-line); }

.chat-reply {
  display: flex; align-items: center; gap: 8px; padding: 6px 16px;
  border-top: 1px solid var(--line); background: var(--card-2);
  font-size: 12.5px; color: var(--ink-2);
}
.chat-reply-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.emoji-panel {
  position: absolute; bottom: 58px; left: 10px;
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 12px;
  padding: 6px; box-shadow: var(--shadow-md); z-index: 60;
}
.emoji-panel button {
  border: 0; background: transparent; font-size: 17px; cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px; line-height: 1;
}
.emoji-panel button:hover { background: var(--bg-tint); }

/* ============================================================
   通用居中弹窗（禁言弹窗等）
   ============================================================ */

body.modal-open { overflow: hidden; }

.modal-mask {
  position: fixed; inset: 0; z-index: 360; background: rgba(10, 16, 12, 0.62);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: modal-fade 0.16s ease;
}
.modal-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px; width: 420px; max-width: 100%; max-height: calc(100vh - 40px); overflow-y: auto;
  box-shadow: var(--shadow-md); animation: modal-in 0.18s ease;
}
.modal-card h3 { font-size: 16px; font-weight: 800; }
.modal-card > p { margin: 4px 0 16px; }
.modal-card .field:last-of-type { margin-bottom: 0; }
.modal-error { color: var(--danger); font-size: 13px; margin-top: 10px; }
.modal-error:empty { display: none; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.check-row label {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--ink-2);
}
.check-row input { accent-color: var(--g700); width: 15px; height: 15px; cursor: pointer; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.modal-actions [data-act="clear"] { margin-right: auto; color: var(--danger); }
.modal-actions [data-act="clear"]:hover { background: var(--danger-soft); border-color: transparent; }

@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

@media (max-width: 720px) {
  .modal-mask { padding: 14px; align-items: flex-start; padding-top: 60px; }
  .modal-card { padding: 18px; }
  .modal-actions [data-act="clear"] { margin-right: 0; }
}

/* 个人主页上的禁言提示 */
.mute-note {
  margin-top: 10px; padding: 9px 12px; border-radius: 10px; font-size: 13px;
  background: var(--warn-soft); color: var(--warn); border: 1px solid rgba(178, 106, 0, 0.25);
  line-height: 1.6;
}

