/* 全站样式。颜色统一用变量，深色模式只需覆盖变量。
   三档宽度：
     ≥1081px  左侧板块栏 + 主栏 + 右侧栏
     821–1080 主栏 + 右侧栏（板块收进左上角菜单）
     ≤820px   只有主栏（手机；账号入口在页头图标和左上角菜单里） */
:root {
  --bg: #f5f6f7;
  --surface: #ffffff;
  --surface-2: #f0f2f4;
  --text: #1f2328;
  --muted: #6b7280;
  --title: #343a41;        /* 列表里未读帖子的标题：比正文略浅，粗体才不显得太重 */
  --border: #e3e5e8;
  --accent: #2f7d4f;
  --accent-text: #ffffff;
  --danger: #c0392b;
  --warn-bg: #fff6dd;
  --warn-text: #7a5a00;
  --ok-bg: #e5f5ea;
  --ok-text: #1f6b3d;
  --code-bg: #f3f4f6;
  --tint: #fffbe0;        /* 个人信息卡里数据区的底色 */
  --radius: 8px;
  --header-h: 54px;
  color-scheme: light;
}

/* 深色：跟随系统（未手动选择时），或手动选择 data-theme="dark" */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16181b; --surface: #1f2226; --surface-2: #282c31; --text: #e3e5e8; --muted: #9aa1ab; --title: #d0d4d9;
    --border: #30343a; --accent: #5fbf85; --accent-text: #10241a; --danger: #ef7b6d;
    --warn-bg: #3a3115; --warn-text: #f0d589; --ok-bg: #1c3526; --ok-text: #9ad9b1; --code-bg: #282c31; --tint: #2b2a1e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #16181b; --surface: #1f2226; --surface-2: #282c31; --text: #e3e5e8; --muted: #9aa1ab; --title: #d0d4d9;
  --border: #30343a; --accent: #5fbf85; --accent-text: #10241a; --danger: #ef7b6d;
  --warn-bg: #3a3115; --warn-text: #f0d589; --ok-bg: #1c3526; --ok-text: #9ad9b1; --code-bg: #282c31; --tint: #2b2a1e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* 不让手机浏览器按系统字体设置自动放大文字（参考 NodeSeek），各手机看到的一致；双指缩放不受影响 */
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow-wrap: anywhere;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { margin: 0 0 12px; font-size: 22px; line-height: 1.35; }
h2 { margin: 24px 0 12px; font-size: 17px; }
.muted { color: var(--muted); }
.hide { display: none !important; }
[hidden] { display: none !important; }

/* 图标：线条图形，颜色跟随文字，大小跟随字号 */
.ic {
  width: 1em; height: 1em; flex: none; vertical-align: -0.125em;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 16px; }

/* ---- 页头 ---- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; gap: 16px; min-height: var(--header-h); }
/* 宽屏（≥1081px）页头按下面三栏对齐（2026-11-18）：
   站名区宽 = 左侧板块栏（132px），导航链接的悬停底色左边 = 中间列表卡片的左边框（"框对框"，与站名对左侧栏、搜索框和主题按钮对右侧栏一致），
   搜索框 + 右侧按钮合起来宽 = 右侧栏（280px）。gap 与 .layout 的 16px 一致。
   宽屏下 .head-tools 里只显示一个主题按钮（36px），其余都是 show-sm。 */
.brand { min-width: 132px; font-size: 18px; font-weight: 700; color: var(--text); white-space: nowrap; } /* 用 min-width：站名长时导航自动往后让 */
.brand:hover { text-decoration: none; }
.show-sm { display: none !important; }

/* 页头导航：后台配置的一部分链接；放不下时可横向滑动 */
.head-nav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.head-nav::-webkit-scrollbar { display: none; }
.head-nav a { flex: none; padding: 4px 10px; border-radius: 6px; color: var(--text); }
.head-nav a:hover { text-decoration: none; background: var(--surface-2); }
.head-nav a.on { color: var(--accent); font-weight: 600; }

.search { position: relative; flex: none; width: calc(280px - 16px - 36px); } /* 右侧栏宽 - 间距 - 主题按钮 */
.search input { width: 100%; padding: 6px 34px 6px 12px; }
.search button { position: absolute; right: 2px; top: 2px; bottom: 2px; width: 32px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 17px; }
.search button:hover { color: var(--accent); }

.head-tools { display: flex; align-items: center; gap: 2px; }
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 19px; cursor: pointer;
}
.icon-btn:hover { text-decoration: none; background: var(--surface-2); color: var(--text); }
/* 主题按钮加边框，与旁边的搜索框一致，右边缘与右侧栏卡片对齐（2026-11-18）；手机上去掉，和其他图标按钮统一 */
#theme-toggle { border: 1px solid var(--border); border-radius: 6px; }
.icon-btn .dot { position: absolute; top: 1px; right: -1px; min-width: 16px; padding: 0 4px; font-size: 11px; line-height: 16px; }
.head-login { padding: 4px 8px; white-space: nowrap; }
.dot { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 12px; line-height: 18px; text-align: center; }

/* 抽屉（左上角菜单）：≥1081px 时用不到，整个隐藏 */
.drawer { display: none; }
.drawer > summary { list-style: none; }
.drawer > summary::-webkit-details-marker { display: none; }
.drawer[open] > summary::before { content: ""; position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .45); cursor: default; }
.drawer-panel {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 41; width: min(300px, 84vw); padding: 16px; overflow-y: auto;
  background: var(--surface); box-shadow: 4px 0 24px rgba(0, 0, 0, .18);
}
.drawer-user { display: none; padding-bottom: 14px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.drawer-boards { display: flex; flex-direction: column; gap: 2px; }
.drawer-boards h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; padding: 0 12px; font-size: 15px; }
body:has(.drawer[open]) { overflow: hidden; }

/* 板块链接（左侧竖排栏、抽屉共用） */
.board-side a, .drawer-boards a { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 6px; color: var(--muted); }
.board-side a:hover, .drawer-boards a:hover { text-decoration: none; background: var(--surface-2); color: var(--text); }
.board-side a.on, .drawer-boards a.on { background: var(--surface-2); color: var(--accent); font-weight: 600; }
.board-side a { padding: 4px 12px; } /* 电脑上用鼠标点，可以比抽屉里的紧凑 */
.board-side .ic, .drawer-boards a .ic { font-size: 16px; }
.board-side span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* "登录可见"板块名后面的小锁（只对游客显示） */
.lock-mark { display: inline-flex; margin-left: auto; opacity: .7; }
.board-side .lock-mark .ic, .drawer-boards a .lock-mark .ic { font-size: 13px; }
.board-side {
  position: sticky; top: calc(var(--header-h) + 16px); display: flex; flex-direction: column; gap: 2px; padding: 8px;
  max-height: calc(100vh - var(--header-h) - 32px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}

.main { flex: 1; padding-top: 16px; padding-bottom: 32px; }
.site-footer { padding: 16px 0; color: var(--muted); font-size: 13px; text-align: center; }

/* 右下角悬浮按钮（回到顶部；帖子页多一个"去回复"）。层级要低于页头，否则会盖住抽屉。 */
.float-nav { position: fixed; right: 16px; bottom: 24px; z-index: 5; display: flex; flex-direction: column; gap: 8px; }
.float-nav a {
  display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 8px; font-size: 20px;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted); box-shadow: 0 2px 8px rgba(0, 0, 0, .1); opacity: .9;
}
.float-nav a:hover { text-decoration: none; color: var(--accent); opacity: 1; }
/* 编辑器的提交按钮出现在屏幕里时收起（由 app.js 加这个类），避免手机上点错 */
body.at-editor .float-nav { display: none; }

/* ---- 通用块 ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; }
.card + .card { margin-top: 16px; }
.narrow { max-width: 460px; margin: 24px auto; }
.mid { max-width: 820px; margin-left: auto; margin-right: auto; }

.notice, .flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; }
.notice { background: var(--warn-bg); color: var(--warn-text); }
.flash { background: var(--ok-bg); color: var(--ok-text); }
.form-error { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; background: var(--warn-bg); color: var(--danger); }

.badge { display: inline-block; padding: 0 7px; border-radius: 4px; font-size: 12px; line-height: 20px; font-weight: 500; vertical-align: middle; background: var(--surface-2); color: var(--muted); }
.badge-admin { background: var(--danger); color: #fff; }
.badge-mod { background: var(--accent); color: var(--accent-text); }
.badge-danger { background: var(--danger); color: #fff; }
.badge-pin { background: var(--warn-bg); color: var(--warn-text); }
.badge-star { background: var(--ok-bg); color: var(--ok-text); }
.badge-op { background: none; color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* ---- 表单与按钮 ---- */
.form { display: flex; flex-direction: column; gap: 14px; margin: 12px 0; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; }
.form small { font-weight: 400; }
input, textarea, select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input:disabled { background: var(--surface-2); color: var(--muted); }
textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
input[type="checkbox"], input[type="radio"] { width: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 500; cursor: pointer;
  background: var(--accent); color: var(--accent-text); border: 1px solid var(--accent);
  border-radius: 6px; padding: 8px 18px;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn-sm { padding: 3px 12px; font-size: 14px; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-block { display: flex; width: 100%; }
.btn-block + .btn-block { margin-top: 8px; }
.btn:disabled { opacity: .6; cursor: default; }
.form .btn { align-self: flex-start; }
.inline { display: inline; }
.linklike { font: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; }
.linklike:hover { text-decoration: underline; }
.linklike.danger { color: var(--danger); }

/* ---- 头像（默认：首字 + 底色） ---- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 28px; height: 28px; border-radius: 6px; color: #fff; font-weight: 600; font-size: 14px; line-height: 1;
}
.avatar-md .avatar { width: 40px; height: 40px; font-size: 18px; }
.avatar-lg2 { flex: none; line-height: 0; }
.avatar-lg2:hover { text-decoration: none; }
.avatar-lg2 .avatar { width: 40px; height: 40px; font-size: 18px; border-radius: 8px; }
.avatar-lg .avatar { width: 72px; height: 72px; font-size: 32px; border-radius: 12px; }
.av-0 { background: #c0564b; } .av-1 { background: #c27a3a; } .av-2 { background: #a8892c; } .av-3 { background: #6f9a3a; }
.av-4 { background: #3f9a5e; } .av-5 { background: #2f9a8c; } .av-6 { background: #3489b3; } .av-7 { background: #4a6fc4; }
.av-8 { background: #6b5fc9; } .av-9 { background: #8e55bd; } .av-10 { background: #b34f9c; } .av-11 { background: #c04f72; }

/* ---- 个人主页 ---- */
.profile-head { display: flex; gap: 20px; align-items: flex-start; }
.profile-head h1 { margin-bottom: 4px; }
.profile-head p { margin: 4px 0; }
.bio { white-space: pre-wrap; }
.stats { display: flex; gap: 24px; flex-wrap: wrap; margin: 12px 0 0; padding: 0; list-style: none; }
.stats b { font-size: 17px; display: block; }
.stats span { color: var(--muted); font-size: 13px; }

/* ---- 三栏布局：左侧板块栏 | 主栏 | 右侧栏 ---- */
.layout { display: grid; grid-template-columns: 132px minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.layout-main { min-width: 0; }
.side .card { padding: 14px 16px; }
.side .card + .card { margin-top: 12px; }
.side .btn-block { padding: 4px 18px; }
.side h3 { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 14px; }
.side ul { margin: 0; padding: 0; list-style: none; }
.quick-links li + li { border-top: 1px solid var(--border); }
.quick-links a { display: flex; align-items: center; gap: 6px; padding: 3px 4px; color: var(--text); }
.quick-links a:hover { text-decoration: none; color: var(--accent); }
.quick-links .ic { font-size: 13px; color: var(--muted); }

/* 个人信息卡（右侧栏和抽屉共用） */
.side-user { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.side-user-main { min-width: 0; }
.side-user-name { display: block; font-size: 16px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; font-size: 13px; }
.side-actions a, .side-actions .linklike, .side-actions .done { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.side-actions a:hover, .side-actions .linklike:hover { color: var(--accent); text-decoration: none; }
.side-actions .ic { font-size: 17px; }
.user-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 10px 12px; margin-bottom: 12px; border-radius: 6px; background: var(--tint); font-size: 13px; }
.user-stats a { display: flex; align-items: center; gap: 5px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.user-stats a:hover { text-decoration: none; color: var(--accent); }
.user-stats b { color: var(--text); font-weight: 600; }

/* ---- 列表 ---- */
.list-card { padding: 0; }
.list-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 8px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
.list-head .pager { margin-left: auto; padding: 0; }
.list-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 0 1 auto; }

/* 分段按钮：新评论 / 新帖子 / 精华 */
.seg { display: inline-flex; flex: none; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg a { padding: 2px 11px; color: var(--text); }
.seg a + a { border-left: 1px solid var(--border); }
.seg a:hover { text-decoration: none; background: var(--surface-2); }
.seg a.on { background: var(--accent); color: var(--accent-text); }

.seg .dot { margin-left: 5px; min-width: 16px; padding: 0 4px; font-size: 11px; line-height: 16px; vertical-align: 1px; }

/* 签到页：顶部的签到条 + 今日签到排行榜 */
.checkin-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; padding: 20px 16px; font-size: 17px;
  background: var(--warn-bg); color: var(--warn-text); border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.checkin-bar.done { background: var(--ok-bg); color: var(--ok-text); }
.checkin-bar small { flex-basis: 100%; text-align: center; font-size: 13px; opacity: .85; }
.rank-list { margin: 0; padding: 0; list-style: none; }
.rank-list li { display: flex; align-items: center; gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--border); }
.rank-list li:last-child { border-bottom: 0; }
.rank-list li.me { background: var(--tint); }
.rank-n { flex: none; width: 30px; text-align: right; font-size: 17px; font-weight: 700; color: var(--muted); }
.rank-list li:nth-child(-n+3) .rank-n { color: var(--danger); }
.rank-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.rank-gain { margin-left: auto; flex: none; min-width: 2em; text-align: right; }

/* 通知列表 */
.notice-read { margin-left: auto; }
.notices { margin: 0; padding: 0; list-style: none; }
.notices li { display: flex; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.notices li:last-child { border-bottom: 0; }
.notices li.unread { background: var(--ok-bg); }
.notices .body { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.notices .excerpt { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.notices .excerpt:hover { text-decoration: none; color: var(--text); }

.post-list { margin: 0; padding: 0; list-style: none; }
.post-row { display: flex; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.post-row:last-child { border-bottom: 0; }
.post-row .body { flex: 1; min-width: 0; }
/* 列表要紧凑：行高比全站的 1.6 小 */
.post-line { line-height: 1.4; }
.post-title { font-size: 14px; color: var(--title); font-weight: 600; }
.post-title:visited { color: var(--muted); }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; margin-top: 2px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.post-meta a, .post-meta span { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); }
.post-meta a:hover { color: var(--accent); text-decoration: none; }
.post-meta .tag { margin-left: auto; }
.tag { padding: 0 7px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; line-height: 18px; white-space: nowrap; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }

.pager { display: flex; gap: 4px; justify-content: center; align-items: center; flex-wrap: wrap; padding: 14px; }
.pager a, .pager span { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 6px; color: var(--muted); font-size: 13px; }
.pager a:hover { text-decoration: none; background: var(--surface-2); color: var(--text); }
.pager .on { border: 1px solid var(--border); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

/* ---- 帖子页：楼主（#0）和回复都是"楼层" ---- */
.thread { padding: 0; }
.thread-title { margin: 0; padding: 18px 24px 4px; font-size: 20px; }
.floor { padding: 16px 24px; border-bottom: 1px solid var(--border); scroll-margin-top: calc(var(--header-h) + 8px); }
.floor:target { background: var(--surface-2); }
.floor-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.floor-who { flex: 1; min-width: 0; }
.floor-name { font-size: 15px; font-weight: 600; color: var(--text); margin-right: 4px; }
.floor-sub { display: flex; flex-wrap: wrap; gap: 0 12px; font-size: 12px; color: var(--muted); }
.floor-sub a { color: var(--muted); }
.floor-no { align-self: flex-start; color: var(--muted); font-size: 13px; }
.floor-count { margin: 0; padding: 10px 24px; border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 500; color: var(--muted); background: var(--surface-2); scroll-margin-top: var(--header-h); }
.sig { margin-top: 16px; padding-top: 8px; border-top: 1px dashed var(--border); color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 18px; align-items: center; margin-top: 12px; font-size: 13px; color: var(--muted); }
.actions a, .actions .linklike, .actions > span { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.actions a:hover, .actions .linklike:hover { color: var(--accent); text-decoration: none; }
.actions .on { color: var(--accent); font-weight: 600; }
.actions .on .ic { fill: currentColor; fill-opacity: .2; }
.actions .linklike.danger:hover { color: var(--danger); }
/* 操作后跳回的位置（赞、收藏、管理栏）：停在屏幕中间偏上，看起来像页面没动 */
#f0-actions, #mod-actions { scroll-margin-top: 40vh; }
.mod-actions { justify-content: flex-start; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
/* 管理栏里已经开启的标记（置顶、精华、锁定）：带勾的绿色小标签，一眼看出开了哪些；再点一次就是取消 */
.actions .linklike.flag-on { padding: 2px 8px 2px 6px; border: 1px solid var(--accent); border-radius: 999px; background: var(--ok-bg); color: var(--ok-text); font-weight: 500; }
.actions .linklike.flag-on:hover { color: var(--ok-text); border-style: dashed; }
.deleted { margin: 0; color: var(--muted); font-style: italic; }
.reply-box { padding: 20px 24px; scroll-margin-top: calc(var(--header-h) + 8px); }
.reply-box > p { margin: 0; }

/* ---- 编辑器（发帖、回帖共用） ---- */
.editor { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); overflow: hidden; box-shadow: 0 1px 4px rgba(0, 0, 0, .06); }
.editor input.ed-title { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 12px 14px; font-size: 17px; font-weight: 600; }
.editor textarea, .ed-preview { font-size: 15px; display: block; border: 0; border-radius: 0; padding: 12px 14px; min-height: 170px; background: var(--surface); }
.editor input:focus, .editor textarea:focus { outline-offset: -2px; }
.ed-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--border); }
.ed-tabs { display: flex; }
.ed-tabs button { padding: 8px 14px 6px; border: 0; border-bottom: 2px solid transparent; background: none; font: inherit; color: var(--muted); cursor: pointer; }
.ed-tabs button.on { color: var(--text); border-bottom-color: var(--text); }
.ed-hint { font-size: 13px; color: var(--muted); }
.ed-tools { display: flex; align-items: center; gap: 2px; padding: 4px 8px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.ed-tools::-webkit-scrollbar { display: none; }
.ed-tools button { flex: none; width: 32px; height: 30px; border: 0; border-radius: 6px; background: none; font: inherit; font-size: 16px; color: var(--muted); cursor: pointer; }
.ed-tools button:hover { background: var(--surface); color: var(--text); }
.ed-tools .ed-heading { flex: none; width: 46px; height: 30px; padding: 0 2px 0 6px; border: 0; border-radius: 6px; background: none; font-size: 16px; font-weight: 700; color: var(--muted); cursor: pointer; }
.ed-tools .ed-heading:hover { background: var(--surface); color: var(--text); }
.ed-tools .ed-heading option { font-weight: 400; font-size: 15px; color: var(--text); background: var(--surface); }
.ed-tools .sep { flex: none; width: 1px; height: 18px; margin: 0 5px; background: var(--border); }
.ed-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; padding: 8px 12px; border-top: 1px solid var(--border); font-size: 14px; }
.ed-foot .btn { margin-left: auto; padding: 6px 22px; }
.ed-board { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.ed-board select { width: auto; padding: 4px 8px; }
/* 没有 JS 时工具栏和预览用不了，藏起来，只留普通输入框 */
html:not(.js) .ed-bar, html:not(.js) .ed-tools { display: none; }

/* 编辑器顶上的草稿提示（app.js 插入）、发帖页给新用户的说明 */
.ed-draft { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 12px; margin-bottom: 10px; border-radius: var(--radius); background: var(--surface-2); font-size: 14px; color: var(--muted); }
.ed-draft button { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; }
.ed-draft button:hover { text-decoration: underline; }
.new-user-note { margin: 0 0 12px; font-size: 14px; }

.tips { margin-top: 20px; padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; color: var(--muted); }
.tips h3 { margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); font-size: 16px; color: var(--accent); }
.tips ul { margin: 0 0 8px; padding-left: 20px; }
.tips li { margin: 3px 0; }
.tips p { margin: 0; }

/* ---- 用户发布的内容（Markdown 渲染结果） ----
   正文比全站基础字号（14px）大一号：长文要读得舒服 */
.content { font-size: 15px; line-height: 1.75; }
.content > :first-child { margin-top: 0; }
.content > :last-child { margin-bottom: 0; }
.content p, .content ul, .content ol, .content pre, .content blockquote, .content table { margin: 0 0 12px; }
.content h1, .content h2, .content h3, .content h4 { margin: 20px 0 10px; font-size: 18px; line-height: 1.4; }
.content h1 { font-size: 21px; }
.content h3 { font-size: 16px; }
.content h4 { font-size: 15px; }
.content li > p { margin-bottom: 6px; }
.content img { max-width: 100%; height: auto; border-radius: 6px; }
.content code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; font: 13px/1.5 ui-monospace, Consolas, "Courier New", monospace; }
.content pre { background: var(--code-bg); padding: 12px 14px; border-radius: 6px; overflow-x: auto; }
.content pre code { padding: 0; background: none; }
.content blockquote { padding: 6px 14px; border-left: 3px solid var(--border); color: var(--muted); background: var(--surface-2); border-radius: 0 6px 6px 0; }
.content blockquote > :last-child { margin-bottom: 0; }
.content table { border-collapse: collapse; display: block; overflow-x: auto; }
.content th, .content td { border: 1px solid var(--border); padding: 5px 10px; }
.content hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.content ul, .content ol { padding-left: 24px; }

/* 链接预览卡片（linkpreview 模块生成）：单独一行的站外网址。左边配图，右边域名、标题、两行内的简介。
   配图按原比例完整显示（只限最大宽高）：分享图很多是很宽的 Logo，裁成固定比例会把字裁掉 */
.content .link-card { display: flex; gap: 14px; align-items: center; margin: 0 0 12px; padding: 12px 14px; max-width: 640px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; }
.content .link-card:hover { border-color: var(--accent); }
.content .link-card img { flex: none; width: auto; height: auto; max-width: 160px; max-height: 96px; object-fit: contain; border-radius: 6px; }
.link-card .lc-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.link-card .lc-site { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-card .lc-title { font-weight: 600; line-height: 1.45; color: var(--accent); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.link-card .lc-desc { font-size: 13px; line-height: 1.55; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@media (max-width: 560px) { .content .link-card img { max-width: 88px; max-height: 64px; } }

/* ---- 后台表格 ---- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 500; white-space: nowrap; }
/* 表格末尾"新建一行"前面的小标题，免得它被当成已有的一行 */
.table tr.new-head td { padding: 14px 10px 4px; border-bottom: 0; font-weight: 600; }
.table-wrap { overflow-x: auto; }
/* 全站的 overflow-wrap: anywhere 会让表格把数字、邮箱从中间断开（如 ID 19 断成两行）；表格里恢复正常断行，太宽时 .table-wrap 横向滚动 */
.table { overflow-wrap: normal; }
.table input, .table select { padding: 4px 8px; min-width: 76px; }
.table code, .table .badge { white-space: nowrap; } /* 邀请码、状态标记不折行 */
.table select[name="login_only"] { min-width: 104px; }
.table .col-num { width: 84px; }
.row-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.row-form input, .row-form select { width: auto; }
/* ---- 设置页：左边分类，右边内容；手机上分类变成顶部一行 ---- */
.settings { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 0 28px; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; padding-right: 16px; border-right: 1px solid var(--border); }
.settings-nav a { padding: 7px 10px; border-radius: 6px; color: var(--text); }
.settings-nav a:hover { text-decoration: none; background: var(--surface-2); }
.settings-nav a.on { color: var(--accent); font-weight: 600; background: var(--surface-2); }
.settings-body { max-width: 560px; }
.settings-body h1 { margin-top: 0; }
.settings-body h2 { margin-top: 28px; }
.prefs fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin: 0; }
.prefs legend { padding: 0 6px; font-weight: 600; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; padding: 4px 0; }
html.js .prefs-nojs { display: none; }
@media (max-width: 820px) {
  .settings { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .settings-nav { flex-direction: row; flex-wrap: wrap; padding: 0 0 10px; border-right: 0; border-bottom: 1px solid var(--border); }
}

.backup-new { margin: 4px 0 12px; }
.backup-where { margin: 0 0 14px; padding: 10px 14px; background: var(--surface-2); border-radius: var(--radius); font-size: 14px; }
.backup-where dt { font-weight: 600; }
.backup-where dd { margin: 4px 0 0; }
.backup-where code { background: var(--code-bg); padding: 1px 6px; border-radius: 4px; overflow-wrap: anywhere; }
/* 敏感操作的确认框（app.js 生成） */
/* 两步验证：扫码页的步骤、二维码、恢复码 */
.steps { padding-left: 20px; display: grid; gap: 14px; }
.qr { display: block; padding: 8px; border-radius: 6px; background: #fff; } /* 二维码必须是白底，深色模式下也一样 */
code.secret { font-size: 15px; } /* 允许在每组之间折行：手机上一行放不下 */
.codes { list-style: none; padding: 0; margin: 12px 0; display: grid; grid-template-columns: repeat(2, max-content); gap: 8px 28px; font-size: 16px; }
details.fold { margin: 8px 0; }
details.fold summary { cursor: pointer; color: var(--accent); }
details.fold[open] summary { margin-bottom: 8px; }
span.danger { color: var(--danger); }
dialog.sudo { width: min(420px, calc(100vw - 32px)); padding: 20px 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
dialog.sudo::backdrop { background: rgba(0, 0, 0, .45); }
dialog.sudo h2 { margin: 0; font-size: 17px; line-height: 1.5; overflow-wrap: anywhere; }
dialog.sudo .form { margin: 0; }
dialog.sudo .notice { margin: 0; }
dialog.sudo [hidden] { display: none; }
.sudo-actions { display: flex; justify-content: flex-end; gap: 8px; }
.subnav { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.subnav a.on { color: var(--text); font-weight: 600; }

/* ---- 管理后台：自己的布局（不显示前台的板块栏和侧栏）。左边分类，右边是分类里的页面标签和内容；手机上分类变成顶部一行 ---- */
.card.admin { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 0 28px; }
.admin-side { display: flex; flex-direction: column; gap: 2px; padding-right: 16px; border-right: 1px solid var(--border); }
.admin-side-title { padding: 0 10px 8px; font-size: 12px; color: var(--muted); }
.admin-side a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; color: var(--text); white-space: nowrap; }
.admin-side a .ic { color: var(--muted); }
.admin-side a:hover { text-decoration: none; background: var(--surface-2); }
.admin-side a.on { color: var(--accent); font-weight: 600; background: var(--surface-2); }
.admin-side a.on .ic { color: var(--accent); }
.admin-body { min-width: 0; }
.admin-body h1 { margin-top: 0; }
.admin-body h2 { margin-top: 28px; }
.admin-body > .subnav { gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.admin-body > .subnav a { padding: 6px 12px; margin-bottom: -1px; color: var(--muted); border-bottom: 2px solid transparent; }
.admin-body > .subnav a:hover { color: var(--text); text-decoration: none; }
.admin-body > .subnav a.on { color: var(--accent); border-bottom-color: var(--accent); }
.admin-body .form { max-width: 600px; } /* 后台变宽以后，表单不跟着拉得太长；表格照样用满宽度 */
@media (max-width: 820px) {
  .card.admin { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .admin-side { flex-direction: row; overflow-x: auto; scrollbar-width: none; padding: 0 0 10px; border-right: 0; border-bottom: 1px solid var(--border); }
  .admin-side a { flex: none; }
  .admin-side-title { display: none; }
  .admin-body > .subnav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .admin-body > .subnav a { flex: none; }
}

/* ---- 中等宽度：没有左侧板块栏，板块收进左上角菜单 ---- */
@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0, 1fr) 280px; }
  .board-side { display: none; }
  .drawer { display: block; }
  /* 没有左侧栏了，页头不再按三栏对齐，恢复原来的紧凑排法 */
  .header-inner { gap: 14px; }
  .brand { min-width: 0; }
  .search { width: 220px; }
}

/* ---- 手机 ---- */
@media (max-width: 820px) {
  :root { --header-h: 84px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; }
  .list-card, .thread { padding: 0; }
  .container { padding: 0 10px; }
  .hide-sm { display: none !important; }
  .show-sm { display: inline-flex !important; }
  /* 手机上不显示右侧栏（参考 NodeSeek）：否则它排在内容下方，回复框底下紧挨着"发帖"按钮，容易误点。
     个人信息卡改放在左上角菜单（抽屉）里，通知、搜索、发帖在页头右侧。 */
  .side { display: none; }
  .drawer-user { display: block; }
  /* 正在输入时页头不再吸顶、悬浮按钮收起，把被键盘挤小的屏幕留给输入框 */
  body:has(textarea:focus) .site-header { position: static; }
  body:has(textarea:focus) .float-nav { display: none; }
  /* 页头两行：第一行 菜单 + 站名 + 图标按钮；第二行 导航（横向滑动） */
  .header-inner { flex-wrap: wrap; gap: 0 8px; padding-top: 4px; padding-bottom: 2px; min-height: 0; }
  .brand { font-size: 17px; }
  .head-tools { margin-left: auto; }
  #theme-toggle { border: 0; border-radius: 8px; }
  .head-nav { order: 3; flex-basis: 100%; margin: 0 -4px; padding-bottom: 4px; }
  /* 字号与电脑上相同（基础 14px、小字 12px），只有列表标题大一号、要点按的几处保持 14px（2026-11-18） */
  .list-head, .actions { font-size: 14px; }
  .post-row { padding: 10px 12px; gap: 10px; }
  .post-title { font-size: 15px; }
  .post-meta { gap: 2px 8px; }
  /* 板块标签缩小一点，窄屏上尽量和作者、时间排在同一行，不单独占一行 */
  .post-meta .tag { margin-left: 0; padding: 0 5px; font-size: 11px; line-height: 16px; }
  .thread-title { padding: 16px 12px 2px; font-size: 20px; }
  .floor { padding: 14px 12px; }
  .floor-count { padding: 8px 12px; }
  .reply-box { padding: 14px 12px; }
  .actions { gap: 6px 16px; }
  .float-nav { right: 10px; bottom: 16px; }
  /* 页面底部多留一段空白：没有 JS 时悬浮按钮不会收起，留白能保证滚到底时它不压在提交按钮上 */
  .main { padding-bottom: 96px; }
  .profile-head { gap: 12px; }
  .avatar-lg .avatar { width: 56px; height: 56px; font-size: 24px; }
  input, textarea, select { font-size: 16px; } /* 避免 iOS 聚焦时自动放大页面 */
}

/* ---- 人机验证 ---- */
.captcha { display: flex; align-items: center; gap: 10px; }
.captcha input { flex: 1; min-width: 0; }
/* 验证码图片是透明底深色字，深色模式下也要垫白底才看得清 */
.captcha img { flex: none; background: #fff; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.cf-turnstile { min-height: 65px; }
/* 后台的单选项：左边圆点，右边标题 + 一行说明 */
.form label.choice { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; }
.choice input { margin-top: 5px; flex: none; }
.choice span { display: flex; flex-direction: column; gap: 2px; }

/* 后台用户表里的小数字输入框（调整积分） */
input.num-sm { width: 84px; padding: 3px 6px; }

/* 被屏蔽用户的评论：折叠成一行灰字 */
details.blocked summary { color: var(--muted); font-size: 13px; }

/* ---- 头像图片（上传的 / 内置的）与设置页的头像选择 ---- */
img.avatar { object-fit: cover; background: var(--surface-2); }
.user-cell { display: inline-flex; align-items: center; gap: 6px; }
.avatar-now { display: flex; align-items: center; gap: 14px; margin: 8px 0 4px; }
.avatar-now p { margin: 0 0 4px; }
.avatar-pick { display: flex; flex-wrap: wrap; gap: 10px; border: 0; padding: 0; margin: 0; }
.avatar-pick legend { padding: 0; margin-bottom: 8px; font-weight: 500; }
.avatar-pick label { position: relative; cursor: pointer; line-height: 0; }
/* 单选框本身藏起来（仍可用键盘选），选中的头像加一圈描边 */
.avatar-pick input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.avatar-pick img { border-radius: 12px; outline: 3px solid transparent; outline-offset: 2px; }
.avatar-pick input:checked + img { outline-color: var(--accent); }
.avatar-pick input:focus-visible + img { outline-color: var(--text); }

/* 备份页：自动备份设置，频率和保留天数并排 */
.backup-schedule .pair { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; max-width: 520px; }

/* ---- 个人主页 ---- */
.profile-head { align-items: center; }
.profile-main { flex: 1; min-width: 0; }
.profile-act { flex: none; align-self: flex-start; }
/* 分栏标签：概况 / 帖子 / 评论 / 收藏 */
.tabs { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs a { padding: 12px 10px 10px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.tabs a span { font-weight: 400; font-size: 13px; color: var(--muted); }
.tab-note { margin: 0; padding: 10px 16px 0; font-size: 13px; }
/* 概况里的一排数字方块 */
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 16px; list-style: none; }
.tiles li { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 6px; border-radius: 10px; background: var(--tint); text-align: center; }
.tiles .ic { width: 22px; height: 22px; color: var(--accent); margin-bottom: 4px; }
.tiles span { font-size: 13px; color: var(--muted); }
.tiles b { font-size: 20px; line-height: 1.3; }
.tiles small { font-size: 12px; color: var(--muted); }
.profile-block { padding: 14px 16px 0; }
.profile-block h2 { font-size: 15px; margin: 0 0 8px; display: flex; align-items: baseline; gap: 10px; }
.profile-block .more { font-size: 13px; font-weight: 400; }
.profile-block .bio, .profile-block p { margin: 0 0 4px; overflow-wrap: anywhere; }
.profile-block + .rows, .profile-block + .empty { margin-top: 0; }
/* 帖子 / 评论的紧凑列表：一条 = 标题（+ 评论摘要）+ 一行小字 */
.rows { margin: 0; padding: 0; list-style: none; }
.rows li { padding: 10px 16px; border-bottom: 1px solid var(--border); }
.rows li:last-child { border-bottom: 0; }
.rows .row-main { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.rows .post-title { overflow-wrap: anywhere; }
.rows .excerpt { display: block; color: var(--muted); overflow-wrap: anywhere; margin: 3px 0 0; padding-left: 10px; border-left: 2px solid var(--border); }
.rows .excerpt:hover { color: var(--text); text-decoration: none; }
.rows .post-meta { margin-top: 4px; }
/* 首页列表里板块标签靠右；这里整行小字都靠左，读起来更连贯 */
.rows .post-meta .tag { margin-left: 0; order: 0; }
@media (max-width: 820px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 12px; }
  .profile-head { flex-wrap: wrap; }
}

/* ---- 点头像弹出的用户信息卡 ---- */
.ucard {
  position: absolute; z-index: 60; width: 300px; max-width: calc(100vw - 16px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .18); overflow: hidden; font-size: 14px;
}
.ucard-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 10px; }
.ucard-who { flex: 1; min-width: 0; line-height: 1.5; }
.ucard-name { font-size: 16px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.ucard-who .muted { font-size: 13px; }
.ucard-close { flex: none; align-self: flex-start; border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; padding: 0 4px; cursor: pointer; }
.ucard-close:hover { color: var(--text); }
.ucard-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin: 0; padding: 10px 14px; list-style: none; background: var(--tint); }
.ucard-stats li { display: flex; align-items: center; gap: 5px; color: var(--muted); }
.ucard-stats .ic { width: 15px; height: 15px; }
.ucard-stats b { color: var(--text); }
.ucard-act { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 10px 12px; }
@media (max-width: 820px) {
  /* 手机上放在屏幕中间，四周压暗 */
  .ucard { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(320px, calc(100vw - 32px)); box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35), 0 8px 28px rgba(0, 0, 0, .25); }
}

/* 设置页「通知」：哪类通知发到哪里的勾选表 */
.push-table th:not(:first-child), .push-table td:not(:first-child) { width: 96px; text-align: center; }
.push-table input[type="checkbox"] { width: auto; margin: 0; }
