body.workbench #editor-dialog{width:min(1160px,calc(100vw - 40px));padding:20px;max-height:92dvh}
.source-editor-header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.source-editor-header h2{margin:0;font-size:18px;font-weight:550}.source-editor-header small{display:block;margin-top:3px;font-size:11px;color:var(--muted)}
.source-editor-actions,.source-mode-tabs,.source-tools{display:flex;align-items:center;gap:7px;flex-wrap:wrap}
.source-mode-tabs button,.source-tools button{font-size:12px;border:1px solid var(--line);border-radius:6px;padding:6px 10px;min-height:36px;color:var(--muted);background:var(--surface)}
.source-mode-tabs button[aria-pressed=true]{color:var(--accent);background:var(--accent-soft);border-color:var(--accent)}
.source-tools{margin:10px 0}.syntax-tip{font-size:11px;color:var(--muted);margin-left:auto}
.source-panes{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px}
.source-input-pane,.source-preview-pane{min-width:0}.source-pane-heading{font-size:11px;color:var(--muted);margin-bottom:6px;display:flex;justify-content:space-between}
#source-editor{display:block;width:100%;height:min(55dvh,540px);min-height:240px;resize:vertical;border:1px solid var(--line);border-radius:8px;background:var(--bg);color:var(--ink);padding:14px;font:14px/1.8 ui-monospace,"SFMono-Regular","Hiragino Sans",monospace;tab-size:2}
.source-preview{height:min(55dvh,540px);min-height:240px;overflow:auto;padding:12px 16px;border:1px solid var(--line);border-radius:8px;background:var(--surface)}
.source-preview h3{margin:16px 0 10px;color:var(--accent);font-size:14px;font-weight:500}.source-preview h3:first-child{margin-top:0}
.preview-phrase{padding:7px 0;border-bottom:1px solid var(--line)}.preview-situation{font-size:11px;color:var(--muted)}.source-preview .jp{font-size:18px;line-height:1.75;margin:3px 0}.source-preview rt{font-size:10px;color:var(--muted)}.preview-meaning{font-size:11px;color:var(--muted);margin-top:4px}
.source-errors{color:#a8432e;font-size:12px;line-height:1.6;margin-top:8px}.source-errors:empty{display:none}
.source-editor-footer{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:12px;padding-top:12px;border-top:1px solid var(--line);flex-wrap:wrap}.source-status{font-size:11px;color:var(--muted)}
#editor-dialog[data-mode=text] .source-preview-pane{display:none}#editor-dialog[data-mode=preview] .source-input-pane{display:none}#editor-dialog[data-mode=text] .source-panes,#editor-dialog[data-mode=preview] .source-panes{grid-template-columns:1fr}
#customize-dialog{position:fixed;inset:70px 15px auto auto;margin:0;padding:19px;width:min(365px,calc(100vw - 24px));max-height:calc(100dvh - 90px);border:1px solid var(--line);border-radius:12px;box-shadow:0 10px 50px #26304330;background:var(--surface);color:var(--ink);z-index:60;overflow:auto}
.customize-head{display:flex;justify-content:space-between;align-items:center;position:sticky;top:-19px;padding:10px 0;background:var(--surface);z-index:1}.customize-head h2{font-size:17px;font-weight:550;margin:0}
.customize-note{color:var(--muted);font-size:11px;margin:0 0 14px;line-height:1.7}.settings-group{padding:12px 0;border-top:1px solid var(--line)}.settings-group h3{font-size:11px;color:var(--accent);font-weight:500;margin:0 0 11px;letter-spacing:.08em}
.setting-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:10px 0;font-size:12px}.setting-row>span{min-width:80px;color:var(--ink)}.setting-row input[type=range]{flex:1;min-width:60px;width:130px;accent-color:var(--accent);padding:0;border:0;background:transparent}.setting-row output{min-width:44px;text-align:right;color:var(--muted);font-size:11px;font-variant-numeric:tabular-nums}
.setting-row select{background:var(--bg);color:var(--ink);border:1px solid var(--line);border-radius:6px;padding:7px 8px;font-size:12px;max-width:190px}
.setting-row input[type=color]{width:46px;height:32px;padding:2px;border:1px solid var(--line);border-radius:4px;background:transparent;cursor:pointer}.setting-row input[type=checkbox]{width:17px;height:17px;accent-color:var(--accent)}.check-grid{display:grid;grid-template-columns:1fr 1fr;gap:5px 12px}.check-grid label{display:flex;align-items:center;gap:7px;margin:5px 0;font-size:12px;color:var(--ink)}
.settings-footer{padding-top:13px;border-top:1px solid var(--line);display:flex;justify-content:space-between;gap:10px}.settings-footer button{font-size:11px}
.pref-info{font-size:11px;color:var(--muted);margin:12px 0 0;line-height:1.6}
.preview-comparison-note{font-size:11px;color:var(--muted)}
body.workbench .jp{font-family:var(--jp-font,var(--sans));font-weight:var(--jp-weight,400)}
body.workbench.focus-mode .jp{font-size:var(--jp-size)}
body.workbench .document-meta .saved-state{display:inline}
body.workbench.hide-outline .workspace{grid-template-columns:minmax(0,1fr)}
body.workbench.hide-outline .outline{display:none}
body.workbench.hide-sidebar .sidebar{display:none}
body.workbench.hide-sidebar .app-shell{grid-template-columns:1fr}
body.workbench.hide-sidebar .menu-toggle{display:none}
body.workbench.hide-situations .situation{display:none}
body.workbench.hide-dividers .phrase-row{border-bottom:0}
body.workbench.show-description .document-description{display:block}
body.workbench:not(.show-description) .document-description{display:none}
body.workbench.show-tags .term-tags{display:flex}
body.workbench:not(.show-tags) .term-tags{display:none}
body.workbench.show-translation .meaning{display:block}
body.workbench:not(.show-translation) .meaning{display:none}
body.workbench.hide-situations[data-layout=compact] .phrase-row{grid-template-columns:30px minmax(0,1fr)}
body.workbench .code-phrase .jp{font-family:ui-monospace,monospace;font-size:14px;white-space:pre-wrap}
@media(max-width:800px){.source-panes{grid-template-columns:1fr}.source-preview-pane{display:none}#editor-dialog[data-mode=preview] .source-preview-pane{display:block}#editor-dialog[data-mode=preview] .source-input-pane{display:none}#source-editor,.source-preview{height:50dvh}.syntax-tip{margin-left:0}body.workbench #editor-dialog{width:calc(100vw - 20px);padding:15px}.source-editor-header h2{font-size:16px}.source-editor-header small{font-size:10px}}
@media(max-width:550px){#customize-dialog{inset:65px 10px auto auto;width:calc(100vw - 20px);max-height:calc(100dvh - 80px)}.source-editor-actions .quiet-btn{font-size:11px;min-height:36px}.source-tools button,.source-mode-tabs button{min-height:40px}#source-editor{font-size:16px;padding:11px}.source-editor-footer{gap:8px}.source-input-pane .source-pane-heading{font-size:11px}}

/* Density and visibility remain adjustable even at small font sizes. */
body.workbench .workspace,body.workbench.focus-mode .workspace{padding-inline:var(--content-padding,18px)}
body.workbench .phrase-row{min-height:0;grid-template-columns:var(--scene-width,110px) minmax(0,1fr)}
body.workbench .section-heading{padding-top:var(--section-gap,12px)}
body.workbench .document-section:first-child .section-heading{padding-top:min(var(--section-gap,12px),8px)}
body.workbench.hide-title .document-head{display:none}
body.workbench.hide-favorites .phrase-actions{display:none}
body.workbench.hide-favorites .phrase-header{display:block}
body.workbench.hide-favorites.hide-situations[data-layout=compact] .phrase-row{display:block}
body.workbench.hide-favorites[data-layout=script] .jp,body.workbench.hide-favorites[data-layout=columns] .jp,body.workbench.hide-favorites[data-layout=script] .phrase-header,body.workbench.hide-favorites[data-layout=columns] .phrase-header{padding-inline-end:0}
body.workbench.hide-outline .mobile-outline{display:none}
body.workbench.hide-ruby rt{display:none}

.workbench .style-links button{padding:4px 9px;border-radius:5px;font-size:10px;color:var(--muted);white-space:nowrap;min-height:28px}
.workbench .style-links button.active{background:var(--accent-soft);color:var(--accent);font-weight:600}
#sync-banner{padding:10px 18px;background:#fff6dc;border-bottom:1px solid #ead69f;color:#5f4b22;font-size:12px;display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
#sync-banner button{font-size:11px;background:#fffdf7;border:1px solid #ead69f;border-radius:5px;padding:5px 9px;min-height:32px;margin-left:5px}
#editor-page-choose{display:flex;align-items:center;gap:12px;font-size:12px;margin:12px 0;color:var(--muted)}
#editor-page-select{border:1px solid var(--line);padding:6px;max-width:65%;color:var(--ink);background:var(--surface);border-radius:5px}
@media(max-width:550px){.workbench .style-links button{padding-inline:5px;font-size:9px}.workbench .preview-bar{padding-inline:8px;gap:4px}.workbench .breadcrumb{gap:4px}.workbench .top-actions{gap:3px}.workbench .quiet-btn,.workbench .focus-btn{padding-inline:6px}}
