/* Import, single and batch modes share a stable horizontal toolbar. */
.editor .creation-tools{display:flex;align-items:center;gap:10px;margin-left:auto;min-width:0}
.editor .field-title:has(.prompt-tools){display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.prompt-tools{display:flex;align-items:center;gap:12px;margin-left:auto;flex-wrap:wrap}
.editor .prompt-tools .counter{margin:0}
.editor .import-storyboard{font-size:14px;font-weight:600;height:50px;min-height:42px;padding:9px 15px;color:var(--dz-accent-hover);background:var(--dz-accent-soft);border:1px solid color-mix(in srgb,var(--dz-accent) 40%,var(--dz-border));border-radius:9px;gap:7px;white-space:nowrap}
.import-storyboard svg{width:16px;height:16px}
.import-storyboard:hover{border-color:var(--dz-accent);background:var(--dz-hover)}
.editor .prompt-row{position:relative;padding:14px 16px;background:linear-gradient(180deg,var(--dz-elevated),var(--dz-surface));border-color:var(--dz-border);box-shadow:0 8px 22px color-mix(in srgb,var(--dz-text) 7%,transparent);overflow:hidden}
.editor .prompt-row .row-top{font-size:13px;margin-bottom:10px;padding-bottom:10px;gap:10px;border-bottom:1px solid color-mix(in srgb,var(--dz-border) 72%,transparent)}
.editor .shot-label-group{display:flex;align-items:center;gap:9px;min-width:0}
.editor .shot-index-badge{display:grid;place-items:center;width:30px;height:30px;flex:0 0 30px;border-radius:8px;background:var(--dz-accent);color:#fff;font-size:11px;font-weight:700;letter-spacing:.04em}
.editor .shot-label{color:var(--dz-text);font-size:14px;font-weight:700}
.editor .shot-position{font-size:11px;font-weight:500;color:var(--dz-secondary);white-space:nowrap}
.editor .prompt-row .row-top{flex-wrap:wrap}.editor .prompt-row .shot-row-actions{margin-left:auto}
.shot-label{color:var(--dz-text);font-weight:700;overflow-wrap:anywhere}
.editor .row-top button{font-size:12px;min-height:26px}
.editor .prompt-row textarea{font-size:14px;line-height:1.8;min-height:100px;color:var(--dz-text)}
.editor .prompt-row textarea[hidden]{display:none}
.editor .rich-prompt{width:100%;min-height:300px;padding:14px 12px;font-size:15px;line-height:1.9;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--dz-text);outline:none;cursor:text;border-radius:8px;background:var(--dz-surface)}
.editor .rich-prompt:focus{box-shadow:inset 0 0 0 1px var(--dz-accent);background:var(--dz-elevated);padding-inline:10px}
.editor .prompt-row>.rich-prompt{border:1px solid var(--dz-accent);padding:13px 11px;background:var(--dz-surface)}
.editor .prompt-row>.rich-prompt:focus{border-color:var(--dz-accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--dz-accent) 18%,transparent);background:var(--dz-surface);padding:13px 11px}
.editor textarea#prompt{min-height:340px}
.expired-reference{display:flex;align-items:center;justify-content:center;border:1px dashed var(--dz-border);color:var(--dz-secondary);font-size:12px}
.inline-mention{display:inline-flex;vertical-align:middle;align-items:center;gap:5px;max-width:min(100%,320px);padding:3px 7px 3px 3px;margin:0 3px;min-height:30px;border:1px solid var(--dz-border);border-radius:14px;font-size:11px;line-height:1.6;background:var(--dz-subtle);color:var(--dz-secondary);cursor:pointer;white-space:nowrap;user-select:all}
.inline-mention:focus-visible{outline:2px solid var(--dz-accent);outline-offset:2px}
.inline-mention .mention-thumb{width:22px;height:22px;display:inline-grid;place-items:center;overflow:hidden;border-radius:50%;flex:0 0 22px;background:var(--dz-subtle)}
.mention-thumb img,.mention-thumb>.art{width:100%;height:100%;object-fit:cover}.mention-thumb .art small{display:none}
.inline-mention.is-pending{border-style:dashed}.inline-mention small{font-size:10px;white-space:nowrap}
.inline-mention .inline-mention-label{border:0;background:transparent;padding:0;gap:5px;font:inherit;color:inherit;min-height:22px;min-width:0;white-space:nowrap;display:inline-flex;align-items:center}
.inline-mention .mention-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.inline-mention .mention-look{display:inline-flex;align-items:center;gap:5px;min-width:0;max-width:130px;padding:1px 5px;border:1px solid var(--dz-border);border-radius:6px;background:color-mix(in srgb,var(--dz-surface) 30%,transparent);font-size:11px;line-height:1.5}
.inline-mention .mention-look-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.inline-mention [data-inline-remove]{border:0;background:transparent;font-size:12px;line-height:1;padding:2px;color:inherit;opacity:.65;min-width:16px;min-height:22px;flex:none}
.inline-mention [data-inline-remove]:hover{opacity:1}
.mention-chevron{font-size:11px;color:inherit;opacity:.7;flex:none}
.inline-mention[data-reference-type="character"]{color:var(--dz-ref-character);background:var(--dz-ref-character-bg);border-color:color-mix(in srgb,var(--dz-ref-character) 25%,var(--dz-border))}
.inline-mention[data-reference-type="scene"]{color:var(--dz-ref-scene);background:var(--dz-ref-scene-bg);border-color:color-mix(in srgb,var(--dz-ref-scene) 25%,var(--dz-border))}
.inline-mention[data-reference-type="prop"]{color:var(--dz-ref-prop);background:var(--dz-ref-prop-bg);border-color:color-mix(in srgb,var(--dz-ref-prop) 25%,var(--dz-border))}
.shot-row-actions,.single-reference-toolbar{display:flex;align-items:center;gap:12px}
.shot-row-actions [data-add-reference],.single-reference-toolbar button{font-size:12px;color:var(--dz-accent-hover);border:0;background:transparent;padding:3px 4px}
.single-reference-toolbar{justify-content:space-between;font-size:12px;color:var(--dz-secondary);margin-top:10px}
.asset-mention .asset-mention-edit,.asset-mention [data-unlink-reference]{border:0;background:transparent;padding:0;color:inherit;min-height:22px}
.asset-mention .asset-mention-edit{display:flex;gap:6px;align-items:center;flex-wrap:wrap;font-size:12px;text-align:left}
.asset-mention [data-unlink-reference]{font-size:15px;min-width:18px}
.reference-menu{position:fixed;z-index:10020;width:min(380px,calc(100vw - 24px));max-height:calc(100dvh - 24px);overflow:auto;padding:13px;border:1px solid var(--dz-border);border-radius:10px;background:var(--dz-elevated);color:var(--dz-text);box-shadow:0 8px 32px color-mix(in srgb,var(--dz-text) 16%,transparent)}
.reference-menu[hidden]{display:none}.reference-menu-header{display:flex;align-items:center;justify-content:space-between;font-size:14px;margin-bottom:10px}
.reference-menu-header button{border:0;background:var(--dz-subtle);color:var(--dz-secondary);font-size:18px;padding:2px 8px}
.reference-menu input{width:100%;min-height:36px;border:1px solid var(--dz-border);border-radius:6px;background:var(--dz-surface);color:var(--dz-text);padding:7px 9px;font-size:13px}
.reference-menu-tabs{display:flex;gap:4px;margin:10px 0}.reference-menu-tabs button{flex:1;min-height:31px;padding:4px 7px;font-size:12px;border:1px solid transparent;background:transparent;color:var(--dz-secondary)}
.reference-menu-tabs [aria-selected=true]{background:var(--dz-accent-soft);border-color:var(--dz-border);color:var(--dz-accent-hover);font-weight:700}
#reference-menu-list{max-height:260px;overflow:auto;display:flex;flex-direction:column;gap:4px}
#reference-menu-list>button{width:100%;min-height:52px;display:flex;gap:9px;align-items:center;padding:6px 8px;border:1px solid transparent;background:transparent;color:var(--dz-text);font-size:13px;text-align:left}
#reference-menu-list>button:hover,#reference-menu-list>button:focus-visible{background:var(--dz-accent-soft);border-color:var(--dz-accent);outline:none}
#reference-menu-list small{margin-left:auto;white-space:nowrap;font-size:11px;color:var(--dz-secondary)}
.reference-menu-thumb{width:40px;height:40px;flex:0 0 40px;overflow:hidden;border-radius:5px;background:var(--dz-subtle)}
.reference-menu-thumb img,.reference-menu-thumb>.art{width:100%;height:100%;object-fit:cover}.reference-menu-thumb .art small{display:none}
.reference-menu-empty,.reference-menu-footnote{font-size:11px;line-height:1.7;color:var(--dz-secondary);margin-top:9px}
.asset-hover-card{position:fixed;z-index:10000;width:min(320px,calc(100vw - 24px));border:1px solid var(--dz-border);border-radius:10px;padding:9px;background:var(--dz-elevated);color:var(--dz-text);box-shadow:0 8px 30px color-mix(in srgb,var(--dz-text) 15%,transparent)}
.asset-hover-card[hidden]{display:none}.asset-hover-art{height:190px;overflow:hidden;border-radius:6px;background:var(--dz-subtle)}
.asset-hover-art img,.asset-hover-art>.art{width:100%;height:100%;object-fit:contain}.asset-hover-art .art svg{object-fit:contain}.asset-hover-art .art small{display:none}
.asset-hover-caption{display:flex;gap:8px;align-items:center;font-size:13px;margin-top:8px}.asset-hover-caption span{font-size:11px;color:var(--dz-accent-hover);padding:2px 6px;background:var(--dz-accent-soft);border-radius:4px}.asset-hover-caption strong{overflow-wrap:anywhere}
.shot-mentions{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px;align-items:center}
.asset-mention,.shot-mentions button.asset-mention{display:inline-flex;align-items:center;gap:7px;padding:6px 9px;border-radius:6px;border:1px solid var(--dz-border);font-size:12px;line-height:1.5;max-width:100%;text-align:left;flex-wrap:wrap;white-space:normal;overflow-wrap:anywhere}
.asset-mention b{font-weight:600}.asset-mention small{font-size:11px;font-weight:400;white-space:nowrap}
.asset-mention.matched{background:var(--dz-accent-soft);color:var(--dz-accent-hover);border-color:color-mix(in srgb,var(--dz-accent) 25%,var(--dz-border))}
.asset-mention.missing,.shot-mentions button.asset-mention.missing{background:var(--dz-subtle);color:var(--dz-text);border-style:dashed;border-color:var(--dz-secondary)}
.asset-mention.ambiguous,.shot-mentions button.asset-mention.ambiguous{background:var(--dz-elevated);color:var(--dz-accent-hover);border-color:var(--dz-accent)}
.shot-mentions button.asset-mention:hover{background:var(--dz-hover);border-color:var(--dz-accent)}
.no-mentions{font-size:12px;color:var(--dz-secondary);line-height:1.7}
.task-shot-number{display:flex;align-items:center;flex-wrap:wrap;gap:5px 10px;font-size:12px;font-weight:700;color:var(--dz-accent-hover);margin-bottom:5px;overflow-wrap:anywhere}
.task-shot-number span{font-size:10px;font-weight:400;color:var(--dz-secondary)}
#storyboard-import{width:min(1000px,calc(100% - 32px));max-width:1000px;max-height:90dvh;padding:24px;color:var(--dz-text);background:var(--dz-surface);border-color:var(--dz-border)}
#storyboard-import .dialog-head p,#storyboard-resolve .dialog-head p{font-size:13px;line-height:1.7;color:var(--dz-secondary)}
#storyboard-import textarea,#storyboard-import input:not([type=radio]),#storyboard-resolve select{width:100%;background:var(--dz-elevated);color:var(--dz-text);border:1px solid var(--dz-border);border-radius:7px;font:inherit;padding:10px}
#storyboard-import textarea{resize:vertical;line-height:1.75;font-size:14px;min-height:100px}
#storyboard-text{height:190px}
.import-source-toolbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:14px}
.import-source-toolbar button,.file-button,#link-storyboard-asset{min-height:36px;padding:7px 12px;border:1px solid var(--dz-border);border-radius:7px;background:var(--dz-elevated);color:var(--dz-text);font-size:13px;cursor:pointer;display:inline-flex;gap:7px;align-items:center}
.file-button svg{width:16px;height:16px}.file-button:hover{background:var(--dz-hover)}
.import-source-toolbar>span{font-size:12px;color:var(--dz-secondary)}
.import-source-label{display:block;font-size:13px;font-weight:600;margin-bottom:8px}
.import-tip,.import-footnote{font-size:12px;line-height:1.7;color:var(--dz-secondary);margin-top:9px}
.parse-toolbar{display:flex;align-items:center;gap:16px;flex-wrap:wrap;margin:18px 0 14px}
.parse-toolbar .primary,#confirm-storyboard{min-height:38px;font-size:13px;padding:9px 16px;flex-shrink:0}
#import-summary{font-size:13px;color:var(--dz-text);line-height:1.7}
#import-error{font-size:13px;color:var(--dz-accent-hover);font-weight:600;line-height:1.7;margin:6px 0}
#import-warnings{font-size:12px;color:var(--dz-secondary);line-height:1.7;margin:6px 0}
#import-preview{display:flex;flex-direction:column;gap:12px;max-height:420px;overflow:auto;scrollbar-gutter:stable}
.import-preview-row{display:grid;grid-template-columns:150px minmax(0,1fr);gap:10px 14px;border:1px solid var(--dz-border);padding:14px;border-radius:8px;background:var(--dz-elevated);min-width:0}
.import-preview-row label{font-size:12px;color:var(--dz-secondary);display:flex;flex-direction:column;gap:7px;min-width:0}
.import-preview-row .shot-mentions{grid-column:1/-1;margin:0}
#storyboard-import .import-preview-row input{font-size:13px;font-weight:600}
.import-policy{border:0;padding:0;margin:0;display:flex;gap:12px;flex-wrap:wrap;min-width:0;font-size:13px}
.import-policy legend{font-size:12px;color:var(--dz-secondary);margin-bottom:8px}
.import-policy label{display:flex;align-items:center;gap:6px;cursor:pointer}
.import-policy input{accent-color:var(--dz-accent)}
#confirm-storyboard:disabled,#link-storyboard-asset:disabled{opacity:.45;cursor:not-allowed}
#storyboard-resolve{max-width:580px;background:var(--dz-surface);color:var(--dz-text);border-color:var(--dz-border)}
.resolve-field{display:flex;flex-direction:column;gap:9px;font-size:13px;margin-bottom:14px}
.resolve-upload{padding-top:18px;border-top:1px solid var(--dz-border);margin-top:20px}
.resolve-upload p{font-size:12px;line-height:1.8;color:var(--dz-secondary);margin-top:9px}
.import-storyboard:focus-visible,.asset-mention:focus-visible,.file-button:focus-within{outline:2px solid var(--dz-accent);outline-offset:3px}
@media(max-width:600px){
 .editor .creation-tools{width:100%;gap:6px}
 .editor .creation-tools .creation-mode-switch{width:auto;flex:1;display:flex;padding:3px;gap:2px}
 .editor .creation-tools .creation-mode-switch button{flex:1;font-size:14px;padding:8px 5px;gap:4px;min-width:0;white-space:nowrap}
 .editor .creation-tools .creation-mode-switch button svg{width:15px;height:15px}
 .editor .creation-tools .import-storyboard{font-size:12px;padding:9px 8px;flex-shrink:0;height:50px}
 .editor .rich-prompt{min-height:220px;font-size:16px;padding-inline:0;line-height:2}.editor .rich-prompt:focus{padding-inline:5px}
 .prompt-tools{width:100%;margin-left:0;justify-content:space-between}
 .editor .prompt-row{padding:11px}.editor .prompt-row textarea{font-size:16px}
 #storyboard-import{padding:16px;width:calc(100% - 20px)}
 .import-preview-row{grid-template-columns:minmax(0,1fr);padding:11px}
 .import-preview-row .shot-mentions{grid-column:1}
 #storyboard-import .dialog-foot{align-items:stretch;flex-direction:column}
 #storyboard-import .primary{justify-content:center}
 .parse-toolbar{gap:10px}#import-summary{font-size:12px}
 .shot-mentions{gap:6px}.asset-mention,.shot-mentions button.asset-mention{padding:5px 7px;gap:5px}
}
@media(max-width:360px){
 .editor .creation-tools .creation-mode-switch button{font-size:12px;padding:8px 2px;gap:0}
 .editor .creation-tools .creation-mode-switch button svg{display:none}
 .editor .creation-tools .import-storyboard{font-size:11px;padding:8px 6px;height:44px;gap:4px}
 .editor .creation-tools .import-storyboard svg{width:14px;height:14px}
}

/* Explicit, scoped clearing controls share the prompt toolbar. */
.editor .field-title:has(.prompt-tools){flex-wrap:nowrap;gap:8px}
.editor .prompt-tools{display:flex;align-items:center;gap:6px;flex-wrap:nowrap;width:auto;margin-left:auto}
.editor .clear-prompt{padding:4px 8px;min-height:28px;font-size:12px;background:var(--dz-elevated);color:var(--dz-secondary);border-color:var(--dz-border)}
.editor .clear-prompt:hover{color:var(--dz-danger);border-color:var(--dz-danger)}
#clear-drafts-confirm{max-width:min(460px,calc(100vw - 24px))}
#clear-drafts-scope{line-height:1.8;color:var(--dz-secondary)}
@media(max-width:600px){.editor .prompt-tools>.counter{display:none}.editor .clear-prompt{font-size:11px;padding:3px 6px}.shot-row-actions{gap:4px}.shot-row-actions button{font-size:11px;padding:3px 5px}}

.editor textarea#prompt[hidden]{display:none}
.editor #single-rich-prompt{min-height:340px;border:1px solid var(--border);padding:14px;line-height:1.8;resize:vertical;overflow:auto}
.editor #single-rich-prompt:focus{padding:14px;border:1px solid var(--dz-accent);box-shadow:none}
.editor #single-rich-prompt:empty:before{content:attr(data-placeholder);color:var(--muted);pointer-events:none}

/* Optional media is a compact attachment drawer, not a second prompt/reference canvas. */
.prompt-reference-hint{font-size:11px;font-weight:400;color:var(--dz-secondary)}
.editor .compact-reference{padding:0;margin:0 0 8px;border:1px solid var(--dz-border);border-radius:8px;background:var(--dz-elevated);min-width:0;flex:none}
.editor .compact-reference>summary{list-style:none;display:flex;align-items:center;gap:8px;min-height:44px;padding:9px 12px;font-size:12px;cursor:pointer;color:var(--dz-secondary);user-select:none}
.editor .compact-reference>summary::-webkit-details-marker{display:none}
.editor .compact-reference>summary:hover{background:var(--dz-subtle);border-radius:8px}
.editor .compact-reference>summary:focus-visible{outline:2px solid var(--dz-accent);outline-offset:-2px;border-radius:8px}
.editor .compact-reference>summary>svg{width:15px;height:15px;color:var(--dz-secondary)}
.editor .compact-reference>summary>strong{font-size:12px;font-weight:600;color:var(--dz-text)}
.reference-optional{font-size:10px;padding:0 5px;border-radius:4px;background:var(--dz-subtle)}
.reference-summary-count{font-size:11px;overflow-wrap:anywhere}
.reference-alert{font-size:11px;color:var(--dz-accent-hover)}
.reference-fold-label{margin-left:auto;font-size:11px;white-space:nowrap}
.reference-fold-label:after{content:'展开 ＋'}
[open]>.reference-fold-label:after,[open]>summary>.reference-fold-label:after{content:'收起 −'}
.editor .compact-reference>.media-group,.editor .compact-reference>.compact-reference-body{border:0;border-top:1px solid var(--dz-border);border-radius:0;padding:9px 12px;min-height:0;max-height:190px;overflow-y:auto}
.editor .compact-reference .media-group-head{margin:0 0 8px;gap:8px;min-height:28px;flex-wrap:wrap}
.editor .compact-reference .reference-controls{margin-left:auto;gap:10px}
.editor .compact-reference .media-tab-strip{margin:0;gap:2px}
.editor .compact-reference .media-tab-strip button{min-width:0;min-height:28px;font-size:11px;padding:3px 8px;gap:4px}
.editor .compact-reference .reference-controls button{font-size:11px;padding:3px 0}
.editor .compact-reference .reference-tiles,.editor .compact-reference .batch-reference-tiles{display:flex;flex-wrap:nowrap;gap:8px;overflow-x:auto;padding-bottom:3px}
.editor .compact-reference .ref,.editor .compact-reference .reference-add,.editor .compact-reference .batch-reference-tile,.editor .compact-reference .batch-reference-add{width:64px;height:64px;min-height:64px;flex:0 0 64px;border-radius:6px}
.editor .compact-reference .reference-add,.editor .compact-reference .batch-reference-add{padding:5px;font-size:10px;gap:3px}
.editor .compact-reference .ref-video,.editor .compact-reference .batch-reference-tile:has(video){width:160px;flex-basis:160px;height:80px}
.editor .compact-reference .ref-audio,.editor .compact-reference .batch-reference-tile:has(audio){width:260px;flex-basis:260px}
.editor .compact-reference audio{max-width:100%;width:100%;height:32px}
.editor .compact-reference video{max-width:100%;width:100%;height:100%}
.editor .compact-reference .ref-hint,.editor .compact-reference .batch-reference-hint{font-size:10px;line-height:1.5;margin:5px 0 0;color:var(--dz-secondary)}
.editor .compact-reference-body{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px 8px}
.editor .compact-reference .batch-reference-head{grid-column:2;grid-row:1;margin:0;align-items:center}
.editor .compact-reference .batch-reference-tabs{grid-column:1;grid-row:1;margin:0;gap:2px}
.editor .compact-reference .batch-reference-tabs button{font-size:11px;padding:3px 7px;min-height:28px;gap:4px}
.editor .compact-reference .batch-reference-tiles{grid-column:1/-1;grid-row:2}
.editor .compact-reference .batch-reference-hint{grid-column:1/-1;grid-row:3}
.editor .prompt-row{display:flex;flex-direction:column}
.editor .prompt-row>.rich-prompt{flex:1;min-height:300px}
.editor .prompt-row>[data-row-reference-slot]{margin:10px 0 0;flex:none}
.editor .prompt-row>[data-row-reference-slot]>.compact-reference{margin:0}
@media(max-width:600px){
 .editor .compact-reference>summary{padding:9px;gap:5px;flex-wrap:wrap}
 .reference-summary-count{font-size:10px}
 .editor .compact-reference-body{display:flex;flex-wrap:wrap}
 .editor .compact-reference .batch-reference-head{order:2;margin-left:auto}
 .editor .compact-reference .batch-reference-tabs{order:1}
 .editor .compact-reference .batch-reference-tiles{order:3;width:100%}
 .editor .compact-reference .batch-reference-hint{order:4;width:100%}
 .prompt-reference-hint{display:none}
 .editor .shot-position{display:none}.editor .shot-index-badge{width:26px;height:26px;flex-basis:26px}.editor .prompt-row .row-top{align-items:flex-start}
}

/* Keep the secondary library shortcut in the toolbar, not in a separate row. */
.creation-tools .editor-library{width:36px;min-width:36px;height:36px;padding:0;display:inline-flex;align-items:center;justify-content:center;flex:none}

@media(max-width:600px){.creation-tools .editor-library{display:none}}

/* Disabled native buttons delegate hover/focus explanations to their wrapper. */
.import-confirm-wrap { position: relative; display: inline-flex; }
.import-confirm-wrap button:disabled { pointer-events: none; }
.import-confirm-wrap[data-reason]:not([data-reason=""]):is(:hover,:focus)::before {
  content: attr(data-reason); position: absolute; bottom: calc(100% + 10px); right: 0;
  width: min(420px, 75vw); padding: 12px 14px; border-radius: 8px;
  background: var(--text, #302b25); color: var(--surface, #fff); font-size: 13px;
  line-height: 1.6; white-space: normal; box-shadow: 0 4px 18px #0003; z-index: 30;
}
