~cytrogen/blog-public

ref: 88eebf3dfdd8ab819fa1a84e1976a8a75d5af2b6 blog-public/posts/e068.html -rw-r--r-- 25.1 KiB
88eebf3dCytrogen Deploy 2026-02-19 08:34:27 3 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<!DOCTYPE html><html lang="zh" data-theme="dark"><head><meta charset="utf-8"><meta name="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1"><title>孩童和恐怖游戏 · Cytrogen 的个人博客</title><meta name="description" content="妹妹一直都有在玩 Roblox(罗布乐思)这款游戏,因为她很想和我一起玩,所以我花了一天时间陪她。其中有个游戏叫做 99 Nights at Forest,貌似近期在孩子们之间十分流行。"><link rel="icon" href="../favicon.png"><link rel="canonical" href="https://cytrogen.icu/posts/e068.html"><link rel="webmention" href="https://webmention.io/cytrogen.icu/webmention"><link rel="me" href="https://m.otter.homes/@Cytrogen"><link rel="me" href="https://github.com/cytrogen"><meta name="fediverse:creator" content="@Cytrogen@m.otter.homes"><link rel="preload" href="../fonts/opensans-regular-latin.woff2" as="font" type="font/woff2" crossorigin="anonymous"><style>@font-face {
  font-family: 'Open Sans';
  src: url('../fonts/opensans-regular-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  size-adjust: 107%;
  ascent-override: 97%;
  descent-override: 25%;
  line-gap-override: 0%;
}
</style><script>(function() {
  try {
    // 优先级:用户选择 > 系统偏好 > 默认浅色
    const saved = localStorage.getItem('theme');
    const theme = saved || 
      (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
    
    document.documentElement.setAttribute('data-theme', theme);
    document.documentElement.style.colorScheme = theme;
  } catch (error) {
    // 失败时使用默认主题,不阻塞渲染
    document.documentElement.setAttribute('data-theme', 'light');
  }
})();
</script><link rel="stylesheet" href="../css/ares.css"><script data-netlify-skip-bundle="true">(function() {
  document.addEventListener('DOMContentLoaded', function() {
    const theme = document.documentElement.getAttribute('data-theme');
    const pageWrapper = document.getElementById('page-wrapper');
    if (pageWrapper && theme) {
      pageWrapper.setAttribute('data-theme', theme);
    }
  });
})();

</script><!-- hexo injector head_end start -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css">

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/hexo-math@4.0.0/dist/style.css">
<!-- hexo injector head_end end --><meta name="generator" content="Hexo 8.1.1"><link rel="alternate" href="atom.xml" title="Cytrogen 的个人博客" type="application/atom+xml">
</head><body><div id="page-wrapper"><a class="skip-link" href="#main-content">跳到主要内容</a><div class="wrap"><header><a class="logo-link" href="../index.html"><img src="../favicon.png" alt="logo"></a><div class="h-card visually-hidden"><img class="u-photo" src="https://cytrogen.icu/favicon.png" alt="Cytrogen"><a class="p-name u-url u-uid" href="https://cytrogen.icu">Cytrogen</a><p class="p-note">Cytrogen 的个人博客,Cytrogen's Blog</p><a class="u-url" rel="me noopener" target="_blank" href="https://m.otter.homes/@Cytrogen">Mastodon</a><a class="u-url" rel="me noopener" target="_blank" href="https://github.com/cytrogen">GitHub</a></div><nav class="site-nav"><div class="nav-main"><div class="nav-primary"><ul class="nav-list hidden-mobile"><li class="nav-item"><a class="nav-link" href="../index.html">首页</a></li></ul><div class="nav-tools"><div class="language-menu"><button class="language-toggle" type="button"><svg class="icon icon-globe" width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true" focusable="false"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm7.5-6.923c-.67.204-1.335.82-1.887 1.855A7.97 7.97 0 0 0 5.145 4H7.5V1.077zM4.09 4a9.267 9.267 0 0 1 .64-1.539 6.7 6.7 0 0 1 .597-.933A7.025 7.025 0 0 0 2.255 4H4.09zm-.582 3.5c.03-.877.138-1.718.312-2.5H1.674a6.958 6.958 0 0 0-.656 2.5h2.49zM4.847 5a12.5 12.5 0 0 0-.338 2.5H7.5V5H4.847zM8.5 5v2.5h2.99a12.495 12.495 0 0 0-.337-2.5H8.5zM4.51 8.5a12.5 12.5 0 0 0 .337 2.5H7.5V8.5H4.51zm3.99 0V11h2.653c.187-.765.306-1.608.338-2.5H8.5zM5.145 12c.138.386.295.744.468 1.068.552 1.035 1.218 1.65 1.887 1.855V12H5.145zm.182 2.472a6.696 6.696 0 0 1-.597-.933A9.268 9.268 0 0 1 4.09 12H2.255a7.024 7.024 0 0 0 3.072 2.472zM3.82 11a13.652 13.652 0 0 1-.312-2.5h-2.49c.062.89.291 1.733.656 2.5H3.82zm6.853 3.472A7.024 7.024 0 0 0 13.745 12H11.91a9.27 9.27 0 0 1-.64 1.539 6.688 6.688 0 0 1-.597.933zM8.5 12v2.923c.67-.204 1.335-.82 1.887-1.855A7.97 7.97 0 0 0 10.855 12H8.5zm3.68-1h2.146c.365-.767.594-1.61.656-2.5h-2.49a13.65 13.65 0 0 1-.312 2.5zm2.802-3.5a6.959 6.959 0 0 0-.656-2.5H12.18c.174.782.282 1.623.312 2.5h2.49zM11.27 2.461c.247.464.462.98.64 1.539h1.835a7.024 7.024 0 0 0-3.072-2.472c.218.284.418.598.597.933zM10.855 4a7.966 7.966 0 0 0-.468-1.068C9.835 1.897 9.17 1.282 8.5 1.077V4h2.355z"></path></svg><span>中文</span></button><div class="language-dropdown"></div></div></div><div class="nav-controls"><div class="more-menu hidden-mobile"><button class="more-toggle" type="button"><span>更多</span><svg class="icon icon-chevron-down" width="12" height="12" viewBox="0 0 12 12" fill="currentColor" aria-hidden="true" focusable="false"><path d="M6 8.825c-.2 0-.4-.1-.5-.2l-3.3-3.3c-.3-.3-.3-.8 0-1.1s.8-.3 1.1 0l2.7 2.7 2.7-2.7c.3-.3.8-.3 1.1 0s.3.8 0 1.1l-3.3 3.3c-.1.1-.3.2-.5.2z"></path></svg></button><div class="more-dropdown"><ul class="dropdown-list"><li class="dropdown-item"><a class="nav-link" href="../archives/index.html">归档</a></li><li class="dropdown-item"><a class="nav-link" href="../categories/index.html">分类</a></li><li class="dropdown-item"><a class="nav-link" href="../tags/index.html">标签</a></li><li class="dropdown-item"><a class="nav-link" href="../about/index.html">关于</a></li><li class="dropdown-item"><a class="nav-link" href="../sitemap/index.html">领地地图</a></li></ul></div></div><div class="theme-switcher"><button class="theme-toggle" type="button" role="switch" aria-pressed="false" aria-label="切换主题"><div class="theme-icon moon-icon"><svg class="icon icon-moon" width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true" focusable="false"><path d="M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278z"></path></svg></div><div class="theme-icon sun-icon"><svg class="icon icon-sun" width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true" focusable="false"><path d="M8 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0 1a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z"></path></svg></div></button></div><details class="mobile-menu-details hidden-desktop"><summary class="hamburger-menu" aria-label="nav.menu"><svg class="icon icon-bars" width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true" focusable="false"><path d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5z"></path></svg><span class="menu-text">nav.menu</span></summary><div class="mobile-menu-dropdown"><ul class="mobile-nav-list"><li class="mobile-nav-item"><a class="mobile-nav-link" href="../index.html">首页</a></li><li class="mobile-nav-item"><a class="mobile-nav-link" href="../archives/index.html">归档</a></li><li class="mobile-nav-item"><a class="mobile-nav-link" href="../categories/index.html">分类</a></li><li class="mobile-nav-item"><a class="mobile-nav-link" href="../tags/index.html">标签</a></li><li class="mobile-nav-item"><a class="mobile-nav-link" href="../about/index.html">关于</a></li><li class="mobile-nav-item"><a class="mobile-nav-link" href="../sitemap/index.html">领地地图</a></li></ul></div></details></div></div></div></nav></header><main class="container" id="main-content" tabindex="-1"><div class="post"><article class="post-block h-entry"><div class="post-meta p-author h-card visually-hidden"><img class="author-avatar u-photo" src="../favicon.png" alt="Cytrogen"><span class="p-name">Cytrogen</span><a class="u-url" href="https://cytrogen.icu">https://cytrogen.icu</a></div><a class="post-permalink u-url u-uid visually-hidden" href="https://cytrogen.icu/posts/e068.html">永久链接</a><div class="p-summary visually-hidden"><p>妹妹一直都有在玩 Roblox(罗布乐思)这款游戏,因为她很想和我一起玩,所以我花了一天时间陪她。其中有个游戏叫做 <em>99 Nights at Forest</em>,貌似近期在孩子们之间十分流行。</p></div><div class="visually-hidden"><a class="p-category" href="../categories/%E4%B8%AA%E4%BA%BA%E9%9A%8F%E6%83%B3/">个人随想</a><a class="p-category" href="../tags/%E5%BF%83%E7%90%86%E5%AD%A6/">心理学</a></div><h1 class="post-title p-name">孩童和恐怖游戏</h1><div class="post-info"><time class="post-date dt-published" datetime="2025-11-02T05:20:14.000Z">11/2/2025</time><time class="dt-updated visually-hidden" datetime="2026-02-09T17:16:55.213Z"></time></div><div class="post-content e-content"><html><head></head><body><p>妹妹一直都有在玩 Roblox(罗布乐思)这款游戏,因为她很想和我一起玩,所以我花了一天时间陪她。其中有个游戏叫做 <em>99 Nights at Forest</em>,貌似近期在孩子们之间十分流行。</p>
<span id="more"></span>
<h2 id="游戏背景"><a class="markdownIt-Anchor" href="#游戏背景"></a> 游戏背景</h2>
<p>该游戏的背景发生在一片森林里,人们声称目击到了一头「站着的鹿」,还有四个孩子在里面失踪。警方怎么找都找不到怪物和孩子,只能将其封锁。而玩家有 99 天的时间探索该森林、找出真相。</p>
<p>该游戏的玩法不知为何会让我想起饥荒,玩家刚进入游戏就能看到营火、持有布袋和斧子。砍树可以获取木头、布袋可以装木头,木头又可以生火、扩大可探索范围。除了白天就能看到的动物外,该游戏还有晚上才会出现的鹿人、到一定天数会主动来找你麻烦的邪教徒、我目前还没见过的羊人…… 基地旁还会立着一个寻人启事板,可以根据上面给出的方向来找到失踪的孩子。</p>
<h2 id="恐怖游戏是否适合孩童游玩"><a class="markdownIt-Anchor" href="#恐怖游戏是否适合孩童游玩"></a> 恐怖游戏是否适合孩童游玩?</h2>
<p>这个游戏的桌面端快捷键设计有些不合理,操作实在是不习惯。但让我更在意的其实是另一个问题:<em>这种恐怖主题的游戏在孩子中如此受欢迎,究竟合不合适</em>?首先,我先说一下我的部分观点:</p>
<ol>
<li>
<p>Roblox 本身就是多人游戏,会火的恐怖游戏也近乎都是多人合作。例如几年前在外国孩子之间很火的 <em>Piggy</em> 就是多人合作逃脱游戏,再到之后的一系列恐怖题材游戏都是多人合作。<em>99 Nights at Forest</em> 也是一样。正是这种集体协作、彼此依赖的机制,让原本单纯的恐怖体验转化为社交刺激与游戏乐趣。</p>
<p>心理学研究提出过 <em>娱乐性恐惧</em> 这个概念,即一种恐惧与愉悦并存的混合情绪体验,而恐惧与愉悦之间是存在着「倒 U 型关系」的。当人们在安全的社交环境中体验恐惧时,恐惧会被转化为积极情绪。</p>
</li>
<li>
<p>对于已经在上学的孩子而言,恐怖体验是有利的,可以帮助他们学习如何面对恐惧、管理焦虑情绪。前提是恐惧强度必须适中。事实上,从我观察来看,近些年在孩子之间火的恐怖游戏(如 <em>Poppy's Playtime</em>)普遍属于 <em>吉祥物恐怖</em>,其内容更偏向于紧张与刺激,再加上可爱吉祥物所营造的反差,而非真正的血腥或猎奇。这些游戏的恐怖也多数被包裹在任务、收集等系统里。</p>
</li>
<li>
<p>我认为这个年龄段的孩子就算接触到了一些恐怖概念,例如邪教徒,他们也无法明白这到底是什么、只是将其看成是一种设定。这并不意味着孩子无法感知恐怖,他们只是难以理解背后的抽象含义。如果你在小时候玩过 4399 等平台上的小游戏的话,或许也接触过许多带有血腥、恐怖、猎奇要素的游戏。比方说 <em>jumpaloo!</em>,屡次失败的玩家会遭受血腥的对待、看着代表自己的小动物被搅碎。但是对于当时的孩子而言,「被搅碎」这个行为本身不重要,重要的是「失败了」。因此,他们把这一幕理解为游戏中的失败信号,而不是现实暴力的再现,这正说明儿童在早期阶段对暴力的解读更多停留在规则层面。</p>
</li>
</ol>
<p>那么,孩子到底适合游玩恐怖游戏吗?我的答案:<strong>这是一个双刃剑。</strong></p>
<p>是的,恐怖游戏可以帮助孩子们脱敏,但是过量的暴力和血腥内容会导致孩子们的共情能力下降、培养出非黑即白的理念。关键在于剂量和语境:偶尔的卡通暴力可能无害,但如果每天数小时沉浸在「杀戮获得奖励」的游戏循环内呢?</p>
<h2 id="roblox-的问题"><a class="markdownIt-Anchor" href="#roblox-的问题"></a> Roblox 的问题</h2>
<p>Roblox 也有着自己特有的风险。它其实比起说是一款游戏,更像是一个游戏平台、里面的游戏都是用户生成内容。而这种开放式平台设计虽然鼓励创造,但同时也带来了新的问题:</p>
<ul>
<li>内容质量不可控。虽然里面多数游戏都是正规的,但是质量低劣、设计不当的游戏也不是没有。突然的 jumpscares(突发惊吓,或称跳杀)就会被我称为是 <em>无营养的恐惧</em></li>
<li>多人游戏意味着与陌生人互动。即使游戏本身适当,聊天功能也可能导致孩子们被有心者欺骗、骚扰、仇恨。
<ul>
<li>Bloomberg 曾经调查发现,Roblox 上的儿童性侵案件从 2018 年的 13 起激增至 2023 年的 <strong>147</strong> 起。要知道,Roblox 是全球最大的儿童游戏平台,日活跃用户超 <strong>7800 万</strong>,其中 40% 是 13 岁以下的儿童,也就是 <strong>312 万</strong>。这一数据之所以令人担忧,是因为 Roblox 的规模远大于其监管能力。全平台审核员竟然只有 <strong>3000</strong> 名左右!</li>
<li>Roblox 有一个叫做 Robux 的货币,类似于 Q 币,可以购买角色装扮和部分游戏内的装备。对于已经有经济能力的大人而言,购买 Robux 根本就不是什么大事。但是对于孩子们而言,该系统会让他们感受到 <em>经济焦虑</em><em>同伴压力</em>。再者,允许孩子为游戏充值的家庭我个人认为并不多。这就像一些现实的案例:没有经济能力的未成年人被一个有经济能力的成年失败者坑骗肉体。</li>
</ul>
</li>
</ul>
<h2 id="评估和结语"><a class="markdownIt-Anchor" href="#评估和结语"></a> 评估和结语</h2>
<p>如何更好地去评估一款游戏适不适合孩子们游玩?我认为可以参考这个框架:</p>
<ol>
<li>游戏是卡通化还是写实化?</li>
<li>恐怖类型是跳跃惊吓、追逐紧张,还是心理恐怖、存在威胁?</li>
<li>玩家能否通过技能避免威胁,还是只能被动承受?</li>
<li>游戏的叙事框架是单纯的杀戮模拟吗?</li>
<li>孩子多少岁?7 岁以下应完全避免;7-10 岁需严格选择和监督;10 岁以上可适度放宽。</li>
<li>孩子对恐怖书籍、电影的反应如何?是否有持续恐惧史?</li>
<li>独自一人玩还是和朋友一起玩?</li>
<li>陪同孩子玩前 30 分钟至 1 小时,其面部表情、身体语言是什么样的?</li>
<li>游玩后是否出现了睡眠问题、焦虑增加、攻击性言行或回避行为?</li>
<li>游玩后询问孩子哪部分最可怕?这些怪物是否是真实的?如果害怕了怎么办?评估孩子的理解和应对能力。</li>
<li>即时游戏适当,也应限制每周游戏时间,避免过度沉浸。</li>
<li><strong>一定</strong> 要教育孩子们,如何应对陌生人、保护个人信息、如何举报不正当内容!</li>
</ol>
<p>那么,完全禁止是否更高效、也更有利于保护孩子?其实未必。对于 Z 世代和 Alpha 世代(前者指代 1997-2012 年出生的人,后者指代 2013 到现在出生的人)来说,这些游戏是社交货币和共同话题。拒绝参与可能导致社交孤立。这意味着完全禁止也有弊处。</p>
<p>适合性是动态的、条件性的,而非静态的、普遍的。所以,与其追问「恐怖游戏是否适合儿童」,不如问「如何让恐怖体验在安全的环境下,为儿童心理成长服务」。</p>
</body></html></div></article></div></main><footer><div class="paginator"><a class="prev" href="ea48.html">上一篇</a><a class="next" href="c3f9.html">下一篇</a></div><!-- Webmention 显示区域--><div class="webmention-section webmention-empty" data-page-url="posts/e068.html" data-full-url="https://cytrogen.icu/posts/e068.html" data-mode="static">
              <h3 class="webmention-title">Webmentions (<span class="webmention-count">0</span>)</h3>
              <div class="webmention-list"></div>
              <span>暂无 Webmentions</span>
            </div><div class="copyright"><p class="footer-links"><a href="../friends/index.html">友链</a><span class="footer-separator"> ·</span><a href="../links/index.html">邻邦</a><span class="footer-separator"> ·</span><a href="../contact/index.html">联络</a><span class="footer-separator"> ·</span><a href="../colophon/index.html">营造记</a><span class="footer-separator"> ·</span><a href="../atom.xml">RSS订阅</a></p><p>© 2025 - 2026 <a href="https://cytrogen.icu">Cytrogen</a>, powered by <a href="https://hexo.io/" target="_blank">Hexo</a> and <a href="https://github.com/cytrogen/hexo-theme-ares" target="_blank">hexo-theme-ares</a>.</p><p><a href="https://blogscn.fun" target="_blank" rel="noopener">BLOGS·CN</a></p></div></footer></div></div><a class="back-to-top" href="#top" aria-label="返回顶部"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path d="M3.293 9.707a1 1 0 010-1.414L9.586 2a2 2 0 012.828 0l6.293 6.293a1 1 0 01-1.414 1.414L11 3.414V17a1 1 0 11-2 0V3.414L2.707 9.707a1 1 0 01-1.414 0z"></path></svg></a><script>document.addEventListener('DOMContentLoaded', function() {
  const codeBlocks = document.querySelectorAll('figure.highlight');
  
  codeBlocks.forEach(block => {
    let caption = block.querySelector('figcaption');
    if (!caption) {
      caption = document.createElement('figcaption');
      block.insertBefore(caption, block.firstChild);
    }

    const info = document.createElement('div');
    info.className = 'info';
    
    const filename = caption.querySelector('span');
    if (filename) {
      filename.className = 'filename';
      info.appendChild(filename);
    }
    
    const lang = block.className.split(' ')[1];
    if (lang) {
      const langSpan = document.createElement('span');
      langSpan.className = 'lang-name';
      langSpan.textContent = lang;
      info.appendChild(langSpan);
    }

    const sourceLink = caption.querySelector('a');
    if (sourceLink) {
      sourceLink.className = 'source-link';
      info.appendChild(sourceLink);
    }

    const actions = document.createElement('div');
    actions.className = 'actions';

    const codeHeight = block.scrollHeight;
    const threshold = 300;

    if (codeHeight > threshold) {
      block.classList.add('folded');
      
      const toggleBtn = document.createElement('button');
      toggleBtn.textContent = '展开';
      toggleBtn.addEventListener('click', () => {
        block.classList.toggle('folded');
        toggleBtn.textContent = block.classList.contains('folded') ? '展开' : '折叠';
      });
      actions.appendChild(toggleBtn);
    }

    const copyBtn = document.createElement('button');
    copyBtn.textContent = '复制';
    copyBtn.addEventListener('click', async () => {
      const codeLines = block.querySelectorAll('.code .line');
      const code = Array.from(codeLines)
        .map(line => line.textContent)
        .join('\n')
        .replace(/\n\n/g, '\n');
      
      try {
        await navigator.clipboard.writeText(code);
        copyBtn.textContent = '已复制';
        copyBtn.classList.add('copied');
        
        setTimeout(() => {
          copyBtn.textContent = '复制';
          copyBtn.classList.remove('copied');
        }, 3000);
      } catch (err) {
        console.error('复制失败:', err);
        copyBtn.textContent = '复制失败';
        
        setTimeout(() => {
          copyBtn.textContent = '复制';
        }, 3000);
      }
    });
    actions.appendChild(copyBtn);

    caption.innerHTML = '';
    caption.appendChild(info);
    caption.appendChild(actions);

    const markedLines = block.getAttribute('data-marked-lines');
    if (markedLines) {
      const lines = markedLines.split(',');
      lines.forEach(range => {
        if (range.includes('-')) {
          const [start, end] = range.split('-').map(Number);
          for (let i = start; i <= end; i++) {
            const line = block.querySelector(`.line-${i}`);
            if (line) line.classList.add('marked');
          }
        } else {
          const line = block.querySelector(`.line-${range}`);
          if (line) line.classList.add('marked');
        }
      });
    }
  });
});</script><script async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js" id="MathJax-script"></script><script>(function() {
  document.addEventListener('DOMContentLoaded', function() {
    const themeToggle = document.querySelector('.theme-toggle');
    
    if (!themeToggle) return;
    
    const getCurrentTheme = () => {
      return document.documentElement.getAttribute('data-theme') || 'light';
    };
    
    const updateUI = (theme) => {
      const isDark = theme === 'dark';
      themeToggle.setAttribute('aria-pressed', isDark.toString());
    };
    
    const setTheme = (theme) => {
      document.documentElement.setAttribute('data-theme', theme);
      document.documentElement.style.colorScheme = theme;
      
      const pageWrapper = document.getElementById('page-wrapper');
      if (pageWrapper) {
        pageWrapper.setAttribute('data-theme', theme);
      }
      
      // Find and remove the temporary anti-flicker style tag if it exists.
      // This ensures the main stylesheet takes full control after the initial load.
      const antiFlickerStyle = document.getElementById('anti-flicker-style');
      if (antiFlickerStyle) {
        antiFlickerStyle.remove();
      }
      
      localStorage.setItem('theme', theme);
      updateUI(theme);
    };
    
    const toggleTheme = () => {
      const current = getCurrentTheme();
      const newTheme = current === 'light' ? 'dark' : 'light';
      setTheme(newTheme);
    };
    
    updateUI(getCurrentTheme());
    
    themeToggle.addEventListener('click', toggleTheme);
    
    if (window.matchMedia) {
      const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
      mediaQuery.addEventListener('change', function(e) {
        if (!localStorage.getItem('theme')) {
          const theme = e.matches ? 'dark' : 'light';
          setTheme(theme);
        }
      });
    }
  });
})();
</script><script src="../js/details-toggle.js" defer></script><script>(function() {
  document.addEventListener('DOMContentLoaded', function() {
    const backToTopBtn = document.querySelector('.back-to-top');
    
    if (!backToTopBtn) return;
    
    const toggleButtonVisibility = () => {
      const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
      const shouldShow = scrollTop > 200;
      
      if (shouldShow) {
        backToTopBtn.classList.add('is-visible');
      } else {
        backToTopBtn.classList.remove('is-visible');
      }
    };
    
    let ticking = false;
    const handleScroll = () => {
      if (!ticking) {
        requestAnimationFrame(() => {
          toggleButtonVisibility();
          ticking = false;
        });
        ticking = true;
      }
    };
    
    const scrollToTop = (event) => {
      event.preventDefault();
      window.scrollTo({
        top: 0,
        behavior: 'smooth'
      });
    };
    
    window.addEventListener('scroll', handleScroll);
    backToTopBtn.addEventListener('click', scrollToTop);
    
    toggleButtonVisibility();
  });
})();</script></body></html>