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
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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
@font-face {
    font-family: 'Dank Mono';
    src: url('../assets/fonts/DankMono-Regular.woff2') format('woff2');
    font-display: swap;
    font-style: normal;
}

@font-face {
    font-family: 'Dank Mono';
    src: url('../assets/fonts/DankMono-Italic.woff2') format('woff2');
    font-display: swap;
    font-style: italic;
}

@font-face {
    font-family: 'JinBuTi';
    src: url('../assets/fonts/DingTalk-JinBuTi.woff2') format('woff2');
    font-display: swap;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'JinBuTi', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* 代码块容器样式 */
.language-javascript, [class*="language-"] {
    background: #f6f8fa !important;
    border-radius: 10px !important;
    box-shadow: 0 10px 30px 0 rgba(0, 0, 0, 0.1) !important;
    position: relative;
    margin: 1.2em 0;
}

.dark .language-javascript, .dark [class*="language-"] {
    background: #282c34 !important;
    box-shadow: 0 10px 30px 0 rgba(0, 0, 0, .4) !important;
}

/* 代码块顶部栏 */
.sticky.top-8 {
    background: #e1e4e8 !important;
    height: 40px !important;
    display: flex;
    align-items: center;
    border-radius: 10px 10px 0 0;
    padding: 0 15px !important;
    margin-bottom: -59px !important;
}

.dark .sticky.top-8 {
    background: #21252b !important;
}

/* 语言标识 */
.text-text-300 {
    position: absolute;
    left: 60px;
    top: 2px;
    color: #abb2bf !important;
    font-size: 17px !important;
    font-weight: 500 !important;
    z-index: 11;
}

.dark .text-text-300 {
    color: #586069 !important;
}

/* 顶部按钮样式优化 */
.save-code-button, .copy-code-button, .run-code-button {
    background: #f8f9fa !important;
    color: #333 !important;
    border: 1px solid #d1d5da !important;
    font-size: 12px !important;
    padding: 4px 12px !important;
    border-radius: 4px !important;
    transition: all 0.2s ease-in-out !important;
}

.dark .save-code-button, .dark .copy-code-button, .dark .run-code-button {
    background: #323842 !important;
    color: #abb2bf !important;
    border: 1px solid #3e4451 !important;
}

.save-code-button:hover, .copy-code-button:hover {
    background: #e9ecef !important;
    color: #222 !important;
}

.dark .save-code-button:hover, .dark .copy-code-button:hover {
    background: #3e4451 !important;
    color: #fff !important;
}

/* 代码块顶部装饰圆点 */
.language-javascript::before, [class*="language-"]::before {
    content: " ";
    position: absolute;
    border-radius: 50%;
    background: #ff5f56;
    width: 12px;
    height: 12px;
    left: 15px;
    top: 14px;
    box-shadow: 20px 0 #ffbd2e, 40px 0 #27c93f;
    z-index: 10;
}

.dakr .language-javascript::before, .dakr [class*="language-"]::before {
    background: #fc625d;
    box-shadow: 20px 0 #fdbc40, 40px 0 #35cd4b;
}

/* 代码内容区域 */
.cm-content {
    font-family: 'Dank Mono', -apple-system, BlinkMacSystemFont, Inter, ui-sans-serif, system-ui, 'Segoe UI', Roboto, Ubuntu, Cantarell, 'Noto Sans', sans-serif, 'Helvetica Neue', Arial, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
    font-size: 15px !important;
    line-height: 1.6em !important;
    padding: 20px 1.4em 1em 30px !important;
    color: #24292e !important;
}

.dark .cm-content {
    color: #abb2bf !important;
}

/* 代码语法高亮 */
.cm-lineb {
    /* 关键字 */
    color: #d73a49 !important;
}

.dark .cm-lineb {
    color: #c678dd !important;
}

.cm-line .ͼd {
    /* 数字 */
    color: #a29bfe !important;
}

.dakr .cm-line .ͼd {
    color: #e5c07b !important;
}

.cm-line .ͼe {
    /* 字符串 */
    color: #6a89cc !important;
}

.dakr .cm-line .ͼe {
    color: #98c379 !important;
}

.cm-line .ͼg {
    /* 变量 */
    color: #2ca9e1 !important;
    font-style: italic;
}

.dakr .cm-line .ͼg {
    color: #e3adb9 !important;
}

/* 代码语法高亮 - 扩展 */
.cm-comment {
    /* 注释 */
    color: #7f848e !important;
    font-style: italic;
}

.cm-property {
    color: #61afef !important;
}

cm-tag {
    color: #e06c75 !important;
}

.cm-attribute {
    color: #d19a66 !important;
}

.cm-string {
    color: #98c379 !important;
}

.cm-operator {
    color: #56b6c2 !important;
}

span.ͼc {
    color: #7d5fff !important;
}

span.ͼl {
    color: #6bddcd !important;
}

span.ͼt {
    /* 暗色模式下的逗号 */
    color: #ddb078 !important;
    ;
    font-style: italic;
}

span.ͼr {
    /* 暗色模式下的函数名 */
    font-style: italic;
}

span.ͼf {
    /* 亮色模式下奇怪的符号 */
    color: #70a1ff;
}

span.ͼm {
    /* 亮色模式下的注释 */
    color: #f29a76;
    font-style: italic;
}

span.ͼw {
    /* 暗色模式下的注释 */
    font-style: italic;
}

/* 滚动条样式 */
.cm-scroller::-webkit-scrollbar {
    height: 10px !important;
    width: 10px !important;
    background-color: #f6f8fa !important;
}

.dark .cm-scroller::-webkit-scrollbar {
    background-color: #282c34 !important;
}

.cm-scroller::-webkit-scrollbar-track {
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.1) !important;
    border-radius: 10px !important;
    background-color: #f6f8fa !important;
}

.dark .cm-scroller::-webkit-scrollbar-track {
    box-shadow: inset 0 0 6px rgba(0, 0, 0, .3) !important;
    background-color: #282c34 !important;
}

.cm-scroller::-webkit-scrollbar-thumb {
    border-radius: 10px !important;
    box-shadow: inset 0 0 6px rgba(0, 0, 0, .2) !important;
    background-color: #d1d5da !important;
}

.dark .cm-scroller::-webkit-scrollbar-thumb {
    box-shadow: inset 0 0 6px rgba(0, 0, 0, .5) !important;
    background-color: #3e4451 !important;
}

/* 行号栏样式 */
.cm-gutters {
    background: #f6f8fa !important;
    border-right: 1px solid #d1d5da !important;
    color: #586069 !important;
    padding-right: 10px !important;
    font-family: "Dank Mono";
}

.dark .cm-gutters {
    background: #282c34 !important;
    border-right: 1px solid #3e4451 !important;
    color: #495162 !important;
}

/* 当前行高亮 */
.cm-activeLine {
    background: #6699ff0b !important;
}

.cm-gutterElement.cm-activeLineGutter {
    background-color: #f9d3e3;
}

.dark .cm-gutterElement.cm-activeLineGutter {
    background-color: #dd7694;
}

/* 添加代码选中样式 */
.cm-selectionBackground, .cm-content ::selection {
    background-color: rgba(122, 129, 255, 0.2) !important;
}

.cm-line.cm-selected {
    background-color: rgba(122, 129, 255, 0.2) !important;
}

/* 选中时的文本颜色保持原样,确保可读性 */
.cm-content ::selection {
    color: rgba(62, 158, 111, 0.9) !important;
}

.dark .cm-content ::selection {
    color: rgba(245, 177, 255, 0.9) !important;
}

/* 匹配相同结果时的颜色 */
.cm-selectionMatch {
    background-color: #9c88ff5a !important;
}

/* 当有多行选中时的样式 */
.cm-selectionLayer>.cm-selectionBackground {
    background-color: rgba(122, 129, 255, 0.2) !important;
}

/* 代码块折叠/展开样式添加与修改 */
.cm-scroller {
    background-color: #f6f8fa;
}

#collapsed>.cm-scroller, #expanded>.cm-scroller {
    padding-bottom: 40px;
}

.dark .cm-scroller {
    background-color: #282c34;
}

.cm-scroller {
    overflow: auto !important;
}

.cm-editor {
    transition: height 1s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden !important;
}

/* 只给超高的代码块添加最大高度和内边距 */
.cm-editor#collapsed {
    height: 400px;
}

/* .cm-editor#expanded { padding-bottom: 40px; } */
.code-expand-btn {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 6px 15px;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    border: none;
    color: #666;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    -webkit-backdrop-filter: blur(8px);
    z-index: 11;
    transition: all 0.3s ease;
}

.dark .code-expand-btn {
    background: rgba(45, 45, 45, 0.6);
    color: #fff;
}

.code-expand-btn:hover {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

.dark .code-expand-btn:hover {
    background: rgba(45, 45, 45, 0.8);
}

.code-expand-btn:active {
    transform: translateX(-50%) translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.code-expand-btn::before {
    content: "⌄";
    display: inline-block;
    margin-right: 4px;
    font-size: 14px;
    transition: transform 0.3s ease;
}

.code-expand-btn#expanded::before {
    transform: rotate(180deg);
}

.code-expand-btn::after {
    content: "展开代码";
}

.code-expand-btn#expanded::after {
    content: "收起代码";
}

/* 渐变遮罩 */
.cm-editor#collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(transparent 0%, rgba(255, 255, 255, 0.3) 40%, rgba(255, 255, 255, 0.6) 80%, rgba(255, 255, 255, 0.8) 100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
    /* 确保遮罩层覆盖到滚动条 */
    width: calc(100% + 17px);
    /* 17px是标准滚动条宽度 */
}

.dark .cm-editor#collapsed::after {
    background: linear-gradient(transparent 0%, rgba(45, 45, 45, 0.3) 40%, rgba(45, 45, 45, 0.6) 80%, rgba(45, 45, 45, 0.8) 100%);
}

/* 只在折叠状态显示渐变遮罩 */
.cm-editor#collapsed::after {
    opacity: 1;
}

/* 隐藏原始的折叠按钮 */
div.flex.items-center.gap-0\.5 button.flex.gap-1.items-center:not(.run-code-button) {
    display: none;
}