/* ============================================================================
   composer.css — THE prompt composer (Views/Shared/_PromptComposer.cshtml), on the landing page AND Creations.
   Moved out of project.css whole (the composer core, the .aspect-ratio-* controls it shares with the detail modal,
   the AssetTagInput mirror, the Studio --st-* tokens), so both pages render the same component from one stylesheet.
   Load it AFTER project.css on Creations.
   ============================================================================ */
:root {
    --st-bg: #f6f6f7;
    --st-surface: #fff;
    --st-surface-2: #f2f2f4;
    --st-surface-3: #ebebee;
    --st-ink: #16161a;
    --st-ink-2: #55565e;
    --st-ink-3: #686973;
    --st-line: #e7e7ea;
    --st-line-2: #d8d8de;
    /* colour ROLES from THE token file (tailwind.theme.js -> css/_theme-vars.css; fixes doc 2, H-7): --st-brand is the
       one primary action (blue), --st-danger is errors / 0 credits / delete only. The fallbacks are the same values,
       for a page that does not load _theme-vars.css. */
    --st-brand: rgb(var(--color-action, 37 99 235));
    --st-brand-hover: rgb(var(--color-action-hover, 29 78 216));
    --st-brand-press: rgb(var(--color-action-press, 30 64 175));
    --st-brand-soft: rgb(var(--color-action-soft, 239 246 255));
    --st-brand-line: rgb(var(--color-action-line, 191 219 254));
    --st-danger: rgb(var(--color-error-dark, 220 38 38));
    --st-danger-press: rgb(var(--color-error-press, 185 28 28));
    --st-danger-soft: rgb(var(--color-error-soft, 254 242 242));
    --st-danger-line: rgb(var(--color-error-line, 254 202 202));
    --st-ok: #15803d;
    --st-ok-soft: #ecfdf3;
    --st-warn: #a15c07;
    --st-place: #4338ca;
    --st-ease: cubic-bezier(.16, 1, .3, 1);
    --st-sh-1: 0 1px 2px rgba(22,22,26,.06), 0 1px 1px rgba(22,22,26,.03);
    --st-sh-2: 0 10px 28px -12px rgba(22,22,26,.18), 0 2px 6px rgba(22,22,26,.05);
    --st-sh-3: 0 30px 70px -28px rgba(22,22,26,.30), 0 6px 16px rgba(22,22,26,.06);
}


/* The area design tokens the composer borrows (animation.css — same values), restated on the composer so it
   renders the same under the public layout, which does not load animation.css. Its pop-up layers (.cmp-layer — the
   "+" menu and the settings panel) live on <body>, outside .floating-prompt, so they get the same tokens and type. */
.floating-prompt,
.cmp-layer {
    --white: #FFFFFF;
    --gray-50: #FAFBFC;
    --gray-100: #F5F7FA;
    --gray-200: #E8ECF0;
    --gray-300: #D7DCE3;
    --gray-400: #A0A8B5;
    --gray-500: #6C7688;
    --gray-600: #4A5567;
    --gray-700: #2D3748;
    --gray-900: #0F1419;
    --radius-lg: 0.875rem;
    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    /* its own type, not the host page's (Creations inherits exactly these; the landing page's body differs) */
    font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 24px;
    color: var(--st-ink);
}
/* the landing page's own button rules (landing.css / video.css) clip these; in the composer they never clip */
.floating-prompt .aspect-ratio-btn,
.floating-prompt .prompt-create-btn {
    overflow: visible;
}

/* ========================================================
   The composer — the existing .floating-prompt, now the hero's composer (E-studio "the one object").
   In the page flow (no longer fixed); it grows as the user types (composer.js Composer.grow).
   ======================================================== */
.floating-prompt {
    position: relative;
    width: min(820px, 100%);
    z-index: 5;
}

.prompt-box.composer {
    position: relative;
    container: cmp / inline-size;   /* the box's OWN width drives the bar (@container cmp below) — the same on every page */
    display: flex;
    flex-direction: column;
    overflow: visible;
    background: var(--st-surface);
    border: 1px solid var(--st-line-2);
    border-radius: 22px;
    box-shadow: var(--st-sh-3);
    transition: border-color .2s var(--st-ease), box-shadow .2s var(--st-ease);
}

    .prompt-box.composer:hover {
        box-shadow: var(--st-sh-3);
    }

    .prompt-box.composer:focus-within {
        border-color: #c9c9d1;
        box-shadow: var(--st-sh-3), 0 0 0 4px rgba(220, 38, 38, .07);
    }

    /* "Use this" → a focus pulse; an empty Generate → a gentle shake */
    .prompt-box.composer.pulse {
        animation: stCmpPulse 1.1s var(--st-ease) 2;
    }

    .prompt-box.composer.shake {
        animation: stShake .42s var(--st-ease);
    }

@keyframes stCmpPulse {
    0% { box-shadow: var(--st-sh-3), 0 0 0 0 rgba(220, 38, 38, .32); }
    100% { box-shadow: var(--st-sh-3), 0 0 0 16px rgba(220, 38, 38, 0); }
}

@keyframes stShake {
    0%, 100% { transform: none; }
    20% { transform: translateX(-7px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(2px); }
}

/* The textarea section */
.floating-prompt .prompt-input-section {
    padding: 0;
}

.floating-prompt .prompt-input-wrapper {
    position: relative;
    display: block;
}

.floating-prompt .prompt-input,
.floating-prompt textarea#floatingPromptInput {
    display: block;
    width: 100%;
    min-height: 96px;
    max-height: none;
    padding: 20px 22px 8px;
    border: 0;
    outline: 0;
    background: transparent;
    resize: none;
    overflow-y: hidden;
    color: var(--st-ink);
    caret-color: var(--st-brand);
    font: 400 18px/1.55 Inter, system-ui, sans-serif;
    letter-spacing: 0;
    transition: height .22s var(--st-ease);
    box-shadow: none;
}

    /* the BOX shows focus (:focus-within ring above) — the textarea never draws its own (the landing page's Tailwind
       forms layer paints every focused textarea a square blue ring; the id beats it on every page) */
    .floating-prompt textarea#floatingPromptInput:focus,
    .floating-prompt textarea#floatingPromptInput:focus-visible {
        border: 0;
        outline: 0;
        box-shadow: none;
    }

    .floating-prompt .prompt-input::placeholder {
        color: #8b8c95;
    }

/* AssetTagInput / GeoPlaceInput chip strips sit under the text, on the TEXT's inset (22px, the textarea's padding).
   Scoped to .prompt-box.composer so the composer wins over the inputs' own generic ".prompt-input-wrapper … {padding:0}"
   whatever order the pages load them in (that tie put the place chip flush on the box edge). */
.floating-prompt .prompt-box.composer .ati-tag-strip,
.floating-prompt .prompt-box.composer .gpi-chip-strip,
.floating-prompt .prompt-box.composer .pa-chips {
    padding: 0 22px;
    box-sizing: border-box;
}

    .floating-prompt .prompt-box.composer .ati-tag-strip:not(:empty) {
        padding-bottom: 6px;
    }

.floating-prompt .prompt-box.composer .gpi-chip-strip {
    margin: 0 0 6px;
}

.floating-prompt .ati-upload-indicator {
    padding: 2px 20px 6px;
}

/* The affordance row (prompt-affordances.js) still exists — the "+" menu clicks its pills — but the
   composer shows it as the "+" menu, never as a second row. */
.floating-prompt .pa-bar {
    display: none !important;
}

/* The "Started from …" banner */
.cmp-from {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 12px 18px 0 20px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--st-ink-2);
}

    .cmp-from[hidden] {
        display: none;
    }

    .cmp-from i {
        color: var(--st-brand);
        font-size: 16px;
        flex: none;
    }

    .cmp-from b {
        color: var(--st-ink);
        font-weight: 600;
    }

.cmp-link {
    margin-left: auto;
    flex: none;
    border: 0;
    background: none;
    padding: 0;
    color: var(--st-brand-press);
    font: 600 13px/1 Inter, system-ui, sans-serif;
    cursor: pointer;
}

    .cmp-link:hover {
        text-decoration: underline;
        text-underline-offset: 3px;
    }

/* The one error line (ids kept: #floatingInlineError / #floatingErrorMessage) */
.floating-prompt .inline-error-message.cmp-err {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 0;
    padding: 0 20px 10px;
    background: none;
    border: 0;
    border-radius: 0;
    color: var(--st-danger);
    font-size: 13px;
    line-height: 1.45;
}

    .floating-prompt .inline-error-message.cmp-err.ds-hidden {
        display: none !important;
    }

    .floating-prompt .inline-error-message.cmp-err i {
        font-size: 16px;
        margin-top: 1px;
    }

.floating-prompt .url-warning-inline {
    margin: 0 20px 8px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #fff8eb;
    border: 1px solid #f4d49a;
    color: #7a4605;
    font-size: 13px;
    align-items: center;
    gap: 8px;
}

/* Toolbar — ONE row (owner sample A): + Add · the settings chip ……… Preview first · Generate.
   One control height (--cmp-h), one radius, one outline; nothing wraps by accident (only a phone gets two DELIBERATE rows). */
.floating-prompt .prompt-toolbar {
    --cmp-h: 36px;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 6px 12px 12px 14px;
    border-top: 0;
}

.floating-prompt .prompt-toolbar-left {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
}

.floating-prompt .prompt-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex: none;
}

/* "+" Add — Element · Upload · Place */
.cmp-plus-wrap {
    position: relative;
    display: inline-flex;
    order: -2;
}

.floating-prompt .ati-upload-wrapper {
    order: -1;
}

    /* AssetTagInput's own upload button lives on as the "+" menu's Upload — shown only while it reports progress */
    .floating-prompt .ati-upload-wrapper .ati-upload-btn:not(.ati-upload-uploading):not(.ati-upload-finalizing):not(.ati-upload-indeterminate) {
        display: none !important;
    }

.cmp-plus {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px 0 9px;
    border-radius: 10px;
    border: 1px solid var(--st-line);
    background: var(--st-surface);
    color: var(--st-ink);
    font: 550 13.5px/1 Inter, system-ui, sans-serif;
    cursor: pointer;
    transition: background .15s var(--st-ease), border-color .15s var(--st-ease);
}

    .cmp-plus i {
        font-size: 17px;
    }

    .cmp-plus:hover {
        background: var(--st-surface-2);
    }

    .cmp-plus[aria-expanded="true"] {
        background: #effcf9;
        border-color: #b9ebe2;
        color: #0f766e;
    }

/* on <body>, placed from the viewport by composer.js _place (never clipped by the box, docked or not) */
.cmp-plus-menu {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 10040;
    display: grid;
    gap: 2px;
    width: 280px;
    padding: 6px;
    background: var(--st-surface);
    border: 1px solid var(--st-line);
    border-radius: 14px;
    box-shadow: var(--st-sh-3);
    opacity: 0;
    transform: translateY(-4px) scale(.98);
    transform-origin: top left;
    transition: opacity .18s var(--st-ease), transform .18s var(--st-ease);
}

    .cmp-plus-menu[hidden] {
        display: none;
    }

    .cmp-plus-menu.open {
        opacity: 1;
        transform: none;
    }

    .cmp-plus-menu[data-side="top"] {
        transform-origin: bottom left;
    }

    .cmp-plus-menu button {
        display: flex;
        gap: 10px;
        align-items: flex-start;
        width: 100%;
        padding: 9px 10px;
        border: 0;
        border-radius: 9px;
        background: transparent;
        text-align: left;
        color: var(--st-ink);
        font: 600 14px/1.3 Inter, system-ui, sans-serif;
        cursor: pointer;
    }

        .cmp-plus-menu button[hidden] {
            display: none;
        }

        .cmp-plus-menu button:hover,
        .cmp-plus-menu button:focus-visible {
            background: var(--st-surface-2);
            outline: none;
        }

        .cmp-plus-menu button i {
            margin-top: 1px;
            font-size: 17px;
            color: var(--st-ink-2);
        }

    .cmp-plus-menu small {
        display: block;
        margin-top: 2px;
        font-size: 12px;
        font-weight: 400;
        color: var(--st-ink-3);
    }

.cmp-plus-none {
    padding: 10px;
    font-size: 13px;
    color: var(--st-ink-2);
}

/* The settings chip — summarises every film setting ("9:16 · 720p · 30 fps · ▣ Topo"); opens #cmpSet */
.cmp-set-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    height: var(--cmp-h, 36px);
    padding: 0 10px;
    border: 1px solid var(--st-line);
    border-radius: 10px;
    background: var(--st-surface);
    color: var(--st-ink);
    font: 550 13.5px/1 Inter, system-ui, sans-serif;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s var(--st-ease), border-color .15s var(--st-ease);
}

    .cmp-set-btn:hover { background: var(--st-surface-2); }
    .cmp-set-btn[aria-expanded="true"] { background: var(--st-surface-2); border-color: var(--st-ink-3); }
    .cmp-set-btn:focus-visible { outline: 2px solid var(--st-brand); outline-offset: 2px; }
    .cmp-ic { width: 16px; height: 16px; flex: none; color: var(--st-ink-2); }
    .cmp-chev { width: 14px; height: 14px; flex: none; color: var(--st-ink-3); }
    /* one line that ends in "…" when the toolbar is tight (Story Mode adds ✨ Plan) — a block, because a flex box cannot ellipsis */
    .cmp-sum { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2; }
    .cmp-sum b { font-weight: 650; }
    .cmp-sum-2, .cmp-sum-3 { display: inline; color: var(--st-ink-2); }   /* inline, not flex: flex drops the spaces around "·" */
    .cmp-sum-2[hidden], .cmp-sum-3[hidden], .cmp-sum [hidden] { display: none; }
    .cmp-sum-swatch { width: 16px; height: 16px; margin-right: 5px; border-radius: 4px; border: 1px solid var(--st-line-2); object-fit: cover; vertical-align: -3px; display: inline-block; }   /* Tailwind's preflight makes img a block (landing) */

/* The settings panel — every option at once, grouped; placed under the chip (composer.js), a bottom sheet on a phone */
.cmp-set {
    position: fixed;   /* on <body>, placed from the viewport by composer.js _place */
    z-index: 10040;
    width: 368px;
    max-width: calc(100vw - 16px);
    padding: 14px;
    background: var(--st-surface);
    border: 1px solid var(--st-line);
    border-radius: 14px;
    box-shadow: var(--st-sh-3);
    font-family: Inter, system-ui, sans-serif;
    animation: cmpSetIn .16s var(--st-ease);
}

    .cmp-set[hidden] { display: none; }
    /* never taller than the viewport; "All styles" scrolls its own grid (about three rows of tiles) */
    .cmp-set { max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); overflow: auto; overscroll-behavior: contain; }
    .cmp-set .mtb-grid { max-height: 312px; overflow: auto; overscroll-behavior: contain; }
    .cmp-set-sec + .cmp-set-sec { margin-top: 14px; }
    .cmp-set-sec[hidden], .cmp-set-off { display: none; }
    .cmp-set.is-all .cmp-set-sec + .cmp-set-sec { margin-top: 0; }
    .cmp-set-h {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        margin: 0 0 6px;
        font-size: 12px;
        font-weight: 600;
        letter-spacing: .02em;
        color: var(--st-ink-3);
    }
    .cmp-set-h small { font-size: 11.5px; font-weight: 500; }
    .cmp-set-h small a { color: var(--st-brand-press); font-weight: 600; text-decoration: none; }
    .cmp-set-h small a:hover { text-decoration: underline; }

@keyframes cmpSetIn { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* a row of choices — outlined like every other control (no grey slab) */
.cmp-seg {
    display: flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--st-line-2);
    border-radius: 10px;
    background: var(--st-surface);
}

    .cmp-seg button {
        flex: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        height: 30px;
        padding: 0 8px;
        border: 0;
        border-radius: 7px;
        background: transparent;
        color: var(--st-ink-2);
        font: 550 13px/1 Inter, system-ui, sans-serif;
        white-space: nowrap;
        cursor: pointer;
    }
    .cmp-seg button:hover { color: var(--st-ink); }
    .cmp-seg button[aria-checked="true"] { background: var(--st-surface-3); color: var(--st-ink); font-weight: 650; }
    .cmp-seg button:focus-visible { outline: 2px solid var(--st-brand); outline-offset: -2px; }
    .cmp-seg button.locked { color: #a3a3ab; cursor: not-allowed; }
    .cmp-lock { width: 12px; height: 12px; }

/* Preview first — the real checkbox inside a switch */
.cmp-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 10px 0 6px;
    border-radius: 10px;
    color: var(--st-ink);
    font: 550 13px/1 Inter, system-ui, sans-serif;
    cursor: pointer;
    user-select: none;
}

    .cmp-switch:hover {
        background: var(--st-surface-2);
    }

    .cmp-switch input {
        position: absolute;
        opacity: 0;
        width: 1px;
        height: 1px;
        margin: 0;
        pointer-events: none;
    }

    .cmp-switch .knob {
        position: relative;
        flex: none;
        width: 30px;
        height: 18px;
        border-radius: 999px;
        background: #c9c9d1;
        transition: background .2s var(--st-ease);
    }

        .cmp-switch .knob::after {
            content: "";
            position: absolute;
            top: 2px;
            left: 2px;
            width: 14px;
            height: 14px;
            border-radius: 50%;
            background: #fff;
            box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
            transition: transform .2s var(--st-ease);
        }

    .cmp-switch input:checked + .knob {
        background: var(--st-brand);
    }

        .cmp-switch input:checked + .knob::after {
            transform: translateX(12px);
        }

    .cmp-switch input:focus-visible + .knob {
        outline: 2px solid var(--st-brand);
        outline-offset: 2px;
    }

    .cmp-switch .lbl-short { display: none; }

/* Generate — the ONE red primary; its label carries the price (preview-flow.js) */
.floating-prompt .prompt-create-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;   /* the composer owns its button: the legacy .prompt-create-btn { min-width:120px } (animation.css, landing.css) never applies */
    height: var(--cmp-h, 36px);
    padding: 0 14px;
    border: 1px solid var(--st-brand);
    border-radius: 10px;
    background: var(--st-brand);
    color: #fff;
    font: 600 14px/1 Inter, system-ui, sans-serif;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 6px 16px -8px rgba(220,38,38,.7);
    transition: background .15s var(--st-ease), border-color .15s var(--st-ease), transform .15s var(--st-ease);
}

    .floating-prompt .prompt-create-btn:hover {
        background: var(--st-brand-hover);
        border-color: var(--st-brand-hover);
    }

    .floating-prompt .prompt-create-btn:active {
        background: var(--st-brand-press);
        transform: scale(.98);
    }

    .floating-prompt .prompt-create-btn:disabled,
    .floating-prompt .prompt-create-btn.processing {
        background: #e4a3a3;
        border-color: #e4a3a3;
        box-shadow: none;
        cursor: progress;
    }

    .floating-prompt .prompt-create-btn i {
        font-size: 16px;
    }

.cmp-sub {
    margin: -2px 0 0;
    padding: 0 22px 12px;
    color: var(--st-ink-3);
    font-size: 12.5px;
    line-height: 1.45;
}

    .cmp-sub b {
        color: var(--st-ink-2);
        font-weight: 600;
    }

    .cmp-sub.warn {
        color: #7a4605;
    }

    /* nothing to say (signed in, credits fine, Preview first on): the line takes no room */
    .cmp-sub:empty {
        display: none;
    }

/* The phone "Create" pill is retired — the composer itself docks to the bottom (see "Docked composer") */
.floating-mobile-trigger {
    display: none !important;
}

.prompt-mobile-close {
    display: none !important;
}

@media (max-width: 899px) {
    .floating-prompt .prompt-input,
    .floating-prompt textarea#floatingPromptInput {
        font-size: 16px;
        padding: 16px 16px 6px;
    }

    .floating-prompt .prompt-box.composer .ati-tag-strip,
    .floating-prompt .prompt-box.composer .gpi-chip-strip,
    .floating-prompt .prompt-box.composer .pa-chips,
    .floating-prompt .cmp-sub,
    .floating-prompt .inline-error-message.cmp-err {
        padding-left: 16px;
        padding-right: 16px;
    }

    .floating-prompt .prompt-toolbar {
        padding: 6px 10px 10px;
    }

    .cmp-from {
        padding: 10px 14px 0 16px;
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .cmp-plus-menu {
        width: min(280px, calc(100vw - 48px));
    }
}

/* THE bar's widths — by the BOX's width (container cmp), so the landing page, Creations and a phone follow one rule set.
   As the box narrows: the map leaves the summary → quality/fps leave it → the switch says "Preview", Add is "+", the price
   becomes "⚡2" → a phone gets two deliberate rows (settings above; the decision — switch + full-width Generate — below). */
@container cmp (max-width: 700px) {
    .cmp-sum-3 { display: none !important; }
}
@container cmp (max-width: 580px) {
    .cmp-sum-2 { display: none !important; }
    .cmp-switch .lbl-long { display: none; }
    .cmp-switch .lbl-short { display: inline; }
}
@container cmp (max-width: 500px) {
    .cmp-plus .lbl { display: none; }
    .cmp-plus { width: var(--cmp-h, 36px); padding: 0; justify-content: center; }
    .floating-prompt .prompt-create-btn .pv-price-long { display: none; }
    .floating-prompt .prompt-create-btn .pv-price-short { display: inline-flex; }
}
@container cmp (max-width: 400px) {
    .floating-prompt .prompt-toolbar { flex-wrap: wrap; }
    .floating-prompt .prompt-toolbar-right { flex-basis: 100%; }
    .floating-prompt .prompt-toolbar-right .prompt-create-btn { flex: 1 1 auto; }
    /* two full-width rows have ROOM again: words come back ("Add", "9:16 · 720p · 30 fps", "Preview · 2 credits") */
    .cmp-sum-2 { display: inline !important; }
    .cmp-plus .lbl { display: inline; }
    .cmp-plus { width: auto; padding: 0 12px 0 9px; }
    .floating-prompt .prompt-create-btn .pv-price-long { display: inline; }
    .floating-prompt .prompt-create-btn .pv-price-short { display: none; }
}
/* the smallest phones (320 px): the compact forms again */
@container cmp (max-width: 300px) {
    .cmp-sum-2 { display: none !important; }
    .cmp-plus .lbl { display: none; }
    .cmp-plus { width: var(--cmp-h, 36px); padding: 0; justify-content: center; }
    .floating-prompt .prompt-create-btn .pv-price-long { display: none; }
    .floating-prompt .prompt-create-btn .pv-price-short { display: inline-flex; }
    /* decoration goes before words: the sparkle leaves, the padding tightens (label + price stay) */
    .floating-prompt .prompt-create-btn > i { display: none; }
    .floating-prompt .prompt-create-btn { min-width: 0; padding: 0 12px; }
}

/* a phone: the settings panel is a bottom sheet (thumb reach, never off-screen) */
@media (max-width: 520px) {
    .cmp-set {
        position: fixed;
        left: 8px !important;
        right: 8px;
        top: auto !important;
        bottom: 8px;
        width: auto;
        max-width: none;
        max-height: 78vh;
        max-height: 78dvh;
        overflow: auto;
        border-radius: 18px;
        z-index: 10040;
        padding-top: 10px;
        animation: cmpSheetUp .28s var(--st-ease);
    }

        /* the grab handle — it reads as a sheet you can dismiss */
        .cmp-set::before {
            content: "";
            display: block;
            width: 36px;
            height: 4px;
            margin: 0 auto 10px;
            border-radius: 2px;
            background: var(--st-line-2);
        }

    /* the scrim: the sheet is a layer ABOVE the page (a tap on it closes the sheet — composer.js outside-click) */
    html.cmp-sheet-open body::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 10039;
        background: rgba(15, 17, 21, .32);
        animation: cmpScrimIn .2s ease-out;
    }
}

@keyframes cmpSheetUp { from { transform: translateY(calc(100% + 8px)); } }
@keyframes cmpScrimIn { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
    .cmp-set, html.cmp-sheet-open body::after { animation: none; }
}

@keyframes stPopIn {
    from { opacity: 0; transform: translate(-50%, 8px); }
}

@media (prefers-reduced-motion: reduce) {
    .prompt-box.composer.shake,
    .prompt-box.composer.pulse {
        animation: none;
    }

    .floating-prompt .prompt-input {
        transition: none;
    }
}

/* Aspect Ratio Wrapper */
.aspect-ratio-wrapper {
    position: relative;
}

.aspect-ratio-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-700);
}

    .aspect-ratio-btn:hover {
        background: var(--gray-100);
        border-color: var(--gray-300);
    }

    .aspect-ratio-btn i {
        font-size: 1.125rem;
        color: var(--gray-700);
    }

    .aspect-ratio-btn .ratio-text {
        color: var(--gray-900);
        font-weight: 600;
    }

    .aspect-ratio-btn .dropdown-arrow {
        font-size: 0.875rem;
        color: var(--gray-400);
        margin-left: 0.25rem;
        transition: transform var(--transition);
    }

        .aspect-ratio-btn .dropdown-arrow.bx-rotate-180 {
            transform: rotate(180deg);
        }

.aspect-ratio-dropdown {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
}

    .aspect-ratio-dropdown button {
        width: 100%;
        padding: 0.75rem 1rem;
        border: none;
        background: transparent;
        text-align: left;
        cursor: pointer;
        transition: all var(--transition);
        display: flex;
        align-items: center;
        gap: 0.75rem;
        font-size: 0.875rem;
        color: var(--gray-700);
        font-weight: 500;
    }

        .aspect-ratio-dropdown button:hover {
            background: var(--gray-50);
        }

        .aspect-ratio-dropdown button i {
            font-size: 1.25rem;
            color: var(--gray-600);
            width: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .aspect-ratio-dropdown button .ratio-info {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 0.125rem;
        }

        .aspect-ratio-dropdown button .ratio-label {
            color: var(--gray-900);
            font-weight: 500;
        }

        .aspect-ratio-dropdown button .ratio-value {
            color: var(--gray-500);
            font-size: 0.75rem;
            font-weight: 400;
        }

/* ============================================================================
   The composer shows its own text through AssetTagInput's mirror (.ati-backdrop — same box, font, wrap,
   scroll; asset-tag-input.js keeps it aligned on input, scroll and resize). The native textarea stays on
   top for the caret, selection and typing, with its glyphs transparent; the mirror paints the words, the
   [tag] / @{place} tokens as soft chips and their punctuation nearly invisible. Chips use background +
   inset shadow only (no padding / weight change) so no glyph moves. Only once ATI has wrapped the
   textarea (.ati-input-row) — without the mirror the text stays plainly visible.
   ============================================================================ */
.floating-prompt .ati-input-row textarea#floatingPromptInput {
    color: transparent;
    background: transparent;
}

    .floating-prompt .ati-input-row textarea#floatingPromptInput::placeholder {
        color: #8b8c95;
    }

    .floating-prompt .ati-input-row textarea#floatingPromptInput::selection {
        background: rgba(220, 38, 38, .18);
        color: transparent;
    }

.floating-prompt .ati-backdrop {
    color: var(--st-ink);
    z-index: 0;
}

.floating-prompt .ati-backdrop .ati-highlight {
    color: #0f766e;
    background: #effcf9;
    box-shadow: inset 0 0 0 1px #b9ebe2;
    border-radius: 6px;
}

.floating-prompt .ati-backdrop .ati-highlight-place {
    color: var(--st-place);
    background: #f0f1ff;
    box-shadow: inset 0 0 0 1px #cfd3fb;
    border-radius: 999px;
}

.floating-prompt .ati-backdrop .ati-brace {
    opacity: .16;
}

/* "Preview · 2 credits" / "Render · up to 8 credits" — the price slot is preview-flow.js initComposer's (both pages); hidden while a submit is in flight */
#createFromPrompt.processing .pv-price {
    display: none;
}

/* its short form ("⚡2") — shown only when the box is narrow (@container cmp above) */
.prompt-create-btn .pv-price-short {
    display: none;
    align-items: center;
    gap: 2px;
    margin-left: 2px;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, .18);
    font-size: 12.5px;
    font-weight: 650;
}

    .prompt-create-btn .pv-price-short svg {
        width: 12px;
        height: 12px;
    }


/* Processing state (submit in flight) — after the composer's own button rule so it wins */
.floating-prompt .prompt-create-btn.processing {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    cursor: not-allowed;
    opacity: 0.8;
}

/* ── engine doc 06 §11 Part B — STORY MODE switch · ✨ Plan · the plan chips · the AI note ─────────────────────────────── */
.cmp-story, .cmp-plan-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: var(--cmp-h, 36px);
    padding: 0 11px 0 9px;
    border: 1px solid var(--st-line);
    border-radius: 10px;
    background: var(--st-surface);
    color: var(--st-ink-2);
    font: 550 13.5px/1 Inter, system-ui, sans-serif;
    white-space: nowrap;
    cursor: pointer;
    flex: none;
    transition: background .15s var(--st-ease), border-color .15s var(--st-ease), color .15s var(--st-ease);
}
    .cmp-story[hidden], .cmp-plan-btn[hidden] { display: none; }
    .cmp-story i { font-size: 16px; }
    .cmp-story:hover, .cmp-plan-btn:hover { background: var(--st-surface-2); }
    .cmp-story:focus-visible, .cmp-plan-btn:focus-visible { outline: 2px solid var(--st-brand); outline-offset: 2px; }
    .cmp-story.on { background: var(--st-brand-soft); border-color: var(--st-brand-line); color: var(--st-brand-press); }
    .cmp-story-cost { font-size: 12px; font-weight: 600; color: var(--st-ink-3); }
    .cmp-story.on .cmp-story-cost { color: var(--st-brand); }
    .cmp-plan-btn.processing { opacity: .6; cursor: progress; }

.cmp-plan { padding: 10px 14px 0; }
    .cmp-plan[hidden] { display: none; }
    .cmp-plan-h { margin: 0 0 6px; font: 600 12.5px/1.3 Inter, system-ui, sans-serif; color: var(--st-ink); }
    .cmp-plan-h small { font-weight: 500; color: var(--st-ink-3); }
    .cmp-plan-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
    .cmp-plan-chip { display: inline-flex; align-items: center; max-width: 100%; border: 1px solid var(--st-brand-line); border-radius: 999px; background: var(--st-brand-soft); }
    .cmp-plan-v { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 4px 4px 4px 10px; border: 0; background: none; color: var(--st-ink); font: 500 12.5px/1.3 Inter, system-ui, sans-serif; cursor: text; }
    .cmp-plan-x { width: 24px; height: 24px; border: 0; border-radius: 999px; background: none; color: var(--st-ink-3); font-size: 15px; line-height: 1; cursor: pointer; }
    .cmp-plan-x:hover { color: var(--st-danger); }
    .cmp-plan-in { min-width: 160px; height: 26px; padding: 0 8px; border: 1px solid var(--st-brand); border-radius: 999px; font: 500 12.5px Inter, system-ui, sans-serif; }

.cmp-story-note { margin: 0; padding: 0 14px 10px; font-size: 12px; color: var(--st-ink-3); }
    .cmp-story-note[hidden] { display: none; }

@container cmp (max-width: 580px) {
    .cmp-story .lbl, .cmp-plan-btn .lbl { display: none; }
    .cmp-story, .cmp-plan-btn { padding: 0 8px; }
}
@container cmp (max-width: 400px) {
    .cmp-story-cost { display: none; }
}
