/* ============================================================
 * TForum PHP 版 · 全站样式
 *
 * 【改 UI 从这里入手】
 * 1) :root 里的 CSS 变量 = 全站配色/圆角/阴影，改一处全站生效
 * 2) .theme-* 类 = 两套界面主题：杂志编辑风 / 默认工具风
 * 3) body.dark = 暗色样式（兼容保留；顶栏按钮已改为两套主题互切）
 * 4) 组件区（卡片/按钮/表单/帖子/评论/后台）按注释分块
 * ============================================================ */

/* ---------- 字体 ---------- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700;900&family=Noto+Serif+SC:wght@400;700&family=Space+Mono:wght@400;700&display=swap');

/* ---------- 基础变量：与「默认工具风」一致，作为无主题类时的兜底 ---------- */
:root {
	--color-sakura: #4f46e5;
	--color-lavender: #6366f1;
	--color-sky: #38bdf8;
	--color-peach: #fb923c;
	--color-mint: #34d399;
	--color-gold: #fbbf24;

	--gradient-brand: linear-gradient(135deg, #4f46e5, #4f46e5);
	--gradient-soft: none;

	--background: #ffffff;
	--foreground: #1c1c1c;
	--card: #ffffff;
	--card-foreground: #1c1c1c;
	--muted: #f3f4f6;
	--muted-foreground: #6b7280;
	--primary: #4f46e5;
	--primary-foreground: #ffffff;
	--secondary: #f3f4f6;
	--secondary-foreground: #4338ca;
	--accent: #f3f4f6;
	--accent-foreground: #4338ca;
	--border: #e5e7eb;
	--input: #e5e7eb;
	--ring: #4f46e5;
	--destructive: #ef4444;

	--radius-sm: 10px;
	--radius: 14px;
	--radius-lg: 16px;
	--radius-full: 999px;

	--shadow-card: none;
	--shadow-elevated: 0 12px 40px rgba(28, 28, 28, .10);
	--shadow-hover: 0 8px 28px rgba(28, 28, 28, .12);

	--font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', sans-serif;
	--font-mono: 'Space Mono', Consolas, monospace;

	--header-height: 66px;
	--container: 1120px;
	--transition: .22s cubic-bezier(.4, 0, .2, 1);
}

/* ---------- 暗色样式（兼容保留，可叠加在两套界面主题上） ----------
 * 已下线的四套旧配色主题不再提供样式；全站仅有杂志编辑风与默认工具风。
 */
body.dark {
	--background: #12141f;
	--foreground: #e6e8f0;
	--card: #1a1d2b;
	--card-foreground: #e6e8f0;
	--muted: #232738;
	--muted-foreground: #9298ad;
	--secondary: #2a2138;
	--secondary-foreground: #c4b5fd;
	--accent: #2a1f2e;
	--accent-foreground: #f9a8d4;
	--border: #303549;
	--input: #303549;
	--gradient-soft: linear-gradient(135deg, #1a1d2b, #231a30);
	--shadow-card: 0 4px 20px rgba(0, 0, 0, .3);
	--shadow-elevated: 0 12px 40px rgba(0, 0, 0, .45);
}

/* ============================================================
 * 基础重置
 * ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
	margin: 0;
	min-height: 100vh;
	background: var(--background);
	background-image: var(--gradient-soft);
	background-attachment: fixed;
	background-size: cover;
	background-position: center;
	color: var(--foreground);
	font-family: var(--font-sans);
	font-size: 14px;
	line-height: 1.65;
	transition: background-color var(--transition), color var(--transition);
}
body.with-bg { background-image: linear-gradient(rgba(255,255,255,.82), rgba(255,255,255,.86)), var(--user-bg); background-size: cover; background-attachment: fixed; }
body.dark.with-bg { background-image: linear-gradient(rgba(12,14,24,.85), rgba(12,14,24,.88)), var(--user-bg); }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-lavender); }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--color-sakura); color: #fff; }

.container { width: min(var(--container), calc(100% - 32px)); margin: 0 auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ============================================================
 * 顶部导航栏
 * ============================================================ */
.site-header {
	position: sticky; top: 0; z-index: 50;
	height: var(--header-height);
	background: color-mix(in srgb, var(--card) 88%, transparent);
	backdrop-filter: blur(14px);
	border-bottom: 1px solid var(--border);
	box-shadow: 0 2px 12px rgba(0,0,0,.03);
}
.header-inner { height: 100%; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-sans); font-size: 22px; color: var(--foreground); font-weight: 700; white-space: nowrap; }
.brand:hover { color: var(--primary); }
.brand-logo { width: 36px; height: 36px; border-radius: 12px; background: var(--gradient-brand); display: grid; place-items: center; color: #fff; font-size: 19px; box-shadow: var(--shadow-card); }
.brand-img { width: 36px; height: 36px; border-radius: 12px; object-fit: cover; }
.header-nav { display: flex; gap: 4px; flex: 1; }
.header-nav a { padding: 8px 14px; border-radius: var(--radius-full); color: var(--muted-foreground); font-weight: 500; }
.header-nav a:hover, .header-nav a.active { background: var(--accent); color: var(--primary); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
	width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border);
	background: var(--card); display: grid; place-items: center; font-size: 16px;
	transition: var(--transition); color: var(--foreground);
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 2px solid var(--card); box-shadow: 0 0 0 2px var(--color-sakura); }
.user-menu { position: relative; }
.user-trigger { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 2px; border-radius: var(--radius-full); }
.user-trigger:hover { background: var(--muted); }
.dropdown {
	position: absolute; right: 0; top: calc(100% + 10px); min-width: 190px;
	background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
	box-shadow: var(--shadow-elevated); padding: 8px; display: none; z-index: 60;
}
.dropdown.show { display: block; animation: pop .18s ease; }
.dropdown a, .dropdown button {
	display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px;
	border: 0; background: none; border-radius: 10px; text-align: left; color: var(--foreground); font-size: 13px;
}
.dropdown a:hover, .dropdown button:hover { background: var(--muted); color: var(--primary); }
.dropdown .divider { height: 1px; background: var(--border); margin: 6px 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }

/* 主题/语言选择弹层 */
.popover {
	position: absolute; right: 0; top: calc(100% + 10px); z-index: 60;
	background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
	box-shadow: var(--shadow-elevated); padding: 14px; width: 210px; display: none;
}
.popover.show { display: block; animation: pop .18s ease; }
.popover h4 { margin: 0 0 10px; font-size: 12px; color: var(--muted-foreground); font-weight: 600; }
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.theme-chip {
	padding: 8px 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--muted);
	font-size: 11px; text-align: center; color: var(--foreground); transition: var(--transition);
}
.theme-chip:hover, .theme-chip.active { border-color: var(--primary); color: var(--primary); font-weight: 600; }
.lang-list { display: flex; flex-direction: column; gap: 2px; }
.lang-list button { padding: 7px 10px; border: 0; background: none; border-radius: 8px; text-align: left; font-size: 13px; }
.lang-list button:hover, .lang-list button.active { background: var(--muted); color: var(--primary); }

/* ============================================================
 * 通用组件
 * ============================================================ */
.card {
	background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
	box-shadow: var(--shadow-card);
}
.glass { background: color-mix(in srgb, var(--card) 75%, transparent); backdrop-filter: blur(12px); }

.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 7px;
	padding: 9px 18px; border-radius: var(--radius-full); border: 1px solid transparent;
	background: var(--primary); color: var(--primary-foreground); font-weight: 600; font-size: 13px;
	transition: var(--transition); white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); color: var(--primary-foreground); filter: brightness(1.05); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--gradient-brand); color: #fff; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--foreground); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--accent); }
.btn-ghost { background: transparent; color: var(--muted-foreground); }
.btn-ghost:hover { background: var(--muted); color: var(--foreground); }
.btn-danger { background: var(--destructive); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 26px; font-size: 15px; }
.btn-block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: var(--foreground); }
.field .hint { font-size: 11px; color: var(--muted-foreground); }
.input, .textarea, .select {
	width: 100%; padding: 10px 14px; border: 1px solid var(--input); border-radius: var(--radius-sm);
	background: var(--background); color: var(--foreground); outline: none; transition: var(--transition);
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 18%, transparent); }
.textarea { resize: vertical; min-height: 100px; line-height: 1.7; }
.select { cursor: pointer; }
.checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--primary); }

.flash { padding: 11px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13px; }
.flash.success { background: color-mix(in srgb, var(--color-mint) 14%, var(--card)); color: #047857; border: 1px solid color-mix(in srgb, var(--color-mint) 30%, transparent); }
.flash.error { background: color-mix(in srgb, var(--destructive) 10%, var(--card)); color: var(--destructive); border: 1px solid color-mix(in srgb, var(--destructive) 25%, transparent); }
body.dark .flash.success { color: #6ee7b7; }
body.dark .flash.error { color: #fca5a5; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: var(--radius-full); font-size: 11px; font-weight: 600; background: var(--muted); color: var(--muted-foreground); }
.badge.primary { background: color-mix(in srgb, var(--primary) 13%, transparent); color: var(--primary); }
.badge.pin { background: color-mix(in srgb, var(--color-gold) 20%, transparent); color: #b45309; }
.badge.locked { background: color-mix(in srgb, var(--destructive) 12%, transparent); color: var(--destructive); }
.badge.admin { background: color-mix(in srgb, var(--color-lavender) 20%, transparent); color: var(--secondary-foreground); }

.empty { text-align: center; padding: 70px 20px; color: var(--muted-foreground); }
.empty-icon { font-size: 52px; margin-bottom: 12px; filter: grayscale(.4); }
.empty p { margin: 0 0 18px; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 6px; margin: 28px 0; flex-wrap: wrap; }
.pagination a, .pagination span {
	min-width: 34px; height: 34px; padding: 0 10px; border-radius: 10px; display: grid; place-items: center;
	background: var(--card); border: 1px solid var(--border); font-size: 13px; color: var(--foreground);
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .current { background: var(--gradient-brand); color: #fff; border-color: transparent; }

/* 页脚 */
.site-footer { margin-top: 60px; padding: 32px 0; border-top: 1px solid var(--border); text-align: center; color: var(--muted-foreground); font-size: 12px; }
.site-footer a { margin: 0 8px; }
.site-footer .powered-link { margin: 0; color: var(--primary); font-weight: 700; text-decoration: none; }
.site-footer .powered-link:hover, .site-footer .powered-link:focus-visible { text-decoration: underline; }

/* ============================================================
 * 首页：工具栏 + 帖子列表
 * ============================================================ */
.page-heading { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 18px; gap: 16px; flex-wrap: wrap; }
.page-heading h1 { font-family: var(--font-sans); font-size: 26px; margin: 0; }
.page-heading .sub { color: var(--muted-foreground); font-size: 13px; }

.toolbar { padding: 14px 18px; margin-bottom: 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.toolbar .search-box { flex: 1; min-width: 200px; position: relative; }
.toolbar .search-box input { padding-left: 36px; }
.toolbar .search-box::before { content: '🔍'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 14px; opacity: .6; }
.toolbar .select { width: auto; min-width: 110px; }

.post-list { display: flex; flex-direction: column; gap: 12px; }
.post-item {
	padding: 18px 20px; display: flex; gap: 16px; align-items: flex-start;
	transition: var(--transition); position: relative; overflow: hidden;
}
.post-item::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gradient-brand); opacity: 0; transition: var(--transition); }
.post-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.post-item:hover::before { opacity: 1; }
.post-item.pinned { background: linear-gradient(90deg, color-mix(in srgb, var(--color-gold) 8%, var(--card)), var(--card)); }
.post-author-avatar { width: 42px; height: 42px; border-radius: 14px; object-fit: cover; flex-shrink: 0; }
.post-main { flex: 1; min-width: 0; }
.post-title { font-size: 16px; font-weight: 700; color: var(--foreground); margin: 0 0 5px; line-height: 1.4; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.post-title a { color: inherit; }
.post-title a:hover { color: var(--primary); }
.post-excerpt { color: var(--muted-foreground); font-size: 13px; margin: 0 0 10px; line-height: 1.6; }
.post-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted-foreground); }
.post-meta .cat { padding: 2px 9px; background: var(--accent); color: var(--accent-foreground); border-radius: var(--radius-full); font-weight: 600; }
.post-stats { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; font-size: 12px; color: var(--muted-foreground); min-width: 56px; }
.post-stats span { display: flex; align-items: center; gap: 4px; }

/* ============================================================
 * 帖子详情 + 评论
 * ============================================================ */
.post-detail { padding: 28px 32px; margin-bottom: 18px; }
.post-detail h1 { font-family: var(--font-sans); font-size: 28px; margin: 0 0 14px; line-height: 1.35; }
.post-detail-head { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 22px; flex-wrap: wrap; }
.post-detail-head .avatar { width: 40px; height: 40px; }
.author-info { flex: 1; }
.author-info strong { display: block; font-size: 14px; }
.author-info small { color: var(--muted-foreground); font-size: 11px; }

/* Markdown 正文 */
.markdown { line-height: 1.85; font-size: 15px; word-wrap: break-word; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { font-family: var(--font-sans); margin: 1.4em 0 .6em; line-height: 1.3; }
.markdown h1 { font-size: 24px; } .markdown h2 { font-size: 21px; } .markdown h3 { font-size: 18px; }
.markdown p { margin: 0 0 1em; }
.markdown img { border-radius: var(--radius); margin: 12px 0; box-shadow: var(--shadow-card); max-height: 520px; object-fit: contain; }
.markdown pre { background: #1e1e2e; color: #e0e0ff; padding: 16px 18px; border-radius: var(--radius-sm); overflow-x: auto; font-family: var(--font-mono); font-size: 13px; }
.markdown code.md-code { background: var(--muted); padding: 2px 6px; border-radius: 5px; font-family: var(--font-mono); font-size: .9em; color: var(--primary); }
.markdown blockquote { margin: 1em 0; padding: 10px 18px; border-left: 4px solid var(--color-sakura); background: var(--accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--muted-foreground); }
.markdown ul, .markdown ol { padding-left: 24px; margin: 0 0 1em; }
.markdown li { margin: 4px 0; }
.markdown hr { border: 0; border-top: 1px dashed var(--border); margin: 24px 0; }
.markdown table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 13px; }
.markdown th, .markdown td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.markdown th { background: var(--muted); }
.md-table-wrap { overflow-x: auto; }

.post-actions { display: flex; gap: 10px; align-items: center; padding-top: 18px; margin-top: 20px; border-top: 1px solid var(--border); }
.like-btn { display: flex; align-items: center; gap: 7px; padding: 8px 18px; border-radius: var(--radius-full); border: 1px solid var(--border); background: var(--card); font-weight: 600; transition: var(--transition); }
.like-btn:hover { border-color: var(--color-sakura); }
.like-btn.liked { background: color-mix(in srgb, var(--color-sakura) 14%, var(--card)); border-color: var(--color-sakura); color: var(--color-sakura); }
.like-btn .heart { animation: heartbeat .3s ease; }
@keyframes heartbeat { 50% { transform: scale(1.35); } }

.comments-section { margin-top: 26px; }
.comments-title { font-family: var(--font-sans); font-size: 19px; margin: 0 0 16px; display: flex; align-items: center; gap: 8px; }
.comment-item { padding: 16px 18px; margin-bottom: 10px; display: flex; gap: 12px; }
.comment-item .avatar { width: 36px; height: 36px; border-radius: 12px; flex-shrink: 0; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; flex-wrap: wrap; }
.comment-head strong { font-size: 13px; color: var(--foreground); }
.comment-head .floor { color: var(--muted-foreground); margin-left: auto; }
.comment-text { font-size: 14px; line-height: 1.7; word-break: break-word; }
.comment-text img { max-height: 300px; border-radius: 10px; margin-top: 8px; }
.comment-actions { display: flex; gap: 12px; margin-top: 8px; font-size: 11px; }
.comment-actions button { border: 0; background: none; color: var(--muted-foreground); padding: 0; }
.comment-actions button:hover { color: var(--primary); }
.comment-children { margin: 12px 0 0 24px; padding-left: 16px; border-left: 2px solid var(--border); }
.comment-children .comment-item { background: var(--accent); }

/* Markdown 编辑器 */
.editor-toolbar { display: flex; gap: 6px; padding: 8px; border: 1px solid var(--input); border-bottom: 0; border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: var(--muted); flex-wrap: wrap; }
.editor-toolbar button { width: 30px; height: 30px; border-radius: 7px; border: 0; background: var(--card); font-size: 13px; transition: var(--transition); }
.editor-toolbar button:hover { background: var(--primary); color: #fff; }
.editor-toolbar .upload-label { cursor: pointer; }
/* 正文编辑框：它是工具栏的相邻兄弟（旧版误写成后代选择器，规则一直未生效，只剩 100px 默认高度） */
.editor-toolbar + .textarea,
#editor-textarea {
	border-radius: 0 0 var(--radius-sm) var(--radius-sm);
	min-height: 380px;
	resize: vertical;
}
.editor-preview { padding: 16px; border: 1px dashed var(--border); border-radius: var(--radius-sm); margin-top: 10px; min-height: 80px; }

/* ============================================================
 * 认证页（登录/注册/找回）
 * ============================================================ */
.auth-wrap { min-height: calc(100vh - var(--header-height) - 100px); display: grid; place-items: center; padding: 40px 16px; }
.auth-card { width: min(440px, 100%); padding: 36px; }
.auth-card h1 { font-family: var(--font-sans); font-size: 27px; margin: 0 0 6px; text-align: center; }
.auth-card .subtitle { text-align: center; color: var(--muted-foreground); font-size: 13px; margin-bottom: 26px; }
.auth-card .btn { margin-top: 6px; }
.auth-links { display: flex; justify-content: space-between; margin-top: 18px; font-size: 12px; }
.auth-deco { text-align: center; font-size: 40px; margin-bottom: 12px; }

/* ============================================================
 * 个人主页 / 设置
 * ============================================================ */
.profile-banner { height: 170px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; background: var(--gradient-brand); background-size: cover; background-position: center; }
.profile-card { margin-top: -46px; position: relative; padding: 0 28px 28px; }
.profile-avatar { width: 88px; height: 88px; border-radius: 50%; border: 5px solid var(--card); object-fit: cover; box-shadow: var(--shadow-elevated); margin-top: -44px; }
.profile-name { font-family: var(--font-sans); font-size: 23px; margin: 12px 0 2px; display: flex; align-items: center; gap: 8px; }
.profile-bio { color: var(--muted-foreground); margin: 6px 0 16px; }
.profile-stats { display: flex; gap: 28px; padding: 14px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.profile-stats div { text-align: center; }
.profile-stats strong { display: block; font-size: 20px; font-family: var(--font-mono); }
.profile-stats span { font-size: 11px; color: var(--muted-foreground); }

.settings-layout { display: grid; grid-template-columns: 200px 1fr; gap: 20px; margin: 26px 0; align-items: start; }
.settings-nav { padding: 10px; position: sticky; top: calc(var(--header-height) + 16px); }
.settings-nav button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 10px 12px; border: 0; background: none; border-radius: 10px; text-align: left; font-size: 13px; }
.settings-nav button:hover { background: var(--muted); }
.settings-nav button.active { background: var(--accent); color: var(--primary); font-weight: 600; }
.settings-panel { padding: 26px 30px; }
.settings-panel h2 { font-family: var(--font-sans); font-size: 20px; margin: 0 0 20px; }
.settings-section { display: none; }
.settings-section.active { display: block; }
.avatar-edit { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.avatar-edit img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }

/* ============================================================
 * 管理后台
 * ============================================================ */
.admin-layout { display: grid; grid-template-columns: 210px 1fr; gap: 20px; margin: 26px 0; align-items: start; }
.admin-sidebar { padding: 12px; position: sticky; top: calc(var(--header-height) + 16px); }
.admin-sidebar h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted-foreground); margin: 12px 10px 8px; }
.admin-sidebar button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; background: none; border-radius: 10px; text-align: left; font-size: 13px; }
.admin-sidebar button:hover { background: var(--muted); }
.admin-sidebar button.active { background: var(--gradient-brand); color: #fff; font-weight: 600; }
.admin-main { min-width: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { padding: 20px; display: flex; align-items: center; gap: 14px; }
.stat-icon { width: 44px; height: 44px; border-radius: 13px; background: var(--gradient-soft); display: grid; place-items: center; font-size: 20px; }
.stat-num { font-size: 24px; font-weight: 800; font-family: var(--font-mono); line-height: 1; }
.stat-label { font-size: 11px; color: var(--muted-foreground); margin-top: 4px; }
.admin-panel { padding: 22px; display: none; }
.admin-panel.active { display: block; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 10px 12px; color: var(--muted-foreground); font-size: 11px; border-bottom: 2px solid var(--border); white-space: nowrap; }
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:hover td { background: var(--accent); }
.data-table .row-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.table-scroll { overflow-x: auto; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 20px; }
.form-section-title { font-size: 13px; font-weight: 700; color: var(--primary); margin: 22px 0 14px; padding-bottom: 7px; border-bottom: 1px solid var(--border); }

/* ============================================================
 * 弹窗 / Toast
 * ============================================================ */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 12, 25, .55); backdrop-filter: blur(4px); display: none; place-items: center; z-index: 100; padding: 16px; }
.modal-overlay.show { display: grid; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { width: min(520px, 100%); max-height: 86vh; overflow-y: auto; padding: 26px; animation: pop .2s ease; }
.modal h3 { font-family: var(--font-sans); margin: 0 0 18px; font-size: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

#toast-container { position: fixed; top: 82px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { min-width: 240px; max-width: 360px; padding: 12px 18px; border-radius: var(--radius-sm); background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--color-mint); box-shadow: var(--shadow-elevated); font-size: 13px; animation: slideIn .25s ease; }
.toast.error { border-left-color: var(--destructive); }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* 加载动画 */
.loading { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
 * 响应式
 * ============================================================ */
@media (max-width: 860px) {
	.settings-layout, .admin-layout { grid-template-columns: 1fr; }
	.settings-nav, .admin-sidebar { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
	.settings-nav button, .admin-sidebar button { width: auto; }
	.admin-sidebar h3 { width: 100%; margin: 6px 10px 2px; }
}
@media (max-width: 640px) {
	:root { --header-height: 58px; }
	.header-nav { display: none; }
	.brand { font-size: 18px; }
	.post-detail { padding: 20px; }
	.post-detail h1 { font-size: 22px; }
	.auth-card { padding: 26px 22px; }
	.post-item { gap: 10px; padding: 14px; }
	.post-stats { display: none; }
	.profile-card { padding: 0 18px 20px; }
	#editor-textarea { height: 260px; min-height: 260px; }
}

/* ============================================================
 * 优化版首页 & 顶栏（按设计图）
 * -------------------------------------------------------------
 * 这是本次 UI 优化新增的样式，覆盖上面的通用样式。
 * 想调整配色 → 改 :root 变量；想调整布局尺寸 → 改下面各块。
 * ============================================================ */

/* ---------- 顶栏：白底、方形 logo、居中搜索、极简右侧 ---------- */
.site-header { height: 56px; background: #fff; border-bottom: 1px solid #f0eef6; box-shadow: none; }
.header-inner { gap: 18px; max-width: 1080px; }

.brand { gap: 9px; font-family: var(--font-sans); font-size: 17px; font-weight: 800; letter-spacing: -.3px; color: #2d2b3a; }
.brand-logo {
	width: 30px; height: 30px; border-radius: 9px; background: var(--gradient-brand);
	display: grid; place-items: center; color: #fff; font-size: 16px; font-weight: 800;
	box-shadow: none; font-family: var(--font-sans);
}
.brand-img { width: 30px; height: 30px; border-radius: 9px; }

.header-search { flex: 1; max-width: 360px; }
.header-search input {
	width: 100%; height: 34px; padding: 0 14px 0 34px; border: 1px solid transparent;
	border-radius: var(--radius-full); background: #f5f4f8; color: var(--foreground);
	font-size: 12.5px; outline: none; transition: var(--transition);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%23a5a1b5' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E");
	background-repeat: no-repeat; background-position: 12px center;
}
.header-search input::placeholder { color: #b3afbf; }
.header-search input:focus { background-color: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 10%, transparent); }

.header-actions { gap: 10px; margin-left: auto; }
.header-icon {
	width: 28px; height: 28px; border: 0; background: none; color: #8a869a;
	font-size: 17px; display: grid; place-items: center; border-radius: 50%; transition: var(--transition);
	text-decoration: none; cursor: pointer; flex: none;
}
.header-icon svg { display: block; }
/* 顶栏主题按钮：按当前主题显示「可切换到的另一套主题」图标 */
.header-icon .icon-theme-mag,
.header-icon .icon-theme-tool { display: none; }
body.theme-tool .header-icon .icon-theme-mag { display: block; }
body.theme-editorial .header-icon .icon-theme-tool { display: block; }
.header-icon:hover { color: var(--primary); background: var(--muted); }
.header-lang {
	border: 0; background: none; color: #4b4859; font-size: 12.5px; font-weight: 600;
	padding: 6px 8px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.header-lang:hover { background: var(--muted); }

.header-user { display: flex; align-items: center; gap: 7px; color: var(--foreground); text-decoration: none; }
.header-user:hover { color: var(--foreground); }
.header-avatar, .header-avatar-letter {
	width: 27px; height: 27px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
	display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700;
	background: var(--gradient-brand); border: 0;
}
.header-username { font-size: 12.5px; font-weight: 700; color: #2d2b3a; white-space: nowrap; }
.header-admin-tag {
	font-size: 10px; font-weight: 700; color: var(--primary); background: #f2ecfd;
	padding: 2px 7px; border-radius: var(--radius-full); white-space: nowrap;
}
.header-logout {
	border: 1px solid #f3c9ca; background: #fff; color: #e5484d;
	font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 8px; cursor: pointer;
	transition: var(--transition); white-space: nowrap;
}
.header-logout:hover { background: #fff5f5; border-color: #e5484d; }
.header-new-btn { padding: 8px 16px; border-radius: 6px; font-size: 12px; box-shadow: none; line-height: 1.2; }
.header-new-btn:hover { transform: none; box-shadow: none; }

/* ---------- 首页两栏布局 ---------- */
.home-wrap { max-width: 940px; margin: 0 auto; padding: 30px 16px 60px; display: grid; grid-template-columns: minmax(0, 1fr) 268px; gap: 24px; align-items: start; }
.home-main { min-width: 0; }
.home-side { display: flex; flex-direction: column; gap: 16px; }

/* 发帖框 */
.composer-card {
	display: flex; align-items: center; gap: 12px; padding: 12px 14px;
	background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg);
	box-shadow: var(--shadow-card); margin-bottom: 18px;
}
.composer-avatar { width: 34px; height: 34px; font-size: 14px; }
.composer-input {
	flex: 1; min-width: 0; height: 36px; display: flex; align-items: center;
	padding: 0 14px; border-radius: 9px; background: #f6f5f9; color: #a8a4b5;
	font-size: 12.5px; text-decoration: none; transition: var(--transition);
}
.composer-input:hover { background: #f1eff7; color: #8a869a; }
.composer-btn { padding: 9px 18px; font-size: 12.5px; border-radius: 9px; }

/* 排序胶囊 + 计数 */
.filter-bar { display: flex; align-items: center; justify-content: space-between; margin: 18px 2px 12px; gap: 12px; flex-wrap: wrap; }
.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
	display: inline-flex; align-items: center; padding: 6px 15px; border-radius: var(--radius-full);
	font-size: 12px; font-weight: 600; color: #6b687a; text-decoration: none;
	background: #fff; border: 1px solid var(--border); transition: var(--transition);
}
.pill:hover { border-color: var(--primary); color: var(--primary); }
.pill.active { background: #26232f; color: #fff; border-color: #26232f; }
.result-count { font-size: 11.5px; color: #a5a1b0; white-space: nowrap; }

/* 帖子列表：一行一条，无头像无摘要 */
.post-list { padding: 4px 0; overflow: hidden; }
.post-row {
	display: flex; align-items: center; justify-content: space-between; gap: 14px;
	min-height: 46px; padding: 9px 20px; border-bottom: 1px solid #f3f1f7;
	transition: background var(--transition);
}
.post-row:last-child { border-bottom: 0; }
.post-row:hover { background: #faf9fd; }
.post-row-main { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 1; }
.post-cat-tag {
	flex-shrink: 0; font-size: 10.5px; font-weight: 700; padding: 2px 9px;
	border-radius: 5px; text-decoration: none; background: #f1ecfd; color: #7c3aed;
}
.post-cat-tag.general, .post-cat-tag[data-cat="general"] { background: #fce7f1; color: #db2777; }
.post-cat-tag.tech { background: #f1ecfd; color: #7c3aed; }
.post-row-title {
	font-size: 13px; font-weight: 600; color: #33303f; text-decoration: none;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.post-row-title:hover { color: var(--primary); }
.post-row-meta { display: flex; align-items: center; gap: 12px; flex-shrink: 0; font-size: 11px; color: #a09cac; }
.post-row-author { color: #7d7989; font-weight: 600; text-decoration: none; white-space: nowrap; }
.post-row-author:hover { color: var(--primary); }
.post-row-time { white-space: nowrap; }
.post-row-stats { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; min-width: 30px; }

/* 分页 */
.home-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 22px 0; color: #a5a1b0; font-size: 11.5px; }
.home-pagination a { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 7px; background: #fff; color: #6b687a; font-size: 15px; }
.home-pagination a:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- 右侧栏卡片 ---------- */
.side-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 18px 16px; box-shadow: var(--shadow-card); }
.side-card h3 { margin: 0 0 12px; font-size: 13.5px; font-weight: 800; color: #2d2b3a; }
.side-card > p { margin: 0; font-size: 12px; line-height: 1.8; color: #8a8699; }

.cat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cat-item {
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
	padding: 8px 12px; border-radius: 8px; font-size: 12.5px; color: #5c5869;
	text-decoration: none; transition: var(--transition);
}
.cat-item:hover { background: #f6f4fb; color: var(--primary); }
.cat-item.active { background: #f0eafc; color: var(--primary); font-weight: 700; }
.cat-count { font-size: 11px; color: #a5a1b0; font-weight: 600; }
.cat-item.active .cat-count { color: var(--primary); }

/* ---------- 页脚简洁版 ---------- */
.site-footer { border-top: 1px solid #efedf4; background: transparent; margin-top: 20px; padding: 26px 0 40px; }
.site-footer p { margin: 0; font-size: 11.5px; color: #a5a1b0; }

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
	.home-wrap { grid-template-columns: 1fr; padding: 20px 14px 40px; }
	.home-side { order: -1; }
	.header-search { max-width: none; }
	.header-username { display: none; }
	.header-admin-tag { display: none; }
	.post-row-meta { gap: 8px; }
	.post-row-time { display: none; }
}
@media (max-width: 480px) {
	.header-lang { font-size: 0; }
	.header-lang::after { content: '🌐'; font-size: 14px; }
	.composer-btn { padding: 9px 12px; font-size: 11px; }
	/* 窄屏顶栏防横向溢出：发布按钮收成图标，搜索框允许收缩 */
	.header-inner { gap: 10px; }
	.header-actions { gap: 6px; }
	.header-new-btn { font-size: 0; padding: 7px 11px; }
	.header-new-btn::after { content: '🚀'; font-size: 14px; }
	.header-search, .header-search input { min-width: 0; width: 100%; }
}

/* ---------- 暗色模式：覆盖优化版首页的浅色硬编码值 ---------- */
body.dark .composer-card,
body.dark .side-card,
body.dark .pill,
body.dark .home-pagination a { background: var(--card); }
body.dark .composer-input { background: var(--muted); color: var(--muted-foreground); }
body.dark .composer-input:hover { background: var(--secondary); color: var(--secondary-foreground); }
body.dark .pill { color: var(--muted-foreground); }
body.dark .pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }
body.dark .result-count,
body.dark .home-pagination,
body.dark .cat-count,
body.dark .site-footer p { color: var(--muted-foreground); }
body.dark .post-row { border-bottom-color: var(--border); }
body.dark .post-row:hover { background: var(--muted); }
body.dark .post-row-title,
body.dark .side-card h3,
body.dark .cat-item { color: var(--foreground); }
body.dark .post-row-meta { color: var(--muted-foreground); }
body.dark .post-row-author { color: var(--card-foreground); }
body.dark .post-cat-tag.general { background: #4a1d38; color: #f9a8d4; }
body.dark .post-cat-tag.tech { background: #332255; color: #c4b5fd; }
body.dark .post-cat-tag.random { background: #2a2138; color: #c4b5fd; }
body.dark .home-pagination a { color: var(--foreground); }
body.dark .side-card > p { color: var(--muted-foreground); }
body.dark .cat-item:hover { background: var(--muted); }
body.dark .cat-item.active { background: var(--secondary); color: var(--secondary-foreground); }
body.dark .cat-item.active .cat-count { color: var(--secondary-foreground); }
body.dark .site-footer { border-top-color: var(--border); }
body.dark .header-logout { background: transparent; color: #fca5a5; border-color: #7f1d1d; }
body.dark .header-logout:hover { background: #3b1418; }

/* ============================================================
 * 杂志编辑风 / 默认工具风 · 共用结构样式
 * 两套主题共用同一套 DOM，仅靠 body.theme-* 切换配色与字体
 * ============================================================ */
.forum-page { max-width: 1100px; margin: 0 auto; padding: 40px 24px 80px; }
.forum-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--border); }
.forum-tabs { display: flex; align-items: center; gap: 22px; }
.forum-tabs a {
	font-size: 13px; color: var(--muted-foreground); text-decoration: none;
	padding: 11px 0; border-bottom: 2px solid transparent; white-space: nowrap; transition: color .15s;
}
.forum-tabs a:hover { color: var(--foreground); }
.forum-tabs a.active { color: var(--foreground); font-weight: 700; border-bottom-color: var(--primary); }
.forum-new { border-radius: 6px; padding: 9px 18px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.forum-table { width: 100%; }
.forum-row {
	display: grid; grid-template-columns: 92px minmax(0, 1fr) 108px 152px 66px 66px 66px;
	align-items: center; gap: 10px; padding: 16px 0; border-bottom: 1px solid var(--border);
	color: var(--foreground); text-decoration: none; font-size: 13px; transition: background .15s;
}
.forum-row:not(.forum-thead):hover { background: var(--muted); }
.forum-thead { color: var(--muted-foreground); font-size: 11.5px; padding: 12px 0; }
.cell-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-cat, .cell-author, .cell-date, .cell-num { color: var(--muted-foreground); }
/* ---------- 数值三列：表头与「图标 + 数字」严格同轴对齐 ----------
 * 图标、数字拆成固定宽度的两格，三列共用同一套盒模型；表头文字也放进
 * 同一个 flex 居中容器，避免不同字形宽度让三列左右错位。
 */
.forum-thead .th-num,
.forum-row .cell-num {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}
.forum-row .cell-num { font-size: 12px; }
.forum-row .num-ico {
	display: inline-block;
	width: 14px;
	flex: 0 0 14px;
	text-align: center;
	font-size: 12px;
	line-height: 1;
}
.forum-row .num-val {
	display: inline-block;
	min-width: 14px;
	text-align: right;
	line-height: 1;
}
.date-cn { display: none; }
.pin-dot { color: var(--primary); font-size: 9px; vertical-align: middle; margin-right: 6px; }
.forum-empty { padding: 44px 0; text-align: center; color: var(--muted-foreground); font-size: 13px; }
.forum-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding-top: 22px; font-size: 12px; color: var(--muted-foreground); }
.forum-pagination a { color: var(--primary); text-decoration: none; }

.detail-page { padding: 26px 24px 80px; }
.detail-container { max-width: 1100px; margin: 0 auto; }
.detail-back { display: inline-block; margin-bottom: 28px; font-size: 12px; color: var(--muted-foreground); text-decoration: none; }
.detail-back:hover { color: var(--primary); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 56px; align-items: start; }
.detail-cat { font-size: 11px; color: var(--muted-foreground); margin-bottom: 9px; }
.detail-title { margin: 0 0 15px; font-size: 29px; line-height: 1.35; font-weight: 700; color: var(--foreground); }
.detail-meta { display: flex; align-items: center; gap: 14px; padding-bottom: 20px; border-bottom: 1px solid var(--border); font-size: 11.5px; color: var(--muted-foreground); }
.detail-edit { margin-left: auto; font-size: 15px; color: var(--muted-foreground); text-decoration: none; }
.detail-body { padding: 26px 0 12px; font-size: 14px; line-height: 1.9; color: var(--foreground); }
.detail-body h2 { font-size: 19px; line-height: 1.5; margin: 34px 0 14px; font-weight: 700; }
.detail-body h3 { font-size: 16px; margin: 26px 0 12px; font-weight: 700; }
.detail-body p { margin: 0 0 18px; }
.detail-body a { color: var(--primary); text-decoration: underline; }
.detail-body ul, .detail-body ol { padding-left: 22px; margin: 0 0 18px; }
.detail-body li { margin: 4px 0; }
.detail-body table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 12.5px; }
.detail-body th, .detail-body td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.detail-body th { color: var(--muted-foreground); font-weight: 600; }
.detail-body pre { background: var(--secondary); color: var(--foreground); padding: 16px 18px; border-radius: 6px; overflow: auto; font-size: 12px; line-height: 1.8; margin: 16px 0; }
.detail-body code { font-family: 'Space Mono', Consolas, monospace; }
.detail-body :not(pre) > code { background: var(--secondary); padding: 2px 6px; border-radius: 4px; font-size: 12px; }
.detail-body blockquote { margin: 18px 0; padding: 14px 18px; background: var(--secondary); color: var(--muted-foreground); font-size: 13px; border-left: 0; border-radius: 6px; }
.detail-actions { display: flex; align-items: center; gap: 12px; margin-top: 20px; padding: 16px 0; border-top: 1px solid var(--border); font-size: 12px; }
.detail-likers { color: var(--muted-foreground); }
.detail-delete { border: 0; background: none; color: #c0392b; font-size: 12px; cursor: pointer; padding: 4px; }
.detail-toc { position: sticky; top: 86px; font-size: 12px; line-height: 1.7; }
.toc-title { color: var(--primary); font-weight: 700; margin-bottom: 12px; }
#toc-list a { display: block; padding: 5px 0; color: var(--muted-foreground); text-decoration: none; }
#toc-list a:hover, #toc-list a.active { color: var(--primary); }
.detail-comments { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border); }
.detail-comments .comments-title { font-size: 15px; margin: 0 0 18px; font-family: inherit; }
.comments-empty { font-size: 12px; color: var(--muted-foreground); }
.comment-compose { margin: 4px 0 24px; }
.comment-compose textarea {
	width: 100%; min-height: 84px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 6px;
	background: var(--card); color: var(--foreground); resize: vertical; outline: none; font-size: 13px;
}
.comment-compose textarea:focus { border-color: var(--primary); }
.comment-compose-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.comment-compose .btn { padding: 9px 20px; font-size: 12px; border-radius: 6px; }
.detail-comments .comment-item { background: transparent; box-shadow: none; border-radius: 0; border-bottom: 1px solid var(--border); padding: 18px 0; margin: 0; }
.comment-login { font-size: 13px; color: var(--muted-foreground); padding: 18px 0; }

/* ---------- 杂志编辑风（米白 + 砖红 + 衬线） ---------- */
body.theme-editorial {
	--color-sakura: #b44630;
	--color-lavender: #b44630;
	--background: #fbf9f4;
	--foreground: #2b2823;
	--card: #fbf9f4;
	--card-foreground: #2b2823;
	--muted: #f3eee4;
	--muted-foreground: #969084;
	--primary: #b44630;
	--primary-foreground: #ffffff;
	--secondary: #f3eee4;
	--secondary-foreground: #8a3a29;
	--accent: #f3eee4;
	--border: #e7e1d6;
	--input: #e7e1d6;
	--gradient-brand: linear-gradient(135deg, #b44630, #b44630);
	--gradient-soft: none;
	--font-sans: 'Noto Serif SC', 'Songti SC', Georgia, serif;
	--shadow-card: none;
}
body.theme-editorial .site-header { background: #fbf9f4; border-bottom: 1px solid #e7e1d6; }
body.theme-editorial .brand { color: #2b2823; }
body.theme-editorial .brand-logo { display: none; }
body.theme-editorial .header-search input { background: #fbf9f4; border: 1px solid #e7e1d6; border-radius: 7px; }
body.theme-editorial .header-search input:focus { background: #fff; }
body.theme-editorial .header-username { color: #2b2823; }
body.theme-editorial .header-icon { color: #969084; }
body.theme-editorial .header-logout { border: 0; background: none; color: #969084; }
body.theme-editorial .header-admin-tag,
body.theme-editorial .header-lang { display: none; }
body.theme-editorial .site-footer { border-top-color: #e7e1d6; }
body.theme-editorial .site-footer p { text-align: left; }
body.theme-editorial .detail-title { font-family: 'Noto Serif SC', 'Songti SC', Georgia, serif; font-weight: 700; }
body.theme-editorial .detail-body pre,
body.theme-editorial .detail-body :not(pre) > code { background: #f3eee4; }
/* 杂志编辑风同样显示完整表头（板块 / 标题 / 发帖人 / 发布时间 / 点赞 / 点击 / 评论） */
body.theme-editorial .date-iso { display: none; }
body.theme-editorial .date-cn { display: inline; }

/* ---------- 默认工具风（纯白 + 蓝紫 + 无衬线） ---------- */
body.theme-tool {
	--background: #ffffff;
	--foreground: #1c1c1c;
	--card: #ffffff;
	--card-foreground: #1c1c1c;
	--muted: #f3f4f6;
	--muted-foreground: #6b7280;
	--primary: #4f46e5;
	--primary-foreground: #ffffff;
	--secondary: #f3f4f6;
	--secondary-foreground: #4338ca;
	--accent: #f3f4f6;
	--border: #e5e7eb;
	--input: #e5e7eb;
	--gradient-brand: linear-gradient(135deg, #4f46e5, #4f46e5);
	--gradient-soft: none;
	--font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', sans-serif;
	--shadow-card: none;
}
body.theme-tool .site-header { background: #fff; border-bottom: 1px solid #e5e7eb; }
body.theme-tool .brand { color: #1c1c1c; }
body.theme-tool .brand-logo { display: none; }
body.theme-tool .header-search input { background: #fff; border: 1px solid #e5e7eb; border-radius: 7px; }
body.theme-tool .header-username { color: #1c1c1c; }
body.theme-tool .header-icon { color: #6b7280; }
body.theme-tool .header-logout { border: 0; background: none; color: #6b7280; }
body.theme-tool .header-admin-tag,
body.theme-tool .header-lang { display: none; }
body.theme-tool .site-footer { border-top-color: #e5e7eb; }
body.theme-tool .site-footer p { text-align: left; }
body.theme-tool .detail-title { font-family: inherit; font-weight: 800; letter-spacing: -.6px; }

/* ---------- 标题字体统一：与正文同族，仅靠字重区分层级 ----------
 * 放在文件末尾，确保覆盖各主题的默认值。
 * -------------------------------------------------------------------- */
.page-heading h1, .post-detail h1, .comments-title, .auth-card h1,
.profile-name, .settings-panel h2, .modal h3,
.markdown h1, .markdown h2, .markdown h3, .markdown h4,
.detail-body h1, .detail-body h2, .detail-body h3, .detail-body h4 {
	font-family: var(--font-sans);
	font-weight: 700;
}

/* ---------- 字体强制统一（内容安全兜底） ----------
 * 帖子正文、评论、公告、页脚等由用户或管理员填写的区域，一律强制使用
 * 站点字体；即便内容里夹带内联 font-family、旧式 <font> 标签，或后台
 * 自定义 CSS 试图指定装饰/手写字体，都会被这里覆盖，无法再渲染出来。
 * 代码块与行内代码保留等宽字体（正常排版需要）。
 * -------------------------------------------------------------- */
.detail-body, .detail-body *,
.markdown, .markdown *,
.comment-text, .comment-text *,
.site-footer, .site-footer *,
.site-announcement, .site-announcement *,
[style*="font-family"], [style*="font:"], [style*="@font"],
font, font *, [face] {
	font-family: var(--font-sans) !important;
}
.detail-body pre, .detail-body pre *, .detail-body code,
.markdown pre, .markdown pre *, .markdown code, .md-code,
.comment-text code, pre, pre *, code {
	font-family: var(--font-mono) !important;
}

/* ---------- 移动端修复（Workers 版新增，2026-11-18） ----------
 * 原 CSS 的响应式断点只覆盖旧版 .post-item/.post-detail 类，
 * 工具风主题的 .forum-row 七列网格与 .detail-grid 双列布局在手机上无规则接管：
 * 列表标题列被压没、日期溢出屏幕；详情页 190px 目录列 + 56px 间距不收缩，
 * 正文被挤到约 100px 宽逐字换行。此段只补移动端规则，桌面端渲染不变。
 * -------------------------------------------------------------- */
@media (max-width: 860px) {
	.detail-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
	.detail-toc { position: static; border-top: 1px solid var(--border); padding-top: 16px; }
}
@media (max-width: 640px) {
	/* 帖子列表：七列横表 → 标题整行 + 元信息一行（计数靠右） */
	.forum-thead { display: none; }
	.forum-row {
		grid-template-columns: auto auto minmax(0, 1fr) auto auto auto;
		grid-template-areas:
			"title title title title title title"
			"cat author date n1 n2 n3";
		gap: 6px 10px;
		padding: 13px 0;
	}
	.forum-row .cell-title { grid-area: title; white-space: normal; overflow: visible; font-size: 14.5px; line-height: 1.5; }
	.forum-row .cell-cat { grid-area: cat; }
	.forum-row .cell-author { grid-area: author; }
	.forum-row .cell-date { grid-area: date; white-space: nowrap; }
	.forum-row .cell-num:nth-child(5) { grid-area: n1; }
	.forum-row .cell-num:nth-child(6) { grid-area: n2; }
	.forum-row .cell-num:nth-child(7) { grid-area: n3; }
	.forum-row .cell-cat, .forum-row .cell-author, .forum-row .cell-date { font-size: 12px; }
	/* 帖子详情：单列全宽，标题/元信息/操作区正常换行 */
	.detail-page { padding: 18px 16px 60px; }
	.detail-title { font-size: 22px; }
	.detail-meta { flex-wrap: wrap; row-gap: 6px; }
	.detail-meta .cell-date, .detail-meta time { white-space: nowrap; }
	.detail-actions { flex-wrap: wrap; }
	.detail-toc { display: none; }
	.detail-body { font-size: 15px; }
	.detail-body table { display: block; overflow-x: auto; }
}
