/* ==========================================================================
   QuixCard Creator
   Part 1 of 3
   Page layout, header, progress bar, and accordion
   ========================================================================== */

.creator-page {
    position: relative;
    height: calc(100dvh - 76px);
    min-height: calc(100dvh - 76px);
    max-height: calc(100dvh - 76px);
    padding: clamp(14px, 2.4vh, 28px) 0 clamp(10px, 1.6vh, 18px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(
            circle at 12% 12%,
            rgba(123, 97, 255, 0.12),
            transparent 28%
        ),
        radial-gradient(
            circle at 88% 18%,
            rgba(49, 87, 213, 0.12),
            transparent 30%
        ),
        linear-gradient(
            180deg,
            #f8faff 0%,
            #f4f7fc 48%,
            #f7f9fc 100%
        );
}

.creator-page::before,
.creator-page::after {
    content: "";
    position: absolute;
    z-index: 0;
    border-radius: 999px;
    pointer-events: none;
    filter: blur(2px);
}

.creator-page::before {
    top: 130px;
    left: -160px;
    width: 360px;
    height: 360px;
    background: rgba(123, 97, 255, 0.07);
}

.creator-page::after {
    right: -210px;
    bottom: 90px;
    width: 440px;
    height: 440px;
    background: rgba(49, 87, 213, 0.06);
}

.creator-shell {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(1380px, calc(100% - 48px));
    height: 100%;
    min-height: 0;
}

.creator-header {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    margin-bottom: clamp(10px, 1.8vh, 20px);
}

.creator-header-copy {
    max-width: 620px;
    min-width: 0;
}

.creator-header .eyebrow {
    margin-bottom: 4px;
    font-size: 0.72rem;
}

.creator-header h1 {
    max-width: 620px;
    margin-bottom: 3px;
    overflow: hidden;
    font-size: clamp(1.3rem, 2.1vw, 1.7rem);
    line-height: 1.15;
    letter-spacing: -0.03em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.creator-intro {
    max-width: 560px;
    margin: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================================================
   Main creator layout
   ========================================================================== */

.creator-form {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.required-fields-note {
    flex: 0 0 auto;
}

.creator-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.02fr) minmax(360px, 0.98fr);
    align-items: stretch;
    gap: clamp(20px, 3vw, 44px);
    flex: 1 1 auto;
    min-height: 0;
}

.creator-controls {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 1px solid rgba(205, 213, 224, 0.9);
    border-radius: 18px;
    background: rgba(236, 240, 247, 0.65);
    box-shadow:
        0 22px 50px rgba(28, 40, 72, 0.09),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(16px);
}

/* ==========================================================================
   Tabs
   ========================================================================== */

.creator-tabs {
    display: flex;
    flex: 0 0 auto;
    gap: 4px;
    padding: 10px 10px 0;
}

.creator-tab {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 1 1 0;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 11px 14px;
    border: 0;
    border-radius: 14px 14px 0 0;
    background: transparent;
    color: var(--muted);
    text-align: left;
    cursor: pointer;
    transition:
        background 180ms ease,
        color 180ms ease;
}

.creator-tab:hover:not(.is-active) {
    background: rgba(255, 255, 255, 0.45);
    color: var(--ink);
}

.creator-tab.is-active {
    z-index: 2;
    background: white;
    color: var(--ink);
    box-shadow: 0 -6px 20px rgba(28, 40, 72, 0.05);
}

.creator-tab-number {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid #dce2ec;
    border-radius: 9px;
    background: #f1f4f9;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 900;
    transition:
        color 180ms ease,
        border-color 180ms ease,
        background 180ms ease,
        box-shadow 180ms ease;
}

.creator-tab.is-active .creator-tab-number {
    border-color: transparent;
    background: linear-gradient(
        135deg,
        var(--primary),
        var(--accent)
    );
    color: white;
    box-shadow: 0 8px 18px rgba(49, 87, 213, 0.24);
}

.creator-tab.is-complete:not(.is-active) .creator-tab-number {
    border-color: rgba(22, 121, 77, 0.18);
    background: rgba(22, 121, 77, 0.09);
    color: var(--success);
}

.creator-tab-heading {
    display: grid;
    min-width: 0;
    gap: 1px;
}

.creator-tab-heading strong {
    overflow: hidden;
    color: inherit;
    font-size: 0.86rem;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.creator-tab-heading small {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 550;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.creator-tab-status {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
}

.creator-tab-check {
    display: none;
    width: 20px;
    height: 20px;
    place-items: center;
    border-radius: 50%;
    background: rgba(22, 121, 77, 0.12);
    color: var(--success);
    font-size: 0.66rem;
    font-weight: 900;
}

.creator-tab.is-complete .creator-tab-check {
    display: grid;
}

/* ==========================================================================
   Tab panels
   ========================================================================== */

.creator-tab-panels {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    background: white;
}

.creator-step-panel {
    display: none;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    background: white;
}

.creator-step-panel.is-open {
    display: flex;
}

.creator-step-panel[hidden] {
    display: none;
}

.creator-step-content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    padding: 18px 22px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #c8d0dc transparent;
}

.creator-step-content > :first-child {
    margin-top: 0;
}

.creator-step-content > :last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   Step actions
   ========================================================================== */

.creator-step-actions {
    display: flex;
    flex: 0 0 auto;
    justify-content: flex-end;
    gap: 12px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.creator-step-actions-split {
    justify-content: space-between;
}

.creator-next-button {
    min-width: 150px;
}

/* ==========================================================================
   Creator-side form grid baseline
   ========================================================================== */

.creator-page .field-grid {
    gap: 10px;
}

.creator-page .field {
    gap: 4px;
}

.creator-page .field label {
    color: #263147;
    font-size: 0.82rem;
    font-weight: 800;
}

.required-fields-note {
    flex-shrink: 0;
    margin: 0 0 8px;
    color: #667085;
    font-size: 0.76rem;
    font-weight: 600;
}

.required-indicator {
    color: #d62828;
    font-weight: 800;
    margin-left: 0.15rem;
}

.creator-page .field small {
    font-size: 0.76rem;
    line-height: 1.35;
}

.creator-page .privacy-note {
    flex: 0 0 auto;
    margin-top: 10px;
    padding: 9px 13px;
    border: 1px solid rgba(49, 87, 213, 0.12);
    border-left: 4px solid var(--primary);
    border-radius: 11px;
    background: rgba(49, 87, 213, 0.07);
    color: #3f558f;
    font-size: 0.74rem;
    line-height: 1.4;
}

/* ==========================================================================
   Small-screen header adjustments
   ========================================================================== */

@media (max-width: 1080px) {
    .creator-layout {
        grid-template-columns: minmax(0, 1fr) minmax(340px, 0.85fr);
        gap: 30px;
    }
}

@media (max-width: 900px) {
    .creator-header h1,
    .creator-intro {
        white-space: normal;
    }
}

/* ==========================================================================
   QuixCard Creator
   Part 2A
   Form controls, upload area, buttons, ready card, and generation states
   ========================================================================== */

/* ==========================================================================
   Form controls
   ========================================================================== */

.creator-page .field input,
.creator-page .field select,
.creator-page .field textarea {
    border: 1px solid #ccd5e2;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--ink);
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease,
        background 160ms ease;
}

.creator-page .field input,
.creator-page .field select {
    min-height: 38px;
    padding: 0 12px;
}

.creator-page .field textarea {
    height: clamp(44px, 8vh, 68px);
    padding: 8px 12px;
    line-height: 1.45;
    resize: vertical;
}

[data-creator-step="1"] .field-full textarea {
    height: clamp(50px, 9vh, 80px);
}

.creator-page .field input::placeholder,
.creator-page .field textarea::placeholder {
    color: #98a3b2;
}

.creator-page .field input:hover,
.creator-page .field select:hover,
.creator-page .field textarea:hover {
    border-color: #b7c2d1;
}

.creator-page .field input:focus,
.creator-page .field select:focus,
.creator-page .field textarea:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(49, 87, 213, 0.11);
}

.creator-page .field-error {
    margin-top: 2px;
    color: var(--danger);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.4;
}

.creator-page .field-help {
    align-items: flex-start;
    margin-top: 2px;
}

.creator-page .field-help span:last-child {
    flex: 0 0 auto;
    color: #7f8b9d;
    font-variant-numeric: tabular-nums;
}

.creator-page .field-help span.is-over-limit {
    color: var(--danger, #b42318);
    font-weight: 750;
}

.split-layout-toggle-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.7);
    cursor: pointer;
}

.split-layout-toggle-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    flex: 0 0 auto;
}

.split-layout-toggle-label small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.35;
}

.creator-page select {
    cursor: pointer;
}

.creator-page textarea {
    scrollbar-width: thin;
    scrollbar-color: #c8d0dc transparent;
}

/* ==========================================================================
   Portrait upload card
   ========================================================================== */

.portrait-upload-card {
    position: relative;
    display: grid;
    gap: 6px;
    padding: 8px 10px;
    overflow: hidden;
    border: 1px dashed #b9c5d5;
    border-radius: 13px;
    background:
        linear-gradient(
            145deg,
            rgba(248, 250, 255, 0.98),
            rgba(243, 246, 252, 0.96)
        );
    transition:
        border-color 170ms ease,
        background 170ms ease,
        box-shadow 170ms ease,
        transform 170ms ease;
}

.portrait-upload-card::after {
    content: "";
    position: absolute;
    top: -70px;
    right: -60px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(123, 97, 255, 0.06);
    pointer-events: none;
}

.portrait-upload-card:hover {
    border-color: rgba(49, 87, 213, 0.55);
    background:
        linear-gradient(
            145deg,
            rgba(247, 249, 255, 1),
            rgba(240, 244, 252, 1)
        );
    box-shadow: 0 12px 28px rgba(28, 40, 72, 0.06);
    transform: translateY(-1px);
}

.portrait-upload-heading {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 8px;
}

.portrait-upload-heading label {
    display: block;
    margin-bottom: 1px;
    font-size: 0.8rem;
    font-weight: 750;
}

.portrait-upload-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.25;
}

.portrait-upload-card input[type="file"] {
    position: relative;
    z-index: 1;
    min-height: auto;
    padding: 6px;
    border: 1px solid #d4dce7;
    border-radius: 10px;
    background: white;
    color: var(--muted);
    font-size: 0.8rem;
    cursor: pointer;
}

.portrait-upload-card input[type="file"]::file-selector-button {
    min-height: 30px;
    margin-right: 9px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    background: var(--ink);
    color: white;
    font-size: 0.8rem;
    font-weight: 750;
    cursor: pointer;
    transition:
        background 160ms ease,
        transform 160ms ease;
}

.portrait-upload-card input[type="file"]::file-selector-button:hover {
    background: #28344b;
}

.portrait-file-status {
    position: relative;
    z-index: 1;
    color: #748094;
    font-size: 0.72rem;
    font-weight: 650;
}

.portrait-file-status.has-file {
    color: var(--success);
}

/* ==========================================================================
   Creator buttons
   ========================================================================== */

.creator-page .button {
    min-height: 40px;
    border-radius: 11px;
    box-shadow: none;
}

.creator-page .button:hover {
    box-shadow: 0 12px 26px rgba(49, 87, 213, 0.2);
}

.creator-page .button-secondary {
    border-color: #d1d9e5;
    background: rgba(255, 255, 255, 0.92);
    color: #263147;
}

.creator-page .button-secondary:hover {
    border-color: #bec8d7;
    background: #f2f5f9;
    box-shadow: none;
}

.creator-submit-button {
    min-height: 46px !important;
    font-size: 0.96rem;
    letter-spacing: -0.01em;
    box-shadow: 0 15px 32px rgba(49, 87, 213, 0.22) !important;
}

.creator-submit-button:hover {
    box-shadow: 0 18px 36px rgba(49, 87, 213, 0.27) !important;
}

.creator-page button:disabled,
.creator-page input[type="submit"]:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
    box-shadow: none;
}

/* ==========================================================================
   Ready card
   ========================================================================== */

.creator-ready-card {
    position: relative;
    overflow: hidden;
    padding: 30px 26px;
    border: 1px solid rgba(49, 87, 213, 0.13);
    border-radius: 20px;
    background:
        radial-gradient(
            circle at 88% 12%,
            rgba(123, 97, 255, 0.14),
            transparent 30%
        ),
        linear-gradient(
            145deg,
            #f9faff,
            #f3f6ff
        );
    text-align: center;
}

.creator-ready-card::before {
    content: "";
    position: absolute;
    bottom: -80px;
    left: -60px;
    width: 170px;
    height: 170px;
    border-radius: 50%;
    background: rgba(49, 87, 213, 0.06);
}

.creator-ready-icon {
    position: relative;
    z-index: 1;
    display: grid;
    width: 58px;
    height: 58px;
    margin: 0 auto 17px;
    place-items: center;
    border-radius: 18px;
    background: linear-gradient(
        135deg,
        var(--primary),
        var(--accent)
    );
    box-shadow: 0 14px 28px rgba(49, 87, 213, 0.21);
    font-size: 1.45rem;
}

.creator-ready-card h2 {
    position: relative;
    z-index: 1;
    margin-bottom: 10px;
    font-size: clamp(1.7rem, 3vw, 2.3rem);
    letter-spacing: -0.035em;
}

.creator-ready-card > p {
    position: relative;
    z-index: 1;
    max-width: 500px;
    margin: 0 auto 20px;
    color: var(--muted);
    font-size: 0.95rem;
}

.creator-feature-list {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-width: 520px;
    margin: 0 auto;
    padding: 0;
    list-style: none;
    text-align: left;
}

.creator-feature-list li {
    padding: 12px 13px;
    border: 1px solid rgba(205, 213, 224, 0.7);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
    color: #334056;
    font-size: 0.86rem;
    font-weight: 700;
}

.creator-feature-list li::first-letter {
    color: var(--success);
}

/* ==========================================================================
   Generation area
   ========================================================================== */

.creator-generation-state {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    margin-top: 10px;
}

.generation-before,
.generation-after {
    border-radius: 15px;
}

.generation-before[hidden],
.generation-after[hidden] {
    display: none;
}

.generation-before {
    flex: 0 0 auto;
    padding: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.78);
}

.generation-before .form-disclaimer {
    max-width: 560px;
    margin: 8px auto 0;
    color: var(--muted);
    font-size: 0.74rem;
    line-height: 1.4;
}

.generation-after {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    gap: 12px;
    padding: 4px 2px 6px;
    overflow-y: auto;
}

.generation-success {
    display: grid;
    flex: 0 0 auto;
    justify-items: center;
    text-align: center;
}

.generation-check {
    display: grid;
    width: 34px;
    height: 34px;
    margin-bottom: 6px;
    place-items: center;
    border-radius: 50%;
    background: var(--success);
    color: white;
    box-shadow: 0 12px 24px rgba(22, 121, 77, 0.2);
    font-size: 0.92rem;
    font-weight: 900;
}

.generation-success h3 {
    margin-bottom: 3px;
    font-size: 1.02rem;
}

.generation-success p {
    max-width: 500px;
    margin: 0;
    color: #587062;
    font-size: 0.78rem;
    line-height: 1.4;
}

.creator-manual-message-field {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 12px;
    border: 1px solid rgba(22, 121, 77, 0.22);
    border-radius: 13px;
    background: rgba(22, 121, 77, 0.055);
}

.creator-message-input-wrap {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}

.creator-manual-message-field textarea {
    flex: 1 1 auto;
    width: 100%;
    min-height: clamp(44px, 8vh, 90px) !important;
    padding-bottom: 28px;
    overflow-x: hidden;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: pre-wrap;
}

.creator-manual-message-field .message-character-count-below {
    position: absolute;
    right: 10px;
    bottom: 8px;
    z-index: 2;
    color: #7f8b9d;
    font-size: 0.74rem;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    pointer-events: none;
}

.creator-manual-message-field .message-character-count-below.is-over-limit {
    color: var(--danger, #b42318);
    font-weight: 750;
}

.creator-regeneration-count {
    grid-column: 1 / -1;
    margin: 0 0 2px;
    color: var(--muted);
    font-size: 0.78rem;
    text-align: center;
}

/*
 * Regeneration / checkout buttons live in their own row, visually
 * separate from (below, outside) the generated-message box above.
 * The remaining-regenerations count sits right under the divider,
 * directly above the buttons.
 */
.generation-actions {
    display: grid;
    flex: 0 0 auto;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px dashed var(--line);
}

.generation-actions .button {
    min-height: 34px;
    font-size: 0.78rem;
}

.generation-actions [data-regenerate-card="both"],
.generation-actions [data-checkout-button] {
    grid-column: 1 / -1;
    width: 100%;
}

/* ==========================================================================
   Loading animation helpers
   ========================================================================== */

.creator-spinner {
    width: 52px;
    height: 52px;
    border: 4px solid rgba(49, 87, 213, 0.14);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: creator-spin 0.8s linear infinite;
    will-change: transform;
}

@keyframes creator-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes creator-fade-in {
    from {
        opacity: 0;
        transform: translateY(7px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.creator-step-panel.is-open .creator-step-content,
.generation-after:not([hidden]) {
    animation: creator-fade-in 220ms ease both;
}

/* ==========================================================================
   Validation and state helpers
   ========================================================================== */

.creator-page .field.has-error input,
.creator-page .field.has-error select,
.creator-page .field.has-error textarea {
    border-color: rgba(180, 35, 24, 0.68);
    box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.08);
}

.creator-page .field.is-valid input,
.creator-page .field.is-valid select,
.creator-page .field.is-valid textarea {
    border-color: rgba(22, 121, 77, 0.42);
}

.creator-tab.is-disabled {
    opacity: 0.62;
    cursor: not-allowed;
}

/* ==========================================================================
   Mid-size form refinements
   ========================================================================== */

@media (max-width: 1080px) {
    .creator-step-content {
        padding-inline: 21px;
    }

    .creator-ready-card {
        padding-inline: 22px;
    }
}

@media (max-width: 760px) {
    .creator-page .field-grid {
        grid-template-columns: 1fr;
    }

    .creator-page .field-full {
        grid-column: auto;
    }

    .creator-feature-list {
        grid-template-columns: 1fr;
    }

    .generation-actions {
        grid-template-columns: 1fr;
    }

    .creator-step-actions,
    .creator-step-actions-split {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .creator-step-actions .button {
        width: 100%;
    }
}

/* ==========================================================================
   QuixCard Creator
   Part 2B
   Live preview, sticky card, loading state, responsive behavior, and polish
   ========================================================================== */

/* ==========================================================================
   Preview column
   ========================================================================== */

.creator-preview-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.creator-preview-sticky {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 10px;
    min-height: 0;
}

.creator-preview-header {
    display: flex;
    flex: 0 0 auto;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.creator-preview-header .eyebrow {
    margin-bottom: 2px;
    font-size: 0.7rem;
}

.creator-preview-header h2 {
    margin: 0;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    letter-spacing: -0.03em;
}

.creator-preview-badge {
    display: inline-flex;
    min-height: 24px;
    padding: 0 10px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(49, 87, 213, 0.16);
    border-radius: 999px;
    background: rgba(49, 87, 213, 0.08);
    color: var(--primary);
    font-size: 0.68rem;
    font-weight: 850;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ==========================================================================
   Preview card
   ========================================================================== */

.creator-preview-card {
    position: relative;
    width: min(100%, 400px);
    flex: 1 1 auto;
    min-height: 0;
    margin-inline: auto;
    overflow: hidden;
    border: 1px solid rgba(205, 213, 224, 0.86);
    border-radius: 24px;
    background: #1a1a1a;
    box-shadow:
        0 30px 70px rgba(28, 40, 72, 0.15),
        0 8px 24px rgba(28, 40, 72, 0.08);
    transform: translateZ(0);
    transition: width 200ms ease, max-width 200ms ease;
}

/*
 * Split layout: the note panel and artwork/message panel sit
 * side by side, both the exact same size, instead of the note
 * panel being hidden. The note side is plain white text only.
 */
.creator-preview-card.is-split-layout {
    display: flex;
    flex-direction: row;
    width: min(100%, 720px);
}

.creator-preview-note-panel {
    display: flex;
    flex: 1 1 50%;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
    background: #ffffff;
}

.creator-preview-note-text {
    margin: 0;
    max-width: 100%;
    color: #2a3040;
    font-size: 0.88rem;
    line-height: 1.55;
    text-align: center;
    white-space: pre-line;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.creator-preview-main {
    position: relative;
    flex: 1 1 50%;
    min-width: 0;
    overflow: hidden;
}

.creator-preview-card:not(.is-split-layout) .creator-preview-main {
    position: static;
    height: 100%;
}

.creator-preview-artwork {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    background:
        radial-gradient(
            circle at 78% 18%,
            rgba(255, 255, 255, 0.72),
            transparent 24%
        ),
        linear-gradient(
            145deg,
            #dfe8ff,
            #f3e7ff 58%,
            #fff0d9
        );
}

.creator-preview-image {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;

    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    pointer-events: none;
}

.creator-preview-image[hidden] {
    display: none;
}

.creator-preview-placeholder {
    position: relative;
    z-index: 1;
    display: grid;
    max-width: 220px;
    padding: 16px;
    place-items: center;
    color: rgba(49, 87, 213, 0.82);
    font-size: 1.6rem;
    text-align: center;
}

.creator-preview-placeholder p {
    margin: 8px 0 0;
    color: #66748a;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.4;
}

.creator-gift-pill {
    position: absolute;
    z-index: 4;
    top: 14px;
    right: 14px;
    display: inline-flex;
    min-height: 28px;
    padding: 0 11px;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.68);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    color: #2f3a50;
    box-shadow: 0 8px 20px rgba(28, 40, 72, 0.12);
    backdrop-filter: blur(14px);
    font-size: 0.7rem;
    font-weight: 850;
}

.creator-gift-pill[hidden] {
    display: none;
}

.creator-preview-content {
    position: absolute;
    inset: auto 0 0;
    z-index: 3;
    display: flex;
    max-height: 60%;
    padding: 50px 20px 20px;
    flex-direction: column;
    justify-content: flex-end;
    overflow-y: auto;
    background:
        linear-gradient(
            to top,
            rgba(0, 0, 0, 0.82) 0%,
            rgba(0, 0, 0, 0.45) 45%,
            rgba(0, 0, 0, 0) 100%
        );
    text-align: center;
    pointer-events: none;
}

.creator-preview-message {
    max-width: 430px;
    margin: 0 auto;
    color: white;
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.55;
    white-space: pre-line;
    text-shadow:
        0 2px 5px rgba(0, 0, 0, 0.85),
        0 1px 18px rgba(0, 0, 0, 0.55);
    transition: font-size 160ms ease;
}

/*
 * Dynamic sizing keeps short greetings from looking lost and
 * keeps longer ones from overflowing the card's message area.
 */
.creator-preview-message.msg-len-short,
[data-manual-message].msg-len-short {
    font-size: 1.05rem;
}

.creator-preview-message.msg-len-medium,
[data-manual-message].msg-len-medium {
    font-size: 0.92rem;
}

.creator-preview-message.msg-len-long,
[data-manual-message].msg-len-long {
    font-size: 0.8rem;
}

/* ==========================================================================
   Theme preview helpers
   ========================================================================== */

.creator-preview-card.theme-celebration .creator-preview-artwork {
    background:
        radial-gradient(
            circle at 80% 18%,
            rgba(255, 255, 255, 0.75),
            transparent 25%
        ),
        linear-gradient(
            145deg,
            #dce8ff,
            #f3e5ff 55%,
            #ffefd9
        );
}

.creator-preview-card.theme-elegant .creator-preview-artwork {
    background:
        radial-gradient(
            circle at 82% 16%,
            rgba(255, 255, 255, 0.6),
            transparent 24%
        ),
        linear-gradient(
            145deg,
            #f6f2eb,
            #e7dfd2
        );
}

.creator-preview-card.theme-bright .creator-preview-artwork {
    background:
        radial-gradient(
            circle at 18% 20%,
            rgba(255, 255, 255, 0.5),
            transparent 24%
        ),
        linear-gradient(
            145deg,
            #fff3a8,
            #ffcabf 52%,
            #c9ecff
        );
}

.creator-preview-card.theme-minimal .creator-preview-artwork {
    background:
        linear-gradient(
            145deg,
            #ffffff,
            #f6f8fc
        );
}

.creator-preview-card.theme-cozy .creator-preview-artwork {
    background:
        radial-gradient(
            circle at 78% 18%,
            rgba(255, 255, 255, 0.5),
            transparent 26%
        ),
        linear-gradient(
            145deg,
            #f1ddcf,
            #f6eee8
        );
}

/* ==========================================================================
   Preview loading overlay
   ========================================================================== */

.creator-loading-card {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: grid;
    padding: 24px;
    place-items: center;
    align-content: center;
    background: rgba(255, 255, 255, 0.96);
    text-align: center;
}

.creator-loading-card[hidden] {
    display: none;
}

.creator-loading-card h3 {
    margin: 12px 0 6px;
    font-size: 1.1rem;
}

.creator-loading-card p {
    margin: 2px 0;
    color: var(--muted);
    font-size: 0.82rem;
    opacity: 0.45;
    transition: opacity 220ms ease, color 220ms ease;
}

.creator-loading-card p.is-active {
    color: var(--ink);
    font-weight: 700;
    opacity: 1;
    animation: creator-loading-pulse 1.6s ease-in-out infinite;
}

.creator-loading-progress {
    width: 100%;
    max-width: 220px;
    height: 6px;
    margin: 14px 0 2px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(49, 87, 213, 0.14);
}

.creator-loading-progress-fill {
    height: 100%;
    width: 35%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), #7b61ff);
    animation: creator-loading-bar 1.8s ease-in-out infinite;
}

@keyframes creator-loading-pulse {
    0%, 100% { opacity: 0.65; }
    50% { opacity: 1; }
}

@keyframes creator-loading-bar {
    0% { transform: translateX(-100%); width: 35%; }
    50% { width: 55%; }
    100% { transform: translateX(220%); width: 35%; }
}

.creator-loading-card small {
    margin-top: 8px;
    color: #8792a3;
    font-size: 0.72rem;
}

@media (max-height: 760px) {
    .creator-intro {
        display: none;
    }
}

/* ==========================================================================
   Generated preview state
   ========================================================================== */

.creator-preview-card.is-generated {
    animation: creator-card-arrive 420ms ease both;
}

.creator-preview-card.is-generated .creator-preview-placeholder {
    display: none;
}

.creator-preview-card.is-generating .creator-preview-artwork,
.creator-preview-card.is-generating .creator-preview-content {
    opacity: 0.5;
}

@keyframes creator-card-arrive {
    from {
        opacity: 0.6;
        transform: translateY(12px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==========================================================================
   Accessibility and motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .creator-page *,
    .creator-page *::before,
    .creator-page *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    /*
     * Loading indicators convey real state, not decoration - they
     * stay animated even with reduced motion, or they'd just look
     * broken/frozen instead of communicating "still working."
     */
    .creator-page .creator-spinner {
        animation: creator-spin 0.8s linear infinite !important;
    }

    .creator-page .creator-loading-progress-fill {
        animation: creator-loading-bar 1.8s ease-in-out infinite !important;
    }

    .creator-page .quix-loading-spinner {
        animation: quixcard-spin 0.75s linear infinite !important;
    }
}

/* ==========================================================================
   Tablet layout
   ========================================================================== */

@media (max-width: 900px) {
    .creator-page {
        height: auto;
        min-height: auto;
        max-height: none;
        overflow: visible;
        padding-top: 34px;
    }

    .creator-shell {
        width: min(760px, calc(100% - 32px));
        height: auto;
    }

    .creator-form {
        flex: none;
        min-height: 0;
    }

    .creator-layout {
        grid-template-columns: 1fr;
        flex: none;
        gap: 34px;
    }

    .creator-tabs {
        flex: none;
    }

    .creator-tab-panels {
        flex: none;
    }

    .creator-step-panel {
        flex: none;
    }

    .creator-step-content {
        flex: none;
        overflow: visible;
        padding: 26px 24px 24px;
    }

    .creator-preview-column {
        order: -1;
        flex: none;
    }

    .creator-preview-sticky {
        flex: none;
        position: static;
    }

    .creator-preview-card {
        width: min(100%, 500px);
        aspect-ratio: 2 / 3;
        flex: none;
    }

    .creator-controls {
        width: 100%;
    }
}

/* ==========================================================================
   Mobile layout
   ========================================================================== */

@media (max-width: 620px) {
    .creator-page {
        height: auto;
        max-height: none;
        min-height: auto;
        padding: 24px 0 42px;
    }

    .creator-shell {
        width: min(100% - 22px, 620px);
    }

    .creator-header {
        gap: 18px;
        margin-bottom: 24px;
    }

    .creator-header h1 {
        margin-bottom: 14px;
        font-size: clamp(2.45rem, 12vw, 3.45rem);
    }

    .creator-intro {
        font-size: 0.96rem;
        line-height: 1.6;
    }

    .creator-layout {
        gap: 26px;
    }

    .creator-preview-header {
        align-items: center;
    }

    .creator-preview-header h2 {
        font-size: 1.7rem;
    }

    .creator-preview-badge {
        min-height: 28px;
        padding-inline: 10px;
        font-size: 0.7rem;
    }

    .creator-preview-card {
        border-radius: 23px;
    }

    .creator-preview-content {
        padding: 40px 18px 18px;
    }

    .creator-preview-message {
        font-size: 0.9rem;
        line-height: 1.62;
    }

    .creator-tabs {
        gap: 3px;
        padding: 8px 8px 0;
    }

    .creator-tab {
        flex: 0 0 44px;
        justify-content: center;
        gap: 8px;
        padding: 9px 8px;
        border-radius: 11px 11px 0 0;
    }

    .creator-tab.is-active {
        flex: 1 1 auto;
        justify-content: flex-start;
        padding: 9px 12px;
    }

    .creator-tab-number {
        width: 32px;
        height: 32px;
        border-radius: 10px;
    }

    .creator-tab-heading {
        display: none;
    }

    .creator-tab.is-active .creator-tab-heading {
        display: grid;
    }

    .creator-tab-heading strong {
        font-size: 0.78rem;
    }

    .creator-tab-heading small {
        display: none;
    }

    .creator-step-content {
        padding: 21px 16px 18px;
    }

    .portrait-upload-card {
        padding: 16px;
    }

    .creator-ready-card {
        padding: 24px 17px;
        border-radius: 17px;
    }

    .creator-ready-icon {
        width: 52px;
        height: 52px;
    }

    .creator-ready-card h2 {
        font-size: 1.65rem;
    }

    .generation-before,
    .generation-after {
        padding: 16px;
    }

    .creator-tab-status {
        gap: 5px;
    }

    .creator-tab-check {
        width: 20px;
        height: 20px;
    }
}

/* ==========================================================================
   Very small screens
   ========================================================================== */

@media (max-width: 390px) {
    .creator-shell {
        width: min(100% - 16px, 390px);
    }

    .creator-header h1 {
        font-size: 2.35rem;
    }

    .creator-tab-status {
        display: none;
    }

    .creator-preview-content {
        padding-inline: 17px;
    }

    .portrait-upload-heading {
        flex-direction: column;
    }
}

/* ==========================================================================
   Footer handling on the creator page
   ========================================================================== */

body:has(.creator-page) {
    min-height: 100dvh;
    overflow: hidden;
}

body:has(.creator-page) .site-footer {
    display: none;
    margin-top: 0;
}

@media (max-width: 900px) {
    body:has(.creator-page) {
        overflow: visible;
    }

    body:has(.creator-page) .site-footer {
        display: flex;
    }
}
