:root {
  /* 色彩系统：低饱和靛蓝紫 + 中性灰 */
  --bg: #f7f8fa;
  --panel-bg: #ffffff;
  --surface: #f3f5f8;
  --surface-hover: #ebeef3;
  --text: #1a1d23;
  --text-secondary: #5f6775;
  --text-muted: #8a93a1;
  --border: rgba(0, 0, 0, 0.08);
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.1);
  --code-bg: #1e1e2e;
  --code-text: #e4e4e7;
  --danger: #ef4444;

  /* 阴影：分层柔和 */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 48px rgba(15, 23, 42, 0.12);

  /* 字体：优先系统字体，离线可用 */
  --font-sans: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", Consolas, Menlo, monospace;
  --font-editor: "SF Pro Text", "Inter", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;

  /* 圆角 */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
}

[data-theme="dark"] {
  --bg: #0b0d12;
  --panel-bg: #151821;
  --surface: #1c1f2a;
  --surface-hover: #252a38;
  --text: #f0f2f7;
  --text-secondary: #a5adb8;
  --text-muted: #6b7280;
  --border: rgba(255, 255, 255, 0.08);
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-soft: rgba(129, 140, 248, 0.15);
  --code-bg: #0f1115;
  --code-text: #e4e4e7;
  --danger: #f87171;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* SVG 图标基线对齐 */
.icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 18px; height: 18px; }

/* 顶部栏 */
.top-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  z-index: 10;
}

.top-bar .brand {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  margin-right: 10px;
  color: var(--text);
  white-space: nowrap;
}

.top-bar input[type="text"] {
  flex: 0 1 220px;
  min-width: 120px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.top-bar input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.top-bar .spacer { flex: 1; }

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-bar button, .top-bar label,
.editor-toolbar button, .editor-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s ease;
  user-select: none;
  white-space: nowrap;
}

.top-bar button:hover, .top-bar label:hover,
.editor-toolbar button:hover, .editor-toolbar label:hover {
  background: var(--surface);
  color: var(--accent);
}

.top-bar button.primary, .editor-toolbar button.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.2);
}

.top-bar button.primary:hover, .editor-toolbar button.primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
}

.top-bar input[type="file"], .editor-toolbar input[type="file"] { display: none; }

.dropdown {
  position: relative;
  display: inline-flex;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  display: none;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
  padding: 6px;
  animation: menuIn .2s cubic-bezier(0.16, 1, 0.3, 1);
}

.top-actions .dropdown-menu {
  left: auto;
  right: 0;
}

.dropdown-menu.show {
  display: flex;
}

.dropdown-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: background .15s ease, color .15s ease;
  white-space: nowrap;
}

.dropdown-item:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.top-bar .divider, .editor-toolbar .divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
}

/* 编辑器工具栏 */
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.editor-toolbar .format-group,
.editor-toolbar .editor-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.editor-toolbar button {
  padding: 5px;
  border-radius: var(--radius-sm);
}

.editor-toolbar button svg.icon {
  width: 15px;
  height: 15px;
}

.editor-toolbar button b,
.editor-toolbar button i,
.editor-toolbar button u,
.editor-toolbar button s {
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 15px;
}

/* 表格选择器 */
.table-selector-menu {
  padding: 12px;
  min-width: auto;
}

.table-grid {
  display: grid;
  grid-template-columns: repeat(8, 22px);
  grid-template-rows: repeat(8, 22px);
  gap: 3px;
}

.table-grid-cell {
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  background: var(--panel-bg);
  transition: background .1s ease, border-color .1s ease;
}

.table-grid-cell:hover,
.table-grid-cell.active {
  background: var(--accent);
  border-color: var(--accent);
}

.table-size-label {
  text-align: center;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

/* 主编辑区 */
.main {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

.pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  transition: flex 0.25s ease, max-width 0.25s ease, opacity 0.2s ease;
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 8px 16px;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  gap: 12px;
}

.pane-title {
  font-weight: 600;
}

.collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1;
  transition: color .15s ease, background .15s ease, transform .2s ease;
}

.collapse-btn:hover {
  color: var(--accent);
  background: var(--surface);
}

.pane.collapsed {
  flex: 0 0 44px !important;
  min-width: 44px;
  max-width: 44px;
  opacity: 1;
}

.pane.collapsed .pane-header {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 14px 8px;
  height: 100%;
  gap: 10px;
}

.pane.collapsed .pane-title {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  white-space: nowrap;
  margin: 4px 0;
}

.pane.collapsed .pane-header > *:not(.pane-title):not(.collapse-btn) {
  display: none;
}

.resizer {
  width: 8px;
  background: transparent;
  cursor: col-resize;
  transition: background 0.2s ease;
  flex: 0 0 8px;
  z-index: 5;
  position: relative;
}

.resizer:hover {
  background: var(--accent-soft);
}

.resizer.dragging {
  background: var(--accent-soft);
}

.resizer::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 32px;
  background: var(--border);
  border-radius: 2px;
  transition: background 0.2s ease, height 0.2s ease;
}

.resizer:hover::after,
.resizer.dragging::after {
  background: var(--accent);
  height: 48px;
}

.resizer.hidden {
  display: none;
}

.resizing .pane,
.resizing .resizer {
  transition: none !important;
}

.editor-pane textarea {
  flex: 1;
  width: 100%;
  padding: 28px 32px;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-editor);
  font-size: 16px;
  line-height: 1.8;
  background: var(--panel-bg);
  color: var(--text);
  caret-color: var(--accent);
  tab-size: 4;
  white-space: pre-wrap;
  word-break: break-all;
}

.preview-pane {
  border-left: 1px solid var(--border);
  background: var(--panel-bg);
}

.preview-content {
  flex: 1;
  overflow: auto;
  font-family: var(--font-editor);
  font-size: 16px;
  line-height: 1.8;
  color: var(--text);
  width: 100%;
  max-width: none;
  margin: 0;
}

.preview-content .markdown-body {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 40px;
}

/* 预览区源码编辑 */
.preview-source {
  flex: 1;
  width: 100%;
  padding: 28px 32px;
  border: none;
  outline: none;
  resize: none;
  display: none;
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.7;
  background: var(--panel-bg);
  color: var(--text);
  caret-color: var(--accent);
  tab-size: 4;
  white-space: pre-wrap;
  word-break: break-all;
}

.preview-toggle {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.toggle-btn {
  padding: 3px 12px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
}

.toggle-btn.active {
  background: var(--panel-bg);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.toggle-btn:hover:not(.active) {
  color: var(--accent);
}

/* Markdown 预览样式 */
.preview-content h1, .preview-content h2, .preview-content h3,
.preview-content h4, .preview-content h5, .preview-content h6 {
  margin-top: 48px;
  margin-bottom: 16px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.01em;
}

.preview-content h1 { font-size: 2.25em; font-weight: 700; letter-spacing: -0.02em; }
.preview-content h2 { font-size: 1.75em; }
.preview-content h3 { font-size: 1.4em; }
.preview-content h4 { font-size: 1.15em; }
.preview-content p { margin: 0 0 20px; color: var(--text); }
.preview-content a { color: var(--accent); text-decoration: none; }
.preview-content a:hover { text-decoration: underline; }
.preview-content ul, .preview-content ol { margin: 0 0 20px; padding-left: 1.8em; }
.preview-content li { margin: 6px 0; }
.preview-content code {
  background: var(--surface);
  padding: 3px 7px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--accent);
}
.preview-content pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 18px 22px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 0 0 20px;
  box-shadow: var(--shadow-sm);
}
.preview-content pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: 0.9em;
}
.preview-content blockquote {
  margin: 0 0 20px;
  padding: 10px 24px;
  border-left: 3px solid var(--text-muted);
  background: transparent;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.95em;
}
.preview-content table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 20px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.preview-content .mermaid {
  margin: 0 0 20px;
  text-align: center;
}
.preview-content .mermaid svg {
  max-width: 100%;
  height: auto;
}
.preview-content th, .preview-content td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
}
.preview-content th { background: var(--surface); font-weight: 600; color: var(--text); }
.preview-content img { max-width: 100%; height: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
[data-theme="dark"] .preview-content img { opacity: 0.95; }
.preview-content hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 40px 0;
}

/* 状态栏 */
.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 16px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.statusbar .save-hint { color: var(--accent); opacity: 0; transition: opacity .3s ease; font-weight: 500; }
.statusbar .save-hint.show { opacity: 1; }
.statusbar #status-right { opacity: 0.7; }

/* 模态框 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
  opacity: 0;
  transition: opacity .2s ease;
}

.modal-overlay.show {
  opacity: 1;
}

.modal {
  background: var(--panel-bg);
  color: var(--text);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 86vh;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition: all .25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.show .modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { margin: 0; font-size: 17px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.modal-header button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 4px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  transition: color .15s ease, background .15s ease;
}
.modal-header button:hover { color: var(--text); background: var(--surface); }

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.7;
}

.modal-body p { margin: 0 0 12px; color: var(--text-secondary); }
.modal-body ul { margin: 8px 0 14px; padding-left: 1.6em; }
.modal-body li { margin: 5px 0; }
.modal-body label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 13px;
}

.modal-body input[type="url"],
.modal-body textarea,
.modal-body input[type="text"],
.modal-body select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  margin-bottom: 12px;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.modal-body input[type="url"]:focus,
.modal-body textarea:focus,
.modal-body input[type="text"]:focus,
.modal-body select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.modal-body textarea { font-family: var(--font-mono); resize: vertical; }

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-footer button {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-bg);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
}

.modal-footer button:hover { border-color: var(--accent); color: var(--accent); background: var(--surface); }
.modal-footer button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.modal-footer button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

/* 移动端 */
@media (max-width: 768px) {
  .top-bar { padding: 8px; gap: 6px; }
  .top-bar .brand { display: none; }
  .top-bar input[type="text"] { flex: 1 1 120px; }
  .editor-toolbar { padding: 6px; gap: 8px; }
  .editor-toolbar .format-group, .editor-toolbar .editor-actions { gap: 3px; padding: 3px; }
  .top-bar button span, .editor-toolbar button span { display: none; }
  .main { flex-direction: column; }
  .preview-pane { border-left: none; border-top: 1px solid var(--border); }
  .pane { flex: 1; height: auto; min-height: 0; }
  .pane.collapsed {
    flex: 0 0 40px !important;
    min-width: auto;
    max-width: none;
    width: 100%;
    height: 40px;
  }
  .pane.collapsed .pane-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    height: 100%;
    writing-mode: horizontal-tb;
  }
  .pane.collapsed .pane-title {
    writing-mode: horizontal-tb;
  }
  .resizer { display: none; }
  .preview-content .markdown-body { padding: 20px 24px; }
}

/* 加载提示 */
.toast {
  position: fixed;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(26, 29, 35, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all .3s ease;
  z-index: 100;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(8px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 拖放文件提示遮罩 */
.drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(79, 70, 229, 0.06);
  border: 2px dashed var(--accent);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  pointer-events: none;
  transition: opacity .2s ease;
  opacity: 0;
  backdrop-filter: blur(2px);
}
[data-theme="dark"] .drop-overlay {
  background: rgba(129, 140, 248, 0.08);
}
.drop-overlay.show {
  display: flex;
  opacity: 1;
}
.drop-message {
  color: var(--accent);
  font-size: 18px;
  font-weight: 600;
  padding: 24px 40px;
  border-radius: var(--radius-lg);
  background: var(--panel-bg);
  box-shadow: var(--shadow-lg);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* 导出图片 */
.export-image-stage {
  position: fixed;
  left: -99999px;
  top: 0;
  visibility: visible;
  pointer-events: none;
  z-index: -1;
}
.ratio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.ratio-btn {
  padding: 10px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
  line-height: 1.3;
}
.ratio-btn small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}
.ratio-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface);
}
.ratio-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.ratio-btn.active small {
  color: rgba(255,255,255,0.85);
}
.option-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 16px;
}
.option-row input[type="checkbox"] {
  width: auto;
  margin: 0;
}
.option-row label {
  display: inline;
  margin: 0;
  font-weight: normal;
  cursor: pointer;
  color: var(--text-secondary);
}
#export-image-preview-wrap {
  min-height: 120px;
  max-height: 420px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 10px;
}
#export-image-preview {
  max-width: 100%;
  display: block;
  border-radius: var(--radius-sm);
}
.modal-body .hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* 插入图片模态框 */
.image-modal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.image-tab {
  flex: 1;
  padding: 7px 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s ease;
}
.image-tab.active {
  background: var(--panel-bg);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.image-tab-panel { display: none; }
.image-tab-panel.active { display: block; }
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease, background .2s ease;
  margin-bottom: 12px;
  position: relative;
  background: var(--surface);
}
.upload-area:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.upload-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  display: block;
  box-shadow: var(--shadow);
}

/* 页面全屏 */
.app.page-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}
body.page-fullscreen-active { overflow: hidden; }

/* KaTeX */
.katex { font-size: 1.1em; }
.preview-content .katex-display { margin: 16px 0; overflow-x: auto; }

/* 任务列表 */
.preview-content input[type="checkbox"] {
  margin-right: 6px;
  vertical-align: middle;
}
.preview-content li.task-item {
  list-style: none;
  margin-left: -1.4em;
}
.preview-content ul.task-list {
  padding-left: 1.8em;
}

/* 工具栏下拉按钮文字 */
.top-bar button, .editor-toolbar button { white-space: nowrap; }

/* 下拉菜单进入动画 */
@keyframes menuIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 打印 / 导出 PDF */
@media print {
  .top-bar, .editor-toolbar, .statusbar, .editor-pane, .resizer, .preview-pane .pane-header,
  .preview-source, .modal-overlay, .toast, .icon-sprite {
    display: none !important;
  }
  .preview-pane {
    border: none !important;
    flex: 1 1 100% !important;
    max-width: none !important;
    width: 100% !important;
  }
  .preview-content {
    padding: 0 !important;
    overflow: visible !important;
    max-width: none !important;
    color: #000 !important;
  }
  .preview-content .markdown-body {
    max-width: none !important;
    padding: 0 !important;
  }
  .preview-content h1, .preview-content h2, .preview-content h3,
  .preview-content h4, .preview-content h5, .preview-content h6,
  .preview-content p, .preview-content li, .preview-content td, .preview-content th { color: #000 !important; }
  .preview-content pre, .preview-content code { background: #f5f5f5 !important; color: #000 !important; }
  html, body, .app, .main {
    height: auto !important;
    overflow: visible !important;
  }
  body {
    background: #fff !important;
    color: #000 !important;
  }
}
