/* Story layouts editor — preview and form chrome */
.d-none { display: none !important; }

@font-face {
        font-family: 'Ohno Softie';
        src: url('/fonts/OhnoSoftie-Regular.otf') format('opentype');
        font-weight: normal;
        font-style: normal;
        font-display: swap;
    }
    @font-face {
        font-family: 'Ohno Softie';
        src: url('/fonts/OhnoSoftie-Bold.otf') format('opentype');
        font-weight: bold;
        font-style: normal;
        font-display: swap;
    }
    .layout-preview {
        --layout-preview-aspect: 16 / 9;
        container-type: size;
        container-name: layout-preview;
        position: relative;
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
        width: min(100%, calc((100dvh - var(--story-layouts-preview-chrome, 18rem)) * 16 / 9));
        max-width: 100%;
        max-height: calc(100dvh - var(--story-layouts-preview-chrome, 18rem));
        aspect-ratio: var(--layout-preview-aspect);
        height: auto;
        margin-inline: auto;
        flex-shrink: 0;
        overflow: hidden;
        isolation: isolate;
        z-index: 0;
        background-color: transparent;
        background-image: url('/images/layouts/wou-layouts-background.jpg');
        background-repeat: no-repeat;
        background-position: center;
        background-size: 100% 100%;
    }
    .layout-preview-background {
        position: absolute;
        inset: 0;
        z-index: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        pointer-events: none;
    }
    .layout-preview-background .layout-image-slot--background {
        position: relative;
        width: min(200%, 93.75cqw);
        aspect-ratio: 1;
        max-height: 200%;
        height: auto;
        flex-shrink: 0;
        transform: translateY(-2%);
        border-radius: 50%;
        overflow: hidden;
        pointer-events: auto;
        cursor: pointer;
        border: 2px dashed transparent;
        background: transparent;
        clip-path: circle(50% at 50% 50%);
    }
    .layout-preview-background .layout-image-slot--background:hover,
    .layout-preview-background .layout-image-slot--background:focus-within,
    .layout-preview-background .layout-image-slot--background:focus-visible {
        outline: none;
        border-color: transparent;
        background: transparent;
    }
    .layout-preview-background .layout-image-slot--background img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        pointer-events: none;
        border-radius: 50%;
    }
    .layout-preview[data-layout="cover"] .layout-preview-background .layout-image-slot--background img {
        opacity: 0.75;
    }
    .layout-preview[data-layout="left"] .layout-preview-background .layout-image-slot--background img,
    .layout-preview[data-layout="right"] .layout-preview-background .layout-image-slot--background img {
        opacity: 1;
    }
    .layout-preview-background .layout-image-slot--background::after {
        content: '';
        position: absolute;
        inset: 0;
        z-index: 1;
        border-radius: 50%;
        pointer-events: none;
        box-shadow: inset 0 0 6.11cqh 3.89cqh rgba(255, 255, 255, 0.55),
                    inset 0 0 12.22cqh 7.22cqh rgba(255, 255, 255, 0.4);
        background: radial-gradient(
            circle at center,
            rgba(255, 255, 255, 0.12) 0%,
            rgba(255, 255, 255, 0.18) 48%,
            rgba(255, 255, 255, 0.24) 78%,
            rgba(255, 255, 255, 0.48) 100%
        );
    }
    .layout-preview-story-title {
        position: absolute;
        top: 1%;
        left: 0;
        right: 0;
        z-index: 0;
        height: 18%;
        padding: 0;
        overflow: visible;
        pointer-events: none;
        user-select: none;
    }
    .layout-preview-story-title__svg {
        display: block;
        width: 100%;
        height: 100%;
        overflow: visible;
        filter: drop-shadow(0 0 1.11cqh rgba(255, 255, 255, 1))
                drop-shadow(0 0 2.78cqh rgba(255, 255, 255, 0.95))
                drop-shadow(0 0 6.11cqh rgba(255, 255, 255, 0.85))
                drop-shadow(0 0 10cqh rgba(255, 255, 255, 0.7))
                drop-shadow(0 0 14.44cqh rgba(255, 255, 255, 0.5));
    }
    .layout-preview-story-title__path {
        fill: none;
        stroke: none;
    }
    .layout-preview-story-title__text {
        font-family: 'Ohno Softie', cursive;
        font-weight: bold;
        font-size: 5.33cqh;
    }
    .layout-preview-story-title__text--stroke {
        fill: none;
        stroke: #fff;
        stroke-width: 0.15em;
        stroke-linejoin: round;
        stroke-linecap: round;
    }
    .layout-preview-story-title__text--fill {
        fill: currentColor;
        stroke: none;
    }
    .layout-preview-story-title__text-path {
        dominant-baseline: middle;
        letter-spacing: inherit;
    }
    .layout-preview-story-title--two-lines {
        height: 22%;
    }
    .layout-preview-story-title--empty {
        display: none;
    }
    .layout-preview-sidebar {
        position: absolute;
        left: 0;
        top: 50%;
        z-index: 2;
        height: 66.7cqh;
        max-width: 42%;
        transform: translateY(-50%);
        pointer-events: none;
        user-select: none;
    }
    .layout-preview-sidebar__img {
        display: block;
        height: 100%;
        width: auto;
        max-width: 100%;
        object-fit: contain;
        object-position: left center;
    }
    .layout-preview-previous-button {
        position: absolute;
        left: 8%;
        top: 50%;
        z-index: 4;
        width: min(24%, 22.22cqh);
        height: min(24%, 22.22cqh);
        transform: translateY(-50%);
        margin: 0;
        padding: 0;
        border: none;
        background: transparent;
        cursor: pointer;
        pointer-events: auto;
        user-select: none;
    }
    .layout-preview-previous-button:disabled {
        cursor: default;
        opacity: 0.4;
        pointer-events: none;
    }
    .layout-preview-previous-button__img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: left center;
    }
    .layout-preview-next-button {
        position: absolute;
        right: 8%;
        top: 50%;
        z-index: 4;
        width: min(24%, 22.22cqh);
        height: min(24%, 22.22cqh);
        transform: translateY(-50%);
        margin: 0;
        padding: 0;
        border: none;
        background: transparent;
        cursor: pointer;
        pointer-events: auto;
        user-select: none;
    }
    .layout-preview-next-button:disabled {
        cursor: default;
        opacity: 0.4;
        pointer-events: none;
    }
    .layout-preview-next-button__img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: right center;
    }
    .layout-preview-back-button {
        position: absolute;
        left: 8%;
        bottom: 5%;
        z-index: 2;
        width: 17.78cqh;
        height: 17.78cqh;
        pointer-events: none;
        user-select: none;
    }
    .layout-preview-back-button__img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: left bottom;
    }
    .layout-preview-pages {
        position: absolute;
        left: 50%;
        bottom: 7%;
        z-index: 2;
        width: 6.25cqw;
        max-height: 6%;
        transform: translateX(-50%);
        pointer-events: none;
        user-select: none;
    }
    .layout-preview-pages__img {
        display: block;
        width: 100%;
        height: auto;
        max-height: 100%;
        object-fit: contain;
        object-position: center bottom;
    }
    .layout-preview-encounters {
        position: absolute;
        left: 50%;
        bottom: 13%;
        z-index: 1;
        width: min(85%, 21.25cqw);
        max-height: 16%;
        transform: translateX(-50%);
        pointer-events: none;
        user-select: none;
    }
    .layout-preview[data-layout="left"] .layout-preview-encounters,
    .layout-preview[data-layout="right"] .layout-preview-encounters {
        display: none;
    }
    .layout-preview-encounters__img {
        display: block;
        width: 100%;
        height: auto;
        max-height: 100%;
        object-fit: contain;
        object-position: center bottom;
        filter: drop-shadow(0 0 0.78cqh rgba(255, 255, 255, 0.95))
                drop-shadow(0 0 2.22cqh rgba(255, 255, 255, 0.85))
                drop-shadow(0 0 4.44cqh rgba(255, 255, 255, 0.65))
                drop-shadow(0 0 7.78cqh rgba(255, 255, 255, 0.4));
    }
    .layout-preview-inner {
        position: absolute;
        inset: 0;
        z-index: 1;
        display: block;
        overflow: hidden;
        box-sizing: border-box;
        padding: 0;
        pointer-events: none;
    }
    .layout-preview-stage {
        position: relative;
        z-index: 1;
        display: flex;
        gap: 0;
        min-height: 100%;
        height: 100%;
        align-items: stretch;
        padding: 0;
        box-sizing: border-box;
        pointer-events: none;
    }
    .layout-preview-stage [data-part="foreground"],
    .layout-preview-stage [data-part="text"] {
        pointer-events: auto;
    }
    .layout-preview [data-part="foreground"],
    .layout-preview [data-part="text"] {
        border-radius: 6px;
        min-height: 40px;
    }
    .layout-preview [data-part="foreground"] {
        background: transparent;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }
    .layout-preview [data-part="foreground"] .layout-image-slot {
        flex: 1 1 auto;
        align-self: stretch;
        min-width: 0;
        min-height: 0;
    }
    .layout-preview [data-part="foreground"] img {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        object-position: center;
        display: block;
    }
    .layout-preview [data-part="text"] {
        background: transparent;
        display: flex;
        align-items: stretch;
        flex: 1 1 0;
        min-width: 0;
        min-height: 0;
    }
    .layout-preview .layout-page-text-wrap {
        position: relative;
        width: 100%;
        height: 100%;
        flex: 1 1 auto;
        align-self: stretch;
        min-height: 0;
        box-sizing: border-box;
        border: 2px dashed transparent;
        border-radius: 6px;
        background: transparent;
        padding: 0.35rem 0.5rem;
    }
    .layout-preview [data-part="text"]:hover .layout-page-text-wrap,
    .layout-preview [data-part="text"]:focus-within .layout-page-text-wrap {
        border-color: rgba(160, 160, 200, 0.55);
        background: rgba(128, 128, 160, 0.15);
    }

    .layout-preview[data-layout="left"],
    .layout-preview[data-layout="right"] {
        --layout-split-text-panel-width: 45%;
        --layout-split-shift-amount: 11%;
        --layout-split-foreground-outset: 6%;
        --layout-split-text-margin-top: 4.17cqh;
        --layout-split-text-margin-bottom: 4.17cqh;
    }
    .layout-preview[data-layout="left"] {
        --layout-split-shift: var(--layout-split-shift-amount);
        --layout-split-text-margin-left: 21%;
        --layout-split-text-margin-right: 10%;
    }
    .layout-preview[data-layout="right"] {
        --layout-split-shift: calc(-1 * var(--layout-split-shift-amount));
        --layout-split-text-margin-left: 10%;
        --layout-split-text-margin-right: 21%;
    }
    .layout-preview[data-layout="left"] .layout-preview-stage,
    .layout-preview[data-layout="right"] .layout-preview-stage {
        align-items: center;
        justify-content: center;
        transform: translateX(var(--layout-split-shift));
    }
    .layout-preview[data-layout="left"] [data-part="text"],
    .layout-preview[data-layout="right"] [data-part="text"] {
        flex: 0 0 var(--layout-split-text-panel-width);
        width: var(--layout-split-text-panel-width);
        aspect-ratio: 868 / 446;
        height: auto;
        max-height: 52%;
        margin: 0;
    }
    .layout-preview .layout-page-text-wrap--panel {
        --layout-locality-color: #AF001E;
        position: relative;
        background: transparent url('/images/layouts/wou_layouts_panel_background.png') center / 100% 100% no-repeat;
        border: none;
        border-radius: 0;
        padding: 0;
        overflow: hidden;
    }
    .layout-preview .layout-page-text-wrap--panel::after {
        content: '';
        position: absolute;
        inset: 5px;
        z-index: 1;
        pointer-events: none;
        background-color: var(--layout-locality-color);
        -webkit-mask-image: url('/images/layouts/wou_layouts_panel_border.png');
        mask-image: url('/images/layouts/wou_layouts_panel_border.png');
        -webkit-mask-size: 100% 100%;
        mask-size: 100% 100%;
        -webkit-mask-position: center;
        mask-position: center;
        -webkit-mask-repeat: no-repeat;
        mask-repeat: no-repeat;
    }
    .layout-preview[data-layout="left"] [data-part="text"]:hover .layout-page-text-wrap--panel,
    .layout-preview[data-layout="right"] [data-part="text"]:hover .layout-page-text-wrap--panel,
    .layout-preview[data-layout="left"] [data-part="text"]:focus-within .layout-page-text-wrap--panel,
    .layout-preview[data-layout="right"] [data-part="text"]:focus-within .layout-page-text-wrap--panel {
        border-color: transparent;
        background-color: transparent;
        background-image: url('/images/layouts/wou_layouts_panel_background.png');
        background-size: 100% 100%;
        background-position: center;
        background-repeat: no-repeat;
    }
    .layout-preview[data-layout="left"] .layout-page-text-display,
    .layout-preview[data-layout="left"] .layout-page-text-input {
        text-align: left;
        top: var(--layout-split-text-margin-top);
        right: var(--layout-split-text-margin-right);
        bottom: var(--layout-split-text-margin-bottom);
        left: var(--layout-split-text-margin-left);
        width: auto;
        height: auto;
        z-index: 2;
    }
    .layout-preview[data-layout="right"] .layout-page-text-display,
    .layout-preview[data-layout="right"] .layout-page-text-input {
        text-align: left;
        top: var(--layout-split-text-margin-top);
        right: var(--layout-split-text-margin-right);
        bottom: var(--layout-split-text-margin-bottom);
        left: var(--layout-split-text-margin-left);
        width: auto;
        height: auto;
        z-index: 2;
    }

    .layout-preview-cover-foreground {
        position: absolute;
        left: 50%;
        top: 47%;
        z-index: 1;
        display: none;
        transform: translate(-50%, -50%);
        /* Sized vs 1280×720 reference (3.5rem ≈ 7.8cqh) so cover foreground scales with the preview box */
        padding: 7.8cqh;
        pointer-events: none;
        cursor: default;
        filter: none;
    }
    .layout-preview[data-layout="cover"] .layout-preview-cover-foreground {
        filter: drop-shadow(0 0.78cqh 1.89cqh rgba(0, 0, 0, 0.55))
                drop-shadow(0 1.67cqh 4.44cqh rgba(0, 0, 0, 0.4))
                drop-shadow(0 3.11cqh 7.8cqh rgba(0, 0, 0, 0.28));
    }
    .layout-preview[data-layout="cover"] .layout-preview-cover-foreground,
    .layout-preview[data-layout="left"] .layout-preview-cover-foreground,
    .layout-preview[data-layout="right"] .layout-preview-cover-foreground {
        display: block;
    }
    .layout-preview[data-layout="left"] .layout-preview-cover-foreground {
        left: calc(50% - var(--layout-split-text-panel-width) / 2 + var(--layout-split-shift) - var(--layout-split-foreground-outset));
        top: 50%;
        transform: translate(-50%, -50%);
        padding: 4.4cqh;
        z-index: 3;
    }
    .layout-preview[data-layout="right"] .layout-preview-cover-foreground {
        left: calc(50% + var(--layout-split-text-panel-width) / 2 + var(--layout-split-shift) + var(--layout-split-foreground-outset));
        top: 50%;
        transform: translate(-50%, -50%);
        padding: 4.4cqh;
        z-index: 3;
    }
    .layout-preview[data-layout="left"] .layout-preview-cover-foreground .layout-cover-foreground-frame,
    .layout-preview[data-layout="right"] .layout-preview-cover-foreground .layout-cover-foreground-frame {
        height: 55.5cqh;
        max-height: 90cqh;
    }
    .layout-preview-cover-foreground .layout-cover-foreground-frame {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: auto;
        height: 55.5cqh;
        max-height: 90cqh;
        max-width: 100%;
        aspect-ratio: 1;
        --layout-locality-color: #AF001E;
        background: transparent url('/images/layouts/ui-info-frame-RO-Delta@2x.png') center / contain no-repeat;
        pointer-events: none;
    }
    .layout-preview-cover-foreground[data-part="foreground"] .layout-image-slot {
        position: absolute;
        left: 50%;
        top: 50%;
        flex: none;
        align-self: auto;
        width: 84%;
        height: 84%;
        max-width: 84%;
        max-height: 84%;
        aspect-ratio: 1;
        transform: translate(-50%, -50%);
        border-radius: 50%;
        overflow: hidden;
        clip-path: circle(50% at 50% 50%);
        pointer-events: auto;
        cursor: pointer;
    }
    .layout-preview-cover-foreground:hover .layout-image-slot,
    .layout-preview-cover-foreground:focus-within .layout-image-slot {
        border-color: transparent;
    }
    .layout-preview-cover-foreground:hover .layout-image-slot:not(.layout-image-slot--empty),
    .layout-preview-cover-foreground:focus-within .layout-image-slot:not(.layout-image-slot--empty) {
        background: transparent;
    }
    .layout-preview-cover-foreground .layout-image-slot:hover,
    .layout-preview-cover-foreground .layout-image-slot:focus-within,
    .layout-preview-cover-foreground .layout-image-slot:focus-visible {
        outline: none;
        border-color: transparent;
    }
    .layout-preview-cover-foreground .layout-image-slot:not(.layout-image-slot--empty):hover,
    .layout-preview-cover-foreground .layout-image-slot:not(.layout-image-slot--empty):focus-within,
    .layout-preview-cover-foreground .layout-image-slot:not(.layout-image-slot--empty):focus-visible {
        background: transparent;
    }
    .layout-preview-cover-foreground img {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        object-fit: cover;
        object-position: center;
        border-radius: 50%;
    }
    .layout-image-slot {
        position: relative;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        border: 2px dashed transparent;
        border-radius: 6px;
        background: transparent;
    }
    .layout-preview [data-part="foreground"]:hover .layout-image-slot,
    .layout-preview [data-part="foreground"]:focus-within .layout-image-slot {
        border-color: transparent;
    }
    .layout-preview [data-part="foreground"]:hover .layout-image-slot:not(.layout-image-slot--empty),
    .layout-preview [data-part="foreground"]:focus-within .layout-image-slot:not(.layout-image-slot--empty) {
        background: transparent;
    }
    .layout-preview .layout-image-slot__label {
        display: none !important;
    }
    .layout-preview-cover-foreground .layout-image-slot--empty {
        background: var(--layout-locality-color);
    }
    .layout-image-slot__label {
        color: var(--bs-secondary-color, #8b8fa3);
        font-size: 0.8rem;
        font-weight: 500;
        text-align: center;
        padding: 0;
        pointer-events: none;
        user-select: none;
    }
    .layout-image-slot:not(.layout-image-slot--empty) .layout-image-slot__label {
        display: none;
    }
    .layout-image-slot::before {
        content: '';
        position: absolute;
        inset: 0;
        z-index: 1;
        pointer-events: none;
        box-sizing: border-box;
        border: 3px dashed transparent;
        border-radius: inherit;
        background: transparent;
    }
    .layout-preview-background .layout-image-slot--background::before {
        z-index: 2;
    }
    .layout-image-slot:hover::before,
    .layout-image-slot:focus-within::before,
    .layout-image-slot:focus-visible::before,
    .layout-preview [data-part="foreground"]:hover .layout-image-slot::before,
    .layout-preview [data-part="foreground"]:focus-within .layout-image-slot::before,
    .layout-preview-cover-foreground:hover .layout-image-slot::before,
    .layout-preview-cover-foreground:focus-within .layout-image-slot::before {
        border-color: rgba(130, 130, 240, 0.95);
        background: rgba(80, 80, 170, 0.45);
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4),
                    inset 0 0 5.6cqh rgba(110, 110, 210, 0.3);
    }
    .layout-image-slot img {
        position: relative;
        z-index: 0;
        pointer-events: none;
    }
    .layout-page-text-display,
    .layout-page-text-input {
        position: absolute;
        inset: 0;
        box-sizing: border-box;
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        border: none;
        border-radius: 0;
        background: transparent;
        color: #000000;
        font-family: 'Ohno Softie', cursive;
        font-weight: normal;
        line-height: 1;
        font-size: 1.2vw;
        box-shadow: none;
    }
    .layout-page-text-display {
        cursor: text;
        word-break: break-word;
        overflow: auto;
    }
    .layout-page-text-display:hover,
    .layout-page-text-display:focus {
        outline: none;
    }
    .layout-page-text-display.layout-page-text-display--empty {
        opacity: 0.55;
        font-style: italic;
    }
    .layout-page-text-input {
        resize: none;
        font-family: 'Ohno Softie', cursive !important;
        font-weight: normal;
        color: #000000 !important;
        caret-color: #000000;
        background-color: transparent !important;
    }
    .layout-page-text-input:focus {
        outline: none;
        background-color: transparent !important;
        box-shadow: none;
        color: #000000 !important;
    }

    .layouts-field--story-title {
        min-width: 0;
        max-width: 100%;
    }
    .story-title-fit {
        display: inline-block;
        box-sizing: border-box;
        width: auto;
        min-width: 10rem;
        max-width: min(100%, 36rem);
        white-space: nowrap;
        field-sizing: content;
        font-weight: 700;
    }
    .story-title-display {
        cursor: text;
        height: 40px;
        display: inline-flex;
        align-items: center;
        border: 1px dashed transparent;
    }
    .story-title-input.form-control {
        width: auto;
        height: 40px;
        font-size: 0.875rem;
        line-height: 1.25;
        padding-block: 0.25rem;
    }
    .story-title-display:hover,
    .story-title-display:focus {
        outline: none;
        border-color: rgba(160, 160, 200, 0.45);
        background: rgba(128, 128, 160, 0.12);
    }
    .story-title-display.story-title-display--empty {
        color: var(--bs-secondary-color, #8b8fa3);
        font-style: italic;
    }
    .story-title-display[aria-disabled="true"] {
        cursor: not-allowed;
        pointer-events: none;
        opacity: 0.55;
    }
    .layouts-field {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    .layouts-field--preview {
        width: 100%;
        align-items: stretch;
        overflow: visible;
        flex: 1 1 auto;
        min-height: 0;
    }
    .layouts-preview-viewport {
        width: 100%;
        min-height: 8rem;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        overflow: hidden;
    }
    .story-layouts-editor #storyEditorPanel:not(.d-none) {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        min-height: 0;
    }
    .card:has(#layoutPreview),
    .card:has(#layoutPreview) > .card-body {
        overflow: visible;
    }
    .layouts-field--preview .layout-preview {
        flex: 0 0 auto;
    }
    .layouts-field > .form-label {
        margin-bottom: 0;
    }
    .layouts-pagination {
        align-items: flex-end;
    }
    .layouts-select-fit {
        display: inline-block;
        width: auto;
        max-width: 100%;
        field-sizing: content;
    }

.story-upsyn-diff-cell {
    max-width: 220px;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.8rem;
}

.story-upsyn-diff-cell--new {
    color: var(--mud-palette-primary);
}

.story-image-picker {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.story-image-picker.d-none {
    display: none !important;
}

.story-image-picker__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.story-image-picker__panel {
    position: relative;
    z-index: 1;
    width: min(720px, 100%);
    max-height: min(85vh, 520px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--mud-palette-surface, #fff);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.story-image-picker__close {
    border: none;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.25rem;
}

.story-image-picker__dropzone {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 7rem;
    padding: 1.25rem 1rem;
    border: 2px dashed var(--mud-palette-lines-default, rgba(0, 0, 0, 0.23));
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.story-image-picker__dropzone:hover,
.story-image-picker__dropzone:focus-visible {
    border-color: var(--mud-palette-primary, #594ae2);
    background: color-mix(in srgb, var(--mud-palette-primary, #594ae2) 6%, var(--mud-palette-background-grey, #f8f8fa));
    outline: none;
}

.story-image-picker__dropzone--active {
    border-color: var(--mud-palette-primary, #594ae2);
    background: color-mix(in srgb, var(--mud-palette-primary, #594ae2) 10%, var(--mud-palette-background-grey, #f8f8fa));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mud-palette-primary, #594ae2) 25%, transparent);
}

.story-image-picker__dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    text-align: center;
    pointer-events: none;
    user-select: none;
}

.story-image-picker__dropzone-icon {
    display: flex;
    color: var(--mud-palette-primary, #594ae2);
    opacity: 0.85;
}

.story-image-picker__dropzone-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary, #1a1a1a);
}

.story-image-picker__dropzone-hint {
    font-size: 0.75rem;
    color: var(--mud-palette-text-secondary, #666);
}

.story-image-picker__strip {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 0.75rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.35rem;
    flex: 0 0 auto;
    max-height: 9.5rem;
    scrollbar-width: thin;
}

.story-image-picker__strip::-webkit-scrollbar {
    height: 6px;
}

.story-image-picker__strip::-webkit-scrollbar-thumb {
    border-radius: 3px;
    background: var(--mud-palette-lines-default, rgba(0, 0, 0, 0.2));
}

.story-image-picker__empty {
    flex: 0 0 auto;
    padding: 0.5rem 0;
    font-size: 0.8rem;
    color: var(--mud-palette-text-secondary, #666);
    white-space: nowrap;
}

.story-image-picker__item {
    flex: 0 0 auto;
    width: 7.5rem;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 0.35rem;
    cursor: pointer;
    text-align: center;
}

.story-image-picker__item:hover,
.story-image-picker__item:focus {
    border-color: var(--mud-palette-primary, #594ae2);
    outline: none;
}

.story-image-picker__item img {
    display: block;
    width: 100%;
    height: 5.5rem;
    object-fit: contain;
    margin-bottom: 0.35rem;
}

.story-image-picker__item-label {
    display: block;
    font-size: 0.7rem;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--mud-palette-text-secondary, #666);
}

