/**
 * 文章页 / 独立页面 / 404 / 评论
 *
 * 只在 is_singular() 或 is_404() 时加载（见 functions.php 的 fgamer_assets）。
 * 首页不背这些规则。
 *
 * 正文的两个历史包袱：
 *   1) 全站正文被 <span style="font-size:20px"> 这类内联样式裹着
 *   2) 下载链接是裸 <a>，没有专门 class
 * 都在「.entry 内文规范」一节统一接管。
 */

/* =========================================================================
   1. 页面骨架
   ========================================================================= */

/* 正文宽度跟随全站容器（.wrap = 1260px，扣掉两侧 24px padding 后 1212px）。
   原来锁 880px，在 1920 屏上左右各空 520px，正文区只占中间一半不到，
   图片、对比图、下载按钮全被挤在窄条里 —— 资源站的正文本来就该铺开。
   上限交给父级 .wrap，这里不再单独设死宽度。 */
.post {
	width: 100%;
	max-width: 100%;
	margin: 0 auto;
	padding: 26px 0 0;
}

/* 独立页面（隐私政策之类）正文可以更窄一点，读着舒服 */
.post--page {
	max-width: 820px;
}

/* =========================================================================
   2. 标题区
   ========================================================================= */

.post-hd {
	margin-bottom: 26px;
}

.post-cats {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 16px;
}

.chip-cat {
	background: var(--brand-soft);
	border-color: var(--brand-line);
	color: var(--brand);
	font-weight: 700;
}

.chip-cat:hover {
	background: var(--brand);
	border-color: var(--brand);
	color: var(--brand-ink);
}

.post-t {
	font-size: clamp(26px, 3.6vw, 40px);
	font-weight: 900;
	line-height: 1.28;
	letter-spacing: -.035em;
	margin-bottom: 18px;
	word-break: break-word;
}

.post-meta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 9px;
	font-size: 12.5px;
	color: var(--text-4);
}

.pm-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.pm-item a { color: var(--text-4); }
.pm-item a:hover { color: var(--brand); }

/* 头像：本地色块，不请求 Gravatar（国内基本超时） */
.fg-avatar {
	flex: none;
	display: inline-grid;
	place-items: center;
	width: var(--av-s, 40px);
	height: var(--av-s, 40px);
	border-radius: 50%;
	background: hsl(var(--av-h, 30), 38%, 20%);
	color: hsl(var(--av-h, 30), 68%, 72%);
	font-size: calc(var(--av-s, 40px) * .42);
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0;
	border: 1px solid hsl(var(--av-h, 30), 40%, 30%);
	user-select: none;
}

.pm-dot {
	width: 3px;
	height: 3px;
	border-radius: 50%;
	background: var(--line);
	flex: none;
}

.pm-updated { color: var(--text-4); }

/* =========================================================================
   3. 文章头图
   ========================================================================= */

.post-cover {
	margin: 0 0 30px;
	border-radius: var(--radius-lg);
	overflow: hidden;
	border: 1px solid var(--line-soft);
	background: var(--bg-elev);
	aspect-ratio: 16 / 9;
}

.post-cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* =========================================================================
   4. 正文内文规范
   ========================================================================= */

.entry {
	font-size: var(--read-font, 17px);
	font-weight: 400;
	line-height: 2.0;
	color: var(--text-2);
	letter-spacing: .01em;
}

.entry > *:first-child { margin-top: 0; }

.entry p {
	margin: 0 0 1.15em;
}

/*
 * 正文表格（0.5.12 补）
 *
 * 主题此前完全没有 table 样式，浏览器默认表格在手机上会直接撑破页面：
 * 「关于我们」的栏目表在 390px 视口下量到 674px，横向溢出。
 * display:block + overflow-x:auto 让表格自己滚，不带动整个文档。
 * 内部仍按 table 排布（tr/td 在块级容器里照样成立）。
 */
.entry table {
	display: block;
	width: 100%;
	max-width: 100%;
	overflow-x: auto;
	border-collapse: collapse;
	margin: 0 0 1.4em;
	font-size: .94em;
	line-height: 1.7;
	-webkit-overflow-scrolling: touch;
}

.entry table th,
.entry table td {
	padding: 10px 14px;
	border: 1px solid var(--line);
	text-align: left;
	vertical-align: top;
}

.entry table th {
	background: var(--bg-elev-2);
	color: var(--text);
	font-weight: 600;
}

.entry table tbody tr:nth-child(even) td {
	background: var(--line-soft);
}

.entry table caption {
	caption-side: top;
	padding: 0 0 8px;
	color: var(--text-3);
	font-size: .9em;
	text-align: left;
}

/*
 * 手机上表格改成卡片堆叠（0.5.14）
 *
 * 光让它横向滚动不够——390px 下 3 列表格第 2 列就被切一半、第 3 列完全
 * 看不见，等于把内容藏起来了。这里把每行拆成一张卡：第一列当标题（底色
 * 加深 + 加粗），其余列逐行排下来，一屏读完不用滑。
 * 表头藏掉，因为每张卡第一行已经承担了列名的作用。
 */
@media (max-width: 720px) {
	.entry table {
		display: block;
		overflow: visible;
		border: 0;
		margin-bottom: 1.2em;
	}

	.entry table thead {
		display: none;
	}

	.entry table tbody,
	.entry table tr,
	.entry table td {
		display: block;
		width: auto;
	}

	.entry table tr {
		margin: 0 0 14px;
		border: 1px solid var(--line);
		border-radius: 12px;
		overflow: hidden;
	}

	.entry table td {
		border: 0;
		border-top: 1px solid var(--line-soft);
		padding: 9px 14px;
		font-size: .95em;
	}

	.entry table td:first-child {
		border-top: 0;
		background: var(--bg-elev-2);
		color: var(--text);
		font-weight: 600;
		font-size: 1em;
	}

	.entry table tbody tr:nth-child(even) td {
		background: transparent;
	}

	.entry table tbody tr:nth-child(even) td:first-child {
		background: var(--bg-elev-2);
	}
}

/*
 * 历史包袱：库里几乎所有段落都被 <span style="font-size:20px"> 包着，
 * 还有一些 14pt / 18px 的杂牌。全部压回正文字号，靠标题层级做区分。
 *
 * 顶层那层 span 其实是「伪段落」（里面装的是一整段文字或一张图），
 * 但 span 是行内元素，里面的块级短代码块会被缩进半个字宽，
 * 所以顶层（.entry 的直接子元素）直接改成块级。内层 span 不动。
 */
.entry :where(span, p, div, li)[style*="font-size"] {
	font-size: inherit !important;
	line-height: inherit;
}

.entry > span[style*="font-size"] {
	display: block;
}

/* 内联颜色也一起归位，避免白底黑字混进深色版面 */
.entry span[style*="color"] { color: inherit !important; }

.entry a {
	color: var(--brand);
	text-decoration: underline;
	text-decoration-color: var(--brand-line);
	text-underline-offset: 3px;
	text-decoration-thickness: 1px;
	transition: all var(--t-fast) var(--ease);
}

.entry a:hover {
	color: var(--brand-dark);
	text-decoration-color: var(--brand);
}

/* 网盘 / 下载站链接：单独挑出来加底纹，一眼能认 */
.entry a[href*="pan.baidu"],
.entry a[href*="aliyundrive"],
.entry a[href*="alipan"],
.entry a[href*="quark"],
.entry a[href*="123pan"],
.entry a[href*="lanzou"],
.entry a[href*="caiyun"],
.entry a[href*="115.com"],
.entry a[href*="weiyun"],
.entry a[href*="ctfile"] {
	background: var(--brand-soft);
	border-bottom: 1px solid var(--brand-line);
	padding: 1px 4px;
	border-radius: 3px;
	text-decoration: none;
}

.entry a[href*="pan.baidu"]:hover,
.entry a[href*="aliyundrive"]:hover,
.entry a[href*="alipan"]:hover,
.entry a[href*="quark"]:hover,
.entry a[href*="123pan"]:hover,
.entry a[href*="lanzou"]:hover,
.entry a[href*="caiyun"]:hover {
	background: var(--brand);
	color: var(--brand-ink);
}

/*
 * Gutenberg 按钮块（正文里插入的「按钮」）
 *
 * 上面那套网盘链接底纹（.entry a[href*="pan.baidu"]，权重 0,2,1）
 * 会把按钮也一起命中：背景被压成 12% 透明金，而按钮自己的字色是深灰，
 * 结果就是暗底暗字、几乎看不见。
 * 这里用 0,3,2 的选择器整体接管，把按钮做回真正的按钮样子。
 */
.entry a.wp-block-button__link[href] {
	display: inline-block;
	background: var(--brand);
	background-image: none;
	color: var(--brand-ink);
	border: 1px solid var(--brand-dark);
	border-bottom-width: 1px;
	border-radius: 8px;
	padding: 11px 24px;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.45;
	letter-spacing: 0;
	text-decoration: none;
	box-shadow: none;
	transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}

.entry a.wp-block-button__link[href]:hover,
.entry a.wp-block-button__link[href]:focus {
	background: var(--brand-dark);
	color: var(--brand-ink);
	text-decoration: none;
	transform: translateY(-1px);
}

.entry .wp-block-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 1.4em 0;
}

.entry .wp-block-buttons .wp-block-button {
	margin: 0;
}

/* 按钮里的字不要被正文字重覆盖 */
.entry .wp-block-button__link,
.entry .wp-block-button__link * {
	-webkit-text-fill-color: currentColor;
}

/*
 * 正文自带页面级样式的文章（作者按「浅色底」写的那套，比如用 body.postid-XXX 限定）
 *
 * 在深色主题上，这些写死的深色字（#0d1117 / #0f1418 / #2D5A0A …）会直接隐形：
 * 它们对应的背景用的是 CSS 变量，变量一旦失效或没定义，背景就没了，
 * 只剩深色字贴在深色底上。这里按元素类型把颜色收回主题控制，
 * 只兜底颜色，不动字号、字重、间距。
 *
 * 前缀用 .site-main 是为了把权重提到 (0,3,1)，压过正文内联的 (0,2,2)。
 */
.site-main .entry strong,
.site-main .entry b {
	color: var(--text);
}

.site-main .entry h4,
.site-main .entry h5,
.site-main .entry h6 {
	color: var(--text);
}

/* 注意：正文里有 `h2:nth-of-type(N) ~ .wp-block-table th` 这类权重 (0,3,2) 的规则，
   光写 (0,3,1) 压不住，会被它的空变量顶成透明底。这里补到 (0,3,3)。 */
.site-main .entry .wp-block-table thead tr th {
	background: var(--bg-elev-2);
	color: var(--text);
	border-color: var(--line);
}

.site-main .entry .wp-block-table td {
	border-color: var(--line);
}

/* 正文原来给交替行的是 rgba(255,255,255,.55)——浅色底上等于没有，
   深色底上就成了一条灰带，配浅灰字几乎看不清。压回一层很淡的高光。 */
.site-main .entry .wp-block-table tr:nth-child(even) td {
	background: var(--tint);
}

.site-main .entry .wp-block-column p,
.site-main .entry .wp-block-column li {
	color: var(--text-2);
}

.site-main .entry .wp-block-column h3,
.site-main .entry .wp-block-column h4 {
	color: var(--brand);
}

.site-main .entry .wp-block-details summary,
.site-main .entry details summary {
	color: var(--text);
}

.site-main .entry blockquote,
.site-main .entry blockquote p,
.site-main .entry .wp-block-quote,
.site-main .entry .wp-block-quote p {
	color: var(--text-3);
}

.site-main .entry code {
	background: var(--bg-elev-2);
	color: var(--brand);
	border: 1px solid var(--line);
	border-radius: 4px;
	padding: 1px 5px;
}

/* —— 标题层级 —— */

.entry h2,
.entry h3,
.entry h4 {
	margin: 1.9em 0 .7em;
	line-height: 1.45;
	letter-spacing: -.01em;
	scroll-margin-top: 90px;
}

.entry h2 {
	font-size: 23px;
	font-weight: 700;
	padding-left: 13px;
	border-left: 3px solid var(--brand);
}

.entry h3 {
	font-size: 19px;
	font-weight: 700;
}

.entry h4 {
	font-size: 17px;
	font-weight: 700;
	color: var(--text-3);
}

/* —— 图片 —— */

.entry img {
	display: block;
	max-width: 100%;
	height: auto;
	margin: 1.5em auto;
	border-radius: var(--radius);
	border: 1px solid var(--line-soft);
	background: var(--bg-elev);
}

.entry a img { transition: opacity var(--t-fast) var(--ease); }
.entry a:hover img { opacity: .9; }

.entry img.aligncenter,
.entry .aligncenter {
	display: block;
	margin-left: auto;
	margin-right: auto;
}

.entry img.alignleft { float: left; margin: .4em 1.4em 1em 0; }
.entry img.alignright { float: right; margin: .4em 0 1em 1.4em; }

.entry .wp-caption,
.entry figure.wp-caption {
	max-width: 100%;
	margin: 1.5em auto;
}

.entry .wp-caption-text,
.entry figcaption {
	font-size: 12.5px;
	color: var(--text-4);
	text-align: center;
	margin-top: 8px;
	line-height: 1.6;
}

/* 老文章大量用 p.picbox / span.picinfo 做图注 */
.entry .picbox {
	text-align: center;
	margin: 1.6em 0;
}

.entry .picinfo {
	display: block;
	font-size: 12.5px !important;
	color: var(--text-4) !important;
	margin-top: 8px;
	line-height: 1.6;
}

/* —— 分割线：老文里靠 ===== 和 <hr> 分段，做得干净点 —— */

.entry hr {
	height: 1px;
	border: 0;
	margin: 2.4em 0;
	background: linear-gradient(90deg, transparent, var(--line) 18%, var(--line) 82%, transparent);
}

/* —— 引用 / 列表 / 表格 —— */

.entry blockquote {
	margin: 1.6em 0;
	padding: 14px 20px;
	background: var(--bg-elev);
	border-left: 3px solid var(--brand-line);
	border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
	color: var(--text-3);
	font-size: 16px;
}

.entry blockquote p:last-child { margin-bottom: 0; }

.entry ul,
.entry ol {
	padding-left: 1.5em;
	margin: 1.2em 0;
}

.entry li { margin-bottom: .55em; }

.entry table {
	width: 100%;
	border-collapse: collapse;
	margin: 1.6em 0;
	font-size: 14.5px;
	line-height: 1.7;
	display: block;
	overflow-x: auto;
	white-space: nowrap;
}

@media (min-width: 700px) {
	.entry table { display: table; white-space: normal; }
}

.entry th,
.entry td {
	border: 1px solid var(--line);
	padding: 9px 13px;
	text-align: left;
}

.entry th {
	background: var(--bg-elev-2);
	color: var(--text);
	font-weight: 700;
}

.entry tr:nth-child(even) td { background: rgba(255, 255, 255, .015); }

/* —— 视频 / 嵌入：B 站 iframe 按 16:9 自适应 —— */

/*
 * 注意：style.css 有一条全局 `iframe { height: auto }`，会把 iframe 的
 * height 属性顶掉。iframe 是替换元素、没有内在高度，auto 会掉到浏览器
 * 默认的 150px —— 正文里的视频就变成一条扁黑块。所以这里必须显式给
 * aspect-ratio，让宽度决定高度。
 */
.entry iframe {
	display: block;
	width: 100%;
	max-width: 100%;
	aspect-ratio: 16 / 9;
	height: auto;
	margin: 1.6em auto;
	border: 0;
	border-radius: var(--radius);
	background: #000;
}

/*
 * 从 B 站专栏粘过来的播放器（inc/video-embed.php 会给它挂 .fg-embed）。
 *
 * 以前这里限 640px，理由是「让它像个窗，别又一块满宽图」。但站里还有
 * [bilibili] 短代码出的满宽播放器（.sc-video，见文件末尾），同一篇文章里
 * 两种尺寸并排出现，看着像排版坏了、视频被压小了。
 * 2026-11-01 用户要求统一成满宽 → 0.5.18 起这里不再收窄。
 * 手机上宽度本来就是 100%，这条改动只影响桌面。
 */
.entry iframe.fg-embed {
	max-width: 100%;
}

/*
 * 抖音是竖屏源，塞进 16:9 的框里左右全是黑边、画面只剩中间一条。
 * 单独给它 9:16，宽度也收窄，视觉高度和横屏 720 宽的那档差不多。
 */
.entry iframe.fg-embed--douyin {
	max-width: 380px;
	aspect-ratio: 9 / 16;
}

/*
 * 标题下方的视频区（inc/post-meta.php → fgamer_the_video()）。
 *
 * 这块对应老主题的 .single-article__video：视频存在文章 meta 的 video 字段里，
 * 不在正文，所以不能被 .entry 前缀的规则命中，尺寸得在这里重给一份。
 */
.fg-video-hero {
	margin: 22px 0 26px;
}

.fg-video-hero iframe {
	display: block;
	width: 100%;
	max-width: 100%;
	aspect-ratio: 16 / 9;
	height: auto;
	margin: 0 auto;
	border: 0;
	border-radius: var(--radius);
	background: #000;
}

.fg-video-hero iframe.fg-embed--douyin {
	max-width: 380px;
	aspect-ratio: 9 / 16;
}

.fg-video-hero .fg-video-native {
	display: block;
	width: 100%;
	max-width: 100%;
	aspect-ratio: 16 / 9;
	height: auto;
	margin: 0 auto;
	border-radius: var(--radius);
	background: #000;
}

/*
 * 副标题：标题下方一行小字，老主题允许单独配色，颜色走内联 style。
 */
.post-sub {
	margin: 10px 0 0;
	font-size: 15px;
	line-height: 1.7;
	color: var(--text-dim);
	font-weight: 400;
}

/*
 * 图片无缝：老主题的 img_seamless 开关，配图连续排列时不留缝。
 */
.entry.img-seamless .wp-block-image,
.entry.img-seamless p > img,
.entry.img-seamless figure {
	margin-top: 0;
	margin-bottom: 0;
}

.entry.img-seamless img {
	border-radius: 0;
	vertical-align: bottom;
}

.entry .wp-block-embed,
.entry .video-player {
	position: relative;
	padding-bottom: 56.25%;
	height: 0;
	margin: 1.6em 0;
	overflow: hidden;
	border-radius: var(--radius);
	background: #000;
}

.entry .wp-block-embed iframe,
.entry .video-player iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
}

.entry code {
	font-family: var(--mono);
	font-size: .88em;
	background: var(--bg-elev-2);
	border: 1px solid var(--line-soft);
	border-radius: 4px;
	padding: 2px 6px;
	color: var(--brand);
}

.entry pre {
	background: var(--bg-elev);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 16px 18px;
	overflow-x: auto;
	margin: 1.6em 0;
	line-height: 1.7;
}

.entry pre code {
	background: none;
	border: 0;
	padding: 0;
	color: var(--text-2);
}

/* 正文分页（<!--nextpage-->） */
.post-pagelinks {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 2em 0;
	font-size: 13px;
}

.post-pagelinks a,
.post-pagelinks > span {
	padding: 5px 12px;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	color: var(--text-3);
}

/* =========================================================================
   5. 文末：标签 + B 站卡
   ========================================================================= */

.post-ft {
	margin-top: 40px;
	padding-top: 28px;
	border-top: 1px solid var(--line-soft);
}

.post-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 28px;
}

.bili-card {
	display: flex;
	align-items: center;
	gap: 15px;
	padding: 18px 20px;
	background: linear-gradient(135deg, rgba(232, 163, 61, .09), rgba(232, 163, 61, .02));
	border: 1px solid var(--brand-line);
	border-radius: var(--radius-lg);
}

.bili-ico {
	display: grid;
	place-items: center;
	width: 42px;
	height: 42px;
	flex: none;
	border-radius: 12px;
	background: var(--brand-soft);
	color: var(--brand);
}

.bili-txt {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.bili-txt strong {
	color: var(--text);
	font-size: 15px;
	font-weight: 700;
	letter-spacing: -.01em;
}

.bili-txt span {
	font-size: 12.5px;
	color: var(--text-4);
	line-height: 1.55;
}

.bili-btn { flex: none; }

/* =========================================================================
   6. 上下篇
   ========================================================================= */

.post-nav {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px;
	max-width: 100%;
	margin: 40px auto 0;
}

.pn {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 16px 18px;
	background: var(--bg-elev);
	border: 1px solid var(--line-soft);
	border-radius: var(--radius);
	transition: all var(--t-fast) var(--ease);
	min-width: 0;
}

.pn:hover {
	border-color: var(--brand-line);
	background: var(--bg-elev-2);
}

.pn-lb {
	font-size: 11.5px;
	color: var(--text-4);
	letter-spacing: .04em;
}

.pn-t {
	font-size: 14.5px;
	color: var(--text-2);
	font-weight: 500;
	line-height: 1.55;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.pn:hover .pn-t { color: var(--brand); }

.pn-next {
	text-align: right;
	grid-column: 2;
}

/* 只有一篇时占满整行 */
.post-nav > .pn:only-child {
	grid-column: 1 / -1;
	text-align: left;
}

/* =========================================================================
   7. 相关文章
   ========================================================================= */

/* 相关文章铺三列，但外框要和正文等宽，否则左右会比正文宽出一截 */
.related {
	max-width: 100%;
	margin: 52px auto 0;
}

.related-hd {
	font-size: 17px;
	font-weight: 700;
	letter-spacing: -.01em;
	margin-bottom: 18px;
	display: flex;
	align-items: center;
	gap: 10px;
}

.related-hd::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--line-soft);
}

/* =========================================================================
   8. 评论
   ========================================================================= */

.comments-area {
	margin: 54px auto 20px;
	max-width: 100%;
}

.comments-hd,
.comment-reply-title {
	font-size: 17px;
	font-weight: 700;
	margin-bottom: 20px;
	display: flex;
	align-items: center;
	gap: 9px;
}

.comments-count {
	display: inline-grid;
	place-items: center;
	min-width: 22px;
	height: 20px;
	padding: 0 7px;
	border-radius: 10px;
	background: var(--bg-elev-2);
	font-size: 11.5px;
	color: var(--text-3);
	font-weight: 500;
}

.comment-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.comment-list .children {
	list-style: none;
	margin: 0;
	padding-left: 26px;
}

.cm-item {
	display: flex;
	gap: 13px;
	padding: 18px 0;
	border-top: 1px solid var(--line-soft);
}

.cm-item:first-child { border-top: 0; }

.cm-avatar {
	flex: none;
	display: block;
}

.cm-main { flex: 1; min-width: 0; }

.cm-head {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 14px;
	margin-bottom: 7px;
}

.cm-name {
	font-size: 13.5px;
	font-weight: 700;
	color: var(--text);
}

.cm-name a { color: var(--text); }
.cm-name a:hover { color: var(--brand); }

.cm-time {
	font-size: 11.5px;
	color: var(--text-4);
}

.cm-text {
	font-size: 14.5px;
	line-height: 1.85;
	color: var(--text-2);
}

.cm-text p:last-child { margin-bottom: 0; }

.cm-actions {
	margin-top: 8px;
	font-size: 12.5px;
}

.cm-actions a { color: var(--text-4); }
.cm-actions a:hover { color: var(--brand); }

.cm-note {
	margin-top: 24px;
	padding: 20px 22px;
	background: var(--bg-elev);
	border: 1px solid var(--line-soft);
	border-radius: var(--radius);
	line-height: 1.75;
}

.cm-note > *:last-child { margin-bottom: 0; }

.cm-note__t {
	margin: 0 0 8px;
	font-size: 15px;
	font-weight: 700;
	color: var(--text);
	letter-spacing: .01em;
}

.cm-note__d {
	margin: 0;
	font-size: 13.5px;
	font-weight: 300;
	color: var(--text-4);
}

.cm-note__a {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 16px 0 0;
}

.cm-note a {
	color: var(--brand);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.cm-note__a .btn {
	text-decoration: none;
}

.cm-mod {
	font-size: 12px;
	color: var(--warn);
	margin: 0 0 6px;
}

/* —— 评论表单 —— */

.comment-form {
	margin-top: 26px;
	padding: 22px;
	background: var(--bg-elev);
	border: 1px solid var(--line-soft);
	border-radius: var(--radius-lg);
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.comment-notes {
	font-size: 12.5px;
	color: var(--text-4);
	margin: 0 0 4px;
}

.comment-form p { margin: 0; }

.comment-form label {
	display: block;
	font-size: 12.5px;
	color: var(--text-3);
	margin-bottom: 6px;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
	width: 100%;
	background: var(--bg-elev-2);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	padding: 11px 13px;
	color: var(--text);
	font-size: 14px;
	line-height: 1.7;
	transition: border-color var(--t-fast) var(--ease);
}

.comment-form input:focus,
.comment-form textarea:focus {
	outline: none;
	border-color: var(--brand-line);
	box-shadow: 0 0 0 3px var(--brand-soft);
}

.comment-form textarea { min-height: 120px; resize: vertical; }

.comment-form .comment-form-cookies-consent {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 12.5px;
	color: var(--text-4);
}

.comment-form .comment-form-cookies-consent label {
	margin: 0;
	font-size: 12.5px;
	color: var(--text-4);
}

.comment-form .submit {
	align-self: flex-start;
	cursor: pointer;
}

/* =========================================================================
   9. 404
   ========================================================================= */

.nf {
	max-width: 640px;
	margin: 60px auto 0;
	text-align: center;
}

.nf-code {
	font-size: clamp(72px, 14vw, 120px);
	font-weight: 900;
	line-height: 1;
	letter-spacing: -.06em;
	margin: 0 0 10px;
	background: linear-gradient(180deg, var(--brand), rgba(232, 163, 61, .12));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.nf-t {
	font-size: 22px;
	font-weight: 900;
	margin-bottom: 10px;
}

.nf-d {
	font-size: 14px;
	color: var(--text-4);
	line-height: 1.85;
	max-width: 460px;
	margin: 0 auto 26px;
}

.nf-search {
	display: flex;
	gap: 9px;
	max-width: 440px;
	margin: 0 auto 22px;
}

.nf-search input {
	flex: 1;
	min-width: 0;
	background: var(--bg-elev);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	padding: 0 14px;
	height: 40px;
	color: var(--text);
	font-size: 14px;
}

.nf-search input:focus {
	outline: none;
	border-color: var(--brand-line);
	box-shadow: 0 0 0 3px var(--brand-soft);
}

.nf-links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 9px;
}

/* =========================================================================
   10. 响应式
   ========================================================================= */

@media (max-width: 900px) {
	.entry { font-size: calc(var(--read-font, 17px) - .5px); line-height: 1.95; }
	.entry h2 { font-size: 21px; }
	.entry h3 { font-size: 18px; }
}

@media (max-width: 620px) {
	.post { padding-top: 14px; }
	.post-t { font-size: 23px; letter-spacing: -.02em; }
	.post-meta { font-size: 12px; gap: 7px; }

	/* 手机上头图贴边满宽，视觉上更有分量 */
	.post-cover {
		margin-left: -16px;
		margin-right: -16px;
		border-radius: 0;
		border-left: 0;
		border-right: 0;
	}

	.entry { font-size: 16px; line-height: 1.92; }
	.entry img { border-radius: var(--radius-sm); }

	.bili-card {
		flex-wrap: wrap;
		padding: 16px;
	}

	.bili-txt { flex: 1 1 100%; order: 3; }
	.bili-btn { margin-left: auto; }

	.post-nav { grid-template-columns: 1fr; }
	.pn-next { grid-column: 1; text-align: left; }

	.comment-list .children { padding-left: 12px; }
	.comment-form { padding: 16px; }
	.nf { margin-top: 36px; }
}

/* =========================================================================
   11. 短代码（老文章 c-downbtn / bilibili / alert 等）
   规则写在 inc/shortcodes.php 里对应的标记上
   ========================================================================= */

/* —— 下载按钮 —— */

/* 这些块是 <span>：正文被 wpautop 包在 <p> 里，用 div 会被浏览器拆标签 */
.sc-download {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 1em 0;
	padding: 14px 16px;
	background: var(--bg-elev);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}

.sc-download:hover {
	border-color: var(--brand-line);
	background: var(--bg-elev-2);
}

.sc-download__icon {
	flex: none;
	display: grid;
	place-items: center;
	width: 46px;
	height: 46px;
	border-radius: 10px;
	background: var(--bg-elev-2);
	border: 1px solid var(--line-soft);
}

.sc-download__icon img {
	width: 26px;
	height: 26px;
	margin: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: none !important;
}

.sc-download__info {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-width: 0;
}

.sc-download__title {
	display: block;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.5;
	color: var(--text);
}

/* 优先级要压过 .entry a[href*="pan.baidu"] 那套下载链接底纹，
   否则按钮和标题会各套一层琥珀底色，糊成一片 */
.entry .sc-download .sc-download__title a,
.entry .sc-download .sc-download__title a:hover {
	color: var(--text);
	text-decoration: none;
	background: none;
	padding: 0;
	border: 0;
	border-radius: 0;
}

.entry .sc-download .sc-download__title a:hover { color: var(--brand); }

.sc-download__source {
	display: block;
	margin-top: 3px;
	font-size: 12px;
	color: var(--text-4);
	line-height: 1.5;
}

.sc-download__pwd {
	font-family: var(--mono);
	font-size: 12.5px;
	color: var(--brand);
	letter-spacing: .04em;
	user-select: all;
}

.entry .sc-download .sc-download__btn,
.entry .sc-download .sc-download__btn:hover {
	flex: none;
	display: inline-flex;
	align-items: center;
	height: 34px;
	padding: 0 15px;
	border-radius: var(--radius-sm);
	background: var(--brand);
	color: var(--brand-ink) !important;
	font-size: 13px;
	font-weight: 700;
	text-decoration: none !important;
	border: 0;
	white-space: nowrap;
	transition: background var(--t-fast) var(--ease);
}

.entry .sc-download .sc-download__btn:hover { background: var(--brand-dark); }

/* —— B 站视频 —— */

.sc-video {
	display: block;
	position: relative;
	padding-bottom: 56.25%;
	height: 0;
	margin: 1.6em 0;
	overflow: hidden;
	border-radius: var(--radius);
	background: #000;
	border: 1px solid var(--line-soft);
}

/*
 * 短代码 [bilibili] 出的播放器：容器自己用 padding-bottom 撑 16:9，
 * iframe 绝对定位填满。这里 max-width 必须显式 none，否则会被上面
 * .fg-embed 的 720 宽小窗规则抓住，变成靠左一条、右边空一块。
 */
.entry .sc-video iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	border: 0;
}

/* —— 提示框 —— */

.sc-alert {
	display: flex;
	gap: 12px;
	margin: 1.5em 0;
	padding: 15px 17px;
	border-radius: var(--radius);
	border: 1px solid var(--line);
	background: var(--bg-elev);
	font-size: 15px;
	line-height: 1.8;
}

.sc-alert__icon {
	flex: none;
	width: 20px;
	height: 20px;
	margin-top: 3px;
}

.sc-alert__icon svg {
	width: 100%;
	height: 100%;
	display: block;
}

.sc-alert__content {
	display: block;
	flex: 1;
	min-width: 0;
	color: var(--text-2);
}

.sc-alert__content > :last-child { margin-bottom: 0; }

.sc-alert--info {
	background: rgba(86, 156, 214, .07);
	border-color: rgba(86, 156, 214, .3);
}
.sc-alert--info .sc-alert__icon { color: #6cb0e8; }

.sc-alert--success {
	background: rgba(74, 222, 128, .07);
	border-color: rgba(74, 222, 128, .28);
}
.sc-alert--success .sc-alert__icon { color: var(--ok); }

.sc-alert--warning {
	background: rgba(251, 191, 36, .07);
	border-color: rgba(251, 191, 36, .3);
}
.sc-alert--warning .sc-alert__icon { color: var(--warn); }

.sc-alert--danger {
	background: rgba(248, 113, 113, .08);
	border-color: rgba(248, 113, 113, .32);
}
.sc-alert--danger .sc-alert__icon { color: var(--danger); }

/* 浅色下提示条要重配一遍：7% 的彩色底压在白底上等于没有，
   图标用的又是亮色（#6cb0e8 那种），亮蓝配白底几乎看不见。
   底色调成实色的淡版、图标换成深色，边框略加深保证轮廓在。 */
html[data-theme="light"] .sc-alert--info {
	background: rgba(37, 99, 167, .06);
	border-color: rgba(37, 99, 167, .22);
}
html[data-theme="light"] .sc-alert--info .sc-alert__icon { color: #1d4ed8; }

html[data-theme="light"] .sc-alert--success {
	background: rgba(21, 128, 61, .06);
	border-color: rgba(21, 128, 61, .22);
}

html[data-theme="light"] .sc-alert--warning {
	background: rgba(161, 98, 7, .07);
	border-color: rgba(161, 98, 7, .24);
}

html[data-theme="light"] .sc-alert--danger {
	background: rgba(185, 28, 28, .06);
	border-color: rgba(185, 28, 28, .22);
}

/* —— 面板 —— */

.sc-plane {
	display: block;
	margin: 1.6em 0;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--bg-elev);
}

.sc-plane__hd {
	display: block;
	padding: 11px 16px;
	background: var(--bg-elev-2);
	border-bottom: 1px solid var(--line);
	font-size: 13.5px;
	font-weight: 700;
	color: var(--text);
	letter-spacing: -.01em;
}

.sc-plane__body {
	display: block;
	padding: 16px;
	font-size: 15.5px;
	line-height: 1.9;
}

.sc-plane__body > :last-child { margin-bottom: 0; }

.sc-plane__body > .sc-download:first-child { margin-top: 0; }
.sc-plane__body > .sc-download:last-child { margin-bottom: 0; }

/* —— 引导块 start-plane —— */

.sc-start {
	display: block;
	position: relative;
	margin: 1.6em 0;
	padding: 15px 18px 15px 20px;
	background: var(--brand-soft);
	border-left: 3px solid var(--brand);
	border-radius: 0 var(--radius) var(--radius) 0;
	font-size: 15.5px;
	line-height: 1.9;
	color: var(--text-2);
}

.sc-start__body {
	display: block;
}

.sc-start__body > :last-child { margin-bottom: 0; }

/* type 2 走另一档强调度 */
.sc-start--2 {
	background: rgba(86, 156, 214, .07);
	border-left-color: #6cb0e8;
}

/* —— 折叠 —— */

.sc-collapse {
	margin: 1.5em 0;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--bg-elev);
	overflow: hidden;
}

.sc-collapse__hd {
	cursor: pointer;
	padding: 12px 16px;
	font-size: 14px;
	font-weight: 700;
	color: var(--text-3);
	list-style: none;
	display: flex;
	align-items: center;
	gap: 9px;
	transition: color var(--t-fast) var(--ease);
}

.sc-collapse__hd::-webkit-details-marker { display: none; }

.sc-collapse__hd::before {
	content: "";
	width: 0;
	height: 0;
	border-left: 5px solid currentColor;
	border-top: 4px solid transparent;
	border-bottom: 4px solid transparent;
	flex: none;
	transition: transform var(--t-fast) var(--ease);
}

.sc-collapse[open] .sc-collapse__hd::before { transform: rotate(90deg); }

.sc-collapse__hd:hover { color: var(--brand); }

.sc-collapse[open] .sc-collapse__hd {
	border-bottom: 1px solid var(--line-soft);
	color: var(--text);
}

.sc-collapse__body {
	padding: 15px 16px;
	font-size: 15.5px;
	line-height: 1.9;
}

.sc-collapse__body > :last-child { margin-bottom: 0; }

/* —— 图标链接 —— */

.sc-icon-url {
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

@media (max-width: 620px) {
	.sc-download {
		flex-wrap: wrap;
		padding: 13px;
		gap: 12px;
	}

	.sc-download__btn {
		width: 100%;
		justify-content: center;
	}

	.sc-download__icon {
		width: 40px;
		height: 40px;
	}

	.sc-alert { font-size: 14.5px; padding: 13px 14px; }
}

/* =========================================================================
   12. 正文图片灯箱
   -------------------------------------------------------------------------
   原来点正文图会直接跳到原图，浏览器裸看图没有关闭按钮、返回还得按后退。
   这里换成页面内放大：右上角一颗明显的关闭按钮，点背景和 ESC 也能关。
   脚本在 assets/js/main.js 末尾，找不到 .entry 就不启用。
   ========================================================================= */

.fg-lb {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 28px;
	background: rgba(6, 8, 12, .94);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
}

.fg-lb.is-open {
	display: flex;
	animation: fg-lb-in .16s ease;
}

@keyframes fg-lb-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

/* 打开灯箱时锁住页面滚动，免得背后跟着滑 */
body.fg-lb-lock {
	overflow: hidden;
}

.fg-lb__img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 24px 70px rgba(0, 0, 0, .65);
	cursor: default;
}

/* 大图没回来之前只压一点亮度。
   原来这里是 opacity .55 + blur(1px)：手机上 DPR 3 时 1px 模糊等于 3 个物理像素，
   整张图糊成一团；再叠在 94% 的黑蒙层上，就成了「又暗又糊」。
   现在只留轻微透明度，不留模糊——宁可看见，也别糊。 */
.fg-lb__img.is-loading {
	opacity: .82;
}

/* 加载指示：转圈。
   正文里那张图会立刻顶上来，正常情况几乎看不到它；
   只有在原图迟迟不来、又没有小图可顶时，才靠它说明「在加载，不是坏了」。 */
.fg-lb__spin {
	position: absolute;
	inset: 0;
	width: 34px;
	height: 34px;
	margin: auto;
	border: 3px solid rgba(255, 255, 255, .22);
	border-top-color: var(--brand);
	border-radius: 50%;
	animation: fg-lb-spin .75s linear infinite;
	pointer-events: none;
}

@keyframes fg-lb-spin {
	to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
	.fg-lb__spin { animation-duration: 2.4s; }
}

.fg-lb__close {
	position: absolute;
	top: 20px;
	right: 20px;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, .22);
	border-radius: 50%;
	background: rgba(18, 20, 26, .82);
	color: #f2f4f8;
	cursor: pointer;
	transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.fg-lb__close:hover {
	background: var(--brand);
	border-color: var(--brand);
	color: var(--brand-ink);
	transform: scale(1.06);
}

.fg-lb__close:focus-visible {
	outline: 2px solid var(--brand);
	outline-offset: 3px;
}

@media (max-width: 640px) {
	.fg-lb {
		padding: 0;
		/* 蒙层本来就 94% 不透明，模糊背景毫无意义；
		   而安卓上 backdrop-filter 会牵扯子元素合成层，图片跟着一起发糊。 */
		background: rgba(6, 8, 12, .96);
		-webkit-backdrop-filter: none;
		backdrop-filter: none;
	}

	.fg-lb__img {
		border-radius: 0;
		box-shadow: none;
	}

	/* 手机上按钮贴到刘海/圆角之外不安全，留安全区内边距 */
	.fg-lb__close {
		top: calc(14px + env(safe-area-inset-top, 0px));
		right: calc(14px + env(safe-area-inset-right, 0px));
		width: 48px;
		height: 48px;
	}
}

/* =========================================================================
   文末「延伸阅读」卡片（0.5.17，见 inc/guides.php）
   —— 给支柱长文做站内反链用的。
   不能做成普通文字链接：读者一眼扫过去就滑走了，链接也就白加了。
   做成一张比正文亮一档、带主色描边的卡，和正文有明显分层。
   配色全部走变量，深浅两套皮肤自动跟着变，这里不写死任何一个颜色。
   ========================================================================= */

.guide-more {
	margin: 44px 0 6px;
	padding-top: 22px;
	border-top: 1px solid var(--line);
}

.guide-more__k {
	margin-bottom: 10px;
	font-size: 12px;
	letter-spacing: .14em;
	color: var(--text-4);
}

.guide-more__card {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 18px 20px;
	border: 1px solid var(--brand-line);
	border-radius: 14px;
	background:
		linear-gradient(135deg, var(--brand-soft), transparent 62%),
		var(--bg-elev);
	text-decoration: none;
	transition: border-color .18s ease, transform .18s ease;
}

.guide-more__card:hover {
	border-color: var(--brand);
	transform: translateY(-1px);
}

/* min-width:0 是必须的：flex 子项默认 min-width:auto，
   长标题在里面撑不出省略号，只会在手机上把整行顶宽 */
.guide-more__main {
	flex: 1;
	min-width: 0;
}

.guide-more__t {
	font-size: 16px;
	font-weight: 600;
	line-height: 1.45;
	color: var(--text);
}

.guide-more__d {
	margin-top: 5px;
	font-size: 13.5px;
	line-height: 1.55;
	color: var(--text-3);
}

.guide-more__m {
	margin-top: 8px;
	font-size: 12px;
	letter-spacing: .03em;
	color: var(--brand);
}

.guide-more__go {
	flex: none;
	font-size: 18px;
	color: var(--brand);
}

@media (max-width: 560px) {
	.guide-more {
		margin-top: 34px;
	}

	.guide-more__card {
		gap: 10px;
		padding: 15px 16px;
	}

	.guide-more__t {
		font-size: 15px;
	}

	/* 手机上横向空间紧，箭头纯装饰，去掉换个清爽 */
	.guide-more__go {
		display: none;
	}
}
