.preview-actions { flex-wrap: wrap; }
.work-gallery { width: min(940px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); padding: 24px; border: 1px solid var(--border-strong); border-radius: 22px; background: var(--surface); color: var(--text-1); box-shadow: 0 16px 70px #39251c40; }
.work-gallery::backdrop { background: #39251c88; backdrop-filter: blur(5px); }
.gallery-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.gallery-heading h2 { margin: 0; }.gallery-heading p { color: var(--text-3); margin: 6px 0 0; font-size: 12px; }
.gallery-search { width: 100%; box-sizing: border-box; padding: 10px 14px; margin-bottom: 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text-1); }
.work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.work-card { min-width: 0; text-align: left; padding: 9px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text-1); cursor: pointer; transition: transform .15s, border-color .15s; }
.work-card:hover { transform: translateY(-3px); border-color: var(--accent); }.work-card.selected { border: 2px solid var(--accent); padding: 8px; background: var(--lavender); }.work-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.work-cover { aspect-ratio: 8 / 5; border-radius: 10px; background: radial-gradient(ellipse at 40% 35%, #e9def0, #f1d8da 40%, #f3ead9 75%); display: grid; place-items: center; overflow: hidden; color: var(--text-3); font-size: 12px; }
.work-cover img { width: 100%; height: 100%; object-fit: cover; }.work-card strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 11px 3px 5px; }.work-card small { display: block; padding: 0 3px 5px; color: var(--text-3); font-size: 11px; }
.gallery-empty { text-align: center; padding: 32px 0; color: var(--text-3); } .view-message { color: var(--text-3); font-size: 11px; }
@media (max-width: 520px) { .work-gallery { padding: 16px; }.work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }.work-cover span { font-size: 10px; }.work-card strong { font-size: 12px; }.preview-footer { align-items: flex-start; } }
.particle-panel { position: absolute; left: 12px; top: 12px; z-index: 2; width: 232px; max-width: calc(100% - 24px); max-height: calc(100% - 132px); overflow-y: auto; border: 1px solid #d6c6ad; border-radius: 15px; background: #fffaf0ee; color: #63402f; box-shadow: 0 5px 22px #39251c1a; backdrop-filter: blur(10px); font: 12px 'Noto Sans CJK SC', system-ui; pointer-events: auto; }
.particle-panel summary { cursor: pointer; padding: 11px 13px; font-weight: 650; }.particle-panel summary span { float: right; color: #9178b0; font-size: 11px; }
.particle-content { padding: 0 12px 12px; }.particle-content fieldset { padding: 0; border: 0; margin: 12px 0; }.particle-content fieldset:disabled { opacity: .5; }.particle-content label { display: block; margin: 10px 0; }.particle-content input[type=range] { display: block; width: 100%; margin-top: 8px; accent-color: #9178b0; }.particle-content input[type=checkbox] { accent-color: #9178b0; vertical-align: middle; }.particle-content select { display: block; width: 100%; padding: 7px; border-radius: 8px; border: 1px solid #d6c6ad; background: #fff8e7; color: #63402f; margin-top: 7px; }.particle-content output { float: right; color: #9178b0; }.particle-content p { font-size: 11px; line-height: 1.6; color: #8b786a; margin: 10px 0 0; }.fx-actions { display: flex; gap: 6px; }.fx-actions button { flex: 1; border: 1px solid #d6c6ad; border-radius: 8px; background: #f3ead9; color: #63402f; padding: 7px 4px; cursor: pointer; font: inherit; }.fx-actions button[aria-pressed=true] { background: #e9def0; border-color: #9178b0; }.particle-panel :focus-visible { outline: 2px solid #9178b0; outline-offset: 2px; }
@media(max-width:640px) { .particle-panel { width: 208px; top: 8px; left: 8px; } }
.preview-actions { flex: 1 1 340px; min-width: 0; justify-content: flex-end; }
@media (max-width: 640px) { .preview-actions { flex-basis: 100%; justify-content: flex-start; }.preview-actions .cbtn { font-size: 11px; padding: 4px 8px; } }
/* Keep host controls in one flowing stack. Folded headers and the legacy exit
   remain reachable without overlapping each other or the native toolbar. */
.host-control-stack { position: absolute; z-index: 2; left: 12px; top: 12px; width: min(350px, calc(100% - 24px)); max-height: calc(100% - 140px); overflow-y: auto; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; pointer-events: none; scrollbar-width: thin; }
.sse-viewer .host-control-stack .legacy-panel, .host-control-stack .particle-panel { position: relative; inset: auto; max-height: none; overflow: visible; margin: 0; box-sizing: border-box; pointer-events: auto; }
.sse-viewer .host-control-stack .legacy-panel { width: 100%; }.host-control-stack .particle-panel { width: min(232px, 100%); max-width: 100%; }
@media(max-width:640px) { .host-control-stack { left: 8px; top: 8px; width: calc(100% - 16px); }.host-control-stack .particle-panel { width: min(232px, 100%); } }
.gallery-header-actions { display: flex; gap: 8px; flex-shrink: 0; }.gallery-storage-note { color: var(--text-3); font-size: 12px; line-height: 1.6; margin: -5px 0 12px; }
.gallery-message { display: block; font-size: 12px; color: var(--accent); margin-bottom: 12px; white-space: pre-wrap; }.gallery-message:empty { display: none; }.gallery-message.error { color: var(--err, #b65059); }
.work-card { cursor: default; }.work-open { border: 0; background: none; padding: 0; color: inherit; font: inherit; text-align: left; width: 100%; cursor: pointer; border-radius: 10px; }.work-open:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.work-card-actions { display: flex; justify-content: space-between; align-items: center; padding: 6px 3px 0; border-top: 1px dashed var(--border); gap: 6px; font-size: 11px; color: var(--text-3); }
.work-delete { font: inherit; border: 1px solid var(--border); border-radius: 20px; color: #a05261; background: var(--surface); padding: 4px 10px; cursor: pointer; }.work-delete:hover { background: var(--pink); }.work-delete:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gallery-delete-confirmation { position: sticky; top: 0; z-index: 2; padding: 14px; margin-bottom: 16px; border: 1px solid #d8a2b5; border-radius: 12px; background: #fff2f1; color: var(--text-1); }.gallery-delete-confirmation p { font-size: 12px; line-height: 1.7; margin: 0 0 10px; overflow-wrap: anywhere; }.gallery-delete-confirmation div { display: flex; gap: 8px; justify-content: flex-end; }.gallery-delete-confirmation .danger { color: #9c3e4f; border-color: #d8a2b5; background: #f1d8da; }
.work-gallery button:disabled { opacity: .5; cursor: wait; }.work-card:has(button:disabled):hover { transform: none; }
@media(max-width:520px) { .gallery-heading { align-items: flex-start; flex-wrap: wrap; }.gallery-header-actions { width: 100%; justify-content: flex-end; }.work-card-actions { font-size: 10px; }.work-delete { padding: 4px 8px; } }
