/* ============================================================
   app.css — 全部样式，手写，无框架无构建
   设计基调：白底 + 一点主色（小红书式图文卡片）+ 论坛的信息密度

   主题是一整套皮肤，不只是换色：主色、圆角、阴影、边框、卡面、标题字体
   都走变量，四套主题各自覆盖（见下面的 data-theme 块）。
   加新组件时请用这些变量，别写死像素值，否则换主题会露馅。
   ============================================================ */

:root {
  --red: #ff2442;              /* 主色，名字沿用历史，实际是"强调色" */
  --accent-rgb: 255, 36, 66;   /* 主色的 RGB，给 rgba() 拼透明度用 */
  --red-soft: #fff1f3;
  --grad-a: #ff5c74;           /* logo / 按钮渐变起点 */
  --grad-b: #ff2442;           /* 渐变终点 */
  --accent-line: #ffc2cb;      /* 输入框聚焦边框 */
  --ink: #1b1b1f;
  --ink-2: #4a4a52;
  --sub: #74747f;        /* 3.37:1 → 4.6:1，12px 小字也要读得清 */
  --line: #ececf0;
  --bg: #f7f7f9;
  --card: #fff;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-sm: 10px;           /* 按钮、输入框 */
  --shadow: 0 1px 2px rgba(16, 18, 28, .04), 0 6px 20px rgba(16, 18, 28, .05);
  --shadow-1: 0 1px 2px rgba(16, 18, 28, .04), 0 2px 8px rgba(16, 18, 28, .045);
  --shadow-2: 0 2px 6px rgba(16, 18, 28, .05), 0 16px 34px -16px rgba(16, 18, 28, .22);
  --lift: -4px;                /* 卡片悬停上浮距离，方正的主题可以调小 */
  --font-display: inherit;     /* 大标题字体，纸张感主题会换成衬线 */
  --title-weight: 700;
  --topbar-bg: rgba(255, 255, 255, .88);
  --bg-image: none;            /* 页面背景纹理，各主题可以叠一层极淡的渐变或纹路 */
  /* 容器宽度跟着屏幕走：小屏贴边，大屏最多 1920。
     固定 1240 时，2560 的显示器两侧要空掉一半。
     88vw 时 1920 屏两边各空 115px，右栏离屏幕边缘太远；
     96vw 基本贴边，只剩 38px 的呼吸位。 */
  --maxw: clamp(1200px, 96vw, 1920px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* ---------- 四套主题：配色 + 形状 + 字体，是一整套皮肤 ---------- */

/* 青黛：清冷克制。方正、几乎无阴影、靠细边框分块 */
[data-theme="jade"] {
  --red: #0f9b8e;
  --accent-rgb: 15, 155, 142;
  --red-soft: #ecfaf7;
  --grad-a: #34c3b4;
  --grad-b: #0f9b8e;
  --accent-line: #a8e6dd;
  --bg: #f5f9f8;
  --line: #e2ecea;
  --radius: 8px;
  --radius-lg: 10px;
  --radius-sm: 7px;
  --shadow-1: 0 0 0 1px rgba(12, 44, 40, .035);   /* 用一圈极淡的描边代替阴影，边缘更清楚但不悬浮 */
  --shadow-2: 0 12px 28px -20px rgba(12, 44, 40, .4);
  --lift: -2px;
  --title-weight: 600;
}

/* 暮蓝：沉浸、悬浮感强。大圆角 + 深投影 */
[data-theme="indigo"] {
  --red: #4f63e8;
  --accent-rgb: 79, 99, 232;
  --red-soft: #eef1ff;
  --grad-a: #7c8cf5;
  --grad-b: #4f63e8;
  --accent-line: #c3cbfa;
  --bg: #f6f7fb;
  --line: #e6e8f2;
  --radius: 18px;
  --radius-lg: 24px;
  --radius-sm: 12px;
  --shadow-1: 0 2px 10px -4px rgba(30, 40, 90, .12);
  --shadow-2: 0 26px 50px -26px rgba(30, 40, 90, .38);
  --lift: -6px;
  --bg-image: radial-gradient(120% 62% at 50% 0%, rgba(79, 99, 232, .12), rgba(79, 99, 232, 0) 62%);
  --topbar-bg: rgba(246, 247, 251, .82);
}

/* 琥珀：纸张感。近直角、暖白卡面、衬线大标题 */
[data-theme="amber"] {
  --red: #d97706;
  --accent-rgb: 217, 119, 6;
  --red-soft: #fff6e9;
  --grad-a: #f0a13c;
  --grad-b: #d97706;
  --accent-line: #f6d3a1;
  --bg: #faf8f5;
  --card: #fffdf8;
  --line: #ece2d3;
  --radius: 4px;
  --radius-lg: 6px;
  --radius-sm: 4px;
  --shadow-1: 0 1px 0 rgba(120, 90, 40, .06);
  --shadow-2: 0 14px 30px -22px rgba(120, 90, 40, .45);
  --lift: -2px;
  --font-display: Georgia, "Songti SC", "SimSun", "Noto Serif SC", serif;
  --topbar-bg: rgba(255, 253, 248, .9);
  --bg-image: repeating-linear-gradient(0deg, rgba(150, 120, 70, .022) 0 1px, rgba(150, 120, 70, 0) 1px 3px);
}

* { box-sizing: border-box; }
/* 键盘 Tab 时必须看得见焦点落在哪；:focus-visible 只在键盘操作时出现，
   鼠标点击不会多出一圈红框。输入框有自己的 focus 样式，这里不覆盖。 */
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--red); outline-offset: 2px; border-radius: 6px;
}
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  /* 三层背景：极淡的点阵 + 两团主色光斑 + 主题自带纹理。
     纯色底在宽屏上左右两大块留白像没加载完，叠一层纹理后页面有"纸面"感。 */
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(16, 18, 28, .026) 1px, transparent 0),
    radial-gradient(1100px 620px at 8% -6%, rgba(var(--accent-rgb), .075), transparent 62%),
    radial-gradient(900px 560px at 100% -4%, rgba(99, 122, 255, .055), transparent 60%),
    var(--bg-image);
  background-size: 24px 24px, auto, auto, auto;
  background-repeat: repeat, no-repeat, no-repeat, no-repeat;
  color: var(--ink);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 40px;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
em { font-style: normal; }
.muted { color: var(--sub); font-size: 13px; }

/* ---------- 顶部导航 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--topbar-bg);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: var(--maxw); margin: 0 auto; height: 58px;
  padding: 0 18px; display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 7px; font-size: 17px; flex: none; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  color: #fff; font-size: 16px; font-weight: 800; box-shadow: 0 5px 14px -4px rgba(var(--accent-rgb), .6);
}
.brand b { letter-spacing: .04em; font-family: var(--font-display); }

.search { flex: 1; max-width: 520px; min-width: 120px; position: relative; margin: 0 4px; }
.search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--sub); display: block; }
.search i svg { width: 16px; height: 16px; }
.search input {
  width: 100%; height: 36px; border-radius: 999px; border: 1px solid transparent;
  background: #f3f3f6; padding: 0 16px 0 36px; font-size: 13.5px; color: var(--ink); outline: none;
  transition: background .18s, border-color .18s, box-shadow .18s;
}
.search input::placeholder { color: #9a9aa4; }
.search input:focus {
  background: #fff; border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .1);
}

.top-nav { display: flex; align-items: center; gap: 2px; flex: none; }
.top-actions { display: flex; align-items: center; gap: 6px; flex: none; margin-left: auto; }
.top-nav > a, .top-actions > a, .top-actions .av-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 11px;
  border-radius: 17px; color: var(--ink-2); font-size: 13.5px; border: 0; background: none;
  transition: background .15s, color .15s;
}
.top-nav > a svg, .top-actions > a svg, .top-actions .av-btn svg { width: 17px; height: 17px; }
.top-nav > a:hover, .top-actions > a:hover { background: #f4f4f6; color: var(--ink); }
/* 当前页用主色淡底 + 主色字，比灰底更容易一眼定位自己在哪一栏 */
.top-nav > a.on, .top-actions > a.on {
  background: var(--red-soft); color: var(--red); font-weight: 600;
}
.top-nav > a.on svg, .top-actions > a.on svg { color: var(--red); }
.top-actions .publish {
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  color: #fff; padding: 0 14px; font-weight: 600;
  box-shadow: 0 4px 12px -6px rgba(var(--accent-rgb), .8), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.top-actions .publish:hover {
  filter: brightness(1.06); color: #fff;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  box-shadow: 0 6px 16px -6px rgba(var(--accent-rgb), .9), inset 0 1px 0 rgba(255, 255, 255, .26);
}
.top-actions .bell { position: relative; }
.dot {
  position: absolute; top: 4px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--red); color: #fff; border-radius: 8px; font-size: 10px; line-height: 16px;
  text-align: center; font-weight: 700;
}
.me-menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: 46px; min-width: 178px; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  padding: 6px; display: none;
}
.me-menu.open .menu-pop { display: block; }
.menu-pop a, .menu-pop button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px;
  border-radius: 8px; font-size: 14px; color: var(--ink-2); background: none; border: 0; text-align: left;
}
.menu-pop svg { width: 16px; height: 16px; }
.menu-pop a:hover, .menu-pop button:hover { background: #f6f6f8; color: var(--ink); }
.auth-links { display: flex; gap: 8px; }

/* ---------- 头像 ---------- */
.av {
  display: inline-grid; place-items: center; border-radius: 50%; font-weight: 700;
  flex: none; overflow: hidden; user-select: none; line-height: 1;
}
.av-btn { padding: 0; height: auto; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b)); color: #fff;
  font-size: 13.5px; font-weight: 600;
  box-shadow: 0 4px 12px -6px rgba(var(--accent-rgb), .75);
  transition: transform .15s, box-shadow .15s, filter .15s, background .15s, border-color .15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 8px 20px -8px rgba(var(--accent-rgb), .85); }
.btn:active { transform: translateY(0); filter: brightness(.98); }
.btn.ghost { background: #fff; color: var(--ink-2); border-color: var(--line); font-weight: 500; box-shadow: none; }
.btn.ghost:hover { border-color: #dcdce3; background: #fafafb; color: var(--ink); filter: none; transform: none; box-shadow: var(--shadow-1); }
.btn.ghost.on { color: var(--red); border-color: var(--accent-line); background: var(--red-soft); }
.btn.danger { color: var(--red); border-color: #ffd0d7; }
.btn.sm { height: 29px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.xs { height: 27px; padding: 0 9px; font-size: 12px; border-radius: 7px; }
.btn.lg { height: 40px; padding: 0 22px; font-size: 14px; border-radius: 11px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- 布局 ---------- */
.wrap {
  max-width: var(--maxw); margin: 0 auto; padding: 18px 18px 52px;
  display: grid; grid-template-columns: 184px minmax(0, 1fr); gap: 24px; align-items: start;
}
/* 宽屏才加第三栏：左导航 / 中间内容 / 右排行榜 */
.wrap.with-rail { grid-template-columns: 200px minmax(0, 1fr) 300px; }
.wrap.wide { grid-template-columns: minmax(0, 1fr); }
/* 无侧栏页面（登录/发帖/改资料/错误页）：必须单列，否则会被塞进 168px 的第一列 */
.wrap.solo {
  grid-template-columns: minmax(0, 1fr);
  background: radial-gradient(120% 90% at 50% 0%, rgba(var(--accent-rgb), .06), rgba(var(--accent-rgb), 0) 55%);
}
.content { min-width: 0; }

/* ---------- 侧栏 ---------- */
.side { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 16px; }

/* 装成 App 的入口：左栏一份、手机首页信息流一份。
   左栏只有 168px 时把按钮放到第二行，避免图标+文字+按钮挤出一条竖排长蛇。 */
.app-card {
  display: grid; grid-template-columns: 38px minmax(0, 1fr); grid-template-areas: "icon text" "icon action";
  align-items: center; column-gap: 10px; row-gap: 6px; min-width: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 12px; box-shadow: var(--shadow-1);
  background-image: linear-gradient(135deg, rgba(var(--accent-rgb), .1), transparent 65%);
}
.app-icon {
  grid-area: icon;
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), .28);
}
.app-txt { grid-area: text; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.app-txt b { font-size: 13.5px; line-height: 1.3; overflow-wrap: anywhere; }
.app-txt span { font-size: 11.5px; color: var(--sub); line-height: 1.35; }
.app-install { grid-area: action; flex: 0 0 auto; justify-self: start; }
.app-strip { display: none; margin-bottom: 12px; }
.install-dlg .dlg-in { padding: 22px; }
.install-steps { display: grid; gap: 10px; margin: 4px 0 12px; }
.install-steps div { display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 1.45; }
.install-steps b { font-size: 12.5px; color: var(--ink); }
.install-steps span { color: var(--sub); }
.offline-page b { letter-spacing: .06em; }
.offline-tip { color: var(--sub); font-size: 13px; }
.side-block {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 15px 13px 14px; box-shadow: var(--shadow-1);
}
.side-block h4 {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--sub); font-weight: 600; letter-spacing: .08em; margin: 0 0 11px 4px;
}
.side-block h4::before {
  content: ''; width: 3px; height: 11px; border-radius: 2px;
  background: linear-gradient(var(--grad-a), var(--grad-b));
}
.board-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.board-list a { display: block; border-radius: 7px; }
/* 版块标签：铺满整栏。
   以前每行都是彩色底 + 彩色字，13 个版块叠起来就是一道彩虹，很吵也很挤。
   现在底色收掉，只留左边那个小色块做识别，行距靠 padding 撑开，
   hover 才整行上色——一栏看下来是「白底 + 一排小色点」，比彩虹条透气得多。 */
.btag {
  display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0;
  color: var(--ink-2);
  border-radius: 8px; padding: 6px 9px 6px 6px;
  font-size: 12.5px; font-weight: 500; line-height: 1.45;
  transition: background .15s, color .15s;
}
.board-list a:hover .btag {
  background: color-mix(in srgb, var(--bc, #0dd5d9) 13%, var(--card));
  color: var(--ink);
}
/* 一个帖子都没有的版块不进侧栏（见 views.sidebar），这里不再需要淡出规则 */
.btag-i {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 20px; height: 20px; border-radius: 6px;
  background: color-mix(in srgb, var(--bc, #0dd5d9) 22%, var(--card));
  font-size: 11px; line-height: 1;
}
.btag-n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btag-c { font-size: 11px; font-weight: 500; opacity: .5; flex: none; font-variant-numeric: tabular-nums; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-cloud a {
  font-size: 12px; line-height: 1.4; color: var(--ink-2);
  background: color-mix(in srgb, var(--ink) 4.5%, var(--card));
  border-radius: 999px; padding: 4px 9px;
  display: inline-flex; gap: 4px; align-items: center;
  transition: background .15s, color .15s, transform .15s;
}
.tag-cloud a:hover { background: var(--red-soft); color: var(--red); transform: translateY(-1px); }
.tag-cloud em { font-size: 10.5px; color: var(--sub); font-variant-numeric: tabular-nums; }
.tag-cloud a:hover em { color: inherit; opacity: .72; }
.stats .stat-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); padding: 4px 0; }
.stats .stat-row b { font-variant-numeric: tabular-nums; }
.side-note { font-size: 11.5px; color: var(--sub); text-align: center; margin: 0; }

/* ---------- 右栏排行榜 ---------- */
.rail { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 14px; }
.rail-block {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 14px 12px; box-shadow: var(--shadow-1);
}
.rail-block h4 {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--sub); font-weight: 600; letter-spacing: .08em; margin: 0 0 10px 4px;
}
.rail-block h4::before {
  content: ''; width: 3px; height: 11px; border-radius: 2px;
  background: linear-gradient(var(--grad-a), var(--grad-b));
}
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list a { display: flex; align-items: flex-start; gap: 8px; padding: 6px; border-radius: 8px; font-size: 12.5px; color: var(--ink-2); }
.rank-list a:hover { background: #f6f6f8; }
.rk {
  flex: none; width: 17px; height: 17px; margin-top: 1px; border-radius: 5px;
  display: grid; place-items: center; font-style: normal;
  font-size: 10.5px; font-weight: 700; color: var(--sub); background: #f1f1f5;
}
.rk.top { background: var(--red); color: #fff; }
.rt {
  flex: 1; min-width: 0; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rv { flex: none; font-size: 11px; color: var(--sub); font-variant-numeric: tabular-nums; margin-top: 2px; }
.author-list { list-style: none; margin: 0; padding: 0; }
.author-list a { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 8px; font-size: 12.5px; color: var(--ink-2); }
.author-list a:hover { background: #f6f6f8; }
.author-list .an { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.author-list .av { flex: none; font-size: 11px; color: var(--sub); }
.rail-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rail-stats div { text-align: center; padding: 8px 0; border-radius: 9px; background: #f7f7f9; }
.rail-stats b { display: block; font-size: 16px; line-height: 1.2; color: var(--ink); font-variant-numeric: tabular-nums; }
.rail-stats span { font-size: 11px; color: var(--sub); }
/* 宽屏右栏已经有「站点数据」，左栏的「社区」就不必再重复一遍 */
@media (min-width: 1561px) {
  .side-block.stats { display: none; }
}

/* ---------- 帖子页右栏：作者 / 目录 / 相关 / 热门 ----------
   阅读页原先是一张 780px 的卡片居中，1920 的屏幕上两侧各空 500 多像素。
   现在宽屏把这三块收进右栏，正文也能放宽，视线从标题到正文的距离更短。 */
.t-rail { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.rail-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 14px 13px; box-shadow: var(--shadow-1);
}
.rail-card h4 {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--sub); font-weight: 600; letter-spacing: .08em; margin: 0 0 10px 3px;
}
.rail-card h4::before {
  content: ''; width: 3px; height: 11px; border-radius: 2px;
  background: linear-gradient(var(--grad-a), var(--grad-b));
}
.rail-hint { margin-left: auto; font-style: normal; font-size: 10.5px; letter-spacing: 0; }
.tra-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tra-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tra-id b { font-size: 14px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tra-id em { font-size: 11.5px; color: var(--sub); }
.tra-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 12px 0 10px; }
.tra-stats div {
  text-align: center; padding: 7px 0; border-radius: 9px;
  background: color-mix(in srgb, var(--ink) 3.5%, var(--card));
}
.tra-stats b { display: block; font-size: 15px; line-height: 1.2; color: var(--ink); font-variant-numeric: tabular-nums; }
.tra-stats span { font-size: 10.5px; color: var(--sub); }
.tra-acts { display: flex; gap: 7px; flex-wrap: wrap; }
.tra-acts .btn { flex: 1 1 auto; justify-content: center; }
.rail-toc-list { max-height: 46vh; overflow: auto; }
.rail-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.rail-links a { display: flex; gap: 8px; padding: 6px; border-radius: 8px; font-size: 12.5px; color: var(--ink-2); }
.rail-links a:hover { background: color-mix(in srgb, var(--ink) 4%, var(--card)); }
.rail-links .rl-t {
  flex: 1; min-width: 0; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rail-links .rl-m { flex: none; font-size: 11px; color: var(--sub); font-variant-numeric: tabular-nums; margin-top: 2px; }

/* ---------- 标签页 ---------- */
/* 排序筛选做成「分段控件」：浅色轨道 + 白色滑块，比一排裸链接更像可切换的控件 */
.tabs {
  display: flex; gap: 2px; margin: 0 0 16px; padding: 3px;
  background: #f3f3f6; border-radius: 11px;
  width: fit-content; max-width: 100%;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 6px 14px; border-radius: 8px; font-size: 12.5px; color: var(--sub);
  white-space: nowrap; transition: background .15s, color .15s, box-shadow .15s;
}
.tab:hover { color: var(--ink-2); }
.tab.on { background: #fff; color: var(--red); font-weight: 600; box-shadow: 0 1px 3px rgba(20, 20, 30, .08); }

/* ---------- 瀑布流卡片 ---------- */
/* 列数跟着容器走，让卡片宽度稳定在 210~240px：
   1000-1500 → 4 列，1500-1850 → 5 列，1850-2300 → 6 列，2300+ → 7 列 */
/* 用 column-width 而不是固定列数：容器变宽自动多排一列，
   不用为每个屏幕宽度手写断点（1280 四列、1920 六列都能自己算）。 */
/* 用 grid 而不是多列：多列是按「竖着」填的（第一列排满才去第二列），
   新发的帖子会顺着左列往下走，视觉顺序跟「最新在前」正好相反。
   grid 是行优先，第一行从左到右就是最新的几篇。 */
.masonry {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  align-items: stretch;
}
.card-wrap { position: relative; min-width: 0; }

/* ---------- 帖子少于一行时的引导卡 ---------- */
/* 卡片尺寸不再随帖子数量变：1 篇和 100 篇都是同一个 4:5 网格。
   帖子少时右边会空出来，补一张虚线「发第一篇」卡把第一行填满，
   既不会像单列大卡那样撑成一条巨幅横条，也不会让页面看着塌了。 */
.card-filler {
  border: 1.5px dashed color-mix(in srgb, var(--ink) 16%, transparent);
  background: transparent; box-shadow: none;
}
.card-filler .card-media {
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--ink) 1.6%, transparent);
}
.card-filler .card-body {
  min-height: 96px; display: flex; align-items: center; justify-content: center;
}
.cf-plus { font-size: 34px; line-height: 1; font-weight: 300; color: var(--sub); }
.cf-text { font-size: 13px; font-weight: 600; color: var(--sub); letter-spacing: .01em; }
.card-filler:hover { border-color: rgba(var(--accent-rgb), .45); transform: none; box-shadow: none; }
.card-filler:hover .cf-plus, .card-filler:hover .cf-text { color: var(--red); }

.card {
  display: block; background: var(--card);
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  transition: transform .22s cubic-bezier(.22, .61, .36, 1), box-shadow .22s ease, border-color .22s ease;
}
.card:hover, .card-wrap:hover .card {
  transform: translateY(var(--lift));
  box-shadow: var(--shadow-2);
  border-color: rgba(var(--accent-rgb), .2);
}
/* 悬停才出现的关注按钮：不能塞进 <a> 里，所以放在卡片旁边绝对定位 */
.card-follow {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  opacity: 0; transform: translateY(-3px);
  transition: opacity .16s ease, transform .16s ease, box-shadow .15s, filter .15s;
  box-shadow: 0 4px 14px -4px rgba(0, 0, 0, .45);
}
.card-follow.ghost { background: rgba(255, 255, 255, .95); }
.card-wrap:hover .card-follow, .card-follow:focus-visible { opacity: 1; transform: none; }
/* 触屏没有 hover，直接常显 */
@media (hover: none) { .card-follow { opacity: 1; transform: none; } }
/* 图片未到之前的底：以前写死 #f0f0f3，深色模式下是一块刺眼的浅灰。
   改成跟卡面同色系的淡渐变，两种模式都成立。
   同时 color: transparent 把 alt 文字藏起来——图挂了就只留一块干净的底，
   而不是把整条标题画进图片框里（无障碍树里 alt 仍在，读屏照常读）。 */
.card-media {
  position: relative; overflow: hidden;
  /* 全站统一 4:5：横图、竖图、手机长截图混在一屏时，各按各的比例排
     会让瀑布流每列高低参差。图片一律 cover 裁切填满，只裁不压扁。 */
  aspect-ratio: 4 / 5;
  color: transparent;
  background: linear-gradient(150deg,
    color-mix(in srgb, var(--ink) 3%, var(--card)),
    color-mix(in srgb, var(--ink) 6.5%, var(--card)));
}
.card-media picture { display: block; height: 100%; }
.card-media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .6s cubic-bezier(.22, .61, .36, 1);
}
.card:hover .card-media img, .card-wrap:hover .card-media img { transform: scale(1.06); }

/* 没有配图的帖子：媒体区不摆灰块、也不生成深色渐变图，
   直接用 HTML 排一张「文字封面」——浅色纸底 + 版块色淡染 + 大标题。
   跟照片卡并列时是同一层的信息密度，不会像一块黑洞。
   底色用 --bc 与 --card 混合，浅色/深色主题共用一套。 */
.cover-text {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  padding: 20px 18px 16px;
  color: var(--ink);
  background:
    radial-gradient(130% 88% at 84% 0%,
      color-mix(in srgb, var(--bc, #888) 22%, transparent), transparent 62%),
    linear-gradient(158deg,
      color-mix(in srgb, var(--bc, #888) 7%, var(--card)),
      color-mix(in srgb, var(--bc, #888) 15%, var(--card)));
}
.cover-text .ct-top {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
  color: color-mix(in srgb, var(--bc, #888) 58%, var(--ink));
}
.cover-text .ct-top i { font-style: normal; font-size: 14px; line-height: 1; }
.cover-text .ct-title {
  margin: auto 0;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
  font-family: var(--font-display);
  font-size: 16.5px; line-height: 1.5; font-weight: 700; letter-spacing: -.012em;
  color: var(--ink); word-break: break-word;
}
.cover-text.md .ct-title { font-size: 19px; line-height: 1.46; }
.cover-text.lg .ct-title { font-size: 23px; line-height: 1.42; -webkit-line-clamp: 3; }
.cover-text .ct-foot {
  padding-top: 10px; border-top: 1px solid color-mix(in srgb, var(--ink) 9%, transparent);
  font-size: 11.5px; color: var(--sub); letter-spacing: .02em;
}
.cover-text .ct-foot::after { content: ' ›'; }
.card-badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.badge {
  font-size: 11px; line-height: 1; padding: 4px 6px; border-radius: 6px;
  background: rgba(0, 0, 0, .55); color: #fff; backdrop-filter: blur(4px); font-weight: 600;
}
.badge.pin { background: rgba(var(--accent-rgb), .92); }
.badge.feat { background: rgba(255, 152, 0, .95); }
.badge.count { background: rgba(0, 0, 0, .45); margin-left: auto; }
.lock-mark {
  position: absolute; bottom: 8px; right: 8px; font-size: 11px; color: #fff;
  background: rgba(0, 0, 0, .5); padding: 3px 6px; border-radius: 5px;
}
.card-body { padding: 13px 14px 12px; }
.card-title {
  font-size: 14px; line-height: 1.5; font-weight: 600; margin: 0 0 10px; color: var(--ink);
  letter-spacing: -.005em;
  font-family: var(--font-display);
  /* 固定占两行高：一行标题的卡片也留出同样的位置，不然同一行里
     有的卡片高 20px、有的矮 20px，瀑布流下沿永远参差。 */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 3em;
}
.card:hover .card-title, .card-wrap:hover .card-title { color: var(--red); }
.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11.5px; color: var(--sub); gap: 8px;
}
.card-foot .who { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.card-foot .who .av { flex: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, .04); }
.card-foot .who em {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 96px;
  color: var(--ink-2); font-weight: 500;
}
.like-mini { display: inline-flex; align-items: center; gap: 3px; flex: none; }
.like-mini svg { width: 13px; height: 13px; }
.card-time { flex: none; font-variant-numeric: tabular-nums; opacity: .85; }

.empty {
  padding: 40px 20px; text-align: center; color: var(--sub); font-size: 13.5px;
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
}

/* ---------- 分页 ---------- */
.pager { display: flex; gap: 6px; justify-content: center; margin: 26px 0 6px; flex-wrap: wrap; }
.pg {
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: 9px; background: #fff;
  border: 1px solid var(--line); display: inline-grid; place-items: center; font-size: 13px; color: var(--ink-2);
}
.pg:hover { border-color: #d6d6dd; }
.pg.on { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 600; }
.pg-dots { color: var(--sub); align-self: center; }

/* ---------- 页头 ---------- */
.page-head { display: flex; align-items: center; gap: 13px; margin: 2px 0 18px; }
.ph-emoji {
  width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center;
  background: linear-gradient(145deg,
    color-mix(in srgb, var(--red) 15%, var(--card)),
    color-mix(in srgb, var(--red) 5%, var(--card)));
  border: 1px solid color-mix(in srgb, var(--red) 17%, transparent);
  font-size: 20px; color: var(--red); flex: none;
}
.ph-emoji svg { width: 19px; height: 19px; }
.page-head h1 { font-size: 20px; letter-spacing: -.01em; font-family: var(--font-display); font-weight: var(--title-weight); }
.ph-act { margin-left: auto; flex: none; }
.page-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--sub); }

/* ---------- 版块卡片 ---------- */
.board-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); gap: 14px; }
.board-card {
  display: flex; gap: 14px; align-items: flex-start; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 18px 16px; transition: transform .18s ease, border-color .18s, box-shadow .18s;
}
.board-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--bc, #888) 42%, var(--line));
  box-shadow: var(--shadow-2);
}
/* 图标底取版块自己的色，跟侧栏那个小方块是同一个色，扫一眼就能对上 */
.bc-emoji {
  width: 46px; height: 46px; border-radius: 14px; flex: none;
  display: grid; place-items: center; font-size: 21px; line-height: 1;
  background: color-mix(in srgb, var(--bc, #888) 13%, var(--card));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bc, #888) 18%, transparent);
}
.bc-main { flex: 1; min-width: 0; }
.bc-head { display: flex; align-items: center; gap: 8px; }
.board-card h3 { font-size: 15px; font-weight: 650; letter-spacing: -.005em; }
.bc-count {
  margin-left: auto; flex: none;
  font-size: 11.5px; font-weight: 600; line-height: 1;
  color: color-mix(in srgb, var(--bc, #888) 55%, var(--sub));
  background: color-mix(in srgb, var(--bc, #888) 10%, var(--card));
  border-radius: 999px; padding: 4px 8px;
  font-variant-numeric: tabular-nums;
}
/* 介绍固定占两行高：否则一行的卡片矮、两行的卡片高，
   同一行里卡片的底部会参差。 */
.board-card p {
  margin: 5px 0 0; font-size: 12.5px; color: var(--sub); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 3.2em;
}

/* ---------- 话题索引 ---------- */
.tag-index {
  display: flex; flex-wrap: wrap; gap: 10px; padding: 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.tag-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px;
  border-radius: 11px; background: #f7f7f9; border: 1px solid var(--line);
  color: var(--ink-2); font-size: 13.5px; transition: .15s;
}
.tag-chip:hover { border-color: var(--accent-line); color: var(--red); }
.tag-chip em { font-style: normal; font-size: 11.5px; color: var(--sub); }
.tag-chip.warm { font-size: 15px; }
.tag-chip.hot { font-size: 17px; font-weight: 600; color: var(--ink); background: var(--red-soft); border-color: var(--accent-line); }
.tag-chip.hot em { color: var(--red); }
.tag-hint { margin: 16px 2px 0; font-size: 12.5px; color: var(--sub); line-height: 1.8; }
.tag-hint code, .about code { background: #f4f4f6; border-radius: 5px; padding: 1px 5px; font-size: .92em; }

/* ---------- 关于本站 ---------- */
.about {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 26px 28px 30px; box-shadow: var(--shadow-1);
}
.about h1 { font-size: 26px; font-family: var(--font-display); letter-spacing: -.015em; }
.about-lead { margin: 8px 0 20px; color: var(--ink-2); font-size: 15px; }
.about-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 0 0 22px; }
.about-stats div { background: #f9f9fb; border-radius: var(--radius); padding: 14px 10px; text-align: center; }
.about-stats b { display: block; font-size: 22px; line-height: 1.3; }
.about-stats span { font-size: 12px; color: var(--sub); }
.about h2 { font-size: 16px; margin: 26px 0 10px; padding-left: 10px; border-left: 3px solid var(--red); }
.about-list { margin: 0; padding-left: 20px; color: var(--ink-2); font-size: 14px; line-height: 1.9; }
.about-list li { margin: 5px 0; }
.about-boards { display: flex; flex-wrap: wrap; gap: 8px; }
.about-boards a {
  display: inline-flex; gap: 7px; align-items: center; padding: 7px 12px;
  border-radius: 10px; border: 1px solid var(--line); background: #f9f9fb; font-size: 13px;
}
.about-boards a:hover { border-color: var(--accent-line); color: var(--red); }
.about-boards em { font-style: normal; font-size: 11.5px; color: var(--sub); }
.about-p { font-size: 13.5px; color: var(--ink-2); line-height: 1.9; margin: 8px 0 0; }
.about-p a { color: var(--red); }
.side-more { margin-left: auto; font-size: 11px; font-weight: 500; letter-spacing: 0; color: var(--sub); }
.side-more:hover { color: var(--red); }

/* ---------- 帖子详情 ---------- */
/* 阅读页：卡片 860px 居中，正文约 800px，一行约 50 个汉字。
   早先固定 780 时，1920 屏上左右各空 500 多像素；现在交给 .t-rail 右栏填右侧。 */
.thread {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 22px 26px 26px; box-shadow: var(--shadow-1);
  max-width: 860px; margin: 0 auto;
}
.crumb { display: flex; gap: 7px; align-items: center; font-size: 12.5px; color: var(--sub); margin-bottom: 14px; }
.crumb a { color: var(--ink-2); font-weight: 500; }
.crumb a:hover { color: var(--red); }
.t-title { font-size: 26px; line-height: 1.4; font-weight: var(--title-weight); font-family: var(--font-display); letter-spacing: -.015em; margin-bottom: 16px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.t-title .badge { position: static; font-size: 11.5px; padding: 5px 8px; border-radius: 7px; }
.t-meta {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 18px;
  background: color-mix(in srgb, var(--ink) 2.5%, var(--card));
  border: 1px solid color-mix(in srgb, var(--ink) 7%, var(--card));
  border-radius: var(--radius);
}
.t-author { display: flex; align-items: center; gap: 10px; }
.t-author div { display: flex; flex-direction: column; line-height: 1.35; }
.t-author b { font-size: 14.5px; }
.t-author span { font-size: 11.5px; color: var(--sub); }
.t-stats { display: flex; gap: 14px; margin-left: auto; font-size: 12.5px; color: var(--sub); }
.t-stats span { display: inline-flex; align-items: center; gap: 4px; }
.t-stats svg { width: 14px; height: 14px; }

/* 图片轮播：scroll-snap 实现，触摸滑动是浏览器原生行为 */
.gallery {
  position: relative; margin: 20px auto 22px;
  width: 100%;
  /* 按图片真实比例铺满正文列，不再按视口高度反推宽度——
     之前 max-width: calc(48vh * ratio) 会让竖图只占正文 2/3 宽，
     两侧留一大片空白，看起来像图被压扁了。
     超长图（长截图）用 130vh 兜底，避免一屏塞不下还要滑很久。 */
  max-width: 100%;
  max-height: 130vh;
  border-radius: var(--radius-lg); overflow: hidden; background: #f4f4f6;
  aspect-ratio: var(--g-ratio, .75);
}
.g-track {
  display: flex; height: 100%;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  outline: none;
}
.g-track::-webkit-scrollbar { display: none; }
.g-track:focus-visible { box-shadow: inset 0 0 0 2px var(--red); }
.g-slide {
  flex: 0 0 100%; height: 100%; margin: 0;
  scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.g-slide img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  user-select: none; -webkit-user-drag: none;
}
/* 单图也按真实比例显示：cover 在 aspect 字段有偏差时会裁掉边缘，
   宁可留一点底色边也别切图 */
.gallery.single .g-slide img { object-fit: contain; }

.g-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .38); color: #fff; cursor: pointer;
  display: grid; place-items: center; opacity: 0;
  transition: opacity .18s, background .18s;
}
.g-nav svg { width: 18px; height: 18px; }
.g-nav.prev { left: 10px; }
.g-nav.next { right: 10px; }
.gallery:hover .g-nav, .g-nav:focus-visible { opacity: 1; }
.g-nav:hover { background: rgba(0, 0, 0, .58); }
.g-nav[hidden] { display: none; }

.g-count {
  position: absolute; top: 12px; right: 12px;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(0, 0, 0, .42); color: #fff;
  font-size: 11.5px; font-variant-numeric: tabular-nums;
}
.g-dots {
  position: absolute; left: 0; right: 0; bottom: 10px;
  display: flex; justify-content: center; gap: 6px;
}
.g-dot {
  width: 6px; height: 6px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .55); cursor: pointer;
  transition: width .2s, background .2s;
}
.g-dot.on { width: 16px; border-radius: 3px; background: #fff; }

/* 双击点赞的心形 */
.heart-burst {
  position: absolute; left: 50%; top: 50%; width: 86px; height: 86px;
  margin: -43px 0 0 -43px; pointer-events: none; color: var(--red);
  animation: heartPop .72s ease-out forwards;
}
.heart-burst svg { width: 100%; height: 100%; filter: drop-shadow(0 4px 16px rgba(0, 0, 0, .28)); }
@keyframes heartPop {
  0% { opacity: 0; transform: scale(.35); }
  25% { opacity: 1; transform: scale(1.1); }
  55% { opacity: 1; transform: scale(.98); }
  100% { opacity: 0; transform: scale(1.22) translateY(-10px); }
}

/* 首页「关注 / 发现」主信息流切换 */
.feed-tabs { display: flex; justify-content: center; gap: 30px; margin: 2px 0 14px; }
.ftab {
  position: relative; font-size: 15px; color: var(--sub);
  padding: 4px 2px; transition: color .15s;
}
.ftab:hover { color: var(--ink-2); }
.ftab.on { color: var(--ink); font-weight: 600; }
.ftab.on::after {
  content: ''; position: absolute; left: 50%; bottom: -3px;
  transform: translateX(-50%); width: 20px; height: 3px;
  border-radius: 999px; background: linear-gradient(90deg, var(--grad-a), var(--grad-b));
}

/* 空流 / 未登录引导 */
.feed-gate {
  max-width: 420px; margin: 56px auto; padding: 34px 26px; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
}
.fg-icon {
  width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center; background: var(--red-soft); color: var(--red);
}
.fg-icon svg { width: 24px; height: 24px; }
.feed-gate h3 { margin: 0 0 8px; font-size: 16px; }
.feed-gate p { margin: 0 0 18px; font-size: 13px; color: var(--sub); line-height: 1.7; }

/* 搜索页 */
.search-head { margin-bottom: 14px; }
.search-empty { max-width: 560px; margin: 40px auto; text-align: center; }
.search-empty h3 { font-size: 16px; margin: 0 0 8px; }
.search-empty p { font-size: 13px; color: var(--sub); margin: 0 0 18px; }
/* 最近搜索 */
.search-history, .search-hot { margin: 24px auto 0; max-width: 560px; text-align: left; }
.sh-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; font-size: 12px; color: var(--sub); letter-spacing: .04em;
}
.sh-clear { background: none; border: 0; padding: 0; font-size: 12px; color: var(--sub); cursor: pointer; }
.sh-clear:hover { color: var(--red); }
.sh-list { display: flex; flex-wrap: wrap; gap: 8px; }
.sh-chip {
  display: inline-flex; align-items: center; height: 30px; padding: 0 13px;
  border-radius: 999px; background: var(--card); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-2); transition: .15s;
}
.sh-chip:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }

.user-list { display: flex; flex-direction: column; }
.user-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 14px; background: var(--card);
  border: 1px solid var(--line); margin-bottom: 8px;
}
.ur-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.ur-txt { min-width: 0; }
.ur-txt b { font-size: 14px; }
.ur-txt p {
  margin: 2px 0 3px; font-size: 12.5px; color: var(--sub);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ur-meta { font-size: 11.5px; color: var(--sub); }

.tag-cloud.wide { gap: 10px; }
.tag-chip {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 10px 14px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line);
  transition: border-color .15s, transform .15s;
}
.tag-chip:hover { border-color: var(--red); transform: translateY(-1px); }
.tag-chip b { font-size: 13.5px; color: var(--ink); }
.tag-chip em { font-style: normal; font-size: 11.5px; color: var(--sub); }

/* 话题页聚合面板 */
.tag-panel {
  display: flex; flex-direction: column; gap: 10px;
  margin: 0 0 14px; padding: 12px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
}
.tp-authors, .tp-related { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tp-authors a {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; color: var(--ink-2);
}
.tp-authors a:hover { color: var(--red); }
.tp-label { font-size: 11.5px; color: var(--sub); }
.tp-related a {
  font-size: 12px; padding: 4px 9px; border-radius: 999px;
  background: #f5f5f7; color: var(--ink-2);
}
.tp-related a:hover { background: var(--red-soft); color: var(--red); }
.tp-related em { font-style: normal; color: var(--sub); margin-left: 3px; font-size: 11px; }

/* 消息 tab 上的未读数 */
.tab-dot {
  display: inline-block; min-width: 16px; height: 16px; line-height: 16px;
  padding: 0 4px; margin-left: 5px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 10.5px; font-style: normal;
  text-align: center; vertical-align: 1px;
}
.tab.on .tab-dot { background: var(--red); color: #fff; }

/* 中文长文一行 50+ 字读起来会串行，正文和插图一起收到 700px 以内 */
.t-body { font-size: 14.5px; line-height: 1.9; color: var(--ink); word-break: break-word; max-width: 700px; }
/* 正文里的列表（- 项 / 1. 项） */
.md-list { margin: 10px 0 12px; padding-left: 22px; }
.md-list li { margin: 5px 0; line-height: 1.8; }
.md-list li::marker { color: var(--sub); }

/* 正文里的插图（![](url) 语法渲染出来的） */
.inline-img { margin: 16px 0; }
.inline-img img {
  width: 100%; border-radius: 12px; display: block; background: #f4f4f6;
  max-height: 80vh; object-fit: contain; cursor: zoom-in;
}

/* ---------- 长文：正文小标题 ---------- */
/* 页面标题已经是 h1，正文从 h2 起；scroll-margin-top 让锚点跳转不被吸顶栏挡住 */
.t-body .md-h, .rp-body .md-h {
  font-family: var(--font-display); font-weight: var(--title-weight);
  color: var(--ink); line-height: 1.5; scroll-margin-top: 76px;
}
/* 小标题前的竖条：用 ::before 而不是 border-left，
   这样竖条能贴着文字高度走、带渐变色和圆头，长标题下也不会拖出一根长棍 */
.t-body .md-h2, .rp-body .md-h2 {
  font-size: 18.5px; margin: 30px 0 12px; padding-left: 12px;
  position: relative;
}
.t-body .md-h2::before, .rp-body .md-h2::before {
  content: ''; position: absolute; left: 0; top: .2em; bottom: .2em;
  width: 3px; border-radius: 999px;
  background: linear-gradient(var(--grad-a), var(--grad-b));
}
.t-body .md-h3, .rp-body .md-h3 { font-size: 16px; margin: 22px 0 8px; color: var(--ink); }
.t-body .md-h4, .rp-body .md-h4 { font-size: 14.5px; margin: 18px 0 6px; color: var(--ink-2); }
.md-anchor {
  margin-left: 7px; color: var(--sub); text-decoration: none;
  font-weight: 400; opacity: 0; transition: opacity .15s;
}
.md-h:hover .md-anchor, .md-anchor:focus-visible { opacity: .65; }
.md-anchor:hover { color: var(--red); }

/* ---------- 长文：本文目录 ---------- */
.toc {
  margin: 6px 0 20px; border: 1px solid color-mix(in srgb, var(--ink) 7%, var(--card));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--ink) 2.5%, var(--card)); overflow: hidden;
}
.toc > summary {
  display: flex; align-items: center; gap: 9px; padding: 11px 14px;
  cursor: pointer; list-style: none; color: var(--ink-2); font-size: 13px;
  user-select: none;
}
.toc > summary::-webkit-details-marker { display: none; }
.toc > summary b { font-size: 13.5px; color: var(--ink); font-weight: 600; }
.toc > summary em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--sub); }
.toc-caret {
  width: 7px; height: 7px; flex: none; margin-left: 2px;
  border-right: 1.6px solid var(--sub); border-bottom: 1.6px solid var(--sub);
  transform: rotate(45deg) translate(-1px, -1px); transition: transform .2s;
}
.toc[open] .toc-caret { transform: rotate(-135deg) translate(-1px, -1px); }
.toc-list {
  margin: 0; padding: 6px 14px 12px; list-style: none;
  border-top: 1px solid var(--line); max-height: 46vh; overflow: auto;
}
.toc-list li { margin: 1px 0; }
.toc-list a {
  display: flex; gap: 9px; align-items: baseline; padding: 5px 0;
  font-size: 13px; line-height: 1.55; color: var(--ink-2); border-radius: 8px;
}
.toc-list a:hover { color: var(--red); }
.toc-list a.on { color: var(--red); font-weight: 600; }
.toc-n { flex: none; width: 17px; color: var(--sub); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.toc-t { min-width: 0; }
.toc-lv3 a { padding-left: 18px; }
.toc-lv4 a { padding-left: 36px; }

/* ---------- 长文：顶部阅读进度 ---------- */
.read-bar {
  position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 60;
  pointer-events: none; background: transparent; opacity: 0; transition: opacity .25s;
}
.read-bar.on { opacity: 1; }
.read-bar i {
  display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--grad-a), var(--grad-b));
  box-shadow: 0 0 8px rgba(var(--accent-rgb), .45);
}

.t-body .tag-inline { color: #1a6fd4; }
.t-body .link { color: #1a6fd4; text-decoration: underline; word-break: break-all; }
.t-body .code-wrap, .rp-body .code-wrap {
  margin: 14px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px;
  background: #f6f6f8; line-height: 1.6;
}
.t-body .code-head, .rp-body .code-head {
  min-height: 34px; padding: 5px 10px 5px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: rgba(0, 0, 0, .035); border-bottom: 1px solid var(--line); color: var(--sub); font-size: 11.5px;
}
.t-body .code-copy, .rp-body .code-copy {
  border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; background: var(--card); color: var(--ink-2);
  font-size: 11.5px; line-height: 1.4;
}
.t-body .code-copy:hover, .rp-body .code-copy:hover { border-color: var(--red); color: var(--red); }
.t-body pre.code, .rp-body pre.code {
  margin: 0; padding: 14px 16px; overflow-x: auto; font-size: 13px; line-height: 1.75;
  tab-size: 2; white-space: pre; -webkit-overflow-scrolling: touch;
}
.t-body pre.code code, .rp-body pre.code code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.t-body code.inline {
  background: #f4f4f6; border-radius: 5px; padding: 1px 5px; font-size: .92em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.t-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.t-tags a { font-size: 13px; color: var(--red); background: var(--red-soft); padding: 4px 10px; border-radius: 9px; }

.t-actions { display: flex; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.act {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px;
  border-radius: 19px; border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  font-size: 13px; font-weight: 500; transition: .16s;
}
.act svg { width: 17px; height: 17px; }
.act:hover { background: #fafafb; border-color: #dcdce3; transform: translateY(-1px); }
.act.on { color: var(--red); border-color: var(--accent-line); background: var(--red-soft); }
.act.on svg { fill: var(--red); stroke: var(--red); }

.mod-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding: 12px; background: #fafafb; border-radius: 12px; }
.notice {
  display: flex; align-items: center; gap: 8px; margin-top: 14px; padding: 11px 14px;
  background: #fff8e6; border: 1px solid #ffe4a3; border-radius: 11px; font-size: 13px; color: #8a6100;
}
.notice svg { width: 15px; height: 15px; }

/* ---------- 回复 ---------- */
.replies { margin-top: 34px; }
.sec-title { font-size: 15px; margin: 22px 0 12px; display: flex; align-items: center; gap: 8px; }
.sec-title em { font-size: 12.5px; color: var(--sub); font-weight: 400; }
.reply-form { background: #fafafb; border: 1px solid var(--line); border-radius: 13px; padding: 12px; }
.reply-form textarea {
  width: 100%; border: 0; background: none; resize: vertical; outline: none;
  font: inherit; font-size: 14.5px; min-height: 66px; color: var(--ink);
}
.rf-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.rf-quote {
  display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line);
  border-radius: 9px; padding: 6px 10px; font-size: 12.5px; color: var(--sub); margin-bottom: 8px;
}
.rf-quote span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rf-quote button { border: 0; background: none; color: var(--sub); font-size: 16px; line-height: 1; }
.login-hint { padding: 22px; text-align: center; background: #fafafb; border: 1px dashed var(--line); border-radius: 12px; color: var(--sub); font-size: 14px; }
.login-hint a { color: var(--red); font-weight: 600; }

.reply-list { margin-top: 8px; }
.reply { display: flex; gap: 11px; padding: 16px 12px; margin: 0 -12px; border-bottom: 1px solid var(--line); border-radius: 12px; transition: background .15s; }
.reply:hover { background: #fafafb; }
.reply:last-child { border-bottom: 0; }
.rp-left { flex: none; }
.rp-main { flex: 1; min-width: 0; }
.rp-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.rp-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.rp-name:hover { color: var(--red); }
.role-badge {
  font-size: 10.5px; padding: 2px 6px; border-radius: 5px; background: #eef4ff; color: #1a6fd4; font-weight: 600;
}
.role-badge.op { background: var(--red-soft); color: var(--red); }
.role-badge.mod { background: #e8f5ec; color: #1f7a3d; }
/* 后台用户表里的「负责版块」：默认收起，点开勾选 */
.mod-boards summary { cursor: pointer; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.mod-boards summary:hover { color: var(--red); }
.mod-boards[open] summary { color: var(--red); }
.mb-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; max-width: 340px; }
.mb-list label {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  font-size: 12px; color: var(--ink-2); padding: 4px 8px; border-radius: 7px;
  background: #f4f4f7; border: 1px solid transparent;
}
.mb-list label:hover { border-color: var(--line); }
.mb-list input { margin: 0; accent-color: var(--red); }
.role-badge.danger { background: #ffe8e8; color: #c62828; }
.rp-floor { color: var(--sub); margin-left: auto; font-variant-numeric: tabular-nums; }
.rp-time { color: var(--sub); }
.quote {
  margin: 8px 0 6px; padding: 8px 12px; background: #f6f6f8; border-left: 3px solid #dcdce2;
  border-radius: 0 8px 8px 0; font-size: 13px; color: var(--sub);
}
.rp-body { font-size: 14px; line-height: 1.75; margin: 5px 0 7px; word-break: break-word; }
.rp-actions { display: flex; gap: 14px; font-size: 12.5px; color: var(--sub); }
.mini-act { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--sub); padding: 0; font-size: 12.5px; }
.mini-act svg { width: 14px; height: 14px; }
.mini-act:hover { color: var(--ink); }
.mini-act.on { color: var(--red); }
.mini-act.on svg { fill: var(--red); stroke: var(--red); }

/* 楼中楼：子回复缩进 + 左侧竖线，超过 2 条折叠 */
.rp-children {
  display: flex; flex-direction: column;
  margin: 10px 0 2px; padding-left: 12px;
  border-left: 2px solid var(--line);
}
.rp-child { display: flex; gap: 9px; padding: 7px 8px; border-radius: 10px; transition: background .15s; }
.rp-child:hover { background: #fafafb; }
.rp-child .rp-head { gap: 6px; }
.rp-child .rp-name { font-size: 12.5px; }
.rp-child .rp-time { font-size: 11px; }
.rp-child .rp-body { font-size: 13.5px; line-height: 1.8; }
.rp-child .rp-actions { gap: 12px; }
.rp-more {
  align-self: flex-start; margin: 2px 0 2px 8px; padding: 3px 0;
  background: none; border: 0; font-size: 12.5px; color: var(--red); cursor: pointer;
}
.rp-more:hover { text-decoration: underline; }

.related { margin-top: 34px; padding-top: 6px; }

/* ---------- 发布 / 编辑 ---------- */
/* justify-self: stretch + max-width：撑到上限后在列内居中。
   用 margin:auto 会让 grid 项收缩到内容宽度（发布页曾只剩 697px、改密码页只有 236px） */
.compose { width: 100%; max-width: 820px; margin: 24px auto 36px; justify-self: center; }
.compose.narrow { max-width: 520px; }
.compose h1 { font-size: 22px; letter-spacing: -.01em; margin-bottom: 16px; font-family: var(--font-display); font-weight: var(--title-weight); }
.compose-form { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px 22px 18px; box-shadow: var(--shadow-1); }
.cf-block { margin-bottom: 20px; }
.cf-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.cf-label em { font-weight: 400; color: var(--sub); font-size: 12px; margin-left: 6px; }
/* 输入框要有「能输入」的样子：原来 #fcfcfd 底 + #ececf0 边框，
   放在白色卡片上几乎看不见边界，后台那个「挂载路径」就像一行只读文字。 */
.cf-input {
  width: 100%; border: 1px solid #d9d9e2; border-radius: 11px; padding: 11px 13px;
  font: inherit; font-size: 14.5px; outline: none; background: #f7f7fa; transition: .15s; resize: vertical;
}
.cf-input:hover { border-color: #c8c8d4; }
.cf-input.is-error { border-color: #e5484d; background: #fff5f5; }
.cf-input.is-error:hover { border-color: #d13b40; }
.cf-input:focus { background: #fff; border-color: var(--accent-line); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .06); }
.board-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.bp input { display: none; }
.bp span {
  display: inline-block; padding: 8px 13px; border-radius: 10px; border: 1px solid var(--line);
  font-size: 13.5px; color: var(--ink-2); cursor: pointer; background: #fff;
}
.bp input:checked + span { border-color: var(--red); background: var(--red-soft); color: var(--red); font-weight: 600; }

.uploader { display: flex; flex-wrap: wrap; gap: 10px; }
.up-btn {
  width: 96px; height: 96px; border-radius: 12px; border: 1px dashed #d6d6dd; background: #fafafb;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--sub); font-size: 12px; cursor: pointer;
}
.up-btn:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.up-btn svg { width: 20px; height: 20px; }
.up-list { display: contents; }
.up-item {
  width: 96px; height: 96px; border-radius: 12px; overflow: hidden; position: relative;
  background: #f0f0f3; cursor: grab;
}
.up-item:active { cursor: grabbing; }
.up-item.dragging { opacity: .4; }
.up-item.drop-target { box-shadow: inset 0 0 0 2px var(--red); }
.up-item img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.up-item button {
  position: absolute; border: 0; color: #fff; font-size: 13px; line-height: 1;
  display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(4px);
}
.up-item .up-del {
  top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0, 0, 0, .55);
}
.up-item .up-del:hover { background: rgba(0, 0, 0, .75); }
.up-item .up-cover {
  right: 4px; bottom: 4px; height: 20px; padding: 0 6px; border-radius: 5px;
  background: rgba(0, 0, 0, .55); font-size: 10.5px;
}
.up-item .up-cover:hover { background: var(--red); }
.up-item .up-idx {
  position: absolute; left: 4px; top: 4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 4px; background: rgba(0, 0, 0, .45); color: #fff; font-size: 10.5px;
  display: grid; place-items: center; font-variant-numeric: tabular-nums;
}
.up-item .cover-tag {
  position: absolute; left: 4px; bottom: 4px; font-size: 10px; color: #fff;
  background: rgba(var(--accent-rgb), .9); padding: 2px 5px; border-radius: 4px;
}
.cf-label-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.cf-label-row .cf-label { margin-bottom: 8px; }
.cf-tools { display: flex; align-items: center; gap: 7px; flex: none; }
.cf-img-btn {
  display: inline-flex; align-items: center; gap: 4px; flex: none; margin-bottom: 8px;
  font-size: 12px; color: var(--ink-2); padding: 5px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; cursor: pointer; transition: .15s;
}
.cf-img-btn:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.cf-img-btn svg { width: 13px; height: 13px; }
.cf-input.drop-hint { outline: 2px dashed var(--red); outline-offset: 2px; background: var(--red-soft); }
.cf-drive { display: grid; grid-template-columns: 1fr 150px; gap: 10px; }
@media (max-width: 640px) {
  .cf-drive { grid-template-columns: 1fr; }
  .cf-label-row { flex-direction: column; gap: 0; }
  .cf-tools { align-self: flex-end; margin-top: -2px; }
}
.cf-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.emoji-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.ep input { display: none; }
.ep span {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px;
  border: 1px solid var(--line); font-size: 18px; cursor: pointer; background: #fff;
}
.ep input:checked + span { border-color: var(--red); background: var(--red-soft); }

/* ---------- 登录 / 注册 ---------- */
.auth-shell {
  /* 撑到 940 后居中：margin 左右必须是 auto，否则 grid 里会贴着左边缘 */
  max-width: 940px; margin: 34px auto 44px; justify-self: stretch;
  display: grid; grid-template-columns: minmax(0, 1fr) 404px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 24px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(20, 20, 30, .04), 0 34px 64px -38px rgba(20, 20, 30, .30);
}

/* 找回密码 / 验证结果：单列小卡片，别硬撑成两栏登录页 */
.auth-shell.mail-only { grid-template-columns: minmax(0, 1fr); max-width: 460px; }
.auth-shell.mail-only .auth-main { padding: 36px 30px 28px; }

/* 左侧：品牌与卖点 */
.auth-side {
  padding: 42px 38px;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(120% 85% at 0% 0%, rgba(var(--accent-rgb), .11), rgba(var(--accent-rgb), 0) 58%),
    radial-gradient(90% 70% at 100% 100%, rgba(255, 140, 60, .09), rgba(255, 140, 60, 0) 62%),
    #fdfbfc;
}
.auth-side-brand { display: flex; align-items: center; gap: 9px; }
.auth-side-brand .logo, .auth-brand-mobile .logo {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b)); color: #fff;
  font-weight: 800; font-size: 16px;
  box-shadow: 0 8px 18px -8px rgba(var(--accent-rgb), .6);
}
.auth-side-brand b { font-size: 16px; letter-spacing: .2px; }
.auth-side h1 {
  font-size: 24px; line-height: 1.55; letter-spacing: -.01em;
  margin: 38px 0 12px; font-weight: 700; max-width: 15em;
}
.auth-side-sub { margin: 0 0 28px; font-size: 13px; line-height: 1.7; color: var(--ink-2); }
.auth-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-points li {
  display: flex; gap: 9px; align-items: flex-start;
  font-size: 13px; line-height: 1.5; color: var(--ink-2);
}
.auth-points svg { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--red); }
.auth-side-stats {
  margin-top: auto; padding-top: 34px;
  display: flex; gap: 26px; font-size: 12px; color: var(--sub);
}
.auth-side-stats b { display: block; font-size: 19px; color: var(--ink); font-weight: 700; line-height: 1.2; }
.auth-side-stats.muted { color: var(--sub); font-size: 12.5px; }

/* 右侧：表单 */
.auth-main { padding: 40px 36px 30px; display: flex; flex-direction: column; justify-content: center; }
.auth-card { background: transparent; border: 0; border-radius: 0; padding: 0; box-shadow: none; }
.auth-brand-mobile { display: none; }
.auth-head h2 { font-size: 21px; margin: 0 0 6px; letter-spacing: -.01em; }
.auth-head p { margin: 0 0 22px; font-size: 13px; color: var(--sub); }

.auth-tabs { display: flex; background: #f4f4f6; border-radius: 12px; padding: 4px; margin-bottom: 20px; }
.auth-tabs a {
  flex: 1; text-align: center; padding: 8px; border-radius: 9px;
  font-size: 13.5px; color: var(--ink-2); transition: color .15s, background .15s;
}
.auth-tabs a:hover { color: var(--ink); }
.auth-tabs a.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

.auth-form .field { display: block; margin-bottom: 14px; }
.auth-form .field-label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 7px; }
.auth-form .field-label em { font-style: normal; color: var(--sub); font-size: 11.5px; }
.auth-form .field-hint { display: block; margin-top: 6px; font-size: 11.5px; color: var(--sub); line-height: 1.5; }
.field-box { position: relative; display: block; }
.auth-form input {
  display: block; width: 100%; height: 46px; border: 1px solid transparent;
  border-radius: 11px; padding: 0 14px; font: inherit; font-size: 14px;
  outline: none; background: #f5f5f7; color: var(--ink);
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.auth-form input::placeholder { color: #b3b3bd; }
.auth-form input:hover { background: #f0f0f3; }
.auth-form input:focus { background: #fff; border-color: var(--accent-line); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .07); }
.field-box input { padding-right: 56px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  height: 32px; padding: 0 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--sub); font-size: 12.5px; cursor: pointer;
}
.pw-toggle:hover { background: #ececf0; color: var(--ink-2); }
.auth-form .btn { margin-top: 10px; height: 46px; font-size: 15px; border-radius: 12px; }
.auth-form .btn[disabled] { opacity: .75; }
.auth-note { font-size: 11.5px; color: #a8a8b2; text-align: center; margin: 16px 0 0; line-height: 1.75; }
.auth-note code { font-size: 11px; background: #f4f4f6; padding: 1px 4px; border-radius: 4px; }
.auth-hint { font-size: 12.5px; color: var(--sub); text-align: center; margin: 14px 0 0; }
.auth-hint a { color: var(--red); font-weight: 600; }
.err {
  background: #fff1f1; border: 1px solid #ffd6d6; color: #c62828;
  font-size: 13px; padding: 10px 12px; border-radius: 10px; margin-bottom: 14px;
  display: flex; gap: 7px; align-items: flex-start; line-height: 1.5;
}
.err svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.err::before { content: "!"; flex: none; width: 16px; height: 16px; margin-top: 1px; border-radius: 50%;
  background: #e05252; color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; }

/* ---------- 个人主页 ---------- */
.profile { }
.pf-top {
  display: flex; gap: 18px; align-items: flex-start; background: #fff; border: 1px solid var(--line);
  border-radius: 16px; padding: 20px; margin-bottom: 14px;
}
.pf-info { flex: 1; min-width: 0; }
.pf-info h1 { font-size: 18px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pf-bio { margin: 6px 0 10px; font-size: 13.5px; color: var(--ink-2); }
.pf-stats { display: flex; gap: 20px; font-size: 12.5px; color: var(--sub); }
.pf-stats b { font-size: 15px; color: var(--ink); margin-right: 3px; font-variant-numeric: tabular-nums; }
.pf-act { flex: none; }

/* ---------- 通知 ---------- */
.noti-list { background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.noti { display: flex; gap: 11px; padding: 13px 16px; border-bottom: 1px solid var(--line); align-items: flex-start; position: relative; }
.noti:last-child { border-bottom: 0; }
.noti:hover { background: #fcfcfd; }
.noti-main { flex: 1; min-width: 0; }
.noti-main p { margin: 0; font-size: 13.5px; }
.noti-t { color: var(--ink-2); }
.noti-p { color: var(--sub) !important; font-size: 12.5px !important; margin-top: 3px !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.noti-time { font-size: 11.5px; color: var(--sub); }
.unread { width: 7px; height: 7px; border-radius: 50%; background: var(--red); flex: none; margin-top: 8px; }

/* ---------- 后台 ---------- */
.admin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 8px; }
.admin-stats > div, .admin-stats > a { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; text-align: center; }
.admin-stats > a { display: block; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s; }
.admin-stats > a:hover { border-color: var(--accent-line); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(20, 30, 70, .07); }
.admin-stats > a:focus-visible, .dash-today > a:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.admin-stats b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.admin-stats span { font-size: 12px; color: var(--sub); }

/* 后台侧边栏布局 */
.admin-shell { display: grid; grid-template-columns: 196px minmax(0, 1fr); gap: 26px; align-items: start; }
/* grid 子项默认 min-width:auto 会被表格撑开，导致里面的 overflow-x 失效 */
.admin-main { min-width: 0; }
.admin-side {
  position: sticky; top: 74px;
  /* 撑满视口高度，别让侧栏缩成上半截小卡片；内容超长时自己滚 */
  min-height: calc(100vh - 128px); max-height: calc(100vh - 96px); overflow-y: auto;
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px 10px;
  scrollbar-width: thin;
}
.as-head { padding: 2px 8px 13px; border-bottom: 1px solid var(--line); margin-bottom: 9px; }
.as-head b { display: block; font-size: 14.5px; line-height: 1.3; }
.as-head span { font-size: 11.5px; color: var(--sub); }
.as-nav { display: flex; flex-direction: column; gap: 2px; }
.as-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; font-size: 13.5px; color: var(--ink-2);
  transition: background .14s, color .14s;
}
.as-item:hover { background: var(--soft, #f4f4f7); color: var(--ink); }
.as-item.on { background: var(--red-soft, #ffe9ec); color: var(--red); font-weight: 600; }
/* 选中项左边加一道色条，比单纯换背景更容易一眼定位 */
.as-item.on::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 17px; border-radius: 0 3px 3px 0; background: currentColor;
}
.as-ico { display: flex; width: 18px; height: 18px; flex: none; opacity: .82; }
.as-ico svg { width: 18px; height: 18px; }
.as-item.on .as-ico { opacity: 1; }
.as-foot {
  margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px;
}
.am-head { margin-bottom: 16px; }
.am-head h1 { font-size: 21px; margin: 0; letter-spacing: -.01em; }

/* 操作结果提示 */
.admin-flash {
  padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px;
  background: #eef4ff; color: #1a4b8f; border: 1px solid #d3e2ff;
}
.admin-flash.ok { background: #e9f7ee; color: #1a7f3f; border-color: #c8ebd5; display: flex; align-items: center; gap: 6px; }
.admin-flash.ok svg { width: 15px; height: 15px; }
.admin-flash.bad { background: #ffecec; color: #b3261e; border-color: #ffd4d4; }

/* 后台筛选条 */
.admin-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.admin-filters .cf-input { font-size: 13px; min-width: 0; }
.admin-filters input[name="q"] { flex: 1; min-width: 160px; padding: 8px 12px; }
/* select 不能用 .cf-input 的 11px 上下 padding，会和固定高度打架把文字挤没 */
.admin-filters select {
  width: auto; min-width: 118px; height: 36px; padding: 0 30px 0 11px;
  font-size: 13px; border: 1px solid #d9d9e2; border-radius: 11px;
  background: #f7f7fa url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%23888' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center/12px;
  appearance: none; -webkit-appearance: none; outline: none; cursor: pointer;
}
.admin-filters select:focus { border-color: var(--accent-line); background-color: #fff; }
.admin-count { font-size: 12.5px; color: var(--sub); margin-bottom: 10px; }
.admin-count b { color: var(--ink); }
.admin-filters input[type="number"] { width: 124px; padding: 8px 10px; }
.admin-filters input[type="date"] { width: auto; padding: 8px 10px; }
.admin-main .cf-input, .admin-main .mini-input, .admin-filters select {
  background-color: var(--bg); color: var(--ink); border-color: var(--line); border-radius: var(--radius-sm);
}
.admin-main .cf-input:focus, .admin-main .mini-input:focus, .admin-filters select:focus {
  background-color: var(--card); border-color: var(--red); outline: 2px solid rgba(var(--accent-rgb), .2); outline-offset: 1px;
}
.admin-main .btn:disabled, .admin-main select:disabled, .admin-reset-dialog .btn:disabled { opacity: .55; cursor: not-allowed; }
.admin-main .table td a:hover { color: var(--red); text-decoration: underline; }
.admin-empty { text-align: center; padding: 24px 16px !important; white-space: normal; }
.admin-empty a { color: var(--red); text-decoration: underline; margin-left: 8px; }
.admin-reset-dialog { max-width: 440px; width: calc(100% - 32px); padding: 22px; border: 0; box-shadow: 0 24px 60px rgba(0, 0, 0, .22); max-height: calc(100vh - 40px); overflow: auto; background: var(--card); color: var(--ink); border-radius: var(--radius-lg); }
.admin-reset-dialog::backdrop { background: rgba(0, 0, 0, .35); }
.admin-reset-dialog h3 { font-size: 16px; margin: 0 0 8px; color: var(--ink); }
.admin-reset-dialog h3 b { color: var(--red); }
.admin-reset-dialog .sf-hint { margin: 0 0 16px; }
.admin-reset-dialog .sf-field { display: block; margin-top: 12px; }
.admin-reset-dialog .cf-input { width: 100%; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.admin-reset-dialog .cf-input:focus { background: var(--card); border-color: var(--red); outline: 2px solid rgba(var(--accent-rgb), .2); outline-offset: 1px; }
.admin-reset-dialog .dlg-btns { flex-wrap: wrap; }
@media (max-width: 620px) {
  .admin-filters input[name="q"] { flex-basis: 100%; }
  .admin-filters input[type="number"], .admin-filters input[type="date"], .admin-filters select { flex: 1 1 124px; max-width: 100%; }
}

/* 后台内容列表：可逆批量隐藏/恢复 */
.thread-bulk-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 0 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: color-mix(in srgb, var(--red) 4%, var(--card));
  color: var(--sub); font-size: 12px;
}
.thread-bulk-select { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); font-weight: 650; cursor: pointer; }
.thread-bulk-bar input[type="checkbox"], .table input.thread-bulk-check, .table thead input[data-thread-select-all] { width: 16px; height: 16px; accent-color: var(--red); cursor: pointer; }
.thread-bulk-actions { display: flex; gap: 7px; }
.thread-bulk-bar small { margin-left: auto; color: var(--sub); }
.thread-bulk-bar .btn:disabled { opacity: .48; cursor: not-allowed; }
.thread-bulk-bar[aria-busy="true"] { opacity: .65; pointer-events: none; }
@media (max-width: 620px) {
  .thread-bulk-bar { gap: 8px; }
  .thread-bulk-bar small { flex-basis: 100%; margin-left: 0; }
}

/* 表格里的行内操作按钮：多个 form 要能并排 */
.td-act { white-space: nowrap; }
.act-form { display: inline-block; margin: 0 2px 2px 0; }
.td-num { font-variant-numeric: tabular-nums; color: var(--sub); font-size: 12.5px; }
.t-flags {
  display: inline-block; margin-left: 6px; font-size: 11px; font-style: normal;
  color: var(--red); background: var(--red-soft, #ffe9ec); padding: 1px 6px; border-radius: 5px;
}
.log-act { font-size: 11.5px; background: var(--soft, #f4f4f7); padding: 2px 6px; border-radius: 5px; }
.w-tag { width: 110px; }
.tag-rename { display: inline-flex; gap: 4px; align-items: center; }

/* 自定义主色 */
.accent-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding: 12px 14px;
  background: var(--soft, #f7f7fa); border-radius: 12px;
}
.accent-row input[type="color"] {
  width: 44px; height: 30px; padding: 0; border: 1px solid var(--line);
  border-radius: 8px; background: none; cursor: pointer;
}
.accent-row .sf-hint { margin: 0; }

/* 飞书通知 */
.fs-state {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 13px; border-radius: 10px; margin-bottom: 14px;
  background: #fff4f4; border: 1px solid #ffd9d9;
}
.fs-state.on { background: #eefaf1; border-color: #c8ebd5; }
.fs-toggles { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 4px; }

/* 插件列表 */
.plug-group { margin-bottom: 18px; }
.plug-gtitle {
  font-size: 12.5px; font-weight: 600; color: var(--sub);
  margin: 0 0 8px; letter-spacing: .04em;
}
.plug-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.plug-item {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; transition: border-color .15s, background .15s;
}
.plug-item:hover { border-color: var(--accent-line, #d9d9e2); }
.plug-item input {
  margin-top: 2px; width: 16px; height: 16px; flex: none; accent-color: var(--red); cursor: pointer;
}
.plug-txt b { display: block; font-size: 13.5px; line-height: 1.4; }
.plug-txt em { display: block; font-size: 11.5px; font-style: normal; color: var(--sub); line-height: 1.5; margin-top: 2px; }
/* 勾上时整块高亮，一眼看出哪些开着 */
.plug-item:has(input:checked) { border-color: rgba(var(--accent-rgb), .35); background: rgba(var(--accent-rgb), .035); }

/* 收藏夹 */
.fav-sel {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  max-width: 118px; height: 26px; padding: 0 6px;
  border-radius: 8px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .95); font-size: 11.5px; color: var(--ink-2);
  cursor: pointer; box-shadow: 0 2px 8px -4px rgba(0, 0, 0, .3);
}
.fav-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.fav-bar .tabs { margin: 0; flex-wrap: wrap; }
.fav-new { display: flex; gap: 6px; margin-left: auto; }
.fav-new input {
  height: 30px; width: 132px; padding: 0 10px; font-size: 12.5px;
  border-radius: 8px; border: 1px solid var(--line); background: #f6f6f8; outline: none;
}
.fav-new input:focus { background: #fff; border-color: var(--accent-line); }

/* 草稿箱 */
.draft-item {
  display: flex; gap: 16px; align-items: flex-start; justify-content: space-between;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 10px; transition: border-color .15s, box-shadow .15s;
}
.draft-item:hover { border-color: rgba(var(--accent-rgb), .2); box-shadow: var(--shadow-1); }
.di-main { min-width: 0; }
.di-main h3 { font-size: 15px; margin: 0 0 6px; line-height: 1.45; }
.di-main p { margin: 0 0 8px; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.di-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.di-tags span { font-size: 11.5px; color: var(--sub); }
.di-time { font-size: 11.5px; color: var(--sub); }
.di-act { display: flex; gap: 8px; flex: none; }
.cf-actions { display: flex; gap: 10px; align-items: center; }
@media (max-width: 640px) {
  .draft-item { flex-direction: column; gap: 12px; }
  .di-act { width: 100%; }
  .di-act .btn { flex: 1; }
}

/* 个人主页：热门笔记推荐位 */
.pf-hot { margin: 4px 0 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.pf-hot .sec-title { margin-bottom: 10px; }
.pf-hot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pf-hot-grid .card-wrap { margin: 0; }
@media (max-width: 720px) {
  .pf-hot-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .pf-hot-grid .card-wrap:nth-child(3) { display: none; }
}

/* 网盘资源卡 */
.drive-box {
  margin: 18px 0 4px; padding: 14px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
}
.drive-top { display: flex; align-items: center; gap: 10px; }
.drive-ico {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  display: grid; place-items: center; background: var(--red-soft); color: var(--red);
}
.drive-ico svg { width: 17px; height: 17px; }
.drive-title b { display: block; font-size: 13.5px; }
.drive-title em { font-style: normal; font-size: 11.5px; color: var(--sub); }
.drive-body {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line);
}
.drive-link { font-size: 12.5px; color: var(--red); word-break: break-all; flex: 1; min-width: 0; }
.drive-code { font-size: 12.5px; color: var(--ink-2); }
.drive-code b { color: var(--ink); letter-spacing: .5px; }
.drive-lock {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line);
}
.drive-lock p { margin: 0; font-size: 12.5px; color: var(--sub); }

/* 后台：数据看板 */
.dash-today { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.dash-today > div, .dash-today > a {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
}
.dash-today > a { display: block; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s; }
.dash-today > a:hover { border-color: var(--accent-line); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(20, 30, 70, .07); }
.dash-today b { display: block; font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.dash-today span { font-size: 12px; color: var(--sub); }
.dash-chart {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px 10px; margin-bottom: 14px;
}
.dash-chart-head { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-2); margin-bottom: 10px; }
.dash-chart-head em { font-style: normal; color: var(--sub); }
.dash-chart svg { width: 100%; height: 108px; display: block; }
.dash-chart .axis { stroke: var(--line); stroke-width: 1; }
.dash-chart .bar { fill: var(--red); opacity: .82; transition: opacity .15s; cursor: pointer; }
.dash-chart .bar:hover, .dash-chart .dash-bar-link:focus .bar { opacity: 1; }
.dash-chart .bar.zero { fill: var(--line); }
.dash-detail-link { color: var(--ink-2); text-decoration: none; font-variant-numeric: tabular-nums; }
.dash-detail-link:hover { color: var(--red); text-decoration: underline; }
.dash-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--sub); margin-top: 6px; }
.dash-table { margin-bottom: 8px; }
.dash-table td:first-child { color: var(--sub); }

/* 后台：站点设置 */
.site-form {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 20px 16px; margin-bottom: 22px;
}
.sf-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 14px; }
.sf-field { display: block; }
/* 友情链接那种 textarea 需要整行，不然挤在半列里只能看见两行 */
.sf-field-wide { grid-column: 1 / -1; }
.sf-label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 7px; }
.sf-label-block { margin-top: 16px; }
.sf-hint { display: block; font-size: 11.5px; color: var(--sub); margin-top: 6px; }
.theme-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.thm-item { position: relative; }
.thm-item input { position: absolute; opacity: 0; pointer-events: none; }
.thm-card {
  display: block; padding: 12px 12px 11px; border-radius: 12px; height: 100%;
  border: 1.5px solid var(--line); background: #fff; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.thm-card:hover { border-color: #d8d8e0; transform: translateY(-1px); }
.thm-item input:checked + .thm-card {
  border-color: var(--red); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .1);
}
.thm-item input:focus-visible + .thm-card { outline: 2px solid var(--red); outline-offset: 2px; }
.thm-swatch {
  display: block; width: 26px; height: 26px; border-radius: 8px; margin-bottom: 9px;
  box-shadow: 0 4px 10px -4px rgba(0, 0, 0, .35);
}
.thm-card b { display: block; font-size: 13px; margin-bottom: 3px; }
.thm-card em { font-style: normal; font-size: 11.5px; color: var(--sub); line-height: 1.5; }
.sf-foot { display: flex; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.sf-ok { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: #0f9b8e; }
.sf-ok svg { width: 14px; height: 14px; }
.sf-err { font-size: 12.5px; color: #c62828; }

/* NAS 挂载：底部那行「当前挂到哪」 */
.nas-now {
  display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 12px; color: var(--sub);
}
.nas-now code {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px;
  background: color-mix(in srgb, var(--ink) 6%, var(--card));
  padding: 2px 6px; border-radius: 5px; color: var(--ink-2);
}
.nas-now em {
  font-style: normal; font-size: 11px; font-weight: 600;
  padding: 2px 7px; border-radius: 999px;
}
.nas-now em.ok {
  background: color-mix(in srgb, #22c55e 18%, var(--card));
  color: color-mix(in srgb, #16a34a 72%, var(--ink));
}
.nas-now em.warn {
  background: color-mix(in srgb, #f59e0b 20%, var(--card));
  color: color-mix(in srgb, #b45309 72%, var(--ink));
}

/* 后台：存储设置 */
.store-pick { margin-bottom: 4px; }
.store-pane { margin-top: 16px; }
.store-pane[hidden] { display: none; }

/* 当前生效的存储状态：后台先看到"现在用的是哪、能不能写"，再动手改 */
.store-state {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; margin-bottom: 16px;
}
.ss-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.ss-head b { font-size: 13.5px; }
.ss-ok { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: #1a8f4a; }
.ss-ok svg { width: 14px; height: 14px; }
.ss-bad { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: #c62828; }
.ss-list { display: grid; gap: 7px; margin: 0; }
.ss-list > div { display: flex; gap: 12px; font-size: 12.5px; align-items: baseline; }
.ss-list dt { color: var(--sub); flex: none; width: 96px; }
.ss-list dd { margin: 0; color: var(--ink); word-break: break-all; }
.ss-list code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; background: var(--soft, #f4f4f7); padding: 2px 6px; border-radius: 5px;
}
.sf-check {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--ink-2); margin-top: 12px; cursor: pointer;
}
.sf-check input { accent-color: var(--red); width: 15px; height: 15px; }
.sf-hint code {
  background: #f2f2f5; padding: 1px 5px; border-radius: 4px;
  font-size: 11.5px; font-family: ui-monospace, Menlo, Consolas, monospace;
}

@media (max-width: 860px) {
  .sf-grid { grid-template-columns: 1fr; }
  .dash-today { grid-template-columns: repeat(2, 1fr); }
  .theme-pick { grid-template-columns: repeat(2, 1fr); }
}
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; color: var(--sub); font-size: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.td-text { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-act { white-space: nowrap; }

/* ---------- 弹窗 / 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 12px); z-index: 90;
  background: rgba(24, 24, 28, .92); color: #fff; font-size: 13.5px; padding: 10px 18px;
  border-radius: 22px; opacity: 0; pointer-events: none; transition: .22s; backdrop-filter: blur(8px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.dlg { border: 0; border-radius: 16px; padding: 0; box-shadow: 0 24px 60px rgba(0, 0, 0, .22); max-width: 330px; width: 90%; }
.dlg::backdrop { background: rgba(0, 0, 0, .35); }
.dlg-in { padding: 22px; }
.dlg-in h3 { font-size: 16px; margin-bottom: 14px; }
.rd { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 8px 0; color: var(--ink-2); cursor: pointer; }
.dlg-btns { display: flex; gap: 10px; margin-top: 16px; }
.dlg-btns .btn { flex: 1; }

.err-page { text-align: center; padding: 64px 20px 80px; max-width: 440px; margin: 0 auto; }
.err-page b {
  display: block; font-size: 72px; font-weight: 800; line-height: 1;
  color: transparent; background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  -webkit-background-clip: text; background-clip: text;
}
.err-page h1 { font-size: 19px; margin: 18px 0 8px; }
.err-page p { color: var(--sub); font-size: 13.5px; margin: 0 0 24px; }
.err-search { display: flex; gap: 8px; margin: 0 0 14px; }
.err-search input {
  flex: 1; min-width: 0; height: 40px; border-radius: 10px; padding: 0 14px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-size: 13.5px; outline: none;
}
.err-search input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .1); }
.err-links { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ---------- 底部 footer ---------- */
.site-ft {
  max-width: var(--maxw); margin: 0 auto; padding: 16px 20px 28px;
  text-align: center; border-top: 1px solid var(--border, #e8e8ee);
}
.ft-nav { display: flex; gap: 6px 18px; justify-content: center; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.ft-nav a { font-size: 13px; color: var(--sub); text-decoration: none; transition: color .2s; }
.ft-nav a:hover { color: var(--accent-line); }
.ft-links { display: flex; gap: 6px 14px; justify-content: center; flex-wrap: wrap; align-items: center; margin-bottom: 6px; }
.ft-label { font-size: 12px; font-weight: 600; color: var(--sub); }
.ft-links a { font-size: 12px; color: var(--sub); text-decoration: none; transition: color .2s; }
.ft-links a:hover { color: var(--accent-line); }
.ft-icp { font-size: 12px; color: var(--sub); }
.ft-icp a { color: var(--sub); text-decoration: none; }
.ft-icp a:hover { color: var(--accent-line); }

/* ---------- 友链页 ---------- */
.link-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 18px; }
.link-card { display: block; padding: 18px; border: 1px solid var(--border, #e8e8ee); border-radius: 14px; background: var(--card); text-decoration: none; transition: transform .15s, box-shadow .15s, border-color .15s; }
.link-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 0, 0, .08); border-color: var(--accent-line); }
.link-card h3 { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.link-card p { font-size: 12px; color: var(--sub); word-break: break-all; }
.links-icp { margin-top: 22px; text-align: center; font-size: 12px; color: var(--sub); }

/* ---------- 移动端底部导航 ---------- */
.mobile-nav { display: none; }

/* ============================================================
   响应式
   ============================================================ */
/* 容器宽度已经在 :root 里用 clamp 做成流体，这里只处理列数收窄 */
@media (max-width: 1560px) {
  /* 右栏让位给正文：1560 以下三栏会把内容挤到 700 以内，卡片全变成窄条。
     帖子页的右栏（作者/目录/相关）同理，一起收起来。 */
  .wrap.with-rail { grid-template-columns: 180px minmax(0, 1fr); }
  .rail, .t-rail { display: none; }
}
@media (max-width: 1000px) {
  .wrap, .wrap.with-rail { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  /* 左栏收起来后，安装入口挪到首页信息流顶部；明确恢复单行横排布局 */
  .app-strip { display: flex; flex-flow: row nowrap; align-items: center; gap: 10px; }
  .app-strip .app-txt { flex: 1 1 auto; min-width: 0; }
  .app-strip .app-install { flex: 0 0 auto; justify-self: auto; }
  /* 861–1000px 是平板竖屏，3 列每列 260px 刚好；
     手机端（≤860）另有 2 列规则，不受这里影响。 */
  .masonry { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .thread { padding: 20px; border-radius: 0; border-left: 0; border-right: 0; }
}
@media (max-width: 860px) {
  body { padding-bottom: calc(64px + var(--safe-b)); }
  .topbar-in { height: 48px; padding: 0 12px; gap: 10px; }
  .brand b { display: none; }
  /* 发现/版块在底部导航里已经有了，窄屏顶栏整块去掉 */
  .top-nav { display: none; }
  .top-actions > a span { display: none; }
  .top-actions .publish { padding: 0 11px; }
  .top-actions .publish span { display: inline; font-size: 13px; }
  .auth-links { gap: 6px; }
  .auth-links .btn { padding: 0 10px; }
  .search { max-width: none; min-width: 0; }
  /* 窄屏顶栏放不下两个按钮：只留「登录」，注册入口在登录页的切换标签里 */
  .auth-links .btn:not(.ghost) { display: none; }
  .wrap { padding: 10px 12px 28px; }
  .masonry { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .card { border-radius: 11px; }
  /* 手机端统一封面比例：横图(1.78)、竖图(0.75) 混排时
     高度能差 3 倍，瀑布流看起来就是"乱"。固定 4:5 后每张卡片等高，
     图片用 object-fit:cover 裁切填满（信息流缩略图的标准做法）。 */
  .card-media { aspect-ratio: 4 / 5 !important; }
  .card-media img, .card-media picture { width: 100%; height: 100%; object-fit: cover; }
  /* 窄屏卡片只有 170~200px 宽，标题 12.5px 一行放不下几个字，
     提到 13px 反而更好读；行高收紧、限制 3 行，避免长标题把卡片撑成柱子。
     min-height 给足 2 行：一行标题的卡片也占同样位置，
     否则 24 张卡片会出现 287/306/325 三种高度，右列参差。 */
  .card-title { font-size: 13px; line-height: 1.45; margin-bottom: 7px; min-height: 2.9em; }
  .card-body { padding: 10px 11px 11px; }
  .card-foot { font-size: 11px; }
  .card-foot .who em { max-width: 72px; }
  .t-title { font-size: 20px; }
  .t-body { font-size: 15px; }
  .t-body .md-h2, .rp-body .md-h2 { font-size: 17px; margin-top: 24px; }
  .toc-list { max-height: 40vh; padding-left: 12px; padding-right: 12px; }
  .tag-index { padding: 14px; gap: 8px; }
  .tag-chip { padding: 7px 12px; }
  .tag-chip.hot { font-size: 16px; }
  .about { padding: 20px 16px 24px; border-radius: 0; border-left: 0; border-right: 0; }
  .about h1 { font-size: 22px; }
  .about-stats { grid-template-columns: repeat(2, 1fr); }
  .t-stats { margin-left: 0; }
  .pf-top { padding: 18px; gap: 13px; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .compose-form { padding: 16px; border-radius: 0; border-left: 0; border-right: 0; }
  .tabs { margin-left: -4px; margin-right: -4px; }
  .mobile-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); padding: 6px 0 calc(6px + var(--safe-b));
    justify-content: space-around; align-items: center;
  }
  .mobile-nav a {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 10.5px; color: var(--sub); flex: 1 1 0; min-width: 0; position: relative;
  }
  .mobile-nav a svg { width: 19px; height: 19px; }
  .mobile-nav a.on { color: var(--ink); font-weight: 600; }
  .mobile-nav .fab {
    flex: 0 0 auto;
    width: 42px; height: 42px; border-radius: 50%; background: var(--red); color: #fff;
    display: grid; place-items: center; box-shadow: 0 6px 18px rgba(var(--accent-rgb), .35);
    margin-top: -16px;
  }
  .mobile-nav .fab svg { width: 22px; height: 22px; }
  .mobile-nav .dot { top: 0; right: 26%; }
  .toast { bottom: calc(84px + var(--safe-b)); }
  /* 后台：侧边栏收成顶部横滑导航，别占掉半屏 */
  .admin-shell { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .admin-side { position: static; padding: 8px; border-radius: 12px; min-height: 0; max-height: none; }
  .as-head { display: none; }
  .as-nav { flex-direction: row; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .as-nav::-webkit-scrollbar { display: none; }
  .as-item { flex: none; padding: 8px 12px; white-space: nowrap; }
  .as-ico { width: 15px; height: 15px; }
  .as-ico svg { width: 15px; height: 15px; }
  .as-foot { flex-direction: row; gap: 4px; margin-top: 6px; padding-top: 6px; }
  .am-head { margin-bottom: 12px; }
  .am-head h1 { font-size: 18px; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  /* 表格列多，手机上保持最小宽度靠横向滚动，不要压成看不清 */
  .admin-main .table { min-width: 760px; }
  .admin-main .td-text { max-width: 220px; }
}
@media (max-width: 380px) {
  .masonry { gap: 8px; }
  .card-title { font-size: 12.5px; }
  .card-body { padding: 9px 10px 10px; }
}

/* ---------- @提及 / 回复编辑 / 关注列表 / 后台版块 ---------- */
.mention {
  color: #1a6fd4; font-weight: 600; background: #eef4ff;
  padding: 0 3px; border-radius: 4px;
}
.mention:hover { background: #e0ebff; }
.t-body strong, .rp-body strong { font-weight: 650; color: var(--ink); }

.rp-editor textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px;
  font: inherit; font-size: 13.5px; line-height: 1.7; resize: vertical;
  background: #fff; color: var(--ink); min-height: 84px;
}
.rp-editor textarea:focus { outline: 2px solid rgba(var(--accent-rgb), .18); border-color: var(--red); }
.rp-editor-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 8px; font-size: 12px;
}

.people { display: flex; flex-direction: column; gap: 2px; }
.person {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
}
.person + .person { margin-top: 8px; }
.person-av { flex: none; display: block; }
.person-main { flex: 1; min-width: 0; }
.person-name { font-size: 14px; font-weight: 600; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.person-name:hover { color: var(--red); }
.person-bio {
  margin: 2px 0 3px; font-size: 12.5px; color: var(--sub);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.person-meta { font-size: 11.5px; color: var(--sub); font-variant-numeric: tabular-nums; }

.mini-input {
  height: 30px; padding: 0 8px; font-size: 12.5px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink);
  width: 100%; max-width: 180px;
}
.mini-input:focus { outline: 2px solid rgba(var(--accent-rgb), .16); border-color: var(--red); }
.mini-input.w-emoji { max-width: 56px; text-align: center; }
.mini-input.w-sort { max-width: 68px; }
.mini-input.wide { max-width: 320px; }

.board-new {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-top: 12px; padding: 12px 14px;
  background: var(--card); border: 1px dashed var(--line); border-radius: 12px;
}
.board-new .mini-input { max-width: 200px; }
.board-new .mini-input.wide { max-width: 300px; }

.ok {
  background: #eefaf0; border: 1px solid #cdebd4; color: #1b7a37;
  font-size: 13px; padding: 9px 12px; border-radius: 10px; margin-bottom: 14px;
}

.pf-stats a { color: var(--sub); }
.pf-stats a:hover { color: var(--red); }

/* ---------- 暗色模式（跟随系统） ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ededf2; --ink-2: #b8b8c2; --sub: #8b8b96;
    --line: #26262c; --bg: #131316; --card: #1b1b20; --red-soft: #2a1519;
    --shadow: 0 2px 8px rgba(0, 0, 0, .4);
  }
  /* 深色底上的点阵换成浅色，否则一层黑点完全看不见 */
  body { background-image:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .035) 1px, transparent 0),
    radial-gradient(1100px 620px at 8% -6%, rgba(var(--accent-rgb), .1), transparent 62%),
    radial-gradient(900px 560px at 100% -4%, rgba(99, 122, 255, .07), transparent 60%),
    var(--bg-image);
  }
  .topbar { background: rgba(19, 19, 22, .9); }
  .search input { background: #202026; }
  .search input:focus { background: #26262c; }
  .btn.ghost { background: #1b1b20; }
  .btn.ghost:hover { background: #232329; }
  .tabs { background: #232329; }
  .tab.on { background: #34343c; color: var(--red); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
  /* 顶栏导航的选中态原来写死 #f4f4f6，深色下变成白底白字，整块看不见 */
  .top-nav > a:hover, .top-actions > a:hover { background: #232329; color: var(--ink); }
  .top-nav > a.on, .top-actions > a.on { background: var(--red-soft); color: var(--red); }
  .pg { background: #1b1b20; border-color: #2a2a32; }
  .pg:hover { border-color: #3a3a44; }
  .tag-cloud a:hover { background: var(--red-soft); }
  .board-list a:hover { background: #232329; }
  /* .bc-emoji 不再需要深色覆盖：底色是 color-mix(--bc, var(--card))，跟着卡面走 */
  .rank-list a:hover, .author-list a:hover { background: #232329; }
  .role-badge.mod { background: #14261b; color: #5ec27f; }
  .mb-list label { background: #232329; }
  .rk { background: #232329; }
  .rail-stats div { background: #202026; }
  .pg.on { background: #ededf2; color: #131316; }
  .card, .thread, .side-block, .board-card, .compose-form, .auth-card,
  .noti-list, .table-wrap, .admin-stats > div, .admin-stats > a, .pf-top { background: var(--card); }
  .cf-input, .auth-form input, .up-btn, .bp span, .ep span, .reply-form, .login-hint { background: #202026; }
  .cf-input { border-color: #34343e; }
  .cf-input:hover { border-color: #42424e; }
  .cf-input.is-error { border-color: #8a3036; background: #2a1618; }
  .cf-img-btn { background: #202026; border-color: #2a2a32; }
  .menu-pop { background: #1f1f25; }
  .menu-pop a:hover, .menu-pop button:hover { background: #2a2a31; }
  .quote { background: #232329; border-left-color: #33333b; }
  .t-body .code-wrap, .rp-body .code-wrap { background: #17171c; border-color: #2a2a32; }
  .t-body .code-head, .rp-body .code-head { background: #202026; border-color: #2a2a32; }
  .t-body .code-copy, .rp-body .code-copy { background: #26262c; border-color: #3a3a44; color: var(--ink-2); }
  .toc { background: #1f1f25; }
  .toc-list { border-top-color: #2a2a32; }
  .toc > summary em { color: var(--sub); }
  .tag-chip, .about-stats div, .about-boards a { background: #202026; border-color: #2a2a32; }
  .tag-chip.hot { background: #2a1519; border-color: #46202a; }
  .tag-hint code, .about code { background: #26262c; }
  .mod-bar { background: #202026; }
  .notice { background: #2a2410; border-color: #4a3d13; color: #e0c070; }
  .mobile-nav { background: rgba(19, 19, 22, .95); }
  .gallery { background: #202026; }
  .dlg { background: #1f1f25; color: var(--ink); }
  .err { background: #2a1618; border-color: #4a2024; }
  .auth-tabs { background: #202026; }
  .auth-tabs a.on { background: #2b2b33; color: var(--ink); box-shadow: none; }
  .auth-form input:hover { background: #26262c; }
  .auth-form input:focus { background: #26262c; border-color: #5a2a33; box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .1); }
  .pw-toggle:hover { background: #2a2a31; }
  .auth-note code { background: #26262c; }
  .auth-shell { background: #17171c; border-color: #2a2a32; box-shadow: 0 30px 60px -40px rgba(0, 0, 0, .8); }
  .thm-card { background: #1b1b21; border-color: #2a2a32; }
  .thm-card:hover { border-color: #3a3a44; }
  .site-form { background: #17171c; border-color: #2a2a32; }
  .store-state { background: #1b1b21; border-color: #2a2a32; }
  .ss-list code { background: #26262c; }
  .ss-ok { color: #6fd08a; }
  .ss-bad { color: #e57373; }
  .admin-side { background: #17171c; border-color: #2a2a32; }
  .as-head, .as-foot { border-color: #2a2a32; }
  .as-item:hover { background: #22222a; color: #fff; }
  .as-item.on { background: rgba(var(--accent-rgb), .17); color: #ff9aa6; }
  .am-head h1 { color: #fff; }
  .admin-flash { background: #1c2436; color: #9dc0f5; border-color: #2a3a55; }
  .admin-flash.ok { background: #17291d; color: #7fd39a; border-color: #24432f; }
  .admin-flash.bad { background: #2b1a1a; color: #ef9a9a; border-color: #4a2626; }
  .log-act { background: #26262c; }
  .t-flags { background: rgba(var(--accent-rgb), .18); }
  .t-meta { background: #1b1b21; border-color: #2a2a32; }
  .dash-chart .bar.zero { fill: #2a2a32; }
  .fav-sel { background: #232329; }
  .fav-new input { background: #202026; }
  .reply:hover { background: #1b1b21; }
  .act:hover { background: #232329; border-color: #3a3a44; }
  .card:hover .card-title { color: var(--red); }
  /* 生成的封面是浅色纸面，深色主题下像贴了张白纸；压暗一点融进背景。
     只针对 /covers/ 下的自制封面，用户上传的真实照片不动。 */
  .card-media img[src*="/covers/"] { filter: brightness(.82) saturate(.92); }
  .drive-box { background: #17171c; border-color: #2a2a32; }
  .sf-hint code { background: #26262c; }
  .tp-related a { background: #26262c; }
  .tag-panel, .user-row, .tag-chip { background: #1b1b21; border-color: #2a2a32; }
  .sh-chip { background: #1b1b21; border-color: #2a2a32; }
  .rp-child:hover { background: #1b1b21; }
  .auth-side { background: #1b1b21; border-right-color: #2a2a32; }
  .auth-shell .auth-card { background: transparent; border: 0; }
  .ok { background: #14251a; border-color: #24452d; color: #6fd08a; }
  .mention { background: #1b2b3d; color: #7fb2ff; }
  .mention:hover { background: #22354c; }
  .mini-input, .rp-editor textarea { background: #202026; border-color: #33333b; }
  .role-badge { background: #1d2836; }
  .empty { background: transparent; }
  .site-ft { border-top-color: #2a2a32; }
  .link-card { background: #1b1b21; border-color: #2a2a32; }
  .link-card:hover { border-color: #3a3a44; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
}

/* ---------- 登录页响应式（放在最后，确保覆盖暗色规则） ---------- */
@media (max-width: 1000px) {
  .auth-shell { grid-template-columns: minmax(0, 1fr) 372px; }
  .auth-side { padding: 34px 28px; }
  .auth-side h1 { font-size: 23px; }
  .auth-main { padding: 34px 28px 26px; }
}
@media (max-width: 860px) {
  .auth-shell {
    display: block; max-width: 440px; margin: 12px auto 28px; justify-self: auto;
    background: transparent; border: 0; border-radius: 0; box-shadow: none;
  }
  .auth-side { display: none; }
  .auth-main { padding: 0; }
  .auth-shell .auth-card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: 18px; padding: 24px 20px 20px;
    box-shadow: 0 1px 2px rgba(20, 20, 30, .04), 0 18px 40px -30px rgba(20, 20, 30, .3);
  }
  .auth-brand-mobile { display: flex; flex-direction: column; align-items: center; gap: 9px; margin-bottom: 18px; }
  .auth-head { text-align: center; }
  .auth-head h2 { font-size: 19px; }
  .auth-head p { margin-bottom: 18px; }
  .auth-note { margin-top: 14px; }
}
@media (prefers-color-scheme: dark) and (max-width: 860px) {
  .auth-shell .auth-card { background: #202026; border-color: #2a2a32; }
}

/* ============================ 全站公告 ============================ */
.notice-bar { background: var(--red-soft); border-bottom: 1px solid var(--line); }
.notice-in {
  max-width: 1240px; margin: 0 auto; padding: 8px 20px;
  display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-2);
}
.notice-in b {
  flex: none; font-size: 11px; font-weight: 700; letter-spacing: .04em;
  color: var(--red); border: 1px solid currentColor; border-radius: 5px; padding: 1px 5px;
}
.notice-in span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================ 私信列表 ============================ */
.dm-list { display: flex; flex-direction: column; gap: 8px; max-width: 720px; }
.dm-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  color: inherit; transition: border-color .15s, transform .15s;
}
.dm-item:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.dm-body { flex: 1; min-width: 0; }
.dm-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.dm-top b { font-size: 14px; }
.dm-top span { flex: none; font-size: 12px; color: var(--sub); }
.dm-body p {
  margin: 4px 0 0; font-size: 13px; color: var(--sub);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dm-body p em { font-style: normal; color: var(--ink-2); }
.dm-badge {
  flex: none; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 11px; font-style: normal;
  display: grid; place-items: center;
}

/* ============================ 私信对话 ============================ */
.chat-head { display: flex; align-items: center; gap: 10px; padding: 4px 0 14px; max-width: 860px; }
.ch-back {
  width: 32px; height: 32px; flex: none; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink-2);
}
.ch-back:hover { background: var(--bg); }
.ch-back svg { width: 18px; height: 18px; }
.ch-who { display: flex; flex-direction: column; line-height: 1.35; }
.ch-who b { font-size: 15px; }
.ch-who span { font-size: 12px; color: var(--sub); }
.chat-body {
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); max-width: 860px;
  min-height: 320px; max-height: min(62vh, 640px); overflow-y: auto;
}
.msg { display: flex; align-items: flex-end; gap: 8px; max-width: 78%; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.bubble {
  background: var(--bg); border-radius: 14px; padding: 8px 12px;
  font-size: 14px; line-height: 1.62; color: var(--ink); min-width: 0;
}
.msg.me .bubble { background: var(--red); color: #fff; }
.bubble p { margin: 0; word-break: break-word; }
.bubble time { display: block; margin-top: 3px; font-size: 11px; opacity: .6; }
.chat-form { display: flex; align-items: flex-end; gap: 10px; margin-top: 12px; max-width: 860px; }
.chat-form textarea {
  flex: 1; min-height: 56px; padding: 10px 12px; resize: vertical;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--ink); font: inherit; font-size: 14px; line-height: 1.6;
}
.chat-form textarea:focus { outline: none; border-color: var(--accent-line); }
.chat-form .btn { height: 44px; display: inline-flex; align-items: center; gap: 6px; }
.chat-form .btn svg { width: 16px; height: 16px; }
.chat-err { margin: 8px 0 0; font-size: 13px; color: #c2410c; }

/* ============================ 榜单 ============================ */
.rank-cols { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.rank-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* 卡片本身也是网格/弹性子项，默认 min-width:auto 会被里面 nowrap 的长标题顶开，
   在窄屏上整张卡就比容器还宽。给它 0，标题才会按 ellipsis 截断而不是撑破布局。 */
.rank-card {
  min-width: 0;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 14px 16px;
}
.rank-card h2 {
  margin: 0 0 10px; font-size: 14px;
  display: flex; align-items: baseline; gap: 8px;
}
/* 量词只写一次：以前每行末尾都挂一个「热度」，十行重复十遍，纯噪音 */
.rank-hint {
  margin-left: auto; font-size: 11px; font-weight: 500;
  color: var(--sub); letter-spacing: 0;
}
.rank-row {
  display: flex; align-items: center; gap: 12px; padding: 9px 6px;
  border-radius: 10px; color: inherit;
  transition: background .15s;
}
.rank-row:hover { background: color-mix(in srgb, var(--red) 5%, var(--card)); }
.rank-no {
  flex: none; width: 22px; height: 22px; line-height: 22px;
  text-align: center; font-style: normal; border-radius: 50%;
  font-size: 13px; font-weight: 700; color: var(--sub);
  font-variant-numeric: tabular-nums;
}
/* 前三名给一枚渐变圆章，一眼能看出榜单的前段 */
.rank-no.top {
  color: #fff; font-size: 12px;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  box-shadow: 0 3px 9px -3px rgba(var(--accent-rgb), .75);
}
.rank-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.rank-main b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-main span { font-size: 12px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-num { flex: none; text-align: right; }
.rank-num b { display: block; font-size: 14px; color: var(--red); font-variant-numeric: tabular-nums; }
.rank-num span { font-size: 11px; color: var(--sub); }
.rank-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.rank-tag {
  font-size: 12.5px; padding: 5px 10px; border-radius: 14px;
  background: var(--bg); color: var(--ink-2);
}
.rank-tag:hover { background: var(--red-soft); color: var(--red); }
.rank-tag em { font-style: normal; color: var(--sub); margin-left: 4px; }
.rank-tag:hover em { color: inherit; }

/* ============================ 图片广场 ============================ */
.g-grid { column-count: 5; column-gap: 10px; }
.g-item {
  display: block; position: relative; margin-bottom: 10px;
  break-inside: avoid; border-radius: 12px; overflow: hidden; background: var(--card);
}
/* 图片还没到之前，img 的 alt 文字会被浏览器画在框里，一片标题很乱；
   color:transparent 只是让它不显示，alt 本身仍留在无障碍树里。
   底色给个浅灰，未加载时就是一块占位，不会闪白。 */
.g-item img {
  display: block; width: 100%; aspect-ratio: var(--ar, 1); object-fit: cover;
  color: transparent; background: linear-gradient(135deg, var(--card), var(--line));
  transition: transform .3s;
}
.g-item:hover img { transform: scale(1.03); }
.g-t {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 10px 8px;
  font-size: 11.5px; color: #fff; line-height: 1.4;
  background: linear-gradient(transparent, rgba(0, 0, 0, .6));
  opacity: 0; transition: opacity .2s;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.g-item:hover .g-t { opacity: 1; }
.empty.sm { padding: 26px 12px; font-size: 13px; }

@media (max-width: 1200px) { .g-grid { column-count: 4; } }
@media (max-width: 940px) {
  .g-grid { column-count: 3; }
  .rank-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 620px) {
  .g-grid { column-count: 2; }
  .chat-body { max-height: 58vh; }
  .msg { max-width: 88%; }
  .notice-in { padding: 8px 12px; font-size: 12px; }
  /* 手机上引导卡跟着卡片一起缩 */
  .card-filler .card-body { min-height: 74px; }
  .cf-plus { font-size: 28px; }
}

@media (prefers-color-scheme: dark) {
  .bubble { background: #26262c; }
  .dm-item:hover { border-color: #3a3a44; }
  .chat-form textarea { background: #202026; border-color: #2a2a32; }
  .rank-row:hover { background: #232329; }
  .rank-tag { background: #232329; }
  .notice-bar { background: #2a1519; }
}

/* ============================ 版规 / 社区守则 ============================ */
/* 版规走「左目录 + 右正文」的文档版式，不是帖子流。
   正文由 parseRules() 按「第X章 / 第X条」切成结构再渲染，
   所以这里只需要管三层的排版：章、条、条内的条目。 */
.rules-wrap {
  max-width: 1080px; margin: 0 auto;
  display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 36px;
  align-items: start;
}

/* 目录跟着滚动停在视口里：条款十几条，来回翻太累 */
.rules-toc {
  position: sticky; top: 80px;
  max-height: calc(100vh - 104px); overflow: auto;
  font-size: 12.5px; line-height: 1.5; padding-right: 4px;
}
.rules-toc > b {
  display: block; font-size: 11px; font-weight: 600; letter-spacing: .1em;
  color: var(--sub); margin-bottom: 10px; padding-left: 10px;
}
.rules-toc ol { list-style: none; margin: 0; padding: 0; }
.rules-toc ol ol {
  margin: 2px 0 8px; padding-left: 12px;
  border-left: 1px solid var(--line);
}
.rules-toc li { margin: 0; }
.rules-toc a {
  display: block; padding: 4px 10px; border-radius: 7px; color: var(--sub);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background .15s, color .15s;
}
.rules-toc > ol > li > a { font-weight: 600; color: var(--ink); margin-top: 4px; }
/* 没有章标题的那一段（原文直接从「第一条」开始），条款直接挂在顶层，
   样式要跟二级条款一致，不能跟着章标题变成粗体 */
.rules-toc > ol > li.toc-flat > a {
  font-weight: 400; font-size: 12px; color: var(--sub); margin-top: 0; padding: 3px 10px;
}
.rules-toc a:hover { background: color-mix(in srgb, var(--ink) 5%, var(--card)); color: var(--red); }

.rules-doc {
  min-width: 0;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-1);
  padding: 40px 46px 36px;
}
.rules-head { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.rules-kicker {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .12em;
  color: var(--red); background: var(--red-soft);
  padding: 4px 9px; border-radius: 999px; margin-bottom: 14px;
}
.rules-head h1 {
  font-size: 30px; line-height: 1.3; letter-spacing: -.02em;
  font-family: var(--font-display); font-weight: var(--title-weight);
}
.rules-meta { margin: 10px 0 0; font-size: 12.5px; color: var(--sub); }

/* 章节标题：下划线分段，跟大网站的规范页一个路数 */
.rules-chapter { margin-top: 38px; scroll-margin-top: 84px; }
.rules-chapter h2 {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  font-size: 19px; letter-spacing: -.01em;
  padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 18px;
}
.rules-chapter h2 em {
  font-style: normal; font-size: 17px; font-weight: 600; color: var(--ink-2);
}

/* 单条：编号做成小胶囊，标题另起一档字重 */
.rules-art { margin: 0 0 26px; scroll-margin-top: 84px; }
.rules-art h3 {
  display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap;
  font-size: 14.5px; margin: 0 0 9px;
}
.ra-no {
  flex: none; font-size: 12px; font-weight: 700; color: var(--red);
  background: var(--red-soft); padding: 3px 8px; border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
.ra-title { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.rules-art > p {
  margin: 0 0 10px; font-size: 14px; line-height: 1.85; color: var(--ink-2);
}

/* 条内的「标签：说明」条目，两列对齐，比一串 <p> 好扫。
   标签列固定 150px：最长的那条是「论坛交流的核心原则重申」11 个字，
   给窄了会折成两行，看着像被截断；用 max-content 又会让每行起点不齐。 */
.rules-list { margin: 10px 0 12px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rules-item {
  display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px;
  padding: 9px 12px; border-radius: 9px;
  background: color-mix(in srgb, var(--ink) 4%, var(--card));
}
.rules-item dt { font-size: 13px; font-weight: 600; color: var(--ink); }
.rules-item dd { margin: 0; font-size: 13.5px; line-height: 1.75; color: var(--ink-2); }

/* 连续短句收成的圆点列表：比一串 <p> 紧凑，一眼能数清有几项 */
.rules-bullets {
  margin: 10px 0 14px; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 6px;
}
.rules-bullets li {
  position: relative; padding-left: 16px;
  font-size: 13.5px; line-height: 1.75; color: var(--ink-2);
}
.rules-bullets li::before {
  content: ''; position: absolute; left: 2px; top: .72em;
  width: 5px; height: 5px; border-radius: 50%;
  background: color-mix(in srgb, var(--red) 50%, var(--line));
}

.rules-foot {
  margin-top: 36px; padding: 20px 22px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: color-mix(in srgb, var(--ink) 2.4%, var(--card));
}
.rules-foot b { font-size: 13.5px; }
.rules-foot p { margin: 7px 0 0; font-size: 13px; line-height: 1.75; color: var(--sub); }
.rules-foot a { color: var(--red); }
.rules-src { font-size: 12px !important; opacity: .85; }

@media (max-width: 940px) {
  .rules-wrap { grid-template-columns: minmax(0, 1fr); gap: 0; }
  /* 手机上目录没法 sticky 在侧边，改成正文上方一张可滚的卡片。
     限高 180px：十几个条目全铺出来会把正文挤到屏幕外。 */
  .rules-toc {
    position: static; max-height: 180px; overflow: auto;
    margin-bottom: 18px; padding: 14px 16px;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  }
  .rules-toc > b { padding-left: 0; }
  /* 只留章级目录：几十条条款全铺出来比正文还长 */
  .rules-toc ol ol { display: none; }
  .rules-doc { padding: 24px 20px 22px; }
  .rules-head h1 { font-size: 23px; }
  .rules-chapter h2 { font-size: 17px; }
  .rules-chapter h2 em { font-size: 15px; }
  .rules-item { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}

/* 概览：服务器状态摘要 */
.monitor-overview { margin: 16px 0 18px; padding: 15px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); box-shadow: var(--shadow-1); }
.monitor-overview-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.monitor-overview-head h2 { display: inline; margin: 0 8px 0 0; font-size: 14px; }
.monitor-overview-head > div:first-child > span { color: var(--sub); font-size: 11px; }
.monitor-overview-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.monitor-mini { min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: color-mix(in srgb, var(--bg) 72%, var(--card)); }
.monitor-mini > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--sub); font-size: 11.5px; }
.monitor-mini > strong { display: block; margin: 8px 0; color: var(--ink); font-size: 19px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.monitor-mini small { display: block; margin-top: 7px; color: var(--sub); font-size: 10.5px; line-height: 1.35; overflow-wrap: anywhere; }
.monitor-mini-process > strong { font-size: 15px; }
.monitor-overview .monitor-error { margin: 10px 0 0; }

/* 服务器监控详情页 */
.monitor-page { min-width: 0; }
.monitor-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.monitor-head h2 { margin: 0 0 4px; font-size: 17px; }
.monitor-head p { margin: 0; color: var(--sub); font-size: 12.5px; }
.monitor-head-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }
.monitor-updated { color: var(--sub); font-size: 11.5px; white-space: nowrap; }
.monitor-updated b { color: var(--ink-2); font-weight: 600; }
.monitor-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.monitor-card, .monitor-detail { min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); }
.monitor-card { padding: 15px; }
.monitor-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--sub); font-size: 12px; }
.monitor-card > strong { display: block; margin: 14px 0 12px; color: var(--ink); font-size: 25px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.monitor-card small { display: block; margin-top: 9px; color: var(--sub); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.monitor-track { height: 7px; overflow: hidden; border-radius: 999px; background: var(--bg); }
.monitor-track i { display: block; width: var(--pct, 0%); height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--grad-a), var(--red)); transition: width .35s ease; }
.monitor-dot { width: 8px; height: 8px; border-radius: 50%; background: #9aa0aa; }
.monitor-dot[data-level="warn"] { background: #e6a23c; }
.monitor-dot[data-level="bad"] { background: #e05252; }
.monitor-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.monitor-detail { padding: 16px; }
.monitor-detail h3 { margin: 0 0 12px; font-size: 13px; }
.monitor-detail dl { display: grid; gap: 0; margin: 0; }
.monitor-detail dl > div { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 12px; }
.monitor-detail dt { color: var(--sub); }
.monitor-detail dd { margin: 0; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.monitor-status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 650; white-space: nowrap; }
.monitor-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.monitor-status.good { color: #25845c; }
.monitor-status.bad { color: #c74747; }
.monitor-footnote { margin: 12px 2px 0; color: var(--sub); font-size: 11px; }
.monitor-error { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); color: #a43131; background: color-mix(in srgb, #d94c4c 10%, var(--card)); font-size: 12px; }
@media (max-width: 1180px) {
  .monitor-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .monitor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .monitor-overview { padding: 11px; }
  .monitor-overview-head { align-items: flex-start; flex-direction: column; }
  .monitor-overview-head .monitor-head-actions { justify-content: space-between; }
  .monitor-overview-grid { grid-template-columns: 1fr 1fr; gap: 7px; }
  .monitor-mini { padding: 10px; }
  .monitor-mini > strong { font-size: 17px; }
  .monitor-head { flex-direction: column; }
  .monitor-head-actions { width: 100%; justify-content: space-between; }
  .monitor-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .monitor-card { padding: 12px; }
  .monitor-card > strong { font-size: 21px; }
  .monitor-detail-grid { grid-template-columns: 1fr; gap: 8px; }
}

/* 独立窗口模式（装成 App 后）：去掉底部导航给浏览器留的白边，
   并让内容避开 iPhone 的 Home 指示条 */
@media (display-mode: standalone) {
  body { padding-bottom: var(--safe-b); }
  .mobile-nav { padding-bottom: var(--safe-b); }
}

/* ------------------------------- 平台 Cookie 配置 ------------------------------- */
/* 三个平台各一块：标题 + 状态徽标 + 大输入框。Cookie 很长，等宽字体更好核对开头结尾 */
.ck-row {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px;
  margin-bottom: 10px; background: var(--card);
}
.ck-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.ck-head b { font-size: 13.5px; }
.ck-state {
  font-size: 11px; padding: 2px 8px; border-radius: 20px;
  background: color-mix(in srgb, var(--ink) 6%, var(--card)); color: var(--sub);
}
.ck-state.on { background: #e8f7ee; color: #1f7a3a; }
.ck-src { font-size: 11px; color: var(--sub); }
.ck-row textarea.cf-input {
  min-height: 62px; font-size: 12px; line-height: 1.5; resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.ck-clear { margin-top: 6px; font-size: 12px; }
.ck-help { margin: 4px 0 12px; font-size: 12.5px; color: var(--ink-2); }
.ck-help summary { cursor: pointer; color: var(--red); font-size: 12.5px; }
.ck-help ol { margin: 8px 0 6px; padding-left: 20px; line-height: 1.9; }
.ck-help code {
  font-size: 11.5px; padding: 1px 5px; border-radius: 5px;
  background: color-mix(in srgb, var(--ink) 6%, var(--card));
}
.ck-help p { margin: 6px 0 0; color: var(--sub); }
/* 最近被拦下的域名：一行一个，右边一键加入 */
.ck-rejected {
  margin: 0 0 16px; padding: 12px 13px;
  border: 1px solid #ffd9d9; border-radius: 12px; background: #fff8f8;
}
.ck-rejected b { font-size: 13px; color: #a33; }
.ck-rejected .sf-hint { margin: 4px 0 8px; }
.ck-reject-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 6px 0; border-top: 1px dashed rgba(163, 51, 51, .18);
}
.ck-reject-row code { flex: 1 1 200px; min-width: 0; font-size: 12px; overflow-wrap: anywhere; }
.ck-reject-plat { flex: none; font-size: 11px; color: var(--sub); }
@media (prefers-color-scheme: dark) {
  .ck-rejected { border-color: #4a2222; background: #221717; }
  .ck-rejected b { color: #ef9a9a; }
}
@media (prefers-color-scheme: dark) {
  .ck-state.on { background: #14251a; color: #6fd08a; }
}

/* ------------------------------- 媒体库 ------------------------------- */
.media-grid {
  display: grid;
  /* min() 兜住 320px 的小屏：固定 260px 时两列会溢出，整页能左右晃动 */
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 18px;
  margin-top: 18px;
}
.media-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.media-frame {
  aspect-ratio: 4 / 3;
  background: #101014;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.media-frame video,
.media-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* 视频用 contain：cover 会把竖屏视频裁掉左右两边，只剩中间一条 */
.media-frame video { object-fit: contain; background: #101014; }
.media-body { padding: 12px 14px 14px; }
.media-body h3 { margin: 0 0 6px; font-size: 15px; line-height: 1.45; }
.media-body p { margin: 0 0 8px; font-size: 13px; color: var(--sub); line-height: 1.55; }
.media-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--sub);
}
.media-meta a { color: var(--red); }
.media-link {
  color: var(--red);
  font-size: 13px;
  word-break: break-all;
  padding: 20px;
  text-align: center;
}
.inline-form { display: inline-block; margin-right: 6px; }

/* ------------------------------- 帖子页博客风 ------------------------------- */
/* 标题左侧竖条：给长文一个明确的视觉起点，和目录配合 */
.t-title { border-left: 4px solid var(--red); padding-left: 13px; }

/* 花瓣：只在帖子页出现，固定层 + 半透明，不参与布局 */
.petals-fixed { position: fixed; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.petals-fixed span {
  position: absolute; top: -30px; display: block;
  background: color-mix(in srgb, var(--red) 55%, #fff);
  border-radius: 62% 38% 55% 45%;
  animation-name: petal-fall; animation-timing-function: linear; animation-iteration-count: infinite;
  opacity: .62;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--red) 18%, transparent);
}
@keyframes petal-fall {
  0% { transform: translate3d(0, -10vh, 0) rotate(0deg); }
  100% { transform: translate3d(48px, 112vh, 0) rotate(420deg); }
}
/* 主内容压在花瓣之上，避免飘落物盖住正文 */
.wrap { position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) { .petals-fixed { display: none; } }

/* 桌面端：目录从正文上方挪到右侧，吸顶跟随；窄屏保持原来的折叠块 */
@media (min-width: 1080px) {
  .thread.has-toc {
    max-width: 1140px; display: grid;
    grid-template-columns: minmax(0, 1fr) 236px; column-gap: 26px; align-items: start;
  }
  .thread.has-toc > * { grid-column: 1; min-width: 0; }
  .thread.has-toc > .toc {
    grid-column: 2; grid-row: 1 / span 40;
    position: sticky; top: 86px; margin: 0;
    max-height: calc(100vh - 110px); overflow: auto;
  }
}

/* ≥1561 时页面右栏已经有一份目录，卡片内部不再重复。
   卡片撑满中列（右边缘离右栏只有 24px 的 gap），正文段落单独限宽 1080 居中：
   图片和标题走全宽，正文一行 72 字左右，既贴边又不至于扫得太远。 */
@media (min-width: 1561px) {
  .wrap.with-rail .thread,
  .wrap.with-rail .thread.has-toc { max-width: 100%; display: block; }
  .wrap.with-rail .thread.has-toc > .toc { display: none; }
  .wrap.with-rail .t-body { max-width: 1080px; margin-inline: auto; }
}

/* ------------------------------- 批量导入进度 ------------------------------- */
.batch-log { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.batch-log li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 11px; border-radius: 9px; font-size: 12.5px; line-height: 1.5;
  background: var(--soft, #f5f5f7); color: var(--ink-2);
}
.batch-log li.ok { background: #eefaf1; color: #1f7a3a; }
.batch-log li.bad { background: #fdeeee; color: #a33; }
.batch-log li.run { background: #eef4ff; color: #2b5db8; }
.batch-log .bl-url { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-log .bl-state { flex: 0 0 auto; max-width: 55%; text-align: right; }
@media (prefers-color-scheme: dark) {
  .batch-log li { background: #1d1d24; }
  .batch-log li.ok { background: #14251a; color: #6fd08a; }
  .batch-log li.bad { background: #2b1a1a; color: #ef9a9a; }
  .batch-log li.run { background: #1b2b3d; color: #7fb2ff; }
}

/* ------------------------------- 手机端适配（补充） ------------------------------- */
/* 之前后台表格靠横向滚动，操作列藏在右边；长链接还会把整页撑宽。
   这里统一在 720px 以下处理，桌面端完全不受影响。 */
@media (max-width: 720px) {
  /* 底部固定导航会盖住正文最后一行 */
  body { padding-bottom: calc(78px + var(--safe-b)); }

  /* 后台横向导航：允许自己横滑，别把整页撑宽 */
  .admin-side { min-width: 0; overflow: hidden; }
  .as-nav, .as-foot { max-width: 100%; min-width: 0; }
  .as-foot { overflow-x: auto; scrollbar-width: none; }
  .as-foot::-webkit-scrollbar { display: none; }

  /* 长链接、命令、代码在提示里必须能断行 */
  .sf-hint, .sf-hint code, .auth-note code, .notice { overflow-wrap: anywhere; word-break: break-word; }
  .sf-hint code { white-space: normal; }

  /* 触控目标别太小 */
  .btn.sm, .btn.xs { min-height: 34px; padding-left: 12px; padding-right: 12px; }
  .admin-filters .cf-input, .admin-filters .btn { min-height: 40px; }

  /* 后台表格：一行一张卡片，操作列不再藏在右边 */
  .admin-main .table { min-width: 0; }
  .table-wrap:not(.dash-table) { overflow: visible; background: transparent; border: 0; border-radius: 0; }
  .table-wrap:not(.dash-table) .table { display: block; width: 100%; }
  .table-wrap:not(.dash-table) thead { display: none; }
  .table-wrap:not(.dash-table) tbody { display: block; }
  .table-wrap:not(.dash-table) tr {
    display: block; background: var(--card); border: 1px solid var(--line);
    border-radius: 12px; margin: 0 0 10px; padding: 2px 12px;
  }
  .table-wrap:not(.dash-table) td {
    display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
    gap: 4px 14px; padding: 9px 0; border-bottom: 1px dashed var(--line);
    white-space: normal; max-width: none;
  }
  .table-wrap:not(.dash-table) tr td:last-child { border-bottom: 0; }
  .table-wrap:not(.dash-table) td::before {
    content: attr(data-label); flex: 0 0 auto; color: var(--sub);
    font-size: 12px; line-height: 1.75;
  }
  .table-wrap:not(.dash-table) td > * { min-width: 0; }
  .table-wrap:not(.dash-table) .td-text { max-width: none; white-space: normal; }
  .table-wrap:not(.dash-table) td[colspan] { justify-content: flex-start; }
  .table-wrap:not(.dash-table) td[colspan]::before { content: none; }
  /* 批量选择那一列没有表头文字，单独占一行很怪，靠右放 */
  .table-wrap:not(.dash-table) td:not([data-label]):not([colspan]) { justify-content: flex-end; }

  /* 筛选条：输入框不要挤成一条 */
  .admin-filters { flex-wrap: wrap; }
  .admin-filters .cf-input { flex: 1 1 140px; }
}

/* ------------------------------- 手机端：媒体库 ------------------------------- */
/* 底部导航多了一个「媒体」入口后，媒体库是手机上的一级页面，
   这里把卡片从网格改成单列大图，视频按 16:9 显示，不再被 4:3 框裁成方块。 */
@media (max-width: 720px) {
  .media-grid { grid-template-columns: 1fr; gap: 14px; margin-top: 14px; }
  .media-card { border-radius: 12px; }
  .media-frame { aspect-ratio: 16 / 9; }
  .media-card.is-image .media-frame { aspect-ratio: 4 / 3; }
  .media-body { padding: 11px 12px 12px; }
  .media-body h3 { font-size: 14.5px; }
  .media-body p { font-size: 12.5px; }
  .media-link { padding: 16px 12px; }
}


/* ============================================================
   视觉打磨（2026-11）
   卡片质感 / 入场动效 / 阅读排版。只调观感，不动结构和功能。
   ============================================================ */

/* ---------- 信息流卡片 ---------- */
/* 间距从 14 放到 16：五列并排时卡片之间需要一点呼吸，否则像一张大表格 */
.masonry { gap: 16px; }

.card {
  border-radius: 16px;
  border-color: color-mix(in srgb, var(--ink) 7.5%, transparent);
  box-shadow: 0 1px 2px rgba(16, 18, 28, .03), 0 5px 16px -8px rgba(16, 18, 28, .1);
}
/* 悬停时抬得更明显一点，阴影从「贴纸」变成「浮起来的一张卡」 */
.card:hover, .card-wrap:hover .card {
  transform: translateY(-5px);
  box-shadow: 0 2px 5px rgba(16, 18, 28, .04), 0 20px 42px -20px rgba(16, 18, 28, .3);
  border-color: color-mix(in srgb, var(--red) 22%, var(--line));
}
.card-body { padding: 14px 15px 13px; }
.card-title { font-size: 14.5px; line-height: 1.52; margin-bottom: 9px; }
.card:hover .card-title, .card-wrap:hover .card-title { color: var(--ink); }
/* 悬停变红太跳：标题保持墨色，用图片缩放和上浮表达「可点」就够了 */
.card-foot .who em { max-width: 104px; }

/* 入场：首屏第一行错峰淡入，往下滚的卡片早就播完了，不占性能 */
@keyframes card-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.masonry > .card-wrap { animation: card-in .52s cubic-bezier(.22, .61, .36, 1) both; }
.masonry > .card-wrap:nth-child(1) { animation-delay: .02s; }
.masonry > .card-wrap:nth-child(2) { animation-delay: .07s; }
.masonry > .card-wrap:nth-child(3) { animation-delay: .12s; }
.masonry > .card-wrap:nth-child(4) { animation-delay: .17s; }
.masonry > .card-wrap:nth-child(5) { animation-delay: .22s; }
.masonry > .card-wrap:nth-child(6) { animation-delay: .27s; }
@media (prefers-reduced-motion: reduce) {
  .masonry > .card-wrap { animation: none; }
}

/* ---------- 阅读页 ---------- */
/* 正文原来锁 700px，卡片有 996 宽，右侧空出一大片。撑满后一行约 55 字，
   长文不用再左右扫视；字号从 14.5 提到 15，屏幕上看更稳。 */
.t-title { font-size: 28px; line-height: 1.38; margin-bottom: 18px; }
.t-body { max-width: 100%; font-size: 15px; line-height: 1.92; }
.t-body p { margin: 0 0 1.1em; }
.t-body > :last-child { margin-bottom: 0; }
/* 段落之间留白，但列表/引用块前后收紧一点，避免整篇被切成碎块 */
.t-body .md-list, .t-body blockquote { margin-top: .9em; margin-bottom: 1.1em; }

/* 作者卡：数字块加高、名字加粗，跟右栏其他卡片区分开 */
.t-rail-author .tra-head { gap: 12px; }
.tra-id b { font-size: 15px; }
.tra-stats { gap: 7px; margin: 13px 0 11px; }
.tra-stats div { padding: 9px 0; border-radius: 10px; }
.tra-stats b { font-size: 17px; }
.tra-acts .btn { font-size: 12.5px; }

/* 相关推荐加缩略图：纯文字列表在一列 300px 里很难扫，有图能一眼挑 */
.rail-links a { align-items: center; gap: 9px; padding: 7px 6px; }
.rail-links .rl-thumb {
  flex: none; width: 42px; height: 42px; border-radius: 9px;
  object-fit: cover; display: block;
  background: color-mix(in srgb, var(--ink) 5%, var(--card));
}
.rail-links .rl-thumb-text {
  display: grid; place-items: center; font-size: 15px; font-weight: 700;
  color: color-mix(in srgb, var(--red) 70%, var(--ink));
}
.rail-links .rl-t { font-size: 12.5px; }

/* ---------- 滚动条 ---------- */
/* 默认滚动条在浅色页面里是一道粗灰条，细一点、悬停才加深 */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--ink) 20%, transparent) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--ink) 18%, transparent);
  border-radius: 8px; border: 3px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--ink) 32%, transparent);
  background-clip: content-box;
}

/* ---------- 深色模式微调 ---------- */
@media (prefers-color-scheme: dark) {
  .card { border-color: color-mix(in srgb, #fff 7%, transparent); }
  .card:hover, .card-wrap:hover .card {
    border-color: color-mix(in srgb, var(--red) 32%, transparent);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .5), 0 22px 46px -22px rgba(0, 0, 0, .75);
  }
}

/* 手机上不放大标题，避免首屏只剩标题 */
@media (max-width: 720px) {
  .t-title { font-size: 22px; }
  .t-body { font-size: 14.5px; line-height: 1.85; }
  .masonry { gap: 12px; }
}

/* ------------------------------- AI 写作 ------------------------------- */
/* 设置区默认折叠：多数时候只管点「生成初稿」，配置一次就不再碰 */
.ai-cfg {
  margin: 0 0 16px; padding: 10px 13px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
.ai-cfg summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.ai-cfg[open] summary { margin-bottom: 10px; }
.ai-cfg .site-form { margin: 0; }
.ai-ref + .ai-ref { margin-top: 6px; }
/* 预览正文用等宽字体：Markdown 的 ## 和 - 对齐了才好改 */
.ai-body {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.75; resize: vertical;
}

/* ------------------------------- 博主主页抓取结果 ------------------------------- */
/* 一列卡片：左边勾选框，中间封面，右边标题 + 类型/时长。手机上也能一屏扫完 */
.up-list {
  margin: 4px 0 18px; border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; background: var(--card);
}
.up-head {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px;
}
.up-head b { font-size: 13px; margin-right: auto; }
.up-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; cursor: pointer;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 5%, transparent);
}
.up-item:last-child { border-bottom: 0; }
.up-item:hover { background: color-mix(in srgb, var(--ink) 2.5%, var(--card)); }
.up-item input[type="checkbox"] { flex: none; }
.up-item img {
  flex: none; width: 52px; height: 68px; object-fit: cover; border-radius: 7px;
  background: color-mix(in srgb, var(--ink) 5%, var(--card));
}
.up-item .up-t {
  flex: 1; min-width: 0; font-size: 12.5px; line-height: 1.5; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.up-item .up-m { flex: none; font-size: 11px; color: var(--sub); font-variant-numeric: tabular-nums; }

/* 每行的导入状态：成功绿、失败红，太长就省略，完整原因放 title 里 */
.up-item .up-st {
  flex: none; max-width: 96px; font-size: 11px; text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.up-item .up-st.run { color: var(--sub); }
.up-item .up-st.ok { color: #1f7a3a; }
.up-item .up-st.bad { color: #c0392b; }
@media (prefers-color-scheme: dark) {
  .up-item .up-st.ok { color: #6fd08a; }
  .up-item .up-st.bad { color: #ef9a9a; }
}

/* ------------------------------- 后台：上传安装包 ------------------------------- */
/* 虚线框 + 拖拽高亮：让「这里可以丢文件」这件事一眼可见，不用读说明 */
.apk-up {
  display: grid; grid-template-columns: 1fr auto; gap: 10px 14px; align-items: center;
  margin: 0 0 14px; padding: 14px 16px;
  border: 1.5px dashed color-mix(in srgb, var(--ink) 16%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--ink) 2%, var(--card));
  transition: border-color .18s, background .18s;
}
.apk-up.drag {
  border-color: var(--red);
  background: color-mix(in srgb, var(--red) 6%, var(--card));
}
.apk-up-txt { min-width: 0; display: grid; gap: 3px; }
.apk-up-txt b { font-size: 13.5px; }
.apk-up-txt span { font-size: 12px; color: var(--sub); line-height: 1.55; }
.apk-up-bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
/* hidden 属性会被上面的 display:flex 盖掉，显式关掉——不然没上传时也挂着一条空进度条 */
.apk-up [hidden] { display: none !important; }
.apk-track {
  flex: 1; height: 7px; border-radius: 999px; overflow: hidden;
  background: color-mix(in srgb, var(--ink) 10%, transparent);
}
.apk-track i {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: var(--red); transition: width .2s ease;
}
.apk-up-bar em {
  font-style: normal; font-size: 11px; color: var(--sub);
  font-variant-numeric: tabular-nums; min-width: 36px; text-align: right;
}
.apk-up-msg { grid-column: 1 / -1; font-size: 12px; line-height: 1.6; color: var(--sub); }
.apk-up-msg.ok { color: #1f7a3a; }
.apk-up-msg.bad { color: #c0392b; }

.apk-files {
  margin: 16px 0 0; border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; background: var(--card);
}
.apk-files-h {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 10px 13px; border-bottom: 1px solid var(--line);
  font-size: 12.5px; font-weight: 600;
}
.apk-files-h em { font-style: normal; font-weight: 400; font-size: 11.5px; color: var(--sub); }
.apk-files ul { list-style: none; margin: 0; padding: 0; }
.apk-files li {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 13px;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 5%, transparent);
}
.apk-files li:last-child { border-bottom: 0; }
.apk-files li.on { background: color-mix(in srgb, var(--red) 4%, var(--card)); }
.apk-f-name { flex: 1; min-width: 0; display: grid; gap: 2px; }
.apk-f-name b {
  font-size: 12.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.apk-f-name em { font-style: normal; font-size: 11px; color: var(--sub); }
.apk-files form { margin: 0; }
.apk-tag {
  flex: none; font-size: 11px; padding: 3px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red);
}
.apk-files .sf-hint { margin: 0; padding: 9px 13px 11px; }
@media (prefers-color-scheme: dark) {
  .apk-up-msg.ok { color: #6fd08a; }
  .apk-up-msg.bad { color: #ef9a9a; }
}
@media (max-width: 560px) {
  .apk-up { grid-template-columns: 1fr; }
  .apk-up > button { grid-row: auto; justify-self: start; }
}
