/* ===========================================
   WizTone Notes — style.css
   macOS 15.7.4 级视觉标准 · 弹簧动效 · 极致精致
   =========================================== */

/* ── 主题变量 ─────────────────────────── */
:root {
    /* 浅色模式 */
    --bg-app: #f5f5f7;
    --bg-sidebar: rgba(246, 246, 246, 0.72);
    --bg-editor: #ffffff;
    --bg-preview: #ffffff;
    --text-main: #1d1d1f;
    --text-muted: #86868b;
    --border-color: rgba(0, 0, 0, 0.08);
    --accent-color: #007aff;
    --item-hover: rgba(0, 0, 0, 0.04);
    --item-active: rgba(0, 122, 255, 0.1);
    --bg-elevated: #ffffff;
    --search-bg: rgba(0, 0, 0, 0.06);
    --tabs-bg: rgba(0, 0, 0, 0.04);
    --editor-text: #2c2c2e;
    --preview-text: #1d1d1f;
    --code-bg: #f8f8f8;
    --code-inline-bg: rgba(0, 0, 0, 0.05);
    --minimap-bg: #f1f2f4;
    --minimap-text: rgba(0, 0, 0, 0.45);
    --minimap-code-bg: #eceef1;
    --control-btn-bg: rgba(255, 255, 255, 0.9);
    --control-btn-hover-bg: #ffffff;
    --slider-track-bg: rgba(0, 0, 0, 0.08);
    --slider-track-hover-bg: rgba(0, 0, 0, 0.15);
    --slider-thumb-bg: #ffffff;
    --slider-thumb-border: rgba(0, 0, 0, 0.15);
    --scrollbar-thumb-bg: rgba(0, 0, 0, 0.1);
    --modal-overlay-bg: rgba(0, 0, 0, 0.15);
    --modal-bg: rgba(255, 255, 255, 0.85);
    --modal-border: rgba(255, 255, 255, 0.5);
    --modal-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    --modal-input-bg: rgba(0, 0, 0, 0.03);
    --modal-input-focus-bg: #ffffff;
    --modal-cancel-bg: rgba(0, 0, 0, 0.06);
    --modal-cancel-hover-bg: rgba(0, 0, 0, 0.1);
    --font-apple: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
    --radius-lg: 12px;
    --radius-md: 8px;
    --doc-font-size: 15px;
    /* 弹簧曲线 */
    --spring: cubic-bezier(0.22, 1, 0.36, 1);
    --spring-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── 深色模式变量 ─────────────────────── */
:root[data-theme="dark"] {
    --bg-app: #0d1117;
    --bg-sidebar: #010409;
    --bg-editor: #0d1117;
    --bg-preview: #0d1117;
    --text-main: #c9d1d9;
    --text-muted: #8b949e;
    --border-color: #30363d;
    --accent-color: #58a6ff;
    --item-hover: #161b22;
    --item-active: rgba(56, 139, 253, 0.2);
    --bg-elevated: #161b22;
    --search-bg: #161b22;
    --tabs-bg: #161b22;
    --editor-text: #c9d1d9;
    --preview-text: #c9d1d9;
    --code-bg: #161b22;
    --code-inline-bg: rgba(110, 118, 129, 0.4);
    --minimap-bg: #010409;
    --minimap-text: rgba(201, 209, 217, 0.52);
    --minimap-code-bg: #161b22;
    --control-btn-bg: rgba(22, 27, 34, 0.95);
    --control-btn-hover-bg: #21262d;
    --slider-track-bg: #30363d;
    --slider-track-hover-bg: #484f58;
    --slider-thumb-bg: #f0f6fc;
    --slider-thumb-border: #6e7681;
    --scrollbar-thumb-bg: #484f58;
    --modal-overlay-bg: rgba(1, 4, 9, 0.6);
    --modal-bg: rgba(22, 27, 34, 0.88);
    --modal-border: rgba(110, 118, 129, 0.32);
    --modal-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    --modal-input-bg: rgba(110, 118, 129, 0.22);
    --modal-input-focus-bg: rgba(13, 17, 23, 0.95);
    --modal-cancel-bg: rgba(110, 118, 129, 0.28);
    --modal-cancel-hover-bg: rgba(139, 148, 158, 0.36);
}

/* ── 基础重置 ─────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; outline: none; }
html { overflow-x: hidden; }
body {
    font-family: var(--font-apple);
    background-color: var(--bg-app);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    overflow: hidden;
    overflow-x: hidden;
}
.app-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    background: var(--bg-editor);
}

/* 深浅模式平滑过渡 */
body, .app-container, .sidebar, .editor-pane, .preview-pane, .pane-header, .search-bar,
.sidebar-tabs, .tab-btn, .tab-btn.active, #markdown-input, #markdown-output, .preview-pane pre,
.code-header, .control-btn, .minimap-pane, #minimap-content pre, .sidebar-footer,
.tree-list li, .outline-item, .modal-box, .modal-box input {
    transition: background-color 0.3s var(--spring), color 0.3s var(--spring),
                border-color 0.3s var(--spring), box-shadow 0.3s var(--spring);
}

/* ===========================================
   全局加载动画
   =========================================== */
.loader-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(245, 245, 247, 0.7);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    z-index: 9999;
    opacity: 0; pointer-events: none;
    transition: opacity 0.4s var(--spring);
}
.loader-overlay.active { opacity: 1; pointer-events: auto; }
:root[data-theme="dark"] .loader-overlay { background: rgba(1, 4, 9, 0.75); }
.spinner {
    width: 48px; height: 48px;
    border: 4px solid rgba(0, 122, 255, 0.15);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    margin-bottom: 16px;
}
.loader-text {
    font-size: 14px; color: var(--text-muted);
    font-weight: 500; letter-spacing: 1px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ===========================================
   侧栏 — 毛玻璃 + 弹簧动效
   =========================================== */
.sidebar {
    width: 260px; min-width: 160px; max-width: 480px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
    border-right: 0.5px solid var(--border-color);
    display: flex; flex-direction: column; flex-shrink: 0;
    transition: margin-left 0.4s var(--spring);
    z-index: 50;
    /* macOS 极轻微内发光 */
    box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.06);
}
.sidebar.collapsed {
    margin-left: calc(-1 * var(--sidebar-current-width, 260px));
    width: var(--sidebar-current-width, 260px) !important;
    min-width: 160px; max-width: 480px;
    transition: margin-left 0.4s var(--spring);
}

/* 侧栏宽度拖拽条 */
.sidebar-resizer {
    width: 6px; cursor: ew-resize; background: transparent;
    position: absolute; top: 0; right: -3px; height: 100%; z-index: 99;
    transition: background 0.25s var(--spring);
}
.sidebar-resizer:hover, .sidebar-resizer.active {
    background: rgba(0, 122, 255, 0.12);
}

.sidebar-header { padding: 32px 16px 16px; }
.search-bar {
    background: var(--search-bg);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    display: flex; align-items: center; gap: 8px;
    color: var(--text-muted);
    border: 0.5px solid transparent;
    transition: border-color 0.2s var(--spring), box-shadow 0.2s var(--spring);
}
.search-bar:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-color) 15%, transparent);
}
.search-bar input {
    border: none; background: transparent;
    font-size: 13px; width: 100%; color: var(--text-main);
}

/* Tab 切换 */
.sidebar-tabs {
    display: flex; margin-top: 16px;
    background: var(--tabs-bg);
    padding: 3px; border-radius: var(--radius-md);
}
.tab-btn {
    flex: 1; text-align: center; font-size: 12px;
    padding: 6px 0; border-radius: 6px;
    color: var(--text-muted); cursor: pointer;
    transition: all 0.25s var(--spring);
    font-weight: 500;
    /* 按下微缩 */
}
.tab-btn:active { transform: scale(0.96); }
.tab-btn.active {
    background: var(--bg-elevated); color: var(--text-main);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08), inset 0 0 0 0.5px rgba(255, 255, 255, 0.1);
}
:root[data-theme="dark"] .tab-btn.active {
    box-shadow: inset 0 0 0 1px #30363d;
}

.tab-content { display: none; flex: 1; overflow-y: auto; padding: 0 12px; }
.tab-content.active { display: block; }

/* ===========================================
   文件树
   =========================================== */
.tree-title {
    font-size: 11px; font-weight: 700; color: var(--text-muted);
    padding: 12px 0; text-transform: uppercase; letter-spacing: 0.05em;
}
.tree-list { list-style: none; }
.tree-list ul { list-style: none; margin: 0; padding: 0; }
.tree-list li {
    font-size: 13px; cursor: pointer; display: block; margin-bottom: 2px;
    transition: background 0.2s var(--spring);
}
.tree-list li:hover > .tree-item-main { background: var(--item-hover); border-radius: var(--radius-md); }
.tree-list li.active > .tree-item-main { background: var(--item-active); border-radius: var(--radius-md); }
.tree-list li.active { color: var(--accent-color); font-weight: 500; }

.tree-item-main {
    position: relative;
    display: flex; align-items: center; gap: 8px;
    height: 32px; width: 100%; box-sizing: border-box;
    padding: 0 76px 0 calc(12px + var(--tree-depth, 0) * 15px);
    overflow: hidden;
    transition: background 0.2s var(--spring);
}
.tree-item-main i {
    font-size: 16px; opacity: 0.8;
    transition: transform 0.3s var(--spring-bounce);
    flex-shrink: 0;
}
.tree-filename {
    flex: 1 1 auto; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 操作按钮 */
.tree-actions {
    position: absolute; right: 12px; top: 0; bottom: 0;
    width: 52px; display: flex; align-items: center; justify-content: space-between;
    color: var(--text-muted);
}
.tree-actions i {
    padding: 4px; border-radius: 4px;
    transition: all 0.2s var(--spring);
}
.tree-actions i:hover { background: rgba(0, 0, 0, 0.1); color: var(--text-main); }
.tree-actions .delete-btn:hover { color: #ff5f56; background: rgba(255, 95, 86, 0.1); }

.tree-list li.folder > ul { display: block; overflow: hidden; }
.tree-list li.folder.collapsed > ul { display: none; }
.tree-list li.drag-over > .tree-item-main {
    background: rgba(0, 122, 255, 0.15) !important;
    outline: 1px dashed var(--accent-color);
    border-radius: var(--radius-md);
}

/* ===========================================
   大纲列表
   =========================================== */
.outline-list { list-style: none; padding-bottom: 20px; padding-top: 8px; }
.outline-item {
    font-size: 13px; color: var(--text-muted); cursor: pointer;
    padding: 6px 8px; border-radius: 6px; margin-bottom: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: all 0.25s var(--spring);
    border-left: 2px solid transparent;
}
.outline-item:hover { background: var(--item-hover); color: var(--text-main); }
.outline-item.active {
    color: var(--accent-color);
    background: rgba(0, 122, 255, 0.1);
    border-left-color: var(--accent-color);
    font-weight: 500;
}

/* 侧栏底部 */
.sidebar-footer {
    padding: 16px; border-top: 1px solid var(--border-color);
    display: flex; gap: 10px;
}
.sidebar-footer-bottom { padding: 8px 12px 12px; }
.filemgr-entry-btn {
    width: 100%; display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-radius: 8px;
    font-size: 13px; color: var(--text-muted);
    transition: all 0.2s var(--spring);
}
.filemgr-entry-btn span { font-size: 13px; }
.filemgr-entry-btn:hover { background: var(--item-hover); color: var(--text-main); }

/* ===========================================
   文件管理器弹窗 — 弹簧弹出 + 空间逻辑
   =========================================== */
.filemgr-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: var(--modal-overlay-bg);
    display: flex; justify-content: center; align-items: center;
    z-index: 1600;
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s var(--spring);
}
.filemgr-overlay.active { opacity: 1; pointer-events: auto; }
.filemgr-box {
    background: var(--modal-bg);
    backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px);
    border: 0.5px solid var(--modal-border);
    box-shadow:
        0 0 0 0.5px rgba(0, 0, 0, 0.03),
        0 4px 16px rgba(0, 0, 0, 0.06),
        0 20px 60px rgba(0, 0, 0, 0.12);
    border-radius: 14px;
    width: min(90vw, 660px); max-height: 75vh;
    display: flex; flex-direction: column;
    transform: scale(0.92) translateY(12px);
    transition: transform 0.4s var(--spring-bounce);
}
.filemgr-overlay.active .filemgr-box {
    transform: scale(1) translateY(0);
}
.filemgr-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px 13px;
    border-bottom: 0.5px solid var(--border-color);
    flex-shrink: 0;
}
.filemgr-header h3 { font-size: 15px; font-weight: 600; color: var(--text-main); margin: 0; }
.filemgr-toolbar {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px;
    border-bottom: 0.5px solid var(--border-color);
    flex-shrink: 0;
}
.filemgr-select-all-label {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--text-muted);
    cursor: pointer; user-select: none;
}
.filemgr-select-all-label input[type=checkbox] {
    width: 14px; height: 14px; accent-color: var(--accent-color); cursor: pointer;
}
.filemgr-count-badge {
    font-size: 12px; color: var(--text-muted);
    background: var(--item-hover);
    padding: 2px 8px; border-radius: 10px;
}
.filemgr-list { overflow-y: auto; flex: 1; padding: 4px 0; }
.filemgr-empty { padding: 40px; text-align: center; color: var(--text-muted); font-size: 14px; }
.filemgr-folder-row {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 16px; user-select: none; opacity: 0.75;
}
.filemgr-folder-name { font-size: 13px; font-weight: 500; color: var(--text-muted); flex: 1; }
.filemgr-file-row {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 16px;
    transition: background 0.15s var(--spring);
}
.filemgr-file-row:hover { background: var(--item-hover); }
.filemgr-folder-row input[type=checkbox],
.filemgr-file-row input[type=checkbox] {
    width: 14px; height: 14px; accent-color: var(--accent-color);
    cursor: pointer; flex-shrink: 0;
}
.filemgr-file-icon { font-size: 15px; color: var(--accent-color); flex-shrink: 0; }
.filemgr-folder-icon { font-size: 15px; color: #f5a623; flex-shrink: 0; }
.filemgr-file-name {
    flex: 1; font-size: 13px; color: var(--text-main);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.filemgr-file-size {
    font-size: 11px; color: var(--text-muted);
    flex-shrink: 0; min-width: 44px; text-align: right;
}
.filemgr-dl-btn { opacity: 0; transition: opacity 0.15s var(--spring); flex-shrink: 0; padding: 3px 6px !important; }
.filemgr-del-btn { opacity: 0; transition: opacity 0.15s var(--spring); flex-shrink: 0; padding: 3px 6px !important; color: #ff7b72; }
.filemgr-folder-row:hover,
.filemgr-file-row:hover { background: var(--item-hover); }
.filemgr-file-row:hover .filemgr-dl-btn { opacity: 1; }
.filemgr-file-row:hover .filemgr-del-btn,
.filemgr-folder-row:hover .filemgr-del-btn { opacity: 1; }

/* ===========================================
   通用按钮 — 带按下回弹反馈
   =========================================== */
.action-btn {
    background: transparent; border: none; color: var(--text-muted);
    cursor: pointer; padding: 6px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s var(--spring);
}
.action-btn:hover { background: var(--item-hover); color: var(--text-main); }
.action-btn:active { transform: scale(0.92); }
.action-btn.active { background: rgba(0, 122, 255, 0.16); color: var(--accent-color); }
:root[data-theme="dark"] .action-btn.active { background: rgba(56, 139, 253, 0.24); }

/* ===========================================
   编辑器与预览区
   =========================================== */
.editor-pane, .preview-pane {
    flex: 1; display: flex; flex-direction: column;
    min-width: 0; position: relative;
}
.editor-pane { border-right: 0.5px solid var(--border-color); }

.pane-header {
    flex-shrink: 0; height: 52px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    border-bottom: 0.5px solid var(--border-color);
    font-size: 13px; color: var(--text-muted);
}
.file-name {
    color: var(--text-main); font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: block; min-width: 0;
}

.header-controls { display: flex; align-items: center; gap: 12px; }
.theme-controls { display: flex; align-items: center; gap: 8px; margin-right: 8px; }
.action-btn-text {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 10px;
}
.action-btn-text span { font-size: 12px; line-height: 1; }

/* Auto 按钮 */
.theme-auto-btn {
    border: 1px solid var(--border-color);
    background: var(--bg-elevated);
    color: var(--text-muted);
    height: 24px; padding: 0 8px; border-radius: 999px;
    font-size: 11px; cursor: pointer;
    transition: all 0.25s var(--spring);
}
.theme-auto-btn:active { transform: scale(0.94); }
.theme-auto-btn.active {
    color: var(--accent-color);
    border-color: color-mix(in srgb, var(--accent-color) 60%, transparent);
    background: color-mix(in srgb, var(--accent-color) 15%, var(--bg-elevated));
}

/* 主题开关 — 弹簧滑动 */
.theme-switch {
    width: 46px; height: 28px; border: none; border-radius: 999px;
    background: rgba(120, 120, 128, 0.32);
    position: relative; cursor: pointer; padding: 0;
    transition: background-color 0.3s var(--spring);
}
.theme-switch-thumb {
    position: absolute; left: 3px; top: 3px;
    width: 22px; height: 22px; border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.24);
    transition: transform 0.35s var(--spring-bounce), background-color 0.3s var(--spring);
    display: inline-flex; align-items: center; justify-content: center;
    color: #57606a;
}
.theme-switch-thumb i {
    position: absolute; font-size: 13px;
    transition: opacity 0.3s var(--spring), transform 0.35s var(--spring-bounce);
}
.theme-switch-thumb .icon-sun { opacity: 1; transform: rotate(0deg) scale(1); }
.theme-switch-thumb .icon-moon { opacity: 0; transform: rotate(18deg) scale(0.72); }
.theme-switch.is-on { background: var(--accent-color); }
.theme-switch.is-on .theme-switch-thumb { transform: translateX(18px); }
.theme-switch.is-on .theme-switch-thumb .icon-sun { opacity: 0; transform: rotate(-18deg) scale(0.72); }
.theme-switch.is-on .theme-switch-thumb .icon-moon { opacity: 1; transform: rotate(0deg) scale(1); }
.theme-switch.is-system { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-color) 38%, transparent); }
:root[data-theme="dark"] .theme-switch { background: #30363d; }
:root[data-theme="dark"] .theme-switch-thumb { background: #f0f6fc; color: #30363d; }

/* 字号控制条 */
.mac-slider {
    -webkit-appearance: none; appearance: none;
    width: 100px; height: 4px;
    background: var(--slider-track-bg);
    border-radius: 2px; outline: none;
    transition: background 0.2s var(--spring);
}
.mac-slider:hover { background: var(--slider-track-hover-bg); }
.mac-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--slider-thumb-bg);
    border: 1px solid var(--slider-thumb-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.2s var(--spring-bounce);
}
.mac-slider::-webkit-slider-thumb:active { transform: scale(1.15); }

/* 编辑器文本区 */
#markdown-input {
    flex: 1; border: none; resize: none;
    padding: 40px;
    font-family: "SF Mono", "Fira Code", "JetBrains Mono", monospace;
    font-size: var(--doc-font-size);
    line-height: 1.7;
    color: var(--editor-text);
    background: transparent;
}

/* 预览区 — position: relative 确保大纲跳转准确 */
#markdown-output {
    flex: 1; padding: 40px; overflow-y: auto; overflow-x: hidden;
    color: var(--preview-text);
    line-height: 1.8;
    font-size: var(--doc-font-size);
    position: relative;
}

/* 预览区触控仅允许纵向滚动，防止横向滑动/侧滑导航 */
.preview-pane {
    touch-action: pan-y;
    -ms-touch-action: pan-y;
}

#markdown-output {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

/* ===========================================
   Markdown 渲染样式
   =========================================== */
.markdown-body h1 { font-size: 2em; margin-bottom: 0.5em; border-bottom: 1px solid var(--border-color); padding-bottom: 0.3em; }
.markdown-body h2 { font-size: 1.5em; margin-bottom: 0.5em; }
.markdown-body p { margin-bottom: 1.2em; white-space: pre-wrap; }

/* 图片自适应：宽度不超过容器，高度自动，防止撑开横向滚动 */
.markdown-body img,
#markdown-output img {
    max-width: 100%;
    width: auto;
    height: auto;
    display: block;
    border-radius: 6px;
    object-fit: contain;
}
.markdown-body code {
    background: var(--code-inline-bg); padding: 0.2em 0.4em;
    border-radius: 4px; font-size: 0.9em;
}
.markdown-body ul,
.markdown-body ol { margin: 0.4em 0 1.1em; padding-left: 1.6em; }
.markdown-body ul ul, .markdown-body ul ol,
.markdown-body ol ul, .markdown-body ol ol { margin: 0.25em 0 0.35em; padding-left: 1.4em; }
.markdown-body li { margin: 0.2em 0; }
.markdown-body li > p { margin-bottom: 0.4em; }
.markdown-body li input[type="checkbox"] { margin-right: 8px; cursor: pointer; }
.markdown-body li.task-done { color: var(--text-muted); text-decoration: line-through; }
.markdown-body li.task-done * { color: inherit; }
#markdown-output li input[type="checkbox"] { margin-right: 8px; cursor: pointer; }
#markdown-output li.task-done { color: var(--text-muted); text-decoration: line-through; }
#markdown-output li.task-done * { color: inherit; }
.markdown-body blockquote {
    margin: 0.8em 0 1.1em;
    padding: 0.25em 0 0.25em 1em;
    border-left: 4px solid var(--border-color);
    color: var(--text-muted);
}

/* ===========================================
   表格 — GitHub 风格框线渲染
   =========================================== */
.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    margin: 0.6em 0 1.4em;
    font-size: 0.93em;
    /* 横向溢出时可左右滚动，不撑开页面 */
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.markdown-body thead {
    background: rgba(0, 0, 0, 0.03);
}
:root[data-theme="dark"] .markdown-body thead {
    background: rgba(255, 255, 255, 0.04);
}
.markdown-body th,
.markdown-body td {
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    text-align: left;
    vertical-align: middle;
    line-height: 1.55;
    white-space: nowrap;
}
/* 允许内容列换行，只让超窄列保持不换行 */
.markdown-body td {
    white-space: normal;
    min-width: 60px;
}
.markdown-body th {
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
}
/* 斑马纹 */
.markdown-body tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}
:root[data-theme="dark"] .markdown-body tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}
/* hover 高亮 */
.markdown-body tbody tr:hover {
    background: var(--item-hover);
}

/* ===========================================
   块级同步高亮 (Block Highlight)
   =========================================== */
.block-highlight {
    background-color: rgba(0, 122, 255, 0.05) !important;
    position: relative; border-radius: 4px;
    transition: background-color 0.35s var(--spring);
}
.block-highlight::before {
    content: ""; position: absolute;
    left: -16px; top: 0; bottom: 0;
    width: 4px; background-color: var(--accent-color);
    border-radius: 4px;
}
.preview-pane pre.block-highlight { box-shadow: 0 0 0 1px var(--accent-color); }
.preview-pane pre.block-highlight::before { display: none; }

/* ===========================================
   代码块 — 精致卡片式
   =========================================== */
.preview-pane pre {
    position: relative; padding: 0; background: transparent;
    border-radius: 0; margin-bottom: 24px; border: none;
    transition: all 0.25s var(--spring);
    cursor: default;
}
.preview-pane pre code {
    display: block;
    padding: 38px 16px 14px !important;
    margin: 0; font-size: 0.9em;
    background: var(--code-bg);
    border: 0.5px solid var(--border-color);
    border-radius: 10px;
    /* 极轻微内发光 */
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.folded-placeholder { display: inline-block; color: var(--text-muted); font-style: italic; }
.preview-pane pre.is-folded code {
    padding: 8px 92px 8px 12px !important;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    line-height: 1.5; min-height: 38px;
}
.preview-pane pre.is-folded .folded-placeholder {
    display: block; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}

/* 代码块控制按钮 */
.code-controls {
    position: absolute; top: 8px; right: 8px;
    opacity: 0; transition: opacity 0.2s var(--spring);
    display: flex; gap: 4px; z-index: 6;
}
.preview-pane pre:hover .code-controls { opacity: 1; }
.preview-pane pre.is-folded .code-controls {
    opacity: 1; top: 50%; transform: translateY(-50%);
}

/* 语言标签 */
.code-lang-label {
    position: absolute; top: 8px; left: 16px;
    font-size: 12px; color: #555;
    background: #f0f0f0;
    border-radius: 6px; padding: 2px 10px;
    font-family: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    z-index: 7; pointer-events: none; user-select: none;
    opacity: 1; box-shadow: none;
    letter-spacing: 0.5px; font-weight: normal;
    border: 0.5px solid #e0e0e0;
}
:root[data-theme="dark"] .code-lang-label {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    border: 0.5px solid rgba(110, 118, 129, 0.28);
}
pre.is-folded code .folded-placeholder {
    display: inline-block;
    margin-left: var(--fold-label-offset, 60px);
    vertical-align: middle;
}

.control-btn {
    padding: 4px 8px; font-size: 11px;
    background: var(--control-btn-bg);
    backdrop-filter: blur(4px);
    border: 0.5px solid var(--border-color);
    border-radius: 5px; color: var(--text-muted);
    cursor: pointer; display: flex; align-items: center; gap: 4px;
    transition: all 0.2s var(--spring);
}
.control-btn:hover { color: var(--accent-color); background: var(--control-btn-hover-bg); }
.control-btn:active { transform: scale(0.93); }

/* ===========================================
   滚动条
   =========================================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb-bg); border-radius: 10px; }

/* ===========================================
   Minimap 全景缩略图
   =========================================== */
.minimap-pane {
    width: 100px;
    background: var(--minimap-bg);
    border-left: 0.5px solid var(--border-color);
    position: relative; overflow: hidden; flex-shrink: 0;
    cursor: pointer;
}
.minimap-wrapper {
    position: absolute; top: 0; left: 0; width: 100%;
    transform-origin: top left;
}
#minimap-content {
    transform-origin: top left;
    position: absolute; top: 0; left: 0;
    pointer-events: none;
    color: var(--minimap-text);
    padding: 40px; box-sizing: border-box;
    font-size: 2px; line-height: 3px;
    word-wrap: break-word; overflow-wrap: break-word;
}
#minimap-content .markdown-body h1 { font-size: 2em; margin-bottom: 0.5em; border-bottom: none; padding-bottom: 0.3em; }
#minimap-content .markdown-body h2 { font-size: 1.5em; margin-bottom: 0.5em; }
#minimap-content .markdown-body p { margin-bottom: 1.2em; }
#minimap-content .markdown-body code { background: var(--code-inline-bg); padding: 0.2em 0.4em; border-radius: 4px; font-size: 0.9em; }
#minimap-content .markdown-body ul,
#minimap-content .markdown-body ol { margin: 0.4em 0 1.1em; padding-left: 1.6em; }
#minimap-content .markdown-body ul ul, #minimap-content .markdown-body ul ol,
#minimap-content .markdown-body ol ul, #minimap-content .markdown-body ol ol { margin: 0.25em 0 0.35em; padding-left: 1.4em; }
#minimap-content .markdown-body li { margin: 0.2em 0; }
#minimap-content pre {
    background: var(--minimap-code-bg);
    border-radius: 10px; margin-bottom: 24px;
    border: 1px solid var(--border-color);
    padding: 10px; font-size: 2px; line-height: 3px;
}

/* Minimap 滑块 — 跟手拖拽 */
.minimap-slider {
    position: absolute; top: 0; left: 0; width: 100%;
    background: rgba(0, 122, 255, 0.1);
    border: 1px solid rgba(0, 122, 255, 0.3);
    border-radius: 4px; pointer-events: none; z-index: 10;
    transition: opacity 0.2s;
}
.minimap-pane:hover .minimap-slider { background: rgba(0, 122, 255, 0.15); }
:root[data-theme="dark"] .minimap-slider { background: rgba(56, 139, 253, 0.18); border-color: rgba(88, 166, 255, 0.45); }
:root[data-theme="dark"] .minimap-pane:hover .minimap-slider { background: rgba(56, 139, 253, 0.24); }

/* ===========================================
   弹窗系统 — 弹簧弹出 + 精致投影
   =========================================== */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: var(--modal-overlay-bg);
    display: flex; justify-content: center; align-items: center;
    z-index: 2200;
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s var(--spring);
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-box {
    background: var(--modal-bg);
    backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px);
    border: 0.5px solid var(--modal-border);
    /* 多层投影体系: 环境阴影 + 跌落阴影 */
    box-shadow:
        0 0 0 0.5px rgba(0, 0, 0, 0.04),
        0 2px 8px rgba(0, 0, 0, 0.04),
        0 8px 24px rgba(0, 0, 0, 0.08),
        0 20px 60px rgba(0, 0, 0, 0.12);
    border-radius: 14px;
    width: min(92vw, 360px);
    padding: 24px; text-align: center;
    transform: scale(0.9) translateY(16px);
    transition: transform 0.4s var(--spring-bounce);
    /* 极轻微内发光 */
    box-shadow:
        inset 0 0.5px 0 rgba(255, 255, 255, 0.1),
        0 0 0 0.5px rgba(0, 0, 0, 0.04),
        0 2px 8px rgba(0, 0, 0, 0.04),
        0 8px 24px rgba(0, 0, 0, 0.08),
        0 20px 60px rgba(0, 0, 0, 0.12);
}
.modal-overlay.active .modal-box {
    transform: scale(1) translateY(0);
}
.modal-box h3 { font-size: 16px; margin-bottom: 12px; color: var(--text-main); font-weight: 600; }
.modal-box p { font-size: 13px; margin-bottom: 16px; color: var(--text-muted); line-height: 1.5; }
.modal-box input {
    width: 100%; padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 0.5px solid var(--border-color);
    background: var(--modal-input-bg);
    color: var(--text-main); font-size: 14px;
    margin-bottom: 20px; outline: none;
    transition: border 0.25s var(--spring), background 0.25s var(--spring), box-shadow 0.25s var(--spring);
    font-family: var(--font-apple);
}
.modal-box input::placeholder { color: var(--text-muted); }
.modal-box input:focus {
    border-color: var(--accent-color);
    background: var(--modal-input-focus-bg);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-color) 20%, transparent);
}
.modal-actions { display: flex; gap: 10px; }
.modal-btn {
    flex: 1; padding: 10px; border-radius: var(--radius-md);
    font-size: 14px; font-weight: 500; cursor: pointer;
    border: none; font-family: var(--font-apple);
    transition: all 0.2s var(--spring);
}
.modal-btn:active { transform: scale(0.96); }
.modal-btn.cancel { background: var(--modal-cancel-bg); color: var(--text-main); }
.modal-btn.cancel:hover { background: var(--modal-cancel-hover-bg); }
.modal-btn.confirm { background: var(--accent-color); color: white; }
.modal-btn.confirm:hover { filter: brightness(1.1); }
.modal-btn.danger { background: #ff5f56; color: white; }
.modal-btn.danger:hover { filter: brightness(1.1); }

/* PDF 导出选项 */
.export-options-form { text-align: left; display: flex; flex-direction: column; gap: 10px; }
.export-option-row { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-main); }
.export-option-row input[type="text"] {
    width: 100%; padding: 8px 10px; border-radius: 8px;
    border: 0.5px solid var(--border-color);
    background: var(--modal-input-bg); color: var(--text-main); font-size: 13px;
}
.export-option-row input[type="text"]:focus {
    border-color: var(--accent-color);
    background: var(--modal-input-focus-bg);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-color) 20%, transparent);
}
.export-option-check {
    display: grid; grid-template-columns: 14px 1fr;
    align-items: center; column-gap: 8px;
    font-size: 13px; color: var(--text-main); line-height: 1.25;
}
.export-option-check span { display: inline-flex; align-items: center; }
.export-option-check input[type="checkbox"] { width: 14px; height: 14px; margin: 0; accent-color: var(--accent-color); }

/* ===========================================
   图片删除按钮 — 悬浮毛玻璃
   =========================================== */
.img-wrapper { position: relative; display: inline-block; max-width: 100%; margin-bottom: 16px; }
.img-delete-btn {
    position: absolute; top: 8px; right: 8px;
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    border: 0.5px solid rgba(0, 0, 0, 0.1);
    color: #ff5f56;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.25s var(--spring);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);
}
.img-wrapper:hover .img-delete-btn { opacity: 1; }
.img-delete-btn:hover {
    background: #ff5f56; color: white;
    transform: scale(1.1);
}
:root[data-theme="dark"] .img-delete-btn {
    background: rgba(22, 27, 34, 0.86);
    border-color: rgba(110, 118, 129, 0.32);
    color: #ff7b72;
}

/* ===========================================
   深色模式代码高亮
   =========================================== */
:root[data-theme="dark"] .hljs,
:root[data-theme="dark"] #minimap-content .hljs { color: #d9e6ff; background: transparent; }
:root[data-theme="dark"] .hljs-comment,
:root[data-theme="dark"] .hljs-quote { color: #8b949e; }
:root[data-theme="dark"] .hljs-keyword,
:root[data-theme="dark"] .hljs-selector-tag,
:root[data-theme="dark"] .hljs-literal,
:root[data-theme="dark"] .hljs-name,
:root[data-theme="dark"] .hljs-section,
:root[data-theme="dark"] .hljs-link { color: #ff7b72; }
:root[data-theme="dark"] .hljs-string,
:root[data-theme="dark"] .hljs-title,
:root[data-theme="dark"] .hljs-type,
:root[data-theme="dark"] .hljs-symbol,
:root[data-theme="dark"] .hljs-bullet,
:root[data-theme="dark"] .hljs-addition,
:root[data-theme="dark"] .hljs-attribute,
:root[data-theme="dark"] .hljs-template-tag,
:root[data-theme="dark"] .hljs-template-variable { color: #a5d6ff; }
:root[data-theme="dark"] .hljs-number,
:root[data-theme="dark"] .hljs-regexp,
:root[data-theme="dark"] .hljs-meta,
:root[data-theme="dark"] .hljs-doctag,
:root[data-theme="dark"] .hljs-built_in,
:root[data-theme="dark"] .hljs-builtin-name { color: #79c0ff; }
:root[data-theme="dark"] .hljs-variable,
:root[data-theme="dark"] .hljs-params,
:root[data-theme="dark"] .hljs-class .hljs-title { color: #ffa657; }

/* ===========================================
   PDF 导出 — TOC 与排版
   =========================================== */
.export-pdf-root .export-toc { padding: 4px 0 2px; }
.export-pdf-root .export-toc h1 { margin-bottom: 10px; border: none; font-size: 1.7em; }
.export-pdf-root .export-toc ul { list-style: none; padding: 0; margin: 0; }
.export-pdf-root .export-toc li { margin: 6px 0; font-size: 14px; }
.export-pdf-root .export-toc li a { color: #0969da; text-decoration: none; }
.export-pdf-root .export-toc .toc-level-2 { padding-left: 16px; }
.export-pdf-root .export-toc .toc-level-3 { padding-left: 32px; }
.export-pdf-root .export-toc .toc-level-4,
.export-pdf-root .export-toc .toc-level-5,
.export-pdf-root .export-toc .toc-level-6 { padding-left: 44px; }
.export-page-break { break-after: page; page-break-after: always; }

/* 导出时隐藏交互 UI */
.export-pdf-root .code-header,
.export-pdf-root .code-controls,
.export-pdf-root .control-btn,
.export-pdf-root .ph-copy,
.export-pdf-root .ph-caret-up-down { display: none !important; }

.export-pdf-root pre {
    max-width: 100% !important; overflow: visible !important;
    white-space: pre-wrap !important; overflow-wrap: anywhere !important;
    word-break: break-word !important; font-size: 12px !important;
    line-height: 1.5 !important; padding: 14px 14px 12px !important;
    margin: 0.95em 0 1.25em !important;
    break-inside: avoid-page; page-break-inside: avoid;
    box-shadow: none !important; filter: none !important;
    transform: none !important; transition: none !important;
}
.export-pdf-root pre:hover { box-shadow: none !important; filter: none !important; transform: none !important; }

.export-pdf-root .export-code-block {
    max-width: 100% !important; background: #f6f8fa !important;
    color: #1f2328 !important; border: 1px solid #d0d7de !important;
    border-radius: 8px; font-size: 12px !important;
    line-height: 1.5 !important; margin: 0.45em 0 0.7em !important;
    padding: 8px 10px !important; box-shadow: none !important;
    break-inside: auto; page-break-inside: auto; overflow: visible !important;
}
.export-pdf-root .export-code-fragment {
    max-width: 100% !important; background: #f6f8fa !important;
    color: #1f2328 !important; border: 1px solid #d0d7de !important;
    border-radius: 8px; padding: 8px 10px !important;
    margin: 0.45em 0 0.7em !important;
    break-inside: auto; page-break-inside: auto;
}
.export-pdf-root .export-code-fragment.export-page-break-before { break-before: page; page-break-before: always; }
.export-pdf-root .export-code-lines { display: block; }
.export-pdf-root .export-code-line {
    display: block;
    font-family: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    white-space: pre-wrap !important; overflow-wrap: anywhere !important;
    word-break: break-word !important; background: transparent !important;
    border-radius: 0; padding: 0.02em 0; margin: 0;
    break-inside: avoid; page-break-inside: avoid;
}
.export-pdf-root pre code,
.export-pdf-root pre code.hljs,
.export-pdf-root .hljs {
    white-space: pre-wrap !important; overflow-wrap: anywhere !important;
    word-break: break-word !important; display: block;
    font-size: 12px !important; line-height: 1.5 !important;
    break-inside: auto; page-break-inside: auto; orphans: 2; widows: 2;
}
.export-pdf-root pre code > * { break-inside: avoid; page-break-inside: avoid; }
.export-pdf-root .export-code-line { orphans: 2; widows: 2; }
.export-pdf-root .export-code-line.hljs { background: transparent !important; }

/* ===========================================
   响应式适配 · 多分辨率断点系统
   =========================================== */

/* 侧栏背景遮罩（移动端抽屉打开时） */
.sidebar-backdrop {
    display: none;
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
    z-index: 499;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s var(--spring);
}
.sidebar-backdrop.active { opacity: 1; pointer-events: auto; }

/* 移动端底部导航栏 */
.mobile-tab-bar {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 52px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-top: 0.5px solid var(--border-color);
    z-index: 200;
    align-items: center; justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.mobile-tab-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 3px; height: 100%;
    border: none; background: transparent;
    color: var(--text-muted); cursor: pointer;
    transition: color 0.2s var(--spring);
    font-size: 10px; font-family: var(--font-apple);
    -webkit-tap-highlight-color: transparent;
}
.mobile-tab-btn i { font-size: 20px; }
.mobile-tab-btn.active { color: var(--accent-color); }
.mobile-tab-btn:active { transform: scale(0.88); }

/* ── 中等桌面 (≤ 1279px) ── */
@media (max-width: 1279px) {
    .sidebar { width: 220px; }
    .minimap-pane { width: 72px; }
    .action-btn-text span { display: none; }
    .action-btn-text { padding: 6px 8px; }
    .mac-slider { width: 80px; }
    .pane-header { padding: 0 16px; }
    .header-controls { gap: 8px; }
}

/* ── 平板横屏 / 小桌面 (≤ 1023px) ── */
@media (max-width: 1023px) {
    .minimap-pane { display: none; }
    .sidebar { width: 200px; min-width: 140px; }
    #markdown-input, #markdown-output { padding: 28px 20px; }
    .pane-header { padding: 0 14px; }
    .header-controls { gap: 6px; }
    .mac-slider, .header-controls .ph-text-t { display: none !important; }
    .theme-auto-btn { display: none; }
}

/* ── 平板竖屏 / 手机 (≤ 767px) ── */
@media (max-width: 767px) {
    html, body { overflow-x: hidden; max-width: 100vw; }
    /* 侧栏：固定浮动抽屉覆盖在内容上方 */
    .sidebar {
        position: fixed !important;
        top: 0; left: 0; height: 100% !important;
        width: min(80vw, 280px) !important;
        min-width: 0 !important;
        z-index: 500;
        transform: translateX(0);
        box-shadow: 4px 0 40px rgba(0, 0, 0, 0.18);
        transition: transform 0.38s var(--spring) !important;
        margin-left: 0 !important;
    }
    .sidebar.collapsed {
        transform: translateX(-110%) !important;
        margin-left: 0 !important;
        width: min(80vw, 280px) !important;
    }
    .sidebar-header { padding-top: 20px !important; }
    .sidebar-resizer { display: none !important; }
    .sidebar-backdrop { display: block; }

    /* 主容器预留底部导航空间 */
    .app-container {
        padding-bottom: calc(52px + env(safe-area-inset-bottom, 0px));
    }

    /* 编辑/预览区各自铺满 */
    .editor-pane { flex: 1 0 100%; min-width: 0; border-right: none; }
    .preview-pane { flex: 0 0 100%; min-width: 0; display: none; }
    .preview-pane.mobile-preview-active { display: flex; }
    .editor-pane.mobile-editor-hidden { display: none; }
    .minimap-pane { display: none !important; }

    /* 显示底部导航 */
    .mobile-tab-bar { display: flex; }

    /* 顶部 Header 精简 */
    .pane-header { padding: 0 12px; height: 46px; }
    .header-controls { gap: 5px; }
    .mac-slider, .header-controls .ph-text-t { display: none !important; }
    .theme-auto-btn { display: none; }
    .action-btn-text span { display: none; }
    .action-btn-text { padding: 6px 7px; }
    .file-name { max-width: 36vw; font-size: 13px; }
    #markdown-input, #markdown-output { padding: 20px 16px; }
}

/* ── 小屏手机 (≤ 479px) ── */
@media (max-width: 479px) {
    .pane-header { padding: 0 8px; height: 44px; }
    .file-name { max-width: 28vw; font-size: 12px; }
    .theme-controls { gap: 4px; }
    .theme-switch { width: 40px; height: 24px; }
    .theme-switch-thumb { width: 18px; height: 18px; top: 3px; left: 3px; }
    .theme-switch.is-on .theme-switch-thumb { transform: translateX(16px); }
    .theme-switch-thumb i { font-size: 11px; }
    #markdown-input, #markdown-output { padding: 16px 12px; }
    .mobile-tab-bar { height: 48px; }
    .modal-box { padding: 20px 16px; }
    .filemgr-box { width: min(96vw, 660px); }
}

/* ── 超大屏幕 (≥ 1800px) ── */
@media (min-width: 1800px) {
    .sidebar { width: 300px; }
    #markdown-input, #markdown-output { padding: 48px 56px; }
    .minimap-pane { width: 120px; }
    .mac-slider { width: 120px; }
    .pane-header { padding: 0 32px; }
}

/* ===========================================
   @media print — PDF 打印纯净模式
   =========================================== */
@media print {
    @page { margin: 15mm; }

    /* 重置 body/html 使内容可以纵向自由延伸 */
    html, body {
        height: auto !important;
        overflow: visible !important;
        overflow-x: visible !important;
        max-width: none !important;
        background: #ffffff !important;
        color: #1f2328 !important;
    }

    body, .app-container, .preview-pane, #markdown-output {
        background: #ffffff !important; color: #1f2328 !important;
    }

    /* 隐藏所有非内容 UI，包括移动端新增组件 */
    .sidebar, .editor-pane, .minimap-pane, .pane-header,
    .sidebar-footer, .sidebar-footer-bottom, #global-loader,
    .modal-overlay, .filemgr-overlay,
    .code-header, .code-controls, .control-btn, .img-delete-btn,
    .mobile-tab-bar, .sidebar-backdrop { display: none !important; }

    /* 强制显示预览区（移动端可能被隐藏） */
    .app-container {
        display: block !important;
        padding: 0 !important;
        height: auto !important;
        overflow: visible !important;
    }
    .preview-pane {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        border: none !important;
        overflow: visible !important;
        flex: none !important;
    }

    #markdown-output {
        padding: 0 !important; overflow: visible !important;
        font-size: 14px !important; line-height: 1.7 !important;
    }

    #markdown-output pre {
        background: #f6f8fa !important; color: #1f2328 !important;
        border: 1px solid #d0d7de !important;
        max-width: 100% !important; overflow: visible !important;
        white-space: pre-wrap !important; overflow-wrap: anywhere !important;
        word-break: break-word !important; font-size: 12px !important;
        line-height: 1.5 !important; padding: 14px 14px 12px !important;
        margin: 0.95em 0 1.25em !important;
        break-inside: avoid-page; page-break-inside: avoid;
        box-shadow: none !important; filter: none !important;
        transform: none !important; transition: none !important;
    }
    #markdown-output pre:hover { box-shadow: none !important; filter: none !important; transform: none !important; }

    #markdown-output .export-code-block {
        max-width: 100% !important; background: #f6f8fa !important;
        color: #1f2328 !important; border: 1px solid #d0d7de !important;
        border-radius: 8px; font-size: 12px !important;
        line-height: 1.5 !important; margin: 0.45em 0 0.7em !important;
        padding: 8px 10px !important; box-shadow: none !important;
        break-inside: auto; page-break-inside: auto; overflow: visible !important;
    }
    #markdown-output .export-code-fragment {
        max-width: 100% !important; background: #f6f8fa !important;
        color: #1f2328 !important; border: 1px solid #d0d7de !important;
        border-radius: 8px; padding: 8px 10px !important;
        margin: 0.45em 0 0.7em !important;
        break-inside: auto; page-break-inside: auto;
    }
    #markdown-output .export-code-fragment.export-page-break-before { break-before: page; page-break-before: always; }

    #markdown-output pre code, #markdown-output pre code.hljs, #markdown-output .hljs {
        white-space: pre-wrap !important; overflow-wrap: anywhere !important;
        word-break: break-word !important; font-size: 12px !important;
        line-height: 1.5 !important; background: transparent !important;
        break-inside: auto; page-break-inside: auto; orphans: 2; widows: 2;
    }
    #markdown-output pre code > * { break-inside: avoid; page-break-inside: avoid; }

    #markdown-output .export-code-lines { display: block; }
    #markdown-output .export-code-line {
        display: block;
        font-family: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
        white-space: pre-wrap !important; overflow-wrap: anywhere !important;
        word-break: break-word !important; background: transparent !important;
        border-radius: 0; padding: 0.02em 0; margin: 0;
        break-inside: avoid; page-break-inside: avoid; orphans: 2; widows: 2;
    }
    #markdown-output .export-code-line.hljs { background: transparent !important; }

    #markdown-output code {
        background: rgba(175, 184, 193, 0.2) !important;
        color: #1f2328 !important;
    }
}
