/* ============================================
   Cross-Document View Transitions (Chrome 111+)
   平滑页面切换，替代硬刷新闪白。旧浏览器自动降级。
   ============================================ */
@view-transition {
    navigation: auto;
}

/* Header 和胶囊导航保持原位，不参与整体淡出（避免闪烁） */
#Top {
    view-transition-name: site-header;
}

::view-transition-old(site-header),
::view-transition-new(site-header),
::view-transition-old(header-pill-tabs),
::view-transition-new(header-pill-tabs) {
    animation-duration: 0s;
}

/* 主内容区：短淡入淡出 */
::view-transition-old(root) {
    animation: 160ms ease-out both vt-fade-out;
}

::view-transition-new(root) {
    animation: 200ms ease-in both vt-fade-in;
}

@keyframes vt-fade-out {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes vt-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ============================================
   CSS Variables for Theme Support
   ============================================ */
:root {
    /* ── 底座(2026-08-25 从底座重配:画布/面板/文字/线条统一带冷蓝调,
       白面板为辅、正蓝 #2563eb 为主、灯牌紫黑为品牌识别,互不越界)── */
    --bg-primary: #f6f6f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f1f3;
    --card-surface-bg: var(--bg-secondary);
    --card-surface-control-bg: var(--bg-secondary);
    --bg-input: #ffffff;
    --text-primary: #111315;
    --text-secondary: #4b5158;
    /* 用户正文可选文字色(亮色主题值,正文背景 #fff 上均过 WCAG AA ≥4.5:1)。
       暗色主题在 [data-theme="dark"] 里给另一套值,同一 .ucolor-* class 自动适配。 */
    --ucolor-red: #cf3a2e;
    --ucolor-orange: #b15c00;
    --ucolor-green: #1f7a3a;
    --ucolor-teal: #0e7c8b;
    --ucolor-blue: #2a5fd0;
    --ucolor-purple: #8338d6;
    --ucolor-pink: #c02a82;
    --ucolor-gray: #5b6270;
    /* 前缀标签预设配色(底色+字色成对,亮色值;字色对底色均过 WCAG AA ≥4.5:1。
       暗色主题在 [data-theme="dark"] 覆写同名变量,同一 .topic-prefix-tag--<key>
       class 自动适配。键集与后端白名单 tagStyleKeys 一一对应,别单边加减)。
       淡底 8 色 + 实底 3 种:announce=公告墨色实底,直接引用主按钮 --btn-primary-*
       (2026-08-27 拍板,暗色随按钮反转成浅底深字);red-solid/purple-solid=踢楼/投票
       实底(2026-09-16 拍板),亮色值取发帖页类型色 --ctype-kick/--ctype-poll(白字 4.70/5.70)。
       实底只给少数要人参与的前缀,求助/交易/测评这类高频前缀用淡底(docs/TAG_RULES.md §16.4)。 */
    --tagstyle-red-bg: #fbe3e3;      --tagstyle-red-fg: #8f1f1f;
    --tagstyle-orange-bg: #ffe9d1;   --tagstyle-orange-fg: #8a3a06;
    --tagstyle-amber-bg: #fdf0c2;    --tagstyle-amber-fg: #755500;
    --tagstyle-green-bg: #eaf6ee;    --tagstyle-green-fg: #186535;
    --tagstyle-teal-bg: #d2f3ef;     --tagstyle-teal-fg: #0d5f58;
    --tagstyle-blue-bg: #f0f1f3;     --tagstyle-blue-fg: #2c3137;
    --tagstyle-purple-bg: #ece4fb;   --tagstyle-purple-fg: #5b21b6;
    --tagstyle-pink-bg: #fbe2ef;     --tagstyle-pink-fg: #99184f;
    --tagstyle-red-solid-bg: #e11d48;    --tagstyle-red-solid-fg: #ffffff;
    --tagstyle-purple-solid-bg: #7c3aed; --tagstyle-purple-solid-fg: #ffffff;
    --tagstyle-announce-bg: var(--btn-primary-bg); --tagstyle-announce-fg: var(--btn-primary-text);
    --text-muted: #767d86;
    --border-color: #e6e8eb;
    --card-border: #d8dce2;
    --border-dark: rgba(17, 19, 21, 0.20);
    --shadow-color: rgba(17, 19, 21, 0.05);
    --link-color: #111315;
    --link-hover: #f04e23;
    --link-underline: #c4c9d0;
    --header-ink: #111315;
    --header-muted: #767d86;
    --header-line: var(--card-border);
    --header-brand: #f04e23;
    --header-brand-2: #cc3a14;
    --header-search-bg: #f0f1f3;
    --header-search-border: #d8dce2;
    --search-top-shine: rgba(255, 255, 255, .30);
    --search-ring-shine: rgba(255, 255, 255, .50);
    --brand-glow: rgba(124, 92, 246, .32);
    --brand-glow-soft: rgba(124, 92, 246, .10);
    --brand-glow-faint: rgba(124, 92, 246, .055);
    --brand-glow-edge: rgba(79, 160, 255, .18);
    --brand-glow-hairline: rgba(154, 117, 255, .92);
    --brand-glow-hairline-end: rgba(79, 160, 255, .74);
    --node-tag-bg: #f0f1f3;
    --code-bg: #f0f1f3;
    --ghost-fill: #f8fafc;
    --ghost-eye: #111;
    --ghost-line: #f04e23;
    --ghost-halo-core: rgba(79, 160, 255, 0.10);
    --ghost-halo-edge: rgba(118, 75, 162, 0.05);
    --ghost-halo-opacity: .48;
    --ghost-shadow: rgba(49, 134, 255, 0.12);
    --ghost-line-w: 3.15;
    --ghost-flow-line-w: 4.2;
    --ghost-cloud-scale: 1.07;
    --card-radius: 6px;
    --scroll-fab-bg: rgba(248, 250, 252, 0.88);
    --scroll-fab-bg-hover: rgba(255, 255, 255, 0.96);
    --scroll-fab-border: rgba(100, 116, 139, 0.24);
    --scroll-fab-icon: #475569;
    --scroll-fab-shadow: rgba(15, 23, 42, 0.16);
    --scroll-fab-surface: rgba(255, 255, 255, 0.94);
    /* 次级按钮/中性胶囊(prefix-tag 等共用):中性冷灰,不上蓝 */
    --primary-soft-bg: #f0f1f3;
    --primary-soft-bg-hover: #e5e7eb;
    --primary-soft-border: #d8dce2;
    --primary-soft-text: #111315;
    --primary-soft-shadow: rgba(15, 28, 51, 0.06);
    --primary-soft-shadow-hover: rgba(15, 28, 51, 0.10);
    /* 悬浮轻胶囊共用层(.toast / .topic-resume-pill / .new-topics-pill) */
    --float-pill-bg: var(--bg-secondary);
    --float-pill-border: var(--card-border);
    --float-pill-shadow: 0 8px 22px rgba(15, 28, 51, 0.12), 0 1px 3px rgba(15, 28, 51, 0.07);
    --float-pill-shadow-hover: 0 10px 24px rgba(15, 28, 51, 0.16), 0 1px 3px rgba(15, 28, 51, 0.08);
    /* ── 工作蓝底座(主色调,2026-08-25 定稿:正蓝 #2563eb,与 --ghost-line/--ctype-help 同源)──
       --accent 强调文字/边框/焦点;--accent-fill 实底配白字(两主题同值);
       --accent-rgb 光环/浅底;--btn-primary-* 主按钮=蓝实底白字。
       散装青 #0891b2/#22d3ee 已全部收编,禁止再写强调色字面量。 */
    --accent: #cc3a14;
    --accent-hover: #f04e23;
    --accent-fill: #f04e23;
    --accent-rgb: 240, 78, 35;
    /* 主按钮=墨色实底(2026-08-25 定稿:亮墨底白字/暗反转白底墨字,蓝只留给链接与焦点) */
    --btn-primary-bg: #111315;
    --btn-primary-bg-hover: #272b30;
    --btn-primary-text: #ffffff;
    /* 等宽代码统一 token：全站代码块 / 密钥 / DoH URL / Token / 终端命令 都引用
       这组变量，保证字体、字号、行高、圆角、内边距一致。 */
    --mono-font: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    --mono-fz-inline: 13px;   /* 行内 <code> */
    --mono-fz-block: 14px;    /* 多行代码块 */
    --mono-fz-mini: 12.5px;   /* 终端 / DoH URL 等紧凑场景 */
    --mono-lh: 1.6;
    --mono-radius: 8px;
    --mono-pad-x: 12px;
    --mono-pad-y: 10px;
    /* 全站统一 code 卡片配色（.md-codeblock 引用），原本只在 markdown 渲染容器内
       局部定义，现提到 :root 让 create_review / doh / profile 等也能拿到。 */
    --md-code-bg: #f3f4f6;
    --md-code-header-bg: #eaecf0;
    --neutral-pill-bg: rgba(118, 125, 134, 0.10);
    --neutral-pill-bg-hover: rgba(118, 125, 134, 0.16);
    --neutral-pill-border: rgba(118, 125, 134, 0.18);
    --neutral-pill-border-strong: rgba(118, 125, 134, 0.28);
    --neutral-pill-text: #4b5158;
    --neutral-pill-icon: #767d86;
    --pill-pin-icon: #111315;
    --pill-star-icon: #d97706;
    --pill-lock-icon: #4b5158;
    --pill-tip-bg: #111315;
    --pill-tip-text: #ffffff;
    --pill-access-icon: #b93815;
    --pill-access-text: #b93815;
    --pill-access-bg: #fff5f2;
    --pill-access-border: #f9d2c7;
    --user-card-stats-bg: var(--bg-tertiary);
    --user-card-stats-border: var(--border-color);
    --user-card-stats-shadow: rgba(0, 0, 0, 0.04);
    --user-card-stats-icon: var(--text-muted);
    --user-card-stats-label: var(--text-secondary);

    /* Rainbow capsule (MinIO-style) */
    --rainbow-color-1: #667eea;
    --rainbow-color-2: #764ba2;
    --rainbow-color-3: #f093fb;
    --rainbow-color-4: #f5576c;
    --rainbow-color-5: #4facfe;
    --rainbow-color-6: #60a5fa;
    --rainbow-border-size: 2px;
    --rainbow-speed: 9s;
    --rainbow-bg: linear-gradient(270deg,
            var(--rainbow-color-1),
            var(--rainbow-color-2),
            var(--rainbow-color-3),
            var(--rainbow-color-4),
            var(--rainbow-color-5),
            var(--rainbow-color-6),
            var(--rainbow-color-1));

    --avatar-border-width: 2px;
    --avatar-gap: 1px;
    --avatar-size: 42px;
    --avatar-size-lg: 64px;
    --avatar-size-lg-mobile: 56px;
    --compact-pill-control-height: 30px;
}

/* 移动端：mono 字号/内边距整体缩小，避免长 URL/Token/代码挤裂屏幕 */
@media (max-width: 520px) {
    :root {
        --mono-fz-inline: 12px;
        --mono-fz-block: 13px;
        --mono-fz-mini: 12px;
        --mono-pad-x: 10px;
        --mono-pad-y: 8px;
    }}

[data-theme="dark"] {
    /* 暗色底座:蓝黑而非纯黑(与亮色同一冷蓝色相),三档递进 画布→面板→浮层 */
    --bg-primary: #0d0e11;
    --bg-secondary: #14161a;
    --bg-tertiary: #1d2026;
    --bg-input: #191c22;
    --text-primary: #eceef2;
    --text-secondary: #a0a7b2;
    --text-muted: #6e7683;
    /* 暗色主题文字色(正文背景 #2d2d2d 上均过 WCAG AA ≥4.5:1)。 */
    --ucolor-red: #ff938b;
    --ucolor-orange: #f0a955;
    --ucolor-green: #5fcf7f;
    --ucolor-teal: #4fc9d6;
    --ucolor-blue: #8aacff;
    --ucolor-purple: #c8a8ff;
    --ucolor-pink: #f59ad0;
    --ucolor-gray: #b6bdca;
    /* 前缀标签配色暗色值(字色对底色均 ≥4.5:1;announce 引用 --btn-primary-* 随按钮反转)。
       red-solid/purple-solid 与 announce 同一做法:暗色换亮一档的底色配深字。红没用 --ctype-kick
       的暗色 #fb7185(整块铺开偏粉),加深到 #f5475f(深字 5.13);紫 #a78bfa 深字 6.65。 */
    --tagstyle-red-bg: #3c1d1d;      --tagstyle-red-fg: #ffb3ab;
    --tagstyle-orange-bg: #3d2413;   --tagstyle-orange-fg: #ffb877;
    --tagstyle-amber-bg: #3a2f12;    --tagstyle-amber-fg: #ffd977;
    --tagstyle-green-bg: #132a1c;    --tagstyle-green-fg: #6ad092;
    --tagstyle-teal-bg: #113230;     --tagstyle-teal-fg: #63d8cc;
    --tagstyle-blue-bg: #20242c;     --tagstyle-blue-fg: #cfd5de;
    --tagstyle-purple-bg: #2c2149;   --tagstyle-purple-fg: #cbb5ff;
    --tagstyle-pink-bg: #3a1c2b;     --tagstyle-pink-fg: #ff9fce;
    --tagstyle-red-solid-bg: #f5475f;    --tagstyle-red-solid-fg: #12161f;
    --tagstyle-purple-solid-bg: #a78bfa; --tagstyle-purple-solid-fg: #12161f;
    --tagstyle-announce-bg: var(--btn-primary-bg); --tagstyle-announce-fg: var(--btn-primary-text);
    --border-color: #23272f;
    --card-border: #2c313a;
    --border-dark: rgba(255, 255, 255, 0.12);
    --shadow-color: rgba(0, 0, 0, 0.35);
    --link-color: #eceef2;
    --link-hover: #ff7a54;
    --link-underline: #4a515d;
    --header-ink: #eceef2;
    --header-muted: #6e7683;
    --header-line: var(--card-border);
    --header-search-bg: #191c22;
    --header-search-border: #2c313a;
    --search-top-shine: rgba(255, 255, 255, .06);
    --search-ring-shine: rgba(255, 255, 255, .08);
    --node-tag-bg: #1d2026;
    --code-bg: #1d2026;
    --ghost-fill: var(--text-primary);
    --ghost-line: #f04e23;
    --ghost-halo-core: rgba(79, 160, 255, 0.10);
    --ghost-halo-edge: rgba(118, 75, 162, 0.05);
    --ghost-halo-opacity: .40;
    --ghost-shadow: rgba(49, 134, 255, 0.06);
    --ghost-line-w: 3.75;
    --ghost-flow-line-w: 4.75;
    --scroll-fab-bg: rgba(31, 41, 55, 0.84);
    --scroll-fab-bg-hover: rgba(51, 65, 85, 0.92);
    --scroll-fab-border: rgba(148, 163, 184, 0.24);
    --scroll-fab-icon: #cbd5e1;
    --scroll-fab-shadow: rgba(0, 0, 0, 0.24);
    --scroll-fab-surface: rgba(45, 55, 72, 0.88);
    --primary-soft-bg: #1d2026;
    --primary-soft-bg-hover: #262a32;
    --primary-soft-border: #323843;
    --primary-soft-text: #eceef2;
    --primary-soft-shadow: rgba(0, 0, 0, 0.28);
    --primary-soft-shadow-hover: rgba(0, 0, 0, 0.34);
    --float-pill-bg: var(--bg-tertiary);
    --float-pill-border: #2c313a;
    --float-pill-shadow: 0 10px 24px rgba(0, 0, 0, 0.44), 0 1px 3px rgba(0, 0, 0, 0.30);
    --float-pill-shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.50), 0 1px 3px rgba(0, 0, 0, 0.32);
    --accent: #ff7a54;
    --accent-hover: #ff9a7a;
    --accent-rgb: 255, 122, 84;
    --btn-primary-bg: #eceef2;
    --btn-primary-bg-hover: #ffffff;
    --btn-primary-text: #0d0e11;
    --neutral-pill-bg: rgba(160, 167, 178, 0.10);
    --neutral-pill-bg-hover: rgba(160, 167, 178, 0.16);
    --neutral-pill-border: rgba(160, 167, 178, 0.18);
    --neutral-pill-border-strong: rgba(160, 167, 178, 0.28);
    --neutral-pill-text: #cfd5de;
    --neutral-pill-icon: #6e7683;
    --pill-pin-icon: #eceef2;
    --pill-star-icon: #fbbf24;
    --pill-lock-icon: #a0a7b2;
    --pill-tip-bg: #eceef2;
    --pill-tip-text: #0d0e11;
    --pill-access-icon: #ff8b6b;
    --pill-access-text: #ff8b6b;
    --pill-access-bg: rgba(240, 78, 35, 0.12);
    --pill-access-border: rgba(240, 78, 35, 0.32);
    --user-card-stats-bg: var(--bg-tertiary);
    --user-card-stats-border: var(--border-color);
    --user-card-stats-shadow: rgba(0, 0, 0, 0.16);
    --user-card-stats-icon: var(--text-muted);
    --user-card-stats-label: var(--text-secondary);
    --md-code-bg: #14161a;
    --md-code-header-bg: #1d2026;
}

/* Global Reset */
/* 字体栈与抗锯齿 2026-09-09 对齐 sb.sb(用户拍板,Mac/iOS 为主):
   - 栈顺序照 sb.sb:system-ui 与 "Segoe UI" 放前面——Windows 上英文/数字改由 Segoe UI 渲染而不是
     雅黑自带的西文(此前栈里没有这两项,Windows 全文落到 Microsoft YaHei,英文数字观感与 sb.sb 不同);
     Mac/iOS 两家本就都落到系统西文 + PingFang SC,栈顺序不影响。Noto/思源/文泉驿留给 Linux。
   - -webkit-font-smoothing: antialiased 是 Mac/iOS 上唯一看得见的差别:sb.sb、linux.sb 都开着,
     笔画更细更轻;之前 n.ht 是 auto(次像素),同字体看着更重更黑。Windows 上此属性无效。
   正文字号 14px / 行高 1.5 未动(sb.sb 是 15px / 1.75,属版面决定,另议)。 */
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", "WenQuanYi Micro Hei", sans-serif !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--bg-primary);
    margin: 0;
    padding: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: var(--link-color);
    text-decoration: none;
    cursor: pointer;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* @mention link inside markdown content. Low-saturation slate that fits the
   "low-noise" palette in DEVELOPMENT_CONVENTIONS.md §3.4 — not a status color,
   just a hint that the @-token is clickable. */
a.mention {
    color: var(--text-secondary, #475569);
    background: var(--mention-bg, rgba(148, 163, 184, 0.14));
    padding: 0 4px;
    border-radius: 4px;
    text-decoration: none;
}

/* User activity indicators — small green dot on avatar when online (≤5min)
   plus a low-noise "活跃于 X 前" line beneath the username. Sits inside
   user-popup-card / profile header. Colours stay in the project's
   low-saturation palette per DEVELOPMENT_CONVENTIONS.md §3.4. */
.user-activity-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 2px var(--card-surface-bg, #fff);
    pointer-events: none;
}
.user-activity-line {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-muted, #94a3b8);
}
.user-activity-line.user-activity-online {
    color: #16a34a;
    font-weight: 600;
}
.user-activity-line.user-activity-recent {
    color: #475569;
}
.user-activity-line.user-activity-today,
.user-activity-line.user-activity-past {
    color: var(--text-muted, #94a3b8);
}
[data-theme="dark"] .user-activity-line.user-activity-online {
    color: #4ade80;
}
a.mention:hover {
    color: var(--link-hover);
    background: var(--mention-bg-hover, rgba(148, 163, 184, 0.22));
    text-decoration: none;
}

/* Layout */
#Wrapper {
    background-color: var(--bg-primary);
    background-repeat: repeat-x;
    text-align: center;
}

.content {
    min-width: 600px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    text-align: left;
}

/* Header */
#Top {
    text-align: center;
    background-color: var(--card-surface-bg);
    height: 56px;
    font-size: 15px;
    font-weight: 500;
    background-size: 44px 44px;
    border-bottom: 1px solid var(--header-line);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.76) inset;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

[data-theme="dark"] #Top {
    background-color: var(--card-surface-bg);
    box-shadow: none;
}

#Top .content {
    display: flex;
    flex-direction: row;
    width: 100%;
    align-items: center;
    gap: 12px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.logo {
    font-size: 30px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    line-height: 1;
    position: relative;
}

.logo:hover {
    text-decoration: none;
}

/* Header Boards (N 系列导航) */
.header-boards {
    flex: 0 0 auto;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 14px;
    overflow: visible;
}

.header-boards-primary,
.header-boards-secondary {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    white-space: nowrap;
}

.header-boards-secondary {
    justify-content: flex-start;
    gap: 12px;
}

.header-boards-secondary .header-nav {
    margin-left: auto;
}

.header-boards-primary {
    overflow-x: auto;
    scrollbar-width: none;
}

.header-boards-primary::-webkit-scrollbar {
    display: none;
}

.header-boards .nav-board-item {
    margin-right: 0;
    padding: 4px 6px;
    font-size: 12px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1.2;
    min-height: 0;
}

.header-boards .nav-filter-chip {
    min-height: 0;
    padding: 4px 12px;
    font-size: 13px;
}

/* ============================================
   共享 Pill 切换器组件 (.pill-tabs / .pill-tab)
   被 Header 导航、messages.html、profile.html 复用
   ============================================ */
.pill-tabs {
    display: inline-flex;
    align-items: center;
    background: var(--bg-tertiary);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
    border: 1px solid var(--border-color);
    box-shadow: none;
}

[data-theme="dark"] .pill-tabs {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    box-shadow: none;
}

.pill-tab {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
    white-space: nowrap;
    line-height: 1.2;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.pill-tab:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.pill-tab.active,
.pill-tab[aria-current="page"] {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.10);
}

[data-theme="dark"] .pill-tab.active,
[data-theme="dark"] .pill-tab[aria-current="page"] {
    background: rgba(255, 255, 255, 0.14);
    color: #f8fafc;
    box-shadow: none;
}

.pill-tab.active:hover,
.pill-tab[aria-current="page"]:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    text-decoration: none;
}

[data-theme="dark"] .pill-tab.active:hover,
[data-theme="dark"] .pill-tab[aria-current="page"]:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    text-decoration: none;
}

/* Header 导航专属：锁定整数 30px 高度（消除 29.6px 亚像素取整偏差）与无下划线 */
.header-boards .pill-tabs {
    height: var(--compact-pill-control-height);
    box-sizing: border-box;
}

.header-boards .pill-tab {
    height: 24px;
    padding: 0 10px;
}

.header-boards .header-next-link {
    text-decoration: none;
}


/* Next更多 should look distinct from New/Now */

/* Next更多 dropdown */

/* ============================================================
   AnyNS 支持社区 Header —— Logo 与搜索框彻底解耦
   对齐 anyns.io 官网视觉（暖纸面/橄榄墨 + 鲜橘红点缀 + @ 环形图标）
   ============================================================ */
.header-cap {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: relative;
    padding: 0;
    background: transparent;
    z-index: 1;
}

.logo.anyns-community-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 36px;
    padding: 0 2px;
    color: var(--header-ink);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    border-radius: 6px;
    transition: opacity 0.16s ease;
}

.logo.anyns-community-logo:hover {
    text-decoration: none;
    opacity: 0.86;
}

.logo.anyns-community-logo:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.anyns-logo-mark {
    display: none;
}

.anyns-logo-wordmark {
    font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
    font-size: 23px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1;
    color: var(--header-ink);
    --an-mark-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='none' stroke='%23000' stroke-width='8.5' stroke-linecap='round'%3E%3Ccircle cx='50' cy='50' r='43'/%3E%3Ccircle cx='46.5' cy='50' r='14.5'/%3E%3Cpath d='M61 35L61 56Q61 64.5 68 64.5'/%3E%3C/g%3E%3C/svg%3E");
}

.anyns-logo-wordmark::before {
    content: "";
    display: inline-block;
    width: 21px;
    height: 21px;
    margin-right: 8px;
    vertical-align: -4.3px;
    background-color: currentColor;
    -webkit-mask: var(--an-mark-glyph) center / contain no-repeat;
    mask: var(--an-mark-glyph) center / contain no-repeat;
}

.anyns-logo-dot {
    color: var(--accent);
}

.anyns-logo-sub {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 7px;
    border-radius: 5px;
    border: 1px solid var(--card-border);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.01em;
}

/* Search Box —— 独立搜索栏，桌面端高度与圆角对齐导航胶囊 (30px / 6px) */
.header-search {
    flex-shrink: 0;
    margin-left: auto;
    display: flex;
    align-items: center;
    position: relative;
    height: var(--compact-pill-control-height);
    box-sizing: border-box;
    border: 1px solid var(--header-search-border);
    border-radius: 6px;
    background: var(--header-search-bg);
    overflow: visible;
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
    z-index: 2;
}

.header-search:hover {
    border-color: var(--text-muted);
}

.header-search:focus-within {
    border-color: var(--accent);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.14);
    z-index: 8;
}

.header-search .search-icon {
    position: absolute;
    right: 3px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background: transparent;
    color: var(--header-muted);
    cursor: pointer;
    z-index: 5;
    transition: color 0.16s ease, background-color 0.16s ease;
}

.header-search .search-icon:hover,
.header-search:focus-within .search-icon {
    color: var(--accent);
}

.header-search .search-icon svg {
    display: block;
    width: 15px;
    height: 15px;
}

.header-search .search-icon:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

#searchInput {
    width: 224px !important;
    height: 100%;
    padding: 0 30px 0 10px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: var(--header-ink);
    text-overflow: ellipsis;
    font-size: 13px;
    outline: none;
    cursor: text;
    box-sizing: border-box;
    transition: width 0.22s ease;
}

#searchInput:focus {
    width: 268px !important;
    color: var(--header-ink);
}

#searchInput::placeholder {
    color: var(--header-muted);
    opacity: 0.9;
}

#searchInput:-webkit-autofill,
#searchInput:-webkit-autofill:hover,
#searchInput:-webkit-autofill:focus,
#searchInput:-webkit-autofill:active {
    border-radius: 5px !important;
    -webkit-text-fill-color: var(--header-ink) !important;
    caret-color: var(--header-ink) !important;
    -webkit-box-shadow: 0 0 0 1000px var(--bg-secondary) inset !important;
    box-shadow: 0 0 0 1000px var(--bg-secondary) inset !important;
}

/* Header Navigation */
.header-nav {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    position: relative;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 5px;
}

/* Mobile Menu Overlay */
.mobile-menu {
    display: none;
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 20px;
    box-shadow: 0 4px 12px var(--shadow-color);
    z-index: 999;
}

.mobile-menu.show {
    display: block;
}

.mobile-menu-content {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.mobile-menu-content a {
    padding: 12px 0;
    font-size: 15px;
    border-bottom: 1px solid var(--border-color);
    display: block;
    text-decoration: none;
    color: var(--text-primary);
}

.mobile-menu-content a:last-of-type {
    border-bottom: none;
}

.mobile-menu-group {
    padding: 4px 0;
}

.mobile-menu-group + .mobile-menu-group {
    border-top: 2px solid var(--border-color);
}

.mobile-menu-group a:last-child {
    border-bottom: none;
}

.mobile-menu-create-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 0;
    font-size: 15px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
}

.mobile-menu-create-toggle .mobile-menu-arrow {
    transition: transform 0.2s ease;
    font-size: 18px;
    color: var(--text-secondary);
}

.mobile-menu-create-toggle.open .mobile-menu-arrow {
    transform: rotate(90deg);
}

.mobile-menu-create-toggle.open {
    border-bottom: none;
}

.mobile-menu-create-sub {
    display: none;
    padding-left: 12px;
}

.mobile-menu-create-toggle.open + .mobile-menu-create-sub {
    display: block;
}

.mobile-menu-content .theme-toggle,
.mobile-menu-content .locale-toggle {
    margin-top: 4px;
    padding: 12px 0;
    font-size: 20px;
    background: none;
    border: none;
    border-top: 1px solid var(--border-color);
    text-align: left;
    width: 100%;
    color: var(--text-primary);
    cursor: pointer;
}

/* Main Box Styles */
/* 卡片统一描边:四周 1px 实线、无阴影(2026-08-23 参照 sb.sb 改,原为只有底边线 + 阴影) */
.box {
    background-color: var(--card-surface-bg);
    border-radius: var(--card-radius);
    border: 1px solid var(--card-border);
    margin-bottom: 20px;
    transition: background-color 0.3s ease;
}

.cell {
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    line-height: 120%;
    text-align: left;
}

.cell:last-child {
    border-bottom: none;
}

/* 静态内容页（版规/关于/隐私/服务条款）的 .cell 装的是长段正文，
 * 不是紧凑列表行，正文行高统一到 1.5（与帖子正文一致），不影响全局 .cell 的 120%。 */
.page-doc .cell {
    line-height: 1.5;
}

.header {
    padding: 12px 24px;
    font-size: 15px;
    line-height: 120%;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--card-surface-bg);
    border-top-left-radius: calc(var(--card-radius) - 1px);
    border-top-right-radius: calc(var(--card-radius) - 1px);
}

/* ── 面包屑行（topic 页 + 编辑页共用） ── */
.topic-breadcrumb-row {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0;
    padding: 12px 24px;
    font-size: 15px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-tertiary);
    border-top-left-radius: calc(var(--card-radius) - 1px);
    border-top-right-radius: calc(var(--card-radius) - 1px);
    min-width: 0;
    overflow: hidden;
}

.topic-breadcrumb-row[hidden] {
    display: none !important;
}

.topic-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    min-width: 0;
    overflow: hidden;
    flex: 1;
}

.topic-breadcrumb > a,
.topic-breadcrumb .chevron {
    flex-shrink: 0;
    white-space: nowrap;
}

/* 面包屑里的板块链接走次级灰,悬停才显链接蓝,避免和正文超链接混淆 */
.topic-breadcrumb > a {
    color: var(--text-secondary);
}

.topic-breadcrumb > a:hover {
    color: var(--link-color);
}

.topic-breadcrumb .topic-breadcrumb-title {
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
}

/* Form & Button Base Styles (aligned with anyns.io .an-input / .an-btn) */
input[type="text"],
input[type="password"],
input[type="email"],
textarea {
    width: 300px;
    padding: 7px 10px;
    font-size: 14px;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    box-shadow: none;
    background-color: var(--bg-input);
    color: var(--text-primary);
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
textarea:focus {
    border-color: var(--text-primary);
    outline: none;
}

input.sl {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

button {
    padding: 6px 14px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-primary);
    background-color: transparent;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

button:hover {
    border-color: var(--text-primary);
    background-color: transparent;
}

/* ============================================
   共享按钮变体（叠加到原生 <button>，可与现有 button 样式组合）
   - .btn-sm           小尺寸（行内列表 / cell 末尾）
   - .btn-link         无边框文字按钮
   - .btn-danger-soft  危险操作的低强度填充（不抢眼）
   ============================================ */
.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    border-radius: 4px;
}

.btn-link {
    background: transparent;
    border: 0;
    padding: 0;
    color: var(--text-secondary);
    font-weight: 500;
}

.btn-link:hover {
    background: transparent;
    color: var(--text-primary);
}

.btn-danger-soft {
    color: var(--accent);
    background-color: transparent;
    border-color: color-mix(in srgb, var(--accent-fill) 45%, var(--border-color));
    border-radius: 6px;
}

.btn-danger-soft:hover {
    color: var(--accent);
    background-color: color-mix(in srgb, var(--accent-fill) 10%, transparent);
    border-color: color-mix(in srgb, var(--accent-fill) 65%, var(--border-color));
}

[data-theme="dark"] .btn-danger-soft {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent-fill) 45%, var(--border-color));
}

[data-theme="dark"] .btn-danger-soft:hover {
    color: var(--accent);
    background-color: color-mix(in srgb, var(--accent-fill) 14%, transparent);
    border-color: color-mix(in srgb, var(--accent-fill) 65%, var(--border-color));
}

/* ============================================
   共享语义文本 / 背景片段（用于错误、警告、成功提示）
   ============================================ */
.text-danger {
    color: #b91c1c;
}

[data-theme="dark"] .text-danger {
    color: #fca5a5;
}

/* 表单失败提示行（min-height 给 1em 避免动态填充时高度抖动） */
.form-error-text {
    color: #b91c1c;
    font-size: 13px;
    min-height: 1em;
}

[data-theme="dark"] .form-error-text {
    color: #fca5a5;
}

/* 状态条：警告 / 成功（2FA、Banner 等使用） */
.status-banner {
    font-size: 14px;
    padding: 10px 12px;
    border-radius: 6px;
    line-height: 1.5;
}

.status-banner--warn {
    background: color-mix(in srgb, #f59e0b 18%, var(--bg-tertiary));
    color: #92400e;
    border: 1px solid color-mix(in srgb, #f59e0b 35%, var(--border-color));
}

[data-theme="dark"] .status-banner--warn {
    background: color-mix(in srgb, #f59e0b 22%, var(--bg-tertiary));
    color: #fde68a;
    border-color: color-mix(in srgb, #f59e0b 40%, var(--border-color));
}

.status-banner--ok {
    background: color-mix(in srgb, #10b981 16%, var(--bg-tertiary));
    color: #166534;
    border: 1px solid color-mix(in srgb, #10b981 32%, var(--border-color));
}

[data-theme="dark"] .status-banner--ok {
    background: color-mix(in srgb, #10b981 22%, var(--bg-tertiary));
    color: #bbf7d0;
    border-color: color-mix(in srgb, #10b981 40%, var(--border-color));
}

.status-banner--info {
    background: color-mix(in srgb, var(--tagstyle-blue-bg) 55%, var(--bg-secondary));
    color: var(--tagstyle-blue-fg);
    border: 1px solid color-mix(in srgb, var(--ucolor-blue) 28%, var(--border-color));
}

[data-theme="dark"] .status-banner--info {
    background: color-mix(in srgb, var(--tagstyle-blue-bg) 72%, var(--bg-tertiary));
    color: var(--tagstyle-blue-fg);
    border-color: color-mix(in srgb, var(--ucolor-blue) 36%, var(--border-color));
}

/* 等宽信息块（用于显示密钥 / 恢复码 / DoH URL 等可复制 mono 内容）
   外观对齐 .md-codeblock：浅灰底 + 12px 圆角 + 无边框 */
.code-block-mono {
    font-family: var(--mono-font);
    font-size: var(--mono-fz-block);
    background: var(--md-code-bg);
    color: #0d0d0d;
    padding: var(--mono-pad-y) var(--mono-pad-x);
    border-radius: 12px;
    user-select: all;
    word-break: break-all;
    overflow-wrap: anywhere;
    line-height: var(--mono-lh);
    border: none;
}

[data-theme="dark"] .code-block-mono {
    background: #1e1e1e;
    color: #d4d4d4;
}

/* Utility */
.fr {
    float: right;
}

.fl {
    float: left;
}

.sep5 {
    height: 5px;
}

.sep10 {
    height: 10px;
}

.sep20 {
    height: 20px;
}

/* Topic List */
.item_title {
    display: block;
    font-size: 15px;
    /* 2026-08-31 对照 sb.sb 拍板:列表标题 400→500,同色下 400 观感发淡(颜色实测两家同档,
       差在字重);标题色 var(--text-primary) 是全局 token 未动 */
    font-weight: 500;
    line-height: 140%;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.item_title>span,
.item_title>a {
    vertical-align: middle;
}

/* 正文行高/字号统一由下方「Markdown Render Area」块(§8228 附近)单点定义,
   此处原有的重复 line-height 声明已删,避免两处真相源漂移。 */

img.emoji-inline {
    width: 26px;
    height: 26px;
    display: inline-block;
    /* 26px 图放 15px/1.7 正文里会把行盒从 25.5 撑到 30;上下 -4px 外边距让它按 18px 参与行盒计算,
       图本身尺寸不变、不撑行;-3px 基线偏移让图心与汉字字心对齐(2026-09-09 实测 computed)。 */
    vertical-align: -3px;
    margin: -4px 1px;
}

.item_title a {
    color: var(--text-primary);
}

/* DM-1 拉黑折叠的列表行标题占位（中性低噪，点击仍可进帖） */
.item_title .topic-title-blocked {
    color: var(--text-muted, #94a3b8);
    font-style: italic;
}

/* 标题前缀标签（主题分类）：圆角胶囊、无边框；默认灰蓝淡底 --primary-soft-bg + 正文色，
   后台可按标签选配色修饰类（见下方 .topic-prefix-tag--<key>）。 */
.topic-prefix-tag {
    display: inline-flex;
    align-items: center;
    background: var(--primary-soft-bg);
    color: var(--text-primary);
    /* 2026-08-26 拍板:胶囊整体压矮(19.3→约16.4px,padding 2px→1px、字 0.85em→0.8em),
       原高度挨着 15px 标题显得墩。 */
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 0.8em;
    font-weight: 400;
    font-family: inherit;
    line-height: 1.2;
    margin-right: 5px;
    vertical-align: middle;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.topic-prefix-tag::before {
    content: '#';
    margin-right: 1px;
    opacity: 0.55;
}

/* 列表行前缀标签是 <a>(跳 /tag 筛选页)；压掉全局链接色/下划线，hover 只加深底色 */
a.topic-prefix-tag {
    text-decoration: none;
    cursor: pointer;
}

a.topic-prefix-tag:hover {
    background: var(--primary-soft-bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}

/* 前缀标签预设配色修饰类(后台按标签选,值经服务端白名单校验)。每条都带
   a…:hover 变体:a.topic-prefix-tag:hover 特异性 (0,2,1) 高于裸双类 (0,2,0),
   不补 hover 变体的话悬停会被打回默认灰蓝底(审查确认的特异性缺陷)。 */
.topic-prefix-tag.topic-prefix-tag--red,
a.topic-prefix-tag.topic-prefix-tag--red:hover { background: var(--tagstyle-red-bg); color: var(--tagstyle-red-fg); }
.topic-prefix-tag.topic-prefix-tag--orange,
a.topic-prefix-tag.topic-prefix-tag--orange:hover { background: var(--tagstyle-orange-bg); color: var(--tagstyle-orange-fg); }
.topic-prefix-tag.topic-prefix-tag--amber,
a.topic-prefix-tag.topic-prefix-tag--amber:hover { background: var(--tagstyle-amber-bg); color: var(--tagstyle-amber-fg); }
.topic-prefix-tag.topic-prefix-tag--green,
a.topic-prefix-tag.topic-prefix-tag--green:hover { background: var(--tagstyle-green-bg); color: var(--tagstyle-green-fg); }
.topic-prefix-tag.topic-prefix-tag--teal,
a.topic-prefix-tag.topic-prefix-tag--teal:hover { background: var(--tagstyle-teal-bg); color: var(--tagstyle-teal-fg); }
.topic-prefix-tag.topic-prefix-tag--blue,
a.topic-prefix-tag.topic-prefix-tag--blue:hover { background: var(--tagstyle-blue-bg); color: var(--tagstyle-blue-fg); }
.topic-prefix-tag.topic-prefix-tag--purple,
a.topic-prefix-tag.topic-prefix-tag--purple:hover { background: var(--tagstyle-purple-bg); color: var(--tagstyle-purple-fg); }
.topic-prefix-tag.topic-prefix-tag--pink,
a.topic-prefix-tag.topic-prefix-tag--pink:hover { background: var(--tagstyle-pink-bg); color: var(--tagstyle-pink-fg); }
/* 实底三种(公告墨色 / 踢楼红 / 投票紫):不带 # 前缀符,字重略提。公告底色随主按钮
   (2026-08-27 拍板);红/紫实底 2026-09-16 拍板,分配规则见 docs/TAG_RULES.md §16.4。 */
.topic-prefix-tag.topic-prefix-tag--announce,
a.topic-prefix-tag.topic-prefix-tag--announce:hover { background: var(--tagstyle-announce-bg); color: var(--tagstyle-announce-fg); font-weight: 500; }
.topic-prefix-tag.topic-prefix-tag--red-solid,
a.topic-prefix-tag.topic-prefix-tag--red-solid:hover { background: var(--tagstyle-red-solid-bg); color: var(--tagstyle-red-solid-fg); font-weight: 500; }
.topic-prefix-tag.topic-prefix-tag--purple-solid,
a.topic-prefix-tag.topic-prefix-tag--purple-solid:hover { background: var(--tagstyle-purple-solid-bg); color: var(--tagstyle-purple-solid-fg); font-weight: 500; }
.topic-prefix-tag.topic-prefix-tag--announce::before,
.topic-prefix-tag.topic-prefix-tag--red-solid::before,
.topic-prefix-tag.topic-prefix-tag--purple-solid::before { content: none; }

.topic_meta {
    font-size: 12px;
    color: var(--text-muted);
}

/* 列表行头像与标题顶对齐(2026-08-27,参照 sb.sb):头像锚定标题首行,
   长标题折行时头像不随行高漂移。只作用于列表行,楼层头(.floor-header-row 单行场景)仍居中。 */
.floor-header-row.topic-list-item {
    align-items: flex-start;
}

.topic-list-item .floor-avatar {
    margin-top: 2px; /* 光学对齐标题首行 x 高度 */
}

.topic-list-item .topic_meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

/* 列表行元信息小图标(板块 / 楼主 / 最后回复人,2026-09-09 参照 sb.sb、linux.sb):
   12px 线性同色、跟随文字色;三项各自「图标 + 名」成组,组间靠 .topic_meta 的 gap 断开。 */
.topic-list-item .node_tag,
.topic-list-item .topic-author,
.topic-list-item .topic-last-reply {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.topic-list-item .topic-meta-ico {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    color: inherit;
}

.topic-list-item .topic-meta-ico svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* 列表行标题后的「分页图标 + 页码」(2026-09-09 参照 linux.sb 实测:12px muted 纯数字、无描边无底,
   图标 12px,项间 3px,紧跟标题 6px;sb.sb 那种描边圆片用户否决),回复超过一页才出现,组内不折行。 */
.item_title .topic-pages {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 6px;
    vertical-align: middle;
    font-size: 12px;
    font-weight: 400;
    line-height: 1;
    color: var(--text-muted);
    white-space: nowrap;
}

.item_title .topic-pages-ico {
    display: inline-flex;
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.item_title .topic-pages-ico svg {
    width: 100%;
    height: 100%;
    display: block;
}

.item_title .topic-page-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 14px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 12px;
    line-height: 1;
    transition: color 0.15s ease;
}

.item_title .topic-page-chip:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.item_title .topic-pages-sep {
    padding: 0 1px;
}

/* 2026-08-26 拍板:楼主名与最后回复人同字重(400),不再加粗区分——两个名字视觉大小一致。 */
.topic-list-item .topic-author {
    color: var(--text-muted);
}

.topic-list-item .topic-author:hover {
    color: var(--text-secondary);
}

.topic-list-item .topic-time {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.topic-list-item .topic-time svg {
    width: 16px;
    height: 16px;
    opacity: 0.85;
}

.topic-metrics-inline {
    display: none;
    align-items: center;
    gap: 10px;
}

.topic-metric {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    /* 默认 OFF = 透明底"空灯"；点亮时填 --primary-soft。 */
    background: transparent;
    border: 1px solid rgba(100, 116, 139, 0.14);
    border-radius: 999px;
    padding: 6px 12px;
    line-height: 1.2;
    min-width: 60px;
    justify-content: center;
}

[data-theme="dark"] .topic-metric {
    background: transparent;
    border-color: rgba(148, 163, 184, 0.14);
}

.topic-metric svg {
    width: 16px;
    height: 16px;
    opacity: 0.85;
}

.topic-metric-number {
    font-variant-numeric: tabular-nums;
}

.topic-metric-unread .topic-stat-dot {
    background: var(--accent-fill);
}

[data-theme="dark"] .topic-metric-unread .topic-stat-dot {
    background: var(--accent-fill);
}

.topic-metric-new-reply .topic-stat-dot {
    background: #f59e0b;
}

[data-theme="dark"] .topic-metric-new-reply .topic-stat-dot {
    background: #fbbf24;
}

.topic-avatar {
    position: relative;
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: 50%;
    display: block;
    box-sizing: border-box;
}

.topic-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    box-sizing: border-box;
}

.topic-avatar>a {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

/* 列表第二行「最后回复人」：纯文字名，时间与之配对。与楼主/时间同走 meta 灰文字、
   同字重 400（2026-08-26 起楼主名不再加粗），无头像/图标——和这一行其余元素一致不抢眼。 */
.topic-list-item .topic-last-reply {
    color: var(--text-muted);
    font-weight: 400;
}
.topic-list-item .topic-last-reply:hover {
    color: var(--text-secondary);
    text-decoration: underline;
}

/* ============================================
   Avatar Role Styles
   ============================================ */
.avatar-role-regular,
.avatar-role-admin,
.avatar-role-moderator,
.avatar-role-svip {
    border-radius: 50%;
    box-sizing: border-box;
}

.avatar-role-regular img,
.avatar-role-admin img,
.avatar-role-moderator img,
.avatar-role-svip img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    box-sizing: border-box;
    border: 0;
    padding: var(--avatar-gap);
    background: var(--bg-secondary);
}

/* 头像边框:不分等级统一冷蓝灰(2026-08-27 加深一档),仅 VIP 保留彩色渐变环。 */
.avatar-role-regular,
.avatar-role-admin,
.avatar-role-moderator,
.avatar-role-svip {
    border: var(--avatar-border-width) solid var(--card-border);
}

/* ============================================
   Floor Header Row (共享：头像 + 用户名 + 元信息)
   ============================================ */
.floor-header-row {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px 10px;
}

/* 帖子页楼层头:头像与用户名行顶对齐(2026-08-30 用户拍板恢复 08-27 口径,
   否决同日早些的垂直居中);右侧两行 meta 同样顶对齐,时间行与用户名行、
   #N 行与商家简介行行行对应。 */
#RepliesBox .floor-header-row {
    align-items: flex-start;
}

/* 右侧 meta 两行(时间·阅读数 / #N),12px muted 与原 floor-meta-row 同字号同灰度;
   行距压到 2px 与左侧 floor-left 两行(用户名/商家简介行)对齐。
   颜色必须显式给:.snow 类无全局定义,不写会继承正文色显得过深(2026-08-30 用户点名)。 */
#RepliesBox .floor-right {
    gap: 2px;
}

#RepliesBox .floor-right .snow {
    font-size: 12px;
    color: var(--text-muted);
}

/* 窄屏楼层头空间金贵:藏阅读数,只留时间和楼层号。 */
@media (max-width: 520px) {
    .floor-view-count {
        display: none;
    }}

/* 楼层内容列(2026-08-27,Discourse/sb.sb 版式):正文/签名/标签/操作行与用户名
   同一左边线(头像宽 + 行内 10px gap),头像自成作者列;窄屏空间金贵恢复通栏。 */
#RepliesBox .cell > :not(.floor-header-row) {
    margin-left: calc(var(--avatar-size) + 10px);
}

@media (max-width: 520px) {
    #RepliesBox .cell > :not(.floor-header-row) {
        margin-left: 0;
    }}

.floor-avatar {
    flex-shrink: 0;
}

.floor-avatar .topic-avatar {
    width: var(--avatar-size);
    height: var(--avatar-size);
}

/* 帖子列表(首页/板块/搜索,CSR+SSR 同 class):小头像 28px(大小屏同值)、环减细 1px、角标隐藏,
   2026-08-27 拍板;楼内/私信/用户卡不在 .topic-list-item 内,维持 --avatar-size。
   --avatar-border-width 同时驱动灰 border 与 VIP 渐变 padding 两种环;--avatar-gap 间隙不动。 */
.topic-list-item .floor-avatar .topic-avatar {
    --avatar-border-width: 1px;
    width: 28px;
    height: 28px;
    perspective: 160px;
}

.floor-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.floor-right {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    text-align: right;
    white-space: nowrap;
}

.floor-user-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 14px;
    line-height: 1.4;
}

.floor-user-line a {
    font-weight: 600;
    color: var(--text-primary);
}

.floor-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 12px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.4;
}

/* 板块标签：方角浅灰小牌、无边框 —— 对应 NodeLoc 标签样式 */
.node_tag {
    /* 2026-08-24 拍板:板块名去胶囊底色改纯文字——行内胶囊只留前缀标签,
       板块是归属信息降为 muted 文字;hover 变正文色+下划线保可点击暗示。 */
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    border: none;
    text-decoration: none;
    font-weight: 400;
    box-sizing: border-box;
    vertical-align: middle;
    transition: color 0.15s ease;
}

.node_tag:hover {
    color: var(--text-primary);
    text-decoration: underline;
}


/* ============================================
   OP Badge (楼主标记)
   ============================================ */
/* 楼主是帖内定位信息，一个帖子里会在主楼 + 楼主每条回复上重复出现，属于高频，
   所以只给最轻的一档青色：色相上和身份组（蓝/紫/赤金）、和同一行可能出现的
   op-endorsed 绿（133°）都拉得开，但饱和度压到远低于身份组，不抢戏。 */
.op-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    margin-left: 4px;
    vertical-align: middle;
    background: rgba(61, 127, 145, 0.10);
    border: 1px solid rgba(61, 127, 145, 0.26);
    color: #3d7f91;
}

[data-theme="dark"] .op-badge {
    background: rgba(127, 196, 212, 0.12);
    border-color: rgba(127, 196, 212, 0.28);
    color: #7fc4d4;
}

/* ============================================
   OP-endorsed badge (楼主认可此回复)
   Stack-Overflow style "accepted answer" marker.
   ============================================ */
.op-endorsed-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    margin-left: 4px;
    vertical-align: middle;
    background: rgba(46, 160, 67, 0.12);
    border: 1px solid rgba(46, 160, 67, 0.4);
    color: #1f7a32;
}

[data-theme="dark"] .op-endorsed-badge {
    background: rgba(63, 185, 80, 0.16);
    border-color: rgba(63, 185, 80, 0.5);
    color: #7ee787;
}

/* 「采纳为答案」内联按钮 —— 求助帖每条回复上,楼主可点。沿用认可徽章的绿色族。 */
.accept-answer-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 9px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.7;
    cursor: pointer;
    background: rgba(46, 160, 67, 0.10);
    border: 1px solid rgba(46, 160, 67, 0.4);
    color: #1f7a32;
}
.accept-answer-btn:hover { background: rgba(46, 160, 67, 0.18); }
.accept-answer-btn.is-accepted {
    background: #2ea043;
    border-color: #2ea043;
    color: #fff;
}
.accept-answer-btn.is-accepted:hover { background: #2c9740; }
.accept-answer-btn:disabled { opacity: 0.55; cursor: default; }
[data-theme="dark"] .accept-answer-btn {
    background: rgba(63, 185, 80, 0.14);
    border-color: rgba(63, 185, 80, 0.5);
    color: #7ee787;
}
[data-theme="dark"] .accept-answer-btn:hover { background: rgba(63, 185, 80, 0.24); }
[data-theme="dark"] .accept-answer-btn.is-accepted {
    background: #3fb950;
    border-color: #3fb950;
    color: #0d1117;
}

/* 「最佳答案」引用链接 —— 主帖正文下方,指向被采纳的回复。沿用认可徽章的绿色族。 */
.best-answer-ref {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 2px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(46, 160, 67, 0.08);
    border: 1px solid rgba(46, 160, 67, 0.32);
    color: #1f7a32;
    font-size: 13px;
    text-decoration: none;
}
.best-answer-ref:hover { background: rgba(46, 160, 67, 0.15); }
.best-answer-ref-tag { font-weight: 700; white-space: nowrap; }
.best-answer-ref-desc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0.8; }
.best-answer-ref-go { font-weight: 600; white-space: nowrap; }
[data-theme="dark"] .best-answer-ref {
    background: rgba(63, 185, 80, 0.12);
    border-color: rgba(63, 185, 80, 0.38);
    color: #7ee787;
}
[data-theme="dark"] .best-answer-ref:hover { background: rgba(63, 185, 80, 0.2); }

/* 交易帖「标记完成」按钮 —— 帖子级,主帖正文下方靠右。克制绿色族,沿用
   「最佳答案」引用链接的低调风格;完成态不再用实心高亮。 */
.trade-complete-btn {
    display: block;
    width: fit-content;
    margin: 10px 0 2px auto;
    padding: 5px 11px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    cursor: pointer;
    text-align: center;
    background: rgba(46, 160, 67, 0.08);
    border: 1px solid rgba(46, 160, 67, 0.32);
    color: #1f7a32;
}
.trade-complete-btn:hover { background: rgba(46, 160, 67, 0.15); }
.trade-complete-btn:disabled { opacity: 0.55; cursor: default; }
[data-theme="dark"] .trade-complete-btn {
    background: rgba(63, 185, 80, 0.12);
    border-color: rgba(63, 185, 80, 0.38);
    color: #7ee787;
}
[data-theme="dark"] .trade-complete-btn:hover { background: rgba(63, 185, 80, 0.2); }

.ticket-resolve-btn {
    display: block;
    width: fit-content;
    margin: 10px 0 2px auto;
    padding: 5px 12px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    cursor: pointer;
    text-align: center;
    background: var(--tagstyle-green-bg);
    border: 1px solid rgba(46, 160, 67, 0.32);
    color: var(--tagstyle-green-fg);
    transition: opacity 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.ticket-resolve-btn:hover {
    opacity: 0.88;
}
.ticket-resolve-btn.is-reopen {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-secondary);
}
.ticket-resolve-btn.is-reopen:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}
.ticket-resolve-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

/* ============================================
   Kick Winner Floor (踢楼中奖楼层高亮)
   ============================================ */
/* 踢楼状态栏嵌在主楼 .cell 内部，是同一楼内的一段结构化区域。
 * 不再额外吸收 .cell 的水平 padding，让内部「踢楼状态 / 奖品 / 中奖楼层 / 公平性验证」
 * 与同楼 floor-header-row / reply_content / topic-signature / topic-tags-row 一致从 x=300 起。
 * 垂直 padding 与底分隔线保留，作为状态卡与正文/签名之间的分块视觉。 */
/* ── 投票卡(详情页主帖) ── */
.cell.poll-vote-card {
    padding-left: 0;
    padding-right: 0;
}
.poll-vote-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 14px;
}
.poll-vote-icon { font-size: 16px; }
.poll-vote-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.poll-opt {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    padding: 11px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s ease;
}
.poll-opt:disabled { cursor: default; }
.poll-opt:not(:disabled):hover { border-color: var(--ctype-poll, #7c3aed); }
.poll-opt-bar {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: rgba(124, 58, 237, 0.12);
    z-index: 0;
    transition: width 0.4s ease;
}
[data-theme="dark"] .poll-opt-bar { background: rgba(167, 139, 250, 0.18); }
.poll-opt.is-selected { border-color: var(--ctype-poll, #7c3aed); }
.poll-opt-mark {
    position: relative; z-index: 1;
    width: 18px; height: 18px; flex-shrink: 0;
    box-sizing: border-box;
    border: 1.5px solid var(--text-muted);
    background: var(--bg-secondary);
}
.poll-opt-mark--radio { border-radius: 999px; }
.poll-opt-mark--check { border-radius: 5px; }
.poll-opt.is-selected .poll-opt-mark--radio {
    border-color: var(--ctype-poll, #7c3aed);
    background: radial-gradient(circle, var(--ctype-poll, #7c3aed) 0 4px, var(--bg-secondary) 5px 100%);
}
.poll-opt.is-selected .poll-opt-mark--check {
    border-color: var(--ctype-poll, #7c3aed);
    background: var(--ctype-poll, #7c3aed);
}
.poll-opt-text { position: relative; z-index: 1; flex: 1; }
.poll-opt-count {
    position: relative; z-index: 1;
    flex-shrink: 0;
    font-size: 12px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
.poll-opt-voters {
    padding: 2px 0 2px 28px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.7;
}
.poll-opt-voters a { color: var(--text-secondary); }
.poll-vote-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}
.poll-vote-hint { font-size: 12px; }
.poll-vote-submit {
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: var(--ctype-poll, #7c3aed);
    color: #fff;
}
.poll-vote-submit:disabled { opacity: 0.5; cursor: default; }
.poll-vote-retract {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}
.poll-end-btn {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* ============================================
   User Group Badge (用户组标记)
   ============================================ */
.user-group-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    margin-left: 4px;
    vertical-align: middle;
    border: 1px solid transparent;
}

/* 用户组配色策略（DEVELOPMENT_CONVENTIONS §3.4）：
   只给「少数派」上色 —— 等级组人人都有，留灰阶；身份组稀有，各给一个色相。
   - lv1 → lv2 → lv3 共用 slate 三档，由浅到深表达等级，不引入色相
     （renderUserGroupBadge 对 lv1 也会出徽章，所以 lv1 用最淡的灰，存在感压到最低）
   - moderator 蓝 / admin 紫 / svip 赤金：三个身份组各占一个色相，互不混淆
   - plus（2026-09-12 新增，进阶档、带到期）不引入新色相：走 svip 赤金的低饱和浅一档，
     表达「同族、低一级」。它也不给头像渐变环 —— 四色环留作 svip 的独有标记
   - moderator 与 admin 都走「降饱和」的柔和档（2026-07-25 调，原为 #1d4ed8 / #6d28d9，
     用户判为过于高调）；两者必须同步降，admin 的饱和度保持略高于 moderator，
     否则版主比管理员还跳，身份层级会视觉倒置
   - blacklist 用黑不用红：封禁是终局状态，不需要抢扫读；红就此腾给全站置顶独占
   - 暖色区只剩 svip 赤金 ~18° / pending 黄 ~36°，间距 17°
     （2026-07-25 调：svip[原 vip] 原琥珀金 26°、pending 原橙 17.5°，只差 8.5° 分不清；往红金挪到
     18.5° 后会直接压到 pending 头上，故 pending 同步移黄，两者间距翻倍到 17°）
   - 2026-09-12 vip 改名 svip，plus 与它同档同色相，故色相预算与间距一字未动 */

.user-group-badge.user-group-lv1 {
    background: rgba(148, 163, 184, 0.08);
    border-color: rgba(148, 163, 184, 0.20);
    color: #94a3b8;
}

.user-group-badge.user-group-lv2 {
    background: rgba(100, 116, 139, 0.10);
    border-color: rgba(100, 116, 139, 0.24);
    color: #64748b;
}

.user-group-badge.user-group-lv3 {
    background: rgba(51, 65, 85, 0.12);
    border-color: rgba(51, 65, 85, 0.30);
    color: #334155;
}

.user-group-badge.user-group-moderator {
    background: rgba(70, 100, 143, 0.11);
    border-color: rgba(70, 100, 143, 0.30);
    color: #46648f;
}

.user-group-badge.user-group-admin {
    background: rgba(100, 69, 156, 0.11);
    border-color: rgba(100, 69, 156, 0.31);
    color: #64459c;
}

.user-group-badge.user-group-plus {
    background: rgba(176, 106, 60, 0.12);
    border-color: rgba(176, 106, 60, 0.32);
    color: #b06a3c;
}

.user-group-badge.user-group-svip {
    background: rgba(194, 88, 32, 0.14);
    border-color: rgba(194, 88, 32, 0.38);
    color: #a84a20;
}

.user-group-badge.user-group-pending {
    background: rgba(202, 138, 4, 0.14);
    border-color: rgba(202, 138, 4, 0.42);
    color: #a16207;
}

/* 黑名单 = 封禁，是终局状态而非「需要注意」的警示，所以用黑不用红：黑更沉、不抢扫读，
   红也就此腾给全站置顶独占。深色模式下纯黑字不可见，改为近黑底 + 浅灰字，两边都读作「黑」。 */
.user-group-badge.user-group-blacklist {
    background: rgba(23, 23, 23, 0.08);
    border-color: rgba(23, 23, 23, 0.38);
    color: #171717;
}

/* --- User Group Badge: Dark Theme --- */
[data-theme="dark"] .user-group-badge.user-group-lv1 {
    background: rgba(148, 163, 184, 0.10);
    border-color: rgba(148, 163, 184, 0.20);
    color: #94a3b8;
}

[data-theme="dark"] .user-group-badge.user-group-lv2 {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.24);
    color: #cbd5e1;
}

[data-theme="dark"] .user-group-badge.user-group-lv3 {
    background: rgba(226, 232, 240, 0.12);
    border-color: rgba(226, 232, 240, 0.30);
    color: #f1f5f9;
}

[data-theme="dark"] .user-group-badge.user-group-moderator {
    background: rgba(140, 174, 214, 0.14);
    border-color: rgba(140, 174, 214, 0.34);
    color: #8caed6;
}

[data-theme="dark"] .user-group-badge.user-group-admin {
    background: rgba(171, 154, 218, 0.15);
    border-color: rgba(171, 154, 218, 0.36);
    color: #ab9ada;
}

[data-theme="dark"] .user-group-badge.user-group-plus {
    background: rgba(224, 169, 126, 0.14);
    border-color: rgba(224, 169, 126, 0.34);
    color: #e0a97e;
}

[data-theme="dark"] .user-group-badge.user-group-svip {
    background: rgba(240, 138, 75, 0.16);
    border-color: rgba(240, 138, 75, 0.40);
    color: #f08a4b;
}

[data-theme="dark"] .user-group-badge.user-group-pending {
    background: rgba(250, 204, 21, 0.16);
    border-color: rgba(250, 204, 21, 0.45);
    color: #fcd34d;
}

[data-theme="dark"] .user-group-badge.user-group-blacklist {
    background: rgba(0, 0, 0, 0.55);
    border-color: rgba(255, 255, 255, 0.26);
    color: #d4d4d4;
}

/* ============================================
   Merchant Pill + 商家信息行 (docs/VERIFIED_BADGES.md §7,2026-08-30 二改)
   胶囊只写「商家」两字(米表域名可能很长,撑爆用户名行,官网移到第二行):
   尺寸语言与 .user-group-badge 同款(10px/圆角3px),配色走 .avatar-merchant-badge
   的珐琅实底(蓝B/金B 同族渐变+深色描边+顶部内高光)。纯身份标识 span 不可点。
   ============================================ */
.merchant-pill {
    display: inline-flex;
    align-items: center;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    margin-left: 4px;
    vertical-align: middle;
    border: 1px solid transparent;
    color: #fff;
}

/* 胶囊配色=X 认证标原色(2026-08-31 二改):首版压深一档保 AA 的深蓝被用户判「颜色没改」
   ——与旧珐琅深蓝肉眼无差,拍板放弃压深,直接用官方原色平涂/渐变,白字对比让位视觉一致。
   无边框无高光,贴 X 扁平语言;双主题同色,无需 dark 覆盖。 */
.merchant-pill-biz {
    background: #1d9bf0;
}

.merchant-pill-bizgold {
    background: linear-gradient(180deg, #e2b719 0%, #cb7b00 100%);
}

/* 商家楼层用户名下第二行「简介 · 域名」:12px muted,单行截断防长米表/长简介爆版;
   域名链接走正蓝,与正文链接同语言。用户卡内共用本组样式。 */
.floor-merchant-line {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    min-width: 0;
}

.floor-merchant-line .floor-merchant-site {
    color: var(--link-color, #1567b5);
    text-decoration: none;
}

.floor-merchant-line .floor-merchant-site:hover {
    text-decoration: underline;
}

/* 状态 pill 的外间距（标题→徽章、徽章→徽章）统一由这里的 margin-left 控制，
   渲染端不再输出任何分隔空格。原因：手机端列表 .item_title 必须是 flex
   （标题 line-clamp 2 行 + 徽章不被裁掉），而 flex 会丢弃纯空白文本节点 ——
   靠空格的话手机端必然挤成 0 间距。改用 margin 后，PC 的 inline 流和手机的
   flex 布局拿到的是同一个值，PC/手机 × 列表/详情四种组合天然一致。 */
.admin-pill {
    margin-left: 4px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 4px;
    border: 1px solid var(--neutral-pill-border);
    border-radius: 3px;
    color: var(--neutral-pill-text);
    background: var(--neutral-pill-bg);
    font-size: 10px;
    line-height: 1.2;
    vertical-align: middle;
    font-weight: 500;
}

/* 状态 pill 用 SVG 图标 + 语义色区分：全站置顶金 / 板块置顶灰 / 精华金 / 锁定灰 / 权限靛
   （2026-08-26 全站置顶由红改金，见下方置顶规则注释）。
   颜色全部走 --pill-* 变量，深浅主题由变量自身切换，这里不再重复写 dark 规则
   （DEVELOPMENT_CONVENTIONS §3.4）。 */
.admin-pill svg {
    width: 12px;
    height: 12px;
    display: block;
    color: var(--neutral-pill-icon);
}

/* 置顶/精华/锁/权限 四个纯图标状态标记：去掉方框，实心图标直接裸放
   （.admin-pill 基类的方框款还被管理后台共用，勿动基类）。 */
.admin-pill.admin-pill-pinned,
.admin-pill.admin-pill-featured,
.admin-pill.admin-pill-locked,
.admin-pill.admin-pill-access {
    border: 0;
    background: none;
    padding: 0;
}

.admin-pill.admin-pill-pinned svg,
.admin-pill.admin-pill-featured svg,
.admin-pill.admin-pill-locked svg,
.admin-pill.admin-pill-access svg {
    width: 14px;
    height: 14px;
}

/* 全站置顶 — 靛蓝（与权限盾牌同色，靠形状区分，板块置顶仍留中性灰）。 */
.admin-pill.admin-pill-pinned svg {
    color: var(--pill-pin-icon);
}

/* 板块内置顶 — 只在单个板块里有效，留中性灰，与全站置顶拉开层级。 */
.admin-pill.admin-pill-pinned.admin-pill-pinned-node svg {
    color: var(--neutral-pill-icon);
}

/* 精华 — 星标配金，论坛通行惯例。 */
.admin-pill.admin-pill-featured svg {
    color: var(--pill-star-icon);
}

/* 锁定 — 表达「这帖已关闭」，不该抢注意力，保持中性、只比正文深一档。 */
.admin-pill.admin-pill-locked svg {
    color: var(--pill-lock-icon);
}

/* 徽章悬停文字气泡：读 aria-label 立即显示（复用编辑器工具栏 .md-btn 的气泡样式语言）。
   这四个徽章的 HTML 刻意不带原生 title，否则气泡之外还会再弹一个原生慢速提示。 */
.admin-pill.admin-pill-pinned,
.admin-pill.admin-pill-featured,
.admin-pill.admin-pill-locked,
.admin-pill.admin-pill-access {
    position: relative;
}

.admin-pill.admin-pill-pinned::after,
.admin-pill.admin-pill-featured::after,
.admin-pill.admin-pill-locked::after,
.admin-pill.admin-pill-access::after {
    content: attr(aria-label);
    position: absolute;
    left: 50%;
    top: calc(100% + 8px);
    transform: translateX(-50%) translateY(-4px);
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--pill-tip-bg);
    color: var(--pill-tip-text);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.16);
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 30;
}

.admin-pill.admin-pill-pinned::before,
.admin-pill.admin-pill-featured::before,
.admin-pill.admin-pill-locked::before,
.admin-pill.admin-pill-access::before {
    content: "";
    position: absolute;
    left: 50%;
    top: calc(100% + 3px);
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: var(--pill-tip-bg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 30;
}

.admin-pill.admin-pill-pinned:hover::after,
.admin-pill.admin-pill-featured:hover::after,
.admin-pill.admin-pill-locked:hover::after,
.admin-pill.admin-pill-access:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.admin-pill.admin-pill-pinned:hover::before,
.admin-pill.admin-pill-featured:hover::before,
.admin-pill.admin-pill-locked:hover::before,
.admin-pill.admin-pill-access:hover::before {
    opacity: 1;
}

/* 帖子页面包屑两层容器 overflow:hidden（标题截断防线，勿放开）会裁掉气泡：
   这里显式关闭，徽章 HTML 在面包屑里改带原生 title（topic.html / seo.go withNativeTitle）。 */
.topic-breadcrumb .admin-pill::before,
.topic-breadcrumb .admin-pill::after {
    content: none;
}

/* 权限 — 盾牌锁孔配靛蓝，与置顶/精华金、锁定灰都不撞。 */
.admin-pill.admin-pill-access svg {
    color: var(--pill-access-icon);
}

.reply-form-notice {
    display: flex;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    gap: 10px;
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(var(--accent-rgb), 0.35);
    background: rgba(var(--accent-rgb), 0.12);
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.reply-form-notice svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    color: var(--accent);
}

[data-theme="dark"] .reply-form-notice {
    border-color: rgba(var(--accent-rgb), 0.4);
    background: rgba(var(--accent-rgb), 0.12);
    color: var(--text-primary);
}

[data-theme="dark"] .reply-form-notice svg {
    color: var(--accent);
}

/* 无权 / 需登录 锁卡：主题页(#RepliesBox 内)与板块页(#topic-list-placeholder 内)同款。
   颜色全走主题变量，深色模式自动适配；外层 .box 由各自页面提供。 */
.topic-access-lock {
    text-align: center;
    padding: 56px 24px;
}

.topic-access-lock .lock-icon {
    font-size: 40px;
    line-height: 1;
    margin-bottom: 16px;
}

.topic-access-lock .lock-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.topic-access-lock .lock-hint {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.topic-access-lock .lock-action {
    margin-top: 18px;
}

.topic-access-lock .lock-action .auth-btn-primary {
    display: inline-block;
    padding: 9px 22px;
    text-decoration: none;
    border-radius: 8px;
}

/* 列表/面板的空·错·加载占位单元:替代各页内联 padding(色由内部 .topic_meta 提供)。 */
.list-state-cell {
    padding: 12px;
}

/* 个人主页各 tab 空态单元:统一 padding(原三处 18px 8px / 8px 0 不一致)。 */
.profile-empty-cell {
    padding: 18px 8px;
}

/* 面板内 .cell 的弱化状态单元(空/错/暂无,常见于状态页)。 */
.muted-state-cell {
    padding: 14px 16px;
    color: var(--text-muted);
}

/* .fade 文本的统一内边距(加载/失败占位),色由 .fade 提供。 */
.fade-state-cell {
    padding: 14px 16px;
}

/* 居中空/状态卡通用骨架:messages 的 .mail-empty-state 与 img 的 .album-empty 共用,
   各自只在页面 <style> 里补 padding/图标/标题等差异(原两页各重复一份 flex 居中)。 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

#ReplyFormBox.reply-form-locked .reply-toolbar,
#ReplyFormBox.reply-form-locked textarea,
#ReplyFormBox.reply-form-locked button[type="submit"] {
    opacity: 0.65;
}

#ReplyFormBox.reply-form-locked button[type="submit"] {
    cursor: not-allowed;
}

#ReplyFormBox.reply-form-locked textarea {
    background: var(--bg-tertiary);
}

.topic-stat-number {
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

/* 两个 pill 横向排列 */
.topic-stats-cell {
    flex-direction: row !important;
    align-items: center;
    gap: 5px;
}

/* 列表主楼媒体标志(图片/附件)：阅读/回复 pill 前的 muted 小图标 */
.topic-media-flags {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    /* 与右侧阅读数 pill 拉开距离(stats-cell gap 5px 之外再加 10px) */
    margin-right: 10px;
}
.topic-media-ico {
    display: inline-flex;
    align-items: center;
    /* 列表「图片/附件」标志:低噪声轻量信息,用更浅的低饱和灰蓝,比正文/统计文字更弱
       (原 --text-secondary=#4b5563 偏深,用户反馈)。亮暗两态都用 slate-400 一致。 */
    color: #94a3b8;
}
.topic-media-ico svg {
    width: 14px;
    height: 14px;
}

/* 合并阅读+回复为单胶囊 pill */
/* 两个独立固定宽度的统计 pill（阅读 / 回复） */
.topic-stat-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 62px;
    padding: 4px 0;
    border-radius: 5px;
    /* 默认 OFF = 透明底（贴近卡片白底）的"空灯"，仅留细描边定形；
       点亮时才填 --primary-soft。 */
    background: transparent;
    border: 1px solid rgba(100, 116, 139, 0.14);
    box-sizing: border-box;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    font-variant-numeric: tabular-nums;
}

[data-theme="dark"] .topic-stat-pill {
    background: transparent;
    border-color: rgba(148, 163, 184, 0.14);
    color: #cbd5e1;
}

.topic-stat-pill svg {
    width: 12px;
    height: 12px;
    color: #64748b;
    opacity: 0.82;
    flex-shrink: 0;
}

[data-theme="dark"] .topic-stat-pill svg {
    color: #94a3b8;
}

.topic-stat-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(100, 116, 139, 0.22);
    flex-shrink: 0;
    transition: background 0.2s;
}

[data-theme="dark"] .topic-stat-dot {
    background: rgba(148, 163, 184, 0.25);
}

.topic-stat-pill-unread .topic-stat-dot {
    background: var(--accent-fill);
}

[data-theme="dark"] .topic-stat-pill-unread .topic-stat-dot {
    background: var(--accent-fill);
}

.topic-stat-pill-new-reply .topic-stat-dot {
    background: #f59e0b;
}

[data-theme="dark"] .topic-stat-pill-new-reply .topic-stat-dot {
    background: #fbbf24;
}

.topic-stat-pill .topic-stat-number {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    font-variant-numeric: tabular-nums;
}

[data-theme="dark"] .topic-stat-pill .topic-stat-number {
    color: #cbd5e1;
}


@media screen and (max-width: 768px) {
    .topic-list-item .topic-stats-cell {
        display: none;
    }

    .topic-metrics-inline {
        display: inline-flex;
        gap: 8px;
    }

    .topic-metric svg {
        width: 14px;
        height: 14px;
    }

    .topic-metric {
        background: transparent;
        border: none;
        padding: 0;
        min-width: 0;
        color: var(--text-muted);
    }

    .topic-list-item .topic-time svg {
        width: 14px;
        height: 14px;
    }

    .topic-stat-number {
        font-size: 11px;
    }}

/* Rightbar */
#Rightbar {
    float: right;
    width: 270px;
    margin-left: 20px;
    margin-top: 20px;
}

#Main {
    margin-right: 290px;
}

/* VanillaForums-like wider layout */
@media screen and (min-width: 1025px) {
    #Wrapper.vanilla-layout>.content {
        box-sizing: border-box;
        max-width: 1224px;
    }

    /* Reduce gap between main and right card */
    #Wrapper.vanilla-layout #Rightbar {
        margin-left: 12px;
    }

    #Wrapper.vanilla-layout #Main {
        margin-right: 282px;
    }

    #Top.vanilla-layout {
        padding-left: 0;
        padding-right: 0;
    }

    #Top.vanilla-layout .header-boards {
        column-gap: 12px;
    }

    #Top.vanilla-layout .content {
        box-sizing: border-box;
        max-width: 1224px;
        padding-left: 24px;
        padding-right: 24px;
    }

    #Bottom.vanilla-layout {
        padding-left: 0;
        padding-right: 0;
    }

    #Bottom.vanilla-layout .content {
        box-sizing: border-box;
        max-width: 1224px;
        padding-left: 18px;
        padding-right: 18px;
    }}

/* ============================================
   User Card Styles (Rightbar)
   ============================================ */
.user-card {
    margin-bottom: 15px;
}

.sidebar-discovery[hidden] {
    display: none !important;
}

.sidebar-panel-card {
    margin-bottom: 15px;
}

.sidebar-panel-cell {
    padding: 15px !important;
}

.sidebar-panel-header {
    margin-bottom: 12px;
}

.sidebar-panel-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text-primary);
}

.sidebar-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sidebar-tag-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--card-surface-control-bg);
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.2;
    text-decoration: none;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.sidebar-tag-chip:hover {
    background: var(--bg-secondary);
    border-color: var(--text-muted);
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar-tag-chip-label {
    min-width: 0;
}

.sidebar-tag-chip-count {
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.sidebar-category-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-category-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 10px;
    border-radius: 10px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.16s ease, color 0.16s ease;
}

.sidebar-category-link:hover {
    background: var(--card-surface-control-bg);
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar-category-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.sidebar-category-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 14px;
}

.sidebar-category-icon.is-fallback::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.6;
}

/* 板块未读：fallback 圆点点亮（复用阅读圆点 .topic-stat-dot 的未读色） */
.sidebar-category-icon.is-fallback.is-unread::before {
    background: var(--accent-fill);
    opacity: 1;
}

[data-theme="dark"] .sidebar-category-icon.is-fallback.is-unread::before {
    background: var(--accent-fill);
}

/* 板块未读：emoji 板块在图标旁补的独立未读圆点 */
.sidebar-category-unread-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-fill);
    flex-shrink: 0;
}

[data-theme="dark"] .sidebar-category-unread-dot {
    background: var(--accent-fill);
}

.sidebar-category-name {
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    color: inherit;
}

.sidebar-category-count {
    flex-shrink: 0;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
}

.sidebar-panel-more {
    display: inline-flex;
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}

.sidebar-panel-more:hover {
    color: var(--text-primary);
    text-decoration: none;
}

/* 未登录欢迎区域 */
.user-card-welcome {
    text-align: center;
    padding: 20px 15px !important;
}

.welcome-title {
    font-size: 20px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.welcome-desc {
    font-size: 13px;
    color: var(--text-muted);
}

/* 未登录侧栏按钮 */
.sidebar-guest-actions {
    display: flex;
    gap: 10px;
    padding: 14px 16px !important;
}

.sidebar-guest-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    /* 主按钮舒展档 33(2026-08-25:主 CTA 统一 33 高,比 compact 30 敦实) */
    min-height: 33px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    border-radius: 999px;
    transition: all 0.18s ease;
    cursor: pointer;
    box-sizing: border-box;
}

.sidebar-guest-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.sidebar-guest-btn--primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border: 1px solid var(--btn-primary-bg);
    box-shadow: 0 1px 2px var(--primary-soft-shadow);
}

.sidebar-guest-btn--primary:hover {
    background: var(--btn-primary-bg-hover);
    border-color: var(--btn-primary-bg-hover);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px var(--primary-soft-shadow-hover);
    color: var(--btn-primary-text);
    text-decoration: none;
}

.sidebar-guest-btn--secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.sidebar-guest-btn--secondary:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    text-decoration: none;
}

[data-theme="dark"] .sidebar-guest-btn--primary {
    background: var(--primary-soft-bg);
}

[data-theme="dark"] .sidebar-guest-btn--primary:hover {
    background: var(--primary-soft-bg-hover);
    box-shadow: 0 3px 12px var(--primary-soft-shadow-hover);
}

/* 已登录用户头部 */
.user-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px !important;
}

.user-card-logged-in .user-card-header {
    border-bottom: none;
    padding-bottom: 10px !important;
}

.user-card-stats-cell {
    padding: 0 14px 14px !important;
    border-bottom: none;
}

.user-card-stats-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
    padding: 14px 15px;
    border-radius: 12px;
    background: var(--card-surface-control-bg);
    border: 1px solid var(--user-card-stats-border);
    box-shadow: 0 8px 18px -16px var(--user-card-stats-shadow);
}

.user-card-stat {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--text-primary);
    text-decoration: none;
    transition: transform 0.16s ease, opacity 0.16s ease;
}

.user-card-stat:hover {
    color: var(--text-primary);
    text-decoration: none;
    transform: none;
}

.user-card-stat-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--user-card-stats-icon);
    flex-shrink: 0;
}

.user-card-stat-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.user-card-stat-copy {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    min-width: 0;
    flex-wrap: wrap;
}

.user-card-stat-label {
    font-size: 13px;
    color: var(--user-card-stats-label);
    line-height: 1.2;
}

.user-card-stat-value {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
}

.user-card-stat-value.is-placeholder {
    color: var(--text-muted);
    font-weight: 600;
}

/* ── 侧栏活跃统计独立卡片 ── */

.sidebar-activity-card .activity-stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
}

.sidebar-activity-card .activity-stats-table th {
    font-weight: 500;
    color: var(--text-muted, #94a3b8);
    font-size: 11px;
    text-align: right;
    padding: 2px 0;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.sidebar-activity-card .activity-stat-label {
    color: var(--user-card-stats-label, #475569);
    font-size: 12px;
}

.sidebar-activity-card .activity-stat-value {
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    font-size: 12px;
    padding: 3px 0;
}

/* ── 侧栏官方渠道与驻站矩阵卡片 ── */
.sidebar-channels-card .channels-group + .channels-group {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.sidebar-channels-card .channels-group-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

.sidebar-channels-card .channels-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-channels-card .channel-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 7px;
    color: var(--text-primary);
    font-size: 12.5px;
    text-decoration: none;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.sidebar-channels-card .channel-link:hover {
    border-color: var(--card-border);
    color: var(--accent);
    text-decoration: none;
}

.sidebar-channels-card .channel-link-name {
    font-weight: 600;
}

.sidebar-channels-card .channel-link-handle {
    font-family: var(--mono-font);
    font-size: 11.5px;
    color: var(--text-muted);
}

.sidebar-channels-card .channels-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.sidebar-channels-card .channels-grid .channel-link {
    justify-content: center;
    padding: 6px 6px;
    font-size: 12px;
}

.sidebar-channels-card .channels-private-hint {
    margin-top: 12px;
    padding: 8px 10px;
    border-radius: 7px;
    background: var(--bg-tertiary);
    border-left: 2.5px solid var(--accent);
    color: var(--text-secondary);
    font-size: 11.5px;
    line-height: 1.5;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    box-sizing: border-box;
}

.user-avatar {
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: 50%;
    flex-shrink: 0;
    display: block;
    box-sizing: border-box;
}

.user-avatar a {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.user-notif {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.user-notif-right {
    margin-top: 0;
}

.user-notif-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.user-notif-badge:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    text-decoration: none;
}

.user-notif-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.user-notif-icon svg {
    display: block;
    width: 16px;
    height: 16px;
}

.user-notif-label {
    font-size: 13px;
}

.user-notif-count {
    font-weight: 700;
    font-size: 13px;
}

.user-notif-count.has-unread {
    color: #ef4444;
}

.user-notif-badge:has(.has-unread) {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.08);
}

/* 手机端未读角标(复用 [data-user-notif-count] 刷新逻辑,与侧栏铃铛同数据源)。
   ①汉堡菜单「私信」行右侧的数字胶囊;②☰ 按钮角上的红色数字泡(有未读才显示)。 */
.mobile-menu-content a.mobile-menu-msg-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.mobile-menu-notif-count {
    padding: 1px 10px;
    border-radius: 999px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
}

.mobile-menu-notif-count.has-unread {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.08);
}

.mobile-menu-btn-count {
    display: none;
    position: absolute;
    top: -1px;
    right: -5px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

.mobile-menu-btn-count.has-unread {
    display: inline-block;
}

.user-logout-link {
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 4px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.user-logout-link:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
    text-decoration: none;
}

/* 操作按钮区域 */

.user-action-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: var(--compact-pill-control-height);
    padding: 0 14px;
    gap: 6px;
    text-align: center;
    font-family: var(--mono-font);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    border-radius: 6px;
    text-decoration: none;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--card-border);
    box-shadow: none;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.user-action-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
    background: transparent;
    text-decoration: none;
}

.user-action-btn.primary {
    background: var(--btn-primary-bg);
    border: 1px solid var(--btn-primary-bg);
    color: var(--btn-primary-text);
    font-family: var(--mono-font);
    font-weight: 500;
    border-radius: 6px;
    box-shadow: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.user-action-btn.primary:hover {
    background: var(--btn-primary-bg-hover);
    border-color: var(--btn-primary-bg-hover);
    color: var(--btn-primary-text);
    box-shadow: none;
}

[data-theme="dark"] .user-action-btn.primary {
    background: var(--btn-primary-bg);
    border-color: var(--btn-primary-bg);
    color: var(--btn-primary-text);
}

[data-theme="dark"] .user-action-btn.primary:hover {
    background: var(--btn-primary-bg-hover);
    border-color: var(--btn-primary-bg-hover);
    box-shadow: none;
}

.user-action-btn.primary .ai-sparkle {
    color: currentColor;
}

/* Sidebar: NHT-style "创作新主题" */
.sidebar-create-topic {
    margin-top: 28px;
}

.sidebar-create-topic-cell {
    padding: 14px 16px !important;
}

.user-card-logged-in .sidebar-create-topic-cell {
    border-bottom: none;
}

.sidebar-create-topic-btn {
    appearance: none;
    --create-topic-icon-size: 18px;
    --create-topic-icon-shift: -1px;
    /* optical alignment for this SVG set */

    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    /* 主按钮舒展档 33(同 .sidebar-guest-btn 注释) */
    min-height: 33px;
    padding: 0 14px;
    box-sizing: border-box;
    border: 1px solid var(--btn-primary-bg);
    border-radius: 6px;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    font-family: var(--mono-font);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    box-shadow: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.sidebar-create-topic-btn:hover {
    background: var(--btn-primary-bg-hover);
    border-color: var(--btn-primary-bg-hover);
    box-shadow: none;
    color: var(--btn-primary-text);
    text-decoration: none;
}

.sidebar-create-topic-btn:focus-visible {
    outline: 2px solid rgba(var(--accent-rgb), 0.4);
    outline-offset: 2px;
}

.sidebar-create-topic-btn .create-topic-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--btn-primary-text);
    flex-shrink: 0;
    width: var(--create-topic-icon-size);
    height: var(--create-topic-icon-size);
}

.sidebar-create-topic-btn .create-topic-icon svg {
    width: 100%;
    height: 100%;
    display: block;
    transform: translateY(var(--create-topic-icon-shift));
}

.sidebar-create-topic-btn .create-topic-label {
    font-size: 14px;
    font-weight: 600;
    line-height: var(--create-topic-icon-size);
}

.sidebar-create-topic .create-dropdown.open .sidebar-create-topic-btn,
.sidebar-create-topic-cell .create-dropdown.open .sidebar-create-topic-btn {
    background: var(--btn-primary-bg);
    box-shadow: none;
}

[data-theme="dark"] .sidebar-create-topic-btn {
    background: var(--btn-primary-bg);
}

[data-theme="dark"] .sidebar-create-topic-btn:hover {
    background: var(--btn-primary-bg-hover);
    box-shadow: none;
}


.ai-plus,
.ai-sparkle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.ai-sparkle {
    color: var(--accent-fill);
}

.ai-plus svg,
.ai-sparkle svg {
    width: 16px;
    height: 16px;
    display: block;
}

[data-theme="dark"] .ai-sparkle {
    color: #7dd3fc;
}

/* ── 发帖类型选择器：色板 + 头部下拉网格面板 ──
 * 色板的同名变量在 create-common.css :root 中有一份镜像(供发帖页切换条首屏使用),
 * 改这里的颜色必须同步 create-common.css。 */
:root {
    --ctype-normal: #64748b; --ctype-normal-bg: rgba(100, 116, 139, 0.10);
    --ctype-help:   #cc3a14; --ctype-help-bg:   rgba(240, 78, 35, 0.10);
    --ctype-poll:   #7c3aed; --ctype-poll-bg:   rgba(124, 58, 237, 0.10);
    --ctype-trade:  #059669; --ctype-trade-bg:  rgba(5, 150, 105, 0.10);
    --ctype-review: #d97706; --ctype-review-bg: rgba(217, 119, 6, 0.10);
    --ctype-kick:   #e11d48; --ctype-kick-bg:   rgba(225, 29, 72, 0.10);
}
[data-theme="dark"] {
    --ctype-normal: #94a3b8; --ctype-normal-bg: rgba(148, 163, 184, 0.16);
    --ctype-help:   #ff7a54; --ctype-help-bg:   rgba(240, 78, 35, 0.14);
    --ctype-poll:   #a78bfa; --ctype-poll-bg:   rgba(167, 139, 250, 0.16);
    --ctype-trade:  #34d399; --ctype-trade-bg:  rgba(52, 211, 153, 0.16);
    --ctype-review: #fbbf24; --ctype-review-bg: rgba(251, 191, 36, 0.16);
    --ctype-kick:   #fb7185; --ctype-kick-bg:   rgba(251, 113, 133, 0.16);
}

/* Clearfix for content wrapper */
#Wrapper .content::after {
    content: "";
    display: table;
    clear: both;
}

/* Footer */
#Bottom {
    background-color: var(--card-surface-bg);
    padding: 20px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--card-border);
    clear: both;
    transition: background-color 0.3s ease;
}

#Bottom .footer-main {
    margin-right: 290px;
    /* match #Main margin-right (reserve Rightbar + gap) */
    text-align: left;
}

#Bottom.vanilla-layout .footer-main {
    margin-right: 282px;
    /* match #Wrapper.vanilla-layout #Main margin-right */
}

#Bottom .footer-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

#Bottom .footer-links {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

#Bottom .footer-link {
    color: var(--text-muted);
    text-decoration: none;
}

#Bottom .footer-link:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

#Bottom .footer-line + .footer-line {
    margin-top: 4px;
}

#Bottom .footer-copyright {
    color: var(--text-muted);
    text-align: right;
    white-space: nowrap;
}

/* Floating Scroll Buttons */
.nht-scroll-buttons {
    position: fixed;
    right: 18px;
    bottom: 24px;
    z-index: 950;
    display: flex;
    flex-direction: column;
    gap: 6px;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.nht-scroll-buttons.is-active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.nht-scroll-button {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--scroll-fab-border);
    background: linear-gradient(180deg, var(--scroll-fab-surface), var(--scroll-fab-bg));
    color: var(--scroll-fab-icon);
    box-shadow: 0 10px 20px -16px var(--scroll-fab-shadow), 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.nht-scroll-button:hover {
    background: linear-gradient(180deg, var(--scroll-fab-surface), var(--scroll-fab-bg-hover));
    color: var(--text-primary);
    box-shadow: 0 12px 22px -16px var(--scroll-fab-shadow), 0 4px 8px rgba(0, 0, 0, 0.10);
    transform: translateY(-1px);
}

.nht-scroll-button:active {
    transform: translateY(1px);
}

.nht-scroll-button:focus-visible {
    outline: none;
    border-color: rgba(100, 116, 139, 0.42);
    box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.14), 0 12px 24px -14px var(--scroll-fab-shadow);
}

.nht-scroll-button svg {
    width: 16px;
    height: 16px;
    display: block;
}

/* ============================================
   Navigation Bar Styles (NHT-style simple style)
   ============================================ */
.nav-bar {
    background-color: var(--card-surface-bg);
    border-radius: var(--card-radius);
    border: 1px solid var(--card-border);
    margin-bottom: 0;
    transition: background-color 0.3s ease;
}

.box #nav-placeholder>.nav-bar {
    border: 0;
    border-radius: 0;
    background-color: transparent;
}

.box #nav-placeholder>.nav-bar .content {
    max-width: none;
    min-width: 0;
    margin: 0;
}

/* 首页列表卡:筛选行(板块槽 + 标签▾ 最新▾)与下面第一行帖子/上下文头之间加一条与 .cell 同款的
   分割线(2026-09-09 用户指出两者没分开)。只圈 #TopicsBox,搜索页(#SearchBox 里 .nav-secondary
   是隐藏的)不受影响。 */
#TopicsBox #nav-placeholder>.nav-bar {
    border-bottom: 1px solid var(--border-color);
}

.nav-bar .content {
    display: flex;
    flex-direction: column;
    min-width: auto;
    padding: 0 10px;
}

/* 第一栏：板块导航 - 简洁文本链接风格 */
.nav-primary {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding: 8px 0;
    font-size: 14px;
}

/* Desktop: primary boards moved to header */
@media screen and (min-width: 769px) {
    .nav-primary {
        display: none;
    }}

.nav-board-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 999px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    margin-right: 4px;
    line-height: 1.2;
    min-height: 30px;
    transition: all 0.15s ease;
}

.nav-board-item:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
    text-decoration: none;
}

.nav-board-item.active {
    background: rgba(14, 165, 233, 0.12);
    border-color: rgba(14, 165, 233, 0.45);
    color: #0c4a6e;
}

[data-theme="dark"] .nav-board-item.active {
    background: rgba(14, 165, 233, 0.2);
    border-color: rgba(14, 165, 233, 0.55);
    color: #bae6fd;
}

/* 第二栏：标签下拉区域 */
.nav-secondary {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
}

.nav-secondary.show {
    max-height: 200px;
    padding: 8px 0;
    overflow: visible;
}

.nav-secondary-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.nav-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* ── 板块摊平行(2026-09-09 拍板,替代「板块▾」下拉):左边一排板块 pill,右边标签/最新下拉 ──
   外观直接复用顶栏同款 .pill-tabs/.pill-tab(灰槽 + 白 pill 选中),不另起选中色:墨色实底会和
   「公告」等前缀标签徽章混(用户 2026-09-09 指出)。桌面一行不折行:槽按内容宽、最多占满、
   溢出横滑(隐藏滚动条写法同 .header-boards-primary);下拉必须留在 .nav-filters(滚动容器之外),
   否则 absolute 浮层会被 overflow 裁掉。 */
.nav-filter-row {
    flex-wrap: nowrap;
}

.nav-board-row {
    display: flex;
    flex: 0 1 auto;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-board-row::-webkit-scrollbar {
    display: none;
}

.nav-board-row .pill-tab {
    flex: 0 0 auto;
}

.nav-filter-row .nav-filters {
    flex: 0 0 auto;
    margin-left: auto;
}

/* 筛选行的两个下拉按钮(标签 / 最新):2026-09-18 拍板改成纯文字 + 细线箭头,不铺底不描边不带图标。
   之前铺板块槽同款灰底 + 内环,用户看着像「两个空槽」;--primary-soft-bg 淡底与 --bg-primary 是同一个灰,
   铺任何灰都退回空槽观感(已否)。悬停/展开才出画布灰底;竖向内距 7px 保住与左边槽同高
   (桌面 29.6 / 手机 28.4)。只圈在首页筛选行,主题页面包屑与顶栏里的 .nav-filter-chip 不受影响。 */
.nav-filter-row .nav-filter-chip {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 7px 10px;
    gap: 5px;
    font-weight: 600;
}

.nav-filter-row .nav-filter-chip:hover,
.nav-filter-row .nav-dropdown.open .nav-filter-chip {
    background: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: none;
}

/* 选中了标签(值 span 只在选中时才渲染,SSR/CSR 同构):整个按钮字深一档、值前带 #,
   与列表前缀标签(.topic-prefix-tag::before)/标签页标题「#VPS」同一写法;× 跟随文字色。 */
.nav-filter-row .nav-dropdown[data-dropdown="tag"] .nav-filter-chip:has(.nav-filter-chip-value) {
    color: var(--text-primary);
}

.nav-filter-row .nav-dropdown[data-dropdown="tag"] .nav-filter-chip-value::before {
    content: '#';
    margin-right: 1px;
    opacity: 0.55;
    font-weight: 400;
}

.nav-filter-row .nav-filter-chip-clear {
    /* 1.2em = 按钮文字行高:沿用全局 18px 方框会把选中态按钮撑到 32px,比左边槽(29.6)高一截 */
    width: 1.2em;
    height: 1.2em;
    color: inherit;
    opacity: 0.75;
}

/* 箭头样式见下方全站共用的 .nav-filter-chip-caret(细线 chevron)。 */

/* ── 分页（chip 下拉式） ── */
.nav-pagination {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-size: 13px;
    user-select: none;
}

.nav-pagination:empty {
    display: none;
}

.nav-pagination-desktop {
    display: flex;
    align-items: center;
    gap: 2px;
}

.nav-pagination-mobile {
    display: none;
    align-items: center;
    gap: 8px;
}

.nav-page-item {
    min-width: 0;
    height: 19px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    color: #666;
    transition: all 0.15s ease;
    text-decoration: none;
    border: 1px solid transparent;
    background: transparent;
    line-height: 1;
}

.nav-page-item:hover:not(.active):not(.disabled) {
    background: #e8e8e8;
    color: #333;
    text-decoration: none;
}

.nav-page-item.active {
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
    font-weight: 500;
    cursor: default;
}

.nav-page-item.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.nav-page-item.nav-page-arrow {
    font-size: 12px;
    color: #999;
}

.nav-page-item.nav-page-arrow:hover:not(.disabled) {
    color: #333;
}

.nav-page-ellipsis {
    color: #999;
    padding: 0 4px;
    font-size: 13px;
}

.nav-page-dropdown-item.dots {
    cursor: default;
    color: var(--text-muted);
}

[data-theme="dark"] .nav-page-item {
    color: #9ca3af;
}

[data-theme="dark"] .nav-page-item:hover:not(.active):not(.disabled) {
    background: #2f2f2f;
    color: #e5e7eb;
}

[data-theme="dark"] .nav-page-item.active {
    background: #242424;
    border-color: #3d3d3d;
    color: #e5e7eb;
}

[data-theme="dark"] .nav-page-item.nav-page-arrow {
    color: #7b7b7b;
}

[data-theme="dark"] .nav-page-item.nav-page-arrow:hover:not(.disabled) {
    color: #e5e7eb;
}

[data-theme="dark"] .nav-page-ellipsis {
    color: #777;
}

.nav-pagination-dropdown {
    position: relative;
}

.nav-pagination-menu {
    min-width: 180px;
    max-width: min(260px, calc(100vw - 24px));
    right: 0;
    left: auto;
}

.nav-pagination-jump {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
    margin: -6px -6px 6px;
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 1;
}

.nav-pagination-jump-input {
    flex: 1;
    min-width: 0;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    -moz-appearance: textfield;
}

.nav-pagination-jump-input::-webkit-inner-spin-button,
.nav-pagination-jump-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.nav-pagination-jump-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
    background: var(--bg-secondary);
}

.nav-pagination-jump-input.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}

.nav-pagination-jump-btn {
    flex-shrink: 0;
    height: 32px;
    padding: 0 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.nav-pagination-jump-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--text-muted);
}

.nav-pagination-page-list {
    max-height: 200px;
    overflow-y: auto;
}

.nav-page-dropdown-item.active {
    background: var(--bg-tertiary);
    font-weight: 600;
}

/* ── New-topics banner (Discourse-style live update) ── */
/* 新帖/新回复提示 —— 悬浮吸顶胶囊。中性卡片底 + 描边 + 柔和投影做出
   "浮起"层次，滚动时吸顶跟随；数字用品牌紫做克制强调。 */
.new-topics-float {
    position: sticky;
    top: calc(env(safe-area-inset-top, 0px) + 6px);
    z-index: 30;
    text-align: center;
    padding: 6px 0;
    /* 透明包裹区不挡身后的帖子行点击，胶囊本体单独恢复 */
    pointer-events: none;
}

.new-topics-pill {
    pointer-events: auto;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 15px;
    border: 1px solid var(--float-pill-border);
    border-radius: 999px;
    background: var(--float-pill-bg);
    color: var(--text-secondary);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    box-shadow: var(--float-pill-shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    animation: newTopicsPillIn 0.25s ease-out;
}

.new-topics-pill:hover {
    transform: translateY(-1px);
    box-shadow: var(--float-pill-shadow-hover);
}

.new-topics-pill:active {
    transform: translateY(0);
}

#RepliesBox .cell[id^="reply-cell-"] {
    scroll-margin-top: 58px;
}

.topic-resume-float {
    position: sticky;
    top: calc(env(safe-area-inset-top, 0px) + 4px);
    z-index: 30;
    height: 0;
    overflow: visible;
    text-align: center;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.topic-resume-float.is-hiding {
    opacity: 0;
    transform: translateY(-8px);
}

.topic-resume-pill {
    pointer-events: auto;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    max-width: calc(100% - 16px);
    padding: 7px 15px;
    border: 1px solid var(--float-pill-border);
    border-radius: 999px;
    background: var(--float-pill-bg);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    box-shadow: var(--float-pill-shadow);
    animation: newTopicsPillIn 0.22s ease-out;
}

.topic-resume-sep {
    opacity: 0.45;
}

.topic-resume-action {
    color: var(--link-color, #2563eb);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    background: none;
    border: none;
    margin: -2px 0;
    padding: 2px 0;
    font: inherit;
}

.topic-resume-action:hover {
    color: var(--link-hover, #1d4ed8);
    text-decoration: underline;
}

.new-topics-pill-icon {
    display: inline-flex;
    flex: 0 0 auto;
    color: var(--text-secondary);
}

.new-topics-pill-icon svg {
    width: 14px;
    height: 14px;
    display: block;
}

.new-topics-text strong {
    color: #7c5cf6;
    font-weight: 700;
}

[data-theme="dark"] .new-topics-text strong {
    color: #a78bfa;
}

@keyframes newTopicsPillIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Expand wrapper animation */
.new-topics-expand-wrapper {
    will-change: max-height, opacity;
}

/* Highlight flash for newly inserted topics */
.topic-new-highlight {
    animation: newTopicFlash 2.5s ease;
}

@keyframes newTopicFlash {
    0% {
        background-color: rgba(100, 116, 139, 0.16);
    }

    100% {
        background-color: transparent;
    }
}

.topic-pagination-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 8px 12px;
    border-top: 1px solid var(--border-color);
}

.topic-pagination-row .nav-pagination {
    margin-left: 0;
}

@media screen and (max-width: 768px) {

    /* ── 移动端筛选 + 分页：同一行，分页靠右 ── */
    .nav-secondary-row {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 8px;
    }

    .nav-filters {
        flex: 1;
        min-width: 0;
        flex-wrap: nowrap;
        overflow: visible;
        gap: 8px;
        padding-bottom: 0;
    }

    .nav-filter-chip {
        padding: 5px 10px;
        font-size: 12px;
        min-height: 28px;
        white-space: nowrap;
        flex-shrink: 1;
        min-width: 0;
    }

    .nav-filter-chip-value {
        max-width: 90px;
    }

    /* 手机两行:第一行板块槽(按内容宽,溢出横滑),第二行 标签▾ 最新▾ 整行(骨架同 sb.sb / NodeSeek 手机版) */
    .nav-filter-row {
        flex-wrap: wrap;
    }

    .nav-filter-row .nav-filters {
        flex: 0 0 100%;
        margin-left: 0;
    }

    .nav-board-row .pill-tab {
        padding: 4px 9px;
        font-size: 12px;
    }

    .nav-pagination-desktop {
        display: none;
    }

    .nav-pagination-mobile {
        display: flex;
        justify-content: flex-end;
        flex-wrap: nowrap;
    }

    .nav-pagination-mobile .nav-filter-chip {
        min-width: 0;
        /* 2026-09-09 拍板:分页按钮面上只显示「当前/总页」,比板块/标签筛选按钮收一档 */
        padding: 4px 10px;
        gap: 6px;
    }}

.nav-dropdown {
    position: relative;
}

.nav-filter-chip {
    appearance: none;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 0;
    min-width: 0;
    padding: 6px 12px;
    font-size: 13px;
    line-height: 1.2;
}

.nav-filter-chip:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
    text-decoration: none;
}

.nav-dropdown.open .nav-filter-chip {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
    color: var(--text-primary);
}

.nav-filter-chip-label {
    font-weight: 600;
}

.nav-filter-chip-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    color: var(--text-muted);
    margin-left: 2px;
    cursor: pointer;
}

.nav-filter-chip-clear:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-filter-chip-value {
    font-weight: 600;
    display: inline-block;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 下拉按钮箭头(筛选行的标签/最新 + 主题页与首页底部的手机分页片「N/M」共用):字体三角「▾」偏粗偏下,
   2026-09-18 起全站换成 12px 细线 chevron(mask 上色跟随文字色);「▾」文本留在 DOM 里,SSR/CSR 两端模板都不改。 */
.nav-filter-chip-caret {
    --nav-chip-caret-svg: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
    width: 12px;
    height: 12px;
    margin-left: 0;
    font-size: 0;
    opacity: 0.8;
    background-color: currentColor;
    -webkit-mask: var(--nav-chip-caret-svg) center / 12px 12px no-repeat;
    mask: var(--nav-chip-caret-svg) center / 12px 12px no-repeat;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 220px;
    max-width: min(360px, calc(100vw - 24px));
    max-height: min(240px, 70vh);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px;
    background: var(--bg-secondary);
    /* 浮层外框必须用 --card-border:--border-color 比画布还浅,白底上看不见 */
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: 0 12px 28px var(--shadow-color);
    z-index: 50;
}

.nav-pagination-dropdown .nav-pagination-menu {
    left: auto;
    right: 0;
}

/* 筛选行两个菜单:桌面按钮贴卡片右缘,菜单右对齐到按钮才落在卡片里(左对齐会伸到右栏上);
   手机上按钮在第二行左侧,仍左对齐。 */
.nav-filter-row .nav-dropdown-menu {
    left: auto;
    right: 0;
}

@media screen and (max-width: 768px) {
    .nav-filter-row .nav-dropdown-menu {
        left: 0;
        right: auto;
    }}

.nav-dropdown-search {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-secondary);
    padding: 8px 8px 6px;
    margin: -6px -6px 4px;
}

.nav-dropdown-search-field {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-dropdown-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 28px 7px 30px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.4;
    outline: none;
    transition: background-color .15s ease, border-color .15s ease;
}

.nav-dropdown-search-input::placeholder {
    color: var(--text-muted);
}

.nav-dropdown-search-input:hover {
    border-color: var(--border-color);
}

.nav-dropdown-search-input:focus {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    box-shadow: none;
}

.nav-dropdown-search-icon {
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    color: var(--text-muted);
    pointer-events: none;
    opacity: 0.7;
}

.nav-dropdown-search-input:focus ~ .nav-dropdown-search-icon {
    opacity: 1;
    color: var(--text-secondary);
}

.nav-dropdown-search-icon svg {
    width: 14px;
    height: 14px;
}

.nav-dropdown.open .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    /* 分组行/返回行是 <button>,不显式写会吃到全局 button{font-weight:bold},和 <a> 的标签行一粗一细 */
    font-weight: 400;
    line-height: 1.2;
    background: none;
    border: none;
    width: 100%;
    min-width: 0;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    box-sizing: border-box;
}

.nav-dropdown-item:hover {
    /* 悬停底色用画布灰:--bg-tertiary 在浅色主题就是白,白卡上看不出悬停(2026-09-18 修) */
    background: var(--bg-primary);
    text-decoration: none;
}

.nav-dropdown-item.active {
    font-weight: 600;
}

/* 首页筛选行的两个菜单(2026-09-18 拍板,与纯文字按钮同一族):行内不带图标;分组行右侧「›」表示能点进去,
   返回行左侧「‹」,当前项加粗 + 右侧「✓」——三种标记都是与按钮箭头同款的细线 mask,不进模板。 */
.nav-filter-row .nav-tag-group-item::after,
.nav-filter-row .nav-tag-group-back::before,
.nav-filter-row .nav-dropdown-item.active::after {
    content: '';
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    opacity: 0.6;
    background-color: currentColor;
    -webkit-mask: var(--nav-menu-mark-svg) center / 12px 12px no-repeat;
    mask: var(--nav-menu-mark-svg) center / 12px 12px no-repeat;
}

.nav-filter-row .nav-tag-group-item::after {
    --nav-menu-mark-svg: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='m9 6 6 6-6 6'/></svg>");
    margin-left: auto;
}

.nav-filter-row .nav-tag-group-back::before {
    --nav-menu-mark-svg: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='m15 6-6 6 6 6'/></svg>");
}

.nav-filter-row .nav-dropdown-item.active::after {
    --nav-menu-mark-svg: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='m5 12 5 5L20 7'/></svg>");
    margin-left: auto;
    opacity: 0.95;
}

.nav-dropdown-item-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-dropdown-empty {
    padding: 8px 10px;
    color: var(--text-muted);
    font-size: 13px;
}

/* Keep secondary nav height consistent on desktop even when a board has no tags (e.g., 全部) */

/* Theme Toggle Button */
/* Theme Toggle Button */
.theme-toggle,
.locale-toggle {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 6px 10px;
    margin-left: 5px;
    border-radius: 4px;
    color: var(--text-secondary);
    transition: background-color 0.2s ease, color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.locale-toggle {
    font-size: 13px;
    font-weight: 600;
}

/* 主题按钮三图标:由 <html data-theme-mode> 纯 CSS 控制显示其一(sun/moon/auto)。
   theme-init.js 在 head 阻塞阶段即设好 data-theme-mode，首屏即正确，无 hydrate 图标跳变。 */
.theme-toggle .theme-icon {
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
html[data-theme-mode="light"] .theme-toggle .theme-icon-sun {
    display: inline-flex;
}
html[data-theme-mode="dark"] .theme-toggle .theme-icon-moon {
    display: inline-flex;
}
html[data-theme-mode="auto"] .theme-toggle .theme-icon-auto,
html:not([data-theme-mode]) .theme-toggle .theme-icon-auto {
    display: inline-flex;
}

.header-boards-secondary .theme-toggle,
.header-boards-secondary .locale-toggle {
    margin-left: 0;
    height: var(--compact-pill-control-height);
    box-sizing: border-box;
    padding: 0 10px;
    border-radius: 6px;
}

.theme-toggle:hover,
.locale-toggle:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Editor Toolbar Styles */
.reply-toolbar, .reply-edit-toolbar {
    background-color: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
}

.reply-toolbar button, .reply-edit-toolbar button {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
}

.reply-toolbar button:hover, .reply-edit-toolbar button:hover {
    background-color: var(--bg-tertiary) !important;
}

/* Input Panels Dark Mode */
.input-panel {
    background-color: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
}

/* ============================================
   RESPONSIVE DESIGN - Mobile Support
   ============================================ */

/* Tablet and smaller */
@media screen and (max-width: 1024px) {
    /* 窄屏单栏:内容列在前、侧栏卡片在后(2026-08-27 修复)。
       HTML 里 #Rightbar 因 float 布局写在 #Main 前,取消浮动后按 DOM 序渲染
       会把侧栏整个顶到列表上面,故用 flex order 翻转。 */
    .content {
        min-width: auto;
        max-width: 100%;
        padding: 0 10px;
        display: flex;
        flex-direction: column;
    }

    .header-boards {
        grid-template-columns: 1fr auto;
    }

    #Rightbar {
        float: none;
        width: 100%;
        margin-left: 0;
        margin-top: 20px;
        order: 2;
    }

    #Main {
        margin-right: 0;
        order: 1;
    }

    #Bottom .footer-main,
    #Bottom.vanilla-layout .footer-main {
        margin-right: 0;
    }

    .nht-scroll-buttons {
        right: 14px;
        bottom: 18px;
    }}

/* Mobile phones */
@media screen and (max-width: 768px) {
    body {
        font-size: 15px;
    }

    :root {
        --avatar-size: 42px;
    }

    #Top {
        height: 52px;
        padding: 0 10px;
        flex-wrap: nowrap;
    }

    #Top .content {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 8px;
        min-width: 0;
    }

    .header-cap {
        flex: 1 1 auto;
        min-width: 0;
        max-width: 100%;
        gap: 10px;
    }

    .header-left {
        flex: 0 0 auto;
        margin-left: 0;
    }

    .anyns-logo-sub {
        display: none;
    }

    .header-boards {
        display: none;
    }

    .header-search {
        flex: 1;
        margin-left: 0;
        height: 36px;
        border-radius: 8px;
        min-width: 0;
        max-width: none;
    }

    .header-search .search-icon {
        right: 4px;
        width: 28px;
        height: 28px;
        border-radius: 6px;
    }

    #searchInput {
        width: 100% !important;
        min-width: 0;
        padding: 0 34px 0 12px;
        font-size: 16px;
    }

    #searchInput:focus {
        width: 100% !important;
    }

    /* Hide desktop nav, show mobile menu button */
    .header-nav {
        display: none !important;
    }

    #TopNav {
        display: none !important;
    }

    .mobile-menu-btn {
        display: block !important;
        flex-shrink: 0;
    }

    .nav-bar {
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    /* Mobile: hide primary nav (replaced by dropdown filters) */
    .nav-primary {
        display: none;
    }

    .nav-board-item {
        flex: 0 0 auto;
        margin-right: 0;
        padding: 7px 14px;
        border-radius: 999px;
        background: var(--bg-tertiary);
        border: 1px solid var(--border-color);
        color: var(--text-secondary);
        white-space: nowrap;
    }

    .nav-board-item.active {
        background: rgba(14, 165, 233, 0.2);
        border-color: rgba(14, 165, 233, 0.55);
        color: #bae6fd;
    }

    .nav-secondary.show {
        padding: 10px 0;
        border-top: none;
    }

    .nav-filter-chip {
        padding: 5px 10px;
        border-radius: 999px;
        font-size: 12px;
        min-height: 28px;
    }

    .nav-dropdown-search-input {
        font-size: 16px;
    }

    /* Hide sidebar on mobile */
    #Rightbar {
        display: none;
    }

    #TopNav a {
        padding: 5px 10px;
    }

    .content {
        padding: 0;
        min-width: auto;
    }

    .box {
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        margin-bottom: 10px;
    }

    .cell {
        padding: 12px;
    }

    .header {
        padding: 12px;
        border-top-left-radius: 0;
        border-top-right-radius: 0;
    }

    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="number"],
    input[type="search"],
    textarea {
        width: 100%;
        box-sizing: border-box;
        /* Prevent iOS Safari zoom (looks like page "jitter") on focus. */
        font-size: 16px;
    }

    /* Topic list: mobile adjustments */
    .topic-list-item .topic-stats-cell {
        display: none;
    }

    /* Auth/form tables: stack label on top of input for clean mobile alignment. */
    #loginForm table,
    #registerForm table,
    #resetRequestForm table,
    #resetConfirmForm table,
    #loginForm tbody,
    #registerForm tbody,
    #resetRequestForm tbody,
    #resetConfirmForm tbody,
    #loginForm tr,
    #registerForm tr,
    #resetRequestForm tr,
    #resetConfirmForm tr,
    #loginForm td,
    #registerForm td,
    #resetRequestForm td,
    #resetConfirmForm td {
        display: block;
        width: 100% !important;
    }

    #loginForm td:first-child,
    #registerForm td:first-child,
    #resetRequestForm td:first-child,
    #resetConfirmForm td:first-child {
        padding: 0 0 6px;
        white-space: nowrap;
        text-align: left;
    }

    #loginForm td:first-child:empty,
    #registerForm td:first-child:empty,
    #resetRequestForm td:first-child:empty,
    #resetConfirmForm td:first-child:empty {
        display: none;
    }

    #loginForm td:last-child,
    #registerForm td:last-child,
    #resetRequestForm td:last-child,
    #resetConfirmForm td:last-child {
        padding: 0 0 12px;
    }

    #loginForm button[type="submit"],
    #registerForm button[type="submit"],
    #resetRequestForm button[type="submit"],
    #resetConfirmForm button[type="submit"] {
        width: 100%;
    }

    /* 手机端标题截断 2 行：截断必须作用在 .item_title 整体，不能只包标题 <a>——
       只包 <a> 的话（2026-07-25 之前的写法）第二行会被前缀标签挤出缩进、状态徽标
       停在第一行末尾不跟着换行。
       实现用 block + max-height，不用 -webkit-line-clamp：clamp 需要 display:-webkit-box，
       而 legacy -webkit-box 作为 flex 子项（.floor-left 是 flex-column）在 WebKit/iOS 有
       首次布局 bug —— 首帧把容器高度按 18.1px 单行算（连一行正常的 19.6 都不到），
       单行行的 pill 底边被裁、两行行的第二行和徽标整个消失；width/align-self 写进
       样式表都防不住首帧，只有事后重排能修复，等于 iOS 上必坏。Chromium 无此问题，
       所以纯 Chromium 验证发现不了 —— 改这里必须连 WebKit 内核一起验。
       max-height = 2 × line-height(140%) = 2.8em，第 3 行整行落在裁切线外，切口干净。
       代价：没有省略号、超过 2 行时跟在末尾的徽标一起被裁 —— 均可接受，徽标信息
       在 title 属性和帖子页里都还在。 */
    .item_title {
        display: block;
        max-height: 2.8em;
        overflow: hidden;
    }

    /* 手机端状态 pill 压扁到 13px 高（svg 11 + 边框 2，去掉上下 padding）：
       16px 图标配 14/15px 正文偏大（用户实际反馈），压扁后 pill 底边距容器裁切线
       余量也从 ~2px 放宽到 ~3px，不再贴边。
       再整体上移 1px：WebKit 换行行里 pill 底边距裁切线实测只剩 1px，真机 PingFang
       基线更低还会再吃掉一点；顶部余量有 4px+，挪 1px 过去两头都稳。 */
    .admin-pill {
        padding-top: 0;
        padding-bottom: 0;
        position: relative;
        top: -1px;
    }

    .admin-pill svg {
        width: 11px;
        height: 11px;
    }

    /* 去框后的四个裸图标随正文缩一档：桌面 14px → 手机 13px */
    .admin-pill.admin-pill-pinned svg,
    .admin-pill.admin-pill-featured svg,
    .admin-pill.admin-pill-locked svg,
    .admin-pill.admin-pill-access svg {
        width: 13px;
        height: 13px;
    }

    .topic_meta {
        font-size: 11px;
    }

    .topic-list-item .topic_meta {
        gap: 5px;
    }

    /* Editor toolbar responsive */
    .reply-toolbar {
        flex-wrap: wrap;
        gap: 5px;
    }

    /* Reply form */
    #Rightbar .box .cell {
        padding: 10px;
    }}

/* Small mobile phones */
@media screen and (max-width: 480px) {
    #TopNav {
        font-size: 13px;
    }

    .item_title {
        font-size: 14px;
    }

    .sep20 {
        height: 10px;
    }

    /* Stack footer links vertically */
    #Bottom .inner {
        line-height: 2;
    }

    #Bottom .footer-line {
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 6px;
    }

    #Bottom .footer-links {
        justify-content: flex-start;
        gap: 12px;
    }

    /* 导航移动端适配 */
    .nav-board-item {
        padding: 5px 10px;
        font-size: 12px;
        border-radius: 999px;
    }}

@media (prefers-reduced-motion: reduce) {

    .nht-scroll-buttons,
    .nht-scroll-button,
    .topic-resume-float,
    .new-topics-pill,
    .topic-resume-pill,
    .toast {
        transition: none;
        animation: none;
    }}

/* Feedback: Toast + Message Bar */
.toast {
    position: fixed;
    top: max(calc(env(safe-area-inset-top, 0px) + 12px), var(--toast-y, 66px));
    left: var(--toast-x, 50%);
    z-index: 10000;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: max-content;
    max-width: var(--toast-max-w, min(460px, calc(100vw - 24px)));
    padding: 7px 15px;
    background: var(--float-pill-bg);
    color: var(--text-primary);
    border: 1px solid var(--float-pill-border);
    border-radius: 18px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    box-shadow: var(--float-pill-shadow);
    opacity: 0;
    transform: translate(-50%, -6px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.toast-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    color: var(--accent);
}

.toast-icon svg {
    width: 15px;
    height: 15px;
    display: block;
}

.toast-text {
    min-width: 0;
    overflow-wrap: anywhere;
}

.toast-badge {
    flex: 0 0 auto;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    font-variant-numeric: tabular-nums;
    background: var(--primary-soft-bg);
    color: var(--primary-soft-text);
}

.toast-badge[hidden],
.toast-meta[hidden] {
    display: none !important;
}

.toast-meta {
    flex: 0 0 auto;
    padding-left: 8px;
    border-left: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.toast.success .toast-icon {
    color: var(--ucolor-green);
}

.toast.success .toast-badge {
    background: var(--tagstyle-green-bg);
    color: var(--tagstyle-green-fg);
}

.toast.error {
    border-color: color-mix(in srgb, var(--ucolor-red) 38%, var(--float-pill-border));
}

.toast.error .toast-icon {
    color: var(--ucolor-red);
}

.toast.warning {
    border-color: color-mix(in srgb, var(--ucolor-orange) 34%, var(--float-pill-border));
}

.toast.warning .toast-icon {
    color: var(--ucolor-orange);
}

.toast.info .toast-icon {
    color: var(--accent);
}

@media screen and (max-width: 768px) {
    .toast {
        top: max(calc(env(safe-area-inset-top, 0px) + 12px), var(--toast-y, 62px));
        padding: 7px 13px;
    }}

.message-bar {
    padding: 10px 13px;
    margin-bottom: 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 13.5px;
    line-height: 1.5;
    display: none;
    align-items: flex-start;
    gap: 9px;
}

.message-bar.show {
    display: flex;
}

.message-bar.error {
    background: color-mix(in srgb, var(--tagstyle-red-bg) 55%, var(--bg-secondary));
    border-color: color-mix(in srgb, var(--ucolor-red) 30%, var(--border-color));
    color: var(--tagstyle-red-fg);
}

[data-theme="dark"] .message-bar.error {
    background: color-mix(in srgb, var(--tagstyle-red-bg) 72%, var(--bg-tertiary));
    border-color: color-mix(in srgb, var(--ucolor-red) 38%, var(--border-color));
}

.message-bar.success {
    background: color-mix(in srgb, var(--tagstyle-green-bg) 55%, var(--bg-secondary));
    border-color: color-mix(in srgb, var(--ucolor-green) 30%, var(--border-color));
    color: var(--tagstyle-green-fg);
}

[data-theme="dark"] .message-bar.success {
    background: color-mix(in srgb, var(--tagstyle-green-bg) 72%, var(--bg-tertiary));
    border-color: color-mix(in srgb, var(--ucolor-green) 38%, var(--border-color));
}

.message-bar.warning {
    background: color-mix(in srgb, var(--tagstyle-amber-bg) 55%, var(--bg-secondary));
    border-color: color-mix(in srgb, var(--ucolor-orange) 32%, var(--border-color));
    color: var(--tagstyle-amber-fg);
}

[data-theme="dark"] .message-bar.warning {
    background: color-mix(in srgb, var(--tagstyle-amber-bg) 72%, var(--bg-tertiary));
    border-color: color-mix(in srgb, var(--ucolor-orange) 40%, var(--border-color));
}

.message-bar.info {
    background: color-mix(in srgb, var(--tagstyle-blue-bg) 55%, var(--bg-secondary));
    border-color: color-mix(in srgb, var(--ucolor-blue) 28%, var(--border-color));
    color: var(--tagstyle-blue-fg);
}

[data-theme="dark"] .message-bar.info {
    background: color-mix(in srgb, var(--tagstyle-blue-bg) 72%, var(--bg-tertiary));
    border-color: color-mix(in srgb, var(--ucolor-blue) 36%, var(--border-color));
}

.message-bar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex-shrink: 0;
}

.message-bar-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

.message-bar.error .message-bar-icon {
    color: var(--ucolor-red);
}

.message-bar.success .message-bar-icon {
    color: var(--ucolor-green);
}

.message-bar.warning .message-bar-icon {
    color: var(--ucolor-orange);
}

.message-bar.info .message-bar-icon {
    color: var(--ucolor-blue);
}

.message-bar-text {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.markdown-fallback {
    white-space: pre-wrap;
    word-break: break-word;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

/* ============================================
   NHT Inspection Card - Professional Style
   ============================================ */

.nht-inspection {
    margin: 16px 0;
}

.nht-inspection-loading,
.nht-inspection-error {
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-tertiary);
    font-size: 13px;
    line-height: 1.55;
}

.nht-inspection-loading {
    color: var(--text-secondary);
}

.nht-inspection-error {
    color: #b91c1c;
    border-color: rgba(185, 28, 28, 0.28);
    background: rgba(185, 28, 28, 0.06);
}

[data-theme="dark"] .nht-inspection-error {
    color: #fca5a5;
    border-color: rgba(252, 165, 165, 0.22);
    background: rgba(252, 165, 165, 0.08);
}

/* Main Card Container */
.nht-inspection-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-secondary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .nht-inspection-card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Header Section - Score Display */
.nht-inspection-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #fff;
}

[data-theme="dark"] .nht-inspection-head {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.nht-inspection-head-left {
    flex: 1;
    min-width: 0;
}

.nht-inspection-title {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.3;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nht-inspection-title::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    border-radius: 5px;
    flex-shrink: 0;
}

.nht-inspection-sub {
    margin-top: 4px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
}

/* Score Display */
.nht-inspection-head-right {
    flex-shrink: 0;
    text-align: right;
}

.nht-inspection-score {
    min-width: 100px;
}

.nht-inspection-score-line {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 10px;
}

.nht-inspection-score-num {
    font-weight: 800;
    font-size: 32px;
    line-height: 1;
    letter-spacing: -0.02em;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.nht-inspection-score-grade {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
}

/* Grade-specific colors */
.nht-inspection-score-grade[data-grade="S"] {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-color: rgba(245, 158, 11, 0.5);
}

.nht-inspection-score-grade[data-grade="A+"],
.nht-inspection-score-grade[data-grade="A"] {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    border-color: rgba(139, 92, 246, 0.5);
}

.nht-inspection-score-grade[data-grade="B+"],
.nht-inspection-score-grade[data-grade="B"] {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-color: rgba(59, 130, 246, 0.5);
}

.nht-inspection-score-grade[data-grade="C+"],
.nht-inspection-score-grade[data-grade="C"] {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: rgba(16, 185, 129, 0.5);
}

.nht-inspection-score-grade[data-grade="D"],
.nht-inspection-score-grade[data-grade="E"] {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: rgba(239, 68, 68, 0.5);
}

.nht-inspection-score-label {
    margin-top: 4px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Meta Information Grid - Card Style */
.nht-inspection-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    padding: 0;
    background: var(--border-color);
}

@media (max-width: 640px) {
    .nht-inspection-meta {
        grid-template-columns: repeat(2, 1fr);
    }}

.nht-meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    background: var(--bg-secondary);
    min-width: 0;
}

.nht-meta-icon {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
}

.nht-meta-icon svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    flex-shrink: 0;
}

.nht-meta-k {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
}

.nht-meta-v {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 0;
    word-break: break-word;
    line-height: 1.35;
}

.nht-meta-v-sub {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Badges Section */
.nht-inspection-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

.nht-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.2;
    font-weight: 600;
}

.nht-badge-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.nht-badge.ok {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.08);
    color: #059669;
}

[data-theme="dark"] .nht-badge.ok {
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.25);
    background: rgba(16, 185, 129, 0.12);
}

.nht-badge.bad {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
}

[data-theme="dark"] .nht-badge.bad {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.25);
    background: rgba(239, 68, 68, 0.12);
}

.nht-badge.neutral {
    border-color: rgba(59, 130, 246, 0.25);
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
}

[data-theme="dark"] .nht-badge.neutral {
    color: #60a5fa;
    border-color: rgba(96, 165, 250, 0.25);
    background: rgba(59, 130, 246, 0.12);
}

/* Charts Section - 2x2 Grid */
.nht-inspection-charts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: var(--border-color);
    border-top: 1px solid var(--border-color);
}

@media (max-width: 640px) {
    .nht-inspection-charts {
        grid-template-columns: 1fr;
    }}

.nht-chart {
    background: var(--bg-secondary);
    padding: 14px 16px;
}

.nht-chart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.nht-chart-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.nht-chart-unit {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.nht-chart-axis {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 10px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.nht-axis-tick {
    flex: 1 1 auto;
    text-align: center;
}

.nht-axis-tick:first-child {
    text-align: left;
}

.nht-axis-tick:last-child {
    text-align: right;
}

.nht-chart-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nht-bar-row {
    display: grid;
    grid-template-columns: 50px 1fr 70px;
    align-items: center;
    gap: 10px;
}

.nht-bar-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.nht-bar-track {
    height: 8px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    overflow: hidden;
    position: relative;
}

.nht-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    width: 0%;
    transition: width 0.4s ease;
}

[data-theme="dark"] .nht-bar-fill {
    background: linear-gradient(90deg, #2563eb, #3b82f6);
}

.nht-bar-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    text-align: right;
}

/* Traceroute Section */
.nht-traceroute-section {
    border-top: 1px solid var(--border-color);
    padding: 14px 16px;
}

.nht-traceroute-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.nht-traceroute-header svg {
    width: 16px;
    height: 16px;
    stroke: var(--text-muted);
    stroke-width: 2;
    fill: none;
}

.nht-traceroute-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nht-traceroute-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.nht-traceroute-summary {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.nht-traceroute-summary:hover {
    background: var(--bg-hover);
}

.nht-traceroute-target {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nht-traceroute-host {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--mono-font);
}

.nht-traceroute-aspath {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    line-height: 1.2;
}

.nht-traceroute-aspath code {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 11px;
    font-family: var(--mono-font);
    white-space: nowrap;
}

.nht-traceroute-hops {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.nht-traceroute-rtt {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    min-width: 65px;
    text-align: right;
}

.nht-traceroute-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 11px;
}

.nht-traceroute-status.ok {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

[data-theme="dark"] .nht-traceroute-status.ok {
    color: #34d399;
}

.nht-traceroute-status.fail {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

[data-theme="dark"] .nht-traceroute-status.fail {
    color: #f87171;
}

.nht-traceroute-expand {
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.nht-traceroute-item.expanded .nht-traceroute-expand {
    transform: rotate(90deg);
}

/* Traceroute Hops Detail */
.nht-traceroute-hops-detail {
    display: none;
    border-top: 1px solid var(--border-color);
    padding: 10px 14px;
    background: var(--bg-secondary);
}

.nht-traceroute-item.expanded .nht-traceroute-hops-detail {
    display: block;
}

.nht-hop-row {
    display: grid;
    grid-template-columns: 28px 1fr 160px 70px;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 11px;
    border-bottom: 1px dashed var(--border-color);
}

.nht-hop-row:last-child {
    border-bottom: none;
}

.nht-hop-ttl {
    color: var(--text-muted);
    font-weight: 600;
    text-align: center;
}

.nht-hop-ip {
    font-family: var(--mono-font);
    color: var(--text-primary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nht-hop-ip.timeout {
    color: var(--text-muted);
}

.nht-hop-as {
    font-size: 10px;
    color: var(--text-muted);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nht-hop-rtt {
    font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

/* Footer Section */
.nht-inspection-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
}

.nht-inspection-footer-left a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 6px;
    background: #3b82f6;
    color: #fff;
    font-weight: 600;
    font-size: 12px;
    text-decoration: none;
    transition: background 0.15s ease;
}

.nht-inspection-footer-left a:hover {
    background: #2563eb;
    text-decoration: none;
}

.nht-inspection-footer-right {
    font-family: var(--mono-font);
    font-size: 11px;
    opacity: 0.7;
}

/* ============================================================
   === Markdown Components (共用：create_topic / topic / profile / messages)
   ============================================================ */

/* ---- Toolbar ---- */
.md-toolbar {
    --md-accent: var(--accent);
    --md-icon-size: 16px;
    --md-icon-stroke: 2;
    --md-tooltip-bg: #111827;
    --md-tooltip-text: #f9fafb;

    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 12px 12px 0 0;
}

[data-theme="dark"] .md-toolbar {
    --md-tooltip-bg: #e2e8f0;
    --md-tooltip-text: #0f172a;
}

.md-toolbar .md-separator {
    width: 1px;
    height: 16px;
    background: var(--border-color);
    margin: 0 2px;
}

.md-toolbar .md-btn {
    --md-icon-scale: 1;
    --md-icon-y: 0px;

    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    line-height: 1;
    font-weight: 600;
    position: relative;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
    user-select: none;
}

.md-toolbar .md-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.md-toolbar .md-btn:active {
    transform: translateY(1px);
}

.md-toolbar .md-btn:focus-visible {
    outline: none;
    border-color: rgba(var(--accent-rgb), 0.45);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18);
}

.md-toolbar .md-btn svg {
    width: var(--md-icon-size);
    height: var(--md-icon-size);
    display: block;
    stroke: currentColor;
    stroke-width: var(--md-icon-stroke);
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    transform: translateY(var(--md-icon-y)) scale(var(--md-icon-scale));
    transform-origin: center;
}

.md-toolbar .md-btn svg * {
    vector-effect: non-scaling-stroke;
}

.md-toolbar .md-btn::after {
    content: attr(aria-label);
    position: absolute;
    left: 50%;
    top: calc(100% + 8px);
    transform: translateX(-50%) translateY(-4px);
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--md-tooltip-bg);
    color: var(--md-tooltip-text);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.16);
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 5;
}

.md-toolbar .md-btn::before {
    content: "";
    position: absolute;
    left: 50%;
    top: calc(100% + 3px);
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: var(--md-tooltip-bg);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.md-toolbar .md-btn:hover::after,
.md-toolbar .md-btn:hover::before,
.md-toolbar .md-btn:focus-visible::after,
.md-toolbar .md-btn:focus-visible::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.md-toolbar .md-btn.wide {
    width: auto;
    padding: 0 8px;
    gap: 4px;
}

.md-toolbar .md-btn.wide .md-btn-text {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1px;
}

.md-toolbar .md-btn.wide.active {
    background: rgba(var(--accent-rgb), 0.12);
    border-color: rgba(var(--accent-rgb), 0.22);
    color: var(--accent);
}

.md-toolbar .md-ai-dismiss-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    margin-left: -2px;
    flex-shrink: 0;
}

.md-toolbar .md-ai-dismiss-btn svg {
    width: 13px;
    height: 13px;
}

/* ── 共享胶囊开关(iOS 式滑块) ──
   原在 settings.css(通知偏好面板),上提到全站备用(目前使用方=settings 通知偏好面板;
   工具栏的 AI「自动」开关最终采用 .md-btn.wide.active 点亮式按钮,不用这套滑块)。
   全部走主题变量,明暗双主题自适配。结构:label.notif-switch > input + span.track > span.thumb,
   input 必须紧邻 track(靠相邻兄弟选择器切开态)。 */
.notif-switch {
    position: relative;
    display: inline-flex;
    width: 42px;
    height: 24px;
    flex: 0 0 auto;
    cursor: pointer;
}

.notif-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.notif-switch-track {
    width: 42px;
    height: 24px;
    border-radius: 999px;
    box-sizing: border-box;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.notif-switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg-secondary);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.22);
    transition: transform 0.15s ease;
}

.notif-switch input:checked + .notif-switch-track {
    /* 开启态走主按钮墨色(亮墨底白珠/暗白底墨珠),不用正蓝实底:
       通知偏好页一屏几十个开着的开关,亮蓝实底会压过全站墨色按钮语言(2026-08-27 拍板)。 */
    background: var(--btn-primary-bg);
    border-color: var(--btn-primary-bg);
}

.notif-switch input:checked + .notif-switch-track .notif-switch-thumb {
    transform: translateX(18px);
}

.notif-switch.is-disabled {
    cursor: default;
    opacity: 0.62;
}


@media (pointer: coarse) {
    .md-toolbar .md-btn.wide.active {
        min-height: 32px;
        min-width: 52px;
    }
    .md-toolbar .md-ai-dismiss-btn {
        width: 28px;
        height: 28px;
    }}

.md-toolbar.md-toolbar-compact-enabled {
    min-height: 34px;
    padding: 4px 6px;
    gap: 4px;
    border-radius: 10px;
}

.md-toolbar[data-md-has-leading-primary="1"] .md-toolbar-toggle-btn {
    margin-left: auto;
}

.md-toolbar.md-toolbar-compact-enabled .md-btn {
    width: 24px;
    height: 24px;
    border-radius: 5px;
}

.md-toolbar.md-toolbar-compact-enabled .md-btn.wide {
    width: auto;
    padding: 0 8px;
    gap: 4px;
}

.md-toolbar.md-toolbar-compact-enabled .md-btn.wide .md-btn-text {
    font-size: 11px;
    font-weight: 600;
}

.md-toolbar .md-toolbar-toggle-caret {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1;
    transition: none;
}

.md-toolbar.md-toolbar-compact-enabled.is-expanded .md-toolbar-toggle-caret {
    transform: rotate(180deg);
}

.md-toolbar.md-toolbar-compact-enabled .md-toolbar-toggle-btn.active {
    background: rgba(var(--accent-rgb), 0.12);
    border-color: rgba(var(--accent-rgb), 0.22);
    color: var(--text-primary);
}

.md-toolbar.md-toolbar-compact-enabled.is-expanded {
    border-radius: 10px 10px 0 0;
}

.md-toolbar-disclosure {
    display: none;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 10px 10px;
    background: var(--bg-secondary);
    padding: 6px;
}

.md-toolbar-disclosure.is-open {
    display: block;
}

.md-toolbar-disclosure-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.md-toolbar-disclosure .md-separator {
    width: 1px;
    height: 14px;
    background: var(--border-color);
    margin: 0 2px;
}

.md-toolbar-disclosure .md-btn {
    --md-icon-scale: 1;
    --md-icon-y: 0px;

    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-primary);
    border-radius: 5px;
    cursor: pointer;
    line-height: 1;
    font-weight: 600;
    position: relative;
    transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
    user-select: none;
}

.md-toolbar-disclosure .md-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.md-toolbar-disclosure .md-btn:focus-visible {
    outline: none;
    border-color: rgba(var(--accent-rgb), 0.45);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.14);
}

.md-toolbar-disclosure .md-btn svg {
    width: var(--md-icon-size);
    height: var(--md-icon-size);
    display: block;
    stroke: currentColor;
    stroke-width: var(--md-icon-stroke);
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    transform: translateY(var(--md-icon-y)) scale(var(--md-icon-scale));
    transform-origin: center;
}

.md-toolbar-disclosure .md-btn svg * {
    vector-effect: non-scaling-stroke;
}

.md-toolbar-disclosure .md-btn::after {
    content: attr(aria-label);
    position: absolute;
    left: 50%;
    top: calc(100% + 8px);
    transform: translateX(-50%);
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--md-tooltip-bg);
    color: var(--md-tooltip-text);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.16);
    transition: opacity 0.12s ease;
    z-index: 5;
}

.md-toolbar-disclosure .md-btn::before {
    content: "";
    position: absolute;
    left: 50%;
    top: calc(100% + 3px);
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: var(--md-tooltip-bg);
    opacity: 0;
    transition: opacity 0.12s ease;
}

.md-toolbar-disclosure .md-btn:hover::after,
.md-toolbar-disclosure .md-btn:hover::before,
.md-toolbar-disclosure .md-btn:focus-visible::after,
.md-toolbar-disclosure .md-btn:focus-visible::before {
    opacity: 1;
}

.md-toolbar-disclosure .md-btn.wide {
    width: auto;
    padding: 0 8px;
    gap: 4px;
}

.md-toolbar-disclosure .md-btn.wide .md-btn-text {
    font-size: 11px;
    font-weight: 600;
}

/* ---- Shared Markdown Composer Surfaces ---- */
.md-composer,
.dm-composer {
    position: relative;
}

.md-composer .preview-box,
.dm-composer .preview-box {
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 12px 12px;
    min-height: 0;
}

.md-composer .input-panel,
.dm-composer .input-panel {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin: 10px 0;
}

.md-composer .input-panel input,
.dm-composer .input-panel input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-primary);
}

.md-composer .input-panel button,
.dm-composer .input-panel button {
    padding: 8px 16px;
    border-radius: 6px;
}

.md-composer .emoji-picker,
.dm-composer .emoji-picker {
    right: 8px;
    top: auto; /* 静态位置=紧跟工具栏(面板 DOM 在工具栏之后),工具栏折行也不被压住 */
    margin-top: 8px;
    border-radius: 10px;
    box-shadow: 0 10px 26px var(--shadow-color);
}

.md-composer .emoji-picker .emoji-item,
.dm-composer .emoji-picker .emoji-item {
    border: none;
    background: transparent;
    font-size: 18px;
    line-height: 1;
    padding: 0;
    color: inherit;
}

/* ---- Shared Create Composer Shell ---- */
.create-editor-field {
    position: relative;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: hidden;
}

.create-editor-live {
    position: relative;
    min-height: 132px;
}

.create-editor-field .editor-textarea {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 132px;
    height: auto;
    margin: 0;
    padding: 14px 16px 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    letter-spacing: 0.01em;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    tab-size: 4;
    resize: vertical;
    overflow: auto;
    outline: none;
    color: var(--text-primary);
    caret-color: var(--text-primary);
}

.create-editor-field .editor-textarea::selection {
    background: rgba(var(--accent-rgb), 0.18);
}

.create-editor-placeholder {
    position: absolute;
    top: 14px;
    left: 16px;
    z-index: 2;
    max-width: calc(100% - 32px);
    padding: 0;
    pointer-events: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 400;
    letter-spacing: 0.01em;
    white-space: pre-wrap;
    color: color-mix(in srgb, var(--text-muted) 82%, transparent);
    opacity: 1;
}

.create-editor-field .ai-char-counter {
    padding: 2px 16px 12px;
    background: transparent;
}

/* AI 字符计数 base rule. Mirrors create-common.css so the topic-page
   reply form (which only loads style.css) renders identical to the
   create_*.html pages (which additionally load create-common.css). */
.ai-char-counter {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
    user-select: none;
}

.ai-char-counter.over {
    color: #ef4444;
}

.ai-char-counter.paused {
    color: #d97706;
}

[data-theme="dark"] .ai-char-counter.paused {
    color: #f59e0b;
}

.ai-char-counter .ai-char-counter-hint {
    font-weight: 600;
}

/* 附件条与字数计数同行（topic 回帖框；发帖页镜像 create-common.css）：
   附件按钮在左、计数在右；计数与 33px 高的附件按钮垂直居中；
   attach-list 展开时行顶对齐，计数不随列表下坠。 */
.composer-attach-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.composer-attach-row [data-attach-mount] {
    flex: 1 1 auto;
    min-width: 0;
}

.composer-attach-row .ai-char-counter {
    flex: 0 0 auto;
    margin-top: 10px; /* 对齐 .attach-uploader 的 margin-top:10px */
    min-height: 33px; /* 附件按钮行高 */
}

/* ── 附件上传控件(attach-uploader.js)──
   样式原为 JS 运行时注入,2026-08-31 移入本文件:发帖页 HTML 预置了静态骨架
   (.attach-uploader-bar 添加按钮+提示),首帧就要有样式,JS 挂载时原地换成同构
   DOM 零跳变。改类名/结构须与 attach-uploader.js 模板同步。 */
.attach-uploader { margin-top: 10px; }
.attach-uploader-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.attach-add-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border: 1px solid var(--border-color, #ddd); border-radius: 8px; background: var(--bg-secondary, #f7f7f7); color: var(--text-primary, #333); font-size: 13px; cursor: pointer; }
.attach-add-btn:hover { background: var(--neutral-pill-bg-hover, var(--bg-tertiary, #efefef)); }
.attach-add-btn:disabled { opacity: .55; cursor: default; }
.attach-hint { color: var(--text-secondary, var(--gray, #999)); font-size: 12px; }
.attach-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
/* 空列表不占位:否则空 div 的 margin-top 也顶出 8px,JS 挂载瞬间下方内容跳 8px */
.attach-list:empty { display: none; }
.attach-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--border-color, #eee); border-radius: 8px; background: var(--bg-secondary, #fafafa); font-size: 13px; }
.attach-row .attach-ico { flex-shrink: 0; }
.attach-row .attach-fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; color: var(--text-primary, #333); }
.attach-row .attach-fsize { flex-shrink: 0; color: var(--text-secondary, var(--gray, #999)); font-size: 12px; margin-left: auto; }
.attach-row .attach-remove { flex-shrink: 0; border: none; background: none; color: var(--text-secondary, #999); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; }
.attach-row .attach-remove:hover { color: var(--danger-color, #d33); }

.create-composer-shell {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: var(--bg-input);
    box-shadow: none;
    overflow: hidden;
}

.create-composer-shell > .md-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 3px;
    padding: 6px 12px;
    margin: 0;
    border: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 88%, transparent);
    border-radius: 0;
    background: #f4f6f9;
    min-height: 0;
}

[data-theme="dark"] .create-composer-shell > .md-toolbar {
    background: #2a2a2a;
}

.create-composer-shell > .md-toolbar .md-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
}

.create-composer-shell > .md-toolbar .md-btn.wide {
    width: auto;
    min-width: 36px;
    padding: 0 8px;
}

.create-composer-shell > .md-toolbar .md-separator {
    height: 16px;
    margin: 0 2px;
}

.create-composer-shell > .input-panel,
.create-composer-shell > .emoji-picker {
    margin-left: 14px;
    margin-right: 14px;
}

.create-composer-shell > .emoji-picker {
    top: auto; /* 取静态位置=紧跟工具栏之后;工具栏在手机上折成两行也不会被面板压住 */
    right: 14px;
    border-radius: 12px;
}

.create-composer-shell > .input-panel {
    margin-top: 10px;
    margin-bottom: 10px;
}

.create-composer-shell .preview-box {
    min-height: 114px;
    margin: 0;
    padding: 12px 16px 14px;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

/* ---- Merged Composer Shell (topic / messages / profile) ---- */
.merged-composer {
    --merged-composer-min-height: 200px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.flat-compose-card-head {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0 2px;
}

.flat-compose-card-kicker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(var(--accent-rgb), 0.12);
    color: #0f766e;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

[data-theme="dark"] .flat-compose-card-kicker {
    background: rgba(var(--accent-rgb), 0.14);
    color: #67e8f9;
}

.flat-compose-card-copy {
    min-width: 0;
    flex: 1 1 auto;
}

.flat-compose-card-title {
    font-size: 18px;
    line-height: 1.35;
    font-weight: 700;
    color: var(--text-primary);
}

.flat-compose-card-subtitle {
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-muted);
}

.merged-composer-editor {
    position: relative;
    margin: 0;
    border: 0;
    background: transparent;
    overflow: hidden;
}

.merged-composer-editor .editor-textarea,
.merged-composer-editor .signature-textarea {
    width: 100%;
    min-height: var(--merged-composer-min-height);
    height: var(--merged-composer-min-height);
    margin: 0;
    padding: 14px 16px 10px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    letter-spacing: 0.01em;
    resize: vertical;
    outline: none;
    color: var(--text-primary);
}

.merged-composer-editor .editor-textarea::selection,
.merged-composer-editor .signature-textarea::selection {
    background: rgba(var(--accent-rgb), 0.18);
}

.merged-composer-editor .CodeMirror {
    width: 100%;
    min-height: var(--merged-composer-min-height);
    height: var(--merged-composer-min-height);
    margin: 0;
    border: 0;
    border-radius: 0;
    box-sizing: border-box;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
}

.merged-composer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 16px;
    padding: 0 4px;
}

.merged-composer-footer-main {
    display: flex;
    align-items: center;
    gap: 10px 14px;
    flex: 1 1 240px;
    min-width: 0;
    flex-wrap: wrap;
}

.merged-composer-footer-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.merged-composer-meta-list {
    display: flex;
    align-items: center;
    gap: 8px 14px;
    flex-wrap: wrap;
}

.merged-composer-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-muted);
}

.merged-composer-meta-item::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: #94a3b8;
    flex-shrink: 0;
}

.merged-composer-submit {
    flex: 0 0 auto;
    min-width: 138px;
    padding: 0 16px;
}

.merged-composer-submit .ai-label {
    white-space: nowrap;
}

.merged-composer-counter {
    margin: 0;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
}

.merged-composer-counter {
    white-space: nowrap;
}

@media screen and (max-width: 768px) {
    .create-composer-shell > .md-toolbar {
        padding: 6px 10px;
    }

    .create-composer-shell > .input-panel,
    .create-composer-shell > .emoji-picker {
        margin-left: 10px;
        margin-right: 10px;
    }

    .create-composer-shell > .emoji-picker {
        right: 10px;
    }

    .create-editor-mirror-content,
    .create-editor-field .editor-textarea {
        padding: 12px 14px 10px;
    }

    .create-composer-shell .preview-box {
        padding: 12px 14px 14px;
    }

    .flat-compose-card-head {
        flex-direction: column;
        gap: 8px;
    }

    .merged-composer-editor .editor-textarea,
    .merged-composer-editor .signature-textarea {
        padding: 12px 14px 10px;
    }

    .merged-composer-footer {
        padding: 0;
    }

    .merged-composer-footer-actions {
        width: 100%;
        margin-left: 0;
    }

    .merged-composer-footer-actions > * {
        width: 100%;
    }}

/* ---- Emoji Picker ---- */
.emoji-picker {
    display: none;
    position: absolute;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 4px 20px var(--shadow-color);
    z-index: 100;
}

.emoji-picker.show {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* 窄屏下私信编辑器比发帖壳窄,8 个 32px 格排不下一行(会 7+1 落单),改 4×2 网格。 */
@media (max-width: 480px) {
    .dm-composer .emoji-picker.show {
        display: grid;
        grid-template-columns: repeat(4, 32px);
        width: max-content;
    }}

.emoji-picker .emoji-item {
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.15s ease;
}

/* 悬停不能用 --bg-tertiary:亮色主题它和面板底同为 #fff,划过去零反馈。 */
.emoji-picker .emoji-item:hover,
.emoji-picker .emoji-item:focus-visible {
    background: rgba(var(--accent-rgb), 0.10);
}

.emoji-picker .emoji-item img {
    width: 28px;
    height: 28px;
    display: block;
    transition: transform 0.12s ease;
}

.emoji-picker .emoji-item:hover img,
.emoji-picker .emoji-item:focus-visible img {
    transform: scale(1.2);
}

/* ---- 用户正文文字颜色(发帖/回复 预设调色板) ----
   用户内容里只允许 .ucolor-* class(净化白名单已放行 class),拿不到
   任意 hex / inline style;每个色随主题取 :root 或 [data-theme="dark"]
   的变量,亮/暗背景下都达标。color 直接命中 span,优先级高于正文容器
   继承下来的 --text-primary,无需 !important。 */
.ucolor-red    { color: var(--ucolor-red); }
.ucolor-orange { color: var(--ucolor-orange); }
.ucolor-green  { color: var(--ucolor-green); }
.ucolor-teal   { color: var(--ucolor-teal); }
.ucolor-blue   { color: var(--ucolor-blue); }
.ucolor-purple { color: var(--ucolor-purple); }
.ucolor-pink   { color: var(--ucolor-pink); }
.ucolor-gray   { color: var(--ucolor-gray); }

/* 颜色选择器浮层:复用 .emoji-picker 的定位与显隐(.show),只补色块样式。 */
.color-picker { max-width: 152px; }
.color-picker .color-swatch {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid var(--border-color);
    box-sizing: border-box;
    transition: transform 0.12s ease;
}
.color-picker .color-swatch:hover { transform: scale(1.12); }
.color-picker .color-swatch[data-color="red"]    { background: var(--ucolor-red); }
.color-picker .color-swatch[data-color="orange"] { background: var(--ucolor-orange); }
.color-picker .color-swatch[data-color="green"]  { background: var(--ucolor-green); }
.color-picker .color-swatch[data-color="teal"]   { background: var(--ucolor-teal); }
.color-picker .color-swatch[data-color="blue"]   { background: var(--ucolor-blue); }
.color-picker .color-swatch[data-color="purple"] { background: var(--ucolor-purple); }
.color-picker .color-swatch[data-color="pink"]   { background: var(--ucolor-pink); }
.color-picker .color-swatch[data-color="gray"]   { background: var(--ucolor-gray); }

/* ---- Markdown Render Area (preview-box / topic_content / reply_content) ---- */
.preview-box,
.topic_content,
.reply_content {
    --md-accent: var(--accent);
    /* Light mode (--md-code-bg / --md-code-header-bg 已提到 :root 全站统一) */
    --md-code-border: rgba(15, 23, 42, 0.14);
    --md-code-divider: rgba(15, 23, 42, 0.08);
    --md-code-text: #0f172a;
    --md-code-muted: rgba(15, 23, 42, 0.55);
    --md-code-btn-bg: rgba(15, 23, 42, 0.04);
    --md-code-btn-bg-hover: rgba(15, 23, 42, 0.07);
    --md-code-btn-border: rgba(15, 23, 42, 0.14);
    --md-code-btn-text: #0f172a;

    color: var(--text-primary);
    /* 2026-08-26 拍板:阅读面放松——字号 14→15px、行高 1.5→1.7(对标 sb.sb 的 15px/1.75,
       中文正文 1.5 偏紧)。界面其余部分(列表/按钮/meta)保持 14px 不动。
       此块同时覆盖发帖预览(.preview-box)与私信正文(.dm-post-body>.preview-box),
       凡 markdown 渲染出的正文排版一致。代码块/标题字号全是绝对 px,不随之放大。 */
    font-size: 15px;
    line-height: 1.7;
}

[data-theme="dark"] .preview-box,
[data-theme="dark"] .topic_content,
[data-theme="dark"] .reply_content {
    /* Dark mode (--md-code-bg / --md-code-header-bg 已提到 [data-theme="dark"] 根) */
    --md-code-border: rgba(255, 255, 255, 0.10);
    --md-code-divider: rgba(255, 255, 255, 0.07);
    --md-code-text: #d4d4d4;
    --md-code-muted: rgba(212, 212, 212, 0.72);
    --md-code-btn-bg: rgba(255, 255, 255, 0.06);
    --md-code-btn-bg-hover: rgba(255, 255, 255, 0.10);
    --md-code-btn-border: rgba(255, 255, 255, 0.14);
    --md-code-btn-text: #d4d4d4;
}

/* 正文链接:让 [text](url) 明显区别于正文,参考 x.com / Discourse 的链接蓝。
   默认上色 + 下划线,悬停加深颜色。亮/暗两套链接色与品牌同系靛蓝,均沿用站内
   已验证过 WCAG AA(亮 #2a5fd0 / 暗 #8aacff,与 --ucolor-blue 同值)。
   作用范围含 .preview-box,故私信(.dm-post-body>.preview-box)、系统消息与发帖预览同步生效。
   邮件正文(.mail-detail-body)只在此声明变量,链接规则在 messages.html(邮件样式集中处)引用。
   @提及(.mention,胶囊样式)与回复引用(.reply-to-ref,自带配色)不染蓝,显式排除。
   交易卡字段值(.trade-listing-value,在正文容器之外)里自动识别出的域名/网址链接同此样式。 */
.preview-box,
.topic_content,
.reply_content,
.trade-listing-value,
.mail-detail-body {
    --md-link: var(--text-primary);
    --md-link-hover: var(--link-hover);
}
[data-theme="dark"] .preview-box,
[data-theme="dark"] .topic_content,
[data-theme="dark"] .reply_content,
[data-theme="dark"] .trade-listing-value,
[data-theme="dark"] .mail-detail-body {
    --md-link: var(--text-primary);
    --md-link-hover: var(--link-hover);
}
.preview-box a:not(.mention):not(.reply-to-ref),
.topic_content a:not(.mention):not(.reply-to-ref),
.reply_content a:not(.mention):not(.reply-to-ref),
.trade-listing-value a {
    color: var(--md-link);
    text-decoration: underline;
    text-decoration-color: var(--link-underline);
    text-underline-offset: 3px;
}
.preview-box a:not(.mention):not(.reply-to-ref):hover,
.topic_content a:not(.mention):not(.reply-to-ref):hover,
.reply_content a:not(.mention):not(.reply-to-ref):hover,
.trade-listing-value a:hover {
    color: var(--md-link-hover);
    text-decoration: underline;
}

.preview-box>*:first-child,
.topic_content>*:first-child,
.reply_content>*:first-child {
    margin-top: 0;
}

.preview-box>*:last-child,
.topic_content>*:last-child,
.reply_content>*:last-child {
    margin-bottom: 0;
}

.preview-box p,
.topic_content p,
.reply_content p {
    /* 段间距随行高放松同步 12→16px(2026-08-26) */
    margin: 0 0 16px;
}

.preview-box h1,
.preview-box h2,
.preview-box h3,
.topic_content h1,
.topic_content h2,
.topic_content h3,
.reply_content h1,
.reply_content h2,
.reply_content h3 {
    margin: 18px 0 10px;
    line-height: 1.25;
    color: var(--text-primary);
}

.preview-box h1,
.topic_content h1,
.reply_content h1 {
    font-size: 20px;
}

.preview-box h2,
.topic_content h2,
.reply_content h2 {
    font-size: 18px;
}

.preview-box h3,
.topic_content h3,
.reply_content h3 {
    font-size: 16px;
}

.preview-box ul,
.preview-box ol,
.topic_content ul,
.topic_content ol,
.reply_content ul,
.reply_content ol {
    margin: 8px 0 12px;
    padding-left: 1.25em;
}

.preview-box li,
.topic_content li,
.reply_content li {
    margin: 4px 0;
}

/* Blockquote */
.preview-box blockquote,
.topic_content blockquote,
.reply_content blockquote {
    margin: 16px 0;
    padding: 12px 16px;
    border-left: 3px solid rgba(59, 130, 246, 0.55);
    background: var(--md-code-bg);
    border-radius: 0 12px 12px 0;
    color: var(--md-code-text);
}

[data-theme="dark"] .preview-box blockquote,
[data-theme="dark"] .topic_content blockquote,
[data-theme="dark"] .reply_content blockquote {
    border-left-color: rgba(96, 165, 250, 0.55);
}

.preview-box blockquote blockquote,
.topic_content blockquote blockquote,
.reply_content blockquote blockquote {
    margin: 12px 0 0;
    padding: 8px 12px;
    background: var(--md-code-header-bg);
    border-left: 2px solid rgba(59, 130, 246, 0.45);
    border-radius: 0 10px 10px 0;
}

[data-theme="dark"] .preview-box blockquote blockquote,
[data-theme="dark"] .topic_content blockquote blockquote,
[data-theme="dark"] .reply_content blockquote blockquote {
    border-left-color: rgba(96, 165, 250, 0.45);
}

.preview-box blockquote>*:first-child,
.topic_content blockquote>*:first-child,
.reply_content blockquote>*:first-child {
    margin-top: 0;
}

.preview-box blockquote>*:last-child,
.topic_content blockquote>*:last-child,
.reply_content blockquote>*:last-child {
    margin-bottom: 0;
}

/* Inline code — Discourse 风格：纯底色块、微圆角、无边框 */
.preview-box :not(pre)>code,
.topic_content :not(pre)>code,
.reply_content :not(pre)>code {
    background: rgba(135, 150, 165, 0.15);
    border: none;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: var(--mono-font);
    font-size: var(--mono-fz-inline);
    color: var(--md-code-text, var(--text-primary));
}

[data-theme="dark"] .preview-box :not(pre)>code,
[data-theme="dark"] .topic_content :not(pre)>code,
[data-theme="dark"] .reply_content :not(pre)>code {
    background: rgba(148, 163, 184, 0.15);
}

/* Code Block (ChatGPT Style) — 全局可复用的统一 code 卡片组件 */
.md-codeblock,
.preview-box .md-codeblock,
.topic_content .md-codeblock,
.reply_content .md-codeblock {
    margin: 16px 0;
    border: none;
    border-radius: 12px;
    overflow: hidden;
    background: var(--md-code-bg);
}

[data-theme="dark"] .md-codeblock,
[data-theme="dark"] .preview-box .md-codeblock,
[data-theme="dark"] .topic_content .md-codeblock,
[data-theme="dark"] .reply_content .md-codeblock {
    background: #1e1e1e;
}

.md-codeblock-header,
.preview-box .md-codeblock-header,
.topic_content .md-codeblock-header,
.reply_content .md-codeblock-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--md-code-header-bg);
    border-bottom: 1px solid var(--md-code-divider, rgba(31, 35, 40, 0.08));
    color: var(--md-code-muted, #5d5d5d);
    font-size: 12px;
    letter-spacing: 0.2px;
}

[data-theme="dark"] .md-codeblock-header,
[data-theme="dark"] .preview-box .md-codeblock-header,
[data-theme="dark"] .topic_content .md-codeblock-header,
[data-theme="dark"] .reply_content .md-codeblock-header {
    color: #a0a0a0;
}

.md-codeblock-lang,
.preview-box .md-codeblock-lang,
.topic_content .md-codeblock-lang,
.reply_content .md-codeblock-lang {
    font-variant-numeric: tabular-nums;
    text-transform: lowercase;
    letter-spacing: 0.2px;
}

.md-codeblock-actions,
.preview-box .md-codeblock-actions,
.topic_content .md-codeblock-actions,
.reply_content .md-codeblock-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Copy button */
.md-copy-btn,
.preview-box .md-copy-btn,
.topic_content .md-copy-btn,
.reply_content .md-copy-btn {
    border: none;
    background: transparent;
    color: #5d5d5d;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 6px;
    transition: color 0.15s ease, background 0.15s ease;
}

[data-theme="dark"] .md-copy-btn,
[data-theme="dark"] .preview-box .md-copy-btn,
[data-theme="dark"] .topic_content .md-copy-btn,
[data-theme="dark"] .reply_content .md-copy-btn {
    color: #a0a0a0;
}

.md-copy-btn:hover,
.preview-box .md-copy-btn:hover,
.topic_content .md-copy-btn:hover,
.reply_content .md-copy-btn:hover {
    color: #0d0d0d;
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .md-copy-btn:hover,
[data-theme="dark"] .preview-box .md-copy-btn:hover,
[data-theme="dark"] .topic_content .md-copy-btn:hover,
[data-theme="dark"] .reply_content .md-copy-btn:hover {
    color: #e0e0e0;
    background: rgba(255, 255, 255, 0.08);
}

.md-copy-btn:active,
.preview-box .md-copy-btn:active,
.topic_content .md-copy-btn:active,
.reply_content .md-copy-btn:active {
    transform: scale(0.95);
}

.md-copy-btn svg,
.preview-box .md-copy-btn svg,
.topic_content .md-copy-btn svg,
.reply_content .md-copy-btn svg {
    width: 16px;
    height: 16px;
    display: block;
}

.md-codeblock pre,
.preview-box .md-codeblock pre,
.topic_content .md-codeblock pre,
.reply_content .md-codeblock pre {
    margin: 0;
    padding: 0 16px 16px;
    background: transparent;
    overflow-x: auto;
}

.md-codeblock pre code,
.preview-box .md-codeblock pre code,
.topic_content .md-codeblock pre code,
.reply_content .md-codeblock pre code {
    display: block;
    padding: 0;
    background: transparent;
    color: #0d0d0d;
    font-family: var(--mono-font);
    font-size: var(--mono-fz-block);
    line-height: var(--mono-lh);
    /* 与全站 mono 一致：长行强制换行，避免手机被横向裁剪 */
    white-space: pre-wrap;
    word-break: break-all;
    overflow-wrap: anywhere;
}

[data-theme="dark"] .md-codeblock pre code,
[data-theme="dark"] .preview-box .md-codeblock pre code,
[data-theme="dark"] .topic_content .md-codeblock pre code,
[data-theme="dark"] .reply_content .md-codeblock pre code {
    color: #d4d4d4;
}

/* Table */
.preview-box table,
.topic_content table,
.reply_content table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
}

.preview-box th,
.preview-box td,
.topic_content th,
.topic_content td,
.reply_content th,
.reply_content td {
    border: 1px solid var(--border-color);
    padding: 10px;
    text-align: left;
}

.preview-box th,
.topic_content th,
.reply_content th {
    background: var(--bg-tertiary);
}

/* Image */
.preview-box img,
.topic_content img,
.reply_content img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

/* ─── Shared Confirm Modal ─── */
.confirm-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.44);
    z-index: 9999;
    backdrop-filter: blur(2px);
    animation: confirmFadeIn 0.16s ease-out;
}

[data-theme="dark"] .confirm-modal-overlay {
    background: rgba(0, 0, 0, 0.62);
}

.confirm-modal-overlay.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-modal-box {
    box-sizing: border-box;
    background: var(--bg-secondary);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 20px 22px;
    max-width: 400px;
    width: calc(100% - 32px);
    box-shadow: 0 16px 36px rgba(15, 28, 51, 0.16), 0 2px 6px rgba(15, 28, 51, 0.08);
    animation: confirmSlideUp 0.16s ease-out;
}

[data-theme="dark"] .confirm-modal-box {
    background: var(--bg-tertiary);
    border-color: #364156;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.50), 0 2px 6px rgba(0, 0, 0, 0.32);
}

.confirm-modal-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.confirm-modal-message {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.55;
}

.confirm-prompt-desc {
    margin-bottom: 10px;
}

.confirm-prompt-label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.confirm-prompt-input {
    width: 100%;
    padding: 8px 10px;
    box-sizing: border-box;
    border: 1px solid var(--card-border);
    border-radius: 7px;
    background: var(--bg-input, var(--bg-secondary));
    color: var(--text-primary);
    font: inherit;
    font-size: 14px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.confirm-prompt-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.14);
}

.confirm-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.confirm-modal-btn {
    padding: 7px 15px;
    border-radius: 7px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.confirm-modal-btn-cancel {
    background: var(--bg-secondary);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
}

.confirm-modal-btn-cancel:hover {
    background: var(--primary-soft-bg);
    color: var(--text-primary);
}

[data-theme="dark"] .confirm-modal-btn-cancel {
    background: rgba(255, 255, 255, 0.04);
    border-color: #364156;
    color: var(--text-secondary);
}

[data-theme="dark"] .confirm-modal-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.09);
    color: var(--text-primary);
}

.confirm-modal-btn-confirm {
    background: var(--btn-primary-bg);
    border: 1px solid transparent;
    color: var(--btn-primary-text);
}

.confirm-modal-btn-confirm:hover {
    background: var(--btn-primary-bg-hover);
}

.confirm-modal-btn-confirm.danger {
    background: var(--ucolor-red);
    border-color: transparent;
    color: #fff;
}

.confirm-modal-btn-confirm.danger:hover {
    background: #b52f24;
}

[data-theme="dark"] .confirm-modal-btn-confirm.danger {
    background: #dc2626;
    color: #fff;
}

[data-theme="dark"] .confirm-modal-btn-confirm.danger:hover {
    background: #ef4444;
}

@keyframes confirmFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes confirmSlideUp {
    from { transform: translateY(6px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .confirm-modal-overlay,
    .confirm-modal-box,
    .confirm-modal-btn {
        animation: none;
        transition: none;
    }
}

/* ============================================
   User Popup Card (浮动用户信息卡片)
   ============================================ */
.user-popup-card {
    position: absolute;
    z-index: 1100;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px) scale(0.97);
    transition: opacity 0.18s ease, transform 0.18s ease;
    will-change: opacity, transform;
}

.user-popup-card.is-visible {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.user-popup-card-inner {
    width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

[data-theme="dark"] .user-popup-card-inner {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
}

.user-popup-card-body {
    display: flex;
    flex-direction: column;
}

/* Header: avatar + username (reusing floor-header-row) */
.user-popup-card-header {
    padding: 14px 14px 10px;
    gap: 6px 10px;
}

.user-popup-card-header .floor-avatar {
    cursor: pointer;
}

.user-popup-card-header .floor-user-line a {
    font-size: 14px;
    font-weight: 600;
}

/* Stats section */
.user-popup-card-stats {
    padding: 0 14px;
}

.user-popup-card-stats .user-card-stats-cell {
    padding: 0 !important;
    border-bottom: none;
}

.user-popup-card-stats .user-card-stats-panel {
    gap: 8px 12px;
    padding: 10px 12px;
    border-radius: 10px;
}

.user-popup-card-stats .user-card-stat-icon svg {
    width: 16px;
    height: 16px;
}

.user-popup-card-stats .user-card-stat-label,
.user-popup-card-stats .user-card-stat-value {
    font-size: 12px;
}

/* Loading skeleton */
.user-popup-card-loading {
    min-height: 72px;
}

.user-popup-card-stats-skeleton {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
    padding: 12px 14px;
    background: var(--user-card-stats-bg);
    border: 1px solid var(--user-card-stats-border);
    border-radius: 10px;
}

.skeleton-line {
    display: block;
    height: 14px;
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--border-color) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

/* SSR 待确认骨架:nht_session=1 但 access 无效时 header 手机菜单 / 侧栏用户卡的中性态,
   JS bootstrap 后由 components.js::reconcileAuthShell 整块替换成登录版或访客版。 */
.user-card-pending-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
}

.user-card-pending-avatar {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.user-card-pending-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-card-pending-lines .skeleton-line:first-child { width: 42%; }
.user-card-pending-lines .skeleton-line:last-child { width: 64%; }

.mobile-menu-auth-pending {
    display: block;
    height: 0;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.user-popup-card-error {
    padding: 12px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

/* Action buttons */
.user-popup-card-actions {
    display: flex;
    gap: 8px;
    padding: 12px 14px;
}

/* 全站「用户身份操作按钮」基础类（关注 / 私信 / 查看主页）。
   同时被「帖子页头像 popup 卡」和「他人资料页头部」复用，保持视觉一致
   （DEVELOPMENT_CONVENTIONS.md §3.2 跨页面同功能同结构）。
   设计：次级操作 — 比头像视觉更安静，浅底 + 中性边框，紧凑高度。
   popup 容器内单独 flex:1 撑满列宽。
   注：类名特意避开 .user-action-btn（已被发帖 / 回复主提交按钮占用）。 */
.user-pill-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    min-width: 56px;
    height: 24px;
    box-sizing: border-box;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
    white-space: nowrap;
    flex: 0 0 auto;
}

.user-pill-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-muted);
    color: var(--text-primary);
    text-decoration: none;
}

.user-pill-btn:disabled,
.user-pill-btn.is-loading {
    opacity: 0.55;
    cursor: not-allowed;
}

/* 已关注：视觉再降一档（透明底 + muted 文字），暗示"操作完成、可取消" */
.user-pill-btn.is-following {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border-color);
}

.user-pill-btn.is-following:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-color: var(--text-muted);
}

/* popup 卡片宽 270px 内：按钮 flex:1 撑满列宽，min-width 失效 */
.user-popup-card-actions .user-pill-btn {
    flex: 1;
    min-width: 0;
}

/* Floor avatar click cursor hint */
.floor-avatar[data-popup-card-trigger] {
    cursor: pointer;
}

/* Mobile: wider card covering more screen */
@media screen and (max-width: 768px) {
    .user-popup-card-inner {
        width: 260px;
    }}

@media (prefers-reduced-motion: reduce) {
    .user-popup-card {
        transition: none;
    }
    .skeleton-line {
        animation: none;
    }}

/* AI 译文展示 docs/TRANSLATION.md §3.7 */
.translation-meta { margin-top: 10px; font-size: 12px; color: var(--text-muted, #94a3b8); display: flex; align-items: center; gap: 4px; }
.translation-label { display: inline-flex; align-items: center; color: var(--text-muted, #94a3b8); }
.translation-label svg { width: 14px; height: 14px; }
.show-original-link { color: var(--text-muted, #94a3b8); cursor: pointer; text-decoration: underline; }
.show-original-link:hover { color: var(--text-primary, #1e293b); }

/* 列表标题旁的 AI 译文标识：中性小图标，可点击就地切换标题 译文↔原文。 */
.title-translated-badge { display: inline-flex; align-items: center; vertical-align: middle; margin-left: 5px; color: var(--text-muted, #94a3b8); cursor: pointer; }
.title-translated-badge svg { width: 13px; height: 13px; }
.title-translated-badge:hover { color: var(--text-secondary, #64748b); }
.title-translated-badge[data-showing="original"] { color: var(--text-secondary, #64748b); }
.title-translated-badge:focus-visible { outline: 2px solid var(--text-secondary, #64748b); outline-offset: 2px; border-radius: 3px; }

/* 标签/板块上下文头的「订阅」按钮(系统消息阶段6 订阅模型)。 */
.ctx-subscribe-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 16px;
    background: none;
    color: var(--text-secondary, #666);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.ctx-subscribe-btn svg { width: 15px; height: 15px; }
.ctx-subscribe-btn:hover { border-color: #3b82f6; color: #3b82f6; }
.ctx-subscribe-btn.subscribed {
    border-color: #3b82f6;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

/* ── 搜索页过滤面板（板块 / 标签 / 作者）──
   原生 select + input，观感对齐发帖页 .normal-meta-select（高 38 / 圆角 10 /
   --bg-input / --border-color），样式自带、不依赖发帖页专用 create-common.css。 */
.search-filter {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.search-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    align-items: end;
}

.search-filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.search-filter-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.search-filter-control {
    width: 100%;
    height: 38px;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13px;
    box-sizing: border-box;
}

select.search-filter-control {
    cursor: pointer;
}

.search-filter-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.18);
}

.search-filter-actions {
    flex-direction: row;
    gap: 8px;
    align-items: center;
}

.search-filter-btn {
    height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--btn-primary-bg);
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: filter 0.15s ease, background 0.15s ease;
}

.search-filter-btn:hover {
    filter: brightness(1.06);
}

.search-filter-btn--ghost {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.search-filter-btn--ghost:hover {
    filter: none;
    border-color: var(--text-muted);
    color: var(--text-primary);
}

@media (max-width: 600px) {
    .search-filter-actions {
        grid-column: 1 / -1;
    }

    .search-filter-btn {
        flex: 1;
    }}

/* ── Header 搜索框自动补全下拉（@用户 / #板块·标签 / 操作符提示 / 最近搜索）── */
/* 抬升整个头部，让补全下拉盖过页面筛选栏(.nav-filters 等静态内容)。
   绑定到下拉的实际显隐(JS 切 .search-suggest-open)，而非 :focus-within——后者在失焦瞬间
   即撤销，但下拉还要延时 120ms 才真正隐藏，空档里 nav 按钮会短暂盖住正在关闭的下拉(闪烁)。
   取 20：高于静态内容(z0)即可，且低于吸顶浮窗 .new-topics-float(z30)，避免反向遮挡它。 */
#Top.search-suggest-open {
    position: relative;
    z-index: 20;
}

.search-suggest {
    position: absolute;
    top: calc(100% + 6px);
    /* 左右缘都锚定到搜索框（.header-search）：宽度跟随搜索框，左右缘对齐。 */
    left: 0;
    right: 0;
    max-width: calc(100vw - 24px); /* 窄屏防溢出兜底 */
    background: var(--bg-secondary);
    /* 浮层外框必须用 --card-border:--border-color 比画布还浅,白底上看不见 */
    border: 1px solid var(--card-border);
    border-radius: 10px;
    box-shadow: 0 10px 26px var(--shadow-color);
    padding: 6px;
    z-index: 50;
    max-height: min(360px, 55vh);
    overflow-x: hidden; /* 禁横向滚动条(就是那条可左右拖的"横线") */
    overflow-y: auto;
    text-align: left;
}

.search-suggest[hidden] {
    display: none;
}

.search-suggest-section {
    font-size: 11px;
    color: var(--text-muted);
    padding: 6px 8px 4px 0; /* 左 0：与 item / 最近搜索胶囊左缘对齐 */
}

/* 「最近搜索」标题行：标题左、清空按钮右。 */
.search-suggest-section--recent {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.search-suggest-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
}

.search-suggest-clear:hover {
    color: var(--text-primary);
    background: var(--neutral-pill-bg);
}

.search-suggest-item {
    box-sizing: border-box; /* width:100% 含 padding，否则溢出被 overflow-x 裁切、hover 重排时整行左跳 */
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 8px 7px 0; /* 左 0：内容左缘贴面板内边距，与 section / 最近搜索胶囊同一竖线 */
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    text-align: left;
}

/* 鼠标移动 / 键盘选中均不使用背景高亮，保持与论坛其余列表一致的纯文本风格。 */

/* @ / # 快捷写法提示：并排成一行 + 小字（紧凑、无标题行，对齐 Discourse 简洁风）。
   padding 上下对称收紧到 5px，与下方最近搜索/胶囊行节奏一致，消除「这行偏松、上下留白大」。 */
.search-suggest-item--tip {
    display: inline-flex;
    width: auto;
    margin-right: 6px;
    vertical-align: top;
    gap: 6px;
    font-size: 12px;
    padding: 5px 8px 5px 0;
    line-height: 1.4;
}

/* 最近搜索：流式胶囊，一行多个、自动换行(紧跟"最近搜索"标题行后内联排布)。 */
.search-suggest-item--chip {
    display: inline-flex;
    width: auto;
    padding: 5px 10px;
    margin: 0 6px 6px 0;
    gap: 5px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    border-radius: 999px;
    font-size: 12px;
    vertical-align: top;
}

.search-suggest-item--chip .search-suggest-name {
    max-width: 150px;
}

.search-suggest-item--chip .search-suggest-icon svg {
    width: 12px;
    height: 12px;
}

[data-theme="dark"] .search-suggest-item--chip {
    background: #2f2f2f;
    border-color: #444;
}

/* @ / # 前缀符号：中性小方 pill（中性灰底，非青色高饱和，§3.4 低噪）。 */
.search-suggest-chip {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 3px;
    background: var(--neutral-pill-bg);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
}

.search-suggest-cat {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    background: var(--text-muted);
    opacity: 0.65;
}

.search-suggest-icon {
    flex-shrink: 0;
    display: inline-flex;
    color: var(--text-muted);
}

.search-suggest-name {
    flex: 1 1 auto;
    min-width: 0; /* flex 子项需此项才能收缩并触发 ellipsis，否则长名撑宽行→横向溢出 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-suggest-desc {
    color: var(--text-secondary);
}

.search-suggest-type {
    margin-left: auto;
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 11px;
}

.search-suggest-item .topic-avatar {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

[data-theme="dark"] .search-suggest {
    background: #2a2a2a;
    border-color: var(--card-border);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

/* 正文编辑器 @用户 补全浮层(web/js/mention-autocomplete.js):
   完整复用 .search-suggest 视觉,仅改定位——挂 body、fixed 跟随光标(JS 写 left/top),
   宽度固定不再锚定搜索框壳。 */
.search-suggest.mention-suggest {
    position: fixed;
    top: auto;
    left: auto;
    right: auto;
    width: 240px;
    z-index: 1200; /* 高于工具栏浮层(≤1000)与用户悬浮卡(1100),低于确认弹窗/Toast(9999+) */
}

/* 精简后的侧栏工单/建议直达双按钮与用户操作行分隔符 */
.sidebar-create-actions {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.sidebar-create-actions .sidebar-create-topic-btn {
    flex: 1.35;
    width: auto;
    min-height: 34px;
    padding: 0 12px;
    text-align: center;
}

.sidebar-create-actions .sidebar-feedback-btn {
    flex: 0.85;
    min-height: 34px;
    padding: 0 10px;
    white-space: nowrap;
}

.user-meta-sep {
    color: var(--text-muted);
    font-size: 12px;
    margin: 0 2px;
    user-select: none;
}


/* ============================================================
   Scheme B: 板块分组看板 & 工单台账行 (Portal & Ticket Ledger)
   ============================================================ */
#TopicsBox.portal-mode {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

#TopicsBox.portal-mode #nav-placeholder {
    display: none;
}

.portal-boards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.portal-board-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: stretch;
}

.portal-board {
    display: flex;
    flex-direction: column;
    margin: 0;
    overflow: hidden;
}

.portal-board--announce {
    border-left: 3px solid var(--text-primary);
}

.portal-board-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border-color);
}

.portal-board-title-group {
    min-width: 0;
    flex: 1 1 auto;
}

.portal-board-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.portal-board-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    line-height: 1.3;
}

.portal-board-title:hover {
    color: var(--accent);
    text-decoration: none;
}

.portal-board-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    font-family: var(--mono-font);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1;
}

.portal-board-desc {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
}

.portal-board-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.portal-head-link {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
}

.portal-head-link:hover {
    color: var(--accent);
    text-decoration: none;
}

.portal-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    padding: 0 11px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    box-sizing: border-box;
    transition: background-color 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
}

.portal-cta--primary {
    background: var(--accent-fill);
    color: #ffffff;
    border: 1px solid transparent;
}

.portal-cta--primary:hover {
    opacity: 0.9;
    color: #ffffff;
    text-decoration: none;
}

.portal-cta--ghost {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

.portal-cta--ghost:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
    text-decoration: none;
}

.portal-board-list {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}

.portal-empty {
    padding: 20px 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.portal-ticket-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    text-decoration: none;
    min-width: 0;
    transition: background-color 0.14s ease;
}

.portal-ticket-row:last-child {
    border-bottom: none;
}

.portal-ticket-row:hover {
    background-color: var(--bg-tertiary);
    text-decoration: none;
}

.portal-ticket-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13.5px;
    line-height: 1.4;
    color: var(--text-primary);
}

.portal-ticket-row.is-unread .portal-ticket-title,
.topic-list-item.is-unread .item_title a {
    font-weight: 600;
}

.portal-ticket-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: 4px;
    font-size: 11.5px;
    color: var(--text-muted);
    white-space: nowrap;
}

.portal-ticket-replies {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-family: var(--mono-font);
    font-size: 11.5px;
    color: var(--text-secondary);
}

.portal-ticket-replies svg {
    width: 12px;
    height: 12px;
    display: block;
    opacity: 0.8;
}

.portal-ticket-replies.has-new {
    color: var(--accent);
    font-weight: 600;
}

.portal-board-foot {
    padding: 9px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.portal-foot-link {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
}

.portal-foot-link:hover {
    color: var(--accent);
    text-decoration: none;
}

/* 工单状态徽章 & #ID 列 (首页看板与板块内页共用) */
.ticket-lead {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    flex: 0 0 54px;
    padding-top: 1px;
}

.ticket-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    height: 19px;
    padding: 0 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    border: 1px solid transparent;
    box-sizing: border-box;
}

.ticket-badge--resolved {
    background: var(--tagstyle-green-bg);
    color: var(--tagstyle-green-fg);
}

.ticket-badge--private {
    background: var(--pill-access-bg);
    color: var(--pill-access-text);
    border-color: var(--pill-access-border);
}

.ticket-badge--closed {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-color: var(--border-color);
}

.ticket-badge--open {
    background: var(--tagstyle-blue-bg);
    color: var(--tagstyle-blue-fg);
}

.ticket-badge--announce {
    background: var(--tagstyle-orange-bg);
    color: var(--tagstyle-orange-fg);
}

.ticket-badge--guide {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.ticket-badge--discuss {
    background: var(--tagstyle-blue-bg);
    color: var(--tagstyle-blue-fg);
}

.topic-breadcrumb .ticket-badge {
    margin-right: 6px;
    vertical-align: 1px;
}

.portal-empty--ticket {
    text-align: left;
    padding: 14px 16px;
    color: var(--text-secondary);
}

.ticket-id {
    flex-shrink: 0;
    font-family: var(--mono-font);
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.25;
    color: var(--text-muted);
}

@media screen and (max-width: 820px) {
    .portal-board-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}
