/* ============ 主题变量 ============ */ :root { --bg: #ffffff; --bg-soft: #f7f8fa; --bg-toolbar: #fbfbfc; --bg-hover: #eef1f5; --bg-active: #e3e9f2; --border: #e4e7ec; --border-strong: #d3d8e0; --text: #1f2329; --text-dim: #6b7280; --text-faint: #9aa1ac; --accent: #2f6feb; --accent-soft: #e8f0ff; --accent-text: #ffffff; --danger: #d14343; --code-bg: #f2f4f7; --code-block-bg: #f6f8fa; --quote-bar: #d0d7e2; --shadow: 0 8px 28px rgba(15, 23, 42, .14); --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06); --font-ui: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif; --font-mono: "Cascadia Code", "JetBrains Mono", Consolas, "Courier New", monospace; } html[data-theme="dark"] { --bg: #1b1c1f; --bg-soft: #202226; --bg-toolbar: #1e2024; --bg-hover: #2a2d33; --bg-active: #32363d; --border: #2e3238; --border-strong: #3b4048; --text: #e6e8ec; --text-dim: #9aa3ae; --text-faint: #6f7782; --accent: #4f8ef7; --accent-soft: #1e2c44; --accent-text: #ffffff; --danger: #ef6b6b; --code-bg: #262a30; --code-block-bg: #22252a; --quote-bar: #3d434c; --shadow: 0 8px 28px rgba(0, 0, 0, .5); --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); } /* ============ 基础 ============ */ * { box-sizing: border-box; } html, body { margin: 0; height: 100%; overflow: hidden; } body { font-family: var(--font-ui); font-size: 13px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; user-select: none; } .app { display: flex; flex-direction: column; height: 100vh; } button { font-family: inherit; font-size: inherit; color: inherit; border: none; background: none; cursor: pointer; } /* ============ 工具栏 ============ */ .toolbar { display: flex; align-items: center; gap: 6px; height: 50px; flex: 0 0 50px; padding: 0 10px; background: var(--bg-toolbar); border-bottom: 1px solid var(--border); } .brand { display: flex; align-items: center; gap: 8px; padding-right: 8px; margin-right: 4px; -webkit-app-region: drag; } .brand-name { font-size: 12.5px; font-weight: 600; color: var(--text-dim); white-space: nowrap; } .tb-group { display: flex; align-items: center; gap: 2px; } .tb-btn { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 9px; border-radius: 7px; color: var(--text-dim); white-space: nowrap; transition: background .12s, color .12s; } .tb-btn svg { width: 15px; height: 15px; fill: currentColor; } .tb-btn span { font-size: 12.5px; } .tb-btn:hover { background: var(--bg-hover); color: var(--text); } .tb-btn:active { background: var(--bg-active); } .tb-btn.on { background: var(--accent-soft); color: var(--accent); } .tb-btn.primary { color: var(--accent); } .tb-btn.primary:hover { background: var(--accent-soft); } .tb-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 7px; color: var(--text-dim); transition: background .12s, color .12s; } .tb-icon svg { width: 15px; height: 15px; fill: currentColor; } .tb-icon:hover { background: var(--bg-hover); color: var(--text); } .tb-icon:active { background: var(--bg-active); } .tb-icon.disabled { opacity: .35; pointer-events: none; } .tb-sep { width: 1px; height: 20px; margin: 0 4px; background: var(--border); } .spacer { flex: 1; } /* 分段控件 */ .seg { display: flex; padding: 2px; border-radius: 8px; background: var(--bg-soft); border: 1px solid var(--border); } .seg button { height: 24px; padding: 0 11px; border-radius: 6px; font-size: 12px; color: var(--text-dim); transition: background .12s, color .12s; } .seg button:hover { color: var(--text); } .seg button.active { background: var(--bg); color: var(--accent); font-weight: 600; box-shadow: var(--shadow-sm); } html[data-theme="dark"] .seg button.active { background: var(--bg-active); } /* ============ 标签栏 ============ */ .tabbar { display: flex; align-items: stretch; flex: 0 0 32px; height: 32px; overflow-x: auto; overflow-y: hidden; background: var(--bg-soft); border-bottom: 1px solid var(--border); user-select: none; } .tabbar[hidden] { display: none; } .tabbar::-webkit-scrollbar { height: 5px; } .tabbar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; } .tab { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; min-width: 118px; max-width: 230px; padding: 0 8px 0 12px; border-right: 1px solid var(--border); border-top: 2px solid transparent; font-size: 12px; color: var(--text-dim); cursor: default; } .tab:hover { background: var(--bg-hover); } .tab.active { background: var(--bg); color: var(--text); border-top-color: var(--accent); } .tab .tab-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .tab .tab-dot { flex: 0 0 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: 0; } .tab.dirty .tab-dot { opacity: 1; } .tab .tab-close { flex: 0 0 16px; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 4px; color: var(--text-faint); font-size: 11px; line-height: 1; } .tab .tab-close:hover { background: var(--bg-active); color: var(--text); } .tab .tab-close svg { width: 9px; height: 9px; fill: currentColor; } /* ============ 查找条 ============ */ .findbar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--bg-soft); border-bottom: 1px solid var(--border); } .findbar[hidden] { display: none; } .findbar input { flex: 1; height: 28px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); font-family: var(--font-ui); font-size: 12.5px; outline: none; } .findbar input:focus { border-color: var(--accent); } .find-count { font-size: 11.5px; color: var(--text-faint); min-width: 62px; } .findbar button { width: 26px; height: 26px; border-radius: 6px; color: var(--text-dim); font-size: 12px; } .findbar button:hover { background: var(--bg-hover); color: var(--text); } /* ============ 工作区 ============ */ .workspace { flex: 1; display: flex; min-height: 0; overflow: hidden; background: var(--bg); } .pane { display: flex; min-width: 0; overflow: hidden; } /* ============ 文件树侧栏 ============ */ .sidebar { flex: 0 0 232px; display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--bg-soft); border-left: 1px solid var(--border); border-right: 1px solid var(--border); } .sidebar[hidden] { display: none; } /* 面板头部(文件目录 / 章节大纲 共用,保证视觉统一) */ .panel-head { display: flex; align-items: center; gap: 7px; flex: 0 0 34px; padding: 0 6px 0 12px; border-bottom: 1px solid var(--border); } .panel-ico { flex: 0 0 13px; width: 13px; height: 13px; fill: var(--text-faint); } .panel-title { font-size: 12px; font-weight: 600; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .panel-actions { display: flex; gap: 2px; flex: 0 0 auto; margin-left: auto; } .sb-btn { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 5px; color: var(--text-faint); } .sb-btn svg { width: 13px; height: 13px; fill: currentColor; } .sb-btn:hover { background: var(--bg-hover); color: var(--text); } .sb-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 0 24px; user-select: none; } .tree-row { display: flex; align-items: center; gap: 5px; height: 26px; padding-right: 8px; font-size: 12.5px; color: var(--text); white-space: nowrap; cursor: default; } .tree-row:hover { background: var(--bg-hover); } .tree-row:focus { outline: none; background: var(--bg-active); } .tree-row:focus.active { background: var(--accent-soft); } .tree-row.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; } .tree-row .twisty { flex: 0 0 12px; text-align: center; font-size: 9px; line-height: 1; color: var(--text-faint); } .tree-row.is-dir .tree-name { font-weight: 500; } .tree-row .tree-name { overflow: hidden; text-overflow: ellipsis; } .tree-empty { padding: 5px 12px 5px 30px; font-size: 11.5px; color: var(--text-faint); } .sb-tip { padding: 26px 16px; font-size: 12px; line-height: 1.7; color: var(--text-faint); text-align: center; } .sb-tip-sub { margin-top: 6px; font-size: 11.5px; color: var(--text-faint); opacity: .85; }.sb-pick-btn { margin-top: 14px; height: 28px; padding: 0 16px; border-radius: 7px; background: var(--accent); color: var(--accent-text); font-size: 12px; font-weight: 500; } .sb-pick-btn:hover { filter: brightness(1.06); } .sb-pick-btn:active { filter: brightness(.94); } /* ============ 章节大纲 ============ */ .outline { flex: 0 0 210px; display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--bg-soft); border-left: 1px solid var(--border); border-right: 1px solid var(--border); } .outline[hidden] { display: none; } .ol-count { margin-left: auto; padding: 1px 7px; border-radius: 9px; background: var(--bg-hover); font-size: 10.5px; color: var(--text-faint); } .ol-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 0 24px; user-select: none; } .ol-item { padding: 4px 10px; font-size: 12.5px; line-height: 1.45; color: var(--text-dim); border-left: 2px solid transparent; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; } .ol-item:hover { background: var(--bg-hover); color: var(--text); } .ol-item.active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-soft); } .ol-item[data-level="1"] { color: var(--text); font-weight: 600; } .ol-item[data-level="1"].active { color: var(--accent); } .ol-empty { padding: 22px 14px; font-size: 12px; line-height: 1.7; color: var(--text-faint); text-align: center; } .editor-pane { flex: 1; position: relative; } /* 编辑器查找高亮叠加层:文字透明只显示 mark 背景,随编辑器滚动 */ .editor-wrap { position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; } .editor-hl { position: absolute; inset: 0; padding: 18px 22px; color: transparent; font-family: var(--font-mono); font-size: 13.5px; line-height: 1.7; tab-size: 4; white-space: pre-wrap; word-wrap: break-word; overflow: hidden; pointer-events: none; } .editor-hl mark { background: rgba(255, 193, 7, .32); color: transparent; border-radius: 3px; } .editor-hl mark.find-hit-active { background: rgba(255, 159, 10, .55); } #editor { flex: 1; width: 100%; height: 100%; padding: 18px 22px; border: none; outline: none; resize: none; background: transparent; color: var(--text); font-family: var(--font-mono); font-size: 13.5px; line-height: 1.7; tab-size: 4; overflow-y: auto; user-select: text; caret-color: var(--accent); } #editor::placeholder { color: var(--text-faint); } .splitter { flex: 0 0 1px; background: var(--border); cursor: col-resize; position: relative; transition: background .15s; } .splitter::after { content: ''; position: absolute; top: 0; bottom: 0; left: -3px; right: -3px; } .splitter:hover, .splitter.dragging { background: var(--accent); } /* 侧栏 / 大纲的可拖拽分隔条 */ .vsplitter { flex: 0 0 1px; background: var(--border); cursor: col-resize; position: relative; transition: background .15s; } .vsplitter::after { content: ''; position: absolute; top: 0; bottom: 0; left: -3px; right: -3px; } .vsplitter:hover, .vsplitter.dragging { background: var(--accent); } .vsplitter[hidden] { display: none; } .preview-pane { flex: 1; overflow: hidden; background: var(--bg); } /* 模式切换 */ .workspace[data-mode="edit"] .preview-pane, .workspace[data-mode="edit"] .splitter { display: none; } .workspace[data-mode="read"] .editor-pane, .workspace[data-mode="read"] .splitter { display: none; } /* ============ 预览排版 ============ */ /* 查找:正文关键字背景标记 */ #preview mark.find-hit { background: rgba(255, 193, 7, .45); color: inherit; padding: 0 1px; border-radius: 3px; } #preview mark.find-hit.find-hit-active { background: #ff9f0a; color: #fff; } .markdown-body { height: 100%; overflow-y: auto; padding: 34px 46px 120px; max-width: 900px; margin: 0 auto; font-size: 14.5px; line-height: 1.78; color: var(--text); user-select: text; overflow-wrap: break-word; } .markdown-body > *:first-child { margin-top: 0; } .markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 { margin: 1.6em 0 .6em; font-weight: 650; line-height: 1.35; scroll-margin-top: 20px; } .markdown-body h1 { font-size: 1.9em; padding-bottom: .3em; border-bottom: 1px solid var(--border); } .markdown-body h2 { font-size: 1.5em; padding-bottom: .25em; border-bottom: 1px solid var(--border); } .markdown-body h3 { font-size: 1.24em; } .markdown-body h4 { font-size: 1.08em; } .markdown-body h5 { font-size: 1em; } .markdown-body h6 { font-size: .94em; color: var(--text-dim); } .markdown-body p { margin: .85em 0; } .markdown-body a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; } .markdown-body a:hover { border-bottom-color: currentColor; } .markdown-body strong { font-weight: 650; } .markdown-body em { font-style: italic; } .markdown-body del { color: var(--text-faint); } .markdown-body code { padding: .16em .4em; border-radius: 5px; background: var(--code-bg); font-family: var(--font-mono); font-size: .88em; color: #b5446e; } html[data-theme="dark"] .markdown-body code { color: #f0a1c0; } .code-wrap { position: relative; margin: 1em 0; border-radius: 9px; background: var(--code-block-bg); border: 1px solid var(--border); overflow: hidden; } .code-wrap pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-family: var(--font-mono); font-size: 12.8px; line-height: 1.65; } .code-wrap pre code { padding: 0; background: none; color: var(--text); font-size: inherit; white-space: pre; } .code-lang { position: absolute; top: 6px; right: 10px; font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); font-family: var(--font-ui); pointer-events: none; } .markdown-body blockquote { margin: 1em 0; padding: .2em 1em; border-left: 3px solid var(--quote-bar); color: var(--text-dim); } .markdown-body blockquote > *:first-child { margin-top: .4em; } .markdown-body blockquote > *:last-child { margin-bottom: .4em; } .markdown-body ul, .markdown-body ol { margin: .7em 0; padding-left: 1.7em; } .markdown-body li { margin: .3em 0; } .markdown-body li > ul, .markdown-body li > ol { margin: .3em 0; } .markdown-body li.task-item { list-style: none; margin-left: -1.35em; } .markdown-body li.task-item input { margin-right: .45em; vertical-align: 1px; accent-color: var(--accent); } .markdown-body hr { height: 1px; margin: 1.8em 0; border: none; background: var(--border); } .table-wrap { overflow-x: auto; margin: 1.1em 0; } .markdown-body table { border-collapse: collapse; width: 100%; font-size: .95em; } .markdown-body th, .markdown-body td { padding: 7px 13px; border: 1px solid var(--border); text-align: left; } .markdown-body th { background: var(--bg-soft); font-weight: 600; } .markdown-body tbody tr:nth-child(2n) { background: color-mix(in srgb, var(--bg-soft) 60%, transparent); } .markdown-body img { max-width: 100%; border-radius: 8px; margin: .4em 0; } /* ============ 状态栏 ============ */ .statusbar { display: flex; align-items: center; justify-content: space-between; flex: 0 0 26px; height: 26px; padding: 0 12px; background: var(--bg-toolbar); border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-faint); } .st-left, .st-right { display: flex; align-items: center; gap: 8px; } /* 状态栏里的「检查更新」文字链接 */ .st-link { color: var(--accent); cursor: pointer; text-decoration: none; } .st-link:hover { text-decoration: underline; } .st-link.busy { opacity: .5; pointer-events: none; } .st-file { color: var(--text-dim); max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .st-dirty { padding: 1px 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); font-size: 10.5px; } .st-div { color: var(--border-strong); } /* ============ 右键菜单 ============ */ .ctx-menu { position: fixed; z-index: 900; min-width: 200px; padding: 5px; border-radius: 9px; background: var(--bg); border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 12.5px; } .ctx-menu[hidden] { display: none; } .ctx-item { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 30px; padding: 0 10px; border-radius: 6px; color: var(--text); cursor: default; } .ctx-item:hover { background: var(--accent); color: var(--accent-text); } .ctx-item .kbd { font-size: 11px; color: var(--text-faint); } .ctx-item:hover .kbd { color: rgba(255, 255, 255, .8); } .ctx-item.disabled { color: var(--text-faint); pointer-events: none; } .ctx-sep { height: 1px; margin: 4px 6px; background: var(--border); } /* ============ 提示 ============ */ .toast { position: fixed; left: 50%; bottom: 46px; transform: translateX(-50%) translateY(8px); padding: 8px 16px; border-radius: 8px; background: rgba(28, 32, 38, .92); color: #fff; font-size: 12.5px; opacity: 0; transition: opacity .18s, transform .18s; pointer-events: none; z-index: 950; } .toast[hidden] { display: none; } .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); } .drop-hint { position: fixed; inset: 0; z-index: 990; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent) 12%, transparent); border: 2px dashed var(--accent); backdrop-filter: blur(1px); } .drop-hint[hidden] { display: none; } .drop-hint div { padding: 10px 22px; border-radius: 10px; background: var(--bg); box-shadow: var(--shadow); color: var(--accent); font-weight: 600; } /* 滚动条 */ ::-webkit-scrollbar { width: 11px; height: 11px; } ::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text-faint) 42%, transparent); border: 3px solid transparent; background-clip: content-box; border-radius: 10px; } ::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--text-faint) 70%, transparent); background-clip: content-box; } ::-webkit-scrollbar-track { background: transparent; } /* 拖动分栏时禁止选中 */ body.resizing { cursor: col-resize; } body.resizing #editor, body.resizing .markdown-body { pointer-events: none; }