@font-face { font-family: 'Courier Prime'; font-style: normal; font-weight: 400; font-display: swap;
    src: url('../fonts/courier-prime-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Courier Prime'; font-style: normal; font-weight: 400; font-display: swap;
    src: url('../fonts/courier-prime-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Courier Prime'; font-style: italic; font-weight: 400; font-display: swap;
    src: url('../fonts/courier-prime-latin-ext-400-italic.woff2') format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Courier Prime'; font-style: italic; font-weight: 400; font-display: swap;
    src: url('../fonts/courier-prime-latin-400-italic.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Courier Prime'; font-style: normal; font-weight: 700; font-display: swap;
    src: url('../fonts/courier-prime-latin-ext-700-normal.woff2') format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Courier Prime'; font-style: normal; font-weight: 700; font-display: swap;
    src: url('../fonts/courier-prime-latin-700-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Courier Prime'; font-style: italic; font-weight: 700; font-display: swap;
    src: url('../fonts/courier-prime-latin-ext-700-italic.woff2') format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Courier Prime'; font-style: italic; font-weight: 700; font-display: swap;
    src: url('../fonts/courier-prime-latin-700-italic.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap;
    src: url('../fonts/inter-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap;
    src: url('../fonts/inter-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap;
    src: url('../fonts/inter-latin-ext-600-normal.woff2') format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap;
    src: url('../fonts/inter-latin-600-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

:root {
    color-scheme: dark;
    --bg-void: #0f1115;
    --bg-raised: #161a21;
    --bg-sunken: #0b0d11;
    --text-void: #a1a1aa;
    --text-strong: #f8fafc;
    --text-soft: #cbd5e1;
    --text-void-muted: #8b95a7;
    --border-void: #1e293b;
    --border-mid: #334155;
    --border-strong: #475569;
    --focus: #94a3b8;
    --btn-bg: #1e293b;
    --btn-text: #e2e8f0;
    --btn-hover: #334155;
    --btn-success: #15803d;
    --btn-primary-bg: #e2e8f0;
    --btn-primary-text: #0f1115;
    --btn-primary-hover: #ffffff;
    --danger: #b91c1c;
    --danger-soft-text: #fecaca;
    --danger-soft-border: #7f1d1d;
    --danger-soft-bg: #2a1215;
    --caret: #e4e4e7;
    --selection: rgba(148, 163, 184, 0.3);
    --overlay: rgba(15, 17, 21, 0.8);
    --overlay-strong: rgba(15, 17, 21, 0.85);
    --scrollbar: #27272a;
    --scrollbar-hover: #3f3f46;
    --accent-name: #e8cf98;
    --sh-scene: #e8cf98;
    --sh-character: #93c5fd;
    --sh-dialogue: #d4d4d8;
    --sh-parenthetical: #8b93a1;
    --sh-transition: #c4b5fd;
    --sh-section: #86cfa3;
    --sh-synopsis: #74a487;
    --sh-title: #b9b1a3;
    --sh-note: #8a95a8;
    --sh-boneyard: #5f6675;

    --bg-paper: #ffffff;
    --text-ink: #000000;
    --border-paper: #e5e7eb;

    --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
    --font-screenplay: 'Courier Prime', Courier, monospace;
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg-void: #f8fafc;
    --bg-raised: #eef2f6;
    --bg-sunken: #ffffff;
    --text-void: #334155;
    --text-strong: #0f172a;
    --text-soft: #334155;
    --text-void-muted: #556070;
    --border-void: #e2e8f0;
    --border-mid: #cbd5e1;
    --border-strong: #94a3b8;
    --focus: #475569;
    --btn-bg: #e2e8f0;
    --btn-text: #1e293b;
    --btn-hover: #cbd5e1;
    --btn-primary-bg: #1e293b;
    --btn-primary-text: #f8fafc;
    --btn-primary-hover: #0f172a;
    --danger-soft-text: #991b1b;
    --danger-soft-border: #fca5a5;
    --danger-soft-bg: #fef2f2;
    --caret: #0f172a;
    --selection: rgba(71, 85, 105, 0.22);
    --overlay: rgba(15, 23, 42, 0.45);
    --overlay-strong: rgba(15, 23, 42, 0.6);
    --scrollbar: #cbd5e1;
    --scrollbar-hover: #94a3b8;
    --accent-name: #8a4b08;
    --sh-scene: #8a4b08;
    --sh-character: #1d4ed8;
    --sh-dialogue: #1e293b;
    --sh-parenthetical: #556070;
    --sh-transition: #6d28d9;
    --sh-section: #166534;
    --sh-synopsis: #3f6f52;
    --sh-title: #6b6259;
    --sh-note: #5a6474;
    --sh-boneyard: #7d8796;
}

:root[data-theme="retro"] {
    color-scheme: dark;
    --bg-void: #000000;
    --bg-raised: #1c001c;
    --bg-sunken: #000000;
    --text-void: #55ffff;
    --text-strong: #ffffff;
    --text-soft: #55ffff;
    --text-void-muted: #00aaaa;
    --border-void: #aa00aa;
    --border-mid: #aa00aa;
    --border-strong: #ff55ff;
    --focus: #ffffff;
    --btn-bg: #1c001c;
    --btn-text: #55ffff;
    --btn-hover: #3a003a;
    --btn-success: #007a7a;
    --btn-primary-bg: #55ffff;
    --btn-primary-text: #000000;
    --btn-primary-hover: #ffffff;
    --danger: #aa00aa;
    --danger-soft-text: #ff55ff;
    --danger-soft-border: #aa00aa;
    --danger-soft-bg: #000000;
    --caret: #ffffff;
    --selection: rgba(255, 85, 255, 0.35);
    --overlay: rgba(0, 0, 0, 0.75);
    --overlay-strong: rgba(0, 0, 0, 0.85);
    --scrollbar: #aa00aa;
    --scrollbar-hover: #ff55ff;
    --accent-name: #ffffff;
    --sh-scene: #ffffff;
    --sh-character: #ff55ff;
    --sh-dialogue: #ffffff;
    --sh-parenthetical: #00aaaa;
    --sh-transition: #ffffff;
    --sh-section: #ffffff;
    --sh-synopsis: #aaaaaa;
    --sh-title: #ff55ff;
    --sh-note: #c864c8;
    --sh-boneyard: #666666;
}
:root[data-theme="retro"] * { border-radius: 0 !important; }
:root[data-theme="retro"] .modal-content { border: 4px double var(--border-strong); box-shadow: 8px 8px 0 var(--border-mid); }
:root[data-theme="retro"] .modal-header h2 { font-family: var(--font-screenplay); text-transform: uppercase; letter-spacing: 0.08em; }

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: row;
    background-color: var(--bg-void);
    font-family: var(--font-ui);
    color: var(--text-void);
    overflow: hidden;
}

@media (pointer: coarse), (max-width: 1023px) {
    body {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: var(--app-height, 100dvh);
        transform: translateY(var(--app-top, 0px));
    }

    #editor { padding-bottom: calc(1rem + 3lh); }
}

@media (pointer: coarse) {
    .btn { min-height: 44px; }

    textarea { font-size: max(16px, calc(16px * var(--editor-scale, 1))); }
}

.pane-void {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-void);
    background-color: var(--bg-void);
}

.header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-void);
}

.header h1, .header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.025em;
}

.header h1 { color: var(--text-strong); }

.header p {
    margin: 0.25rem 0 0 0;
    font-size: 0.75rem;
    color: var(--text-void-muted);
}

@media (max-width: 1279px) {
    .pane-void .header p { display: none; }
}

.btn {
    padding: 0.5rem 1rem;
    background-color: var(--btn-bg);
    color: var(--btn-text);
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    font-family: inherit;
}

.btn:hover { background-color: var(--btn-hover); }
.btn.success { background-color: var(--btn-success); color: white; }

textarea {
    flex: 1;
    width: 100%;
    padding: 1.5rem;
    background: transparent;
    border: none;
    resize: none;
    outline: none;
    color: var(--text-void);
    font-family: monospace;
    font-size: calc(0.875rem * var(--editor-scale, 1));
    line-height: 1.6em;
}

.pane-void > textarea { position: relative; z-index: 1; }
.editor-shade { position: absolute; z-index: 0; margin: 0; overflow: hidden; pointer-events: none; color: var(--text-void); }
body:not(.shaded) .editor-shade { display: none; }
.editor-shade::after { content: ''; display: block; height: 100vh; }

.editor-shade > span { display: block; }

body.shaded #editor { color: transparent; caret-color: var(--caret); }
body.shaded #editor::selection { color: transparent; background: var(--selection); }
#editor::placeholder { color: var(--text-void-muted); opacity: 1; }
.sh-scene { color: var(--sh-scene); }
.sh-character { color: var(--sh-character); }
.sh-dialogue { color: var(--sh-dialogue); }
.sh-parenthetical { color: var(--sh-parenthetical); }
.sh-transition { color: var(--sh-transition); }
.sh-section { color: var(--sh-section); }
.sh-synopsis { color: var(--sh-synopsis); }
.sh-title_page { color: var(--sh-title); }
.sh-page_break { color: var(--text-void-muted); }
.sh-note { color: var(--sh-note); }
.sh-boneyard { color: var(--sh-boneyard); }

@media (min-width: 1024px) and (max-width: 1199px) {
    .pane-void > .header > div:first-child { display: none; }
    .pane-void > .header { padding-inline: 1rem; justify-content: flex-end; }
}

button:focus-visible, a[href]:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

.button-group .gear { display: block; }
.setting { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.75rem 0; border-bottom: 1px solid var(--border-void); cursor: pointer; }
.setting input { flex: 0 0 auto; width: 1.15rem; height: 1.15rem; margin: 0.15rem 0 0; accent-color: var(--focus); cursor: pointer; }
.setting strong { color: var(--text-strong); font-weight: 600; }
.setting-note { display: block; margin-top: 0.2rem; font-size: 0.8125rem; line-height: 1.5; color: var(--text-void-muted); }
.setting-choice { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin: 0 0 0.75rem; padding: 0.5rem 0.75rem; border: 1px solid var(--border-void); border-radius: 0.375rem; }
.setting-choice legend { padding: 0 0.25rem; font-size: 0.75rem; color: var(--text-void-muted); }
.setting-choice label { display: flex; align-items: center; gap: 0.4rem; min-height: 32px; color: var(--text-strong); font-size: 0.875rem; cursor: pointer; }
.setting-choice input { accent-color: var(--focus); }
@media (pointer: coarse) { .setting-choice label { min-height: 44px; } }
.setting-group { margin: 1.25rem 0 0.25rem; font-size: 0.875rem; color: var(--text-strong); }
.setting-intro { margin: 0 0 0.75rem; }
.setting-pace { flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; cursor: default; }
.setting-pace label { cursor: pointer; }
.pace-field { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--text-strong); }
.setting .pace-input { width: 5rem; height: auto; min-height: 32px; margin: 0; padding: 0.3rem 0.5rem; border: 1px solid var(--border-void); border-radius: 0.375rem; background: var(--bg-sunken); color: var(--btn-text); font: 0.875rem var(--font-ui); cursor: text; }
.setting-pace .setting-note { flex-basis: 100%; }
@media (pointer: coarse) { .setting .pace-input { width: 5.5rem; height: auto; min-height: 44px; } }
.setting-more { margin: 0.9rem 0 0; font-size: 0.8125rem; line-height: 1.5; color: var(--text-void-muted); }
@media (pointer: coarse) { .setting input { width: 1.4rem; height: 1.4rem; } }

.file-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem; padding: 0.5rem 1.5rem; border-bottom: 1px solid var(--border-void);
    background: var(--bg-raised); color: var(--text-strong); font-size: 0.8125rem; }
.file-bar[hidden] { display: none; }
.file-bar-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.file-bar[data-kind="allow"] #fileLoadBtn, .file-bar[data-kind="allow"] #fileKeepBtn, .file-bar[data-kind="conflict"] #fileAllowBtn { display: none; }

.element-bar {
    display: flex;
    flex-shrink: 0;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    overflow-x: auto;
    border-top: 1px solid var(--border-void);
    background-color: var(--bg-void);
}
.el-btn,
.suggest-chip {
    flex: 0 0 auto;
    padding: 0.35rem 0.7rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    background: transparent;
    color: var(--text-void-muted);
    font: 500 0.75rem var(--font-ui);
    cursor: pointer;
    touch-action: manipulation;
}
.el-btn:hover,
.suggest-chip:hover { color: var(--btn-text); }
.el-btn[aria-pressed="true"] { background-color: var(--btn-bg); border-color: var(--border-void); color: var(--text-strong); }
.el-btn .short { display: none; }

.suggestions { display: flex; flex: 1 1 auto; gap: 0.25rem; min-width: 0; }
.suggestions[hidden] { display: none; }
.element-bar.suggesting .el-btn { display: none; }
.suggest-chip { min-width: 0; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-chip:first-child { background-color: var(--btn-bg); border-color: var(--border-void); color: var(--text-strong); }

.suggestions.no-tab .suggest-chip:first-child { background: transparent; border-color: transparent; color: var(--text-void-muted); }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@media (hover: hover) and (pointer: fine) {
    .suggestions:not(.no-tab) .suggest-chip:first-child::after { content: "Tab"; margin-left: 0.6em; padding: 0 0.35em; border: 1px solid var(--border-void); border-radius: 0.25rem; font-size: 0.85em; opacity: 0.7; }
}

.el-help {
    flex: 0 0 auto;
    align-self: center;
    width: 1.9rem;
    height: 1.9rem;
    margin-left: auto;
    border: 1px solid var(--border-void);
    border-radius: 50%;
    background: transparent;
    color: var(--text-void-muted);
    font: 600 0.8rem var(--font-ui);
    cursor: pointer;
}
.el-help:hover { color: var(--btn-text); }
@media (pointer: coarse) { .el-help { width: 44px; height: 44px; } }
@media (max-width: 480px) { .el-help { display: none; } }

.el-focus {
    flex-shrink: 0;
    margin-left: auto;
    padding: 0 0.6rem;
    height: 32px;
    border: 1px solid var(--border-void);
    border-radius: 0.375rem;
    background: transparent;
    color: var(--text-void-muted);
    font: 600 0.75rem var(--font-ui);
    cursor: pointer;
}
.el-focus:hover { color: var(--btn-text); }
.el-focus[aria-pressed="true"] { color: var(--text-strong); border-color: var(--border-strong); background: var(--btn-bg); }
@media (pointer: coarse) { .el-focus { height: 44px; } }
@media (max-width: 480px) { .el-focus { display: none; } }
.el-focus + .el-help { margin-left: 0.4rem; }
.pane-void { position: relative; }
.focus-veil { display: none; position: absolute; z-index: 5; pointer-events: none; background: var(--bg-void); opacity: 0.72; }
body.focus-mode .focus-veil { display: block; }

body.focus-mode #editor { padding-top: 40vh; padding-bottom: 50vh; }
@media (pointer: coarse) {
    .el-btn, .suggest-chip { min-height: 44px; font-size: 0.85rem; padding: 0 0.9rem; }
}

@media (max-width: 480px) {
    .element-bar { padding-inline: 0.5rem; gap: 0.125rem; }
    .el-btn { flex: 1 1 auto; padding-inline: 0.3rem; text-align: center; }
    .suggest-chip { flex: 1 1 0; padding-inline: 0.3rem; text-align: center; }
    .el-btn .long { display: none; }
    .el-btn .short { display: inline; }
}

.pane-canvas {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-paper);
    position: relative;
}

.pane-canvas .header {
    background-color: white;
    border-bottom: 1px solid var(--border-paper);
    z-index: 20;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.pane-canvas .header h2 { color: var(--text-ink); }
.pane-canvas .header p { color: #64748b; }

.canvas-tools { display: flex; gap: 0.4rem; align-items: center; }
.canvas-btn {
    font-family: monospace;
    font-size: 0.75rem;
    background: #f3f4f6;
    color: #4b5563;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    white-space: nowrap;
}
.canvas-btn:hover { background: #e5e7eb; color: #111827; }
.canvas-btn:focus-visible { outline: 2px solid #64748b; outline-offset: 2px; }

#render-target {
    flex: 1;
    overflow-y: auto;
    padding: 3rem clamp(1rem, 2.5vw, 4rem);
    color: var(--text-ink);
    background-color: var(--bg-paper);
    container: sheet / inline-size;
}

.screenplay-font {
    --ind-char: 22ch;
    --ind-paren: 15ch;
    --w-paren: 25ch;
    --ind-dialogue: 10ch;
    --w-dialogue: 35ch;
    --ind-transition: 0;
    --transition-align: right;

    font-family: var(--font-screenplay);
    font-size: 12pt;
    line-height: 1.1;
    width: 100%;
    max-width: 60ch;
    margin: 0 auto;
    text-align: left;
}

.script-scene-heading { text-transform: uppercase; margin: 2rem 0 1rem; }

.script-scene-num { float: right; font-weight: 400; color: #6b7280; }
.script-action { margin: 0 0 1rem; width: 100%; white-space: pre-wrap; }

.script-dialogue-block { margin: 0 0 1rem; }
.script-character { text-transform: uppercase; margin-left: var(--ind-char); }
.script-parenthetical { margin-left: var(--ind-paren); max-width: var(--w-paren); }
.script-dialogue { margin-left: var(--ind-dialogue); max-width: var(--w-dialogue); }

.script-dual {
    --ind-char: 8ch; --ind-paren: 4ch; --w-paren: none; --ind-dialogue: 0; --w-dialogue: none;
    display: flex; gap: 2ch; margin-bottom: 1rem;
}
.script-dual .script-dialogue-block { flex: 1; min-width: 0; margin: 0; }

.script-transition {
    text-transform: uppercase;
    margin: 0 0 1rem var(--ind-transition);
    text-align: var(--transition-align);
}

@container sheet (max-width: 36rem) {
    .screenplay-font {
        --ind-char: 30%;
        --ind-paren: 20%;
        --w-paren: 60%;
        --ind-dialogue: 8%;
        --w-dialogue: 84%;
        --ind-transition: 0;
        --transition-align: right;
    }

    .script-dual {
        flex-direction: column;
        gap: 1rem;
        --ind-char: 30%; --ind-paren: 20%; --w-paren: 60%; --ind-dialogue: 8%; --w-dialogue: 84%;
    }
}
@container sheet (max-width: 26rem) {
    .screenplay-font { font-size: 14px; line-height: 1.25; }
}

.script-centered { text-align: center; margin: 0 0 1rem; }
.script-lyrics { font-style: italic; margin: 0 0 1rem; }
.script-page-break { border: 0; border-top: 1px dashed #cbd5e1; margin: 1.5rem 0; }
.script-note {
    font-family: var(--font-ui); font-size: 0.75em; background: #fef9c3; color: #713f12;
    padding: 0 0.3em; border-radius: 0.2rem;
}

.script-section {
    font-family: var(--font-ui); font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.08em; color: #64748b; border-bottom: 1px solid var(--border-paper);
    margin: 1.5rem 0 0.75rem; padding-bottom: 0.25rem;
}
.script-synopsis { font-family: var(--font-ui); font-size: 0.75rem; font-style: italic; color: #6b7280; margin: 0 0 1rem; }

.script-title-page { text-align: center; padding: 4rem 0 3rem; margin-bottom: 2rem; border-bottom: 1px dashed #cbd5e1; }
.script-title-page .tp-title { text-transform: uppercase; font-weight: 700; margin-bottom: 2rem; }
.script-title-page .tp-author { margin-bottom: 2rem; }
.script-title-page .tp-meta { margin-top: 1rem; font-size: 10pt; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); }
.pane-canvas ::-webkit-scrollbar-thumb { background: #cbd5e1; }
.pane-canvas ::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--overlay);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 50;
}
.modal-overlay.active { display: flex; }
.modal-content {
    background: var(--bg-void);
    border: 1px solid var(--border-void);
    border-radius: 0.5rem;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    max-height: 85dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.modal-content.wide { max-width: 46rem; }
.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-void);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h2 { margin: 0; font-size: 1rem; color: var(--text-strong); }
.modal-close { min-width: 36px; min-height: 36px; border-radius: 0.375rem; background: transparent; color: var(--text-void-muted); border: none; cursor: pointer; font-size: 1.25rem; }
.modal-close:hover { color: var(--text-strong); }
.modal-body {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
}
.modal-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-void);
}
.btn.primary { background-color: var(--btn-primary-bg); color: var(--btn-primary-text); font-weight: 600; }
.btn.primary:hover { background-color: var(--btn-primary-hover); }
.btn.ghost { background: transparent; color: var(--text-void-muted); }
.btn.ghost:hover { color: var(--btn-text); }
.script-item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

.help-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border-void);
}
.chip {
    flex: 0 0 auto;
    padding: 0.4rem 0.8rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    background: transparent;
    color: var(--text-void-muted);
    font: 500 0.8125rem var(--font-ui);
    cursor: pointer;
}
.chip:hover { color: var(--btn-text); }
.chip[aria-pressed="true"] { background-color: var(--btn-bg); border-color: var(--border-void); color: var(--text-strong); }
.help-section h3, .tour-step h3 { margin: 1.25rem 0 0.5rem; font-size: 0.95rem; color: var(--text-strong); }
.help-section h3:first-child { margin-top: 0; }
.help-section p, .help-section li, .tour-step p, .tour-step li {
    margin: 0 0 0.6rem;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--text-void);
}
.help-section ul, .tour-step ul { margin: 0 0 0.6rem; padding-left: 1.2rem; }
.help-section a { color: var(--text-soft); }
kbd {
    padding: 0.05rem 0.4rem;
    border: 1px solid var(--border-mid);
    border-bottom-width: 2px;
    border-radius: 0.25rem;
    background: var(--bg-raised);
    color: var(--btn-text);
    font: 0.8em ui-monospace, Consolas, monospace;
    white-space: nowrap;
}
.callout {
    margin: 0.75rem 0;
    padding: 0.6rem 0.8rem;
    border-left: 3px solid var(--border-strong);
    border-radius: 0 0.375rem 0.375rem 0;
    background: var(--bg-raised);
}
.callout p { margin: 0; }
.help-table { width: 100%; border-collapse: collapse; }
.help-table th {
    padding: 0.4rem 0.6rem;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-void-muted);
}
.help-table td { padding: 0.6rem; vertical-align: top; border-top: 1px solid var(--border-void); font-size: 0.8125rem; line-height: 1.5; }
.help-table td:first-child { width: 22%; color: var(--text-strong); font-weight: 600; }
.help-table code, .sample {
    display: block;
    padding: 0.5rem 0.65rem;
    border-radius: 0.375rem;
    background: var(--bg-sunken);
    color: var(--text-soft);
    font: 0.8125rem/1.5 ui-monospace, Consolas, monospace;
    white-space: pre-wrap;
    overflow-x: auto;
}
code.inline, .help-table code.inline {
    display: inline;
    padding: 0.05rem 0.35rem;
    border-radius: 0.25rem;
    background: var(--bg-sunken);
    color: var(--text-soft);
    font: 0.85em ui-monospace, Consolas, monospace;
    white-space: normal;
}
.help-thanks { margin: 0.5rem 0 0; font-size: 0.75rem; color: var(--text-void-muted); }
.help-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }

.tour-step[hidden], .help-section[hidden] { display: none; }
.tour-step h3 { margin-top: 0.25rem; font-size: 1.2rem; }
.tour-dots { display: flex; gap: 0.4rem; }
.tour-dots span { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--border-mid); }
.tour-dots span[aria-current="step"] { background: var(--btn-text); }
.sample-io { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin: 0.75rem 0; }
.sample-io h4 { margin: 0 0 0.3rem; font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-void-muted); }
.sample-io .sample { margin: 0; min-height: 11rem; }
.sample-sheet { container: sheet / inline-size; min-height: 11rem; padding: 0.75rem; border-radius: 0.375rem; background: #fff; color: #000; overflow: hidden; }
.sample-sheet .screenplay-font { font-size: 10px; line-height: 1.25; }
.hint-touch { display: none; }

@media (pointer: coarse) {
    .hint-touch { display: revert; }
    .hint-keys { display: none; }
}
@media (max-width: 560px) {
    .sample-io { grid-template-columns: 1fr; }
    .sample-io .sample, .sample-sheet { min-height: 0; }
    .help-table thead { display: none; }
    .help-table tr { display: block; padding: 0.5rem 0; border-top: 1px solid var(--border-void); }
    .help-table td { display: block; width: auto !important; padding: 0.15rem 0.2rem; border: 0; }
}

.library-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-void); }
.library-search {
    flex: 1 1 12rem;
    min-width: 0;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-void);
    border-radius: 0.375rem;
    background: var(--bg-sunken);
    color: var(--btn-text);
    font: 0.875rem var(--font-ui);
}
.library-search:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.library-views { display: flex; gap: 0.25rem; }
.script-item { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-void); }
.script-item:last-child { border-bottom: none; }
.script-open {
    display: block;
    width: 100%;
    padding: 0.25rem 0.5rem;
    margin: 0 -0.5rem;
    box-sizing: content-box;
    border: 0;
    border-radius: 0.375rem;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.script-open:hover { background: var(--border-void); }
.script-open:focus-visible, .mini:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.script-title { font-weight: 600; color: var(--text-strong); margin-bottom: 0.15rem; overflow-wrap: anywhere; }
.script-preview { font-size: 0.75rem; color: var(--text-void-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.script-meta { margin-top: 0.15rem; font-size: 0.7rem; color: var(--text-void-muted); }
.script-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
.mini {
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--border-void);
    border-radius: 0.375rem;
    background: transparent;
    color: var(--text-void-muted);
    font: 500 0.75rem var(--font-ui);
    cursor: pointer;
}
.mini:hover { color: var(--btn-text); background: var(--btn-bg); }
.mini.danger:hover { color: var(--danger-soft-text); border-color: var(--danger-soft-border); background: var(--danger-soft-bg); }
.mini.armed { color: #fff; border-color: var(--danger); background: var(--danger); }
@media (pointer: coarse) { .mini { min-height: 44px; padding-inline: 0.9rem; font-size: 0.85rem; } }
.rename-form { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.rename-form input {
    flex: 1 1 10rem;
    min-width: 0;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--border-strong);
    border-radius: 0.375rem;
    background: var(--bg-sunken);
    color: var(--text-strong);
    font: 0.9375rem var(--font-ui);
}
.rename-form input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.rename-form input[aria-invalid="true"] { border-color: var(--danger); }

.versions-top { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-void); }
.versions-for { margin: 0 0 0.5rem; color: var(--text-strong); font-weight: 600; overflow-wrap: anywhere; }
.version-item { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-void); }
.version-when { font-weight: 600; color: var(--text-strong); }
.version-name { margin-top: 0.1rem; color: var(--accent-name); overflow-wrap: anywhere; }
.version-note { margin-top: 0.1rem; font-size: 0.8125rem; color: var(--text-void-muted); }
.versions-note { padding-inline: 0; }

.compare-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 0.75rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-void); }
.compare-summary { margin: 0; flex: 1 1 16rem; font-size: 0.8125rem; color: var(--text-strong); }
.compare-item { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-void); }
.compare-heading { margin: 0; font: 600 0.875rem var(--font-screenplay); color: var(--text-strong); overflow-wrap: anywhere; }
.compare-status { margin: 0.1rem 0 0.5rem; font-size: 0.75rem; color: var(--text-void-muted); }
.compare-lines { margin: 0 0 0.5rem; padding: 0.4rem 0.6rem; border: 1px solid var(--border-void); background: var(--bg-sunken);
    font: 0.8125rem/1.5 var(--font-screenplay); color: var(--text-void); overflow-wrap: anywhere; }
.compare-line { display: block; white-space: pre-wrap; text-decoration: none; }
.compare-sign { display: inline-block; width: 1.25em; }
del.compare-line { color: var(--danger-soft-text); text-decoration: line-through; }
ins.compare-line { color: var(--sh-section); text-decoration: underline; text-underline-offset: 0.2em; }
.compare-line .compare-sign { text-decoration: none; }
.compare-fold { color: var(--text-void-muted); font-family: var(--font-ui); font-size: 0.75rem; }
.compare-more { margin: 0.25rem 0 0; font: 0.75rem var(--font-ui); color: var(--text-void-muted); }
#versions-status:empty { display: none; }
#versions-status { padding: 0.6rem 1rem; border-top: 1px solid var(--border-void); background: var(--bg-raised); font-size: 0.8125rem; color: var(--btn-text); }
.library-note { margin: 0; padding: 0.75rem 1rem; font-size: 0.8125rem; line-height: 1.5; color: var(--text-void-muted); }
.library-note .mini { margin-left: 0.5rem; }
#library-keep { border-top: 1px solid var(--border-void); }
.library-toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--border-void);
    background: var(--bg-raised);
    font-size: 0.8125rem;
    color: var(--btn-text);
}
.library-toast span { flex: 1; overflow-wrap: anywhere; }
#library-status:empty { display: none; }
.button-group { display: flex; gap: 0.5rem; }

.button-group .txt-long { display: none; }
.button-group .help-btn { padding-inline: 0.75rem; }
@media (max-width: 699px) {
    .button-group .txt-long { display: inline; }
    .button-group .txt-short { display: none; }
}

.mobile-bar { display: none; }

@media (max-width: 1023px), (pointer: coarse) and (max-height: 500px) {
    body {
        --bar-h: 52px;
        flex-direction: column;
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    }
    body.kb-open { padding-bottom: 0; }

    .mobile-bar {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex: 0 0 var(--bar-h);
        height: var(--bar-h);
        padding: 0 0.75rem;
        border-bottom: 1px solid var(--border-void);
        background-color: var(--bg-void);
    }
    .seg {
        flex: 1;
        display: flex;
        gap: 3px;
        padding: 3px;
        background-color: var(--btn-bg);
        border-radius: 0.5rem;
    }
    .seg button {
        flex: 1;
        min-height: 40px;
        border: none;
        border-radius: 0.375rem;
        background: transparent;
        color: var(--text-void-muted);
        font: 600 0.9rem var(--font-ui);
        cursor: pointer;
    }
    .seg button[aria-pressed="true"] { background-color: var(--btn-hover); color: var(--text-strong); }
    .menu-btn { width: 44px; height: 44px; padding: 0; display: grid; place-items: center; }

    .pane-void, .pane-canvas { flex: 1; height: auto; min-height: 0; border: 0; }
    .pane-canvas { display: none; }
    body[data-view="preview"] .pane-canvas { display: flex; }

    body[data-view="preview"] .pane-void { display: contents; }
    body[data-view="preview"] .pane-void textarea,
    body[data-view="preview"] .editor-shade,
    body[data-view="preview"] .element-bar,
    body[data-view="preview"] .focus-veil { display: none; }

    .pane-canvas > .header { padding: 0.35rem 1rem; justify-content: flex-end; }
    .pane-canvas > .header > div:first-child { display: none; }
    .pane-canvas > .header .canvas-tools { display: flex; gap: 0.4rem; align-items: center; }
.canvas-btn { min-height: 36px; }

    .pane-void > .header { display: contents; }
    .pane-void > .header > div:first-child { display: none; }
    .pane-void > .header .button-group {
        display: none;
        position: fixed;
        z-index: 40;
        top: calc(var(--bar-h) + env(safe-area-inset-top));
        right: calc(0.75rem + env(safe-area-inset-right));
        flex-direction: column;
        min-width: 11rem;
        padding: 0.25rem;
        background-color: var(--bg-void);
        border: 1px solid var(--border-void);
        border-radius: 0.5rem;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    }
    body.menu-open .pane-void > .header .button-group { display: flex; }
    .button-group .btn { min-height: 44px; text-align: left; }

    textarea { padding: 1rem; font-size: max(16px, calc(16px * var(--editor-scale, 1))); }

    #render-target { padding: 1rem; overscroll-behavior: contain; -webkit-tap-highlight-color: transparent; }

    .modal-close { min-width: 44px; min-height: 44px; }
    .panes-switch { display: none; }
}

@media (min-width: 700px) and (max-width: 1023px), (min-width: 700px) and (pointer: coarse) and (max-height: 500px) {
    .menu-btn { display: none; }
    .seg { flex: 0 1 16rem; }
    .mobile-bar { padding: 0 1rem; }
    .pane-void > .header .button-group {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        top: env(safe-area-inset-top);
        right: calc(1rem + env(safe-area-inset-right));
        height: var(--bar-h);
        min-width: 0;
        padding: 0;
        background: none;
        border: 0;
        box-shadow: none;
    }
    .button-group .btn { min-height: 40px; padding: 0 0.75rem; text-align: center; }

    textarea { padding-inline: max(1.5rem, calc((100vw - 44rem) / 2)); padding-block: 1.5rem; }
    #render-target { padding: 2rem; }
}

@media (min-width: 700px) and (max-width: 799px) {
    .seg { flex-basis: 14rem; }
}

.drop-hint {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--overlay-strong);
    border: 3px dashed var(--focus);
    color: var(--text-strong);
    font: 600 1.25rem var(--font-ui);
    pointer-events: none;
}
.drop-hint[hidden] { display: none; }
.notice {
    position: fixed;
    left: 50%;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 60;
    width: max-content;
    max-width: calc(100vw - 2rem);
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-void);
    border-radius: 0.5rem;
    background: var(--bg-raised);
    color: var(--btn-text);
    font: 0.875rem/1.5 var(--font-ui);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
    overflow-wrap: anywhere;
}
.notice.error { border-color: var(--danger); }
.notice:empty { display: none; }

.export-option + .export-option { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border-void); }
.export-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.export-option h3 { margin: 0 0 0.35rem; font-size: 0.875rem; color: var(--text-strong); }
.export-option p { margin: 0 0 0.75rem; font-size: 0.8125rem; color: var(--text-void-muted); }
.print-summary { color: var(--text-strong) !important; }
.chapters-list { margin: 0 0 0.75rem; padding: 0.5rem 0.75rem; max-height: 12rem; overflow: auto; border: 1px solid var(--border-void); border-radius: 0.375rem; background: var(--bg-sunken); color: var(--text-strong); font: 0.8125rem/1.6 var(--font-ui); font-variant-numeric: tabular-nums; white-space: pre-wrap; overflow-wrap: anywhere; }
.chapters-warn { margin: 0 0 0.75rem; padding-left: 1.1rem; font-size: 0.8125rem; color: var(--text-strong); }
.paper-choice { display: flex; gap: 1.25rem; margin: 0 0 0.75rem; padding: 0.5rem 0.75rem; border: 1px solid var(--border-void); border-radius: 0.375rem; }
.paper-choice legend { padding: 0 0.25rem; font-size: 0.75rem; color: var(--text-void-muted); }
.paper-choice label { display: flex; align-items: center; gap: 0.4rem; min-height: 32px; cursor: pointer; }


#print-root { display: none; }
.print-page {
    position: relative;
    overflow: hidden;
    background: #fff;
    color: #000;
    font-family: var(--font-screenplay);
    font-size: 12pt;
    line-height: 12pt;
    break-after: page;
}
.print-page:last-child { break-after: auto; }

.print-page.letter { width: 8.5in; height: 10.99in; }
.print-page.a4 { width: 210mm; height: 296.8mm; }
.print-line { position: absolute; height: 12pt; white-space: pre; }
.print-line .pr-b { font-weight: 700; }
.print-line .pr-i { font-style: italic; }
.print-line .pr-u { text-decoration: underline; }

@media print {
    html, body {
        display: block !important; position: static !important; height: auto !important; width: auto !important;
        overflow: visible !important; background: #fff !important; margin: 0 !important; padding: 0 !important;
    }
    body > :not(#print-root) { display: none !important; }
    #print-root { display: block; }
}

.panes-switch { display: inline-flex; gap: 2px; padding: 2px; border-radius: 0.3rem; background: #f3f4f6; border: 1px solid #e5e7eb; }
.panes-switch button { display: grid; place-items: center; width: 26px; height: 22px; padding: 0; border: 0; border-radius: 0.2rem; background: transparent; color: #4b5563; cursor: pointer; }
.panes-switch button:hover { background: #e5e7eb; color: #111827; }
.panes-switch button[aria-pressed="true"] { background: #1f2937; color: #ffffff; }

.button-group .panes-switch { align-self: center; background: var(--btn-bg); border-color: var(--border-void); }
.button-group .panes-switch button { width: 30px; height: 28px; color: var(--btn-text); }
.button-group .panes-switch button:hover { background: var(--btn-hover); color: var(--text-strong); }
.button-group .panes-switch button[aria-pressed="true"] { background: var(--btn-hover); color: var(--text-strong); box-shadow: inset 0 0 0 1px var(--focus); }
body[data-panes="write"] .pane-canvas { display: none; }
body[data-panes="write"] .pane-void { border-right: 0; }
body[data-panes="write"] #editor { padding-inline: max(1.5rem, calc((100% - 44rem) / 2)); }

body[data-panes="preview"] { flex-direction: column; }
body[data-panes="preview"] .pane-void { flex: none; border-right: 0; }
body[data-panes="preview"] .pane-void > :not(.header):not(.file-bar) { display: none; }
body[data-panes="preview"] .pane-void > .header > div:first-child { display: block; }

body[data-panes="preview"] .pane-canvas { flex: 1; min-height: 0; }

#render-target { position: relative; }
.quick-edit { position: absolute; z-index: 5; box-sizing: border-box; padding: 0.4rem 0.5rem; background: #fffbe6; border: 1px solid #1f2937; border-radius: 0.3rem; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25); }
.quick-edit-field { display: block; flex: none; width: 100%; box-sizing: border-box; min-height: 2.6em; padding: 0.2rem; border: 0; background: transparent; color: #000000; font: 12pt/1.35 var(--font-screenplay); resize: none; outline: none; overflow: hidden; }
.quick-edit-hint { margin: 0.3rem 0 0; font: 0.75rem/1.3 var(--font-ui); color: #374151; }

body.quick-applying #editor { display: block !important; position: fixed !important; left: -10000px !important; top: 0 !important; width: 20rem !important; height: 6rem !important; }

#sheets { display: none; }
#render-target.pages { background-color: #d4d4d8; }
#render-target.pages #page { display: none; }
#render-target.pages #sheets { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; }
#sheets .print-page { flex: none; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3); }
.canvas-btn[aria-pressed="true"] { background: #1f2937; border-color: #1f2937; color: #ffffff; }

.stats-for { margin: 0 0 0.75rem; color: var(--text-strong); font-weight: 600; }

.stats-tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.5rem; margin: 0 0 1rem; }
.stats-tiles > div { grid-column: span 2; border: 1px solid var(--border-void); border-radius: 0.375rem; padding: 0.5rem 0.6rem; }
.stats-tiles > div:nth-child(n+4) { grid-column: span 3; }
.stats-tiles dt { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-void-muted); }
.stats-tiles dd { margin: 0.15rem 0 0; font-size: 1.25rem; font-weight: 600; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.stats-heading { margin: 0 0 0.4rem; font-size: 0.875rem; color: var(--text-strong); }
.stats-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.stats-table th, .stats-table td { padding: 0.3rem 0.4rem; border-bottom: 1px solid var(--border-void); text-align: right; }
.stats-table th:first-child, .stats-table td:first-child { text-align: left; overflow-wrap: anywhere; }
.stats-table thead th { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-void-muted); font-weight: 600; }
.stats-table tbody th { font-weight: 400; color: var(--text-strong); }
.stats-table + .stats-heading, .stats-mix + .stats-heading { margin-top: 1rem; }
.stats-mix { margin: 0 0 0.25rem; font-size: 0.8125rem; color: var(--text-strong); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stats-mix:empty { display: none; }
.stats-jump {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text-strong);
    font: inherit;
    text-align: left;
    cursor: pointer;
    overflow-wrap: anywhere;
}
.stats-jump:hover { text-decoration: underline; }
.stats-jump:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.stats-num { margin-right: 0.5em; color: var(--text-void-muted); }
.stats-who { margin-top: 0.1rem; font-size: 0.75rem; color: var(--text-void-muted); overflow-wrap: anywhere; }
.stats-scenes tbody th { vertical-align: top; }
.stats-note { margin: 0.75rem 0 0; font-size: 0.75rem; color: var(--text-void-muted); }
.modal-footer .hint-keys { font-size: 0.75rem; color: var(--text-void-muted); }
@media (max-width: 480px) { .stats-tiles { grid-template-columns: repeat(2, 1fr); } .stats-tiles > div, .stats-tiles > div:nth-child(n+4) { grid-column: auto; } .stats-tiles > div:last-child { grid-column: 1 / -1; } }

.outline-list { display: flex; flex-direction: column; gap: 1px; padding: 0.5rem; }
.outline-item {
    display: grid; grid-template-columns: auto 1fr auto; column-gap: 0.6rem; align-items: baseline;
    width: 100%; padding: 0.45rem 0.6rem 0.45rem calc(0.6rem + var(--level, 0) * 1rem);
    border: 0; border-left: 3px solid transparent; border-radius: 0.25rem;
    background: transparent; color: var(--btn-text); font: 0.8125rem/1.35 var(--font-ui); text-align: left; cursor: pointer;
}
.outline-item:hover { background: var(--bg-raised); }
.outline-item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.outline-item[aria-current] { border-left-color: var(--focus); background: var(--bg-raised); }
.outline-item.section { font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.72rem; color: var(--text-soft); }
.outline-item.scene .ol-text { font-family: var(--font-screenplay); color: var(--text-strong); }
.outline-item .ol-num, .outline-item .ol-page { font-size: 0.7rem; color: var(--text-void-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.outline-item .ol-text { overflow-wrap: anywhere; }
.outline-item .ol-synopsis { grid-column: 2 / 4; font-style: italic; font-weight: 400; text-transform: none; letter-spacing: normal; color: var(--text-void-muted); font-size: 0.75rem; }
