/* 文章书页。主题只提供配色，正文结构与交互在所有主题下保持一致。 */
:root {
  --reading-width: 780px;
  --read-fs: 17px;
  --read-lh: 1.85;
  --read-para: 14px;
  /* 左侧标题标识按字体独立校准：正值下移，负值上移。 */
  --heading-marker-shift-system: 0em;
  --heading-marker-shift-wenkai: 0em;
  --heading-marker-shift-songti: .06em;
  --read-mono: CascadiaCode, "Cascadia Code", Consolas, "Liberation Mono", monospace;
  --read-fg: var(--site-text);
  --read-quiet: var(--site-muted);
  --read-link: color-mix(in srgb, var(--site-accent-ink) 70%, #20242b);
  --read-line: color-mix(in srgb, var(--site-text) 22%, transparent);
  --read-line-soft: color-mix(in srgb, var(--site-text) 12%, transparent);
  --read-surface: color-mix(in srgb, var(--page-bg) 20%, #fff);
  --read-block-bg: color-mix(in srgb, var(--read-fg) 3%, var(--read-surface));
  --read-table-head: color-mix(in srgb, var(--site-accent) 10%, var(--read-surface));
  --read-code-fg: #343e4e;
  --read-code-bg: color-mix(in srgb, #526075 8%, var(--read-surface));
  --read-inline-code-fg: color-mix(in srgb, var(--read-link) 65%, var(--read-fg));
  --read-inline-code-bg: color-mix(in srgb, var(--site-accent) 7%, var(--read-surface));
  --read-inline-code-line: color-mix(in srgb, var(--site-accent) 20%, var(--read-surface));
  --read-mark-bg: #fff0ad;
  --read-mark-fg: #393121;
  --read-color-red: #b42318;
  --read-color-blue: #1d4ed8;
  --read-color-green: #16704a;
  --read-color-purple: #6d28d9;
  --read-syntax-keyword: #7940a5;
  --read-syntax-string: #226947;
  --read-syntax-number: #9a4c13;
  --read-syntax-function: #225ba1;
  --read-syntax-comment: #657080;
  --read-syntax-type: #8d3d64;
}
body[data-theme-series="neon"] {
  --read-fg: color-mix(in srgb, var(--site-text) 94%, var(--page-bg));
  --read-link: color-mix(in srgb, var(--site-accent) 40%, #fff);
  --read-line: #ffffff38;
  --read-line-soft: #ffffff20;
  --read-surface: color-mix(in srgb, var(--page-bg) 96%, #fff);
  --read-block-bg: color-mix(in srgb, var(--read-surface) 95%, #fff);
  --read-table-head: color-mix(in srgb, var(--site-accent) 13%, var(--read-surface));
  --read-code-fg: #dde3ed;
  --read-code-bg: #ffffff0d;
  --read-inline-code-fg: color-mix(in srgb, var(--site-accent) 35%, var(--read-fg));
  --read-inline-code-bg: color-mix(in srgb, var(--site-accent) 12%, var(--read-surface));
  --read-inline-code-line: color-mix(in srgb, var(--site-accent) 26%, var(--read-surface));
  --read-mark-bg: #69501e;
  --read-mark-fg: #fff2c9;
  --read-color-red: #ffa69e;
  --read-color-blue: #a8c7ff;
  --read-color-green: #8fdbb2;
  --read-color-purple: #d3b5ff;
  --read-syntax-keyword: #d3b5ff;
  --read-syntax-string: #9bd6af;
  --read-syntax-number: #edbd8c;
  --read-syntax-function: #a8c7ff;
  --read-syntax-comment: #a3adbb;
  --read-syntax-type: #f0b0ce;
}

/* 阅读宽度、字号与段落节奏。 */
.post-article { max-width: var(--reading-width); }
.post-head h1 { font-size: clamp(1.8rem, 3vw, 2.25rem); line-height: 1.4; }
#write {
  max-width: var(--reading-width); margin: 0 auto; padding: 24px 0;
  color: var(--read-fg); font: var(--read-fs)/var(--read-lh) var(--font-body);
  letter-spacing: 0; word-spacing: normal; text-align: left;
  overflow-wrap: anywhere; word-break: normal;
}
#write :is(p, li, dd, dt, td, th, blockquote) { font-size: 1em; color: inherit; }
#write p { margin: var(--read-para) 0; font-family: inherit; word-spacing: normal; }
#write > :first-child { margin-top: 0; }
#write > :last-child { margin-bottom: 0; }

/* 标题：参考图中的六级样式，装饰随主题色变化。 */
#write {
  --heading-accent: var(--site-accent);
  --heading-soft: color-mix(in srgb, var(--site-accent) 68%, var(--read-quiet));
  --heading-dot: color-mix(in srgb, var(--site-accent) 35%, var(--page-bg));
  --heading-dot-paint: radial-gradient(circle, var(--heading-dot) 1.6px, transparent 1.85px);
  --heading-marker-shift: var(--heading-marker-shift-system);
}
html[data-font="system"] #write { --heading-marker-shift: var(--heading-marker-shift-system); }
html[data-font="wenkai"] #write { --heading-marker-shift: var(--heading-marker-shift-wenkai); }
html[data-font="songti"] #write { --heading-marker-shift: var(--heading-marker-shift-songti); }
#write :is(h1, h2, h3, h4, h5, h6),
#write :is(h1, h2, h3, h4, h5, h6):is(:hover, :focus, .md-focus) {
  position: relative; width: auto; min-width: 0; min-height: 0; padding: 0;
  color: var(--read-fg); font-weight: 700; line-height: 1.5; text-align: left;
  background: none; border: 0; border-radius: 0; box-shadow: none; text-shadow: none;
  transform: none; transition: none; backdrop-filter: none; -webkit-backdrop-filter: none;
  cursor: auto;
  scroll-margin-top: calc(var(--header-height, 72px) + 24px);
}
#write h1:not(.md-focus):hover { color: var(--read-fg); transform: none; }
/* 清除主题引擎的标题编号和图标，目录保持原有样式。 */
#write :is(h1, h2, h3, h4, h5, h6)::before,
#write :is(h1, h2, h3, h4, h5, h6)::after,
#write :is(h1, h2, h3, h4, h5, h6) > span:first-of-type::before,
.typora-export-sidebar .outline-label::before { content: none !important; }

/* H1：居中标题 + 渐变短横。 */
#write h1, #write h1:is(:hover, :focus, .md-focus) {
  font-size: 1.8em; margin: 48px 0 24px; padding-bottom: 20px; text-align: center;
}
#write h1.md-heading::after, #write h1.md-heading:is(:hover, :focus, .md-focus)::after {
  content: '' !important; position: absolute; bottom: 0; left: 50%;
  width: 46px; height: 5px; margin: 0; border: 0; border-radius: 4px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--heading-accent) 45%, var(--page-bg)), var(--heading-soft), color-mix(in srgb, var(--heading-accent) 45%, var(--page-bg)));
  transform: translateX(-50%); box-shadow: none; transition: none;
}

/* 标识与文字同一行居中；14px 标识列 + 10px 间距，右侧点阵紧随文字。 */
#write :is(h2, h3, h4, h5, h6),
#write :is(h2, h3, h4, h5, h6):is(:hover, :focus, .md-focus) {
  display: grid; grid-template-columns: 14px minmax(0, max-content) max-content;
  column-gap: 10px; align-items: center; justify-content: start; padding-left: 0;
}
#write :is(h2, h3, h4, h5, h6) > .md-plain { grid-column: 2; grid-row: 1; min-width: 0; }
#write h2, #write h2:is(:hover, :focus, .md-focus) { grid-template-columns: 14px minmax(0, 1fr); }
#write h2, #write h2:is(:hover, :focus, .md-focus) { font-size: 1.5em; margin: 40px 0 16px; }
#write h2.md-heading::before, #write h2.md-heading:is(:hover, :focus, .md-focus)::before,
#write h2.md-heading::after, #write h2.md-heading:is(:hover, :focus, .md-focus)::after {
  content: '' !important; position: static; grid-column: 1; grid-row: 1;
  align-self: center; margin: 0; border: 0; top: auto; left: auto;
  border-radius: 3px; transform: translateY(var(--heading-marker-shift)); box-shadow: none; transition: none;
}
#write h2.md-heading::before, #write h2.md-heading:is(:hover, :focus, .md-focus)::before {
  justify-self: start; width: 6px; height: 1.04em; background: var(--heading-accent);
}
#write h2.md-heading::after, #write h2.md-heading:is(:hover, :focus, .md-focus)::after {
  justify-self: end; width: 2px; height: .64em; background: var(--heading-soft);
}
#write h3, #write h3:is(:hover, :focus, .md-focus) { font-size: 1.3em; margin: 30px 0 12px; }
#write h4, #write h4:is(:hover, :focus, .md-focus) { font-size: 1.15em; margin: 26px 0 10px; }
#write h5, #write h5:is(:hover, :focus, .md-focus) { font-size: 1.1em; margin: 24px 0 8px; }
#write h6, #write h6:is(:hover, :focus, .md-focus) { font-size: 1.05em; margin: 22px 0 8px; }

/* H3 左竖条；H4 实心圆；H5 空心圆；H6 短横。 */
#write :is(h3, h4, h5, h6)::before,
#write :is(h3, h4, h5, h6):is(:hover, :focus, .md-focus)::before {
  content: '' !important; position: static; grid-column: 1; grid-row: 1;
  align-self: center; justify-self: center; left: auto; top: auto;
  margin: 0; padding: 0; border: 0; background: var(--heading-accent);
  transform: translateY(var(--heading-marker-shift)); box-shadow: none; transition: none;
}
#write h3.md-heading::before, #write h3.md-heading:is(:hover, :focus, .md-focus)::before {
  width: 6px; height: 1em; border-radius: 3px; background: var(--heading-soft);
}
#write h4.md-heading::before, #write h4.md-heading:is(:hover, :focus, .md-focus)::before {
  width: 14px; height: 14px; border-radius: 50%;
}
#write h5.md-heading::before, #write h5.md-heading:is(:hover, :focus, .md-focus)::before {
  width: 12px; height: 12px; border: 2px solid var(--heading-accent);
  border-radius: 50%; box-sizing: border-box; background: none;
}
#write h6.md-heading::before, #write h6.md-heading:is(:hover, :focus, .md-focus)::before {
  width: 8px; height: 3px; border-radius: 0;
}

/* 右侧点阵对齐文字末行基线，落在字形右下侧，不参与左侧标识的居中。 */
#write :is(h3, h4, h5, h6) > .md-plain { align-self: last baseline; }
#write :is(h3, h4, h5, h6).md-heading::after,
#write :is(h3, h4, h5, h6).md-heading:is(:hover, :focus, .md-focus)::after {
  content: '' !important; display: block; position: static;
  grid-column: 3; grid-row: 1; align-self: last baseline;
  width: 12px; height: 12px; margin: 0; padding: 0;
  border: 0; border-radius: 0; vertical-align: baseline;
  background-color: transparent; background-repeat: no-repeat; background-size: 5px 5px;
  mask-image: none; -webkit-mask-image: none;
  transform: translateY(.04em); box-shadow: none; opacity: 1; transition: none;
}
#write h3.md-heading::after, #write h3.md-heading:is(:hover, :focus, .md-focus)::after {
  background-image: var(--heading-dot-paint), var(--heading-dot-paint), var(--heading-dot-paint);
  background-position: left top, left bottom, right bottom;
}
#write h4.md-heading::after, #write h4.md-heading:is(:hover, :focus, .md-focus)::after {
  background-image: var(--heading-dot-paint), var(--heading-dot-paint), var(--heading-dot-paint), var(--heading-dot-paint);
  background-position: left top, right top, left bottom, right bottom;
}
#write h5.md-heading::after, #write h5.md-heading:is(:hover, :focus, .md-focus)::after {
  height: 17px;
  transform: translateY(calc(.04em + 1px));
  background-image: var(--heading-dot-paint), var(--heading-dot-paint), var(--heading-dot-paint), var(--heading-dot-paint), var(--heading-dot-paint);
  background-position: left top, left center, right center, left bottom, right bottom;
}
#write h6.md-heading::after, #write h6.md-heading:is(:hover, :focus, .md-focus)::after {
  height: 17px;
  transform: translateY(calc(.04em + 1px));
  background-image: var(--heading-dot-paint), var(--heading-dot-paint), var(--heading-dot-paint), var(--heading-dot-paint), var(--heading-dot-paint), var(--heading-dot-paint);
  background-position: left top, right top, left center, right center, left bottom, right bottom;
}
#write :is(h1, h2, h3, h4, h5, h6) + :is(h1, h2, h3, h4, h5, h6),
#write :is(h1, h2, h3, h4, h5, h6) + :is(h1, h2, h3, h4, h5, h6):is(:hover, :focus, .md-focus) { margin-top: 20px; }
#write > :is(h1, h2, h3, h4, h5, h6):first-child,
#write > :is(h1, h2, h3, h4, h5, h6):first-child:is(:hover, :focus, .md-focus) { margin-top: 0; }
#write :is(h1, h2, h3, h4, h5, h6) span { border: 0; }
#write :is(h1, h2, h3, h4, h5, h6) code:not(.md-fencescode) { padding: 0; border: 0; background: none; color: inherit; }

/* 列表：悬挂缩进；只读待办使用方形勾选框。 */
#write ul, #write ol { margin: var(--read-para) 0; padding-left: 1.6em; }
#write ul { list-style-type: disc; }
#write ul ul { list-style-type: circle; }
#write ul ul ul { list-style-type: square; }
#write ol, #write ol ol, #write ol ol ol { list-style-type: decimal; }
#write li { position: relative; margin: .35em 0; padding-left: .15em; line-height: var(--read-lh); }
#write li::marker { color: var(--read-quiet); }
#write li::before { content: none !important; }
#write li > :is(ul, ol) { margin: .35em 0; }
#write li > p { margin: .45em 0; }
#write li > :is(pre, .code-block, .table-wrap, .math-block, .md-alert, figure) { margin: 16px 0; }
#write li > :first-child { margin-top: 0; }
#write li > :last-child { margin-bottom: 0; }
#write .task-list-item { list-style: none; padding-left: .15em; }
#write .task-list-item > label, #write .task-list-item > p > label { display: block; position: relative; cursor: default; }
#write .task-list-item label:has(> input:checked) { color: var(--read-quiet); }
#write .task-list-item input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; position: absolute;
  /* 与文字共用字号和行高，按首行行盒居中；换行时不移到整段中间。 */
  font: inherit;
  top: calc(.5lh - .425em - 1px); left: -1.25em; width: .85em; height: .85em; margin: 0;
  border: 1.5px solid var(--read-quiet); border-radius: 3px; background: var(--read-surface);
  opacity: 1; cursor: default; transform: none; transition: none;
  box-sizing: border-box;
}
#write .task-list-item input::before, #write .task-list-item input::after { content: none !important; }
#write .task-list-item input:checked { border-color: var(--read-link); background: var(--read-link); }
#write .task-list-item input:checked::after {
  content: '' !important; display: block; position: static; width: 100%; height: 100%; border: 0;
  background: var(--read-surface); opacity: 1; transform: none;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3.4 8.6 3 3 6.2-6.8' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 80% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3.4 8.6 3 3 6.2-6.8' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 80% no-repeat;
}
#write .task-list-item input[type=checkbox]:checked + :is(p, span) { background: none; color: inherit; }

/* 公式：保留 MathJax 的 SVG 基线；块级公式只在外层滚动。 */
#write mjx-container { position: static; top: auto; vertical-align: baseline; font-size: 1em; color: inherit; }
#write .math-block { margin: 24px 0; padding: 8px 4px; overflow-x: auto; overflow-y: hidden; text-align: center; }
#write mjx-container[display="true"] { display: block; width: max-content; min-width: 0; max-width: none; margin: 0 auto; overflow: visible; }
#write .math-block mjx-container svg { max-width: none; }
#write .math-copy {
  cursor: pointer; border-radius: 4px; border: 0; outline: none; box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}
#write .math-copy:is(:hover, :focus-visible, [data-copy-state]) {
  background: color-mix(in srgb, var(--site-accent) 12%, transparent);
}
#write .math-copy:focus-visible { background: color-mix(in srgb, var(--site-accent) 20%, transparent); }
.math-copy-status {
  position: fixed; z-index: 1000; bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  left: 50%; transform: translateX(-50%); max-width: calc(100vw - 40px); box-sizing: border-box;
  padding: 10px 18px; border: 1px solid var(--site-accent); border-radius: 10px;
  background: var(--page-bg); color: var(--site-text); box-shadow: 0 4px 20px #0002;
  font: 14px/1.5 var(--font-body, sans-serif); text-align: center; pointer-events: none;
}
.math-copy-status:empty { display: none; }

/* 分隔与表格：主题色表头、细分栏与柔和行底色，保留作者的单元格对齐。 */
#write hr, #write hr:hover { margin: 32px 0; height: 0; border: 0; border-top: 1px solid var(--read-line); background: none; opacity: 1; transform: none; transition: none; }
#write hr::before, #write hr::after { content: none !important; }
#write .table-wrap {
  --table-edge: color-mix(in srgb, var(--site-accent) 18%, var(--read-line));
  --table-grid: color-mix(in srgb, var(--read-fg) 9%, transparent);
  margin: 24px 0; overflow-x: auto; border: 1px solid var(--table-edge); border-radius: 12px;
  background: var(--read-surface);
  box-shadow: 0 5px 18px -14px color-mix(in srgb, var(--site-accent) 35%, var(--read-fg));
}
#write table { display: table; width: 100%; margin: 0; border: 0; border-collapse: separate; border-spacing: 0; border-radius: 0; background: var(--read-surface); font-size: .93em; line-height: 1.7; font-variant-numeric: tabular-nums; backdrop-filter: none; -webkit-backdrop-filter: none; }
#write table :is(th, td) {
  padding: 12px 17px; border: 0; border-right: 1px solid var(--table-grid, var(--read-line-soft));
  border-bottom: 1px solid var(--read-line-soft); background: none; color: inherit;
  vertical-align: middle; min-width: 5em; transition: none;
}
#write table th {
  padding-top: 13px; padding-bottom: 13px; background: var(--read-table-head);
  border-top: 2px solid color-mix(in srgb, var(--site-accent) 65%, var(--read-surface));
  border-bottom-color: var(--table-edge, var(--read-line));
  color: color-mix(in srgb, var(--read-link) 55%, var(--read-fg)); font-weight: 700; white-space: normal;
}
#write table tr > :last-child { border-right: 0; }
#write table :is(th, td):not([style*="text-align"]) { text-align: left; }
#write tbody tr, #write tbody tr:hover { background: none; transition: none; }
#write tbody tr:nth-child(even), #write tbody tr:nth-child(even):hover { background: color-mix(in srgb, var(--site-accent) 3%, var(--read-surface)); }
#write table tbody tr:hover td, #write table tbody td:hover { background: none; color: inherit; box-shadow: none; text-shadow: none; }
#write tbody tr:last-child td { border-bottom: 0; }
#write table code:not(.md-fencescode) { font-size: .92em; white-space: nowrap; overflow-wrap: normal; }
@media (hover: hover) and (pointer: fine) {
  #write table tbody tr:hover td { background: color-mix(in srgb, var(--site-accent) 7%, transparent); }
}

/* 引用区别于提示卡片。 */
#write blockquote, #write blockquote:is(:hover, :focus, :active, .md-focus) {
  margin: 24px 0; padding: 2px 0 2px 18px; border: 0; border-left: 3px solid var(--read-line); border-radius: 0;
  background: none; color: var(--read-fg); font-style: normal; line-height: inherit; box-shadow: none; transform: none; transition: none;
}
#write blockquote::before, #write blockquote::after { content: none !important; }
#write blockquote p { margin: 10px 0; color: inherit; }
#write blockquote blockquote { margin: 14px 0; border-left-color: var(--read-line-soft); }
#write blockquote > :first-child { margin-top: 0; }
#write blockquote > :last-child { margin-bottom: 0; }
#write blockquote cite { display: block; margin-top: 8px; font-size: .875em; color: var(--read-quiet); font-style: normal; }

/* 提示块：独立的图标底座、清楚标题与柔和卡面；语义色在各主题下稳定。 */
#write .md-alert {
  --alert-hue: #55738e;
  --alert-ink: color-mix(in srgb, var(--alert-hue) 78%, #17212d);
  --alert-bg: color-mix(in srgb, var(--alert-hue) 3%, var(--read-surface));
  --alert-border: color-mix(in srgb, var(--alert-hue) 22%, var(--read-surface));
  --alert-icon-bg: color-mix(in srgb, var(--alert-hue) 9%, var(--read-surface));
  position: relative; isolation: isolate; overflow: hidden;
  margin: 20px 0; padding: 16px 18px;
  border: 1px solid var(--alert-border); border-radius: 12px;
  background: linear-gradient(115deg, color-mix(in srgb, var(--alert-hue) 4%, transparent), transparent 68%), var(--alert-bg);
  color: var(--read-fg);
  box-shadow: 0 3px 12px -10px color-mix(in srgb, var(--alert-hue) 35%, transparent);
  transform: none; transition: none; z-index: auto;
}
#write .md-alert:hover {
  background: linear-gradient(115deg, color-mix(in srgb, var(--alert-hue) 4%, transparent), transparent 68%), var(--alert-bg);
  border-color: var(--alert-border);
  box-shadow: 0 3px 12px -10px color-mix(in srgb, var(--alert-hue) 35%, transparent);
  transform: none; z-index: auto;
}
body[data-theme-series="neon"] #write .md-alert {
  --alert-ink: color-mix(in srgb, var(--alert-hue) 62%, #fff);
  --alert-bg: color-mix(in srgb, var(--alert-hue) 7%, var(--read-surface));
  --alert-border: color-mix(in srgb, var(--alert-hue) 34%, var(--read-surface));
  --alert-icon-bg: color-mix(in srgb, var(--alert-hue) 16%, var(--read-surface));
  box-shadow: inset 0 1px 0 #ffffff04;
}
body[data-theme-series="neon"] #write .md-alert:hover { box-shadow: inset 0 1px 0 #ffffff04; }
/* 短色条与标题对齐，避免整块长边框过于抢眼。 */
#write .md-alert::before {
  content: '' !important; position: absolute; inset: 18px auto auto 0;
  width: 3px; height: 24px; border-radius: 0 3px 3px 0;
  background: var(--alert-ink); opacity: .85; pointer-events: none;
}
#write .md-alert::after,
#write .md-alert .md-alert-text-container::before,
#write .md-alert .md-alert-text-container::after { content: none !important; }
/* 完整重置旧引擎的标题胶囊：标题宽度随内容自然伸展。 */
#write .md-alert .md-alert-text-container {
  display: block; position: relative; width: auto; max-width: none;
  margin: 0 0 10px; padding: 0; border: 0; border-radius: 0;
  background: none; box-shadow: none; color: var(--alert-ink);
  font-size: 1em; font-weight: 700; line-height: 1.5; overflow: visible;
}
#write .md-alert .md-alert-text {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  margin: 0; padding: 0; border: 0; border-radius: 0;
  background: none; box-shadow: none; color: var(--alert-ink);
  font-size: .94em; font-weight: 700; line-height: 1.5; letter-spacing: .01em;
}
/* 保留 SVG 路径的描边；旧引擎的 fill:currentColor 会把线性图标涂成色块。 */
#write .md-alert .md-alert-text > svg {
  display: block; position: static; top: auto; flex: 0 0 auto;
  width: 16px; height: 16px; margin: 0; padding: 5px;
  box-sizing: content-box; border: 1px solid var(--alert-border); border-radius: 8px;
  color: var(--alert-ink); fill: none; stroke: currentColor; stroke-width: 1.5;
  background: var(--alert-icon-bg); box-shadow: none;
  transform: translateY(calc(var(--heading-marker-shift) - 1px));
}
#write .md-alert .md-alert-name {
  min-width: 0; margin: 0; padding: 0; color: inherit;
  background: none; border: 0; border-radius: 0; box-shadow: none;
  overflow-wrap: anywhere;
}
#write .md-alert > :last-child { margin-bottom: 0; }
#write .md-alert > :nth-child(2) { margin-top: 0; }
#write .md-alert :is(h1, h2, h3, h4, h5, h6) { margin-top: 20px; }
#write .md-alert :is(h2, h3, h4, h5, h6), #write .md-alert :is(h2, h3, h4, h5, h6):is(:hover, :focus, .md-focus) { padding-left: 0; }
#write .md-alert :is(.code-block, .table-wrap, .math-block, blockquote, details, figure) { margin-top: 14px; margin-bottom: 14px; }
#write .md-alert > :is(.code-block, .table-wrap, .math-block, blockquote, details, figure):last-child { margin-bottom: 0; }
#write .md-alert > .md-alert { margin-top: 14px; }
#write .md-alert-note, #write .md-alert-abstract { --alert-hue: #55738e; }
#write .md-alert-info, #write .md-alert-todo { --alert-hue: #3576b5; }
#write .md-alert-tip { --alert-hue: #238570; }
#write .md-alert-success { --alert-hue: #31804d; }
#write .md-alert-question, #write .md-alert-important { --alert-hue: #8060ae; }
#write .md-alert-warning { --alert-hue: #a7781b; }
#write .md-alert-caution { --alert-hue: #b76825; }
#write .md-alert-failure, #write .md-alert-danger { --alert-hue: #b64d49; }
#write .md-alert-bug { --alert-hue: #a04f82; }
#write .md-alert-example { --alert-hue: #5a6bb1; }
#write .md-alert-quote { --alert-hue: #6a7680; }

/* 图片：默认完整边缘，位图可圆角，作者明确提供图注。 */
#write img, #write img:hover { max-width: 100%; height: auto; margin: 0; border-radius: 0; filter: none; transform: none; box-shadow: none !important; transition: none; }
#write img.media-image, #write img.image-rounded { border-radius: 8px; }
#write img.image-plain { border-radius: 0; }
#write p:has(> img), #write figure { margin: 24px 0; }
#write p > img:only-child, #write figure > img { display: block; margin: 0 auto; }
#write figure:has(> img) { text-align: center; }
#write figcaption, #write figure:hover > figcaption { display: block; margin: 8px 0 0; font-size: .825em; line-height: 1.65; color: var(--read-quiet); text-align: center; transition: none; }
body[data-theme-series="neon"] #write img { outline: 1px solid var(--read-line-soft); outline-offset: 1px; }

/* 代码工具栏在 pre 外，语言与复制按钮互不遮挡。 */
#write .code-block { margin: 24px 0; min-width: 0; border: 1px solid var(--read-line); border-radius: 8px; background: var(--read-block-bg); overflow: hidden; }
#write .code-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; box-sizing: border-box; padding: 4px 12px 4px 16px; border-bottom: 1px solid var(--read-line-soft); font: 12px/1.5 var(--read-mono); color: var(--read-quiet); white-space: normal; }
#write .code-label { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; min-width: 0; }
#write .code-language { flex: none; }
#write .code-filename { color: var(--read-fg); overflow-wrap: anywhere; }
#write pre.md-fences { max-width: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; overflow-x: auto; font: 14px/1.7 var(--read-mono); color: var(--read-code-fg); }
#write .md-fences::before, #write .md-fences::after { content: none !important; display: none !important; }
#write .md-fences > code.md-fencescode { display: block; width: max-content; min-width: 100%; box-sizing: border-box; padding: 16px; margin: 0; color: inherit; background: none; border: 0; font: inherit; letter-spacing: 0; white-space: pre; word-break: normal; overflow-wrap: normal; tab-size: 4; }
#write .code-copy { position: static; flex: none; opacity: 1; min-height: 32px; height: auto; padding: 4px 9px; border: 1px solid transparent; border-radius: 5px; background: transparent; font: 12px/1.5 var(--font-body); color: var(--read-quiet); cursor: pointer; transition: color .15s, background .15s; }
#write .code-copy:hover, #write .code-copy:focus-visible { color: var(--read-fg); background: var(--read-code-bg); border-color: var(--read-line-soft); }
#write .code-copy:disabled { cursor: wait; }
#write pre.md-fences:focus-visible { outline-offset: -3px; }
#write .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
#write pre[lang="mermaid"] { margin: 24px 0; padding: 16px; border: 1px solid var(--read-line-soft); border-radius: 8px; background: var(--read-surface); }
#write .md-diagram { overflow-x: auto; text-align: center; }
#write .md-diagram svg { display: block; margin: auto; }
/* 引擎 token 颜色带 !important；在正文作用域覆盖。 */
#write .md-fences :is(.cm-keyword, .cm-tag, .cm-builtin) { color: var(--read-syntax-keyword) !important; font-weight: 600 !important; }
#write .md-fences :is(.cm-string, .cm-string-2) { color: var(--read-syntax-string) !important; }
#write .md-fences :is(.cm-number, .cm-atom) { color: var(--read-syntax-number) !important; }
#write .md-fences :is(.cm-def, .cm-variable-2, .cm-variable-3, .cm-attribute, .cm-property) { color: var(--read-syntax-function) !important; }
#write .md-fences :is(.cm-comment, .cm-meta) { color: var(--read-syntax-comment) !important; font-style: normal; }
#write .md-fences .cm-type { color: var(--read-syntax-type) !important; font-style: normal; }
#write .md-fences :is(.cm-variable, .cm-operator) { color: inherit !important; }

/* 行内代码：主题色浅底与细描边，不改变正文基线和换行行为。 */
#write code:not(.md-fencescode), #write code:not(.md-fencescode):hover {
  padding: .12em .42em; margin: 0 .08em; border: 1px solid var(--read-inline-code-line); border-radius: 5px;
  background: var(--read-inline-code-bg); color: var(--read-inline-code-fg); font: 500 .86em/1.65 var(--read-mono);
  vertical-align: baseline; letter-spacing: 0; overflow-wrap: anywhere; word-break: normal;
  box-shadow: none; transform: none; transition: none; -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
#write :is(strong, b) > code:not(.md-fencescode) { font-weight: 700; }
/* 文字强调保留原本语义。 */
#write strong, #write b, #write strong:hover, #write mark strong, #write mark:hover strong { color: inherit; font-weight: 700; border: 0; background: none; text-shadow: none; transform: none; transition: none; }
#write em, #write i, #write em:hover { color: inherit; font-style: italic; font-weight: inherit; padding: 0; background: none; animation: none; transition: none; -webkit-text-stroke: 0; }
#write u { text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: currentColor; text-underline-offset: .2em; }
#write del, #write s, #write del:hover { color: var(--read-quiet); text-decoration: line-through; text-decoration-color: currentColor; opacity: 1; cursor: auto; }
#write mark, #write mark:hover { padding: .03em .12em; margin: 0; border-radius: 2px; background: var(--read-mark-bg) !important; color: var(--read-mark-fg) !important; transition: none; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
#write .text-red { color: var(--read-color-red); }
#write .text-blue { color: var(--read-color-blue); }
#write .text-green { color: var(--read-color-green); }
#write .text-purple { color: var(--read-color-purple); }
#write kbd, #write kbd:hover { display: inline-block; padding: .08em .35em; margin: 0 .12em; min-width: 1.5em; border: 1px solid var(--read-line); border-bottom-width: 2px; border-radius: 4px; background: var(--read-block-bg); color: var(--read-fg); font: .8em/1.5 var(--read-mono); text-align: center; box-shadow: none; transform: none; transition: none; }
#write a, #write a:visited, #write a:not(.md-toc-inner):hover { padding: 0; margin: 0; border: 0; border-radius: 0; background: none; color: var(--read-link); font-weight: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); text-decoration-thickness: 1px; text-underline-offset: .2em; box-shadow: none; transition: text-decoration-color .15s; }
#write a:not(.md-toc-inner):hover { text-decoration-color: currentColor; }
#write p a:not(.md-toc-inner)::before { content: none !important; }
#write a:has(> img:only-child) { text-decoration: none; }
#write :is(h1, h2, h3, h4, h5, h6) code:not(.md-fencescode):hover { padding: 0; border: 0; background: none; color: inherit; }

/* 脚注、按键与折叠块。 */
#write sup { vertical-align: super; font-size: .72em; line-height: 0; }
#write sup.md-footnote { margin: 0 .1em; padding: 0; border-radius: 0; background: none; }
#write .md-footnote a, #write sup a { text-decoration: none; }
#write .footnotes-sep { display: none; }
#write .footnotes { margin-top: 36px; padding-top: 14px; border-top: 1px solid var(--read-line); font-size: .875em; color: var(--read-quiet); }
#write .footnotes p { margin: .35em 0; }
#write details { margin: 24px 0; padding: 14px 16px; border: 1px solid var(--read-line); border-radius: 8px; background: var(--read-block-bg); }
#write summary { cursor: pointer; color: var(--read-fg); font-weight: 600; }
#write details[open] > summary { margin-bottom: 12px; }
#write .math-error { color: var(--read-color-red); font: .9em/1.6 var(--read-mono); }
#write :is(.table-wrap, .math-block, pre.md-fences) { -webkit-overflow-scrolling: touch; scrollbar-width: thin; }

@media (max-width: 640px) {
  :root { --read-fs: 16px; --read-para: 12px; }
  .site-post { padding-left: 20px; padding-right: 20px; }
  .post-head h1 { font-size: 1.8rem; }
  #write { padding: 12px 0; }
  #write h1, #write h1:is(:hover, :focus, .md-focus) { font-size: 1.65em; margin-top: 36px; }
  #write h2, #write h2:is(:hover, :focus, .md-focus) { font-size: 1.4em; margin-top: 32px; }
  #write h3, #write h3:is(:hover, :focus, .md-focus) { font-size: 1.2em; margin-top: 26px; }
  #write :is(.md-alert, figure, .code-block, .table-wrap, .math-block, blockquote, details) { margin-top: 20px; margin-bottom: 20px; }
  #write .md-alert { margin-top: 18px; margin-bottom: 18px; padding: 14px 16px; border-radius: 10px; }
  #write .md-alert::before { top: 16px; }
  #write .md-alert .md-alert-text-container { margin-bottom: 8px; }
  #write table { font-size: .94em; }
  #write table :is(th, td) { padding: 9px 12px; }
  #write pre.md-fences { font-size: 13px; }
  #write .md-fences > code.md-fencescode { padding: 14px; }
  #write blockquote { padding-left: 14px; }
}
@media print {
  #write { --read-inline-code-fg: #343e4e; --read-inline-code-bg: #f1f3f5; --read-inline-code-line: #d6dbe0; }
  #write { --read-fg: #222; --read-quiet: #555; --read-surface: #fff; --read-link: #24466e; --read-code-fg: #343e4e; --read-code-bg: #f1f3f5; --read-mark-bg: #fff0ad; --read-mark-fg: #393121; }
  #write { --read-line: #00000038; --read-line-soft: #00000020; --read-syntax-keyword: #7940a5; --read-syntax-string: #226947; --read-syntax-number: #9a4c13; --read-syntax-function: #225ba1; --read-syntax-comment: #657080; --read-syntax-type: #8d3d64; }
  #write .code-copy { display: none; }
  .math-copy-status { display: none; }
  #write .math-copy { outline: none !important; background: none !important; }
  #write .md-fences > code.md-fencescode { width: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
  #write :is(.code-block, .md-alert, figure) { break-inside: avoid; }
}
