:root {
  color-scheme: light;
  --page: #ffffff;
  --sidebar: #f5f5f5;
  --surface: #ffffff;
  --surface-muted: #fafafa;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --faint: #a3a3a3;
  --line: #e2e2e2;
  --accent: #ff5971;
  --teal: #01847e;
  --selected: #fff0eb;
  --code: #f5f5f5;
  --shadow: 0 18px 50px rgba(25, 25, 25, .08);
  --reading-font-size: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--page); }
button { font: inherit; }
button:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.app-shell { height: 100vh; position: relative; display: grid; grid-template-columns: var(--sidebar-w, 286px) 1fr; grid-template-rows: minmax(0, 1fr); }
.sidebar-resizer { position: absolute; top: 0; bottom: 0; left: var(--sidebar-w, 286px); width: 9px; transform: translateX(-50%); z-index: 20; cursor: col-resize; touch-action: none; }
.sidebar-resizer::after { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; transform: translateX(-50%); background: transparent; transition: background 120ms ease; }
.sidebar-resizer:hover::after, .sidebar-resizer.dragging::after { background: var(--accent); width: 2px; }
body.resizing { cursor: col-resize; user-select: none; }
.sidebar { background: var(--sidebar); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.brand-row { height: 64px; display: flex; align-items: center; gap: 11px; padding: 0 22px; border-bottom: 1px solid var(--line); }
.brand-mark { height: 38px; width: auto; object-fit: contain; }
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: .01em; }
.brand-caption { color: var(--muted); font-size: 11px; margin-top: 3px; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; padding: 25px 18px 5px 22px; font-size: 12px; color: var(--muted); font-weight: 600; }
.icon-button { width: 30px; height: 30px; border: 0; background: transparent; border-radius: 8px; color: var(--muted); cursor: pointer; display: grid; place-items: center; transition: background 120ms ease, color 120ms ease; }
.icon-button svg { width: 16px; height: 16px; stroke-width: 1.8; }
.icon-button:hover { background: rgba(0, 0, 0, .06); color: var(--text); }
.folder-summary { min-height: 28px; padding: 0 22px; color: var(--faint); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree { padding: 5px 10px 24px; overflow: auto; flex: 1; }
.tree-row { min-height: 34px; display: flex; align-items: center; gap: 7px; padding: 5px 8px; border: 1px solid transparent; border-radius: 5px; cursor: pointer; font-size: 13px; }
.tree-row:hover { background: rgba(255, 255, 255, .65); }
.tree-row.selected { background: var(--selected); border-color: transparent; color: var(--accent); font-weight: 600; }
.tree-row.directory { color: #424242; font-weight: 500; }
.tree-arrow { width: 13px; color: var(--faint); font-size: 11px; }
.tree-icon { width: 16px; height: 18px; color: var(--teal); display: grid; place-items: center; }
.tree-icon svg { width: 14px; height: 14px; stroke-width: 1.7; }
.tree-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-children { padding-left: 15px; }
.tree-empty { padding: 56px 22px; color: var(--muted); text-align: center; }
.empty-icon { width: 44px; height: 44px; margin: 0 auto 15px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-muted); color: var(--teal); display: grid; place-items: center; font-size: 19px; }
.tree-empty strong { color: var(--text); display: block; font-size: 13px; font-weight: 500; }
.tree-empty p { font-size: 12px; line-height: 1.6; margin: 7px 0 0; }
.recent-folder { margin: 16px auto 0; display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-muted); color: var(--text); font-size: 12px; cursor: pointer; transition: border-color 120ms ease, color 120ms ease; }
.recent-folder:hover { border-color: var(--accent); color: var(--accent); }
.recent-folder svg { width: 14px; height: 14px; flex: 0 0 auto; color: var(--accent); }
.recent-folder-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.content { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.topbar { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 42px; border-bottom: 1px solid var(--line); box-shadow: 0 6px 20px -18px rgba(0, 0, 0, .5); }
.crumbs { min-width: 0; display: flex; align-items: baseline; gap: 13px; overflow: hidden; }
.eyebrow { color: var(--teal); font-size: 10px; font-weight: 700; letter-spacing: .12em; white-space: nowrap; }
#current-path { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 15px; flex-shrink: 0; }
.reading-tools { display: flex; align-items: center; gap: 2px; }
.reading-tools .icon-button { font-size: 12px; font-weight: 600; letter-spacing: -.04em; }
.support-note { color: var(--faint); font-size: 11px; }
.about { position: relative; }
.about-trigger { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 8px; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.about-trigger svg { width: 14px; height: 14px; }
.about:hover .about-trigger, .about:focus-within .about-trigger { background: rgba(0, 0, 0, .06); color: var(--text); }
.about-popup { position: absolute; z-index: 12; top: calc(100% + 8px); right: 0; width: 268px; padding: 14px 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--page); box-shadow: var(--shadow); opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity 120ms ease, transform 120ms ease; }
/* Invisible bridge over the 8px gap so the cursor can move from the trigger
   into the popup without hover dropping — that gap was a dead zone. */
.about-popup::before { content: ''; position: absolute; top: -10px; left: 0; right: 0; height: 10px; }
.about:hover .about-popup, .about:focus-within .about-popup { opacity: 1; visibility: visible; transform: translateY(0); }
.about-title { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.about-desc { margin: 0 0 12px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.about-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; line-height: 1.5; padding: 4px 0; }
.about-row svg { width: 15px; height: 15px; flex: 0 0 auto; color: var(--muted); }
.about-link { color: var(--accent); text-decoration: none; }
.about-link:hover { text-decoration: underline; }
.about-link .about-ext { width: 12px; height: 12px; margin-left: -2px; color: var(--accent); }
.about-feedback { color: var(--muted); }
.about-feedback b { color: var(--text); font-weight: 600; }
body.depth .about:hover .about-trigger, body.depth .about:focus-within .about-trigger { background: rgba(255, 255, 255, .08); }
.reader { position: relative; flex: 1; min-height: 0; overflow: auto; }
.reader:focus, .reader:focus-visible { outline: none; }
.find-panel { position: sticky; top: 10px; z-index: 6; display: flex; align-items: center; gap: 6px; width: min(390px, calc(100% - 28px)); margin: 10px 14px -50px auto; padding: 5px; border: 1px solid var(--line); border-radius: 6px; background: var(--page); box-shadow: var(--shadow); }
.find-panel[hidden] { display: none; }
.find-panel input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 13px; padding: 6px 7px; }
.find-panel span { min-width: 38px; color: var(--muted); font-size: 11px; text-align: center; }
.find-button { width: 26px; height: 26px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.find-button:hover { background: var(--surface-muted); color: var(--text); }
.find-button svg { width: 14px; height: 14px; }
.search-match { border-radius: 2px; background: rgba(255, 190, 50, .42); color: inherit; }
.search-match.current { background: var(--accent); color: #fff; }
.reader-empty { max-width: 680px; margin: 15vh auto 0; padding: 0 34px 80px; }
.reader-kicker { color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .14em; }
.reader-empty h1 { margin: 17px 0 17px; font-size: clamp(32px, 4vw, 50px); line-height: 1.18; font-weight: 400; letter-spacing: 0; }
.reader-empty h1 .hl-md { font-weight: 600; background: linear-gradient(96deg, var(--accent) 0%, var(--teal) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.reader-empty p { max-width: 520px; color: var(--muted); font-size: 15px; line-height: 1.9; margin: 0 0 28px; }
code { padding: 2px 5px; background: var(--code); border-radius: 3px; color: var(--teal); font-size: .9em; }
.primary-button { border: 0; border-radius: 8px; background: var(--text); color: var(--page); padding: 12px 18px; cursor: pointer; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 7px; box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .45); transition: transform 120ms ease, box-shadow 120ms ease; }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 12px 26px -10px rgba(0, 0, 0, .5); }
.primary-button svg { width: 15px; height: 15px; color: var(--accent); stroke-width: 1.8; }
.reader-meta { display: flex; align-items: center; gap: 9px; color: var(--faint); font-size: 11px; margin-top: 34px; }
.meta-dot { width: 3px; height: 3px; border-radius: 50%; background: #c5c5c5; }
.reader-guide { max-width: 560px; margin-top: 42px; padding-top: 28px; border-top: 1px solid var(--line); }
.reader-guide-title { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .02em; margin-bottom: 16px; }
.reader-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.reader-steps li { display: flex; gap: 12px; align-items: flex-start; }
.step-num { flex: 0 0 auto; width: 24px; height: 24px; margin-top: 1px; border-radius: 50%; background: var(--selected); color: var(--accent); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.step-body b { display: block; font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.step-body p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.step-plus { color: var(--teal); font-weight: 600; }
.reader-guide kbd { font-family: inherit; font-size: 11px; padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-muted); color: var(--text); }
.document { width: 100%; margin: 0; padding: 24px 32px 110px; }
.outline-panel { position: fixed; z-index: 4; top: 78px; right: 22px; width: 220px; max-height: calc(100vh - 100px); overflow: auto; padding: 14px 10px 14px 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--page); box-shadow: var(--shadow); }
.outline-title { margin: 0 0 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.outline-panel nav { display: grid; gap: 2px; }
.outline-panel a { display: block; overflow: hidden; padding: 5px 7px; border-radius: 4px; color: var(--muted); font-size: 12px; line-height: 1.45; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.outline-panel a:hover { background: var(--surface-muted); color: var(--text); }
.outline-panel .outline-level-2 { padding-left: 16px; }
.outline-panel .outline-level-3 { padding-left: 25px; font-size: 11px; }
.heading-pulse { animation: heading-pulse 1s ease-out; }
@keyframes heading-pulse { 0% { background: rgba(255, 89, 113, .28); } 100% { background: transparent; } }
.footnotes { margin-top: 40px; font-size: 13px; color: var(--muted); }
.footnotes hr { border: 0; border-top: 1px solid var(--line); margin: 0 0 16px; }
.footnotes ol { padding-left: 20px; margin: 0; }
.footnotes li { margin: 0 0 8px; line-height: 1.7; }
.footnote-text { margin-right: 6px; }
.footnote-ref, .footnote-backref { color: var(--accent); text-decoration: none; }
.footnote-ref { font-size: .85em; vertical-align: baseline; }
.footnote-ref:hover, .footnote-backref:hover { text-decoration: underline; }
.return-anchor-button { position: fixed; z-index: 5; bottom: 26px; left: 50%; transform: translateX(-50%); padding: 8px 16px; border: 0; border-radius: 20px; background: var(--text); color: var(--page); font-size: 12px; box-shadow: var(--shadow); cursor: pointer; }
.return-anchor-button:hover { opacity: .9; }
.backlink-section { margin-top: 28px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-muted); }
.backlink-title { padding-bottom: 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 16px; line-height: 1.4; }
.backlink-list { display: grid; gap: 2px; padding-top: 7px; }
.backlink-row { display: grid; gap: 1px; }
.backlink-document, .backlink-heading, .backlink-more { border: 0; background: transparent; color: var(--accent); text-align: left; cursor: pointer; }
.backlink-document { display: flex; align-items: center; gap: 8px; padding: 6px 4px; font-size: 15px; font-weight: 600; }
.backlink-document:hover, .backlink-heading:hover, .backlink-more:hover { text-decoration: underline; }
.backlink-chevron { width: 12px; color: var(--muted); font-size: 18px; line-height: 1; transition: transform 120ms ease; }
.backlink-row.expanded .backlink-chevron { transform: rotate(90deg); }
.backlink-icon { color: var(--accent); font-size: 18px; line-height: 1; }
.backlink-headings { display: grid; gap: 2px; padding: 1px 0 5px 34px; }
.backlink-heading { padding: 4px 4px; color: var(--accent); font-size: 13px; }
.backlink-more { padding: 7px 4px 0; color: var(--muted); font-size: 15px; }
.document-return-button { position: fixed; z-index: 8; right: 24px; bottom: 24px; padding: 9px 15px; border: 0; border-radius: 20px; background: var(--text); color: var(--page); box-shadow: var(--shadow); cursor: pointer; font-size: 12px; }
.section-ref { color: var(--accent); text-decoration: none; cursor: pointer; }
.section-ref:hover { text-decoration: underline; }
.link-preview-card { position: fixed; z-index: 15; right: 24px; bottom: 24px; width: min(360px, calc(100vw - 32px)); display: grid; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--page); box-shadow: var(--shadow); }
.link-preview-card strong { color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-preview-card > span { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.link-preview-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 5px; }
.link-preview-actions a, .link-preview-actions button { border: 0; border-radius: 5px; padding: 5px 9px; font-size: 12px; cursor: pointer; }
.link-preview-actions a { background: var(--accent); color: #fff; text-decoration: none; }
.link-preview-actions button { background: var(--surface-muted); color: var(--text); }
.mind-map-overlay { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; background: rgba(255, 255, 255, .96); }
.mind-map-toolbar { min-height: 48px; display: flex; align-items: center; gap: 14px; padding: 0 18px; border-bottom: 1px solid #e2e2e2; background: #fff; }
.mind-map-toolbar strong { color: var(--text); font-size: 13px; }
.mind-map-hint { flex: 1; color: var(--muted); font-size: 11px; }
.mind-map-reset { border: 1px solid #d8d8d8; border-radius: 5px; padding: 5px 9px; background: #fff; color: #6b6b6b; cursor: pointer; font-size: 12px; }
.mind-map-reset:hover { border-color: #3b7de0; color: #3b7de0; }
.mind-map-close { width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; }
.mind-map-close:hover { background: var(--surface-muted); color: var(--text); }
.mind-map-viewport { position: relative; flex: 1; overflow: hidden; cursor: grab; touch-action: none; }
.mind-map-viewport:active { cursor: grabbing; }
.mind-map-canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.mind-map-edges { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.mind-map-body { position: absolute; inset: 0; }
.mind-map-node { position: absolute; display: flex; align-items: center; }
.mind-map-node-button { position: relative; z-index: 1; width: 180px; min-height: 42px; max-height: 142px; overflow: hidden; border: 1px solid var(--node-color); border-radius: 8px; padding: 8px 12px; background: var(--node-tint); color: #1a1a2e; text-align: center; font-size: 13px; font-weight: 400; line-height: 20px; cursor: pointer; box-shadow: 0 3px 10px rgba(0, 0, 0, .06); }
.mind-map-node-button.mind-map-node-strong { background: var(--node-color); color: #fff; font-weight: 700; }
.mind-map-node-button.kind-root { background: #11112a; color: #fff; }
.mind-map-node-button:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--node-color) 55%, transparent); }
.mind-map-node-button.is-selected { box-shadow: 0 0 0 2px var(--node-color), 0 0 0 5px color-mix(in srgb, var(--node-color) 28%, transparent); }
.mind-map-fold { position: absolute; z-index: 2; left: -11px; top: 50%; width: 22px; height: 22px; transform: translateY(-50%); border: 1px solid var(--node-color); border-radius: 50%; background: #fff; color: var(--node-color); cursor: pointer; font-size: 12px; line-height: 18px; }
.mind-map-fold:hover { background: var(--node-color); color: #fff; }
.mind-map-empty { color: var(--muted); padding: 24px; }
body.focus-mode .markdown-body > * { transition: opacity 160ms ease; }
body.focus-mode .markdown-body > .focus-dim { opacity: .32; }
body.focus-mode .markdown-body > .focus-section { opacity: .68; }
body.focus-mode .markdown-body > .focus-active { opacity: 1; }
.outline-panel a.focus-current { color: var(--accent); font-weight: 600; }
.markdown-body { font-size: var(--reading-font-size); font-weight: 300; line-height: 1.9; letter-spacing: 0; word-wrap: break-word; }
.markdown-body > * { box-sizing: border-box; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 { line-height: 1.4; font-weight: 400; }
.markdown-body h1 { color: #01847e; font-size: 26px; margin: 0 0 20px; padding-bottom: 5px; border-bottom: 1px solid rgba(1, 132, 126, .09); }
.markdown-body h2 { color: #01847e; font-size: 24px; margin: 32px 0 12px; display: inline-block; padding-bottom: 4px; border-bottom: 1.25px solid rgba(1, 132, 126, .19); }
.markdown-body h3 { color: #01847e; font-size: 20px; margin: 24px 0 10px; }
.markdown-body h4 { color: #01847e; font-size: 18px; margin: 20px 0 8px; }
.markdown-body h5 { color: #01847e; font-size: 17px; margin: 18px 0 8px; }
.markdown-body h6 { color: #01847e; font-size: 14px; margin: 16px 0 8px; }
.markdown-body p { margin: 0 0 16px; }
.markdown-body a { color: var(--accent); text-decoration: none; }
.markdown-body a:hover { text-decoration: underline; }
.markdown-body strong { font-weight: 600; }
.markdown-body blockquote { margin: 0 0 16px; padding: 12px 18px 12px 48px; border: 0; background: linear-gradient(90deg, rgba(1,132,126,.08), rgba(255,89,113,.08)); border-radius: 6px; color: var(--muted); position: relative; }
.markdown-body blockquote::before { content: "\201C"; position: absolute; left: 16px; top: 10px; color: rgba(1, 132, 126, .63); font-size: 32px; line-height: 1; }
.markdown-body blockquote blockquote { padding: 4px 0 4px 16px; background: transparent; border-left: 4px solid var(--teal); border-radius: 0; }
.markdown-body blockquote blockquote::before { content: none; }
.markdown-body ul, .markdown-body ol { list-style: none; padding-left: 0; margin: 0 0 16px; }
.markdown-body li { display: flex; align-items: flex-start; gap: 7px; margin: 0 0 6px; }
.markdown-body li:last-child { margin-bottom: 0; }
.marker-cell { width: 13px; min-width: 13px; min-height: 1.9em; display: grid; place-items: start center; padding-top: .35em; }
.list-content { min-width: 0; flex: 1; }
.markdown-body li p { margin: 0; }
.list-marker { width: 6px; height: 6px; margin-top: .45em; border-radius: 50%; background: var(--accent); }
.markdown-body ol { counter-reset: markdown-item; }
.markdown-body ol > li { counter-increment: markdown-item; }
.markdown-body ol > li > .marker-cell::before { content: counter(markdown-item) "."; color: var(--accent); font-size: 13px; line-height: 1.4; }
.markdown-body li > .list-content > ul, .markdown-body li > .list-content > ol { margin-top: 0; margin-bottom: 0; padding-left: 20px; }
.markdown-body li > p + ul, .markdown-body li > p + ol { margin-top: 0; }
.markdown-body li > .list-content > ul > li > .marker-cell .list-marker { width: 5px; height: 5px; border: 1px solid var(--accent); background: transparent; }
.markdown-body li.task-item { padding-left: 20px; }
.markdown-body li.task-item { padding-left: 0; }
.task-icon { width: 13px; height: 13px; border: 1px solid var(--accent); border-radius: 2px; display: grid; place-items: center; color: var(--accent); }
.task-icon.checked { background: var(--accent); color: #fff; }
.task-icon svg { width: 10px; height: 10px; stroke-width: 2.4; }
.markdown-body code, .markdown-body pre { font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace; }
.markdown-body code { padding: 1px 5px; border: 1px solid #f7e9f2; background: #faf4f8; border-radius: 4px; color: var(--accent); font-size: 12.6px; }
.inline-color-chip, .inline-time-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 5px; border: 1px solid color-mix(in srgb, var(--line) 75%, transparent); border-radius: 4px; background: color-mix(in srgb, var(--code) 78%, transparent); color: var(--accent); font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace; font-size: .9em; line-height: 1.45; white-space: nowrap; vertical-align: baseline; }
.inline-color-swatch { width: .9em; height: .9em; flex: 0 0 auto; border: 1px solid color-mix(in srgb, var(--line) 85%, #000 15%); border-radius: 2px; }
.inline-time-icon { color: var(--muted); font-family: inherit; }
.emoji-shortcode { display: inline-block; font-family: "Apple Color Emoji", "Segoe UI Emoji", sans-serif; line-height: 1; }
.structured-branch { color: var(--teal); }
.structured-secondary { color: var(--muted); }
.structured-note { color: var(--accent); }
.code-block { margin: 0 0 16px; background: #f5f5f5; border-radius: 8px; }
.code-header { height: 28px; display: flex; align-items: center; padding: 8px 12px 0 16px; color: #6b6b6b; font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace; font-size: 12.6px; }
.language-menu { position: relative; flex: 1; min-width: 0; }
.code-language { display: inline-flex; align-items: baseline; border: 0; background: transparent; padding: 0; margin: 0; color: inherit; font: inherit; line-height: 20px; text-align: left; cursor: pointer; }
.code-language:hover { color: var(--text); }
.code-language-guess { color: var(--faint); }
.language-menu-list { position: absolute; z-index: 3; top: 100%; left: 0; min-width: 150px; max-height: 320px; overflow-y: auto; margin: 4px 0 0; padding: 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--page); box-shadow: var(--shadow); font-size: 12.6px; }
.language-menu-item { display: block; width: 100%; border: 0; background: transparent; padding: 6px 9px; color: var(--text); font: inherit; text-align: left; border-radius: 4px; cursor: pointer; }
.language-menu-item:hover, .language-menu-item:focus { background: var(--surface-muted); outline: 0; }
.language-menu-item.selected { color: var(--teal); font-weight: 600; }
.language-group-label { padding: 8px 9px 3px; color: var(--faint); font-size: 10.5px; font-weight: 700; letter-spacing: .04em; }
.highlight-status { color: var(--faint); font-size: 11px; white-space: nowrap; }
.code-actions { display: flex; align-items: center; gap: 8px; opacity: 0; transition: opacity 120ms ease; }
.code-block:hover .code-actions, .code-block:focus-within .code-actions { opacity: 1; }
.code-action { width: 16px; height: 20px; display: grid; place-items: center; border: 0; padding: 0; background: transparent; color: #6b6b6b; cursor: pointer; }
.code-action:hover { color: var(--text); }
.code-action svg { width: 12.6px; height: 12.6px; stroke-width: 1.8; }
.code-block pre { overflow: auto; padding: 8px 16px 16px; margin: 0; background: transparent; border-radius: 0 0 8px 8px; font-size: 12.6px; line-height: 1.55; }
.code-block pre code { padding: 0; border: 0; background: none; color: var(--text); }
.code-block pre[data-line-numbers="true"] { display: flex; gap: 12px; }
.line-number-gutter { flex: 0 0 auto; min-width: 18px; color: #9aa2ae; text-align: right; user-select: none; }
.code-block pre[data-line-numbers="true"] code { flex: 0 0 auto; }
.tool-call-card { margin: 0 0 16px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-muted); overflow: hidden; }
.tool-call-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.tool-call-heading { min-width: 0; display: flex; align-items: center; gap: 10px; }
.tool-call-icon { width: 26px; height: 26px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 7px; background: var(--selected); color: var(--accent); font-size: 19px; }
.tool-call-heading strong { display: block; color: var(--text); font-size: 13px; line-height: 1.4; font-weight: 600; }
.tool-call-heading code { display: block; width: fit-content; margin-top: 3px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 11px; }
.tool-call-action, .tool-call-copy { border: 1px solid var(--line); border-radius: 5px; padding: 5px 8px; background: var(--surface); color: var(--muted); cursor: pointer; font-size: 11px; white-space: nowrap; }
.tool-call-action:hover, .tool-call-copy:hover { border-color: var(--accent); color: var(--accent); }
.tool-call-arguments { padding: 8px 14px 10px; }
.tool-call-row { display: grid; grid-template-columns: minmax(90px, 19%) 12px minmax(0, 1fr); gap: 7px; align-items: start; padding: 5px 0; font-size: 12.5px; line-height: 1.6; }
.tool-call-key { color: var(--muted); font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace; overflow-wrap: anywhere; }
.tool-call-separator { color: var(--faint); }
.tool-call-value { min-width: 0; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.tool-call-value-details { min-width: 0; }
.tool-call-value-details summary { color: var(--muted); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-call-value-details summary:hover { color: var(--accent); }
.tool-call-value-details pre { margin: 6px 0 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--text); font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.tool-call-value-details div { margin-top: 6px; padding: 7px 9px; border-left: 2px solid var(--line); }
.tool-call-empty { color: var(--faint); font-size: 12px; }
.tool-call-raw { padding: 0 14px 12px; }
.tool-call-raw pre { max-height: 360px; margin: 0 0 8px; padding: 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); overflow: auto; }
.tool-call-raw pre code { padding: 0; border: 0; background: transparent; color: var(--text); font-size: 12px; white-space: pre; }
.table-scroll { position: relative; max-width: 100%; overflow-x: auto; margin: 0 0 16px; overscroll-behavior-x: contain; }
.markdown-body table { width: max-content; max-width: 100%; border-collapse: collapse; }
.markdown-body th, .markdown-body td { border: 1px solid #d8d8d8; padding: 8px 12px; text-align: left; font-size: 16px; }
.markdown-body th { background: #eaeaea; color: var(--text); font-weight: 600; }
.sticky-thead { position: fixed; top: 0; left: 0; z-index: 2; border-collapse: collapse; background: var(--surface); box-shadow: 0 1px 0 var(--line); pointer-events: none; user-select: none; }
.sticky-thead th { border: 1px solid #d8d8d8; padding: 8px 12px; text-align: left; font-size: 16px; background: #eaeaea; color: var(--text); font-weight: 600; }
.markdown-body img { max-width: 90%; max-height: 60vh; height: auto; display: block; object-fit: contain; }
.markdown-body img[ src ] { cursor: zoom-in; }
.markdown-body .markdown-image { outline: 0; touch-action: manipulation; }
.markdown-body img.image-missing { min-width: 120px; min-height: 48px; border: 1px dashed var(--line); }
.markdown-image-figure figcaption { color: var(--muted); font-size: 12px; line-height: 1.6; margin-top: 6px; }
.markdown-body .image-row { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 16px; }
.markdown-body .image-cell { flex: 1 1 0; min-width: 0; }
.markdown-body .image-cell .markdown-image-figure { margin: 0; }
.markdown-body .image-cell .markdown-image { max-width: 100%; object-position: left top; }
.image-lightbox { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 48px; background: rgba(0, 0, 0, .78); }
.lightbox-stage { display: grid; place-items: center; max-width: 100%; max-height: 100%; }
.lightbox-content { transition: transform 80ms ease-out; touch-action: none; user-select: none; cursor: grab; }
.lightbox-content:active { cursor: grabbing; }
.image-lightbox img.lightbox-content { max-width: min(92vw, 1400px); max-height: 84vh; object-fit: contain; display: block; }
.lightbox-svg { background: #fff; padding: 20px; border-radius: 10px; }
.lightbox-svg svg { max-width: min(88vw, 1360px); max-height: 80vh; width: auto; height: auto; display: block; }
.lightbox-caption { position: fixed; left: 50%; bottom: 22px; max-width: 80vw; transform: translateX(-50%); color: #fff; font-size: 13px; text-align: center; }
.lightbox-close { position: fixed; top: 18px; right: 22px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer; display: grid; place-items: center; }
.lightbox-close:hover { background: rgba(255, 255, 255, .25); }
.lightbox-close svg { width: 17px; height: 17px; }
.lightbox-prev, .lightbox-next { position: fixed; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer; display: grid; place-items: center; }
.lightbox-prev:hover, .lightbox-next:hover { background: rgba(255, 255, 255, .25); }
.lightbox-prev { left: 22px; }
.lightbox-next { right: 22px; }
.lightbox-prev svg, .lightbox-next svg { width: 20px; height: 20px; }
.markdown-body figure { margin: 0 0 16px; }
.markdown-body input { accent-color: var(--accent); }
.markdown-body hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
.reader-error { max-width: 600px; margin: 12vh auto; padding: 28px; border: 1px solid #f0c9bf; background: #fff8f6; border-radius: 7px; }
.reader-error h2 { margin: 0 0 8px; color: #a63a24; font-size: 18px; font-weight: 500; }
.reader-error p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }

body.depth { --page: #0d0d0d; --sidebar: #1a1b1e; --surface: #0d0d0d; --surface-muted: #141518; --text: #e8e8e8; --muted: #8a8a8a; --faint: #686868; --line: #2a2b2e; --accent: #5e6ad2; --teal: #50e3c2; --selected: rgba(80, 227, 194, .12); --code: #1a1b1e; --shadow: 0 18px 50px rgba(0,0,0,.3); }
body.depth .tree-row:hover { background: rgba(255,255,255,.05); }
body.depth .markdown-body h1,
body.depth .markdown-body h2,
body.depth .markdown-body h3,
body.depth .markdown-body h4,
body.depth .markdown-body h5,
body.depth .markdown-body h6 { color: var(--teal); }
body.depth .markdown-body h1 { border-color: rgba(80, 227, 194, .15); }
body.depth .markdown-body h2 { border-color: rgba(80, 227, 194, .26); }
body.depth .markdown-body blockquote, body.depth .code-block { background: #1a1b1e; }
body.depth .markdown-body th { background: #1a1b1e; }
body.depth .markdown-body code { background: #1a1b1e; border-color: #2a2b2e; color: var(--teal); }
body.depth .markdown-body th, body.depth .markdown-body td { border-color: #2a2b2e; }
body.depth .code-header, body.depth .code-action { color: #8a8a8a; }
body.depth .tool-call-heading code { background: transparent; color: var(--muted); }
body.depth .reader-error { border-color: #57312a; background: #211614; }

body.paper { --page: #fbf7ee; --sidebar: #f2ecdf; --surface: #fbf7ee; --surface-muted: #f7f0e3; --text: #342d25; --muted: #786b5d; --faint: #a99a88; --line: #dfd2bf; --accent: #b85c45; --teal: #547b72; --selected: #f4dfd3; --code: #f0e8d9; --shadow: 0 18px 50px rgba(94, 66, 34, .12); }
body.paper .tree-row:hover { background: rgba(255, 255, 255, .55); }
body.paper .markdown-body h1,
body.paper .markdown-body h2,
body.paper .markdown-body h3,
body.paper .markdown-body h4,
body.paper .markdown-body h5,
body.paper .markdown-body h6 { color: var(--teal); }
body.paper .markdown-body blockquote, body.paper .code-block { background: #f0e8d9; }
body.paper .markdown-body th { background: #eee3d2; }
body.paper .markdown-body code { background: #f3e9db; border-color: #ead7c3; color: var(--accent); }
body.paper .markdown-body th, body.paper .markdown-body td { border-color: #d9c9b3; }
body.paper .tool-call-heading code { background: transparent; color: var(--muted); }

.mermaid-block { margin: 0 0 16px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-muted); overflow-x: auto; }
.mermaid-block[data-zoomable="true"] { cursor: zoom-in; outline: 0; }
.mermaid-canvas { min-height: 40px; display: flex; align-items: center; justify-content: center; }
.mermaid-canvas.mermaid-loading { color: var(--muted); font-size: 13px; }
.mermaid-canvas svg { max-width: 100%; }
.mermaid-fallback-note { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.math-block { margin: 0 0 16px; padding: 12px 16px; overflow-x: auto; text-align: center; }
.math-block.math-fallback { padding: 0; text-align: left; }
.math-inline { display: inline-block; }
.math-fallback-note { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.math-inline.math-fallback { font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace; font-size: .95em; color: var(--muted); cursor: help; }

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 220px 1fr; }
  .topbar { padding: 0 20px; }
  .support-note { display: none; }
  .document { padding: 38px 22px 70px; }
  .outline-panel { top: 70px; right: 12px; left: 12px; width: auto; max-height: 55vh; }
  .reader-empty { margin-top: 11vh; padding: 0 24px 60px; }
  .tool-call-header { align-items: flex-start; }
  .tool-call-row { grid-template-columns: minmax(72px, 25%) 10px minmax(0, 1fr); }
}
