/* Asset workspace: preview -> horizontal library -> prompt. Details scroll separately. */
:root{--storai-prompt-surface:#fff;--storai-library-surface:#f2f3f5;--storai-detail-surface:#fff;--asset-line:#dce0e5;--asset-ink:#343a43;--asset-muted:#737c89;--asset-selected:#6f89ad;}
html.dark-mode{--storai-prompt-surface:#25272b;--storai-library-surface:#1c1e22;--storai-detail-surface:#24262a;--asset-line:#41464f;--asset-ink:#e1e6ed;--asset-muted:#a4adbb;--asset-selected:#a2b8d7;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-detail-dialog{width:920px;max-width:calc(100vw - 32px);height:min(620px,88dvh);max-height:90dvh;padding:0;display:flex;flex-direction:column;overflow:hidden;border-radius:12px;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-detail-body{flex:1 1 0;display:grid;grid-template-columns:minmax(0,1.6fr) minmax(250px,1fr);gap:0;padding:0;min-height:0;height:100%;overflow:hidden!important;background:var(--storai-library-surface)!important;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-form-images{display:flex!important;flex-direction:column;flex:1 1 0;min-width:0;min-height:0;height:100%;margin:0;padding:16px;overflow:hidden!important;background:var(--storai-library-surface)!important;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-detail-fields{min-width:0;min-height:0;height:100%;padding:32px 20px 20px;border:0;border-left:1px solid var(--asset-line);overflow-y:auto;overscroll-behavior:contain;background:var(--storai-detail-surface)!important;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-image-workspace{display:grid!important;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto;gap:12px;flex:1 1 0;min-width:0;min-height:0;height:100%!important;overflow:visible;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-image-library-toolbar{grid-column:1;grid-row:1;order:0;min-height:28px;align-items:center;margin:0;padding:0;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-image-library-summary{gap:7px;min-width:0;color:var(--asset-muted);font:400 11px/20px system-ui;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-image-library-actions{flex:none;gap:6px;}
.entity-image-library-actions [hidden]{display:none!important;}
.entity-image-selected-count{white-space:nowrap;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-image-selection-cancel{border:0;border-radius:4px;background:transparent;padding:2px 5px;color:var(--asset-muted);font:inherit;white-space:nowrap;cursor:pointer;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-image-selection-cancel:hover{background:#8882;color:var(--asset-ink);}

/* The preview never covers thumbnails or the prompt composer. */
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-stage{grid-column:1;grid-row:1;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto;gap:10px;position:relative;box-sizing:border-box;min-width:0;min-height:0;height:100%;max-height:100%;padding:8px;border:1px solid var(--asset-line);border-radius:8px;background:var(--storai-prompt-surface);overflow:hidden;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-inline-gallery-preview{grid-column:1;grid-row:1;position:relative;inset:auto;display:flex;align-items:center;justify-content:center;min-width:0;min-height:0;width:100%;height:100%;overflow:hidden;border:0;border-radius:0;background:transparent;}
.entity-inline-gallery-preview .entity-preview-open{display:block;position:absolute;inset:0;box-sizing:border-box;width:100%;height:100%;margin:0;padding:0;border:0;border-radius:0;background:transparent;cursor:zoom-in;}
.entity-preview-open>.entity-image-shell{display:block;width:100%;height:100%;border-radius:0;}
.entity-preview-open img{width:100%;height:100%;object-fit:contain;}
.entity-preview-expand{position:absolute;right:10px;bottom:10px;top:auto;z-index:2;display:grid;place-items:center;width:28px;height:28px;margin:0;padding:5px;border:0;border-radius:6px;background:transparent;color:var(--asset-ink);box-shadow:none;cursor:pointer;opacity:0;transition:opacity .12s;}
.entity-preview-expand svg{width:16px;height:16px;}
.entity-inline-gallery-preview:hover .entity-preview-expand,.entity-preview-expand:focus-visible{opacity:1;}
.entity-gallery-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:9px;padding:15px;text-align:center;color:var(--asset-muted);}
.entity-gallery-empty svg{width:32px;height:32px;margin-bottom:3px;opacity:.75;}
.entity-gallery-empty strong{font:400 12px/20px system-ui;color:var(--asset-ink);}
.entity-gallery-empty span{font:400 11px/18px system-ui;max-width:260px;}

/* One steady strip mixes completed images and editable drafts. */
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-thumbnails{grid-column:1;grid-row:2;min-width:0;min-height:0;height:62px;overflow:hidden;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-thumbnails .entity-image-choices{display:flex;flex-direction:row;align-items:flex-start;justify-content:flex-start;gap:8px;box-sizing:border-box;width:100%;height:62px!important;max-height:none;margin:0;padding:2px 1px 4px;overflow-x:auto!important;overflow-y:hidden!important;overscroll-behavior:contain;scrollbar-width:none;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-thumbnails .entity-thumbnail-item{position:relative;flex:0 0 56px;box-sizing:border-box;width:56px;height:56px!important;min-width:0!important;min-height:0!important;aspect-ratio:1;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-thumbnails .entity-thumbnail-item>.entity-thumbnail-main{position:relative;inset:auto;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:100%!important;height:100%!important;min-width:0!important;min-height:0!important;max-width:none;max-height:none;margin:0;padding:0;border:1px solid var(--asset-line);border-radius:6px;background:var(--storai-prompt-surface);color:var(--asset-muted);overflow:hidden;cursor:pointer;font:400 11px/17px system-ui;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-thumbnails .entity-thumbnail-main .entity-image-shell{width:100%;height:100%;border-radius:12px;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-thumbnails .entity-thumbnail-main img{width:100%;height:100%;object-fit:cover;border-radius:12px;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-thumbnails .entity-thumbnail-main.selected{border:2px solid var(--asset-selected);box-shadow:none;color:var(--asset-ink);}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-thumbnails .entity-draft-thumbnail{border-style:dashed;white-space:normal;padding:6px!important;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-thumbnails .entity-draft-thumbnail.selected{border-style:solid;}
.entity-gallery-stage:has(.entity-image-choices[hidden]){grid-template-rows:minmax(0,1fr) auto!important;}
.entity-gallery-stage:has(.entity-image-choices[hidden]) .entity-gallery-thumbnails{display:none;}
.entity-image-choices[hidden]{display:none!important;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-thumbnail-item>.entity-image-select-check{position:absolute!important;inset:4px auto auto 4px!important;z-index:3;display:grid;place-items:center;width:12px!important;height:12px!important;min-width:12px!important;min-height:12px!important;max-width:12px!important;max-height:12px!important;margin:0;padding:0;transform:none!important;border:1px solid #fff;border-radius:3px;background:#0003;color:#111;font:9px/1 system-ui;box-shadow:0 0 2px #0007;opacity:0;cursor:pointer;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) :is(.entity-thumbnail-item:hover,.entity-thumbnail-item:focus-within,.entity-images-selecting .entity-thumbnail-item)>.entity-image-select-check{opacity:1;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-thumbnail-item>.entity-image-select-check[aria-checked=true]{background:#fff;color:#111;}

/* Selected media is read-only; editing creates a new draft explicitly. */
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-image-workspace>.entity-main-image{grid-column:1;grid-row:2;display:flex!important;flex-direction:column;flex:0 0 auto;align-self:end;position:relative;box-sizing:border-box;width:100%;min-width:0;min-height:0!important;height:auto!important;max-height:none;aspect-ratio:auto;margin:0;border:1px solid var(--asset-line);border-radius:12px;background:var(--storai-prompt-surface)!important;overflow:visible;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-main-image>.entity-form-image-preview{display:none!important;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-shared-frame>.entity-inline-prompt{position:relative;inset:auto;display:flex;flex-direction:column;width:100%;height:auto;min-height:0;margin:0;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-shared-frame .entity-prompt-input-box{height:auto;min-height:0;border:0;border-radius:12px;background:transparent!important;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-shared-frame .entity-form-prompt{flex:0 0 auto!important;box-sizing:border-box;height:calc(8.5em + 16px)!important;min-height:calc(8.5em + 16px)!important;max-height:calc(8.5em + 16px)!important;margin:0;padding:8px 12px!important;border:0;border-radius:0;background:transparent!important;font-size:13px;line-height:1.7;overflow-y:auto;resize:none!important;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-shared-frame .entity-form-prompt[readonly]{color:var(--asset-muted);}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-composer-footer{flex:none;display:flex!important;flex-wrap:nowrap;gap:4px!important;padding:3px 6px 6px!important;align-items:center;background:transparent!important;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-composer-footer>.entity-model-control{grid-column:1;grid-row:1;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-composer-footer>.image-options{grid-column:2;grid-row:1;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-composer-footer>.composer-style-trigger{grid-column:3;grid-row:1;max-width:90px;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-composer-footer>.entity-composer-actions{grid-column:4;grid-row:1;justify-self:end;gap:4px!important;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-composer-footer :is(.entity-model-trigger,.image-options-trigger){min-height:28px;padding:3px 6px!important;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-detail-fields :is(input,textarea){background:var(--storai-prompt-surface);font-size:13px;}
.entity-card-menu button:disabled{opacity:.4;cursor:default;}
:is(.entity-preview-open,.entity-preview-expand,.entity-image-selection-cancel,.entity-thumbnail-main,.entity-image-select-check):focus-visible{outline:2px solid var(--asset-selected);outline-offset:2px;}
@media(hover:none){.entity-preview-expand{opacity:1;}:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-thumbnail-item>.entity-image-select-check{opacity:1;}}
@media(max-width:820px){
 :is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-detail-dialog{width:calc(100vw - 20px);max-width:calc(100vw - 20px);height:94dvh;max-height:94dvh;}
 :is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-detail-body{display:block!important;overflow-y:auto!important;}
 :is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-form-images{height:min(640px,80dvh)!important;min-height:440px!important;padding:16px;}
 :is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-detail-fields{height:auto;min-height:0;padding:20px 16px;border-left:0;border-top:1px solid var(--asset-line);overflow:visible;}
 :is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-image-library-summary:has(.entity-image-selected-count)>.entity-image-library-count{display:none;}
 :is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-composer-footer{column-gap:3px!important;}
}
@media(prefers-reduced-motion:reduce){.entity-preview-expand{transition:none;}}

/* Library actions sit immediately above thumbnails, below the large preview. */
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-composer-actions>.entity-edit-again-button{display:inline-flex;align-items:center;justify-content:center;gap:0;width:28px!important;min-width:28px;max-width:28px;height:28px;flex:0 0 28px;padding:5px!important;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-edit-again-button>svg{width:16px;height:16px;flex:none;}

/* Content-sized controls prevent empty space inside model/settings tiles. */
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-composer-footer>.entity-model-control{flex:0 1 auto;width:auto;min-width:70px;max-width:165px;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-composer-footer>.image-options{flex:0 1 auto!important;width:auto;min-width:0!important;max-width:185px;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-composer-footer>.composer-style-trigger{flex:0 1 auto;min-width:0;max-width:85px;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-composer-footer>.entity-composer-actions{flex:0 0 auto;margin-left:auto;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-thumbnails{user-select:none;-webkit-user-select:none;}

/* Preview controls float above the image. */
.entity-preview-step{position:absolute;top:50%;z-index:3;display:grid;place-items:center;width:28px;height:32px;margin:0;padding:5px;transform:translateY(-50%);border:0;border-radius:6px;background:transparent;color:#46505e;box-shadow:none;opacity:0;pointer-events:none;cursor:pointer;transition:opacity .12s;}
.entity-preview-step svg{width:18px;height:18px;}
.entity-preview-previous{left:10px;}.entity-preview-next{right:10px;}
.entity-inline-gallery-preview:hover .entity-preview-step,.entity-preview-step:focus-visible{opacity:1;pointer-events:auto;}
.entity-preview-step[hidden]{display:none!important;}
.entity-preview-step:hover{background:transparent;color:var(--asset-ink);}
.entity-preview-step:focus-visible{outline:2px solid var(--asset-selected);outline-offset:2px;}
html.dark-mode .entity-preview-step{background:transparent;color:#e3e7ef;}
html.dark-mode .entity-preview-step:hover{background:transparent;color:#fff;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-shared-frame .entity-reference-add{flex:0 0 44px;width:44px;height:44px;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-shared-frame .entity-reference-plus{display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:44px;height:44px;min-width:44px;min-height:44px;max-width:44px;max-height:44px;margin:0;padding:0;border:1px solid #88888830;border-radius:6px;background:transparent;color:#8993a1;font:22px/1 system-ui;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-shared-frame .entity-reference-plus:hover:not(:disabled){background:#88888812;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-shared-frame .entity-reference-plus:disabled{opacity:.3;cursor:default;}
@media(hover:none){.entity-preview-step{opacity:1;pointer-events:auto;}}
@media(prefers-reduced-motion:reduce){.entity-preview-step{transition:none;}}

html.dark-mode :is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-shared-frame .entity-reference-plus{border-color:#88888830;}

/* One image panel contains the preview, actions, thumbnails and scroll handle. */
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-library{grid-column:1;grid-row:2;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:28px 62px auto;gap:6px;min-width:0;padding:0;border:0;background:transparent;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-library>.entity-image-library-toolbar{grid-column:1;grid-row:1;width:auto;min-width:0;padding:0;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-library:has(.entity-image-choices[hidden]){grid-template-rows:28px;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-thumbnails .entity-image-choices::-webkit-scrollbar{display:none;height:0;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-library>.entity-thumbnail-scrollbar{grid-column:1;grid-row:3;display:block;box-sizing:border-box;appearance:none;-webkit-appearance:none;width:100%;min-width:0;height:10px;min-height:10px;margin:0;padding:0;border:0;border-radius:0;background:transparent;accent-color:var(--asset-selected);cursor:ew-resize;}
.entity-thumbnail-scrollbar[hidden]{display:none!important;}
.entity-thumbnail-scrollbar::-webkit-slider-runnable-track{height:5px;border-radius:3px;background:#e2e5e9;}
.entity-thumbnail-scrollbar::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;width:var(--gallery-scroll-thumb,40px);height:5px;border:0;border-radius:3px;background:#a1a9b5;}
.entity-thumbnail-scrollbar::-moz-range-track{height:5px;border-radius:3px;background:#e2e5e9;}
.entity-thumbnail-scrollbar::-moz-range-thumb{width:var(--gallery-scroll-thumb,40px);height:5px;border:0;border-radius:3px;background:#a1a9b5;}
.entity-thumbnail-scrollbar:hover::-webkit-slider-thumb{background:#7d8b9e;}
.entity-thumbnail-scrollbar:focus-visible{outline:1px solid var(--asset-selected);outline-offset:2px;}
html.dark-mode .entity-thumbnail-scrollbar::-webkit-slider-runnable-track{background:#373c45;}
html.dark-mode .entity-thumbnail-scrollbar::-webkit-slider-thumb{background:#7c8798;}
html.dark-mode .entity-thumbnail-scrollbar::-moz-range-track{background:#373c45;}
html.dark-mode .entity-thumbnail-scrollbar::-moz-range-thumb{background:#7c8798;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-thumbnail-item>.entity-image-select-check::after{content:"";position:absolute;inset:-4px;background:transparent;}

/* Shared canvas above the library; only the prompt has a subtle boundary. */
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-image-workspace{grid-template-rows:minmax(0,1fr) auto;gap:10px;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-stage{display:contents;border:0;background:transparent;padding:0;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-library{grid-row:2;border:0;background:transparent;padding:0;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-inline-gallery-preview{grid-row:1;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-image-workspace>.entity-main-image{grid-row:1;align-self:stretch;min-height:0!important;height:100%!important;border:1px solid var(--asset-line);border-radius:8px;background:transparent!important;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-image-workspace:not(.gallery-show-prompt)>.entity-main-image{display:none!important;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .gallery-show-prompt .entity-inline-gallery-preview{display:none!important;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-image-workspace>.entity-main-image>.entity-inline-prompt{height:100%;min-height:0;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-image-workspace .entity-prompt-input-box{display:flex;flex-direction:column;flex:1;min-height:0;border:0;border-radius:0;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-image-workspace .entity-form-prompt{flex:1 1 0!important;height:0!important;min-height:0!important;max-height:none!important;padding:10px 12px!important;}
/* Upload/new stay beside the count; download/delete remain at the right edge. */
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-library>.entity-image-library-toolbar{display:grid;grid-template-columns:auto auto auto minmax(0,1fr) auto auto auto auto;column-gap:6px;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-library .entity-image-library-summary{grid-column:1;grid-row:1;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-library .entity-image-library-actions{display:contents;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-library [data-library-action=upload]{grid-column:2;grid-row:1;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-library [data-library-action=add]{grid-column:3;grid-row:1;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-library [data-library-action=download]{grid-column:7;grid-row:1;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-library [data-library-action=delete]{grid-column:8;grid-row:1;}

:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-library [data-library-action=prompt]{grid-column:5;grid-row:1;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-library [data-library-action=variation]{grid-column:6;grid-row:1;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-library-text-action{width:auto;min-width:0;padding:2px 4px;border:0;border-radius:4px;background:transparent;color:var(--asset-muted);font:400 11px/20px system-ui;white-space:nowrap;cursor:pointer;}
.entity-library-text-action:hover:not(:disabled){background:#88888812;color:var(--asset-ink);}
.entity-library-text-action:disabled{opacity:.35;cursor:default;}
.entity-library-text-action:focus-visible{outline:2px solid var(--asset-selected);outline-offset:1px;}
/* Clip once at the outer thumbnail: nested radii cannot leave pale corner gaps. */
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-thumbnails .entity-thumbnail-main:not(.entity-draft-thumbnail){border:0;border-radius:6px;overflow:hidden;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-thumbnails .entity-thumbnail-main :is(.entity-image-shell,img){border-radius:6px!important;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-thumbnails .entity-thumbnail-main.selected:not(.entity-draft-thumbnail)::after{content:"";position:absolute;inset:0;border:1.5px solid var(--asset-selected);border-radius:inherit;pointer-events:none;}
@media(max-width:420px){:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-library>.entity-image-library-toolbar{column-gap:2px;}}

/* Preview hover reveals transparent controls with legible image overlays. */
.entity-preview-step,.entity-preview-expand{pointer-events:auto;background:transparent!important;border:0;box-shadow:none;color:#93999f!important;}
.entity-preview-step{width:56px;height:64px;}
.entity-preview-expand{width:36px;height:36px;}
.entity-preview-step svg,.entity-preview-expand svg{filter:none;stroke-width:1.8;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-thumbnail-item>.entity-image-select-check:hover{opacity:1;}

/* Explicit clipping protects thumbnails from legacy image/button styles. */
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-thumbnails .entity-thumbnail-item>.entity-thumbnail-main{border-radius:6px!important;clip-path:inset(0 round 6px);}

/* A slim inset selection ring leaves image size and corners unchanged. */
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-thumbnails .entity-thumbnail-item>.entity-thumbnail-main.selected:not(.entity-draft-thumbnail){border:0;padding:0;background:transparent;box-shadow:none;}
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-gallery-thumbnails .entity-thumbnail-item>.entity-draft-thumbnail.selected{border:1px solid var(--asset-selected);background:#88888808;box-shadow:none;}

.entity-preview-step svg{width:36px;height:36px;}

.entity-preview-step:hover,.entity-preview-expand:hover{color:#737a82!important;}
html.dark-mode .entity-preview-step,html.dark-mode .entity-preview-expand{color:#b3b7bc!important;}
html.dark-mode .entity-preview-step:hover,html.dark-mode .entity-preview-expand:hover{color:#d2d5d9!important;}

/* The active preview needs no checkbox outside explicit multi-selection. */
:is(#characterModal,#locationModal,#propModal,#styleAssetModal) .entity-image-choices:not(.entity-images-selecting) .entity-thumbnail-main.selected~.entity-image-select-check{display:none!important;}
