.markdown-workbench { --writer-height: clamp(460px, 62vh, 700px); --writer-split: 46%; --writer-muted: #737775; --writer-ink: #303432; border-radius: 6px; background: #fff; box-shadow: 0 5px 32px #26302906; color: var(--writer-ink); }
.editor-menubar { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 8px 14px; background: #fff; gap: 10px; }
.editor-menubar-start { display: inline-flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.editor-modes { display: inline-flex; background: #f3f4f2; padding: 3px; gap: 2px; border-radius: 8px; }
.editor-modes button { display: inline-flex; align-items: center; justify-content: center; width: 68px; gap: 6px; height: 30px; font-size: 12px; color: #686d68; border: 0; background: transparent; border-radius: 6px; cursor: pointer; }
.editor-modes button svg { width: 14px; height: 14px; }
.editor-modes button.active { color: #922a25; background: #fff; box-shadow: 0 1px 5px #222a2010; }
.editor-assist { display: inline-flex; align-items: center; gap: 6px; }
.editor-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid #e4e7e2;
  border-radius: 999px;
  background: #fff;
  color: #4f5751;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}
.editor-chip svg { width: 14px; height: 14px; flex: 0 0 auto; }
.editor-chip span { line-height: 1; white-space: nowrap; }
.editor-chip:hover {
  border-color: color-mix(in srgb, var(--front-red, #8c0000) 28%, #e4e7e2);
  color: var(--front-red, #8c0000);
  background: #fff8f6;
}
.editor-chip[aria-pressed="true"],
.editor-chip[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--front-red, #8c0000) 34%, #e4e7e2);
  background: color-mix(in srgb, var(--front-soft, #fff6f4) 88%, white);
  color: var(--front-red, #8c0000);
  box-shadow: 0 1px 4px rgba(140, 0, 0, 0.08);
}
.editor-focus-chip[aria-pressed="true"] {
  background: var(--front-red, #8c0000);
  border-color: var(--front-red, #8c0000);
  color: #fff;
  box-shadow: 0 4px 12px rgba(140, 0, 0, 0.18);
}
.editor-focus-chip[aria-pressed="true"]:hover {
  background: #730000;
  border-color: #730000;
  color: #fff;
}
.editor-utilities { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; }
.sync-control { color: #777c76; margin-right: 10px; }
.admin-body .sync-control input { accent-color: #963631; }
.copy-rich-button { display: inline-flex; align-items: center; gap: 6px; color: #fff; font-size: 12px; font-weight: 650; border-radius: 4px; background: var(--front-red, #8c0000); padding: 8px 12px; margin-left: 8px; box-shadow: 0 4px 12px #8c00001c; }
.copy-rich-button:hover { background: #730000; }
.copy-rich-button:disabled { opacity: .62; cursor: wait; }
.editor-toolbar { position: relative; min-height: 46px; background: #f7f8f6; padding: 6px 12px; gap: 6px; }
.format-tools { display: flex; gap: 3px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; min-width: 0; }
.format-tools .icon-button { width: 33px; height: 32px; color: #555d55; }
.format-tools .icon-button svg { width: 17px; height: 17px; }
.format-tools .tool-break { margin-left: 10px; }
.format-tools .icon-button[aria-pressed="true"] { color: #992f29; background: #f1e3df; }
.format-tools .heading-button { width: 50px; gap: 2px; }
.editor-toolbar > #find-editor,
.editor-toolbar > #focus-editor {
  flex: 0 0 auto;
  width: 33px;
  height: 32px;
  color: #555d55;
}
.editor-toolbar > #find-editor { margin-left: auto; }
.editor-toolbar > #focus-editor[aria-pressed="true"] {
  color: #992f29;
  background: #f1e3df;
}
.editor-toolbar > #find-editor svg,
.editor-toolbar > #focus-editor svg { width: 17px; height: 17px; }
.heading-button .heading-chevron { width: 11px !important; }
.heading-menu { position: absolute; top: calc(100% - 2px); left: 90px; z-index: 15; width: 174px; padding: 6px; background: #fff; box-shadow: 0 6px 28px #222c2424; border-radius: 6px; }
.heading-menu button { display: flex; justify-content: space-between; gap: 16px; width: 100%; padding: 10px; text-align: left; color: #3f4840; border: 0; background: transparent; font-size: 13px; border-radius: 3px; }
.heading-menu button span { color: #9b9d96; font-size: 11px; }
.heading-menu button:hover { color: #94332d; background: #faf2ef; }
.editor-search { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 9px 14px; background: #f2f4f0; }
.admin-body .editor-search input { width: 160px; padding: 7px 9px; font-size: 12px; background: white; }
.editor-search > span { color: #747e6d; font-size: 11px; min-width: 36px; margin: 0 4px; }
.search-command { color: #59664d; font-size: 12px; padding: 6px 8px; border: 0; background: transparent; }
.search-command:hover { color: #922d27; }
.editor-panes { display: grid; grid-template-columns: minmax(0,var(--writer-split)) 7px minmax(0,1fr); }
.source-pane { background: #fafbf9; min-width: 0; }
.editor-doc-title {
  margin: 0;
  padding: 12px 18px 4px;
  color: #8c0000;
  font: 650 1.12rem/1.5 "Noto Serif SC", "Songti SC", "Microsoft YaHei", serif;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.editor-doc-title .hash {
  margin-right: .4em;
  color: #c4a8a4;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-weight: 500;
}
.editor-doc-title.is-empty { color: #b7b2ae; font-weight: 500; }
.pane-heading, .preview-controls { height: 42px; min-height: 42px; padding: 6px 24px; font-size: 11px; color: #8a8f87; }
.pane-heading > span:first-child { display: flex; gap: 7px; align-items: center; color: #7a8175; }
.pane-heading svg { width: 13px; height: 13px; }
.pane-heading .file-type { font: 10px Consolas,monospace; color: #969c90; }
.preview-controls { flex-wrap: nowrap; gap: 9px; padding: 6px 20px 6px 30px; }
.preview-label { color: #7f8778; white-space: nowrap; font-size: 11px; margin-right: auto; }
.theme-picker { display: inline-flex; align-items: center; gap: 0; margin: 0 7px 0 0; }
.theme-gallery-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 10px 4px 8px;
  border: 1px solid #e2e5df;
  border-radius: 999px;
  background: #f7f8f5;
  color: #4a5248;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.theme-gallery-trigger:hover {
  border-color: color-mix(in srgb, var(--front-red, #8c0000) 28%, #e2e5df);
  background: #fff;
  color: var(--front-red, #8c0000);
}
.theme-gallery-trigger .theme-name { max-width: 6.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-gallery-trigger svg { width: 14px; height: 14px; opacity: 0.72; }
.theme-swatch-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background:
    linear-gradient(135deg, var(--swatch, #8c0000) 0 52%, var(--swatch-secondary, #eadbd7) 52% 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  flex: 0 0 auto;
}
.preview-controls > .icon-button { width: 28px; height: 28px; }
.preview-controls > .icon-button svg { width: 16px; height: 16px; }
.pane-resizer { background: #f4f5f2; cursor: col-resize; position: relative; touch-action: none; }
.pane-resizer::after { content: ""; width: 2px; height: 28px; background: #c7cdc1; border-radius: 2px; position: absolute; left: 2px; top: 45%; opacity: 0; transition: opacity .15s; }
.pane-resizer:hover::after, .pane-resizer:focus-visible::after { opacity: 1; }
.pane-resizer:focus-visible { outline: 2px solid #a54b4344; outline-offset: -2px; }
.markdown-workbench.resizing { user-select: none; }
.preview-scroll { height: var(--writer-height); padding: 24px 38px 50px; background: #fff; scrollbar-color: #d6dacf transparent; scrollbar-gutter: stable; }
.preview-scroll > .markdown-article { max-width: 690px; margin: 0 auto; }
.preview-scroll.mobile-preview { background: #f1f3ef; padding: 24px; }
.preview-scroll.mobile-preview .markdown-article { padding: 26px 22px; min-height: 100%; width: min(100%,375px); box-shadow: 0 2px 16px #26312207; }
.preview-body {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  min-width: 0;
}
.preview-body > .preview-scroll { min-width: 0; }
.preview-publish-rail {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 6px;
  border-left: 1px solid #e8ebe6;
  background: #f7f8f5;
}
.preview-publish-rail button {
  display: grid;
  gap: 3px;
  place-items: center;
  width: 100%;
  min-height: 52px;
  padding: 6px 2px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #5f675f;
  font: inherit;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.2;
  cursor: pointer;
}
.preview-publish-rail button svg { width: 16px; height: 16px; }
.preview-publish-rail button:hover,
.preview-publish-rail button[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--front-red, #8c0000) 24%, transparent);
  background: #fff;
  color: var(--front-red, #8c0000);
}
.preview-publish-rail button:disabled { opacity: 0.55; cursor: wait; }
.typesetting-check {
  display: flex !important;
  align-items: center;
  justify-content: flex-start !important;
  gap: 8px !important;
  font-size: 12px;
  color: #687160;
}
.typesetting-check input { accent-color: var(--front-red, #8c0000); }
.editor-statusbar .status-help {
  padding: 0;
  border: 0;
  background: transparent;
  color: #6d746c;
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}
.editor-statusbar #status-editor-guide { margin-left: auto; }
.editor-statusbar .status-help:hover { color: var(--front-red, #8c0000); }
.editor-statusbar #status-theme { margin-left: 0; color: #6d746c; font-weight: 650; }
.editor-tutorial-wrap { position: relative; }
.editor-tutorial-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  display: grid;
  min-width: 168px;
  max-height: min(70vh, 520px);
  padding: 6px;
  overflow: auto;
  border: 1px solid #e4e6e2;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(28, 32, 29, 0.12);
}
.editor-tutorial-menu[hidden] { display: none !important; }
.editor-tutorial-menu hr {
  margin: 4px 6px;
  border: 0;
  border-top: 1px solid #eceee9;
}
.editor-tutorial-menu button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #3a413c;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.editor-tutorial-menu button:hover,
.editor-tutorial-menu button:focus-visible {
  background: #f3f5f1;
  color: var(--front-red, #8c0000);
  outline: none;
}
.editor-guide-overlay {
  position: fixed;
  inset: 0;
  z-index: 12050;
  pointer-events: auto;
}
.editor-guide-overlay[hidden] { display: none !important; }
.editor-guide-dim {
  position: absolute;
  background: rgba(28, 32, 29, 0.62);
  pointer-events: auto;
}
.editor-guide-ring {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid color-mix(in srgb, var(--front-red, #8c0000) 82%, #fff);
  border-radius: 10px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--front-red, #8c0000) 18%, transparent);
  pointer-events: none;
}
.editor-guide-card {
  position: absolute;
  z-index: 2;
  display: grid;
  gap: 12px;
  width: min(340px, calc(100vw - 28px));
  padding: 16px;
  border: 1px solid #e4e6e2;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(28, 32, 29, 0.2);
}
.editor-guide-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.editor-guide-head .dialog-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: #8a918b;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
}
.editor-guide-head h2 {
  margin: 0;
  color: #2c332e;
  font-size: 1.08rem;
  line-height: 1.35;
}
.editor-guide-lead {
  margin: 0;
  color: #5f675f;
  font-size: 13px;
  line-height: 1.65;
}
.editor-guide-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
body.editor-guide-active {
  overflow: hidden;
}
.editor-lesson-dialog {
  width: min(720px, calc(100vw - 28px));
  max-height: min(86vh, 760px);
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
}
.editor-lesson-dialog::backdrop { background: rgba(28, 32, 29, 0.42); }
.editor-lesson-shell {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid #e4e6e2;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(28, 32, 29, 0.14);
}
.editor-lesson-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.editor-lesson-head h2 {
  margin: 0;
  color: #2c332e;
  font-size: 1.15rem;
}
.editor-lesson-head p {
  margin: 0;
  color: #6d746c;
  font-size: 13px;
  line-height: 1.6;
}
.editor-lesson-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.editor-lesson-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 220px;
}
.editor-lesson-source,
.editor-lesson-preview {
  margin: 0;
  padding: 14px;
  border: 1px solid #e7e9e4;
  border-radius: 8px;
  overflow: auto;
  max-height: min(48vh, 420px);
}
.editor-lesson-source {
  background: #f6f7f4;
  color: #333a32;
  font: 13px/1.65 Consolas, "SFMono-Regular", Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.editor-lesson-preview {
  background: #fff;
  font-size: 15px;
}
.editor-lesson-preview > :first-child { margin-top: 0; }
.markdown-help-dialog {
  width: min(760px, calc(100vw - 28px));
  max-height: min(86vh, 720px);
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
}
.markdown-help-dialog::backdrop { background: rgba(28, 32, 29, 0.42); }
.markdown-help-shell {
  display: grid;
  gap: 14px;
  max-height: min(86vh, 720px);
  padding: 18px;
  overflow: auto;
  border: 1px solid #e4e6e2;
  border-radius: 10px;
  background: #fafbf8;
  box-shadow: 0 24px 60px rgba(28, 32, 29, 0.18);
}
.markdown-help-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.markdown-help-head h2 {
  margin: 4px 0 0;
  color: #2c322c;
  font-size: 1.15rem;
}
.markdown-help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}
.markdown-help-grid section {
  padding: 12px;
  border: 1px solid #e6e9e3;
  border-radius: 8px;
  background: #fff;
}
.markdown-help-grid h3 {
  margin: 0 0 8px;
  color: #445045;
  font-size: 12px;
  font-weight: 750;
}
.markdown-help-grid pre {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #5a635a;
  font: 11px/1.55 Consolas, "Microsoft YaHei", monospace;
  white-space: pre-wrap;
}
.preview-placeholder { color: #a9aea4; font-size: 14px; padding: 36px 0; }
.typesetting-popover { position: absolute; right: 18px; top: 42px; z-index: 12; width: 244px; padding: 18px; background: #fff; border-radius: 6px; box-shadow: 0 6px 30px #27322320; display: grid; gap: 18px; }
.typesetting-popover > label, .typesetting-popover > div { display: flex; align-items: center; justify-content: space-between; gap: 15px; font-size: 12px; color: #687160; }
.admin-body .typesetting-popover select, .admin-body .typesetting-popover #article-font { background: #f3f5f0; width: 132px; font-size: 12px; padding: 7px 8px; }

.theme-gallery-dialog {
  width: min(920px, calc(100vw - 28px));
  max-width: 920px;
  max-height: min(88vh, 820px);
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
}
.theme-gallery-dialog::backdrop {
  background: rgba(28, 32, 29, 0.42);
}
.theme-gallery-shell {
  display: grid;
  gap: 14px;
  max-height: min(88vh, 820px);
  padding: 18px 18px 20px;
  overflow: auto;
  border: 1px solid #e4e6e2;
  border-radius: 10px;
  background: #fafbf8;
  box-shadow: 0 24px 60px rgba(28, 32, 29, 0.18);
}
.theme-gallery-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.theme-gallery-head .dialog-eyebrow {
  display: block;
  color: #8a918b;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
}
.theme-gallery-head h2 {
  margin: 4px 0 0;
  color: #2c322c;
  font-size: 1.2rem;
  font-weight: 750;
}
.theme-gallery-lead {
  margin: 0;
  color: #6d746c;
  font-size: 13px;
  line-height: 1.55;
}
.theme-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.theme-gallery-card {
  display: grid;
  grid-template-rows: minmax(168px, 1fr) auto;
  min-height: 228px;
  overflow: hidden;
  border: 1px solid #e2e5df;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(28, 32, 29, 0.05);
  cursor: pointer;
}
.theme-gallery-card:hover {
  border-color: color-mix(in srgb, var(--front-red, #8c0000) 28%, #e2e5df);
}
.theme-gallery-card.is-active {
  border-color: color-mix(in srgb, var(--front-red, #8c0000) 45%, #e2e5df);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--front-red, #8c0000) 35%, transparent), 0 10px 24px rgba(28, 32, 29, 0.08);
}
.theme-gallery-preview {
  box-sizing: border-box;
  height: 176px;
  padding: 12px 12px 8px;
  overflow: hidden;
  background: var(--article-soft, #fafbf9);
  pointer-events: none;
}
.theme-gallery-preview h1 {
  margin: 0 0 7px !important;
  font-size: 14px !important;
  line-height: 1.25 !important;
}
.theme-gallery-preview h2 {
  margin: 0 0 5px !important;
  font-size: 12px !important;
  line-height: 1.3 !important;
}
.theme-gallery-preview h3 {
  margin: 0 0 5px !important;
  font-size: 11px !important;
  line-height: 1.3 !important;
}
.theme-gallery-preview p {
  margin: 0 0 6px !important;
  font-size: 11px !important;
  line-height: 1.45 !important;
  color: var(--article-text, #333) !important;
}
.theme-gallery-preview blockquote {
  margin: 0 !important;
  padding: 6px 8px !important;
  font-size: 11px !important;
}
.theme-gallery-preview blockquote p { margin: 0 !important; }
.theme-gallery-card > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid #eef0ec;
  background: #fff;
}
.theme-gallery-card > footer strong {
  color: #343c35;
  font-size: 13px;
  font-weight: 700;
}
.theme-gallery-use {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #e2e5df;
  border-radius: 4px;
  background: #f7f8f5;
  color: #4a5248;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.theme-gallery-card.is-active .theme-gallery-use,
.theme-gallery-use:hover {
  border-color: color-mix(in srgb, var(--front-red, #8c0000) 35%, #e2e5df);
  background: color-mix(in srgb, var(--front-red, #8c0000) 8%, #fff);
  color: var(--front-red, #8c0000);
}
.font-stepper { gap: 10px; }
.font-stepper .icon-button { width: 28px; height: 28px; background: #f3f5f0; }
.font-stepper output { width: 38px; font-size: 13px; color: #485342; }
.font-stepper output::after { content: " px"; font-size: 10px; color: #8b9384; }
.article-outline { right: 15px; top: 42px; }
.editor-statusbar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; min-height: 34px; background: #f7f8f5; padding: 8px 18px; font-size: 11px; color: #8a9282; }
.admin-body .CodeMirror { height: var(--writer-height); background: #fafbf9; color: #424b3f; font: 15px/1.9 Consolas,"Microsoft YaHei",monospace; }
.CodeMirror-lines { padding: 24px 0 50px; }
.CodeMirror pre.CodeMirror-line, .CodeMirror pre.CodeMirror-line-like { padding: 0 24px 0 12px; }
.CodeMirror-gutters { background: transparent; }
.CodeMirror-linenumber { padding: 0 6px 0 14px; font-size: 11px; color: #aeb7a5; }
.CodeMirror-cursor { border-left-color: #9e3e34; border-left-width: 2px; }
.CodeMirror-selected { background: #e5e9df !important; }
.CodeMirror-focused .CodeMirror-selected { background: #e8e1da !important; }
.cm-s-default .cm-header { color: #973c32; font-weight: 650; }
.cm-s-default .cm-formatting { color: #a9b09f; }
.cm-s-default .cm-strong { color: #33422e; font-weight: 650; }
.cm-s-default .cm-em { color: #52614a; }
.cm-s-default .cm-quote { color: #7b886e; }
.cm-s-default .cm-link, .cm-s-default .cm-string { color: #3c8074; }
.cm-s-default .cm-comment { color: #7f6647; }
.CodeMirror-empty { color: #a7b19b; }
.admin-body .CodeMirror textarea { min-height: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; outline: none; line-height: normal; }
.cm-searching { background: #f6e6a5; }
.markdown-workbench:not([data-mode="split"]) .pane-resizer { display: none; }
.markdown-workbench[data-mode="preview"] .editor-toolbar, .markdown-workbench[data-mode="preview"] .editor-search { display: none; }
.markdown-workbench[data-mode="write"] .editor-panes, .markdown-workbench[data-mode="preview"] .editor-panes { grid-template-columns: minmax(0,1fr); }
.markdown-workbench[data-mode="write"] .CodeMirror-lines { max-width: 920px; margin: auto; }
.editor-focused .markdown-workbench { inset: 0; border-radius: 0; box-shadow: none; }
.editor-focused .editor-panes { flex: 1; min-height: 0; }
.editor-focused .source-pane, .editor-focused .preview-pane { min-height: 0; }
.editor-focused .CodeMirror { height: 0; flex: 1; min-height: 0; }
.editor-focused .preview-body {
  height: 0;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
}
.editor-focused .preview-body > .preview-scroll { height: 0; min-height: 0; overflow: auto; }
body.editor-focused {
  overflow: hidden;
}
body.editor-focused .site-footer,
body.editor-focused .topbar,
body.editor-focused .important-reminder,
body.editor-focused .wechat-share-guide {
  display: none !important;
}
body.editor-focused .markdown-workbench {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  flex-direction: column;
  width: auto;
  max-width: none;
  border-radius: 0;
  box-shadow: none;
}
.block-dialog { width: min(530px,calc(100% - 32px)); }
.media-insert-dialog { width: min(520px,calc(100% - 32px)); }
.media-insert-dialog #image-source-fields,
.media-insert-dialog #image-caption-fields { display: grid; gap: 14px; }
.image-caption-hint { margin: 0; color: #8a9285; font-size: 11px; line-height: 1.6; }
.image-source-tabs { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 3px; padding: 3px; background: #f0f2ee; border-radius: 5px; }
.image-source-tabs button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; border-radius: 3px; background: transparent; color: #778071; font: inherit; font-weight: 650; cursor: pointer; }
.image-source-tabs button.active { background: #fff; color: var(--front-red, #8c0000); box-shadow: 0 1px 7px #2a362215; }
.image-source-tabs svg { width: 15px; height: 15px; }
#image-upload-pane { display: grid; gap: 12px; }
.image-dropzone { min-height: 126px; place-items: center; align-content: center; gap: 5px !important; padding: 20px; border: 1px dashed #bdc4b8; border-radius: 6px; background: #fafbf9; text-align: center; cursor: pointer; transition: border-color .15s ease,background-color .15s ease; }
.image-dropzone:hover,.image-dropzone.dragging { border-color: var(--front-red, #8c0000); background: var(--front-soft, #fbf6f5); }
.image-dropzone svg { width: 26px; height: 26px; color: var(--front-red, #8c0000); }
.image-dropzone strong { color: #394238; font-size: 14px; }
.image-dropzone span,.image-storage-note { color: #8a9285; font-size: 11px; }
.image-file-summary { display: grid; grid-template-columns: 56px minmax(0,1fr) 32px; gap: 12px; align-items: center; min-height: 66px; padding: 8px; background: #f6f7f4; border-radius: 5px; }
.image-file-summary img { width: 56px; height: 50px; object-fit: cover; border-radius: 3px; background: #fff; }
.image-file-summary div { min-width: 0; display: grid; gap: 3px; }
.image-file-summary strong { overflow: hidden; color: #394238; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.image-file-summary span { color: #8a9285; font-size: 11px; }
.image-storage-note,.dialog-message { min-height: 18px; margin: 0; line-height: 1.6; }
.dialog-message { color: var(--front-red, #8c0000); font-size: 12px; }
.nsd-image-loading { opacity: .45; }
.block-fields { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.block-wide { grid-column: 1 / -1; }
.block-dialog textarea { font: 14px/1.7 Consolas,"Microsoft YaHei",monospace; min-height: 120px; resize: vertical; }
#math-fields { display: grid; gap: 16px; }
.math-dialog-preview { overflow: auto; padding: 16px; min-height: 74px; color: #3f4c35; background: #f8f9f5; }
.math-dialog-preview .katex { font-size: 1.2em; }
.export-dialog .export-word-note { margin: 0; color: #7a817c; font-size: 12px; line-height: 1.65; }
.export-dialog form { gap: 18px; }
.export-dialog .dialog-heading > div { display: grid; gap: 2px; }
.dialog-eyebrow { color: #9b3029; font: 650 10px/1.2 Arial,sans-serif; }
.export-kind-tabs { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 3px; padding: 3px; border-radius: 5px; background: #eef0ec; }
.export-kind-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; border: 0; border-radius: 3px; color: #6d746c; background: transparent; font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; }
.export-kind-tabs button.active { color: var(--front-red, #8c0000); background: #fff; box-shadow: 0 1px 7px #26312212; }
.export-kind-tabs svg { width: 16px; height: 16px; }
.export-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.export-fields[hidden] { display: none; }
#image-export-fields label { grid-column: 1 / -1; }
#word-export-fields { grid-template-columns: minmax(0,1fr); }
.export-summary { display: grid; grid-template-columns: 62px minmax(0,1fr); align-items: center; gap: 16px; min-height: 92px; padding: 14px 16px; border-left: 3px solid var(--front-red, #8c0000); background: #f6f7f4; }
.export-summary > div:last-child { display: grid; gap: 5px; }
.export-summary strong { color: #343c35; font-size: 14px; }
.export-summary small { color: #7c847b; font-size: 11px; line-height: 1.55; }
#export-type-note { color: var(--front-red, #8c0000); }
.export-live-preview { display: grid; gap: 8px; margin-top: 2px; }
.export-live-preview[hidden] { display: none; }
.export-live-preview-stage {
  display: grid;
  place-items: center;
  max-height: min(42vh, 420px);
  overflow: auto;
  padding: 10px;
  border: 1px solid #e4e6e2;
  background: #f3f4f0;
}
.export-live-preview-stage img {
  display: block;
  max-width: 100%;
  height: auto;
  background: #faf9f6;
  box-shadow: 0 8px 24px #26312214;
}
.export-live-preview-stage iframe {
  width: 100%;
  min-height: 280px;
  height: min(38vh, 360px);
  border: 0;
  background: #fff;
}
#export-preview-caption { margin: 0; color: #6d746c; font-size: 12px; }
.export-paper-preview { position: relative; width: 52px; height: 68px; justify-self: center; overflow: hidden; border: 1px solid #d7c1bd; background: #fff; box-shadow: 3px 4px 0 #e6e8e3; transition: width .18s ease,height .18s ease; }
.export-paper-preview::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 4px; background: var(--front-red, #8c0000); }
.export-paper-preview span { display: block; height: 2px; margin: 14px 9px 0; background: #dfe2dc; }
.export-paper-preview span + span { margin-top: 6px; }
.export-paper-preview[data-shape="long"] { width: 38px; height: 76px; }
.export-paper-preview[data-shape="landscape"] { width: 72px; height: 50px; }
.export-status { min-height: 19px; margin: -2px 0 0; color: #667064; font-size: 12px; line-height: 1.55; }
.export-status[data-state="error"] { color: var(--front-red, #8c0000); }
.export-qr-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid #e4e6e2;
  border-radius: 6px;
  background: #fafbf9;
  color: #4a514d;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  cursor: pointer;
  user-select: none;
}
.export-qr-toggle:hover { border-color: #d7c1bd; background: #fff; }
.export-qr-toggle:has(input:checked) {
  border-color: color-mix(in srgb, var(--front-red, #8c0000) 28%, transparent);
  background: #f7ecea;
  color: #6d1212;
}
.export-qr-toggle input {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  max-width: 16px;
  margin: 0;
  padding: 0 !important;
  flex: 0 0 16px;
  border: 1.5px solid #b8bfb9;
  border-radius: 4px;
  background: #fff;
  accent-color: var(--front-red, #8c0000);
  cursor: pointer;
}
.export-qr-toggle input:checked {
  border-color: var(--front-red, #8c0000);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.2l2.8 2.8 6.2-6.2'/%3E%3C/svg%3E") center / 12px 12px no-repeat,
    var(--front-red, #8c0000);
}
.export-qr-toggle input:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--front-red, #8c0000) 28%, transparent);
  outline-offset: 2px;
}
.export-qr-note {
  margin: 0 0 12px;
  color: #8a918b;
  font-size: 12px;
  line-height: 1.5;
}
.export-qr-toggle[hidden],
.export-qr-note[hidden] { display: none !important; }
.export-status[data-state="busy"]::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: #9b3029; animation: export-pulse 1s ease-in-out infinite alternate; }
.export-dialog .dialog-actions { gap: 8px; }
.export-dialog .dialog-actions .button { min-width: 96px; justify-content: center; }
.export-dialog .dialog-actions .button svg { width: 15px; height: 15px; }
.export-dialog button:disabled { cursor: wait; opacity: .58; }
.editor-export-stage { position: fixed; left: 0; top: 0; z-index: -1; box-sizing: border-box; overflow: visible; padding: 0; color: #1f2320; background: #faf9f6; pointer-events: none; }
.editor-export-stage .export-doc-shell {
  position: relative;
  box-sizing: border-box;
  padding: 18px 56px 20px;
  overflow: visible;
  background: #faf9f6;
}
.editor-export-stage .export-doc-meta {
  position: relative;
  z-index: 1;
  margin: 0 0 14px;
  padding: 0 0 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--front-red, #8c0000) 12%, transparent);
}
.editor-export-stage .export-doc-meta strong {
  display: block;
  margin: 0 0 8px;
  color: #1f2320;
  font-family: "Noto Serif SC", "Songti SC", STSong, Georgia, serif;
  font-size: calc(var(--article-size, 20px) * 1.55);
  font-weight: 650;
  line-height: 1.38;
  letter-spacing: 0.01em;
}
.editor-export-stage .export-doc-shell[data-font="sans"] .export-doc-meta strong {
  font-family: "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}
.editor-export-stage .export-doc-meta span {
  color: #7a817c;
  font-family: "Times New Roman", Georgia, serif;
  font-size: calc(var(--article-size, 20px) * 0.68);
  letter-spacing: 0.02em;
}
.editor-export-stage .export-doc-body { position: relative; z-index: 1; }
.editor-export-stage .export-doc-body > .markdown-article {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  margin: 0;
  color: #1f2320;
  font-size: var(--article-size, 16px);
  line-height: var(--article-leading, 1.55);
  line-break: strict;
  word-break: normal;
  overflow-wrap: anywhere;
}
.editor-export-stage .export-doc-body img {
  display: block !important;
  width: auto !important;
  max-width: 50% !important;
  height: auto !important;
  margin: 18px auto !important;
  object-fit: contain;
  break-inside: avoid;
  page-break-inside: avoid;
}
.editor-export-stage .export-doc-body figure,
.editor-export-stage .export-doc-body .qa-image-link {
  max-width: 50%;
  margin-left: auto;
  margin-right: auto;
  break-inside: avoid;
  page-break-inside: avoid;
}
.editor-export-stage .export-doc-body figure.md-figure {
  max-width: 50%;
}
.editor-export-stage .export-doc-body figure img,
.editor-export-stage .export-doc-body .qa-image-link img {
  max-width: 100% !important;
  margin: 0 auto !important;
}
.editor-export-stage .export-doc-body .md-figure figcaption {
  margin-top: 10px;
}
.editor-export-stage .export-nowrap-punct { white-space: nowrap; }
.editor-export-stage .preview-placeholder { display: none; }
.editor-export-stage .export-doc-foot { position: relative; z-index: 1; margin-top: 28px; padding-top: 12px; border-top: 1px solid #e4e6e2; color: #8a918b; font-size: 11px; letter-spacing: .02em; }
@keyframes export-pulse { to { opacity: .3; transform: scale(.82); } }
@media (max-width: 1050px) {
  .preview-controls { padding-left: 18px; padding-right: 12px; gap: 5px; }
  .preview-scroll { padding: 24px; }
  .pane-heading { padding-left: 18px; padding-right: 15px; }
  .preview-label { font-size: 10px; }
  .preview-body,
  .editor-focused .preview-body { grid-template-columns: minmax(0, 1fr); }
  .preview-publish-rail {
    position: sticky;
    bottom: 0;
    z-index: 5;
    flex-direction: row;
    justify-content: space-around;
    padding: 6px 8px;
    border-left: 0;
    border-top: 1px solid #e8ebe6;
  }
  .preview-publish-rail button {
    min-height: 44px;
    width: auto;
    flex: 1 1 0;
  }
  .editor-statusbar #status-theme,
  .editor-statusbar .status-help { display: none; }
  .editor-lesson-split { grid-template-columns: 1fr; }
  .editor-chip span { display: none; }
  .editor-chip { padding: 0; width: 30px; min-height: 30px; }
}
@media (max-width: 680px) {
  .export-dialog { padding: 18px; }
  .export-fields { grid-template-columns: minmax(0,1fr); }
  .export-summary { grid-template-columns: 52px minmax(0,1fr); padding: 12px; }
  .export-paper-preview { transform: scale(.88); }
  .media-insert-dialog { padding: 18px; }
  .image-dropzone { min-height: 112px; }
  .markdown-workbench { --writer-height: 480px; }
  .editor-menubar { padding: 8px; flex-wrap: wrap; gap: 7px; }
  .editor-menubar-start { gap: 6px; }
  .editor-assist { gap: 4px; }
  .editor-modes button { width: 53px; height: 31px; font-size: 11px; gap: 4px; }
  .editor-modes button svg { display: none; }
  .editor-utilities { margin-left: auto; gap: 1px; }
  .editor-utilities > .icon-button { width: 28px; height: 29px; }
  .editor-utilities > .icon-button svg { width: 15px; }
  .copy-rich-button { margin-left: 2px; padding: 6px; width: 29px; height: 29px; justify-content: center; }
  .copy-rich-button span { display: none; }
  .copy-rich-button svg { width: 15px; height: 15px; }
  .sync-control { display: none; }
  .editor-toolbar { padding: 6px; flex-wrap: nowrap; }
  .format-tools { flex: 1; gap: 1px; }
  .format-tools .icon-button { width: 32px; height: 34px; }
  .format-tools .tool-break { margin-left: 7px; }
  .format-tools .heading-button { width: 44px; }
  .editor-panes { grid-template-columns: minmax(0,1fr); }
  .pane-resizer { display: none; }
  .pane-heading, .preview-controls { padding: 6px 16px; height: 40px; min-height: 40px; }
  .preview-controls { gap: 8px; }
  .preview-label { font-size: 11px; }
  .preview-scroll { padding: 24px 22px 38px; }
  .admin-body .CodeMirror { font-size: 15px; }
  .CodeMirror pre.CodeMirror-line, .CodeMirror pre.CodeMirror-line-like { padding-right: 16px; padding-left: 8px; }
  .CodeMirror-linenumber { padding-left: 8px; }
  .CodeMirror-lines { padding-top: 22px; }
  .editor-statusbar { font-size: 10px; gap: 10px; padding: 8px 12px; }
  .editor-statusbar #cursor-position { display: none; }
  .editor-search { padding: 8px; }
  .admin-body .editor-search input { width: calc(50% - 4px); }
  .editor-focused .markdown-workbench { inset: 0; border-radius: 0; }
  .editor-focused .markdown-workbench[data-mode="split"] .CodeMirror, .editor-focused .markdown-workbench[data-mode="split"] .preview-scroll { height: 420px; flex: none; }
  .heading-menu { left: 68px; }
}
