/* A quiet editing workbench. Tokens come from the shared sage landing theme. */
:root { --editor-radius: 16px; --editor-ease: cubic-bezier(.2, .8, .2, 1); }

.run .text-button, .run .text-link, .scene-verb, .part-chip, .scene-add, .audition, .drawing-editor button,
.scene-editor button, .revision-submit { transition: background 150ms, border-color 150ms, color 150ms, transform 150ms; }
.run button:active:not(:disabled), .drawing-editor button:active:not(:disabled),
.scene-editor button:active:not(:disabled) { transform: translateY(1px); }
.run :focus-visible, .drawing-editor :focus-visible, .scene-editor :focus-visible,
.history :focus-visible { outline: 2px solid var(--sage-strong); outline-offset: 3px; }

.run .spread { gap: 20px; }
.run .script, .run .film { border-radius: 12px; }
.script-header { padding: 21px 22px 16px; font-size: 14px; }
.script-header > span:first-child { color: var(--ink); font-weight: 500; }
/* The column is a flex stack so the draft bar can stick to the viewport's
   bottom edge while the column is on screen: a tall portrait frame no longer
   pushes the one call to action out of sight. */
.run .script { display: flex; flex-direction: column; }
.run .script-header { flex: none; }
.run .script-scroll { position: relative; inset: auto; flex: 1 1 auto; min-height: 0; margin: 0 10px; padding: 0 6px; }
.run .script-footer { position: sticky; bottom: 12px; left: auto; right: auto; order: 3; flex: none; margin: 8px 16px 16px; }
.run .script-footer[hidden] { display: none; }
.run .scene, .run .scene:last-child { padding: 14px 12px; border-top: 0; margin-bottom: 6px; }
.run .scene::before { inset: 0; border-radius: 8px; }
.run .scene-heading { padding-left: 0; grid-template-columns: 32px minmax(0, 1fr) auto; column-gap: 12px; row-gap: 4px; align-items: start; }
.run .scene-number { position: static; grid-column: 1; grid-row: 1 / span 2; width: 32px; height: 32px; font-size: 12px; }
.run .scene-title { grid-column: 2; grid-row: 1; }
.run .scene-heading .status-word { grid-column: 3; grid-row: 1; margin-top: 2px; }
.run .scene-duration { display: block; grid-column: 2; grid-row: 2; margin: 0; font-size: 10px; }
.run .scene-card, .run .scene-failure, .run .scene-chips, .run .scene-extra-body { margin-left: 44px; }
.scene-title { color: var(--ink); line-height: 1.5; }
.scene-number { transition: background 180ms, color 180ms, border-color 180ms; }
.scene.is-current .scene-number { background: var(--sage); color: var(--paper); border-color: var(--sage); }
.scene-heading:hover .scene-number { border-color: var(--sage); }
.scene-heading .status-word.is-ready { color: var(--sage-strong); background: color-mix(in srgb, var(--sage) 13%, transparent); }
.script-footer { gap: 8px; }
.script-footer .text-button { border-style: dashed; border-color: var(--line-2); color: var(--ink-2); border-radius: 7px; }
.script-footer .text-button:hover { border-color: var(--sage); color: var(--ink); background: color-mix(in srgb, var(--sage) 7%, transparent); }
.under-frame { align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 12px; min-height: 60px; }
#download-final:hover { background: var(--paper-2); border-color: var(--sage); }
#frame-hint { margin: 0 auto 0 0; font-size: 11px; color: var(--ink-3); }
#frame-hint[hidden] { display: none; }
#download-final { margin-left: auto; min-height: 38px; padding: 8px 12px; font-size: 12px; text-decoration: none; }
.narration-warning { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 12px; padding: 12px; border: 1px solid var(--line-2); border-radius: 8px; }
.narration-warning[hidden] { display: none; }
.narration-warning > p:first-child { flex: 1 1 220px; margin: 0; color: var(--ink-2); font: 400 12px/1.6 var(--sans); }
.narration-warning .text-button { flex: none; font-size: 12px; }
.narration-warning .composer-error { flex-basis: 100%; margin: 0; }
.narration-warning .composer-error:empty { display: none; }

.revision-submit { border-color: var(--sage); background: var(--sage); color: var(--paper); border-radius: 8px; font: 600 13px/1.5 var(--sans); min-height: 42px; padding: 11px 16px; }
.revision-submit:hover:not(:disabled) { background: var(--sage-strong); border-color: var(--sage-strong); }
.revision-submit:disabled { opacity: .38; cursor: not-allowed; }
.video-update { border-radius: 10px; border-color: color-mix(in srgb, var(--sage) 45%, var(--line)); gap: 16px; }
.video-update::before { content: ''; width: 7px; height: 7px; flex: none; background: var(--sage); border-radius: 50%; }
.video-update p { flex: 1; }
.video-edits { margin-top: 6px; padding-block: 14px; }
.video-edits summary { width: fit-content; color: var(--ink-2); }
.video-edits summary:hover { color: var(--ink); }
.video-edits li { padding: 12px 0; }
.run > .meta { margin-top: 4px; padding-block: 0; }

/* Voice and language sit beside the status line; each opens a small panel. */
/* The entrance animation leaves a transform on the title block, so its
   pickers need a stacking order of their own to open above the frame. */
.run .title-block { position: relative; z-index: 8; }
.video-settings { display: flex; gap: 6px; align-items: center; margin-left: 4px; }
.video-settings[hidden] { display: none; }
.setting-picker { position: relative; }
.setting-picker > summary { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink-2); background: var(--paper); font: 500 12px/1.4 var(--sans); cursor: pointer; list-style: none; white-space: nowrap; }
.setting-picker > summary::-webkit-details-marker { display: none; }
.setting-picker > summary:hover, .setting-picker[open] > summary { border-color: var(--sage); color: var(--ink); }
.setting-picker.is-staged > summary { border-color: var(--sage); background: color-mix(in srgb, var(--sage) 12%, var(--paper)); color: var(--ink); }
.setting-picker.is-staged > summary::after { content: 'changed'; font: 500 10px/1 var(--sans); letter-spacing: .04em; text-transform: uppercase; color: var(--sage-strong); }
.setting-picker.is-disabled > summary { opacity: .55; cursor: not-allowed; }
.setting-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 6; width: 300px; padding: 8px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--paper); box-shadow: 0 10px 30px #00000018; }
.setting-picker[open] .setting-panel { animation: editor-reveal 160ms var(--editor-ease); }
.setting-option { display: flex; align-items: center; gap: 8px; }
.setting-option label { flex: 1; display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 40px; padding: 6px 8px; border-radius: 7px; cursor: pointer; font: 400 13px/1.4 var(--sans); color: var(--ink); }
.setting-option label:hover { background: var(--paper-2); }
.setting-option input { accent-color: var(--sage-strong); margin: 0; }
.setting-option input:disabled + .setting-name { color: var(--ink-3); }
.setting-name { font-weight: 500; }
.setting-kind { color: var(--ink-3); font-size: 11px; }
.audition { flex: none; min-width: 58px; min-height: 30px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink-2); font: 500 11px/1.4 var(--sans); cursor: pointer; }
.audition::before { content: '\25B6' / ''; font-size: 9px; margin-right: 6px; }
.audition:hover:not(:disabled) { border-color: var(--sage); color: var(--ink); }
.audition.is-playing { border-color: var(--sage); background: color-mix(in srgb, var(--sage) 12%, var(--paper)); color: var(--ink); }
.audition.is-playing::before { content: '\25A0' / ''; }
.audition:disabled { opacity: .6; cursor: progress; }
.setting-note { margin: 6px 8px 4px; color: var(--ink-3); font: 400 11px/1.55 var(--sans); }

/* The update banner: honest copy, retry only when it can work. */
.video-update-actions { display: flex; gap: 12px; align-items: center; flex: none; }
.video-update.is-failed { border-color: color-mix(in srgb, var(--oxide) 40%, var(--line)); }
.video-update.is-failed::before { background: var(--oxide); }
.video-update .text-link { font-size: 12px; }
.video-update .scene-retry[hidden], .video-update .text-link[hidden] { display: none; }

/* Rows: chips say what the draft does; the card holds the words and verbs. */
.scene-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.scene-chips:empty { display: none; }
.chip-tag { display: inline-flex; align-items: center; min-height: 20px; padding: 1px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2); font: 500 10px/1.5 var(--sans); letter-spacing: .02em; }
.chip-tag.is-edited { border-color: var(--sage); color: var(--sage-strong); background: color-mix(in srgb, var(--sage) 10%, transparent); }
.chip-tag.is-removed { border-color: color-mix(in srgb, var(--oxide) 40%, var(--line)); color: var(--oxide); }
.chip-tag.is-new { border-color: var(--sage); background: var(--sage); color: var(--paper); }
.chip-tag.is-note { color: var(--ink-3); border-style: dashed; }
.scene-chips .scene-verb { min-height: 22px; padding: 2px 8px; font-size: 11px; }
.scene.is-removed .scene-heading { opacity: .5; text-decoration: line-through; text-decoration-color: var(--ink-3); }
.scene.is-removed .scene-number { border-style: dashed; }
.scene-heading .status-word.is-unchanged { color: var(--ink-4); border-color: transparent; }
.scene-card { margin-top: 6px; }
.scene-card > summary { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 5px 0; color: var(--ink-3); font: 500 12px/1.4 var(--sans); cursor: pointer; list-style: none; }
.scene-card > summary::-webkit-details-marker { display: none; }
.scene-card > summary::before { content: '\25B8' / ''; font-size: 10px; transition: transform 150ms var(--editor-ease); }
.scene-card[open] > summary::before { transform: rotate(90deg); }
.scene-card > summary:hover { color: var(--ink); }
.scene-card[hidden] { display: none; }
.scene-card-body { padding: 6px 0 4px; }
.scene-card[open] .scene-card-body { animation: editor-reveal 160ms var(--editor-ease); }
.scene-field { display: block; margin-top: 10px; }
.scene-field-label { display: block; margin-bottom: 4px; color: var(--ink-3); font: 500 10px/1.5 var(--sans); letter-spacing: .06em; text-transform: uppercase; }
.scene-heading-input, .scene-beat-field textarea { display: block; width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper-2); color: var(--ink); font: 400 13px/1.6 var(--sans); resize: none; overflow: hidden; }
.scene-heading-input { font-weight: 500; }
.scene-beat-field textarea.beat { margin: 0; color: var(--ink); }
.scene-heading-input:focus, .scene-beat-field textarea:focus { border-color: var(--sage); outline: none; background: var(--paper); }
.scene-heading-input:disabled, .scene-beat-field textarea:disabled { opacity: .6; cursor: not-allowed; }
.scene-beat-field.is-edited .scene-field-label::after { content: ' \00B7 changed'; color: var(--sage-strong); text-transform: none; letter-spacing: 0; }
.scene-beat-field textarea.is-spoken { border-color: var(--sage); }
.scene-card.is-readonly .scene-beats .beat { margin-left: 0; }
.scene-parts { margin-top: 12px; }
.scene-parts[hidden] { display: none; }
.scene-parts-list { display: flex; flex-wrap: wrap; gap: 6px; }
.scene-parts-empty { color: var(--ink-3); font: 400 11px/1.5 var(--sans); }
.part-chip { display: inline-flex; align-items: center; max-width: 100%; min-height: 28px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink-2); font: 400 11px/1.4 var(--sans); cursor: pointer; }
.part-chip:hover:not(:disabled) { border-color: var(--sage); color: var(--ink); }
.part-chip:disabled { opacity: .5; cursor: not-allowed; }
.scene-verbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.scene-verbs:empty { display: none; }
.scene-verb { min-height: 30px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); color: var(--ink-2); font: 500 11px/1.4 var(--sans); cursor: pointer; }
.scene-verb:hover:not(:disabled) { border-color: var(--sage); color: var(--ink); background: color-mix(in srgb, var(--sage) 7%, transparent); }
.scene-verb:disabled { opacity: .45; cursor: not-allowed; }
.scene-verb.is-destructive { color: var(--oxide); }
.scene-verb.is-destructive:hover:not(:disabled) { border-color: var(--oxide); background: color-mix(in srgb, var(--oxide) 7%, transparent); }
.scene-card-note { margin: 10px 0 0; color: var(--ink-3); font: 400 11px/1.55 var(--sans); }
.scene-card-note:empty { display: none; }
.scene.is-extra .scene-heading { display: grid; cursor: default; }
.scene.is-extra .scene-number { border-style: dashed; color: var(--ink-3); }
.scene-extra-body { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.scene-extra-note { flex-basis: 100%; margin: 0; color: var(--ink-2); font: 400 12px/1.55 var(--sans); overflow-wrap: anywhere; }

/* The seam between rows: a plus that appears on hover or focus. */
.script-list .scene-gap { position: relative; height: 12px; margin: -3px 0 -3px 44px; padding: 0; list-style: none; }
.script-list .scene-gap[hidden] { display: none; }
.scene-add { position: absolute; inset: 0 auto 0 0; display: inline-flex; align-items: center; gap: 6px; height: 22px; margin: -5px 0; padding: 0 8px 0 0; border: 0; background: transparent; color: var(--sage-strong); font: 500 11px/1 var(--sans); opacity: 0; cursor: pointer; transition: opacity 150ms; }
.scene-add-mark { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--sage); border-radius: 50%; background: var(--paper); font-size: 13px; }
.scene-gap:hover .scene-add, .scene-add:focus-visible, .script.is-editing .scene-gap:last-of-type .scene-add { opacity: 1; }
.scene-add:disabled { opacity: 0 !important; pointer-events: none; }
.scene-gap::before { content: ''; position: absolute; inset: 50% 0 auto 0; border-top: 1px dashed var(--line-2); opacity: 0; transition: opacity 150ms; }
.scene-gap:hover::before { opacity: 1; }

/* The draft bar: staged changes, one review, one apply. */
.script-footer .draft-bar { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border: 1px solid var(--sage); border-radius: 9px; background: color-mix(in srgb, var(--sage) 9%, var(--paper)); }
.script-footer .draft-bar[hidden] { display: none; }
.draft-summary { flex: 1 1 140px; color: var(--ink); font: 500 12px/1.5 var(--sans); }
.draft-actions { display: flex; align-items: center; gap: 12px; }
.draft-actions .text-link { font-size: 12px; color: var(--ink-2); }
.draft-actions .revision-submit { min-height: 36px; padding: 8px 14px; font-size: 12px; }
.draft-error { flex-basis: 100%; margin: 0; color: var(--oxide); font: 400 11px/1.5 var(--sans); }
.draft-error:empty { display: none; }

/* Versions: play any, restore any but the current. */
.video-edits li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 16px; }
.video-edits li span:last-child { white-space: nowrap; font-family: var(--sans); }
.version-label { overflow-wrap: anywhere; }
.version-status { color: var(--ink-3); font-size: 11px; }
.version-status.is-current { color: var(--sage-strong); font-weight: 500; }
.version-usage { font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.version-actions { display: flex; gap: 12px; }
.version-actions .text-link { font-size: 12px; }
.version-actions .text-link:disabled { opacity: .45; cursor: not-allowed; }

/* A toast for what just happened, with one action. */
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 30; display: flex; align-items: center; gap: 16px; max-width: min(520px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 10px; background: var(--ink); color: var(--paper); font: 400 13px/1.5 var(--sans); box-shadow: 0 12px 36px #0004; transform: translateX(-50%); animation: toast-in 220ms var(--editor-ease); }
.toast[hidden] { display: none; }
.toast .text-link { color: var(--paper); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.toast .text-link[hidden] { display: none; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translateX(-50%); } }

/* The review sheet: the list, then time first, then cost, then the voice. */
.estimate-changes { margin: 18px 0 0; padding: 0 0 0 18px; color: var(--ink); font: 400 13px/1.7 var(--sans); }
.estimate-changes li + li { margin-top: 2px; }
.estimate-summary .estimate-cost { margin: 4px 0 0; color: var(--ink-2); font: 400 15px/1.5 var(--sans); }
.estimate-summary .estimate-voice { margin: 10px 0 0; color: var(--ink-3); font: 400 12px/1.5 var(--sans); }
.estimate-summary .estimate-voice:empty { display: none; }
.scene-editor-check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12px; color: var(--ink-2); }
.scene-editor-check input { accent-color: var(--sage-strong); }

/* Drawing editor: stable header, scene canvas, a grouped contextual inspector. */
.drawing-editor { width: min(1280px, calc(100vw - 48px)); max-height: calc(100dvh - 48px); padding: 0; overflow: auto; border: 1px solid var(--line-2); border-radius: var(--editor-radius); box-shadow: 0 28px 100px #0005; }
.drawing-editor::backdrop, .scene-editor::backdrop { background: #080d0bbd; backdrop-filter: blur(6px); }
.drawing-editor[open], .scene-editor[open] { animation: editor-enter 210ms var(--editor-ease); }
.drawing-editor > header { position: sticky; top: 0; z-index: 3; padding: 20px 24px; margin: 0; border-bottom: 1px solid var(--line); background: var(--paper); }
.drawing-editor h2 { margin-top: 4px; font: 450 27px/1.2 var(--serif); letter-spacing: -.015em; overflow-wrap: anywhere; }
.editor-eyebrow { font: 500 10px/1.5 var(--sans); letter-spacing: .1em; }
.drawing-editor .editor-close, .scene-editor header > button { display: grid; place-items: center; min-width: 36px; width: 36px; height: 36px; padding: 0; flex: none; border: 1px solid var(--line); border-radius: 8px; color: var(--ink-2); }
.editor-close:hover, .scene-editor header > button:hover { color: var(--ink); background: var(--paper-2); }
.drawing-editor-layout { grid-template-columns: minmax(0, 1fr) 308px; align-items: stretch; gap: 0; }
.drawing-workspace { padding: 20px 24px 24px; }
.drawing-toolbar { justify-content: space-between; gap: 12px; min-height: 34px; margin-bottom: 14px; }
#drawing-draft-status { display: inline-flex; align-items: center; gap: 8px; font: 400 12px/1.5 var(--sans); color: var(--ink-2); }
#drawing-draft-status::before { content: ''; display: block; width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--sage); }
#drawing-draft-status[data-state="loading"]::before { width: 10px; height: 10px; border: 1.5px solid var(--line-2); border-top-color: var(--sage); background: none; animation: editor-spin 700ms linear infinite; }
#drawing-draft-status[data-state="error"]::before { background: var(--oxide); }
.editor-history-buttons { display: flex; flex: none; gap: 4px; }
.editor-history-buttons .text-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 6px 9px; height: 32px; border: 1px solid transparent; border-radius: 6px; color: var(--ink-2); font-size: 11px; }
.editor-history-buttons button:hover:not(:disabled) { background: var(--paper-2); border-color: var(--line); color: var(--ink); }
.drawing-canvas { border: 1px solid var(--line); border-radius: 8px; cursor: default; box-shadow: 0 3px 15px #0000000a; }
.drawing-canvas[aria-busy="true"] { cursor: progress; }
.drawing-canvas img { transition: opacity 130ms; }
.drawing-canvas img:not([src]) { opacity: 0; }
.drawing-selection { border-color: #637853; border-radius: 3px; background: #8293750a; box-shadow: 0 0 0 1px #ffffffcc; }
.drawing-objects-heading { display: flex; justify-content: space-between; gap: 12px; margin: 20px 0 9px; color: var(--ink-3); font: 500 11px/1.5 var(--sans); }
.drawing-objects { display: flex; gap: 8px; overflow-x: auto; padding: 3px 3px 10px; margin-inline: -3px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.drawing-object-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 210px; min-height: 42px; flex: none; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink-2); background: var(--paper); font: 400 12px/1.4 var(--sans); text-align: left; }
.drawing-object-chip > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawing-object-number { display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 5px; background: var(--paper-2); color: var(--ink-3); font: 400 10px/1 var(--mono); }
.drawing-object-chip:hover { border-color: var(--sage); }
.drawing-object-chip[aria-pressed="true"] { color: var(--ink); border-color: var(--sage); background: color-mix(in srgb, var(--sage) 12%, var(--paper)); }
.drawing-object-chip[aria-pressed="true"] .drawing-object-number { background: var(--sage); color: var(--paper); }
.drawing-object-chip.is-hidden > span:last-child { text-decoration: line-through; opacity: .65; }
.canvas-help { margin: 10px 0 0; font-size: 11px; }
.keyboard-hint { color: var(--ink-3); white-space: nowrap; }
.drawing-scope-note { margin: 4px 0 0; color: var(--ink-3); font-size: 11px; }
.drawing-inspector { gap: 0; background: color-mix(in srgb, var(--paper-2) 60%, var(--paper)); border-left: 1px solid var(--line); }
.inspector-heading { padding: 20px 20px 16px; border-bottom: 1px solid var(--line); }
.drawing-inspector .inspector-heading select { color: var(--ink); margin-top: 8px; font-weight: 500; }
.inspector-section { min-width: 0; padding: 18px 20px; margin: 0; border: 0; border-bottom: 1px solid var(--line); }
.inspector-section legend { float: left; width: 100%; padding: 0; margin: 0 0 12px; font: 500 11px/1.5 var(--sans); color: var(--ink); }
.inspector-section legend + * { clear: both; }
.drawing-fields { gap: 12px; margin: 0; }
.drawing-inspector label { font-size: 11px; color: var(--ink-2); }
.drawing-inspector input:not([type=checkbox]), .drawing-inspector select, .drawing-inspector textarea { margin-top: 5px; padding: 8px 10px; font-size: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.drawing-inspector input[type=number] { font-variant-numeric: tabular-nums; }
.drawing-inspector input:focus, .drawing-inspector textarea:focus, .drawing-inspector select:focus { border-color: var(--sage); }
.drawing-inspector input:user-invalid, .drawing-inspector textarea:user-invalid { border-color: var(--oxide); }
.drawing-inspector .drawing-check { min-height: 28px; gap: 9px; }
.drawing-check input { accent-color: var(--sage-strong); width: 15px; height: 15px; }
.drawing-color { margin: 7px 0 0; justify-content: space-between; }
.drawing-color input[type=color] { width: 33px; height: 27px; padding: 2px; margin: 0; cursor: pointer; }
.drawing-color input:disabled { opacity: .35; cursor: not-allowed; }
.drawing-inspector textarea { min-height: 104px; resize: vertical; line-height: 1.65; }
.editor-character-count { display: block; min-height: 15px; margin-top: 5px; text-align: right; font: 400 10px/1.5 var(--sans); color: var(--ink-3); }
.drawing-inspector #drawing-reset { margin: 14px 20px; height: auto; min-height: 34px; padding: 7px 10px; width: fit-content; max-width: calc(100% - 40px); border: 0; border-radius: 6px; box-shadow: none; color: var(--ink-3); font-size: 11px; line-height: 20px; }
.drawing-inspector #drawing-reset:disabled { background: transparent; }
.drawing-inspector #drawing-reset:hover:not(:disabled) { color: var(--ink); }
.drawing-inspector #drawing-error { margin: 0 20px; font-size: 12px; }
.drawing-inspector #drawing-error:empty { display: none; }
.drawing-apply { position: sticky; bottom: 0; margin-top: auto; padding: 16px 20px; border-top: 1px solid var(--line); background: var(--paper-2); z-index: 2; }
.drawing-apply .revision-note { font-size: 10px; text-align: center; margin: 9px 0 0; color: var(--ink-3); line-height: 1.5; }

/* Narration, scene instructions, and review share the same modal grammar. */
.scene-editor { padding: 26px; border-radius: var(--editor-radius); border-color: var(--line-2); }
.scene-editor h2 { font-weight: 450; font-size: 28px; letter-spacing: -.015em; }
.scene-editor header { align-items: center; }
#scene-editor-note { margin: 16px 0 24px; font-size: 13px; }
#scene-editor-fields label { color: var(--ink-2); font-size: 12px; }
#scene-editor-fields textarea, #scene-editor-fields select { border-color: var(--line); border-radius: 8px; background: var(--paper-2); padding: 12px; }
.scene-editor footer { align-items: center; gap: 16px; padding-top: 20px; margin-top: 24px; border-top: 1px solid var(--line); }
.editor-shortcut { flex: 1; color: var(--ink-3); font: 400 10px/1.5 var(--sans); }
.scene-editor[data-mode="remove"] #scene-editor-save, .discard-button { color: var(--oxide); }
.scene-editor[data-mode="remove"] #scene-editor-save { background: color-mix(in srgb, var(--oxide) 10%, var(--paper)); border-color: color-mix(in srgb, var(--oxide) 30%, var(--line)); }
.edit-estimate { width: min(480px, calc(100vw - 32px)); }
#edit-estimate-scope { margin-top: 22px; font: 400 14px/1.7 var(--sans); }
.estimate-summary { background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin: 20px 0; }
.estimate-summary .estimate-price { margin: 8px 0 0; font: 450 30px/1.2 var(--serif); }
.edit-estimate .revision-note { font-size: 12px; }
.discard-edits { width: min(420px, calc(100vw - 32px)); }
.discard-edits .revision-note { margin-top: 16px; font-size: 13px; }
.discard-edits footer { justify-content: space-between; }
.discard-edits .discard-button { border: 0; padding-inline: 0; font-size: 12px; }

.history .sheet-header { border-bottom-color: var(--line); }
.history .sheet-title { font-size: 32px; letter-spacing: -.02em; }
.history .filter { border: 1px solid var(--line); border-radius: 8px; background: var(--paper-2); padding: 12px 14px; font: 400 13px/1.5 var(--sans); }
.history .sheet-filter { padding-block: 20px 10px; }
.history .history-empty { color: var(--ink-3); font: 400 14px/1.7 var(--sans); text-align: center; padding: 40px 18px; }
.history .row:hover { background: color-mix(in srgb, var(--sage) 8%, var(--paper)); }
.history .row-question { font-size: 14px; }
.history .row { border-radius: 8px; }
.row-menu-actions { border-radius: 8px; }
.row-menu-actions button { border-radius: 4px; }

@keyframes editor-enter { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes editor-reveal { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
@keyframes editor-spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
  .drawing-editor-layout { grid-template-columns: minmax(0, 1fr) 280px; }
  .drawing-workspace { padding: 16px; }
  #frame-hint { display: none; }
}
@media (max-width: 760px) {
  .drawing-editor { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); border-radius: 12px; }
  .drawing-editor > header { padding: 16px; }
  .drawing-editor h2 { font-size: 22px; }
  .drawing-editor-layout { grid-template-columns: 1fr; }
  .drawing-workspace { padding: 12px; }
  .drawing-inspector { border-left: 0; border-top: 1px solid var(--line); }
  .drawing-inspector .inspector-heading { padding: 16px; }
  .inspector-section { padding: 16px; }
  .drawing-apply { padding: 14px 16px; }
  .drawing-inspector #drawing-reset { margin-inline: 16px; }
  .drawing-toolbar { gap: 5px; }
  #drawing-draft-status { font-size: 11px; gap: 6px; }
  .editor-history-buttons .text-button { font-size: 10px; padding: 6px; gap: 4px; }
  .editor-history-buttons svg { width: 14px; }
  .drawing-objects-heading { margin-top: 14px; }
  .drawing-object-chip { max-width: 180px; }
  .keyboard-hint { display: none; }
  .canvas-help { font-size: 10px; }
  .drawing-scope-note { font-size: 10px; }
  .run .spread { gap: 14px; }
  .scene-card > summary { min-height: 36px; }
  .scene-verb { min-height: 36px; }
  .video-settings { flex-basis: 100%; }
  .video-update { gap: 10px; padding: 12px; font-size: 12px; }
  .under-frame { gap: 8px; }
  #download-final { font-size: 11px; }
  .scene-editor { padding: 20px; }
  .scene-editor h2 { font-size: 25px; }
  .scene-editor footer { flex-wrap: wrap; gap: 12px; }
  .editor-shortcut { flex-basis: 100%; }
  .edit-estimate footer { flex-wrap: nowrap; justify-content: space-between; gap: 12px; }
  .discard-edits footer { flex-wrap: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  .drawing-editor[open], .scene-editor[open], .scene-card[open] .scene-card-body,
  .setting-picker[open] .setting-panel, .toast, #drawing-draft-status::before { animation: none !important; }
}
