/* App chrome stays dark; Less document themes are isolated inside preview frames. */
html, body { height:100%; }
body { display:flex; flex-direction:column; height:100dvh; overflow:hidden; }
.app { flex:1; height:auto; min-height:0; }
.stage { overflow:hidden; }
.stage.mode-split { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
.reader-pane { padding:24px; overflow:hidden; }
#reader.reader { width:100%; height:100%; min-height:0; padding:0; background:transparent; box-shadow:none; border-radius:0; }
#reader > iframe, #visualPreview > iframe { display:block; width:100%; height:100%; border:0; border-radius:5px; background:transparent; }
.visual-pane { padding:0; overflow:hidden; }
#visual.visual { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:0; width:100%; height:100%; padding:0; margin:0; border-radius:0; box-shadow:none; }
#markdownEditor { min-width:0; height:100%; min-height:0; border:0; border-right:1px solid #393943; border-radius:0; }
#markdownEditor .vditor-toolbar, #markdownEditor .vditor-preview { display:none !important; }
#markdownEditor .vditor-content { height:100%; min-height:0; }
#markdownEditor .vditor-sv { width:100%; min-width:0; padding:28px 24px !important; overflow:auto; font-size:var(--doc-font-size) !important; }
#visualPreview { height:100%; min-height:0; min-width:0; padding:24px; background:#24242b; }
.stage[data-theme="light"] #markdownEditor .vditor-sv { background:#fcfcfc; color:#333; color-scheme:light; }
.stage[data-theme="dark"] #markdownEditor .vditor-sv { background:#262626; color:#d8d8d8; color-scheme:dark; }
.stage[data-theme="light"] .edit { background:#fcfcfc; color:#333; color-scheme:light; }
.stage[data-theme="dark"] .edit { background:#262626; color:#d8d8d8; color-scheme:dark; }
.stage[data-theme="light"] .vditor-sv__marker { color:#777; }
.stage[data-theme="dark"] .vditor-sv__marker { color:#aaa; }
.toolbar { flex-shrink:0; }
.modebar button { font-size:14px; }
.width-control { font-size:14px; }
.empty { color:#aaa; }
@media(max-width:760px) {
 .app { grid-template-columns:190px minmax(0,1fr); }
 .app.sidebar-off { grid-template-columns:0 minmax(0,1fr); }
 .stage.mode-split { display:grid; grid-template-columns:1fr; grid-template-rows:minmax(0,1fr) minmax(0,1fr); }
 .stage.mode-split .pane { height:100%; }
 #visual.visual { grid-template-columns:1fr; grid-template-rows:minmax(0,1fr) minmax(0,1fr); }
 .reader-pane, #visualPreview { padding:10px; }
 #markdownEditor { border-right:0; border-bottom:1px solid #393943; }
 .visual .vditor-content { display:block; overflow:hidden; }
 #markdownEditor .vditor-sv { height:100%; flex:none; }
}

/* Vditor highlights code with theme-specific inline backgrounds; force the app's dark palette. */
.stage[data-theme="dark"] #markdownEditor .vditor-sv pre,
.stage[data-theme="dark"] #markdownEditor .vditor-sv pre.vditor-reset,
.stage[data-theme="dark"] #markdownEditor .vditor-sv .vditor-ir__preview pre,
.stage[data-theme="dark"] #markdownEditor .vditor-sv .vditor-wysiwyg pre {
  background:#1b1b20 !important; color:#e7e5ed !important; border:1px solid #45454f !important;
}
.stage[data-theme="dark"] #markdownEditor .vditor-sv pre code,
.stage[data-theme="dark"] #markdownEditor .vditor-sv pre code span {
  background:transparent !important; color:inherit !important;
}
.stage[data-theme="dark"] #markdownEditor .vditor-sv .vditor-ir__preview,
.stage[data-theme="dark"] #markdownEditor .vditor-sv .vditor-wysiwyg {
  background:#262626 !important; color:#d8d8d8 !important;
}
.stage[data-theme="dark"] #markdownEditor .vditor-sv .vditor-ir__preview code:not(pre code),
.stage[data-theme="dark"] #markdownEditor .vditor-sv .vditor-wysiwyg code:not(pre code) {
  background:#303039 !important; color:#e7e5ed !important;
}
#connectSide { width:100%; margin:0 0 12px; padding:9px 12px; background:#373443; border-color:#5d526f; color:#eeeaf7; font-size:14px; }
#connectSide:hover { border-color:#a78bfa; }
#connectSide { display:block; }
