.tf-image-page,
.tf-image-page * {
    box-sizing: border-box;
}

/* Mobile multi-line composer guard */
@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-composer-panel,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-panel {
        min-height: 58px !important;
    }

    body.tf-image-standalone-page .tf-image-composer-prompt,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-prompt {
        max-height: 128px !important;
        padding: 7px 18px !important;
        border-radius: 28px !important;
        overflow: hidden !important;
    }

    body.tf-image-standalone-page .tf-image-composer:not(.tf-image-composer-expanded) .tf-image-composer-prompt {
        border-radius: 999px !important;
    }

    body.tf-image-standalone-page .tf-image-form textarea.form-control,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-form textarea.form-control {
        max-height: 112px !important;
        overflow-y: auto;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-run,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-run {
        top: auto !important;
        bottom: 0 !important;
        transform: none !important;
    }
}

/* Final template preview glass base */
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .86), rgba(247, 247, 245, .76)),
        rgba(247, 247, 245, .82) !important;
    backdrop-filter: blur(34px) saturate(1.18) !important;
    -webkit-backdrop-filter: blur(34px) saturate(1.18) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body {
    border-top: 1px solid rgba(255, 255, 255, .72) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .66), 0 -14px 34px rgba(255, 255, 255, .2) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .42) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-apply {
    box-shadow: 0 14px 30px rgba(0, 0, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .1) !important;
}

.tf-image-page {
    --tf-image-border: var(--main-border-color, rgba(125, 136, 155, .18));
    --tf-image-bg: var(--main-bg-color, #fff);
    --tf-image-soft: var(--muted-border-color, #f5f6f8);
    --tf-image-glass-bg: rgba(255, 255, 255, .74);
    --tf-image-glass-layer: rgba(255, 255, 255, .54);
    --tf-image-glass-border: rgba(255, 255, 255, .68);
    --tf-image-text: var(--key-color, #252933);
    --tf-image-muted: var(--muted-color, #8a9099);
    --tf-image-muted-2: var(--muted-2-color, #a7adb6);
    --tf-image-theme: var(--theme-color, #2997f7);
    padding-top: 12px;
    padding-bottom: 232px;
}

.tf-image-studio {
    overflow: hidden;
    border: 1px solid var(--tf-image-glass-border);
    border-radius: var(--main-radius, 8px);
    background: var(--tf-image-glass-bg);
    backdrop-filter: blur(14px) saturate(1.12);
    -webkit-backdrop-filter: blur(14px) saturate(1.12);
}

.dark-theme .tf-image-studio {
    border-color: rgba(255, 255, 255, .1);
    background: rgba(30, 32, 36, .62);
}

.tf-image-output {
    min-width: 0;
}

.tf-image-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    padding: 0 16px;
    border-bottom: 1px solid rgba(125, 136, 155, .12);
    background: rgba(255, 255, 255, .3);
}

.tf-image-title {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    color: var(--tf-image-text);
    font-size: 15px;
    font-weight: 700;
}

.tf-image-title i {
    color: var(--tf-image-theme);
}

.tf-image-head-mark {
    width: 14px;
    height: 14px;
    border: 2px solid var(--tf-image-theme);
    border-radius: 50%;
    box-shadow: inset 5px 0 0 transparent, 0 0 0 3px var(--focus-color-opacity1, rgba(41, 151, 247, .1));
}

.tf-image-status,
.tf-image-head .badg {
    flex: 0 0 auto;
    white-space: nowrap;
}

.tf-image-template-open {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 42px;
    padding: 8px 14px;
    margin: 0;
    border-radius: 999px;
    font-size: 14px;
    line-height: 1.4;
}

.tf-image-status {
    color: var(--tf-image-muted);
    font-size: 12px;
}

.tf-image-head-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.tf-image-head-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 30px;
    padding: 5px 10px;
    border: 1px solid rgba(125, 136, 155, .15);
    border-radius: 999px;
    color: var(--tf-image-muted);
    background: rgba(255, 255, 255, .42);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: color .18s ease, background-color .18s ease, border-color .18s ease;
}

.tf-image-head-button:hover {
    color: var(--tf-image-text);
    border-color: var(--focus-color-opacity3, rgba(41, 151, 247, .28));
    background: rgba(255, 255, 255, .68);
}

.tf-image-output-body {
    padding: 16px;
}

.tf-image-form .form-control {
    width: 100%;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--tf-image-text);
    box-shadow: none;
}

.tf-image-form select.form-control {
    width: auto;
    height: 32px;
    min-width: 112px;
    padding: 0 24px 0 8px;
    font-weight: 700;
}

.tf-image-form textarea.form-control {
    height: 64px;
    min-height: 64px;
    max-height: 120px;
    padding: 0;
    resize: none;
    color: var(--tf-image-text);
    font-size: 18px;
    line-height: 1.6;
}

.tf-image-composer {
    position: fixed;
    z-index: 998;
    left: max(16px, calc((100vw - 1180px) / 2));
    right: max(16px, calc((100vw - 1180px) / 2));
    bottom: 18px;
    min-width: 0;
}

.tf-image-composer-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 16px 18px 16px;
    border: 1px solid var(--tf-image-glass-border);
    border-radius: 26px;
    background: rgba(255, 255, 255, .72);
    box-shadow: 0 10px 26px rgba(15, 23, 42, .1);
    backdrop-filter: blur(20px) saturate(1.18);
    -webkit-backdrop-filter: blur(20px) saturate(1.18);
}

.dark-theme .tf-image-composer-panel {
    border-color: rgba(255, 255, 255, .12);
    background: rgba(28, 30, 34, .78);
}

.tf-image-composer-top {
    display: flex;
    justify-content: flex-start;
    min-width: 0;
}

.tf-image-composer-assets-mobile {
    display: none;
    order: 0;
    margin: 0 52px 10px 0;
}

.tf-image-composer-prompt {
    order: 1;
}

.tf-image-composer-bottom {
    order: 2;
}

.tf-image-composer-prompt {
    min-height: 86px;
    margin-bottom: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, .62);
    border-radius: 20px;
    background: rgba(255, 255, 255, .38);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.tf-image-composer-bottom {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    padding-right: 64px;
}

.tf-image-composer-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    flex: 0 1 auto;
    min-width: 0;
}

.tf-image-composer-assets-desktop {
    flex: 0 1 auto;
    min-width: 0;
    margin: 0;
}

.tf-image-composer-assets-desktop .tf-image-composer-status {
    justify-content: flex-start;
}

.tf-image-template-open,
.tf-image-tool-button,
.tf-image-select-pill,
.tf-image-pay-toggle,
.tf-image-asset-pill,
.tf-image-pay-actions .but {
    border: 1px solid rgba(255, 255, 255, .7) !important;
    background: rgba(255, 255, 255, .42) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .42);
    backdrop-filter: blur(12px) saturate(1.12);
    -webkit-backdrop-filter: blur(12px) saturate(1.12);
}

.tf-image-template-open:hover,
.tf-image-tool-button:hover,
.tf-image-select-pill:hover,
.tf-image-pay-actions .but:hover {
    background: rgba(255, 255, 255, .58) !important;
}

.tf-image-select-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    margin: 0;
    padding: 6px 12px;
    border: 1px solid var(--tf-image-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, .48);
    color: var(--tf-image-muted);
    font-size: 13px;
}

.tf-image-select-pill span {
    flex: 0 0 auto;
    font-weight: 700;
}

.tf-image-upload {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    color: var(--tf-image-text);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: color .18s ease, background-color .18s ease, transform .18s ease;
}

.tf-image-upload input {
    display: none;
}

.tf-image-upload span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tf-image-upload.has-reference {
    color: var(--tf-image-theme);
    background: var(--focus-color-opacity1, rgba(41, 151, 247, .1)) !important;
}

.tf-image-aspect-picker {
    position: relative;
}

.tf-image-aspect-picker.has-reference {
    color: var(--tf-image-theme);
    background: var(--focus-color-opacity1, rgba(41, 151, 247, .1)) !important;
}

.tf-image-upload.is-full {
    color: var(--tf-image-muted);
}

.tf-image-lucide-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.tf-image-upload small {
    color: var(--tf-image-muted-2);
    font-size: 12px;
    line-height: 1.45;
    white-space: nowrap;
}

.tf-image-reference-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-height: 0;
    margin: 0 -6px 0 0;
    padding: 0 8px 0 0;
    overflow: visible;
    opacity: 0;
    transform: translateY(-6px);
    transition: max-height .24s ease, margin .24s ease, opacity .2s ease, transform .24s ease;
}

.tf-image-reference-preview.has-items {
    max-height: 150px;
    margin: 0 -6px 10px 0;
    opacity: 1;
    transform: translateY(0);
}

.tf-image-reference-preview img {
    display: block;
    width: 82px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .12);
    object-fit: contain;
    cursor: zoom-in;
}

.tf-image-reference-item {
    position: relative;
    width: 82px;
    overflow: visible;
    flex: 0 0 auto;
    transform: translateY(0) scale(1);
    opacity: 1;
    transition: transform .22s ease, opacity .18s ease, width .22s ease, margin .22s ease;
    animation: tf-image-reference-in .24s ease both;
}

.tf-image-reference-item.is-removing {
    width: 0;
    margin-right: -8px;
    opacity: 0;
    transform: translateY(-2px) scale(.92);
    pointer-events: none;
}

.tf-image-reference-item.is-removing .tf-image-reference-remove {
    opacity: 0;
    visibility: hidden;
    transform: none !important;
    transition: opacity .08s ease, visibility .08s ease !important;
}

.tf-image-reference-item.is-removing .tf-image-reference-remove .ic-close {
    animation: none !important;
    transform: none !important;
    transition: none !important;
}

@keyframes tf-image-reference-in {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.tf-image-reference-remove {
    position: absolute;
    top: -10px;
    right: -10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #1f2328;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 8px 22px rgba(15, 23, 42, .18);
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background-color .18s ease, transform .18s ease;
}

.tf-image-reference-remove:hover {
    background: #fff;
    transform: scale(1.05);
}

.tf-image-reference-remove.is-hiding {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: none !important;
    transition: opacity .08s ease, visibility .08s ease !important;
}

.tf-image-reference-remove .ic-close {
    width: 13px;
    height: 13px;
}

.tf-image-pay-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
}

.tf-image-pay-actions .but {
    min-height: 26px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
}

.tf-image-pay-toggle {
    display: inline-flex;
    gap: 6px;
    margin: 0;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 999px;
    background: rgba(255, 255, 255, .42);
}

.tf-image-pay-toggle label {
    margin: 0;
}

.tf-image-pay-toggle input {
    display: none !important;
}

.tf-image-pay-toggle span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    min-width: 54px;
    padding: 0 12px;
    border-radius: 999px;
    color: var(--tf-image-muted);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .18s ease, color .18s ease, background-color .18s ease;
}

.tf-image-pay-toggle input:checked + span {
    color: var(--tf-image-theme);
    background: var(--focus-color-opacity1, rgba(41, 151, 247, .1));
}

.tf-image-run {
    position: absolute;
    right: 22px;
    bottom: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: rgba(150, 145, 142, .42);
    box-shadow: none;
    outline: none;
    font-weight: 700;
    transition: background-color .18s ease, color .18s ease, transform .18s ease, opacity .18s ease;
}

.tf-image-run > span:not(.tf-image-send-wrap) {
    display: none;
}

.tf-image-run.is-ready {
    background: #000;
}

.tf-image-run:not(.is-ready):not([disabled]) {
    color: rgba(255, 255, 255, .88);
}

.tf-image-run:hover {
    transform: translateY(-1px);
}

.tf-image-send-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    line-height: 0;
}

.tf-image-send-icon {
    display: block;
    width: 16px;
    height: 16px;
    margin: 0;
}

.tf-image-run[disabled]:not(.is-ready) {
    cursor: not-allowed;
    background: rgba(150, 145, 142, .42);
    opacity: 1;
}

.tf-image-run[disabled].is-ready {
    cursor: progress;
    background: #000;
    opacity: .72;
}

.tf-image-composer-status {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 100%;
    color: var(--tf-image-muted);
    font-size: 12px;
}

.tf-image-asset-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    min-height: 34px;
    padding: 5px 10px;
    border-radius: 999px;
    color: var(--tf-image-muted);
    line-height: 1;
}

.tf-image-asset-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: rgba(255, 255, 255, .54);
}

.tf-image-asset-icon .tf-image-asset-svg,
.tf-image-asset-icon svg {
    display: block;
    width: 16px;
    height: 16px;
}

.tf-image-asset-icon i {
    color: var(--tf-image-theme);
    font-size: 13px;
}

.tf-image-asset-text {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    min-width: 0;
    white-space: nowrap;
}

.tf-image-asset-text span {
    color: var(--tf-image-muted);
}

.tf-image-composer-status b {
    color: var(--tf-image-text);
    font-weight: 700;
}

.tf-image-asset-balance b {
    color: #4d82f9;
}

.tf-image-asset-points b {
    color: #ff9f1a;
}

.tf-image-asset-cost {
    background: var(--focus-color-opacity1, rgba(41, 151, 247, .1)) !important;
}

.tf-image-asset-cost b {
    color: var(--tf-image-theme);
}

.tf-image-output-body {
    display: grid;
    grid-template-rows: minmax(280px, 48vh) auto minmax(34px, auto) auto;
    gap: 12px;
}

.tf-image-output-box {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    overflow: hidden;
    border: 1px solid rgba(125, 136, 155, .15);
    border-radius: var(--main-radius, 8px);
    background: var(--tf-image-glass-layer);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.tf-image-output-empty {
    max-width: 460px;
    padding: 24px 18px;
    border-radius: var(--main-radius, 8px);
    background: rgba(255, 255, 255, .2);
    text-align: center;
}

.tf-image-output-empty > i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    margin-bottom: 14px;
    border-radius: var(--main-radius, 8px);
    color: var(--tf-image-theme);
    background: var(--focus-color-opacity1, rgba(41, 151, 247, .08));
    font-size: 24px;
}

.tf-image-gpt-mark {
    position: relative;
    display: inline-block;
    width: 54px;
    height: 54px;
    margin-bottom: 14px;
    transform-origin: 50% 50%;
    animation: tfImageGptSpin 3.2s linear infinite;
    will-change: transform;
}

.tf-image-gpt-mark::before {
    content: "";
    position: absolute;
    inset: -9px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(107, 111, 248, .18), rgba(107, 111, 248, 0) 62%);
    animation: tfImageGptHalo 1.8s ease-in-out infinite;
    pointer-events: none;
}

.tf-image-gpt-mark i {
    position: absolute;
    left: 17px;
    top: 6px;
    width: 20px;
    height: 42px;
    border: 2px solid var(--tf-image-theme);
    border-radius: 999px;
    opacity: .88;
    transform-origin: 10px 21px;
    animation: tfImageGptPetal 1.6s ease-in-out infinite;
}

.tf-image-gpt-mark i:nth-child(2) {
    transform: rotate(60deg);
    animation-delay: .08s;
}

.tf-image-gpt-mark i:nth-child(3) {
    transform: rotate(120deg);
    animation-delay: .16s;
}

.tf-image-gpt-mark i:nth-child(4) {
    transform: rotate(180deg);
    animation-delay: .24s;
}

.tf-image-gpt-mark i:nth-child(5) {
    transform: rotate(240deg);
    animation-delay: .32s;
}

.tf-image-gpt-mark i:nth-child(6) {
    transform: rotate(300deg);
    animation-delay: .4s;
}

@keyframes tfImageGptSpin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes tfImageGptHalo {
    0%,
    100% {
        opacity: .28;
        transform: scale(.86);
    }
    50% {
        opacity: .72;
        transform: scale(1.08);
    }
}

@keyframes tfImageGptPetal {
    0%,
    100% {
        opacity: .52;
    }
    50% {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tf-image-gpt-mark,
    .tf-image-gpt-mark::before,
    .tf-image-gpt-mark i {
        animation: none !important;
    }
}

.tf-image-loading {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: inherit;
    background: rgba(247, 247, 247, .76);
}

.dark-theme .tf-image-loading {
    background: rgba(255, 255, 255, .06);
}

.tf-image-loading-dots,
.tf-image-loading-dots canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.tf-image-loading-dots {
    opacity: .42;
    -webkit-mask-image: linear-gradient(to top left, rgba(0, 0, 0, 0) 0%, #000 18%, #000 78%, rgba(0, 0, 0, 0) 100%);
    mask-image: linear-gradient(to top left, rgba(0, 0, 0, 0) 0%, #000 18%, #000 78%, rgba(0, 0, 0, 0) 100%);
}

.tf-image-loading-dots canvas {
    display: block;
}

.tf-image-loading-text {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 20px;
    color: var(--tf-image-muted);
    font-size: 13px;
    text-align: center;
}

.tf-image-output-empty h2 {
    margin: 0 0 8px;
    color: var(--tf-image-text);
    font-size: 19px;
    font-weight: 700;
}

.tf-image-output-empty p {
    margin: 0;
    color: var(--tf-image-muted);
    font-size: 13px;
    line-height: 1.7;
}

.tf-image-result {
    width: 100%;
    height: 100%;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .82);
}

.tf-image-result img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.tf-image-output-box.is-chat {
    display: block;
    align-items: stretch;
    justify-content: flex-start;
    padding: 18px;
    overflow: auto;
}

.tf-image-chat-stream {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 100%;
}

.tf-image-chat-message {
    display: flex;
    width: 100%;
}

.tf-image-chat-user {
    justify-content: flex-end;
}

.tf-image-chat-ai {
    justify-content: flex-start;
}

.tf-image-chat-bubble {
    max-width: min(520px, 72%);
    padding: 11px 15px;
    border-radius: 20px;
    color: var(--tf-image-text);
    background: rgba(255, 255, 255, .72);
    box-shadow: 0 6px 18px rgba(15, 23, 42, .045);
    font-size: 14px;
    line-height: 1.68;
    word-break: break-word;
}

.tf-image-chat-user .tf-image-chat-bubble {
    border-radius: 22px;
    background: rgba(236, 236, 236, .92);
}

.tf-image-chat-user {
    flex-direction: column;
    align-items: flex-end;
}

.tf-image-chat-user-refs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
    justify-content: flex-end;
    gap: 8px;
    width: min(292px, 72%);
    margin: 0 0 8px auto;
}

.tf-image-chat-user-ref {
    display: block;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    border-radius: 18px;
    background: rgba(236, 236, 236, .78);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
}

.tf-image-chat-user-ref img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tf-image-chat-prompt-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin: 8px 12px 0 0;
}

.tf-image-chat-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    color: rgba(48, 52, 60, .68);
    background: transparent;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: color .16s ease, background-color .16s ease, transform .16s ease;
}

.tf-image-chat-action:hover {
    color: var(--tf-image-theme);
    background: rgba(41, 151, 247, .08);
    transform: translateY(-1px);
}

.tf-image-chat-loading {
    position: relative;
    width: min(520px, 100%);
    min-height: 220px;
    overflow: hidden;
    border: 1px solid rgba(125, 136, 155, .13);
    border-radius: var(--main-radius, 8px);
    background: rgba(247, 247, 247, .76);
}

.tf-image-chat-result {
    width: min(560px, 100%);
    overflow: hidden;
    border-radius: 18px;
    background: rgba(0, 0, 0, .82);
    box-shadow: 0 12px 34px rgba(15, 23, 42, .14);
}

.tf-image-chat-result img {
    display: block;
    width: 100%;
    max-height: min(520px, 54vh);
    object-fit: contain;
}

.tf-image-chat-error {
    margin: 0;
    background: rgba(255, 255, 255, .58);
}

.tf-image-chat-error-inline {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: min(560px, 88%);
    padding: 10px 14px 10px 13px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 16px;
    color: rgba(45, 49, 57, .82);
    background: rgba(255, 255, 255, .66);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
    font-size: 13px;
    line-height: 1.58;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.tf-image-chat-error-inline::before {
    content: "";
    align-self: stretch;
    width: 3px;
    min-height: 22px;
    border-radius: 999px;
    background: linear-gradient(180deg, #ff6b6b, #ff3b5f);
    box-shadow: 0 0 14px rgba(255, 59, 95, .28);
}

.tf-image-chat-error-inline i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    border-radius: 999px;
    color: #e5485f;
    background: rgba(229, 72, 95, .09);
    font-size: 12px;
}

.tf-image-chat-error-inline span {
    min-width: 0;
}

.tf-image-generation-stopped {
    width: min(520px, 72%);
    padding: 2px 0 0;
    color: var(--tf-image-text);
    word-break: break-word;
}

.tf-image-generation-stopped-label {
    margin-bottom: 8px;
    color: rgba(35, 39, 47, .42);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
}

.tf-image-generation-stopped-text {
    color: rgba(10, 12, 16, .94);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.72;
    white-space: pre-wrap;
}

.tf-image-generation-stopped-text.is-typing::after {
    content: "";
    display: inline-block;
    width: 2px;
    height: .96em;
    margin-left: 3px;
    border-radius: 999px;
    background: currentColor;
    vertical-align: -.08em;
    animation: tfImageTypeCursor .86s steps(1, end) infinite;
}

@keyframes tfImageTypeCursor {
    50% {
        opacity: 0;
    }
}

.tf-image-chat-list {
    display: grid;
    gap: 10px;
}

.tf-image-chat-record {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 72px;
    padding: 10px;
    border: 1px solid rgba(125, 136, 155, .14);
    border-radius: var(--main-radius, 8px);
    color: var(--tf-image-text);
    background: var(--tf-image-bg);
    text-align: left;
    cursor: pointer;
    transition: border-color .18s ease, background-color .18s ease, transform .18s ease;
}

.tf-image-chat-duration-badge {
    position: absolute;
    top: -1px;
    left: -1px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 88px;
    min-height: 16px;
    padding: 0 6px 0 5px;
    overflow: hidden;
    border-radius: var(--main-radius, 8px) 0 8px 0;
    color: #fff;
    background: linear-gradient(135deg, rgba(41, 151, 247, .98), rgba(63, 126, 255, .92));
    box-shadow: 0 4px 10px rgba(41, 151, 247, .2);
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    white-space: nowrap;
    pointer-events: none;
}

.tf-image-chat-expire-badge {
    position: absolute;
    top: -1px;
    right: -1px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 118px;
    min-height: 16px;
    padding: 0 6px;
    overflow: hidden;
    border-radius: 0 var(--main-radius, 8px) 0 8px;
    color: #fff;
    background: linear-gradient(135deg, rgba(255, 139, 64, .98), rgba(255, 100, 60, .92));
    box-shadow: 0 4px 10px rgba(255, 110, 60, .18);
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    white-space: nowrap;
    pointer-events: none;
}

.tf-image-chat-record:hover {
    border-color: var(--focus-color-opacity3, rgba(41, 151, 247, .28));
    background: var(--tf-image-soft);
    transform: translateY(-1px);
}

.tf-image-chat-record-cover {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: var(--main-radius, 8px);
    color: var(--tf-image-muted);
    background: var(--tf-image-soft);
}

.tf-image-chat-record-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tf-image-chat-record-main {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.tf-image-chat-record-main b,
.tf-image-chat-record-main small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tf-image-chat-record-main b {
    font-size: 14px;
}

.tf-image-chat-record-main small {
    color: var(--tf-image-muted);
    font-size: 12px;
}

.tf-image-notice {
    padding: 9px 11px;
    border: 1px solid rgba(255, 111, 6, .16);
    border-radius: var(--main-radius, 8px);
    background: rgba(255, 111, 6, .06);
    color: #b26a10;
    font-size: 12px;
    line-height: 1.65;
}

.tf-image-gallery-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tf-image-gallery-head h3 {
    margin: 0;
    color: var(--tf-image-text);
    font-size: 15px;
    font-weight: 700;
}

.tf-image-gallery-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tf-image-gallery-actions .but {
    min-height: 30px;
    padding: 4px 10px;
    font-size: 12px;
}

.tf-image-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    align-content: start;
}

.tf-image-gallery-item {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(125, 136, 155, .15);
    border-radius: var(--main-radius, 8px);
    background: var(--tf-image-glass-layer);
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.tf-image-gallery-item img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform .2s ease;
}

.tf-image-gallery-item:hover img {
    transform: scale(1.03);
}

.tf-image-gallery-meta {
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 6px;
    padding: 4px 6px;
    border-radius: 6px;
    background: rgba(0, 0, 0, .48);
    color: #fff;
    font-size: 12px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tf-image-empty-line {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 92px;
    border: 1px dashed rgba(125, 136, 155, .22);
    border-radius: var(--main-radius, 8px);
    color: var(--tf-image-muted);
    background: var(--tf-image-glass-layer);
    font-size: 13px;
}

.tf-image-records-loading {
    flex-direction: column;
    gap: 12px;
    min-height: 180px;
    border-style: solid;
    color: #4f63ff;
    background: rgba(255, 255, 255, .5);
    font-size: 15px;
    font-weight: 600;
}

.tf-image-records-loading .tf-image-gpt-mark {
    width: 58px;
    height: 58px;
    margin: 0;
    color: #4f63ff;
    filter: drop-shadow(0 12px 24px rgba(79, 99, 255, .2));
    animation-duration: 1.35s;
}

.tf-image-records-loading .tf-image-gpt-mark::before {
    inset: -10px;
    background: radial-gradient(circle, rgba(79, 99, 255, .16), rgba(79, 99, 255, 0) 66%);
}

.tf-image-records-loading .tf-image-gpt-mark i {
    left: 18px;
    top: 5px;
    width: 22px;
    height: 48px;
    transform-origin: 11px 24px;
    border-color: currentColor;
    border-width: 2.5px;
    opacity: .9;
    box-shadow: 0 0 10px rgba(79, 99, 255, .16);
}

.tf-image-records-loading > span:last-child {
    display: block;
    color: #4f63ff;
    line-height: 1.4;
}

.tf-image-gallery-grid.is-records {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tf-image-records-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
}

.tf-image-records-pager[hidden] {
    display: none !important;
}

.tf-image-records-pager .but {
    min-width: 92px;
}

.tf-image-records-page-info {
    min-width: 64px;
    text-align: center;
    font-size: 13px;
    color: var(--tf-image-muted);
}

.tf-image-aspect-modal.flex.in,
.tf-image-aspect-modal.flex.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0, 0, 0, .28);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.tf-image-aspect-modal .modal-dialog {
    width: min(430px, calc(100vw - 32px));
    max-width: 430px;
    margin: 0 auto;
}

.tf-image-aspect-modal .modal-content {
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .62);
    border-radius: 28px;
    background: rgba(250, 250, 248, .92);
    box-shadow: 0 26px 80px rgba(15, 23, 42, .24), inset 0 1px 0 rgba(255, 255, 255, .7);
    backdrop-filter: blur(24px) saturate(1.12);
    -webkit-backdrop-filter: blur(24px) saturate(1.12);
}

.tf-image-aspect-modal .modal-body {
    padding: 0 20px 14px;
}

.tf-image-aspect-panel {
    display: grid;
    gap: 18px;
}

.tf-image-aspect-section {
    display: grid;
    gap: 10px;
}

.tf-image-aspect-section-title {
    color: rgba(30, 31, 34, .52);
    font-size: 12px;
    font-weight: 800;
}

.tf-image-aspect-options {
    display: grid;
    gap: 8px;
}

.tf-image-size-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tf-image-ratio-options {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tf-image-model-options {
    grid-template-columns: 1fr;
}

.tf-image-aspect-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid rgba(125, 136, 155, .16);
    border-radius: 14px;
    color: rgba(30, 31, 34, .74);
    background: rgba(255, 255, 255, .62);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .64);
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    transition: border-color .18s ease, background-color .18s ease, color .18s ease;
}

.tf-image-aspect-option small {
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    color: rgba(30, 31, 34, .46);
}

.tf-image-aspect-option:hover {
    background: rgba(255, 255, 255, .82);
}

.tf-image-aspect-option.is-disabled,
.tf-image-aspect-option:disabled {
    cursor: not-allowed;
    opacity: .46;
    color: rgba(30, 31, 34, .42);
    background: rgba(242, 244, 247, .62);
    box-shadow: none;
}

.tf-image-aspect-option.is-disabled:hover,
.tf-image-aspect-option:disabled:hover {
    background: rgba(242, 244, 247, .62);
}

.tf-image-aspect-option.active {
    border-color: rgba(41, 151, 247, .38);
    color: var(--tf-image-theme);
    background: rgba(41, 151, 247, .1);
}

.tf-image-aspect-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 16px;
    color: rgba(30, 31, 34, .54);
    background: rgba(255, 255, 255, .44);
    font-size: 12px;
    font-weight: 700;
}

.tf-image-aspect-preview strong {
    color: rgba(30, 31, 34, .86);
    font-size: 13px;
}

.tf-image-aspect-actions {
    padding: 4px 20px 20px;
}

.tf-image-aspect-apply {
    width: 100%;
    min-height: 44px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: #050505;
    box-shadow: 0 14px 32px rgba(0, 0, 0, .18);
    font-size: 15px;
    font-weight: 800;
}

.tf-image-aspect-apply:hover {
    background: rgba(0, 0, 0, .9);
}

.tf-image-chat-result-wrap.is-targeted {
    animation: tfImageTargetPulse 1.9s ease both;
}

@keyframes tfImageTargetPulse {
    0% {
        filter: drop-shadow(0 0 0 rgba(41, 151, 247, 0));
        transform: translateY(0);
    }
    22% {
        filter: drop-shadow(0 12px 30px rgba(41, 151, 247, .22));
        transform: translateY(-2px);
    }
    100% {
        filter: drop-shadow(0 0 0 rgba(41, 151, 247, 0));
        transform: translateY(0);
    }
}

.tf-image-modal-header {
    position: relative;
    min-height: 56px;
    padding: 16px 58px 15px;
}

.tf-image-modal-header .modal-title {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 100%;
    margin: 0;
    color: var(--tf-image-text);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
}

.tf-image-modal-header .modal-title i {
    color: var(--tf-image-muted);
}

.tf-image-modal-close {
    top: 50% !important;
    right: 16px !important;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 !important;
    color: var(--tf-image-muted-2);
    line-height: 34px;
    opacity: .75;
}

.tf-image-modal-close:hover {
    color: var(--tf-image-text);
    opacity: 1;
}

.tf-image-modal-close .ic-close {
    width: 16px;
    height: 16px;
}

.tf-image-modal .modal-body {
    max-height: min(70vh, 620px);
    overflow: auto;
}

.tf-image-template-modal .modal-content {
    overflow: hidden;
}

.tf-image-template-modal .tf-image-modal-header[hidden] {
    display: none !important;
}

.tf-image-template-modal .modal-body {
    padding: 14px;
}

.tf-image-template-grid {
    column-count: 3;
    column-gap: 14px;
}

.tf-image-template-card {
    display: inline-block;
    width: 100%;
    margin: 0 0 14px;
    overflow: hidden;
    border: 1px solid var(--tf-image-border);
    border-radius: var(--tf-image-template-radius, var(--main-radius, 8px));
    background: var(--tf-image-bg);
    cursor: pointer;
    break-inside: avoid;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.tf-image-template-card:hover {
    transform: translateY(-2px);
    border-color: var(--focus-color-opacity3, rgba(41, 151, 247, .28));
    box-shadow: 0 10px 28px rgba(20, 30, 50, .08);
}

.tf-image-template-cover {
    position: relative;
    overflow: hidden;
    border-radius: inherit;
    background: var(--tf-image-soft);
}

.tf-image-template-cover img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.tf-image-template-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 180px;
    color: var(--tf-image-theme);
    background: var(--focus-color-opacity1, rgba(41, 151, 247, .08));
    font-size: 28px;
}

.tf-image-template-mask {
    position: absolute;
    inset: auto 0 0;
    padding: 38px 12px 12px;
    color: #fff;
    background: linear-gradient(to top, rgba(0, 0, 0, .62), rgba(0, 0, 0, 0));
    pointer-events: none;
}

.tf-image-template-mask h3 {
    margin: 0;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .22);
}

.tf-image-template-mask p {
    display: -webkit-box;
    margin: 4px 0 0;
    overflow: hidden;
    color: rgba(255, 255, 255, .82);
    font-size: 12px;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.tf-image-template-detail {
    position: relative;
    display: grid;
    grid-template-rows: minmax(0, auto) auto;
    overflow: hidden;
    border: 1px solid var(--tf-image-border);
    border-radius: var(--tf-image-template-radius, var(--main-radius, 8px));
    background: var(--tf-image-bg);
}

.tf-image-template-detail[hidden],
.tf-image-template-list-view[hidden] {
    display: none !important;
}

.tf-image-template-detail-close {
    position: absolute;
    z-index: 3;
    top: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: rgba(0, 0, 0, .38);
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background-color .18s ease, transform .18s ease;
}

.tf-image-template-detail-close:hover {
    background: rgba(0, 0, 0, .52);
    transform: scale(1.03);
}

.tf-image-template-detail-close .ic-close {
    width: 18px;
    height: 18px;
}

.tf-image-template-detail-cover {
    overflow: auto;
    max-height: min(46vh, 420px);
    min-height: 260px;
    background: var(--tf-image-soft);
}

.tf-image-template-detail-cover img {
    display: block;
    width: 100%;
    height: auto;
}

.tf-image-template-detail-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    color: var(--tf-image-theme);
    background: var(--focus-color-opacity1, rgba(41, 151, 247, .08));
    font-size: 38px;
}

.tf-image-template-detail-content {
    padding: 22px 24px 24px;
    text-align: center;
}

.tf-image-template-detail-content h3 {
    margin: 0 0 10px;
    color: var(--tf-image-text);
    font-size: 24px;
    font-weight: 800;
    line-height: 1.35;
}

.tf-image-template-detail-content p {
    margin: 0 auto 14px;
    max-width: 680px;
    color: var(--tf-image-muted);
    font-size: 15px;
    line-height: 1.8;
}

.tf-image-template-detail-prompt {
    max-width: 760px;
    max-height: 96px;
    margin: 0 auto 18px;
    padding: 12px 14px;
    overflow: auto;
    border: 1px solid var(--tf-image-border);
    border-radius: var(--main-radius, 8px);
    color: var(--tf-image-muted);
    background: var(--tf-image-soft);
    font-size: 13px;
    line-height: 1.65;
    text-align: left;
}

.tf-image-template-detail-actions {
    display: grid;
    grid-template-columns: minmax(0, 140px) minmax(0, 1fr);
    gap: 12px;
    max-width: 760px;
    margin: 0 auto;
}

.tf-image-template-detail-actions .but {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    margin: 0;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 700;
}

.tf-image-usage {
    color: rgba(31, 35, 43, .76);
    font-size: 15px;
    line-height: 1.9;
    word-break: break-word;
}

.tf-image-usage p {
    margin: 0 0 10px;
}

.tf-image-usage ul,
.tf-image-usage ol {
    margin: 8px 0 12px 1.4em;
    padding: 0;
}

.tf-image-usage li {
    margin: 0 0 6px;
}

.tf-image-usage a {
    color: var(--tf-image-theme);
    text-decoration: none;
}

.tf-image-usage a:hover {
    text-decoration: underline;
}

.tf-image-usage-content {
    min-height: 180px;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-template-home .tf-image-sign-button.but::before {
        content: "\f090";
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 20px;
        height: 20px;
        font-family: FontAwesome;
        font-size: 20px;
        line-height: 20px;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-sign-button.but > span {
        display: none !important;
    }
}

@media (min-width: 1200px) {
    .tf-image-page {
        max-width: 1180px;
    }
}

@media (max-width: 1200px) {
    .tf-image-gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .tf-image-template-grid {
        column-count: 2;
    }
}

@media (max-width: 992px) {
    .tf-image-output-body {
        grid-template-rows: minmax(260px, auto) auto auto auto;
    }

    .tf-image-composer-status {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .tf-image-page {
        padding-top: 8px;
        padding-bottom: 276px;
    }

    .tf-image-head,
    .tf-image-output-body {
        padding-left: 12px;
        padding-right: 12px;
    }

    .tf-image-form textarea.form-control {
        height: 58px;
        min-height: 58px;
        font-size: 16px;
    }

    .tf-image-reference-preview {
        gap: 7px;
        margin-right: 0;
        padding-right: 6px;
    }

    .tf-image-reference-preview.has-items {
        margin: 0 0 8px;
    }

    .tf-image-reference-preview img {
        width: 60px;
        height: 48px;
        border-radius: 8px;
    }

    .tf-image-reference-item {
        width: 60px;
    }

    .tf-image-reference-remove {
        top: -8px;
        right: -8px;
        width: 24px;
        height: 24px;
    }

    .tf-image-reference-remove .ic-close {
        width: 11px;
        height: 11px;
    }

    .tf-image-composer {
        left: 10px;
        right: 10px;
        bottom: 10px;
    }

    .tf-image-composer-panel {
        padding: 14px;
        border-radius: 24px;
    }

    .tf-image-composer-top {
        justify-content: flex-start;
        margin: 0 48px 10px 0;
        padding-top: 0;
        border-top: 0;
    }

    .tf-image-composer-assets-mobile {
        display: flex;
    }

    .tf-image-composer-assets-desktop {
        display: none;
    }

    .tf-image-composer-prompt {
        min-height: 84px;
        padding: 10px 12px;
        border-radius: 18px;
    }

    .tf-image-composer-bottom {
        padding-right: 56px;
        gap: 10px;
    }

    .tf-image-composer-tools {
        gap: 8px;
    }

    .tf-image-template-open,
    .tf-image-upload,
    .tf-image-select-pill {
        min-height: 38px;
        padding: 7px 11px;
        font-size: 13px;
    }

    .tf-image-upload small,
    .tf-image-select-pill span {
        display: none;
    }

    .tf-image-aspect-modal.flex.in,
    .tf-image-aspect-modal.flex.show {
        align-items: flex-end;
        padding: 0 10px max(10px, env(safe-area-inset-bottom));
    }

    .tf-image-aspect-modal .modal-dialog {
        width: 100%;
        max-width: 100%;
    }

    .tf-image-aspect-modal .modal-content {
        border-radius: 28px;
    }

    .tf-image-aspect-modal .modal-body {
        padding: 0 16px 12px;
    }

    .tf-image-ratio-options {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .tf-image-aspect-option {
        min-height: 38px;
        border-radius: 13px;
        font-size: 12px;
    }

    .tf-image-asset-pill {
        min-height: 32px;
        padding: 5px 8px;
        gap: 5px;
    }

    .tf-image-asset-text span {
        display: none;
    }

    .tf-image-pay-actions .but {
        min-height: 32px;
        padding: 5px 8px;
    }

    .tf-image-pay-toggle {
        min-height: 38px;
        padding: 3px;
    }

    .tf-image-pay-toggle span {
        height: 30px;
        min-width: 46px;
        padding: 0 10px;
        font-size: 12px;
    }

    .tf-image-run {
        right: 14px;
        bottom: 14px;
        width: 44px;
        height: 44px;
        min-height: 44px;
    }

    .tf-image-head-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .tf-image-head-button span {
        display: none;
    }

    .tf-image-output-box.is-chat {
        padding: 12px;
    }

    .tf-image-chat-bubble {
        max-width: 82%;
        padding: 10px 14px;
        font-size: 14px;
    }

    .tf-image-generation-stopped {
        width: 82%;
        padding-top: 2px;
    }

    .tf-image-generation-stopped-label {
        margin-bottom: 7px;
        font-size: 12px;
    }

    .tf-image-generation-stopped-text {
        font-size: 14px;
        line-height: 1.68;
    }

    .tf-image-chat-user-refs {
        width: min(240px, 82%);
        grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
        gap: 7px;
    }

    .tf-image-chat-user-ref {
        border-radius: 15px;
    }

    .tf-image-chat-loading {
        min-height: 180px;
    }

    .tf-image-gallery-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .tf-image-gallery-grid,
    .tf-image-gallery-grid.is-records {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .tf-image-template-grid {
        column-count: 2;
        column-gap: 8px;
    }

    .tf-image-template-card {
        margin-bottom: 8px;
    }

    .tf-image-template-modal .modal-body {
        padding: 10px;
    }

    .tf-image-template-detail-cover,
    .tf-image-template-detail-placeholder {
        min-height: 180px;
    }

    .tf-image-template-detail-content {
        padding: 18px 14px 16px;
    }

    .tf-image-template-detail-content h3 {
        font-size: 21px;
    }

    .tf-image-template-detail-actions {
        grid-template-columns: 1fr;
    }

    .tf-image-template-detail-actions .but {
        min-height: 42px;
        font-size: 14px;
    }
}

/* Chat-style studio surface */
.tf-image-page {
    --tf-chat-surface: #f7f7f8;
    --tf-chat-user: #ececec;
    --tf-chat-panel: rgba(255, 255, 255, .82);
    --tf-chat-shadow: 0 18px 50px rgba(15, 23, 42, .08);
    max-width: 1180px;
    padding-top: 0;
}

.tf-image-studio {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.dark-theme .tf-image-studio {
    border-color: transparent;
    background: transparent;
}

.tf-image-head {
    min-height: 42px;
    padding: 0 4px 10px;
    border-bottom: 0;
    background: transparent;
}

.tf-image-title {
    color: var(--tf-image-muted);
    font-size: 13px;
}

.tf-image-head-mark {
    width: 8px;
    height: 8px;
    border: 0;
    background: var(--tf-image-theme);
    box-shadow: 0 0 0 4px var(--focus-color-opacity1, rgba(41, 151, 247, .1));
}

.tf-image-head-actions {
    gap: 6px;
}

.tf-image-head-button,
.tf-image-status {
    min-height: 30px;
    border: 1px solid rgba(125, 136, 155, .12);
    border-radius: 999px;
    background: rgba(255, 255, 255, .58);
    box-shadow: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.tf-image-head-button {
    padding: 0 11px;
}

.tf-image-status {
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
}

.tf-image-output-body {
    display: block;
    padding: 0 0 18px;
}

.tf-image-output-box {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 58vh;
    padding: 18px 0 24px;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.tf-image-output-empty {
    max-width: 520px;
    margin: 56px auto 18px;
    padding: 34px 24px;
    border: 1px dashed rgba(125, 136, 155, .2);
    border-radius: 28px;
    background: rgba(255, 255, 255, .48);
}

.tf-image-output-empty h2 {
    font-size: 22px;
}

.tf-image-output-box.is-chat {
    display: block;
    min-height: 58vh;
    max-height: none;
    padding: 12px 0 26px;
    overflow: visible;
}

.tf-image-chat-stream {
    gap: 22px;
}

.tf-image-chat-message {
    display: flex;
}

.tf-image-chat-user {
    justify-content: flex-end;
}

.tf-image-chat-ai {
    justify-content: flex-start;
}

.tf-image-chat-bubble {
    max-width: min(520px, 72%);
    padding: 12px 17px;
    border-radius: 22px;
    color: #202123;
    background: var(--tf-chat-user);
    box-shadow: none;
    font-size: 15px;
    line-height: 1.72;
}

.tf-image-chat-user .tf-image-chat-bubble {
    border-top-right-radius: 22px;
}

.tf-image-chat-loading {
    width: min(660px, 72vw);
    min-height: 300px;
    border: 0;
    border-radius: 28px;
    background: rgba(255, 255, 255, .68);
    box-shadow: var(--tf-chat-shadow);
}

.tf-image-loading-text {
    bottom: 24px;
}

.tf-image-result,
.tf-image-chat-result {
    width: min(760px, 76vw);
    height: auto;
    min-height: 0;
    overflow: hidden;
    border-radius: 28px;
    background: transparent;
    box-shadow: var(--tf-chat-shadow);
}

.tf-image-result img,
.tf-image-chat-result img {
    width: 100%;
    height: auto;
    max-height: min(620px, 62vh);
    border-radius: inherit;
    object-fit: contain;
}

.tf-image-notice {
    margin: 0 0 16px;
    border-radius: 16px;
}

.tf-image-gallery-head {
    margin: 22px 0 10px;
    padding: 0 4px;
}

.tf-image-gallery-head h3 {
    color: var(--tf-image-muted);
    font-size: 13px;
}

.tf-image-gallery-actions .but {
    min-height: 30px;
    border-radius: 999px;
}

.tf-image-gallery-grid {
    display: flex;
    gap: 10px;
    padding: 2px 4px 8px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}

.tf-image-gallery-grid::-webkit-scrollbar {
    height: 6px;
}

.tf-image-gallery-grid::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(125, 136, 155, .2);
}

.tf-image-gallery-grid.is-records {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: visible;
}

.tf-image-gallery-item {
    flex: 0 0 168px;
    border: 0;
    border-radius: 16px;
    background: rgba(255, 255, 255, .6);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
    scroll-snap-align: start;
}

.tf-image-gallery-grid.is-records .tf-image-gallery-item {
    flex-basis: auto;
}

.tf-image-gallery-item img {
    aspect-ratio: 16 / 11;
    border-radius: inherit;
}

.tf-image-gallery-meta {
    left: 8px;
    right: 8px;
    bottom: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .82);
    color: #202123;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.tf-image-empty-line {
    flex: 1 0 100%;
    border-radius: 18px;
}

.dark-theme .tf-image-page {
    --tf-chat-surface: #17191d;
    --tf-chat-user: #2a2d32;
    --tf-chat-panel: rgba(36, 38, 43, .82);
    --tf-chat-shadow: 0 18px 50px rgba(0, 0, 0, .3);
}

.dark-theme .tf-image-head-button,
.dark-theme .tf-image-status,
.dark-theme .tf-image-output-empty,
.dark-theme .tf-image-chat-loading,
.dark-theme .tf-image-gallery-item {
    background: rgba(36, 38, 43, .72);
}

.dark-theme .tf-image-chat-bubble,
.dark-theme .tf-image-gallery-meta {
    color: #f2f3f5;
}

.dark-theme .tf-image-gallery-meta {
    background: rgba(35, 37, 42, .82);
}

@media (max-width: 992px) {
    .tf-image-output-box,
    .tf-image-output-box.is-chat {
        min-height: 50vh;
    }

    .tf-image-chat-bubble {
        max-width: 82%;
        font-size: 14px;
    }

    .tf-image-chat-user-refs {
        width: min(260px, 82%);
    }

    .tf-image-chat-loading,
    .tf-image-result,
    .tf-image-chat-result {
        width: min(760px, 88vw);
    }
}

@media (max-width: 640px) {
    .tf-image-head {
        padding-left: 2px;
        padding-right: 2px;
    }

    .tf-image-head-actions {
        width: auto;
        justify-content: flex-end;
    }

    .tf-image-output-body {
        padding-left: 0;
        padding-right: 0;
    }

    .tf-image-output-box,
    .tf-image-output-box.is-chat {
        min-height: 44vh;
        padding-top: 8px;
    }

    .tf-image-output-empty {
        margin-top: 24px;
        border-radius: 22px;
    }

    .tf-image-chat-stream {
        gap: 18px;
    }

    .tf-image-chat-bubble {
        max-width: 92%;
        padding: 15px 17px;
        border-radius: 22px;
        font-size: 15px;
        line-height: 1.75;
    }

    .tf-image-chat-loading,
    .tf-image-result,
    .tf-image-chat-result {
        width: 100%;
        border-radius: 22px;
    }

    .tf-image-chat-loading {
        min-height: 200px;
    }

    .tf-image-gallery-grid {
        display: flex;
        gap: 10px;
    }

    .tf-image-gallery-grid.is-records {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tf-image-gallery-item {
        flex-basis: 150px;
    }
}

/* Official-chat inspired result surface */
.tf-image-page {
    --tf-chat-page: #fff;
    --tf-chat-ink: #202123;
    --tf-chat-muted: #8a8f98;
    --tf-chat-bubble: #ececec;
    --tf-chat-subtle: rgba(236, 236, 236, .72);
    --tf-chat-line: rgba(13, 18, 28, .08);
    --tf-chat-panel-shadow: 0 16px 48px rgba(15, 23, 42, .07);
    width: min(100%, 1060px);
    max-width: 1060px;
    padding-top: 4px;
    padding-bottom: 238px;
}

.tf-image-page .tf-image-studio {
    clear: none;
    padding: 0;
    margin: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.tf-image-page .tf-image-output {
    min-height: calc(100vh - 308px);
}

.tf-image-page .tf-image-head {
    position: relative;
    min-height: 52px;
    padding: 2px 0 8px;
    border: 0;
    background: transparent;
}

.tf-image-page .tf-image-title {
    gap: 9px;
    color: var(--tf-chat-ink);
    font-size: 15px;
    font-weight: 700;
}

.tf-image-page .tf-image-head-mark {
    width: 10px;
    height: 10px;
    border: 0;
    background: #10a37f;
    box-shadow: 0 0 0 5px rgba(16, 163, 127, .1);
}

.tf-image-page .tf-image-head-actions {
    flex-wrap: nowrap;
    gap: 8px;
}

.tf-image-page .tf-image-head-button,
.tf-image-page .tf-image-status {
    min-width: 0;
    min-height: 34px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: #5f6670;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.tf-image-page .tf-image-head-button {
    width: 34px;
    padding: 0;
    gap: 0;
}

.tf-image-page .tf-image-head-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.tf-image-page .tf-image-head-button:hover {
    color: var(--tf-chat-ink);
    border-color: var(--tf-chat-line);
    background: var(--tf-chat-subtle);
}

.tf-image-page .tf-image-status {
    display: inline-flex;
    align-items: center;
    padding: 0 4px;
    color: var(--tf-chat-muted);
    font-size: 13px;
}

.tf-image-page .tf-image-output-body {
    padding: 0;
}

.tf-image-page .tf-image-output-box {
    min-height: clamp(430px, 61vh, 720px);
    padding: 16px 0 24px;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.tf-image-page .tf-image-output-box.is-chat {
    display: block;
    min-height: clamp(430px, 61vh, 720px);
    padding: 8px 0 24px;
    overflow: visible;
}

.tf-image-page .tf-image-output-empty {
    max-width: 430px;
    margin: clamp(72px, 14vh, 140px) auto 20px;
    padding: 0 22px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.tf-image-page .tf-image-output-empty h2 {
    margin-bottom: 8px;
    color: var(--tf-chat-ink);
    font-size: 21px;
}

.tf-image-page .tf-image-output-empty p {
    color: var(--tf-chat-muted);
    font-size: 14px;
}

.tf-image-failure-reason {
    display: grid;
    gap: 6px;
    width: min(100%, 460px);
    margin: 16px auto 0;
    padding: 12px 14px;
    border: 1px solid rgba(244, 63, 94, .14);
    border-radius: 14px;
    color: rgba(43, 47, 55, .78);
    background: rgba(255, 255, 255, .72);
    text-align: left;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .06);
}

.tf-image-failure-reason b {
    color: rgba(17, 24, 39, .92);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
}

.tf-image-failure-reason span {
    color: rgba(77, 84, 97, .9);
    font-size: 13px;
    line-height: 1.6;
}

.tf-image-chat-failure-reason {
    width: min(620px, 88%);
    margin: 10px 0 0;
    background: rgba(255, 255, 255, .68);
}

.tf-image-page .tf-image-gpt-mark {
    width: 58px;
    height: 58px;
    margin-bottom: 18px;
    color: #6b6ff8;
    animation-duration: 2.6s;
}

.tf-image-page .tf-image-gpt-mark i {
    left: 18px;
    top: 5px;
    width: 22px;
    height: 48px;
    border-color: currentColor;
    opacity: .82;
    box-shadow: 0 0 10px rgba(107, 111, 248, .18);
}

.tf-image-page .tf-image-chat-stream {
    width: min(100%, 920px);
    margin: 0 auto;
    gap: 28px;
}

.tf-image-page .tf-image-chat-message {
    display: flex;
    width: 100%;
}

.tf-image-page .tf-image-chat-user {
    justify-content: flex-end;
    align-items: flex-end;
}

.tf-image-page .tf-image-chat-ai {
    justify-content: flex-start;
}

.tf-image-page .tf-image-chat-bubble {
    max-width: min(520px, 72%);
    padding: 12px 17px;
    border: 0;
    border-radius: 22px;
    background: var(--tf-chat-bubble);
    color: var(--tf-chat-ink);
    box-shadow: none;
    font-size: 15px;
    line-height: 1.72;
    word-break: break-word;
}

.tf-image-page .tf-image-chat-user .tf-image-chat-bubble {
    border-top-right-radius: 22px;
}

.tf-image-page .tf-image-chat-prompt-actions {
    margin: 10px 18px 0 0;
    gap: 12px;
}

.tf-image-page .tf-image-chat-action {
    width: 34px;
    height: 34px;
    color: rgba(42, 45, 52, .62);
    font-size: 20px;
}

.tf-image-page .tf-image-chat-action:hover {
    color: #1f8bff;
    background: rgba(31, 139, 255, .08);
}

.tf-image-page .tf-image-chat-loading {
    width: min(720px, 78vw);
    min-height: 320px;
    overflow: hidden;
    border: 1px solid var(--tf-chat-line);
    border-radius: 30px;
    background: rgba(255, 255, 255, .78);
    box-shadow: var(--tf-chat-panel-shadow);
}

.tf-image-page .tf-image-loading-text {
    bottom: 26px;
    color: var(--tf-chat-muted);
    font-size: 13px;
}

.tf-image-page .tf-image-result,
.tf-image-page .tf-image-chat-result {
    width: min(760px, 78vw);
    height: auto;
    min-height: 0;
    overflow: hidden;
    border: 0;
    border-radius: 30px;
    background: transparent;
    box-shadow: var(--tf-chat-panel-shadow);
}

.tf-image-page .tf-image-result img,
.tf-image-page .tf-image-chat-result img {
    display: block;
    width: 100%;
    height: auto;
    max-height: min(680px, 64vh);
    border-radius: inherit;
    object-fit: contain;
}

.tf-image-page .tf-image-chat-error {
    max-width: min(620px, 88%);
    margin: 0;
    padding: 22px 24px;
    border: 1px solid rgba(244, 63, 94, .12);
    border-radius: 24px;
    background: rgba(255, 255, 255, .74);
}

.tf-image-page .tf-image-chat-error-inline {
    max-width: min(620px, 88%);
    padding: 12px 16px 12px 14px;
    border: 1px solid rgba(148, 163, 184, .16);
    border-radius: 20px;
    background: rgba(255, 255, 255, .72);
    color: rgba(43, 47, 55, .78);
    box-shadow: 0 12px 34px rgba(15, 23, 42, .07);
}

.dark-theme .tf-image-chat-error-inline,
.dark-theme .tf-image-page .tf-image-chat-error-inline {
    border-color: rgba(255, 255, 255, .1);
    color: rgba(245, 247, 250, .78);
    background: rgba(36, 38, 43, .64);
    box-shadow: 0 14px 36px rgba(0, 0, 0, .22);
}

.dark-theme .tf-image-chat-error-inline i {
    color: #ff6b7e;
    background: rgba(255, 107, 126, .12);
}

.dark-theme .tf-image-generation-stopped-label {
    color: rgba(245, 247, 250, .42);
}

.dark-theme .tf-image-generation-stopped-text {
    color: rgba(245, 247, 250, .9);
}

.tf-image-page .tf-image-notice {
    display: none !important;
}

.tf-image-page .tf-image-gallery-head {
    width: min(100%, 920px);
    margin: 8px auto 12px;
    padding: 0;
}

.tf-image-page .tf-image-gallery-head h3 {
    color: var(--tf-chat-muted);
    font-size: 13px;
    font-weight: 700;
}

.tf-image-page .tf-image-gallery-actions {
    gap: 6px;
}

.tf-image-page .tf-image-gallery-actions .but {
    min-height: 32px;
    padding: 4px 10px;
    border-color: var(--tf-chat-line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .48);
    color: #59606b;
    font-size: 12px;
}

.tf-image-page .tf-image-gallery-grid {
    width: min(100%, 920px);
    margin: 0 auto;
    padding: 0 0 10px;
}

.tf-image-page .tf-image-gallery-grid[hidden],
.tf-image-page .tf-image-gallery-head[hidden] {
    display: none !important;
}

.tf-image-page .tf-image-gallery-item {
    flex: 0 0 136px;
    border: 0;
    border-radius: 18px;
    background: transparent;
    box-shadow: none;
}

.tf-image-page .tf-image-gallery-item img {
    aspect-ratio: 1 / 1;
    border-radius: inherit;
    box-shadow: 0 6px 20px rgba(15, 23, 42, .08);
}

.tf-image-page .tf-image-gallery-tools {
    top: 7px;
    right: 7px;
}

.tf-image-page .tf-image-gallery-meta {
    left: 8px;
    right: 8px;
    bottom: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .86);
    color: #353942;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .1);
}

.tf-image-page .tf-image-empty-line {
    min-height: 76px;
    border-color: rgba(125, 136, 155, .16);
    border-radius: 22px;
    background: rgba(255, 255, 255, .34);
}

.dark-theme .tf-image-page {
    --tf-chat-page: #212327;
    --tf-chat-ink: #f2f3f5;
    --tf-chat-muted: #a6abb3;
    --tf-chat-bubble: #303338;
    --tf-chat-subtle: rgba(255, 255, 255, .08);
    --tf-chat-line: rgba(255, 255, 255, .1);
    --tf-chat-panel-shadow: 0 18px 56px rgba(0, 0, 0, .34);
}

.dark-theme .tf-image-page .tf-image-chat-loading,
.dark-theme .tf-image-page .tf-image-chat-error,
.dark-theme .tf-image-page .tf-image-gallery-actions .but,
.dark-theme .tf-image-page .tf-image-empty-line {
    background: rgba(36, 38, 43, .6);
}

.dark-theme .tf-image-page .tf-image-gallery-meta {
    background: rgba(36, 38, 43, .86);
    color: var(--tf-chat-ink);
}

@media (max-width: 768px) {
    .tf-image-page {
        width: 100%;
        padding-top: 0;
        padding-bottom: 258px;
    }

    .tf-image-page .tf-image-output {
        min-height: calc(100vh - 288px);
    }

    .tf-image-page .tf-image-head {
        min-height: 46px;
        padding: 0 0 4px;
    }

    .tf-image-page .tf-image-title {
        max-width: 42%;
        font-size: 14px;
        line-height: 1.25;
    }

    .tf-image-page .tf-image-head-actions {
        gap: 4px;
    }

    .tf-image-page .tf-image-head-button {
        width: 32px;
        min-height: 32px;
    }

    .tf-image-page .tf-image-status {
        padding-right: 0;
        font-size: 12px;
    }

    .tf-image-page .tf-image-output-box,
    .tf-image-page .tf-image-output-box.is-chat {
        min-height: 48vh;
        padding: 6px 0 16px;
    }

    .tf-image-page .tf-image-output-empty {
        margin-top: clamp(48px, 10vh, 86px);
    }

    .tf-image-page .tf-image-chat-stream {
        gap: 22px;
    }

    .tf-image-page .tf-image-chat-bubble {
        max-width: 82%;
        padding: 10px 14px;
        border-radius: 20px;
        font-size: 15px;
        line-height: 1.68;
    }

    .tf-image-page .tf-image-generation-stopped {
        width: 82%;
    }

    .tf-image-page .tf-image-generation-stopped-label {
        margin-bottom: 7px;
        font-size: 12px;
    }

    .tf-image-page .tf-image-generation-stopped-text {
        font-size: 14px;
        line-height: 1.68;
    }

    .tf-image-page .tf-image-chat-user-refs {
        width: min(240px, 82%);
        grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
    }

    .tf-image-page .tf-image-chat-loading,
    .tf-image-page .tf-image-result,
    .tf-image-page .tf-image-chat-result {
        width: 100%;
        border-radius: 24px;
    }

    .tf-image-page .tf-image-chat-loading {
        min-height: 220px;
    }

    .tf-image-page .tf-image-gallery-head {
        align-items: center;
        flex-direction: row;
        gap: 8px;
    }

    .tf-image-page .tf-image-gallery-actions .but {
        padding: 4px 8px;
        font-size: 12px;
    }

    .tf-image-page .tf-image-gallery-item {
        flex-basis: 122px;
    }
}

@media (max-width: 420px) {
    .tf-image-page .tf-image-gallery-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .tf-image-page .tf-image-gallery-actions {
        width: 100%;
    }

    .tf-image-page .tf-image-gallery-actions .but {
        flex: 1 1 0;
    }
}

/* Standalone template-first layout */
body.tf-image-standalone-page {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background: var(--body-bg-color, #f5f6f7);
}

body.tf-image-standalone-page.admin-bar {
    min-height: calc(100vh - 32px);
}

body.tf-image-standalone-page .fixed-body,
body.tf-image-standalone-page .main-fixed,
body.tf-image-standalone-page header,
body.tf-image-standalone-page footer,
body.tf-image-standalone-page .mobile-navbar,
body.tf-image-standalone-page .float-right,
body.tf-image-standalone-page .footer-tabbar,
body.tf-image-standalone-page .footer-tabbar-placeholder {
    display: none !important;
}

body.tf-image-standalone-page .tf-image-page {
    width: min(100% - 32px, 1180px);
    max-width: 1180px;
    min-height: 100vh;
    padding-top: 20px;
    padding-bottom: 238px;
}

body.tf-image-standalone-page .tf-image-studio {
    min-height: calc(100vh - 278px);
}

.tf-image-template-home {
    min-height: calc(100vh - 278px);
}

.tf-image-template-home .tf-image-head {
    width: min(100%, 1040px);
    margin: 0 auto 12px;
}

.tf-image-template-home .tf-image-template-list-view {
    width: min(100%, 1040px);
    margin: 0 auto;
    padding-bottom: 28px;
}

.tf-image-template-home .tf-image-template-grid {
    column-count: 4;
    column-gap: 14px;
}

.tf-image-template-home .tf-image-template-card {
    border: 0;
    border-radius: 22px;
    background: transparent;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .07);
}

.tf-image-template-home .tf-image-template-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 44px rgba(15, 23, 42, .12);
}

.tf-image-template-home .tf-image-template-cover {
    min-height: 180px;
    background: rgba(255, 255, 255, .64);
}

.tf-image-template-home .tf-image-template-cover img {
    width: 100%;
    min-height: 180px;
    object-fit: cover;
}

.tf-image-work-panel[hidden],
.tf-image-template-home[hidden] {
    display: none !important;
}

body.tf-image-standalone-page .tf-image-composer {
    left: max(16px, calc((100vw - 1060px) / 2));
    right: max(16px, calc((100vw - 1060px) / 2));
}

@media (max-width: 1100px) {
    .tf-image-template-home .tf-image-template-grid {
        column-count: 3;
    }
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-page {
        width: calc(100% - 20px);
        padding-top: 12px;
        padding-bottom: 258px;
    }

    body.tf-image-standalone-page .tf-image-studio,
    .tf-image-template-home {
        min-height: calc(100vh - 292px);
    }

    .tf-image-template-home .tf-image-template-grid {
        column-count: 2;
        column-gap: 10px;
    }

    .tf-image-template-home .tf-image-template-card {
        margin-bottom: 10px;
        border-radius: 18px;
    }

    .tf-image-template-home .tf-image-template-cover,
    .tf-image-template-home .tf-image-template-cover img {
        min-height: 142px;
    }

}

/* Final mobile/template workflow polish */
.tf-image-mobile-settings-open {
    display: none;
}

.tf-image-page .tf-image-head-button.but {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-height: 34px;
    padding: 6px 13px;
    gap: 6px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
}

.tf-image-page .tf-image-head-button.but.hollow {
    border: 1px solid var(--focus-color-opacity3, rgba(41, 151, 247, .28)) !important;
    background: rgba(255, 255, 255, .68) !important;
    color: var(--theme-color, #2997f7) !important;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .06);
}

.tf-image-page .tf-image-head-button.but.hollow:hover {
    border-color: var(--theme-color, #2997f7) !important;
    background: rgba(255, 255, 255, .92) !important;
}

.tf-image-page .tf-image-head-button.but span {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: nowrap;
}

body.tf-image-standalone-page .modal-backdrop.in,
body.tf-image-standalone-page .modal-backdrop.show {
    opacity: .34;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.tf-image-template-preview-modal .modal-dialog,
.tf-image-mobile-settings-modal .modal-dialog {
    width: min(92vw, 520px);
}

.tf-image-template-preview-modal .modal-content,
.tf-image-mobile-settings-modal .modal-content {
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 30px;
    background: rgba(255, 255, 255, .72);
    box-shadow: 0 28px 80px rgba(15, 23, 42, .22);
    backdrop-filter: blur(28px) saturate(1.14);
    -webkit-backdrop-filter: blur(28px) saturate(1.14);
}

.tf-image-glass-close,
.tf-image-mobile-settings-close {
    position: absolute;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #111;
    background: rgba(255, 255, 255, .78);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .12);
}

.tf-image-glass-close {
    top: 18px;
    right: 18px;
}

.tf-image-template-preview-cover {
    min-height: 260px;
    background: rgba(255, 255, 255, .46);
}

.tf-image-template-preview-cover img {
    display: block;
    width: 100%;
    max-height: 420px;
    object-fit: cover;
}

.tf-image-template-preview-body {
    padding: 24px 28px 28px;
}

.tf-image-template-preview-body h2 {
    margin: 0 64px 10px 0;
    color: #111;
    font-size: 28px;
    font-weight: 800;
    line-height: 1.18;
}

.tf-image-template-preview-body p {
    display: -webkit-box;
    margin: 0 0 22px;
    overflow: hidden;
    color: rgba(17, 17, 17, .62);
    font-size: 15px;
    line-height: 1.72;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.tf-image-template-preview-apply {
    width: 100%;
    min-height: 48px;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 800;
}

.tf-image-mobile-settings-header {
    padding: 34px 42px 16px;
}

.tf-image-mobile-settings-header h3 {
    margin: 0 64px 8px 0;
    color: #111;
    font-size: 28px;
    font-weight: 800;
    line-height: 1.2;
}

.tf-image-mobile-settings-header p {
    margin: 0;
    color: rgba(17, 17, 17, .48);
    font-size: 16px;
    font-weight: 700;
}

.tf-image-mobile-settings-close {
    top: 38px;
    right: 40px;
}

.tf-image-mobile-settings-list {
    display: grid;
    gap: 16px;
    padding: 10px 32px 32px;
}

.tf-image-mobile-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    width: 100%;
    min-height: 76px;
    margin: 0;
    padding: 0 26px;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 999px;
    color: #111;
    background: rgba(255, 255, 255, .74);
    box-shadow: 0 12px 26px rgba(15, 23, 42, .12);
    font-size: 18px;
    font-weight: 800;
}

.tf-image-mobile-setting-row small {
    color: rgba(17, 17, 17, .46);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.tf-image-mobile-setting-main {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.tf-image-mobile-setting-main i {
    color: rgba(17, 17, 17, .72);
    font-size: 22px;
}

.tf-image-mobile-setting-row select.form-control {
    width: auto;
    min-width: 92px;
    height: 40px;
    padding: 0 24px 0 8px;
    border: 0;
    background: transparent;
    color: rgba(17, 17, 17, .68);
    box-shadow: none;
    font-size: 18px;
    font-weight: 800;
    text-align: right;
}

.tf-image-mobile-payment-row {
    border-radius: 28px;
}

.tf-image-mobile-payment {
    display: inline-flex;
    gap: 8px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(17, 17, 17, .06);
}

.tf-image-mobile-payment button {
    min-width: 58px;
    height: 38px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    color: rgba(17, 17, 17, .56);
    background: transparent;
    font-weight: 800;
}

.tf-image-mobile-payment button.active {
    color: #fff;
    background: #111;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-page {
        width: calc(100% - 30px);
        padding-top: 26px;
        padding-bottom: 118px;
    }

    body.tf-image-standalone-page .tf-image-studio,
    .tf-image-template-home {
        min-height: calc(100vh - 150px);
    }

    .tf-image-template-home .tf-image-head {
        align-items: flex-start;
        margin-bottom: 18px;
    }

    .tf-image-template-home .tf-image-title {
        max-width: none;
    }

    .tf-image-template-home .tf-image-title span {
        color: #111;
        font-size: 34px;
        font-weight: 800;
        line-height: 1.08;
    }

    .tf-image-page .tf-image-head-actions {
        flex: 0 0 auto;
        width: auto;
        gap: 8px;
    }

    .tf-image-page .tf-image-head-button.but {
        width: 48px;
        min-width: 48px;
        min-height: 48px;
        padding: 0;
        border-radius: 50%;
        box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
    }

    .tf-image-page .tf-image-head-button.but.hollow {
        border-color: rgba(255, 255, 255, .74) !important;
        background: rgba(255, 255, 255, .84) !important;
        color: rgba(17, 17, 17, .72) !important;
    }

    .tf-image-page .tf-image-head-button.but span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .tf-image-template-home .tf-image-template-list-view {
        padding-bottom: 12px;
    }

    .tf-image-template-home .tf-image-template-grid {
        column-gap: 14px;
    }

    .tf-image-template-home .tf-image-template-card {
        margin-bottom: 14px;
        border-radius: 30px;
    }

    .tf-image-template-home .tf-image-template-cover,
    .tf-image-template-home .tf-image-template-cover img {
        min-height: 170px;
    }

    body.tf-image-standalone-page .tf-image-composer {
        left: 14px;
        right: 14px;
        bottom: calc(10px + env(safe-area-inset-bottom));
    }

    .tf-image-composer-panel {
        display: flex;
        align-items: center;
        flex-direction: row;
        gap: 10px;
        min-height: 64px;
        padding: 8px 58px 8px 10px;
        border-radius: 32px;
        background: rgba(255, 255, 255, .82);
        box-shadow: 0 18px 48px rgba(15, 23, 42, .16);
    }

    .tf-image-composer-assets-mobile,
    .tf-image-composer-assets-desktop,
    .tf-image-composer-tools {
        display: none !important;
    }

    .tf-image-mobile-settings-open {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        order: 0;
        flex: 0 0 auto;
        width: 44px;
        height: 44px;
        padding: 0;
        border: 0;
        border-radius: 50%;
        color: #111;
        background: rgba(17, 17, 17, .06);
        font-size: 18px;
    }

    .tf-image-composer-prompt {
        order: 1;
        flex: 1 1 auto;
        min-height: 44px;
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .tf-image-form textarea.form-control {
        height: 44px;
        min-height: 44px;
        max-height: 92px;
        padding: 9px 0;
        font-size: 16px;
        line-height: 1.55;
    }

    .tf-image-composer-bottom {
        display: contents;
    }

    .tf-image-run {
        order: 2;
        right: 10px;
        bottom: 10px;
        width: 44px;
        height: 44px;
        min-height: 44px;
    }

    .tf-image-reference-preview.has-items {
        position: absolute;
        left: 14px;
        right: 14px;
        bottom: 74px;
        max-height: 82px;
        margin: 0;
        padding: 8px;
        overflow-x: auto;
        border-radius: 18px;
        background: rgba(255, 255, 255, .78);
        box-shadow: 0 12px 30px rgba(15, 23, 42, .12);
    }

    .tf-image-reference-item,
    .tf-image-reference-preview img {
        width: 58px;
    }

    .tf-image-template-preview-modal .modal-dialog,
    .tf-image-mobile-settings-modal .modal-dialog {
        position: fixed;
        left: 14px;
        right: 14px;
        bottom: calc(14px + env(safe-area-inset-bottom));
        width: auto;
        margin: 0;
    }

    .tf-image-template-preview-modal .modal-content,
    .tf-image-mobile-settings-modal .modal-content {
        border-radius: 34px;
    }

    .tf-image-template-preview-cover {
        min-height: 220px;
    }

    .tf-image-template-preview-body {
        padding: 22px 26px 26px;
    }

    .tf-image-template-preview-body h2,
    .tf-image-mobile-settings-header h3 {
        font-size: 27px;
    }

    .tf-image-mobile-settings-header {
        padding: 34px 42px 14px;
    }

    .tf-image-mobile-settings-list {
        gap: 16px;
        padding: 10px 32px 30px;
    }

    .tf-image-mobile-setting-row {
        min-height: 74px;
        padding: 0 24px;
        font-size: 18px;
    }
}

@media (max-width: 420px) {
    body.tf-image-standalone-page .tf-image-page {
        width: calc(100% - 20px);
        padding-top: 20px;
    }

    .tf-image-template-home .tf-image-title span {
        font-size: 30px;
    }

    .tf-image-page .tf-image-head-button.but {
        width: 42px;
        min-width: 42px;
        min-height: 42px;
    }

    .tf-image-template-home .tf-image-template-cover,
    .tf-image-template-home .tf-image-template-cover img {
        min-height: 148px;
    }

    .tf-image-mobile-settings-header {
        padding: 30px 30px 12px;
    }

    .tf-image-mobile-settings-close {
        top: 28px;
        right: 28px;
        width: 48px;
        height: 48px;
    }

    .tf-image-mobile-settings-list {
        padding: 8px 22px 24px;
    }

    .tf-image-mobile-setting-row {
        min-height: 68px;
        padding: 0 20px;
        font-size: 16px;
    }
}

/* Final compact mobile modal pass */
.tf-image-template-card {
    transition: box-shadow .18s ease, border-color .18s ease;
}

.tf-image-template-card:hover,
.tf-image-template-home .tf-image-template-card:hover {
    transform: none !important;
}

.tf-image-template-home .tf-image-template-card:hover {
    box-shadow: 0 10px 28px rgba(15, 23, 42, .07);
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-template-preview-modal .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-dialog {
        position: fixed !important;
        top: auto !important;
        left: 16px !important;
        right: 16px !important;
        bottom: calc(12px + env(safe-area-inset-bottom)) !important;
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
        transform: none !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .modal-content,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-content {
        max-height: calc(100vh - 34px - env(safe-area-inset-bottom));
        overflow: hidden auto;
        border-radius: 28px;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-header {
        padding: 24px 28px 10px;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-header h3 {
        margin-right: 58px;
        font-size: 24px;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-header p {
        font-size: 14px;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-close,
    body.tf-image-standalone-page .tf-image-glass-close {
        top: 20px;
        right: 22px;
        width: 44px;
        height: 44px;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-list {
        gap: 12px;
        padding: 10px 20px 22px;
    }

    body.tf-image-standalone-page .tf-image-mobile-setting-row {
        min-height: 60px;
        padding: 0 18px;
        border-radius: 24px;
        font-size: 16px;
    }

    body.tf-image-standalone-page .tf-image-mobile-setting-row select.form-control {
        max-width: 138px;
        min-width: 0;
        font-size: 15px;
    }

    body.tf-image-standalone-page .tf-image-template-preview-cover {
        min-height: 0;
        max-height: 42vh;
        overflow: hidden;
    }

    body.tf-image-standalone-page .tf-image-template-preview-cover img {
        max-height: 42vh;
        object-fit: cover;
    }

    body.tf-image-standalone-page .tf-image-template-preview-body {
        padding: 18px 22px 22px;
    }

    body.tf-image-standalone-page .tf-image-template-preview-body h2 {
        margin-right: 54px;
        margin-bottom: 8px;
        font-size: 23px;
    }

    body.tf-image-standalone-page .tf-image-template-preview-body p {
        margin-bottom: 16px;
        font-size: 14px;
        line-height: 1.58;
        -webkit-line-clamp: 2;
    }

    body.tf-image-standalone-page .tf-image-template-preview-apply {
        min-height: 44px;
        font-size: 15px;
    }
}

@media (max-width: 420px) {
    body.tf-image-standalone-page .tf-image-template-preview-modal .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-dialog {
        left: 10px !important;
        right: 10px !important;
        bottom: calc(10px + env(safe-area-inset-bottom)) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .modal-content,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-content {
        border-radius: 24px;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-header {
        padding: 22px 22px 8px;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-list {
        padding: 8px 16px 18px;
    }
}

/* Compact generation loading surface */
.tf-image-page .tf-image-chat-ai {
    justify-content: center;
}

.tf-image-page .tf-image-chat-loading {
    width: min(380px, 58vw) !important;
    min-height: 0 !important;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    border-radius: 28px;
}

.tf-image-page .tf-image-loading-dots {
    inset: 0;
}

.tf-image-page .tf-image-loading-dots canvas {
    left: 50%;
    top: 50%;
    right: auto;
    bottom: auto;
    width: 100% !important;
    height: 100% !important;
    transform: translate(-50%, -50%);
}

.tf-image-page .tf-image-loading-text {
    bottom: 22px;
}

.tf-image-page .tf-image-result,
.tf-image-page .tf-image-chat-result {
    margin: 0 auto;
}

@media (max-width: 768px) {
    .tf-image-page .tf-image-chat-ai {
        justify-content: center;
    }

    .tf-image-page .tf-image-chat-loading {
        width: min(76vw, 300px) !important;
        border-radius: 24px;
    }
}

/* Zibll-native header buttons and centered template preview */
body.tf-image-standalone-page .tf-image-page .tf-image-head-button.but {
    width: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    padding: .3em .8em !important;
    gap: 0 !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    font-weight: normal !important;
    line-height: 1.44 !important;
    box-shadow: var(--this-shadow) !important;
}

body.tf-image-standalone-page .tf-image-page .tf-image-head-button.but.hollow {
    border-color: var(--this-border) !important;
    background: transparent !important;
    color: var(--this-color) !important;
    box-shadow: var(--this-shadow) !important;
}

body.tf-image-standalone-page .tf-image-page .tf-image-head-button.but.hollow:hover {
    opacity: .8;
    background: var(--this-bg) !important;
    color: var(--this-color) !important;
}

body.tf-image-standalone-page .tf-image-page .tf-image-head-button.but span {
    position: static !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: nowrap !important;
}

body.tf-image-standalone-page .tf-image-page .tf-image-head-button.but > .fa:not(.fa-angle-right) {
    margin-right: .25em;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.in,
body.tf-image-standalone-page .tf-image-template-preview-modal.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

body.tf-image-standalone-page .tf-image-template-preview-modal .modal-dialog {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: min(92vw, 520px) !important;
    max-width: 520px !important;
    margin: 0 auto !important;
    transform: none !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal .modal-content {
    max-height: min(88vh, 760px);
    overflow: hidden auto;
}

body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-cover {
    min-height: 0;
    max-height: min(46vh, 360px);
    overflow: hidden;
}

body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-cover img {
    max-height: min(46vh, 360px);
    object-fit: cover;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-page .tf-image-head-button.but {
        width: 42px !important;
        min-width: 42px !important;
        min-height: 42px !important;
        padding: 0 !important;
        border-radius: 4px !important;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-head-button.but span {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        overflow: hidden !important;
        clip: rect(0, 0, 0, 0) !important;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-head-button.but > .fa:not(.fa-angle-right) {
        margin-right: 0;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.in,
    body.tf-image-standalone-page .tf-image-template-preview-modal.show {
        align-items: center;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .modal-dialog {
        width: calc(100vw - 28px) !important;
        max-width: 420px !important;
        margin: 0 auto !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .modal-content {
        max-height: calc(100vh - 42px);
        border-radius: 24px;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-cover,
    body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-cover img {
        max-height: 36vh;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-dialog {
        position: fixed !important;
        top: auto !important;
        left: 16px !important;
        right: 16px !important;
        bottom: calc(12px + env(safe-area-inset-bottom)) !important;
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
        transform: none !important;
    }
}

/* Mobile template picker uses the Zibll-style bottom sheet */
@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-template-preview-modal.in,
    body.tf-image-standalone-page .tf-image-template-preview-modal.show {
        display: block !important;
        align-items: initial !important;
        justify-content: initial !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.fade .modal-dialog {
        transform: translateY(100%) !important;
        transition: transform .26s cubic-bezier(.22, .61, .36, 1) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.in .modal-dialog,
    body.tf-image-standalone-page .tf-image-template-preview-modal.show .modal-dialog {
        transform: translateY(0) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .modal-dialog {
        position: fixed !important;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .modal-content {
        max-height: min(82vh, 680px) !important;
        overflow: hidden auto;
        border: 0 !important;
        border-radius: 18px 18px 0 0 !important;
        background: var(--main-bg-color, #fff) !important;
        box-shadow: 0 -14px 38px rgba(0, 0, 0, .16) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .modal-content::before {
        content: "";
        display: block;
        width: 38px;
        height: 4px;
        margin: 10px auto 8px;
        border-radius: 999px;
        background: rgba(125, 125, 125, .32);
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-glass-close {
        top: 14px !important;
        right: 14px !important;
        width: 34px !important;
        height: 34px !important;
        color: var(--main-color, #333) !important;
        background: var(--muted-border-color, rgba(120, 120, 120, .1)) !important;
        box-shadow: none !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-cover {
        min-height: 0 !important;
        max-height: 34vh !important;
        margin: 0 14px;
        overflow: hidden;
        border-radius: 12px;
        background: var(--muted-border-color, rgba(120, 120, 120, .08)) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-cover img {
        width: 100%;
        max-height: 34vh !important;
        aspect-ratio: 16 / 10;
        object-fit: cover;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-body {
        padding: 16px 16px 8px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-body h2 {
        margin: 0 42px 8px 0 !important;
        color: var(--main-color, #333) !important;
        font-size: 18px !important;
        font-weight: 700 !important;
        line-height: 1.35 !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-body p {
        margin: 0 0 14px !important;
        color: var(--muted-color, #777) !important;
        font-size: 13px !important;
        line-height: 1.65 !important;
        -webkit-line-clamp: 3 !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-apply {
        min-height: 42px !important;
        border-radius: var(--main-radius, 6px) !important;
        font-size: 14px !important;
        font-weight: 600 !important;
    }
}

/* Keep image-page modals aligned with native Zibll modal UI */
body.tf-image-standalone-page .tf-image-modal .modal-content {
    border: 0 !important;
    border-radius: var(--main-radius, 6px) !important;
    background: var(--main-bg-color, #fff) !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, .18) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.tf-image-standalone-page .modal-backdrop.in,
body.tf-image-standalone-page .modal-backdrop.show {
    opacity: .45 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.tf-image-standalone-page .tf-image-modal-header {
    min-height: 52px;
    padding: 14px 52px 13px;
    border-bottom-color: var(--main-border-color, rgba(125, 125, 125, .12));
}

body.tf-image-standalone-page .tf-image-modal-header .modal-title {
    color: var(--main-color, #333);
    font-size: 16px;
    font-weight: 700;
}

body.tf-image-standalone-page .tf-image-modal-header .modal-title i {
    color: var(--muted-color, #999);
}

body.tf-image-standalone-page .tf-image-modal-close {
    top: 10px !important;
    right: 10px !important;
    width: 32px !important;
    height: 32px !important;
    margin: 0 !important;
    padding: 0 !important;
    color: var(--muted-color, #999) !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    opacity: .55 !important;
    line-height: 32px !important;
}

body.tf-image-standalone-page .tf-image-modal-close:hover {
    color: var(--main-color, #333) !important;
    opacity: .9 !important;
}

body.tf-image-standalone-page .tf-image-modal-close .ic-close {
    width: 14px;
    height: 14px;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.in,
body.tf-image-standalone-page .tf-image-template-preview-modal.show,
body.tf-image-standalone-page .tf-image-mobile-settings-modal.in,
body.tf-image-standalone-page .tf-image-mobile-settings-modal.show {
    display: block !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal .modal-dialog,
body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-dialog {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 400px !important;
    max-width: calc(100% - 20px) !important;
    margin: 30px auto !important;
    transform: none !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal .modal-content,
body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-content {
    max-height: calc(100vh - 60px) !important;
    overflow: hidden !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal .modal-body,
body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-body {
    max-height: calc(100vh - 170px);
    overflow: auto;
    padding: 15px;
}

body.tf-image-standalone-page .tf-image-template-preview-modal .modal-content::before {
    display: none !important;
}

body.tf-image-standalone-page .tf-image-template-preview-cover {
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 0 12px !important;
    overflow: hidden;
    border-radius: var(--main-radius, 6px);
    background: var(--muted-border-color, rgba(125, 125, 125, .08)) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-cover img {
    display: block;
    width: 100%;
    max-height: min(45vh, 360px) !important;
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

body.tf-image-standalone-page .tf-image-template-preview-prompt {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--muted-color, #777);
    font-size: 14px;
    line-height: 1.65;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

body.tf-image-standalone-page .tf-image-template-preview-modal .modal-buts {
    padding: 0 15px 15px;
}

body.tf-image-standalone-page .tf-image-template-preview-apply {
    width: 100%;
    min-height: 36px !important;
    border-radius: var(--main-radius, 6px) !important;
    font-size: 14px !important;
    font-weight: 400 !important;
}

body.tf-image-standalone-page .tf-image-mobile-settings-list {
    display: grid;
    gap: 10px;
    padding: 0 !important;
}

body.tf-image-standalone-page .tf-image-mobile-setting-row {
    min-height: 48px !important;
    padding: 0 14px !important;
    border: 1px solid var(--main-border-color, rgba(125, 125, 125, .12)) !important;
    border-radius: var(--main-radius, 6px) !important;
    background: var(--muted-border-color, rgba(125, 125, 125, .06)) !important;
    color: var(--main-color, #333) !important;
    font-size: 14px !important;
}

body.tf-image-standalone-page .tf-image-mobile-setting-row select.form-control {
    max-width: 155px;
}

@media (max-width: 640px) {
    body.tf-image-standalone-page .tf-image-template-preview-modal.in,
    body.tf-image-standalone-page .tf-image-template-preview-modal.show,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.in,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.show {
        display: flex !important;
        align-items: flex-end;
        overflow: hidden !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.fade .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.fade .modal-dialog {
        transform: translateY(110%) !important;
        transition: .4s !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.in .modal-dialog,
    body.tf-image-standalone-page .tf-image-template-preview-modal.show .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.in .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.show .modal-dialog {
        transform: translateY(0) !important;
        transition: .6s cubic-bezier(.28, .9, .34, .99) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-dialog {
        position: relative !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 -1px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .modal-content,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-content {
        max-height: 82vh !important;
        border-radius: 16px 16px 0 0 !important;
        box-shadow: 0 -10px 50px rgba(0, 0, 0, .15) !important;
        padding-bottom: env(safe-area-inset-bottom);
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .modal-body,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-body {
        max-height: calc(82vh - 112px);
        padding: 14px;
    }

    body.tf-image-standalone-page .tf-image-template-preview-cover img {
        max-height: 34vh !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-prompt {
        font-size: 13px;
        -webkit-line-clamp: 3;
    }

    body.tf-image-standalone-page .tf-image-modal-header {
        min-height: 50px;
        padding: 15px 48px 12px;
    }
}

/* Final Zibll modal tuning: desktop dialog + mobile bottom drawer */
@media (min-width: 769px) {
    body.tf-image-standalone-page .tf-image-template-preview-modal.in,
    body.tf-image-standalone-page .tf-image-template-preview-modal.show,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.in,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.show {
        display: block !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.fade .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.fade .modal-dialog {
        transform: translateY(18px) scale(.96) !important;
        transition: transform .32s cubic-bezier(.32, .85, .45, 1.18), opacity .22s ease !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.in .modal-dialog,
    body.tf-image-standalone-page .tf-image-template-preview-modal.show .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.in .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.show .modal-dialog {
        transform: translateY(0) scale(1) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .modal-dialog {
        width: min(680px, calc(100vw - 56px)) !important;
        max-width: 680px !important;
        margin: clamp(42px, 8vh, 88px) auto !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-dialog {
        width: 460px !important;
        max-width: calc(100vw - 56px) !important;
        margin: clamp(54px, 10vh, 110px) auto !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .modal-content,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-content {
        max-height: calc(100vh - 96px) !important;
        border-radius: var(--main-radius, 8px) !important;
        box-shadow: 0 10px 34px rgba(0, 0, 0, .18) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .modal-body {
        max-height: calc(100vh - 220px);
        padding: 18px 20px;
    }

    body.tf-image-standalone-page .tf-image-template-preview-cover img {
        max-height: min(52vh, 430px) !important;
    }
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-template-preview-modal.in,
    body.tf-image-standalone-page .tf-image-template-preview-modal.show,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.in,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.show {
        display: flex !important;
        align-items: flex-end !important;
        justify-content: center !important;
        height: 100% !important;
        overflow: hidden !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.fade .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.fade .modal-dialog {
        transform: translateY(110%) !important;
        transition: transform .4s !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.in .modal-dialog,
    body.tf-image-standalone-page .tf-image-template-preview-modal.show .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.in .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.show .modal-dialog {
        transform: translateY(0) !important;
        transition: transform .6s cubic-bezier(.28, .9, .34, .99) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-dialog {
        position: relative !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 -1px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .modal-content,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-content {
        max-height: 86vh !important;
        border-radius: 18px 18px 0 0 !important;
        box-shadow: 0 -10px 50px rgba(0, 0, 0, .16) !important;
        padding-bottom: env(safe-area-inset-bottom);
    }

    body.tf-image-standalone-page .tf-image-modal-header {
        min-height: 72px;
        padding: 30px 66px 16px 28px;
    }

    body.tf-image-standalone-page .tf-image-modal-header .flex.jc {
        justify-content: flex-start;
    }

    body.tf-image-standalone-page .tf-image-modal-header .modal-title {
        justify-content: flex-start;
        font-size: 20px;
        line-height: 1.35;
        text-align: left;
    }

    body.tf-image-standalone-page .tf-image-modal-close {
        top: 24px !important;
        right: 18px !important;
        width: 44px !important;
        height: 44px !important;
        font-size: 26px !important;
        line-height: 44px !important;
        opacity: .45 !important;
    }

    body.tf-image-standalone-page .tf-image-modal-close .ic-close {
        width: 18px;
        height: 18px;
    }

    body.tf-image-standalone-page .tf-image-modal .touch-close {
        display: block !important;
        top: -26px;
    }

    body.tf-image-standalone-page .tf-image-modal .touch-close::before {
        width: 44px;
        height: 5px;
        background: var(--muted-3-color, rgba(140, 140, 140, .55));
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .modal-body,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-body {
        max-height: calc(86vh - 132px);
        padding: 16px 18px;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .modal-buts {
        padding: 0 18px 18px;
    }

    body.tf-image-standalone-page .tf-image-template-preview-cover {
        border-radius: 12px;
    }

    body.tf-image-standalone-page .tf-image-template-preview-cover img {
        max-height: 38vh !important;
    }
}

/* Mobile settings is the phone-only plus-menu panel */
@media (min-width: 769px) {
    body.tf-image-standalone-page #tfImageMobileSettingsOpen {
        display: none !important;
    }

    body.tf-image-standalone-page #tfImageMobileSettingsModal {
        display: none !important;
    }
}

@media (max-width: 768px) {
    body.tf-image-standalone-page #tfImageMobileSettingsOpen {
        display: inline-flex !important;
    }
}

/* ChatGPT-like image conversation states */
@keyframes tf-image-thinking-sweep {
    0% {
        background-position: 140% 50%;
    }
    100% {
        background-position: -40% 50%;
    }
}

@keyframes tf-image-loading-fallback-breathe {
    0%,
    100% {
        opacity: .32;
        transform: translate3d(-18%, -10%, 0) scale(.82);
    }
    22% {
        opacity: .72;
        transform: translate3d(-18%, -10%, 0) scale(1.06);
    }
    42% {
        opacity: .42;
        transform: translate3d(22%, -2%, 0) scale(.86);
    }
    64% {
        opacity: .78;
        transform: translate3d(22%, -2%, 0) scale(1.08);
    }
    82% {
        opacity: .45;
        transform: translate3d(-5%, 20%, 0) scale(.9);
    }
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-ai {
    justify-content: flex-start !important;
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-loading {
    display: grid !important;
    gap: 14px;
    width: min(390px, 52vw) !important;
    min-width: 220px !important;
    min-height: 0 !important;
    aspect-ratio: auto !important;
    margin: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    justify-items: stretch;
    align-content: start;
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-thinking {
    display: grid;
    align-items: center;
    justify-self: start;
    gap: 7px;
    min-height: 0;
    padding: 0;
    overflow: visible;
    color: rgba(72, 77, 84, .88);
    line-height: 1.45;
}

body.tf-image-standalone-page .tf-image-page .tf-image-thinking-text {
    display: inline-block;
    width: max-content;
    max-width: 100%;
    color: transparent;
    background: linear-gradient(105deg, rgba(88, 93, 100, .82) 0%, rgba(88, 93, 100, .82) 38%, rgba(255, 255, 255, .98) 50%, rgba(88, 93, 100, .82) 62%, rgba(88, 93, 100, .82) 100%);
    background-size: 260% 100%;
    background-position: 140% 50%;
    -webkit-background-clip: text;
    background-clip: text;
    animation: tf-image-thinking-sweep 2.1s ease-in-out infinite;
    font-size: 16px;
    font-weight: 700;
}

body.tf-image-standalone-page .tf-image-page .tf-image-thinking-shine {
    display: block;
    color: rgba(88, 93, 100, .64);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.6;
}

body.tf-image-standalone-page .tf-image-page .tf-image-loading-card {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: min(260px, 32vh);
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border: 1px solid rgba(244, 244, 244, .9);
    border-radius: 26px;
    background: #f1f1f1;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .78), 0 14px 40px rgba(15, 23, 42, .035) !important;
    transform: none !important;
}

body.tf-image-standalone-page .tf-image-page .tf-image-loading-card::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 48% 52%, rgba(255, 255, 255, .16), transparent 56%);
}

body.tf-image-standalone-page .tf-image-page .tf-image-loading-card::before {
    content: none;
    display: none;
}

body.tf-image-standalone-page .tf-image-page .tf-image-loading-card .tf-image-loading-dots,
body.tf-image-standalone-page .tf-image-page .tf-image-loading-card canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    transform: none !important;
}

body.tf-image-standalone-page .tf-image-page .tf-image-loading-card .tf-image-loading-dots {
    opacity: .72;
    -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 0%, #000 58%, rgba(0, 0, 0, .72) 72%, rgba(0, 0, 0, 0) 100%);
    mask-image: radial-gradient(circle at 50% 50%, #000 0%, #000 58%, rgba(0, 0, 0, .72) 72%, rgba(0, 0, 0, 0) 100%);
}

body.tf-image-standalone-page .tf-image-page .tf-image-loading-card canvas {
    display: block;
    position: relative;
    z-index: 2;
}

body.tf-image-standalone-page .tf-image-page .tf-image-result,
body.tf-image-standalone-page .tf-image-page .tf-image-chat-result {
    position: relative;
    display: inline-block !important;
    width: auto !important;
    max-width: min(640px, 62vw) !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-result-wrap {
    display: grid;
    gap: 14px;
    justify-items: start;
    width: fit-content;
    max-width: min(640px, 62vw);
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-pending-loading {
    width: min(360px, 50vw) !important;
    min-width: 220px !important;
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-pending-loading .tf-image-thinking-text {
    font-size: 18px;
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-pending-loading .tf-image-thinking-shine {
    font-size: 14px;
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-pending-loading .tf-image-loading-card {
    width: 100%;
    border-radius: 28px;
    opacity: .86;
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-done-thinking {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    color: rgba(72, 77, 84, .76);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-duration {
    color: rgba(72, 77, 84, .52);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-result-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 16px;
    margin-top: -10px;
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-result-meta .tf-image-chat-duration {
    margin: 0;
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-expire {
    margin-left: auto;
    color: rgba(72, 77, 84, .52);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-done-thinking i {
    font-size: 14px;
    opacity: .76;
}

body.tf-image-standalone-page .tf-image-page .tf-image-result img,
body.tf-image-standalone-page .tf-image-page .tf-image-chat-result img {
    display: block;
    width: auto !important;
    max-width: min(640px, 62vw) !important;
    height: auto !important;
    max-height: min(560px, 58vh) !important;
    border-radius: 22px !important;
    object-fit: contain !important;
    box-shadow: var(--tf-chat-panel-shadow, 0 12px 34px rgba(15, 23, 42, .14));
}

body.tf-image-standalone-page .tf-image-page .tf-image-result:not(.is-image-ready),
body.tf-image-standalone-page .tf-image-page .tf-image-chat-result:not(.is-image-ready) {
    width: min(640px, 62vw) !important;
    min-width: min(360px, 62vw) !important;
    min-height: min(360px, 46vh) !important;
    overflow: hidden !important;
    border-radius: 22px !important;
    background: rgba(255, 255, 255, .45) !important;
    box-shadow: var(--tf-chat-panel-shadow, 0 12px 34px rgba(15, 23, 42, .14)) !important;
}

body.tf-image-standalone-page .tf-image-page .tf-image-result-loading {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    background: rgba(255, 255, 255, .12);
    pointer-events: none;
    opacity: 1;
    visibility: visible;
    transition: opacity .18s ease, visibility .18s ease;
}

body.tf-image-standalone-page .tf-image-page .tf-image-result.is-image-ready .tf-image-result-loading,
body.tf-image-standalone-page .tf-image-page .tf-image-chat-result.is-image-ready .tf-image-result-loading {
    opacity: 0;
    visibility: hidden;
}

body.tf-image-standalone-page .tf-image-page .tf-image-result-loading .tf-image-gpt-mark {
    width: 46px;
    height: 46px;
    margin: 0;
    color: #6b6ff8;
    filter: drop-shadow(0 8px 18px rgba(15, 23, 42, .14));
}

body.tf-image-standalone-page .tf-image-page .tf-image-result-loading .tf-image-gpt-mark::before {
    inset: -8px;
}

body.tf-image-standalone-page .tf-image-page .tf-image-result-loading .tf-image-gpt-mark i {
    left: 14px;
    top: 4px;
    width: 18px;
    height: 38px;
    transform-origin: 9px 19px;
    border-color: currentColor;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-page .tf-image-chat-thinking {
        min-height: 40px;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-thinking-text {
        font-size: 15px;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-thinking-shine {
        font-size: 13px;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-chat-loading {
        width: min(74vw, 286px) !important;
        min-height: 0 !important;
        min-width: 0 !important;
        gap: 12px;
        padding: 0 !important;
        border-radius: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-loading-card {
        width: 100%;
        min-height: min(220px, 30vh);
        border-radius: 24px;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-result,
    body.tf-image-standalone-page .tf-image-page .tf-image-chat-result,
    body.tf-image-standalone-page .tf-image-page .tf-image-chat-result-wrap,
    body.tf-image-standalone-page .tf-image-page .tf-image-result img,
    body.tf-image-standalone-page .tf-image-page .tf-image-chat-result img {
        max-width: min(88vw, 420px) !important;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-result img,
    body.tf-image-standalone-page .tf-image-page .tf-image-chat-result img {
        max-height: min(62vh, 520px) !important;
        border-radius: 20px !important;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-result:not(.is-image-ready),
    body.tf-image-standalone-page .tf-image-page .tf-image-chat-result:not(.is-image-ready) {
        width: min(88vw, 420px) !important;
        min-width: min(280px, 88vw) !important;
        min-height: min(300px, 44vh) !important;
        border-radius: 20px !important;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-chat-done-thinking {
        font-size: 14px;
    }
}

body.tf-image-standalone-page .tf-image-page .tf-image-result-edit,
body.tf-image-standalone-page .tf-image-page .tf-image-result-download {
    position: absolute;
    bottom: 14px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 70px;
    height: 38px;
    padding: 0 14px;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, .6);
    border-radius: 999px;
    color: #202124;
    background: rgba(255, 255, 255, .68);
    box-shadow: 0 8px 20px rgba(15, 23, 42, .13);
    backdrop-filter: blur(14px) saturate(135%);
    -webkit-backdrop-filter: blur(14px) saturate(135%);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    transition: opacity .18s ease, visibility .18s ease, background-color .18s ease;
}

body.tf-image-standalone-page .tf-image-page .tf-image-result:not(.is-image-ready) .tf-image-result-edit,
body.tf-image-standalone-page .tf-image-page .tf-image-result:not(.is-image-ready) .tf-image-result-download,
body.tf-image-standalone-page .tf-image-page .tf-image-chat-result:not(.is-image-ready) .tf-image-result-edit,
body.tf-image-standalone-page .tf-image-page .tf-image-chat-result:not(.is-image-ready) .tf-image-result-download {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

body.tf-image-standalone-page .tf-image-page .tf-image-result-edit {
    right: 14px;
}

body.tf-image-standalone-page .tf-image-page .tf-image-result-download {
    left: 14px;
}

body.tf-image-standalone-page .tf-image-page .tf-image-result-edit:hover,
body.tf-image-standalone-page .tf-image-page .tf-image-result-download:hover {
    transform: none;
    background: rgba(255, 255, 255, .68);
    box-shadow: 0 8px 20px rgba(15, 23, 42, .13);
}

body.tf-image-standalone-page .tf-image-page .tf-image-result-edit i,
body.tf-image-standalone-page .tf-image-page .tf-image-result-download i {
    font-size: 13px;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-page .tf-image-result-edit,
    body.tf-image-standalone-page .tf-image-page .tf-image-result-download {
        bottom: 10px;
        min-width: 62px;
        height: 34px;
        padding: 0 12px;
        gap: 5px;
        font-size: 13px;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-result-edit {
        right: 10px;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-result-download {
        left: 10px;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-result-edit i,
    body.tf-image-standalone-page .tf-image-page .tf-image-result-download i {
        font-size: 12px;
    }
}

/* Prevent global .flex utilities from making closed modals visible */
body.tf-image-standalone-page .tf-image-template-preview-modal:not(.in):not(.show):not(.tf-image-modal-hiding):not(.tf-image-template-opening):not(.tf-image-template-closing),
body.tf-image-standalone-page .tf-image-mobile-settings-modal:not(.in):not(.show):not(.tf-image-mobile-settings-opening):not(.tf-image-mobile-settings-closing) {
    display: none !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-modal-hiding {
    display: flex !important;
    pointer-events: none;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-modal-hiding .modal-dialog {
    opacity: 0 !important;
    transform: translateY(28px) scale(.97) !important;
}

body.tf-image-template-modal-closing .modal-backdrop.in {
    opacity: 0 !important;
}

/* Final ChatGPT template modal overrides */
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal {
    align-items: center !important;
    justify-content: center !important;
    padding: 22px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    background: transparent !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(0, 0, 0, .36);
    opacity: 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: opacity .22s ease;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.flex.in,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.flex.show {
    display: flex !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.fade .modal-dialog {
    width: min(520px, calc(100vw - 44px)) !important;
    max-width: 520px !important;
    margin: auto !important;
    opacity: 0 !important;
    transform: translateY(72px) scale(.985) !important;
    transition: transform .56s cubic-bezier(.18, .9, .18, 1), opacity .24s ease !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.in .modal-dialog,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.show .modal-dialog {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.in::before,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.show::before {
    opacity: 1;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.tf-image-template-closing::before {
    opacity: 0;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.tf-image-template-closing .modal-dialog {
    opacity: 0 !important;
    transform: translateY(50px) scale(.985) !important;
    transition: transform .2s ease, opacity .18s ease !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content {
    position: relative;
    max-height: calc(100vh - 44px) !important;
    overflow: hidden !important;
    border: 0 !important;
    border-radius: 38px !important;
    background: rgba(255, 255, 255, .5) !important;
    box-shadow: 0 28px 90px rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .78) !important;
    backdrop-filter: blur(28px) saturate(1.18) !important;
    -webkit-backdrop-filter: blur(28px) saturate(1.18) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content::before {
    display: none !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-cover {
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    overflow: hidden !important;
    border-radius: 0 !important;
    background: #f2f2f0 !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-cover img {
    display: block;
    width: 100% !important;
    height: auto !important;
    max-height: min(56vh, 520px) !important;
    aspect-ratio: auto !important;
    object-fit: cover !important;
    transform: scale(1.055) !important;
    transition: transform .58s cubic-bezier(.2, .8, .2, 1);
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.in .tf-image-template-preview-cover img,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.show .tf-image-template-preview-cover img {
    transform: scale(1) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close {
    top: 18px !important;
    right: 18px !important;
    z-index: 4;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 48px !important;
    height: 48px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    color: #111 !important;
    background: rgba(255, 255, 255, .76) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .08) !important;
    opacity: 1 !important;
    backdrop-filter: blur(18px) saturate(1.1) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.1) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close:hover {
    color: #111 !important;
    background: rgba(255, 255, 255, .92) !important;
    opacity: 1 !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close .ic-close {
    width: 22px !important;
    height: 22px !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body {
    position: relative;
    margin-top: -1px;
    padding: 34px 38px 16px !important;
    background: linear-gradient(180deg, rgba(255, 255, 255, .72), rgba(255, 255, 255, .48)) !important;
    text-align: center;
    opacity: 0;
    transform: translateY(28px);
    backdrop-filter: blur(26px) saturate(1.16);
    -webkit-backdrop-filter: blur(26px) saturate(1.16);
    transition: transform .5s cubic-bezier(.18, .9, .18, 1) .1s, opacity .28s ease .1s;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 1px;
    background: rgba(255, 255, 255, .72);
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.in .tf-image-template-preview-body,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.show .tf-image-template-preview-body,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.in .tf-image-template-preview-actions,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.show .tf-image-template-preview-actions {
    opacity: 1;
    transform: translateY(0);
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body h2 {
    margin: 0 0 14px !important;
    color: #111 !important;
    font-size: 30px !important;
    font-weight: 750 !important;
    line-height: 1.2 !important;
    letter-spacing: 0 !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-prompt {
    display: -webkit-box;
    margin: 0 auto !important;
    max-width: 430px;
    overflow: hidden;
    color: rgba(17, 17, 17, .58) !important;
    font-size: 17px !important;
    font-weight: 450;
    line-height: 1.58 !important;
    text-align: left;
    -webkit-line-clamp: 4 !important;
    -webkit-box-orient: vertical;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
    display: grid;
    gap: 14px;
    padding: 12px 38px 38px !important;
    background: rgba(255, 255, 255, .48) !important;
    opacity: 0;
    transform: translateY(28px);
    backdrop-filter: blur(26px) saturate(1.16);
    -webkit-backdrop-filter: blur(26px) saturate(1.16);
    transition: transform .5s cubic-bezier(.18, .9, .18, 1) .16s, opacity .28s ease .16s;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-apply {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 58px !important;
    margin: 0 !important;
    padding: 0 24px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: #0d0d0d !important;
    color: #fff !important;
    box-shadow: none !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-apply:hover {
    background: #1f1f1f !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal {
        align-items: flex-end !important;
        padding: 0 12px 12px !important;
        overflow: hidden !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.fade .modal-dialog {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        transform: translateY(82px) scale(.99) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.in .modal-dialog,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.show .modal-dialog {
        transform: translateY(0) scale(1) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content {
        max-height: calc(100vh - 28px) !important;
        border-radius: 34px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-cover img {
        max-height: 52vh !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close {
        top: 14px !important;
        right: 14px !important;
        width: 44px !important;
        height: 44px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body {
        padding: 26px 28px 12px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body h2 {
        font-size: 28px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-prompt {
        font-size: 16px !important;
        line-height: 1.56 !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
        padding: 10px 28px max(30px, env(safe-area-inset-bottom)) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-apply {
        min-height: 56px !important;
        font-size: 18px !important;
    }
}

@media (max-width: 420px) {
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal {
        padding: 0 10px 10px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content {
        border-radius: 30px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body {
        padding: 24px 24px 10px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body h2 {
        font-size: 25px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-prompt {
        font-size: 15px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
        padding-left: 24px !important;
        padding-right: 24px !important;
    }
}

/* Zibll-native modal reset: keep the theme's modal motion/backdrop instead of custom sheets */
body.tf-image-standalone-page .modal-backdrop.in,
body.tf-image-standalone-page .modal-backdrop.show {
    opacity: .5 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.tf-image-standalone-page .modal-backdrop.fade {
    transition: opacity .16s ease !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.flex.in,
body.tf-image-standalone-page .tf-image-template-preview-modal.flex.show,
body.tf-image-standalone-page .tf-image-mobile-settings-modal.flex.in,
body.tf-image-standalone-page .tf-image-mobile-settings-modal.flex.show {
    display: flex !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal:not(.bottom).fade .modal-dialog,
body.tf-image-standalone-page .tf-image-mobile-settings-modal:not(.bottom).fade .modal-dialog {
    transform: scale(.9) !important;
    transition: transform .5s cubic-bezier(.32, .85, .45, 1.18), width .3s !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal:not(.bottom).in .modal-dialog,
body.tf-image-standalone-page .tf-image-template-preview-modal:not(.bottom).show .modal-dialog,
body.tf-image-standalone-page .tf-image-mobile-settings-modal:not(.bottom).in .modal-dialog,
body.tf-image-standalone-page .tf-image-mobile-settings-modal:not(.bottom).show .modal-dialog {
    transform: scale(1) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.bottom.fade .modal-dialog,
body.tf-image-standalone-page .tf-image-mobile-settings-modal.bottom.fade .modal-dialog {
    transform: translateY(110%) !important;
    transition: .4s !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.bottom.in .modal-dialog,
body.tf-image-standalone-page .tf-image-template-preview-modal.bottom.show .modal-dialog,
body.tf-image-standalone-page .tf-image-mobile-settings-modal.bottom.in .modal-dialog,
body.tf-image-standalone-page .tf-image-mobile-settings-modal.bottom.show .modal-dialog {
    transform: translateY(0) !important;
    transition: .6s cubic-bezier(.28, .9, .34, .99) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal .modal-dialog,
body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-dialog {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
}

body.tf-image-standalone-page .tf-image-modal .modal-content {
    border: 0 !important;
    background: var(--main-bg-color, #fff) !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, .18) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.tf-image-standalone-page .tf-image-modal-close {
    top: 10px !important;
    right: 10px !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--muted-color, #999) !important;
    opacity: .4 !important;
    line-height: 1 !important;
}

body.tf-image-standalone-page .tf-image-modal-close:hover {
    color: inherit !important;
    opacity: .5 !important;
}

body.tf-image-standalone-page .tf-image-modal-close .ic-close {
    width: 1em !important;
    height: 1em !important;
}

@media (min-width: 641px) {
    body.tf-image-standalone-page .tf-image-template-preview-modal:not(.bottom) .modal-dialog {
        width: min(620px, calc(100vw - 56px)) !important;
        max-width: 620px !important;
        margin: clamp(42px, 8vh, 88px) auto !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal:not(.bottom) .modal-dialog {
        width: 400px !important;
        max-width: calc(100vw - 56px) !important;
        margin: clamp(42px, 8vh, 88px) auto !important;
    }
}

@media (max-width: 640px) {
    body.tf-image-standalone-page .tf-image-template-preview-modal.bottom,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.bottom {
        align-items: flex-end !important;
        overflow: hidden !important;
        height: 100% !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.bottom .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.bottom .modal-dialog {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 -1px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.bottom .modal-content,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.bottom .modal-content {
        max-height: 82vh !important;
        overflow: hidden auto !important;
        border-radius: 16px 16px 0 0 !important;
        padding-bottom: env(safe-area-inset-bottom);
        box-shadow: 0 -10px 50px rgba(0, 0, 0, .15) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.bottom .modal-body,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.bottom .modal-body {
        max-height: calc(82vh - 112px) !important;
        padding: 14px !important;
    }
}

/* Final template/gallery interaction polish */
body.tf-image-standalone-page .tf-image-head-gpt {
    position: relative;
    display: inline-block;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    color: #10a37f;
}

body.tf-image-standalone-page .tf-image-head-gpt i {
    position: absolute;
    top: 2px;
    left: 7px;
    width: 7px;
    height: 16px;
    border: 1.35px solid currentColor;
    border-radius: 999px;
    transform-origin: 3.5px 8px;
}

body.tf-image-standalone-page .tf-image-head-gpt i:nth-child(1) {
    transform: rotate(0deg);
}

body.tf-image-standalone-page .tf-image-head-gpt i:nth-child(2) {
    transform: rotate(60deg);
}

body.tf-image-standalone-page .tf-image-head-gpt i:nth-child(3) {
    transform: rotate(120deg);
}

body.tf-image-standalone-page .tf-image-head-gpt i:nth-child(4) {
    transform: rotate(180deg);
}

body.tf-image-standalone-page .tf-image-head-gpt i:nth-child(5) {
    transform: rotate(240deg);
}

body.tf-image-standalone-page .tf-image-head-gpt i:nth-child(6) {
    transform: rotate(300deg);
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-title-gpt {
    position: relative;
    display: inline-block;
    flex: 0 0 1em;
    width: 1em;
    height: 1em;
    margin: 0 .12em 0 0;
    color: #10a37f;
    transform-origin: 50% 50%;
    animation: tfImageGptSpin 2.4s linear infinite;
    will-change: transform;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-title-gpt::before {
    content: "";
    position: absolute;
    inset: -.24em;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(16, 163, 127, .16), rgba(16, 163, 127, 0) 64%);
    animation: tfImageGptHalo 1.9s ease-in-out infinite;
    pointer-events: none;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-title-gpt i {
    position: absolute;
    top: .1em;
    left: .33em;
    width: .34em;
    height: .8em;
    color: inherit !important;
    border: .07em solid currentColor;
    border-radius: 999px;
    opacity: .88;
    transform-origin: .17em .4em;
    animation: tfImageGptPetal 1.6s ease-in-out infinite;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-title-gpt i:nth-child(1) {
    transform: rotate(0deg);
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-title-gpt i:nth-child(2) {
    transform: rotate(60deg);
    animation-delay: .08s;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-title-gpt i:nth-child(3) {
    transform: rotate(120deg);
    animation-delay: .16s;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-title-gpt i:nth-child(4) {
    transform: rotate(180deg);
    animation-delay: .24s;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-title-gpt i:nth-child(5) {
    transform: rotate(240deg);
    animation-delay: .32s;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-title-gpt i:nth-child(6) {
    transform: rotate(300deg);
    animation-delay: .4s;
}

@media (prefers-reduced-motion: reduce) {
    body.tf-image-standalone-page .tf-image-template-home .tf-image-title-gpt,
    body.tf-image-standalone-page .tf-image-template-home .tf-image-title-gpt::before,
    body.tf-image-standalone-page .tf-image-template-home .tf-image-title-gpt i {
        animation: none !important;
    }
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-template-card,
body.tf-image-standalone-page .tf-image-template-home .tf-image-template-card:hover {
    transform: none !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-template-cover {
    height: auto !important;
    min-height: 0 !important;
    overflow: hidden;
    border-radius: var(--tf-image-template-radius, 8px) !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-template-cover img {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    object-fit: contain !important;
    transform: scale(1);
    transition: transform .34s cubic-bezier(.22, .61, .36, 1);
    will-change: transform;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-template-card:hover .tf-image-template-cover img {
    transform: scale(1.045);
}

body.tf-image-standalone-page .tf-image-gallery-item {
    position: relative;
    overflow: hidden;
}

body.tf-image-standalone-page .tf-image-gallery-tools {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    z-index: 6;
    display: inline-flex !important;
    gap: 6px;
    opacity: 0;
    visibility: hidden;
    transform: none !important;
    transition: opacity .18s ease, visibility .18s ease;
}

body.tf-image-standalone-page .tf-image-gallery-item:hover .tf-image-gallery-tools,
body.tf-image-standalone-page .tf-image-gallery-item:focus-within .tf-image-gallery-tools {
    opacity: 1;
    visibility: visible;
    transform: none !important;
}

body.tf-image-standalone-page .tf-image-gallery-tools .but.cir {
    --this-size: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid var(--this-border) !important;
    border-radius: 5em !important;
    color: var(--this-color) !important;
    background: var(--this-bg) !important;
    box-shadow: var(--this-shadow) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.tf-image-standalone-page .tf-image-gallery-tools .but.cir:hover {
    opacity: .8;
    transform: none !important;
    color: var(--this-color) !important;
    background: var(--this-bg) !important;
}

body.tf-image-standalone-page .tf-image-gallery-tools .but.cir > .fa {
    margin: 0 !important;
    font-size: 13px;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-cover {
        height: auto !important;
    }

    body.tf-image-standalone-page .tf-image-gallery-tools {
        top: 7px !important;
        right: 7px !important;
        opacity: 1;
        visibility: visible;
        transform: none !important;
    }

    body.tf-image-standalone-page .tf-image-gallery-tools .but.cir {
        --this-size: 28px;
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
    }
}

/* Keep closed Zibll modals hidden even when utility flex classes are present */
body.tf-image-standalone-page .tf-image-template-preview-modal:not(.in):not(.show):not(.tf-image-modal-hiding):not(.tf-image-template-opening):not(.tf-image-template-closing),
body.tf-image-standalone-page .tf-image-mobile-settings-modal:not(.in):not(.show):not(.tf-image-mobile-settings-opening):not(.tf-image-mobile-settings-closing) {
    display: none !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-modal-hiding {
    display: flex !important;
    opacity: 0 !important;
    pointer-events: none;
}

/* ChatGPT-style template sheet and expanding composer */
body.tf-image-standalone-page .tf-image-template-preview-modal:not(.in):not(.show):not(.tf-image-modal-hiding):not(.tf-image-template-opening):not(.tf-image-template-closing) {
    display: none !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-template-opening,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-template-closing {
    display: flex !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.flex {
    position: fixed !important;
    inset: 0 !important;
    z-index: 1055 !important;
    display: flex;
    align-items: flex-end !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 12px 24px !important;
    overflow: hidden !important;
    background: transparent !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    background: rgba(0, 0, 0, .35);
    opacity: 0;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    transition: opacity .26s ease !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.in::before,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.show::before {
    opacity: 1;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.tf-image-template-closing::before {
    opacity: 0;
    transition-duration: .18s !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-dialog,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.fade .modal-dialog {
    position: relative !important;
    z-index: 1;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: min(560px, calc(100vw - 24px)) !important;
    max-width: 560px !important;
    margin: 0 auto !important;
    opacity: 0 !important;
    transform: translate3d(0, calc(100% + 34px), 0) !important;
    transform-origin: bottom center;
    transition: transform .46s cubic-bezier(.22, .61, .36, 1), opacity .18s ease !important;
    will-change: transform, opacity;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.in .modal-dialog,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.show .modal-dialog {
    opacity: 1 !important;
    transform: translate3d(0, 0, 0) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.tf-image-template-closing .modal-dialog {
    opacity: 0 !important;
    transform: translate3d(0, calc(100% + 34px), 0) !important;
    transition: transform .32s cubic-bezier(.55, .06, .68, .19), opacity .14s ease .06s !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content {
    position: relative;
    max-height: calc(100vh - 48px) !important;
    overflow: hidden !important;
    border: 1px solid rgba(255, 255, 255, .55) !important;
    border-radius: 36px !important;
    background: rgba(244, 244, 242, .58) !important;
    color: #151515;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .72) !important;
    backdrop-filter: blur(28px) saturate(1.16) !important;
    -webkit-backdrop-filter: blur(28px) saturate(1.16) !important;
    transform: translate3d(0, 0, 0);
    transform-origin: bottom center;
    transition: none;
    will-change: transform;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.in .modal-content,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.show .modal-content {
    transform: translate3d(0, 0, 0);
    animation: none !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.tf-image-template-closing .modal-content {
    transform: translate3d(0, 0, 0);
    animation: none !important;
    transition-duration: 0s;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content::before {
    display: none !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-media,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-cover {
    max-height: 44vh !important;
    min-height: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    border-radius: 0 !important;
    background: rgba(238, 238, 235, .78) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-cover img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-height: 44vh !important;
    min-height: 0 !important;
    aspect-ratio: auto !important;
    object-fit: cover !important;
    transform: scale(1.045) !important;
    transition: transform .7s cubic-bezier(.2, .8, .2, 1) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.in .tf-image-template-preview-cover img,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.show .tf-image-template-preview-cover img {
    transform: scale(1) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-modal-close {
    top: 16px !important;
    right: 16px !important;
    z-index: 5 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 48px !important;
    height: 48px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    color: #fff !important;
    background: rgba(0, 0, 0, .45) !important;
    box-shadow: none !important;
    opacity: 1 !important;
    line-height: 1 !important;
    backdrop-filter: blur(12px) saturate(1.1) !important;
    -webkit-backdrop-filter: blur(12px) saturate(1.1) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close:hover {
    color: #fff !important;
    background: rgba(0, 0, 0, .6) !important;
    opacity: 1 !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close .ic-close {
    width: 22px !important;
    height: 22px !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body {
    max-height: none !important;
    margin: 0 !important;
    padding: 30px 38px 8px !important;
    overflow: visible !important;
    background: rgba(246, 246, 244, .56) !important;
    text-align: center;
    opacity: 0;
    transform: translateY(18px);
    transition: transform .46s cubic-bezier(.18, .9, .18, 1) .08s, opacity .26s ease .08s !important;
    backdrop-filter: blur(24px) saturate(1.14) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.14) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body h2 {
    margin: 0 auto 14px !important;
    color: #111 !important;
    font-size: 26px !important;
    font-weight: 800 !important;
    line-height: 1.22 !important;
    letter-spacing: 0 !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-prompt {
    display: -webkit-box;
    margin: 0 auto !important;
    max-width: 450px;
    overflow: hidden;
    color: rgba(17, 17, 17, .56) !important;
    font-size: 16px !important;
    font-weight: 450;
    line-height: 1.7 !important;
    text-align: center;
    -webkit-line-clamp: 3 !important;
    -webkit-box-orient: vertical;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
    margin: 0 !important;
    padding: 24px 38px 34px !important;
    background: rgba(246, 246, 244, .56) !important;
    opacity: 0;
    transform: translateY(18px);
    transition: transform .46s cubic-bezier(.18, .9, .18, 1) .13s, opacity .26s ease .13s !important;
    backdrop-filter: blur(24px) saturate(1.14) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.14) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.in .tf-image-template-preview-body,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.show .tf-image-template-preview-body,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.in .tf-image-template-preview-actions,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.show .tf-image-template-preview-actions {
    opacity: 1;
    transform: translateY(0);
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-apply {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    min-height: 56px !important;
    margin: 0 !important;
    padding: 0 22px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: #050505 !important;
    color: #fff !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .16) !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-apply:hover {
    background: rgba(0, 0, 0, .9) !important;
}

body.tf-image-standalone-page .modal-backdrop {
    transition: opacity .12s ease !important;
}

body.tf-image-template-modal-open .modal-backdrop,
body.tf-image-template-modal-closing .modal-backdrop {
    display: none !important;
    opacity: 0 !important;
}

body.tf-image-standalone-page .tf-image-form textarea.form-control {
    overflow: hidden;
    transition: height .28s cubic-bezier(.22, .61, .36, 1), min-height .28s cubic-bezier(.22, .61, .36, 1);
}

body.tf-image-standalone-page .tf-image-composer {
    transform: none !important;
}

body.tf-image-standalone-page .tf-image-composer-panel,
body.tf-image-standalone-page .tf-image-composer-prompt,
body.tf-image-standalone-page .tf-image-reference-preview {
    transition-duration: .32s !important;
    transition-timing-function: cubic-bezier(.22, .61, .36, 1) !important;
}

body.tf-image-standalone-page .tf-image-composer.tf-image-composer-template-insert .tf-image-composer-panel {
    animation: none !important;
}

body.tf-image-standalone-page .tf-image-composer.tf-image-composer-template-insert .tf-image-composer-prompt {
    animation: tf-image-composer-flash .42s ease;
}

body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-panel {
    box-shadow: 0 20px 58px rgba(15, 23, 42, .14);
}

@keyframes tf-image-composer-flash {
    0% {
        background: rgba(255, 255, 255, .3);
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2);
    }
    45% {
        background: rgba(255, 255, 255, .72);
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .7), 0 0 0 4px rgba(255, 255, 255, .2);
    }
    100% {
        background: rgba(255, 255, 255, .38);
        box-shadow: none;
    }
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal {
        padding: 0 10px max(10px, env(safe-area-inset-bottom)) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content {
        max-height: calc(100vh - 20px - env(safe-area-inset-bottom)) !important;
        border-radius: 34px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-media,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-cover,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-cover img {
        max-height: 44vh !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-modal-close {
        top: 14px !important;
        right: 14px !important;
        width: 44px !important;
        height: 44px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body {
        padding: 26px 28px 6px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body h2 {
        font-size: 24px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-prompt {
        font-size: 15px !important;
        line-height: 1.65 !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
        padding: 22px 28px 28px !important;
    }

    body.tf-image-standalone-page .tf-image-composer-panel {
        align-items: flex-end;
        transition: min-height .32s cubic-bezier(.22, .61, .36, 1), padding .32s cubic-bezier(.22, .61, .36, 1), border-radius .32s cubic-bezier(.22, .61, .36, 1), box-shadow .32s ease;
    }

    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-panel {
        align-items: flex-end;
        min-height: 64px;
        padding: 8px 58px 8px 10px;
        border-radius: 32px;
    }

    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-prompt {
        order: 1;
        width: auto;
        align-self: auto;
        min-height: 44px !important;
        padding: 0;
    }

    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-form textarea.form-control {
        height: auto;
        padding-top: 9px;
        padding-bottom: 9px;
    }

    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-bottom {
        display: contents;
    }

    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-run {
        position: absolute;
        margin-bottom: 0;
    }

    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-mobile-settings-open {
        left: 10px;
        bottom: 10px;
    }

    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-run {
        right: 10px;
        bottom: 10px;
    }

    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-reference-preview.has-items {
        bottom: calc(100% + 10px);
        opacity: 1;
        transform: translateY(0);
    }
}

/* Final motion lock: template sheet owns modal motion, composer stays anchored */
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.tf-image-template-closing .modal-dialog {
    opacity: 0 !important;
    transform: translate3d(0, calc(100% + 34px), 0) !important;
    transition: transform .32s cubic-bezier(.55, .06, .68, .19), opacity .14s ease .06s !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.tf-image-template-closing .modal-content {
    transform: translate3d(0, 0, 0) !important;
    animation: none !important;
    transition-duration: 0s !important;
}

body.tf-image-standalone-page .tf-image-composer,
body.tf-image-standalone-page .tf-image-composer.tf-image-composer-template-insert,
body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded {
    transform: none !important;
}

body.tf-image-standalone-page .tf-image-composer.tf-image-composer-template-insert .tf-image-composer-panel {
    animation: none !important;
    transform: none !important;
}

body.tf-image-standalone-page .tf-image-reference-preview:empty,
body.tf-image-standalone-page .tf-image-reference-preview:not(.has-items) {
    max-height: 0 !important;
    min-height: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    opacity: 0 !important;
    pointer-events: none;
}

/* Final compact composer sizing */
body.tf-image-standalone-page .tf-image-form textarea.form-control {
    min-height: 38px;
    height: 38px;
    padding: 5px 0;
    line-height: 1.45;
}

body.tf-image-standalone-page .tf-image-composer-panel {
    padding: 12px 16px 12px;
    border-radius: 24px;
}

body.tf-image-standalone-page .tf-image-composer-prompt {
    min-height: 46px;
    margin-bottom: 8px;
    padding: 8px 12px;
}

body.tf-image-standalone-page .tf-image-upload,
body.tf-image-standalone-page .tf-image-select-pill {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 40px !important;
    height: 40px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    box-sizing: border-box;
}

body.tf-image-standalone-page .tf-image-model-field select.form-control {
    height: 38px !important;
    min-height: 38px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    line-height: 38px !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-composer {
        left: 12px !important;
        right: 12px !important;
        bottom: calc(10px + env(safe-area-inset-bottom)) !important;
    }

    body.tf-image-standalone-page .tf-image-composer-panel,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-panel {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 8px !important;
        min-height: 54px !important;
        padding: 7px 54px 7px 54px !important;
        border-radius: 28px !important;
    }

    body.tf-image-standalone-page .tf-image-composer-prompt,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-prompt {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        min-height: 34px !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    body.tf-image-standalone-page .tf-image-form textarea.form-control,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-form textarea.form-control {
        min-height: 34px !important;
        height: 34px;
        max-height: 104px !important;
        padding: 5px 0 !important;
        font-size: 16px !important;
        line-height: 1.48 !important;
    }

    body.tf-image-standalone-page .tf-image-composer-bottom,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-bottom {
        display: contents !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-run,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-run {
        position: absolute !important;
        top: 50% !important;
        bottom: auto !important;
        width: 40px !important;
        height: 40px !important;
        min-height: 40px !important;
        transform: translateY(-50%) !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-mobile-settings-open {
        left: 8px !important;
    }

    body.tf-image-standalone-page .tf-image-run,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-run {
        right: 8px !important;
    }

    body.tf-image-standalone-page .tf-image-reference-preview:empty,
    body.tf-image-standalone-page .tf-image-reference-preview:not(.has-items) {
        position: static !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
    }
}

/* Final glass composer skin */
body.tf-image-standalone-page .tf-image-composer-panel {
    border-color: rgba(255, 255, 255, .62) !important;
    background: linear-gradient(135deg, rgba(255, 255, 255, .68), rgba(245, 245, 243, .46)) !important;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .14), inset 0 1px 0 rgba(255, 255, 255, .78) !important;
    backdrop-filter: blur(28px) saturate(1.18) !important;
    -webkit-backdrop-filter: blur(28px) saturate(1.18) !important;
}

body.tf-image-standalone-page .tf-image-composer-prompt {
    border: 1px solid rgba(255, 255, 255, .7) !important;
    border-radius: 18px !important;
    background: linear-gradient(135deg, rgba(255, 255, 255, .42), rgba(255, 255, 255, .18)) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72), 0 8px 22px rgba(15, 23, 42, .06) !important;
    backdrop-filter: blur(18px) saturate(1.1) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.1) !important;
}

body.tf-image-standalone-page .tf-image-form textarea.form-control {
    color: rgba(15, 17, 21, .86) !important;
    background: transparent !important;
}

body.tf-image-standalone-page .tf-image-form textarea.form-control::placeholder {
    color: rgba(15, 17, 21, .46) !important;
}

/* Final glass confirm modal for records edit/delete */
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm,
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.flex {
    position: fixed !important;
    inset: 0 !important;
    z-index: 1056 !important;
    display: flex;
    align-items: flex-end !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 12px 24px !important;
    overflow: hidden !important;
    background: transparent !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    background: rgba(0, 0, 0, .35);
    opacity: 0;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    transition: opacity .26s ease !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.in::before,
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.show::before {
    opacity: 1;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.tf-image-confirm-closing::before {
    opacity: 0;
    transition-duration: .18s !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-dialog,
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.fade .modal-dialog {
    position: relative !important;
    z-index: 1;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: min(460px, calc(100vw - 24px)) !important;
    max-width: 460px !important;
    margin: 0 auto !important;
    opacity: 0 !important;
    transform: translate3d(0, calc(100% + 34px), 0) !important;
    transform-origin: bottom center;
    transition: transform .46s cubic-bezier(.22, .61, .36, 1), opacity .18s ease !important;
    will-change: transform, opacity;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.in .modal-dialog,
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.show .modal-dialog {
    opacity: 1 !important;
    transform: translate3d(0, 0, 0) !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.tf-image-confirm-closing .modal-dialog {
    opacity: 0 !important;
    transform: translate3d(0, calc(100% + 34px), 0) !important;
    transition: transform .32s cubic-bezier(.55, .06, .68, .19), opacity .14s ease .06s !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-content {
    position: relative;
    overflow: hidden !important;
    border: 1px solid rgba(255, 255, 255, .55) !important;
    border-radius: 34px !important;
    background: rgba(244, 244, 242, .62) !important;
    color: #151515;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .72) !important;
    backdrop-filter: blur(28px) saturate(1.16) !important;
    -webkit-backdrop-filter: blur(28px) saturate(1.16) !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-content::before {
    display: none !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-modal-header {
    min-height: auto !important;
    margin: 0 !important;
    padding: 28px 74px 14px !important;
    border: 0 !important;
    background: rgba(246, 246, 244, .42) !important;
    text-align: center;
    box-shadow: none !important;
    backdrop-filter: blur(24px) saturate(1.12) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.12) !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-title {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #111 !important;
    font-size: 20px !important;
    font-weight: 800 !important;
    line-height: 1.25 !important;
    letter-spacing: 0 !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-confirm-close {
    top: 14px !important;
    right: 14px !important;
    z-index: 5 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 44px !important;
    height: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    color: #fff !important;
    background: rgba(0, 0, 0, .45) !important;
    box-shadow: none !important;
    opacity: 1 !important;
    line-height: 1 !important;
    transform: none !important;
    backdrop-filter: blur(12px) saturate(1.1) !important;
    -webkit-backdrop-filter: blur(12px) saturate(1.1) !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-confirm-close:hover {
    color: #fff !important;
    background: rgba(0, 0, 0, .6) !important;
    opacity: 1 !important;
    transform: none !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-confirm-close .ic-close {
    width: 20px !important;
    height: 20px !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-body {
    max-height: calc(78vh - 150px) !important;
    margin: 0 !important;
    padding: 0 28px 8px !important;
    overflow: auto !important;
    background: rgba(246, 246, 244, .42) !important;
    text-align: center;
    opacity: 0;
    transform: translateY(16px);
    transition: transform .46s cubic-bezier(.18, .9, .18, 1) .08s, opacity .26s ease .08s !important;
    backdrop-filter: blur(24px) saturate(1.12) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.12) !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.in .modal-body,
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.show .modal-body,
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.in .modal-buts,
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.show .modal-buts {
    opacity: 1;
    transform: translateY(0);
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-confirm-body p {
    margin: 14px auto 0 !important;
    max-width: 360px;
    color: rgba(17, 17, 17, .58) !important;
    font-size: 15px !important;
    line-height: 1.65 !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-confirm-preview {
    overflow: hidden;
    margin: 0 auto !important;
    border-radius: 22px;
    background: rgba(255, 255, 255, .34);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65), 0 12px 34px rgba(15, 23, 42, .1);
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-confirm-preview img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 36vh;
    object-fit: contain;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-buts {
    display: flex !important;
    flex-direction: column-reverse;
    gap: 10px;
    margin: 0 !important;
    padding: 18px 28px 28px !important;
    background: rgba(246, 246, 244, .42) !important;
    opacity: 0;
    transform: translateY(16px);
    transition: transform .46s cubic-bezier(.18, .9, .18, 1) .13s, opacity .26s ease .13s !important;
    backdrop-filter: blur(24px) saturate(1.12) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.12) !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-confirm-ok,
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-confirm-cancel {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    min-height: 52px !important;
    margin: 0 !important;
    padding: 0 22px !important;
    border-radius: 999px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    transform: none !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-confirm-ok {
    border: 0 !important;
    background: #050505 !important;
    color: #fff !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .16) !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-danger .tf-image-confirm-ok {
    background: #e5484d !important;
    box-shadow: 0 12px 28px rgba(229, 72, 77, .22) !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-confirm-cancel {
    border: 1px solid rgba(255, 255, 255, .64) !important;
    background: rgba(255, 255, 255, .34) !important;
    color: rgba(17, 17, 17, .72) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72) !important;
    backdrop-filter: blur(16px) saturate(1.08) !important;
    -webkit-backdrop-filter: blur(16px) saturate(1.08) !important;
}

body.tf-image-confirm-modal-open .modal-backdrop,
body.tf-image-confirm-modal-closing .modal-backdrop {
    display: none !important;
    opacity: 0 !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-composer-panel,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-panel {
        background: linear-gradient(135deg, rgba(255, 255, 255, .7), rgba(245, 245, 243, .48)) !important;
    }

    body.tf-image-standalone-page .tf-image-composer-prompt,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-prompt {
        border: 1px solid rgba(255, 255, 255, .54) !important;
        border-radius: 18px !important;
        background: rgba(255, 255, 255, .24) !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .52) !important;
        backdrop-filter: blur(14px) saturate(1.06) !important;
        -webkit-backdrop-filter: blur(14px) saturate(1.06) !important;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm {
        padding: 0 10px max(10px, env(safe-area-inset-bottom)) !important;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-content {
        border-radius: 32px !important;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-modal-header {
        padding: 26px 68px 12px !important;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-title {
        font-size: 19px !important;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-body {
        max-height: calc(82vh - 150px) !important;
        padding: 0 22px 8px !important;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-confirm-preview img {
        max-height: 38vh;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-buts {
        padding: 16px 22px 24px !important;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-confirm-ok,
    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-confirm-cancel {
        min-height: 50px !important;
    }
}

/* Final nested glass composer surface */
body.tf-image-standalone-page .tf-image-composer-panel {
    padding: 10px !important;
    border: 1px solid rgba(255, 255, 255, .58) !important;
    border-radius: 34px !important;
    background: rgba(246, 246, 244, .3) !important;
    box-shadow: 0 16px 50px rgba(15, 23, 42, .12), inset 0 1px 0 rgba(255, 255, 255, .56) !important;
    backdrop-filter: blur(30px) saturate(1.14) !important;
    -webkit-backdrop-filter: blur(30px) saturate(1.14) !important;
}

body.tf-image-standalone-page .tf-image-composer-panel::before {
    content: "";
    position: absolute;
    inset: 10px;
    z-index: 0;
    border: 0;
    border-radius: 28px;
    background: rgba(255, 255, 255, .08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
    pointer-events: none;
    backdrop-filter: blur(6px) saturate(1.01);
    -webkit-backdrop-filter: blur(6px) saturate(1.01);
}

body.tf-image-standalone-page .tf-image-composer-prompt,
body.tf-image-standalone-page .tf-image-composer-bottom,
body.tf-image-standalone-page .tf-image-composer-top,
body.tf-image-standalone-page #tfImageReferenceUrls {
    position: relative;
    z-index: 1;
}

body.tf-image-standalone-page .tf-image-composer-prompt {
    min-height: 56px !important;
    margin: 0 !important;
    padding: 10px 64px 4px 18px !important;
    border: 0 !important;
    border-radius: 24px !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.tf-image-standalone-page .tf-image-form textarea.form-control {
    min-height: 42px !important;
    height: 42px;
    padding: 7px 0 !important;
    color: rgba(20, 20, 18, .86) !important;
    font-size: 17px !important;
    line-height: 1.55 !important;
    background: transparent !important;
}

body.tf-image-standalone-page .tf-image-form textarea.form-control::placeholder {
    color: rgba(20, 20, 18, .5) !important;
}

body.tf-image-standalone-page .tf-image-composer-bottom {
    align-items: center !important;
    gap: 10px !important;
    min-height: 48px;
    padding: 0 56px 8px 18px !important;
}

body.tf-image-standalone-page .tf-image-composer-tools {
    align-items: center;
    gap: 10px;
}

body.tf-image-standalone-page .tf-image-upload,
body.tf-image-standalone-page .tf-image-select-pill,
body.tf-image-standalone-page .tf-image-pay-toggle,
body.tf-image-standalone-page .tf-image-asset-pill,
body.tf-image-standalone-page .tf-image-pay-actions .but {
    border-color: rgba(255, 255, 255, .62) !important;
    background: rgba(255, 255, 255, .54) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72) !important;
    backdrop-filter: blur(14px) saturate(1.08) !important;
    -webkit-backdrop-filter: blur(14px) saturate(1.08) !important;
}

body.tf-image-standalone-page .tf-image-upload:hover,
body.tf-image-standalone-page .tf-image-select-pill:hover,
body.tf-image-standalone-page .tf-image-pay-actions .but:hover {
    background: rgba(255, 255, 255, .76) !important;
}

body.tf-image-standalone-page .tf-image-upload,
body.tf-image-standalone-page .tf-image-select-pill {
    height: 40px !important;
    min-height: 40px !important;
    border-radius: 999px !important;
}

body.tf-image-standalone-page .tf-image-aspect-picker.has-reference {
    color: var(--tf-image-theme) !important;
    background: var(--focus-color-opacity1, rgba(41, 151, 247, .1)) !important;
}

body.tf-image-standalone-page .tf-image-run {
    z-index: 2;
    right: 20px !important;
    bottom: 18px !important;
    width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    background: rgba(150, 145, 142, .42) !important;
}

body.tf-image-standalone-page .tf-image-run.is-ready,
body.tf-image-standalone-page .tf-image-run[disabled].is-ready {
    background: #050505 !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-composer-panel,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-panel {
        min-height: 62px !important;
        padding: 8px 54px 8px 54px !important;
        border-radius: 32px !important;
        background: rgba(246, 246, 244, .32) !important;
    }

    body.tf-image-standalone-page .tf-image-composer-panel::before {
        inset: 7px;
        border-radius: 26px;
        background: rgba(255, 255, 255, .08);
    }

    body.tf-image-standalone-page .tf-image-composer-prompt,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-prompt {
        min-height: 40px !important;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    body.tf-image-standalone-page .tf-image-form textarea.form-control,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-form textarea.form-control {
        min-height: 40px !important;
        height: 40px;
        padding: 7px 0 !important;
        font-size: 16px !important;
        line-height: 1.5 !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-run,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-run {
        z-index: 2;
        width: 40px !important;
        height: 40px !important;
        min-height: 40px !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-mobile-settings-open {
        left: 8px !important;
    }

    body.tf-image-standalone-page .tf-image-run,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-run {
        right: 8px !important;
        bottom: auto !important;
    }
}

/* Final tool pills and mobile composer tuning */
body.tf-image-standalone-page .tf-image-upload,
body.tf-image-standalone-page .tf-image-select-pill {
    border-color: rgba(255, 255, 255, .38) !important;
    background: rgba(245, 245, 242, .26) !important;
    color: rgba(30, 31, 34, .86) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .42), 0 5px 14px rgba(15, 23, 42, .035) !important;
    backdrop-filter: blur(10px) saturate(1.04) !important;
    -webkit-backdrop-filter: blur(10px) saturate(1.04) !important;
}

body.tf-image-standalone-page .tf-image-upload:hover,
body.tf-image-standalone-page .tf-image-select-pill:hover {
    border-color: rgba(255, 255, 255, .5) !important;
    background: rgba(245, 245, 242, .34) !important;
}

body.tf-image-standalone-page .tf-image-aspect-picker.has-reference {
    color: var(--tf-image-theme) !important;
    background: rgba(41, 151, 247, .12) !important;
}

body.tf-image-standalone-page .tf-image-upload small,
body.tf-image-standalone-page .tf-image-model-field select.form-control {
    color: rgba(30, 31, 34, .62) !important;
}

body.tf-image-standalone-page .tf-image-model-field select.form-control {
    background: transparent !important;
    box-shadow: none !important;
}

body.tf-image-standalone-page .tf-image-model-field select.form-control,
body.tf-image-standalone-page .tf-image-mobile-model-row select.form-control {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 1px !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

body.tf-image-standalone-page .tf-image-model-field {
    gap: 6px !important;
    min-width: 190px !important;
    padding: 0 16px !important;
}

body.tf-image-standalone-page .tf-image-model-picker,
body.tf-image-standalone-page .tf-image-mobile-model-picker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0;
    border: 0;
    color: inherit;
    background: transparent;
    font: inherit;
}

body.tf-image-standalone-page .tf-image-model-picker {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1;
}

body.tf-image-standalone-page .tf-image-model-picker > span {
    flex: 0 0 auto;
    color: rgba(30, 31, 34, .92);
    font-size: 14px;
    font-weight: 800;
}

body.tf-image-standalone-page .tf-image-model-picker small,
body.tf-image-standalone-page .tf-image-mobile-model-picker small {
    min-width: 0;
    max-width: 118px;
    overflow: hidden;
    color: rgba(30, 31, 34, .62);
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.tf-image-standalone-page .tf-image-mobile-model-picker {
    margin-left: auto;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-composer-panel,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-panel {
        min-height: 68px !important;
        padding-top: 10px !important;
        padding-bottom: 10px !important;
        border-radius: 34px !important;
    }

    body.tf-image-standalone-page .tf-image-composer-panel::before {
        inset: 8px;
        border-radius: 28px;
    }

    body.tf-image-standalone-page .tf-image-composer-prompt,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-prompt {
        min-height: 44px !important;
    }

    body.tf-image-standalone-page .tf-image-form textarea.form-control,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-form textarea.form-control {
        min-height: 44px !important;
        height: 44px;
        padding: 8px 0 !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-run,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-run {
        width: 42px !important;
        height: 42px !important;
        min-height: 42px !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-mobile-settings-open {
        left: 9px !important;
    }

    body.tf-image-standalone-page .tf-image-run,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-run {
        right: 9px !important;
    }
}

/* Final centered glass confirm modal */
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm,
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.flex {
    position: fixed !important;
    inset: 0 !important;
    z-index: 1065 !important;
    display: flex;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    padding: 18px !important;
    overflow: hidden !important;
    background: transparent !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    background: rgba(0, 0, 0, .32);
    opacity: 0;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    transition: opacity .2s ease !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.in::before,
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.show::before {
    opacity: 1;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.tf-image-confirm-closing::before {
    opacity: 0;
    transition-duration: .16s !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-dialog,
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.fade .modal-dialog {
    position: relative !important;
    z-index: 1;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: min(430px, calc(100vw - 36px)) !important;
    max-width: 430px !important;
    margin: 0 auto !important;
    opacity: 0 !important;
    transform: translate3d(0, 8px, 0) scale(.965) !important;
    transform-origin: center center !important;
    transition: transform .26s cubic-bezier(.18, .9, .18, 1), opacity .2s ease !important;
    will-change: transform, opacity;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.in .modal-dialog,
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.show .modal-dialog {
    opacity: 1 !important;
    transform: translate3d(0, 0, 0) scale(1) !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.tf-image-confirm-closing .modal-dialog {
    opacity: 0 !important;
    transform: translate3d(0, 6px, 0) scale(.975) !important;
    transition: transform .18s ease, opacity .16s ease !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-content {
    border-radius: 30px !important;
    background: rgba(246, 246, 244, .66) !important;
    box-shadow: 0 22px 70px rgba(0, 0, 0, .24), inset 0 1px 0 rgba(255, 255, 255, .7) !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-modal-header {
    padding: 24px 66px 12px !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-body {
    max-height: min(52vh, 380px) !important;
    padding: 0 24px 8px !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-confirm-preview {
    max-width: 100%;
    border-radius: 20px;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-confirm-preview img {
    max-height: min(34vh, 260px);
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-buts {
    padding: 16px 24px 24px !important;
}

body.tf-image-confirm-modal-open .modal-backdrop,
body.tf-image-confirm-modal-closing .modal-backdrop,
body.tf-image-confirm-parent-backdrop-hidden .modal-backdrop {
    display: none !important;
    opacity: 0 !important;
    transition: none !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm,
    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.flex {
        align-items: center !important;
        padding: 14px !important;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-dialog,
    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.fade .modal-dialog {
        width: min(390px, calc(100vw - 28px)) !important;
        max-width: 390px !important;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-content {
        border-radius: 28px !important;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-modal-header {
        padding: 22px 62px 10px !important;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-body {
        max-height: min(54vh, 360px) !important;
        padding: 0 20px 8px !important;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-buts {
        padding: 14px 20px 22px !important;
    }
}

/* Hard-center the record edit/delete confirm dialog */
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-dialog,
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.fade .modal-dialog {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 1 !important;
    width: min(430px, calc(100vw - 36px)) !important;
    max-width: 430px !important;
    margin: 0 !important;
    opacity: 0 !important;
    transform: translate3d(-50%, calc(-50% + 18px), 0) scale(.92) !important;
    transform-origin: center center !important;
    transition: transform .36s cubic-bezier(.16, 1, .3, 1), opacity .24s ease !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.in .modal-dialog,
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.show .modal-dialog {
    opacity: 1 !important;
    transform: translate3d(-50%, -50%, 0) scale(1) !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.tf-image-confirm-closing .modal-dialog {
    opacity: 0 !important;
    transform: translate3d(-50%, calc(-50% + 10px), 0) scale(.96) !important;
    transition: transform .24s cubic-bezier(.4, 0, .2, 1), opacity .2s ease !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-content {
    border-radius: 28px !important;
    background: rgba(247, 247, 245, .72) !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-modal-header,
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-body,
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-buts {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .modal-dialog,
    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.fade .modal-dialog {
        width: min(388px, calc(100vw - 28px)) !important;
        max-width: 388px !important;
    }
}

/* Final icon sizing and action alignment without changing the composer layout */
body.tf-image-standalone-page .tf-image-tool-icon,
body.tf-image-standalone-page .tf-image-model-icon,
body.tf-image-standalone-page .tf-image-send-wrap {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 auto !important;
    color: currentColor;
    line-height: 1 !important;
}

body.tf-image-standalone-page .tf-image-tool-icon,
body.tf-image-standalone-page .tf-image-model-icon,
body.tf-image-standalone-page .tf-image-tool-icon i,
body.tf-image-standalone-page .tf-image-tool-icon svg,
body.tf-image-standalone-page .tf-image-tool-icon .icon,
body.tf-image-standalone-page .tf-image-tool-icon .svg-icon,
body.tf-image-standalone-page .tf-image-model-icon i,
body.tf-image-standalone-page .tf-image-model-icon svg,
body.tf-image-standalone-page .tf-image-model-icon .icon,
body.tf-image-standalone-page .tf-image-model-icon .svg-icon,
body.tf-image-standalone-page .tf-image-button-icon {
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
    font-size: 16px !important;
    line-height: 1 !important;
}

body.tf-image-standalone-page .tf-image-send-wrap,
body.tf-image-standalone-page .tf-image-send-wrap i,
body.tf-image-standalone-page .tf-image-send-wrap svg,
body.tf-image-standalone-page .tf-image-send-wrap .icon,
body.tf-image-standalone-page .tf-image-send-wrap .svg-icon,
body.tf-image-standalone-page .tf-image-send-icon,
body.tf-image-standalone-page .tf-image-run > i {
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    font-size: 18px !important;
    line-height: 1 !important;
}

body.tf-image-standalone-page .tf-image-upload > span,
body.tf-image-standalone-page .tf-image-model-field {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
}

body.tf-image-standalone-page .tf-image-model-field select.form-control {
    background: transparent !important;
    box-shadow: none !important;
}

body.tf-image-standalone-page .tf-image-run,
body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-run {
    right: 20px !important;
    bottom: 18px !important;
    transform: none !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-run,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-run {
        right: 10px !important;
        bottom: 10px !important;
    }
}

/* Mobile definitive rollback: match the simple input bar layout */
@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-composer {
        left: 14px !important;
        right: 14px !important;
        bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    }

    body.tf-image-standalone-page .tf-image-composer-panel,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-panel {
        display: block !important;
        position: relative !important;
        min-height: 58px !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        overflow: visible !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    body.tf-image-standalone-page .tf-image-composer-panel::before {
        display: none !important;
        content: none !important;
    }

    body.tf-image-standalone-page .tf-image-composer-prompt,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-prompt {
        position: relative !important;
        z-index: 1 !important;
        min-height: 58px !important;
        max-height: 128px !important;
        margin: 0 68px !important;
        padding: 7px 18px !important;
        border: 1px solid rgba(255, 255, 255, .48) !important;
        border-radius: 28px !important;
        background: rgba(247, 247, 245, .36) !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .58), 0 12px 32px rgba(15, 23, 42, .1) !important;
        overflow: hidden !important;
        backdrop-filter: blur(20px) saturate(1.08) !important;
        -webkit-backdrop-filter: blur(20px) saturate(1.08) !important;
    }

    body.tf-image-standalone-page .tf-image-form textarea.form-control,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-form textarea.form-control {
        min-height: 42px !important;
        height: 42px;
        max-height: 112px !important;
        padding: 7px 0 !important;
        font-size: 18px !important;
        line-height: 1.45 !important;
        text-align: left !important;
        overflow-y: auto !important;
    }

    body.tf-image-standalone-page .tf-image-composer-bottom,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-bottom {
        display: block !important;
        position: static !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
    }

    body.tf-image-standalone-page .tf-image-composer-tools,
    body.tf-image-standalone-page .tf-image-composer-assets-mobile,
    body.tf-image-standalone-page .tf-image-composer-assets-desktop,
    body.tf-image-standalone-page .tf-image-pay-toggle {
        display: none !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-run,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-run {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: absolute !important;
        z-index: 2 !important;
        top: 50% !important;
        bottom: auto !important;
        width: 58px !important;
        height: 58px !important;
        min-width: 58px !important;
        min-height: 58px !important;
        padding: 0 !important;
        margin: 0 !important;
        border: 1px solid rgba(255, 255, 255, .46) !important;
        border-radius: 50% !important;
        background: rgba(247, 247, 245, .34) !important;
        color: rgba(20, 20, 18, .82) !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .56), 0 12px 32px rgba(15, 23, 42, .1) !important;
        transform: translateY(-50%) !important;
        backdrop-filter: blur(20px) saturate(1.08) !important;
        -webkit-backdrop-filter: blur(20px) saturate(1.08) !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-mobile-settings-open {
        left: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-run,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-run {
        right: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-run.is-ready,
    body.tf-image-standalone-page .tf-image-run[disabled].is-ready {
        background: rgba(5, 5, 5, .86) !important;
        color: #fff !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-open .fa,
    body.tf-image-standalone-page .tf-image-send-wrap,
    body.tf-image-standalone-page .tf-image-send-wrap i,
    body.tf-image-standalone-page .tf-image-send-wrap svg,
    body.tf-image-standalone-page .tf-image-send-wrap .icon,
    body.tf-image-standalone-page .tf-image-send-wrap .svg-icon {
        width: 20px !important;
        height: 20px !important;
        margin: 0 !important;
        font-size: 20px !important;
        line-height: 20px !important;
    }
}

/* Final delete record confirm glass polish */
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .modal-dialog,
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm.fade .modal-dialog {
    width: min(420px, calc(100vw - 32px)) !important;
    max-width: 420px !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .modal-content {
    overflow: hidden !important;
    border: 1px solid rgba(255, 255, 255, .56) !important;
    border-radius: 30px !important;
    background: linear-gradient(145deg, rgba(247, 247, 245, .48), rgba(238, 238, 234, .28)) !important;
    box-shadow: 0 24px 76px rgba(0, 0, 0, .26), inset 0 1px 0 rgba(255, 255, 255, .68) !important;
    backdrop-filter: blur(30px) saturate(1.16) !important;
    -webkit-backdrop-filter: blur(30px) saturate(1.16) !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .tf-image-modal-header {
    padding: 22px 64px 10px !important;
    background: rgba(246, 246, 244, .24) !important;
    backdrop-filter: blur(24px) saturate(1.12) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.12) !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .modal-title {
    gap: 9px !important;
    color: #18181b !important;
    font-size: 18px !important;
    font-weight: 800 !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .modal-title .fa {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .48);
    background: rgba(229, 72, 77, .16);
    color: #e5484d;
    font-size: 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 8px 20px rgba(229, 72, 77, .1);
    backdrop-filter: blur(12px) saturate(1.08);
    -webkit-backdrop-filter: blur(12px) saturate(1.08);
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .tf-image-confirm-close {
    top: 14px !important;
    right: 14px !important;
    width: 38px !important;
    height: 38px !important;
    border: 1px solid rgba(255, 255, 255, .5) !important;
    color: rgba(20, 20, 18, .7) !important;
    background: rgba(255, 255, 255, .26) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .58), 0 8px 20px rgba(15, 23, 42, .08) !important;
    backdrop-filter: blur(14px) saturate(1.08) !important;
    -webkit-backdrop-filter: blur(14px) saturate(1.08) !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .tf-image-confirm-close:hover {
    color: #18181b !important;
    background: rgba(255, 255, 255, .42) !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .modal-body {
    max-height: min(58vh, 430px) !important;
    padding: 0 20px 8px !important;
    background: rgba(246, 246, 244, .18) !important;
    overflow: auto !important;
    backdrop-filter: blur(20px) saturate(1.08) !important;
    -webkit-backdrop-filter: blur(20px) saturate(1.08) !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-confirm {
    display: grid;
    gap: 14px;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-preview {
    position: relative;
    width: 100%;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .52);
    border-radius: 20px;
    background: rgba(246, 246, 244, .28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .58), 0 14px 34px rgba(15, 23, 42, .12);
    backdrop-filter: blur(18px) saturate(1.08);
    -webkit-backdrop-filter: blur(18px) saturate(1.08);
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-preview::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .56);
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-preview img {
    display: block;
    width: 100%;
    height: auto;
    max-height: min(32vh, 238px) !important;
    object-fit: contain;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-copy {
    padding: 15px 16px 16px;
    border: 1px solid rgba(255, 255, 255, .46);
    border-radius: 20px;
    background: linear-gradient(145deg, rgba(255, 255, 255, .32), rgba(255, 230, 230, .18)) !important;
    text-align: left;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .54), 0 10px 26px rgba(229, 72, 77, .08);
    backdrop-filter: blur(18px) saturate(1.08);
    -webkit-backdrop-filter: blur(18px) saturate(1.08);
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    color: #d92d33;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-copy strong {
    display: block;
    color: #18181b;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.35;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-copy p {
    margin: 7px 0 0 !important;
    max-width: none !important;
    color: rgba(24, 24, 27, .62) !important;
    font-size: 13px !important;
    line-height: 1.55 !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .modal-buts {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 14px 20px 20px !important;
    background: rgba(246, 246, 244, .18) !important;
    backdrop-filter: blur(20px) saturate(1.08) !important;
    -webkit-backdrop-filter: blur(20px) saturate(1.08) !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .tf-image-confirm-ok,
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .tf-image-confirm-cancel {
    min-height: 46px !important;
    border-radius: 14px !important;
    font-size: 15px !important;
    backdrop-filter: blur(16px) saturate(1.08) !important;
    -webkit-backdrop-filter: blur(16px) saturate(1.08) !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm.is-danger .tf-image-confirm-ok {
    border: 1px solid rgba(255, 255, 255, .36) !important;
    background: linear-gradient(135deg, rgba(239, 68, 68, .86), rgba(220, 38, 38, .76)) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 12px 28px rgba(220, 38, 38, .24) !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .tf-image-confirm-cancel {
    border: 1px solid rgba(255, 255, 255, .5) !important;
    background: rgba(255, 255, 255, .24) !important;
    color: rgba(24, 24, 27, .72) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .56) !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .modal-dialog,
    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm.fade .modal-dialog {
        width: min(374px, calc(100vw - 28px)) !important;
        max-width: 374px !important;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .tf-image-modal-header {
        padding: 20px 58px 10px !important;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .modal-body {
        max-height: min(60vh, 420px) !important;
        padding: 0 16px 8px !important;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-preview img {
        max-height: min(30vh, 220px) !important;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .modal-buts {
        padding: 12px 16px 18px !important;
    }
}

/* Mobile final rollback: simple input bar, no expanded tool panel */
@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-composer {
        left: 14px !important;
        right: 14px !important;
        bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    }

    body.tf-image-standalone-page .tf-image-composer-panel,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-panel {
        display: block !important;
        position: relative !important;
        min-height: 58px !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        overflow: visible !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    body.tf-image-standalone-page .tf-image-composer-panel::before {
        display: none !important;
        content: none !important;
    }

    body.tf-image-standalone-page .tf-image-composer-prompt,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-prompt {
        position: relative !important;
        z-index: 1 !important;
        min-height: 58px !important;
        max-height: 128px !important;
        margin: 0 68px !important;
        padding: 7px 18px !important;
        border: 1px solid rgba(255, 255, 255, .48) !important;
        border-radius: 28px !important;
        background: rgba(247, 247, 245, .36) !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .58), 0 12px 32px rgba(15, 23, 42, .1) !important;
        overflow: hidden !important;
        backdrop-filter: blur(20px) saturate(1.08) !important;
        -webkit-backdrop-filter: blur(20px) saturate(1.08) !important;
    }

    body.tf-image-standalone-page .tf-image-form textarea.form-control,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-form textarea.form-control {
        min-height: 42px !important;
        height: 42px;
        max-height: 112px !important;
        padding: 7px 0 !important;
        font-size: 18px !important;
        line-height: 1.45 !important;
        text-align: left !important;
        overflow-y: auto !important;
    }

    body.tf-image-standalone-page .tf-image-composer-bottom,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-bottom {
        display: block !important;
        position: static !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
    }

    body.tf-image-standalone-page .tf-image-composer-tools,
    body.tf-image-standalone-page .tf-image-composer-assets-mobile,
    body.tf-image-standalone-page .tf-image-composer-assets-desktop,
    body.tf-image-standalone-page .tf-image-pay-toggle {
        display: none !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-run,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-run {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: absolute !important;
        z-index: 2 !important;
        top: 50% !important;
        bottom: auto !important;
        width: 58px !important;
        height: 58px !important;
        min-width: 58px !important;
        min-height: 58px !important;
        padding: 0 !important;
        margin: 0 !important;
        border: 1px solid rgba(255, 255, 255, .46) !important;
        border-radius: 50% !important;
        background: rgba(247, 247, 245, .34) !important;
        color: rgba(20, 20, 18, .82) !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .56), 0 12px 32px rgba(15, 23, 42, .1) !important;
        transform: translateY(-50%) !important;
        backdrop-filter: blur(20px) saturate(1.08) !important;
        -webkit-backdrop-filter: blur(20px) saturate(1.08) !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-mobile-settings-open {
        left: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-run,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-run {
        right: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-run.is-ready,
    body.tf-image-standalone-page .tf-image-run[disabled].is-ready {
        background: rgba(5, 5, 5, .86) !important;
        color: #fff !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-open .fa,
    body.tf-image-standalone-page .tf-image-send-wrap,
    body.tf-image-standalone-page .tf-image-send-wrap i,
    body.tf-image-standalone-page .tf-image-send-wrap svg,
    body.tf-image-standalone-page .tf-image-send-wrap .icon,
    body.tf-image-standalone-page .tf-image-send-wrap .svg-icon {
        width: 20px !important;
        height: 20px !important;
        margin: 0 !important;
        font-size: 20px !important;
        line-height: 20px !important;
    }
}

/* Mobile composer rollback: simple left-plus, prompt, right-send layout */
@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-composer {
        left: 14px !important;
        right: 14px !important;
        bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    }

    body.tf-image-standalone-page .tf-image-composer-panel,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-panel {
        display: block !important;
        position: relative !important;
        min-height: 58px !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        overflow: visible !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    body.tf-image-standalone-page .tf-image-composer-panel::before {
        display: none !important;
    }

    body.tf-image-standalone-page .tf-image-composer-prompt,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-prompt {
        position: relative !important;
        min-height: 58px !important;
        max-height: 128px !important;
        margin: 0 68px !important;
        padding: 7px 18px !important;
        border: 1px solid rgba(255, 255, 255, .48) !important;
        border-radius: 28px !important;
        background: rgba(247, 247, 245, .36) !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .58), 0 12px 32px rgba(15, 23, 42, .1) !important;
        overflow: hidden !important;
        backdrop-filter: blur(20px) saturate(1.08) !important;
        -webkit-backdrop-filter: blur(20px) saturate(1.08) !important;
    }

    body.tf-image-standalone-page .tf-image-form textarea.form-control,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-form textarea.form-control {
        min-height: 42px !important;
        height: 42px;
        max-height: 112px !important;
        padding: 7px 0 !important;
        font-size: 18px !important;
        line-height: 1.45 !important;
        overflow-y: auto !important;
        text-align: left;
    }

    body.tf-image-standalone-page .tf-image-composer-bottom,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-bottom {
        display: block !important;
        position: static !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
    }

    body.tf-image-standalone-page .tf-image-composer-tools,
    body.tf-image-standalone-page .tf-image-composer-assets-mobile,
    body.tf-image-standalone-page .tf-image-composer-assets-desktop,
    body.tf-image-standalone-page .tf-image-pay-toggle {
        display: none !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-run,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-run {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: absolute !important;
        z-index: 2 !important;
        top: 50% !important;
        bottom: auto !important;
        width: 58px !important;
        height: 58px !important;
        min-width: 58px !important;
        min-height: 58px !important;
        padding: 0 !important;
        margin: 0 !important;
        border: 1px solid rgba(255, 255, 255, .46) !important;
        border-radius: 50% !important;
        background: rgba(247, 247, 245, .34) !important;
        color: rgba(20, 20, 18, .82) !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .56), 0 12px 32px rgba(15, 23, 42, .1) !important;
        transform: translateY(-50%) !important;
        backdrop-filter: blur(20px) saturate(1.08) !important;
        -webkit-backdrop-filter: blur(20px) saturate(1.08) !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-mobile-settings-open {
        left: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-run,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-run {
        right: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-run.is-ready,
    body.tf-image-standalone-page .tf-image-run[disabled].is-ready {
        background: rgba(5, 5, 5, .86) !important;
        color: #fff !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-open .fa,
    body.tf-image-standalone-page .tf-image-send-wrap,
    body.tf-image-standalone-page .tf-image-send-wrap i,
    body.tf-image-standalone-page .tf-image-send-wrap svg,
    body.tf-image-standalone-page .tf-image-send-wrap .icon,
    body.tf-image-standalone-page .tf-image-send-wrap .svg-icon {
        width: 20px !important;
        height: 20px !important;
        margin: 0 !important;
        font-size: 20px !important;
        line-height: 20px !important;
    }
}

/* Mobile prompt resize: keep smooth height stretch without radius morph */
@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-composer-prompt,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-prompt,
    body.tf-image-standalone-page .tf-image-composer:not(.tf-image-composer-expanded) .tf-image-composer-prompt {
        border-radius: 28px !important;
        transition-property: min-height, max-height, height, padding, box-shadow, background-color, border-color !important;
        transition-duration: .28s !important;
        transition-timing-function: cubic-bezier(.22, .61, .36, 1) !important;
    }

    body.tf-image-standalone-page .tf-image-form textarea.form-control {
        transition: height .28s cubic-bezier(.22, .61, .36, 1), min-height .28s cubic-bezier(.22, .61, .36, 1) !important;
    }
}

/* Chat history delete action */
body.tf-image-standalone-page .tf-image-chat-record {
    position: relative;
    padding-right: 50px !important;
    overflow: hidden;
}

body.tf-image-standalone-page .tf-image-chat-duration-badge {
    border-radius: var(--main-radius, 8px) 0 8px 0;
}

body.tf-image-standalone-page .tf-image-chat-expire-badge {
    border-radius: 0 var(--main-radius, 8px) 0 8px;
}

body.tf-image-standalone-page .tf-image-chat-record-main {
    flex: 1 1 auto;
}

body.tf-image-standalone-page .tf-image-chat-delete {
    position: absolute;
    top: 50%;
    right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    min-width: 30px;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 10px;
    color: rgba(71, 85, 105, .5) !important;
    background: rgba(15, 23, 42, .045) !important;
    font-size: 14px;
    line-height: 1;
    box-shadow: none !important;
    opacity: .72;
    transform: translateY(-50%);
    transition: color .16s ease, background-color .16s ease, transform .16s ease, opacity .16s ease;
}

body.tf-image-standalone-page .tf-image-chat-delete:hover,
body.tf-image-standalone-page .tf-image-chat-delete:focus {
    color: #e5484d !important;
    background: rgba(229, 72, 77, .1) !important;
    opacity: 1;
    transform: translateY(-50%) scale(1.03);
    outline: none;
}

body.tf-image-standalone-page .tf-image-chat-delete .fa {
    margin: 0 !important;
    font-size: 14px;
    line-height: 1;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-chat-delete-confirm {
    margin: 0;
}

body.tf-image-standalone-page .tf-image-chat-user .tf-image-chat-bubble,
body.tf-image-standalone-page .tf-image-page .tf-image-chat-user .tf-image-chat-bubble {
    max-width: min(520px, 72%) !important;
    padding: 11px 16px !important;
    border-radius: 22px !important;
    background: rgba(236, 236, 236, .94) !important;
    box-shadow: none !important;
    font-size: 15px !important;
    line-height: 1.7 !important;
}

body.tf-image-standalone-page .tf-image-chat-user-refs {
    width: min(292px, 72%) !important;
    margin: 0 0 8px auto !important;
}

body.tf-image-standalone-page .tf-image-chat-result {
    width: min(560px, 100%) !important;
    border-radius: 20px !important;
}

body.tf-image-standalone-page .tf-image-chat-result img {
    max-height: min(520px, 54vh) !important;
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-result-wrap {
    max-width: min(560px, 58vw) !important;
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-result {
    max-width: min(560px, 58vw) !important;
}

body.tf-image-standalone-page .tf-image-generation-stopped,
body.tf-image-standalone-page .tf-image-page .tf-image-generation-stopped {
    width: min(520px, 72%) !important;
    padding-top: 2px !important;
}

body.tf-image-standalone-page .tf-image-generation-stopped-label,
body.tf-image-standalone-page .tf-image-page .tf-image-generation-stopped-label {
    margin-bottom: 8px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.45 !important;
}

body.tf-image-standalone-page .tf-image-generation-stopped-text,
body.tf-image-standalone-page .tf-image-page .tf-image-generation-stopped-text {
    font-size: 15px !important;
    font-weight: 400 !important;
    line-height: 1.72 !important;
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-result img {
    max-width: min(560px, 58vw) !important;
    max-height: min(520px, 54vh) !important;
}

/* Inline chat edit: ChatGPT-style action and glass composer */
body.tf-image-standalone-page .tf-image-page .tf-image-chat-prompt-actions {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    margin: 8px 10px 0 0 !important;
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-action {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    padding: 0 !important;
    border: 1px solid rgba(13, 13, 13, .08) !important;
    border-radius: 50% !important;
    color: rgba(47, 47, 47, .76) !important;
    background: rgba(255, 255, 255, .72) !important;
    box-shadow: none !important;
    font-size: 16px !important;
    line-height: 1 !important;
    backdrop-filter: blur(12px) saturate(1.05) !important;
    -webkit-backdrop-filter: blur(12px) saturate(1.05) !important;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease !important;
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-action:hover,
body.tf-image-standalone-page .tf-image-page .tf-image-chat-action:focus {
    color: #2f2f2f !important;
    border-color: rgba(13, 13, 13, .12) !important;
    background: rgba(255, 255, 255, .94) !important;
    transform: none !important;
}

body.tf-image-standalone-page .tf-image-chat-edit-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    width: min(620px, 82vw);
    max-width: 100%;
    margin: 8px 10px 0 auto;
}

body.tf-image-standalone-page .tf-image-chat-edit-row.has-inline-edit {
    width: min(640px, 86vw);
}

body.tf-image-standalone-page .tf-image-chat-edit-row .tf-image-chat-prompt-actions {
    flex: 0 0 auto;
    margin: 0 !important;
}

body.tf-image-standalone-page .tf-image-inline-edit {
    flex: 1 1 500px;
    width: auto;
    min-width: 0;
    max-width: 520px;
    margin: 0;
    overflow: hidden;
    transform-origin: right center;
    animation: tf-image-inline-edit-in .34s cubic-bezier(.16, 1, .3, 1) both;
}

body.tf-image-standalone-page .tf-image-inline-edit.is-closing {
    pointer-events: none;
    animation: tf-image-inline-edit-out .22s cubic-bezier(.7, 0, .84, 0) both;
}

@keyframes tf-image-inline-edit-in {
    from {
        opacity: 0;
        max-width: 0;
        filter: blur(4px);
        transform: translate3d(18px, 0, 0);
        clip-path: inset(-18px 0 -18px 100% round 20px);
    }
    to {
        opacity: 1;
        max-width: 520px;
        filter: blur(0);
        transform: translate3d(0, 0, 0);
        clip-path: inset(-18px 0 -18px 0 round 20px);
    }
}

@keyframes tf-image-inline-edit-out {
    from {
        opacity: 1;
        max-width: 520px;
        filter: blur(0);
        transform: translate3d(0, 0, 0);
        clip-path: inset(-18px 0 -18px 0 round 20px);
    }
    to {
        opacity: 0;
        max-width: 0;
        filter: blur(3px);
        transform: translate3d(16px, 0, 0);
        clip-path: inset(-18px 0 -18px 100% round 20px);
    }
}

body.tf-image-standalone-page .tf-image-inline-edit-refs {
    display: none !important;
}

body.tf-image-standalone-page .tf-image-inline-edit-ref {
    position: relative;
    display: block;
    width: 48px;
    height: 48px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .58);
    border-radius: 14px;
    background: rgba(255, 255, 255, .42);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .42);
}

body.tf-image-standalone-page .tf-image-inline-edit-ref img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

body.tf-image-standalone-page .tf-image-inline-edit-panel {
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
    min-height: 50px;
    padding: 6px 7px 6px 16px;
    border: 1px solid rgba(255, 255, 255, .74);
    border-radius: 20px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .88), rgba(255, 255, 255, .56)),
        rgba(255, 255, 255, .62);
    box-shadow:
        0 14px 34px rgba(15, 23, 42, .12),
        inset 0 1px 0 rgba(255, 255, 255, .86);
    backdrop-filter: blur(22px) saturate(1.2);
    -webkit-backdrop-filter: blur(22px) saturate(1.2);
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

body.tf-image-standalone-page .tf-image-inline-edit-panel::before {
    content: "";
    width: 7px;
    height: 7px;
    margin-right: 10px;
    border-radius: 50%;
    background: #1f8bff;
    box-shadow: 0 0 0 5px rgba(31, 139, 255, .1);
    flex: 0 0 auto;
}

body.tf-image-standalone-page .tf-image-inline-edit-panel:focus-within {
    border-color: rgba(31, 139, 255, .38);
    box-shadow:
        0 16px 38px rgba(15, 23, 42, .14),
        0 0 0 4px rgba(31, 139, 255, .09),
        inset 0 1px 0 rgba(255, 255, 255, .92);
}

.dark-theme body.tf-image-standalone-page .tf-image-inline-edit-panel,
body.dark-theme.tf-image-standalone-page .tf-image-inline-edit-panel {
    border-color: rgba(255, 255, 255, .14);
    background:
        linear-gradient(135deg, rgba(36, 39, 45, .9), rgba(26, 28, 33, .76)),
        rgba(28, 30, 34, .78);
}

body.tf-image-standalone-page .tf-image-inline-edit-prompt {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body.tf-image-standalone-page .tf-image-inline-edit-input {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 24px;
    max-height: 78px;
    padding: 0;
    border: 0;
    outline: none;
    resize: none;
    color: rgba(20, 20, 18, .9);
    background: transparent;
    box-shadow: none;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.46;
    overflow-y: auto;
    caret-color: #1f8bff;
}

body.tf-image-standalone-page .tf-image-inline-edit-input::placeholder {
    color: rgba(20, 20, 18, .36);
}

body.tf-image-standalone-page .tf-image-inline-edit-bottom {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    min-height: 0;
    padding: 0 0 0 8px;
}

body.tf-image-standalone-page .tf-image-inline-edit-cancel,
body.tf-image-standalone-page .tf-image-inline-edit-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .76);
    border-radius: 50%;
    color: rgba(20, 20, 18, .64);
    background: rgba(255, 255, 255, .54);
    box-shadow:
        0 5px 14px rgba(15, 23, 42, .07),
        inset 0 1px 0 rgba(255, 255, 255, .5);
    backdrop-filter: blur(12px) saturate(1.12);
    -webkit-backdrop-filter: blur(12px) saturate(1.12);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}

body.tf-image-standalone-page .tf-image-inline-edit-cancel:hover,
body.tf-image-standalone-page .tf-image-inline-edit-send:hover {
    transform: translateY(-1px) scale(1.03);
    box-shadow:
        0 8px 18px rgba(15, 23, 42, .1),
        inset 0 1px 0 rgba(255, 255, 255, .58);
}

body.tf-image-standalone-page .tf-image-inline-edit-send {
    color: #fff;
    background: linear-gradient(135deg, #111827, #050505);
    border-color: rgba(5, 5, 5, .9);
}

body.tf-image-standalone-page .tf-image-inline-edit-send:not(.is-ready):disabled {
    background: rgba(186, 183, 180, .58);
    border-color: rgba(150, 145, 142, .16);
    color: rgba(255, 255, 255, .9);
    box-shadow: none;
    transform: none;
}

body.tf-image-standalone-page .tf-image-chat-loading-wrap {
    animation: tf-image-inline-replace-loading .22s cubic-bezier(.22, .61, .36, 1) both;
}

@keyframes tf-image-inline-replace-loading {
    from {
        opacity: .72;
        transform: translate3d(0, 8px, 0) scale(.99);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-chat-record {
        padding-right: 48px !important;
    }

    body.tf-image-standalone-page .tf-image-chat-delete {
        right: 10px;
        width: 32px;
        height: 32px;
        min-width: 32px;
    }

    body.tf-image-standalone-page .tf-image-chat-user .tf-image-chat-bubble,
    body.tf-image-standalone-page .tf-image-page .tf-image-chat-user .tf-image-chat-bubble {
        max-width: 82% !important;
        padding: 10px 14px !important;
        font-size: 14px !important;
    }

    body.tf-image-standalone-page .tf-image-generation-stopped,
    body.tf-image-standalone-page .tf-image-page .tf-image-generation-stopped {
        width: 82% !important;
    }

    body.tf-image-standalone-page .tf-image-generation-stopped-label,
    body.tf-image-standalone-page .tf-image-page .tf-image-generation-stopped-label {
        margin-bottom: 7px !important;
        font-size: 12px !important;
    }

    body.tf-image-standalone-page .tf-image-generation-stopped-text,
    body.tf-image-standalone-page .tf-image-page .tf-image-generation-stopped-text {
        font-size: 14px !important;
        line-height: 1.68 !important;
    }

    body.tf-image-standalone-page .tf-image-chat-user-refs {
        width: min(240px, 82%) !important;
        grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
        gap: 7px;
    }

    body.tf-image-standalone-page .tf-image-chat-result {
        width: min(340px, 92vw) !important;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-chat-result-wrap,
    body.tf-image-standalone-page .tf-image-page .tf-image-chat-result,
    body.tf-image-standalone-page .tf-image-page .tf-image-chat-result img {
        max-width: min(340px, 92vw) !important;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-chat-result img {
        max-height: min(500px, 58vh) !important;
    }

    body.tf-image-standalone-page .tf-image-chat-edit-row,
    body.tf-image-standalone-page .tf-image-chat-edit-row.has-inline-edit {
        width: min(340px, 92vw);
        gap: 6px;
        margin-right: 4px;
    }

    body.tf-image-standalone-page .tf-image-inline-edit {
        max-width: none;
    }

    body.tf-image-standalone-page .tf-image-inline-edit-panel {
        min-height: 44px;
        padding: 5px 6px 5px 12px;
        border-radius: 999px;
    }

    body.tf-image-standalone-page .tf-image-inline-edit-prompt {
        min-height: 0;
        padding: 0;
        border-radius: 0;
    }

    body.tf-image-standalone-page .tf-image-inline-edit-input {
        min-height: 22px;
        max-height: 66px;
        font-size: 14px;
    }

    body.tf-image-standalone-page .tf-image-inline-edit-cancel,
    body.tf-image-standalone-page .tf-image-inline-edit-send {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }
}

/* Final mobile settings sheet and reference insert polish */
@media (max-width: 768px) {
    body.tf-image-standalone-page.tf-image-mobile-settings-opened .modal-backdrop,
    body.tf-image-standalone-page.tf-image-mobile-settings-closing .modal-backdrop {
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.flex {
        position: fixed !important;
        inset: 0 !important;
        z-index: 1062 !important;
        align-items: flex-end !important;
        justify-content: center !important;
        width: 100% !important;
        height: 100% !important;
        padding: 0 10px max(10px, env(safe-area-inset-bottom)) !important;
        overflow: hidden !important;
        background: transparent !important;
        opacity: 1 !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal.tf-image-mobile-settings-opening,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.tf-image-mobile-settings-closing,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.in,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.show {
        display: flex !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal:not(.tf-image-mobile-settings-opening):not(.tf-image-mobile-settings-closing):not(.in):not(.show) {
        display: none !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal::before {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 0;
        background: rgba(17, 18, 20, .28);
        opacity: 0;
        backdrop-filter: blur(12px) saturate(1.08);
        -webkit-backdrop-filter: blur(12px) saturate(1.08);
        transition: opacity .18s ease !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal.in::before,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.show::before {
        opacity: 1;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal.tf-image-mobile-settings-closing::before {
        opacity: 0 !important;
        transition-duration: .12s !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.fade .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.bottom.fade .modal-dialog {
        position: relative !important;
        z-index: 1 !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        width: min(100%, 430px) !important;
        max-width: 430px !important;
        margin: 0 auto !important;
        opacity: 0 !important;
        transform: translate3d(0, 108%, 0) scale(1) !important;
        transform-origin: bottom center !important;
        transition: transform .34s cubic-bezier(.22, .86, .24, 1), opacity .22s ease !important;
        will-change: transform, opacity;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal.in .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.show .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.bottom.in .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.bottom.show .modal-dialog {
        opacity: 1 !important;
        transform: translate3d(0, 0, 0) scale(1) !important;
        transition-duration: .34s !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal.tf-image-mobile-settings-closing .modal-dialog {
        opacity: 0 !important;
        transform: translate3d(0, 108%, 0) scale(1) !important;
        transition: transform .26s cubic-bezier(.55, .06, .68, .19), opacity .16s ease !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-content,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.bottom .modal-content {
        position: relative !important;
        max-height: min(68vh, 520px) !important;
        overflow: hidden !important;
        border: 1px solid rgba(255, 255, 255, .58) !important;
        border-radius: 28px !important;
        background: rgba(246, 246, 244, .66) !important;
        color: rgba(17, 18, 20, .92) !important;
        box-shadow: 0 24px 80px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .72) !important;
        backdrop-filter: blur(28px) saturate(1.16) !important;
        -webkit-backdrop-filter: blur(28px) saturate(1.16) !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal .tf-image-modal-header {
        position: relative !important;
        min-height: auto !important;
        margin: 0 !important;
        padding: 22px 64px 10px 22px !important;
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal .touch-close {
        display: block !important;
        position: absolute !important;
        top: 8px !important;
        left: 50% !important;
        width: 36px !important;
        height: 4px !important;
        margin-left: -18px !important;
        border-radius: 999px !important;
        background: rgba(17, 18, 20, .18) !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-title {
        display: inline-flex !important;
        align-items: center !important;
        gap: 8px !important;
        color: rgba(17, 18, 20, .9) !important;
        font-size: 16px !important;
        font-weight: 800 !important;
        line-height: 1.25 !important;
        letter-spacing: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal .tf-image-modal-close,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .tf-image-mobile-settings-close {
        top: 14px !important;
        right: 14px !important;
        z-index: 4 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 38px !important;
        height: 38px !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 50% !important;
        color: #fff !important;
        background: rgba(17, 18, 20, .42) !important;
        box-shadow: none !important;
        opacity: 1 !important;
        transform: none !important;
        backdrop-filter: blur(14px) saturate(1.1) !important;
        -webkit-backdrop-filter: blur(14px) saturate(1.1) !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal .tf-image-modal-close .ic-close {
        width: 18px !important;
        height: 18px !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-body,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.bottom .modal-body {
        max-height: calc(min(68vh, 520px) - 62px) !important;
        margin: 0 !important;
        padding: 6px 14px 16px !important;
        overflow: auto !important;
        background: transparent !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-list {
        display: grid !important;
        gap: 10px !important;
        padding: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-setting-row {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 12px !important;
        width: 100% !important;
        min-height: 56px !important;
        margin: 0 !important;
        padding: 10px 14px !important;
        border: 1px solid rgba(255, 255, 255, .54) !important;
        border-radius: 18px !important;
        background: rgba(255, 255, 255, .42) !important;
        color: rgba(17, 18, 20, .9) !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .56), 0 10px 28px rgba(15, 23, 42, .08) !important;
        font-size: 15px !important;
        font-weight: 700 !important;
        line-height: 1.25 !important;
        text-align: left !important;
        backdrop-filter: blur(18px) saturate(1.1) !important;
        -webkit-backdrop-filter: blur(18px) saturate(1.1) !important;
        transition: transform .16s ease, background-color .16s ease, border-color .16s ease !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-setting-row:active {
        transform: scale(.985) !important;
        background: rgba(255, 255, 255, .58) !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-setting-main {
        display: inline-flex !important;
        align-items: center !important;
        gap: 10px !important;
        min-width: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-setting-main .tf-image-tool-icon,
    body.tf-image-standalone-page .tf-image-mobile-setting-main .tf-image-model-icon,
    body.tf-image-standalone-page .tf-image-mobile-setting-main i {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 18px !important;
        min-width: 18px !important;
        color: rgba(17, 18, 20, .64) !important;
        font-size: 17px !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-setting-row small {
        max-width: 46%;
        overflow: hidden;
        color: rgba(17, 18, 20, .48) !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        line-height: 1.35 !important;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.tf-image-standalone-page .tf-image-mobile-setting-row select.form-control {
        width: auto !important;
        max-width: 158px !important;
        height: 34px !important;
        min-height: 34px !important;
        padding: 0 24px 0 8px !important;
        border: 0 !important;
        background: transparent !important;
        color: rgba(17, 18, 20, .62) !important;
        box-shadow: none !important;
        font-size: 14px !important;
        font-weight: 800 !important;
        line-height: 34px !important;
        text-align: right !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-payment-row {
        border-radius: 20px !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-payment {
        display: inline-flex !important;
        gap: 4px !important;
        padding: 4px !important;
        border-radius: 999px !important;
        background: rgba(17, 18, 20, .07) !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-payment button {
        min-width: 52px !important;
        height: 32px !important;
        padding: 0 12px !important;
        border: 0 !important;
        border-radius: 999px !important;
        background: transparent !important;
        color: rgba(17, 18, 20, .56) !important;
        font-size: 13px !important;
        font-weight: 800 !important;
        box-shadow: none !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-payment button.active {
        background: rgba(17, 18, 20, .88) !important;
        color: #fff !important;
    }

    body.tf-image-standalone-page .tf-image-composer-prompt,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-prompt {
        overflow: visible !important;
    }

    body.tf-image-standalone-page .tf-image-reference-preview.has-items {
        position: absolute !important;
        left: 6px !important;
        right: 6px !important;
        bottom: calc(100% + 8px) !important;
        z-index: 4 !important;
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        max-height: 74px !important;
        margin: 0 !important;
        padding: 8px !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        border: 1px solid rgba(255, 255, 255, .5) !important;
        border-radius: 20px !important;
        background: rgba(246, 246, 244, .64) !important;
        box-shadow: 0 14px 36px rgba(15, 23, 42, .13), inset 0 1px 0 rgba(255, 255, 255, .62) !important;
        opacity: 1 !important;
        transform: translate3d(0, 0, 0) scale(1) !important;
        backdrop-filter: blur(22px) saturate(1.12) !important;
        -webkit-backdrop-filter: blur(22px) saturate(1.12) !important;
        scroll-snap-type: x proximity;
    }

    body.tf-image-standalone-page .tf-image-reference-preview.has-items::-webkit-scrollbar {
        display: none;
    }

    body.tf-image-standalone-page .tf-image-reference-item,
    body.tf-image-standalone-page .tf-image-reference-preview img {
        width: 56px !important;
        height: 56px !important;
        min-width: 56px !important;
    }

    body.tf-image-standalone-page .tf-image-reference-item {
        scroll-snap-align: start;
    }

    body.tf-image-standalone-page .tf-image-reference-preview img {
        border-radius: 14px !important;
        object-fit: cover !important;
        box-shadow: 0 8px 18px rgba(15, 23, 42, .12) !important;
    }

    body.tf-image-standalone-page .tf-image-reference-remove {
        top: -7px !important;
        right: -7px !important;
        width: 22px !important;
        height: 22px !important;
        color: #fff !important;
        background: rgba(17, 18, 20, .58) !important;
        box-shadow: 0 6px 16px rgba(15, 23, 42, .18) !important;
    }

    body.tf-image-standalone-page .tf-image-reference-remove .ic-close {
        width: 11px !important;
        height: 11px !important;
    }

    body.tf-image-standalone-page .tf-image-reference-inserting .tf-image-reference-preview.has-items {
        animation: tf-image-mobile-reference-tray .32s cubic-bezier(.22, .61, .36, 1) both;
    }

    body.tf-image-standalone-page .tf-image-reference-inserting .tf-image-reference-item {
        animation: tf-image-mobile-reference-pop .32s cubic-bezier(.22, .61, .36, 1) both;
    }

    body.tf-image-standalone-page .tf-image-guest-history-hint {
        display: flex !important;
        align-items: flex-start !important;
        gap: 8px !important;
        width: 100% !important;
        margin: 0 0 12px !important;
        padding: 10px 12px !important;
        border: 1px solid rgba(59, 130, 246, .16) !important;
        border-radius: 14px !important;
        background: rgba(59, 130, 246, .08) !important;
        color: rgba(37, 99, 235, .88) !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        line-height: 1.45 !important;
    }

    body.tf-image-standalone-page .tf-image-guest-history-hint i {
        flex: 0 0 auto !important;
        margin-top: 1px !important;
        font-size: 13px !important;
    }
}

@keyframes tf-image-mobile-reference-tray {
    from {
        opacity: 0;
        transform: translate3d(0, 8px, 0) scale(.985);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes tf-image-mobile-reference-pop {
    from {
        opacity: 0;
        transform: translate3d(0, 6px, 0) scale(.9);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

/* Final glass sync for template preview and work delete dialog */
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content {
    background: rgba(246, 246, 244, .26) !important;
    box-shadow: 0 28px 90px rgba(15, 23, 42, .24), inset 0 1px 0 rgba(255, 255, 255, .62) !important;
    backdrop-filter: blur(36px) saturate(1.2) !important;
    -webkit-backdrop-filter: blur(36px) saturate(1.2) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .42), rgba(255, 255, 255, .2)),
        rgba(246, 246, 244, .22) !important;
    border-color: rgba(255, 255, 255, .54) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .62) !important;
    backdrop-filter: blur(34px) saturate(1.18) !important;
    -webkit-backdrop-filter: blur(34px) saturate(1.18) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
    border-top: 0 !important;
    padding-top: 18px !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-upload-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 42px;
    padding: 9px 14px;
    border: 1px solid rgba(255, 255, 255, .58);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .42), rgba(255, 255, 255, .2)),
        rgba(246, 246, 244, .24);
    color: rgba(20, 20, 18, .62);
    font-size: 13px;
    font-weight: 750;
    line-height: 1.35;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .62);
    backdrop-filter: blur(20px) saturate(1.12);
    -webkit-backdrop-filter: blur(20px) saturate(1.12);
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-upload-hint[hidden] {
    display: none !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-upload-hint .fa {
    color: rgba(20, 20, 18, .72);
    font-size: 15px;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .modal-dialog,
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm.fade .modal-dialog {
    width: min(520px, calc(100vw - 28px)) !important;
    max-width: 520px !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .modal-content {
    border: 1px solid rgba(255, 255, 255, .58) !important;
    border-radius: 34px !important;
    background:
        radial-gradient(circle at 18% 0%, rgba(255, 255, 255, .56), rgba(255, 255, 255, 0) 34%),
        linear-gradient(145deg, rgba(248, 248, 246, .42), rgba(242, 242, 239, .18)) !important;
    box-shadow: 0 28px 88px rgba(15, 23, 42, .28), inset 0 1px 0 rgba(255, 255, 255, .7) !important;
    backdrop-filter: blur(36px) saturate(1.2) !important;
    -webkit-backdrop-filter: blur(36px) saturate(1.2) !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .tf-image-modal-header {
    padding: 22px 66px 12px !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .modal-title {
    font-size: 19px !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .modal-body {
    max-height: min(66vh, 570px) !important;
    padding: 0 22px 10px !important;
    background: transparent !important;
    overflow: auto !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-confirm-rich {
    gap: 16px;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-preview-stack {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 260px;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-preview {
    z-index: 2;
    width: min(86%, 360px);
    border-radius: 26px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .4), rgba(255, 255, 255, .18)),
        rgba(246, 246, 244, .28);
    box-shadow: 0 20px 48px rgba(15, 23, 42, .2), inset 0 1px 0 rgba(255, 255, 255, .72);
    backdrop-filter: blur(20px) saturate(1.12);
    -webkit-backdrop-filter: blur(20px) saturate(1.12);
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-preview img {
    width: 100%;
    max-height: min(36vh, 285px) !important;
    object-fit: contain;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-preview-mini {
    position: absolute;
    top: 50%;
    z-index: 1;
    width: 42%;
    max-width: 178px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    border: 1px solid rgba(255, 255, 255, .48);
    border-radius: 24px;
    background: rgba(255, 255, 255, .24);
    box-shadow: 0 14px 36px rgba(15, 23, 42, .14), inset 0 1px 0 rgba(255, 255, 255, .58);
    opacity: .66;
    backdrop-filter: blur(18px) saturate(1.1);
    -webkit-backdrop-filter: blur(18px) saturate(1.1);
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-preview-mini img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(.92);
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-preview-mini.is-left {
    left: 18px;
    transform: translateY(-50%) rotate(-7deg);
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-preview-mini.is-right {
    right: 18px;
    transform: translateY(-50%) rotate(7deg);
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-copy {
    padding: 18px;
    border-radius: 24px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, .46), rgba(255, 235, 235, .2)),
        rgba(255, 255, 255, .18) !important;
    box-shadow: 0 14px 34px rgba(229, 72, 77, .08), inset 0 1px 0 rgba(255, 255, 255, .68);
    backdrop-filter: blur(24px) saturate(1.16);
    -webkit-backdrop-filter: blur(24px) saturate(1.16);
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-copy strong {
    font-size: 18px;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-scope {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-scope span {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 10px;
    border: 1px solid rgba(229, 72, 77, .16);
    border-radius: 999px;
    background: rgba(229, 72, 77, .08);
    color: rgba(185, 28, 28, .82);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .modal-buts {
    gap: 12px;
    padding: 8px 22px 22px !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .tf-image-confirm-ok,
body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .tf-image-confirm-cancel {
    min-height: 50px !important;
    border-radius: 17px !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .modal-dialog,
    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm.fade .modal-dialog {
        width: min(390px, calc(100vw - 24px)) !important;
        max-width: 390px !important;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .modal-content {
        border-radius: 30px !important;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .modal-body {
        max-height: min(68vh, 560px) !important;
        padding: 0 16px 8px !important;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-preview-stack {
        min-height: 220px;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-preview {
        width: min(88%, 300px);
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-preview img {
        max-height: min(32vh, 240px) !important;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-preview-mini {
        width: 40%;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-preview-mini.is-left {
        left: 6px;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-preview-mini.is-right {
        right: 6px;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm .tf-image-delete-copy {
        padding: 16px;
    }

    body.tf-image-standalone-page #tfImageConfirmModal.tf-image-chatgpt-confirm.is-delete-confirm .modal-buts {
        padding: 8px 16px 18px !important;
    }
}

/* Mobile composer: separated tools, embedded send, inline references */
@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-composer {
        left: 16px !important;
        right: 16px !important;
        bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    }

    body.tf-image-standalone-page .tf-image-composer-panel,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-panel {
        display: block !important;
        position: relative !important;
        min-height: 60px !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        overflow: visible !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    body.tf-image-standalone-page .tf-image-composer-panel::before {
        display: none !important;
        content: none !important;
    }

    body.tf-image-standalone-page .tf-image-composer-prompt,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-prompt,
    body.tf-image-standalone-page .tf-image-composer:not(.tf-image-composer-expanded) .tf-image-composer-prompt {
        position: relative !important;
        z-index: 1 !important;
        min-height: 60px !important;
        max-height: 162px !important;
        margin: 0 0 0 66px !important;
        padding: 7px 64px 7px 18px !important;
        border: 1px solid rgba(255, 255, 255, .72) !important;
        border-radius: 30px !important;
        background: rgba(255, 255, 255, .78) !important;
        box-shadow: 0 14px 34px rgba(15, 23, 42, .13), inset 0 1px 0 rgba(255, 255, 255, .9) !important;
        overflow: visible !important;
        backdrop-filter: blur(24px) saturate(1.12) !important;
        -webkit-backdrop-filter: blur(24px) saturate(1.12) !important;
    }

    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-prompt {
        border-radius: 26px !important;
    }

    body.tf-image-standalone-page .tf-image-form textarea.form-control,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-form textarea.form-control {
        display: block !important;
        min-height: 44px !important;
        height: auto;
        max-height: 104px !important;
        padding: 6px 0 !important;
        color: rgba(20, 20, 18, .88) !important;
        font-size: 18px !important;
        line-height: 1.55 !important;
        text-align: left !important;
        overflow-y: auto !important;
    }

    body.tf-image-standalone-page .tf-image-form textarea.form-control::placeholder {
        color: rgba(20, 20, 18, .42) !important;
        font-size: 18px !important;
    }

    body.tf-image-standalone-page .tf-image-composer-bottom,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-bottom {
        display: block !important;
        position: static !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
    }

    body.tf-image-standalone-page .tf-image-composer-tools,
    body.tf-image-standalone-page .tf-image-composer-assets-mobile,
    body.tf-image-standalone-page .tf-image-composer-assets-desktop,
    body.tf-image-standalone-page .tf-image-pay-toggle {
        display: none !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-run,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-run {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: absolute !important;
        z-index: 30 !important;
        top: auto !important;
        bottom: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        border: 0 !important;
        border-radius: 50% !important;
        transform: none !important;
        pointer-events: auto !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-mobile-settings-open {
        left: 0 !important;
        bottom: 2px !important;
        width: 56px !important;
        height: 56px !important;
        min-width: 56px !important;
        min-height: 56px !important;
        border: 1px solid rgba(255, 255, 255, .66) !important;
        background: rgba(255, 255, 255, .7) !important;
        color: rgba(20, 20, 18, .82) !important;
        box-shadow: 0 12px 28px rgba(15, 23, 42, .12), inset 0 1px 0 rgba(255, 255, 255, .86) !important;
        backdrop-filter: blur(22px) saturate(1.1) !important;
        -webkit-backdrop-filter: blur(22px) saturate(1.1) !important;
    }

    body.tf-image-standalone-page .tf-image-run,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-run {
        right: 8px !important;
        bottom: 6px !important;
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
        background: rgba(150, 145, 142, .64) !important;
        color: #fff !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    body.tf-image-standalone-page .tf-image-run.is-ready,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-run.is-ready,
    body.tf-image-standalone-page .tf-image-run[disabled].is-ready {
        background: rgba(5, 5, 5, .9) !important;
        color: #fff !important;
    }

    body.tf-image-standalone-page .tf-image-run[disabled]:not(.is-ready) {
        background: rgba(150, 145, 142, .64) !important;
        color: rgba(255, 255, 255, .94) !important;
        opacity: 1 !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-open .fa {
        width: 22px !important;
        height: 22px !important;
        margin: 0 !important;
        font-size: 22px !important;
        line-height: 22px !important;
    }

    body.tf-image-standalone-page .tf-image-send-wrap,
    body.tf-image-standalone-page .tf-image-send-wrap i,
    body.tf-image-standalone-page .tf-image-send-wrap svg,
    body.tf-image-standalone-page .tf-image-send-wrap .icon,
    body.tf-image-standalone-page .tf-image-send-wrap .svg-icon,
    body.tf-image-standalone-page .tf-image-send-icon,
    body.tf-image-standalone-page .tf-image-run > i {
        width: 21px !important;
        height: 21px !important;
        margin: 0 !important;
        font-size: 21px !important;
        line-height: 21px !important;
    }

    body.tf-image-standalone-page .tf-image-run > span:not(.tf-image-send-wrap) {
        display: none !important;
    }

    body.tf-image-standalone-page .tf-image-reference-preview.has-items {
        position: static !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        z-index: 1 !important;
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        max-height: 74px !important;
        margin: 0 0 7px !important;
        padding: 4px 4px 5px 0 !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
        transition: max-height .24s cubic-bezier(.22, .61, .36, 1), margin .24s cubic-bezier(.22, .61, .36, 1), opacity .18s ease, transform .24s cubic-bezier(.22, .61, .36, 1) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        scroll-snap-type: x proximity;
    }

    body.tf-image-standalone-page .tf-image-reference-preview.has-items::-webkit-scrollbar {
        display: none;
    }

    body.tf-image-standalone-page .tf-image-reference-item,
    body.tf-image-standalone-page .tf-image-reference-preview img {
        width: 58px !important;
        height: 58px !important;
        min-width: 58px !important;
    }

    body.tf-image-standalone-page .tf-image-reference-item {
        overflow: visible !important;
        animation: none !important;
        transition: opacity .14s ease, transform .14s ease !important;
    }

    body.tf-image-standalone-page .tf-image-reference-item.is-entering {
        animation: tf-image-mobile-reference-soft-in .24s cubic-bezier(.22, .61, .36, 1) both !important;
    }

    body.tf-image-standalone-page .tf-image-reference-preview img {
        border-radius: 16px !important;
        background: transparent !important;
        object-fit: contain !important;
        object-position: center !important;
        box-shadow: none !important;
    }

    body.tf-image-standalone-page .tf-image-reference-remove {
        top: -5px !important;
        right: -5px !important;
        width: 20px !important;
        height: 20px !important;
        color: #fff !important;
        background: rgba(17, 18, 20, .58) !important;
        box-shadow: 0 6px 16px rgba(15, 23, 42, .16) !important;
    }

    body.tf-image-standalone-page .tf-image-reference-remove .ic-close {
        width: 9px !important;
        height: 9px !important;
    }
}

@keyframes tf-image-mobile-reference-soft-in {
    from {
        opacity: 0;
        transform: translate3d(0, 7px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@media (max-width: 380px) {
    body.tf-image-standalone-page .tf-image-composer {
        left: 10px !important;
        right: 10px !important;
    }

    body.tf-image-standalone-page .tf-image-composer-prompt,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-prompt,
    body.tf-image-standalone-page .tf-image-composer:not(.tf-image-composer-expanded) .tf-image-composer-prompt {
        margin-left: 58px !important;
        padding-right: 58px !important;
    }

    body.tf-image-standalone-page .tf-image-form textarea.form-control,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-form textarea.form-control,
    body.tf-image-standalone-page .tf-image-form textarea.form-control::placeholder {
        font-size: 18px !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-mobile-settings-open {
        width: 50px !important;
        height: 50px !important;
        min-width: 50px !important;
        min-height: 50px !important;
    }

    body.tf-image-standalone-page .tf-image-run,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-run {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
    }
}

/* Final chat top breathing room */
body.tf-image-standalone-page .tf-image-work-panel .tf-image-output-box.is-chat,
body.tf-image-standalone-page .tf-image-work-panel .tf-image-page .tf-image-output-box.is-chat {
    padding-top: 34px !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-output-box.is-chat,
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-page .tf-image-output-box.is-chat {
        padding-top: 22px !important;
    }
}

/* Final shared ChatGPT-style head controls: template page and chat page */
body.tf-image-standalone-page .tf-image-template-home .tf-image-head-actions,
body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    width: auto !important;
    min-width: 0 !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but,
body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but.hollow,
body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-button.but,
body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-button.but.hollow {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: auto !important;
    min-width: 0 !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 13px !important;
    border: 1px solid rgba(13, 13, 13, .08) !important;
    border-radius: 12px !important;
    color: #2f2f2f !important;
    background: rgba(255, 255, 255, .72) !important;
    box-shadow: none !important;
    transform: none !important;
    backdrop-filter: blur(12px) saturate(1.05) !important;
    -webkit-backdrop-filter: blur(12px) saturate(1.05) !important;
    transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but:hover,
body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but:focus,
body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-button.but:hover,
body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-button.but:focus {
    border-color: rgba(13, 13, 13, .1) !important;
    background: rgba(255, 255, 255, .92) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04) !important;
    transform: none !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but > .fa:not(.fa-angle-right),
body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-button.but > .fa:not(.fa-angle-right) {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    color: #2f2f2f !important;
    font-size: 18px !important;
    line-height: 18px !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but span,
body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-button.but span {
    position: static !important;
    display: inline-flex !important;
    align-items: center !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    clip: auto !important;
    color: #2f2f2f !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but,
    body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but.hollow,
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-button.but,
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-button.but.hollow {
        flex: 0 0 42px !important;
        width: 42px !important;
        min-width: 42px !important;
        max-width: 42px !important;
        height: 42px !important;
        min-height: 42px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        background: rgba(255, 255, 255, .74) !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but span,
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-button.but span {
        display: none !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but > .fa:not(.fa-angle-right),
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-button.but > .fa:not(.fa-angle-right) {
        width: 20px !important;
        height: 20px !important;
        font-size: 20px !important;
        line-height: 20px !important;
    }
}

/* Final template preview sheet: unified frosted copy/action area */
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content {
    border: 1px solid rgba(255, 255, 255, .62) !important;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .34), rgba(246, 246, 244, .18)),
        rgba(246, 246, 244, .22) !important;
    box-shadow: 0 28px 88px rgba(15, 23, 42, .26), inset 0 1px 0 rgba(255, 255, 255, .72) !important;
    backdrop-filter: blur(24px) saturate(1.12) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.12) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
    border: 0 !important;
    background:
        radial-gradient(circle at 50% 0%, rgba(255, 255, 255, .72), rgba(255, 255, 255, 0) 54%),
        linear-gradient(180deg, rgba(255, 255, 255, .6), rgba(246, 246, 244, .44)),
        rgba(246, 246, 244, .5) !important;
    box-shadow: none !important;
    backdrop-filter: blur(36px) saturate(1.22) brightness(1.04) !important;
    -webkit-backdrop-filter: blur(36px) saturate(1.22) brightness(1.04) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body {
    padding-bottom: 4px !important;
    background:
        radial-gradient(circle at 50% 0%, rgba(255, 255, 255, .76), rgba(255, 255, 255, 0) 58%),
        linear-gradient(180deg, rgba(255, 255, 255, .62), rgba(246, 246, 244, .48)),
        rgba(246, 246, 244, .52) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
    background:
        linear-gradient(180deg, rgba(246, 246, 244, .48), rgba(246, 246, 244, .54)),
        rgba(246, 246, 244, .52) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body::before,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body::after,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions::before,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions::after {
    display: none !important;
    content: none !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
    gap: 14px !important;
    padding-top: 16px !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-prompt {
    color: rgba(17, 17, 17, .58) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-apply {
    box-shadow: 0 16px 32px rgba(0, 0, 0, .14) !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body {
        padding-bottom: 4px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
        padding-top: 14px !important;
    }
}

/* Strong frosted template panel: overlap media so the glass has real pixels to blur */
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content {
    isolation: isolate;
    background: rgba(246, 246, 244, .16) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    height: min(280px, 48%);
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 0%, rgba(255, 255, 255, .9), rgba(255, 255, 255, 0) 52%),
        linear-gradient(180deg, rgba(255, 255, 255, .68), rgba(246, 246, 244, .54)),
        rgba(246, 246, 244, .58) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .82), 0 -20px 44px rgba(255, 255, 255, .2);
    backdrop-filter: blur(56px) saturate(1.45) brightness(1.08) contrast(.94) !important;
    -webkit-backdrop-filter: blur(56px) saturate(1.45) brightness(1.08) contrast(.94) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-media,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-cover {
    position: relative;
    z-index: 0;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
    position: relative !important;
    z-index: 2 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body {
    margin-top: -86px !important;
    padding-top: 108px !important;
    padding-bottom: 2px !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
    padding-top: 14px !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body h2 {
    color: rgba(7, 7, 7, .96) !important;
    text-shadow: 0 1px 0 rgba(255, 255, 255, .42);
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-prompt {
    color: rgba(17, 17, 17, .62) !important;
    text-shadow: 0 1px 0 rgba(255, 255, 255, .34);
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content::after {
        height: min(270px, 52%);
        backdrop-filter: blur(60px) saturate(1.5) brightness(1.08) contrast(.94) !important;
        -webkit-backdrop-filter: blur(60px) saturate(1.5) brightness(1.08) contrast(.94) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body {
        margin-top: -78px !important;
        padding-top: 96px !important;
        padding-bottom: 2px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
        padding-top: 12px !important;
    }
}

/* Reference-style frosted modal: clear media, thick glass information panel */
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content {
    isolation: isolate;
    border: 1px solid rgba(255, 255, 255, .72) !important;
    background: transparent !important;
    box-shadow: 0 30px 92px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .72) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 1;
    height: 46%;
    min-height: 254px;
    max-height: 360px;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 0%, rgba(255, 255, 255, .88), rgba(255, 255, 255, 0) 46%),
        linear-gradient(135deg, rgba(232, 238, 240, .82), rgba(244, 239, 235, .74) 58%, rgba(238, 238, 236, .82)),
        rgba(238, 239, 238, .78) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .86), 0 -18px 48px rgba(255, 255, 255, .18);
    backdrop-filter: blur(46px) saturate(1.34) brightness(1.08) contrast(.96) !important;
    -webkit-backdrop-filter: blur(46px) saturate(1.34) brightness(1.08) contrast(.96) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-media,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-cover {
    position: relative;
    z-index: 0;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
    position: relative !important;
    z-index: 2 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body {
    margin-top: 0 !important;
    padding: 58px 56px 8px !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
    gap: 18px !important;
    padding: 24px 56px 48px !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body h2 {
    margin-bottom: 22px !important;
    color: rgba(6, 6, 6, .96) !important;
    font-size: 31px !important;
    font-weight: 850 !important;
    text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-prompt {
    max-width: 520px !important;
    color: rgba(24, 24, 22, .52) !important;
    font-size: 18px !important;
    font-weight: 520 !important;
    line-height: 1.7 !important;
    text-shadow: 0 1px 0 rgba(255, 255, 255, .36);
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-apply {
    min-height: 64px !important;
    border-radius: 999px !important;
    background: #000 !important;
    box-shadow: 0 18px 38px rgba(0, 0, 0, .16) !important;
    font-size: 18px !important;
    font-weight: 800 !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content::after {
        height: 48%;
        min-height: 236px;
        max-height: 330px;
        backdrop-filter: blur(50px) saturate(1.38) brightness(1.08) contrast(.96) !important;
        -webkit-backdrop-filter: blur(50px) saturate(1.38) brightness(1.08) contrast(.96) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body {
        margin-top: 0 !important;
        padding: 42px 28px 6px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
        gap: 14px !important;
        padding: 18px 28px 32px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body h2 {
        margin-bottom: 16px !important;
        font-size: 25px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-prompt {
        font-size: 15px !important;
    }

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-apply {
        min-height: 56px !important;
        font-size: 16px !important;
    }
}

/* Balanced frosted finish: translucent grey glass, not flat white */
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal::before {
    background: rgba(18, 18, 18, .26) !important;
    backdrop-filter: blur(18px) saturate(.88) brightness(.9) !important;
    -webkit-backdrop-filter: blur(18px) saturate(.88) brightness(.9) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content::after {
    background:
        radial-gradient(circle at 50% 0%, rgba(255, 255, 255, .66), rgba(255, 255, 255, .16) 48%, rgba(255, 255, 255, 0) 76%),
        linear-gradient(135deg, rgba(216, 229, 235, .68), rgba(235, 230, 226, .62) 56%, rgba(225, 226, 224, .68)),
        rgba(229, 232, 231, .62) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72), 0 -18px 46px rgba(255, 255, 255, .14);
    backdrop-filter: blur(54px) saturate(1.55) brightness(1.05) contrast(.92) !important;
    -webkit-backdrop-filter: blur(54px) saturate(1.55) brightness(1.05) contrast(.92) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content {
    border-color: rgba(255, 255, 255, .68) !important;
    box-shadow: 0 30px 92px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .7) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-prompt {
    color: rgba(20, 20, 18, .56) !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal::before {
        backdrop-filter: blur(20px) saturate(.88) brightness(.9) !important;
        -webkit-backdrop-filter: blur(20px) saturate(.88) brightness(.9) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content::after {
        background:
            radial-gradient(circle at 50% 0%, rgba(255, 255, 255, .7), rgba(255, 255, 255, .18) 48%, rgba(255, 255, 255, 0) 76%),
            linear-gradient(135deg, rgba(216, 229, 235, .7), rgba(235, 230, 226, .64) 56%, rgba(225, 226, 224, .7)),
            rgba(229, 232, 231, .64) !important;
        backdrop-filter: blur(58px) saturate(1.58) brightness(1.05) contrast(.92) !important;
        -webkit-backdrop-filter: blur(58px) saturate(1.58) brightness(1.05) contrast(.92) !important;
    }
}

/* Fill the upper glass band so the title area is frosted, not transparent */
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content::after {
    background:
        linear-gradient(180deg, rgba(229, 236, 238, .84) 0%, rgba(231, 233, 232, .74) 38%, rgba(231, 231, 229, .68) 100%),
        rgba(229, 232, 231, .72) !important;
    backdrop-filter: blur(56px) saturate(1.42) brightness(1.05) contrast(.92) !important;
    -webkit-backdrop-filter: blur(56px) saturate(1.42) brightness(1.05) contrast(.92) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body {
    background:
        linear-gradient(180deg, rgba(229, 236, 238, .8), rgba(231, 233, 232, .7)),
        rgba(229, 232, 231, .66) !important;
    backdrop-filter: blur(34px) saturate(1.32) brightness(1.04) !important;
    -webkit-backdrop-filter: blur(34px) saturate(1.32) brightness(1.04) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
    background:
        linear-gradient(180deg, rgba(231, 233, 232, .7), rgba(231, 231, 229, .76)),
        rgba(229, 232, 231, .68) !important;
    backdrop-filter: blur(34px) saturate(1.32) brightness(1.04) !important;
    -webkit-backdrop-filter: blur(34px) saturate(1.32) brightness(1.04) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
    border: 0 !important;
    box-shadow: none !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content::after {
        background:
            linear-gradient(180deg, rgba(229, 236, 238, .86) 0%, rgba(231, 233, 232, .76) 38%, rgba(231, 231, 229, .7) 100%),
            rgba(229, 232, 231, .74) !important;
        backdrop-filter: blur(60px) saturate(1.42) brightness(1.05) contrast(.92) !important;
        -webkit-backdrop-filter: blur(60px) saturate(1.42) brightness(1.05) contrast(.92) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body {
        background:
            linear-gradient(180deg, rgba(229, 236, 238, .82), rgba(231, 233, 232, .72)),
            rgba(229, 232, 231, .68) !important;
    }
}

/* Final template modal motion and glass close button sync */
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.flex {
    background: transparent !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal::before {
    content: "" !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 0 !important;
    background: rgba(18, 18, 18, .26) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    backdrop-filter: blur(18px) saturate(.88) brightness(.9) !important;
    -webkit-backdrop-filter: blur(18px) saturate(.88) brightness(.9) !important;
    transition: opacity .34s cubic-bezier(.22, .61, .36, 1), backdrop-filter .34s cubic-bezier(.22, .61, .36, 1) !important;
    will-change: opacity;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.tf-image-template-opening::before,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.in::before,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.show::before {
    opacity: 1 !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.tf-image-template-closing::before {
    opacity: 0 !important;
    transition-duration: .26s !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-dialog,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.fade .modal-dialog {
    opacity: 0 !important;
    transform: translate3d(0, 34px, 0) scale(.985) !important;
    transition: transform .34s cubic-bezier(.22, .61, .36, 1), opacity .34s cubic-bezier(.22, .61, .36, 1) !important;
    will-change: transform, opacity;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.in .modal-dialog,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.show .modal-dialog {
    opacity: 1 !important;
    transform: translate3d(0, 0, 0) scale(1) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.tf-image-template-closing .modal-dialog {
    opacity: 0 !important;
    transform: translate3d(0, 34px, 0) scale(.985) !important;
    transition-duration: .26s !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-modal-close {
    position: absolute !important;
    top: 16px !important;
    right: 16px !important;
    z-index: 6 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    min-height: 52px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid rgba(255, 255, 255, .32) !important;
    border-radius: 50% !important;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .26), rgba(255, 255, 255, .1)),
        rgba(76, 76, 76, .58) !important;
    color: #fff !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 10px 28px rgba(0, 0, 0, .18) !important;
    opacity: 1 !important;
    line-height: 0 !important;
    transform: none !important;
    backdrop-filter: blur(18px) saturate(1.18) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.18) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close:hover,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-modal-close:hover {
    color: #fff !important;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .3), rgba(255, 255, 255, .12)),
        rgba(58, 58, 58, .64) !important;
    opacity: 1 !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close > span,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-modal-close > span {
    position: absolute !important;
    inset: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 0 !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close .ic-close,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-modal-close .ic-close {
    display: block !important;
    width: 25px !important;
    height: 25px !important;
    margin: 0 !important;
    color: #fff !important;
    fill: currentColor !important;
    stroke: currentColor !important;
    transform: none !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal::before {
        backdrop-filter: blur(20px) saturate(.88) brightness(.9) !important;
        -webkit-backdrop-filter: blur(20px) saturate(.88) brightness(.9) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-dialog,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.fade .modal-dialog,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.tf-image-template-closing .modal-dialog {
        transform: translate3d(0, 28px, 0) scale(.985) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.in .modal-dialog,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.show .modal-dialog {
        transform: translate3d(0, 0, 0) scale(1) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-modal-close {
        top: 14px !important;
        right: 14px !important;
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close .ic-close,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-modal-close .ic-close {
        width: 24px !important;
        height: 24px !important;
    }
}

/* Final polish: opaque frosted title band and input-style glass close button */
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content::after {
    background:
        linear-gradient(180deg, rgba(226, 234, 236, .94) 0%, rgba(229, 232, 232, .9) 42%, rgba(229, 229, 227, .86) 100%),
        rgba(228, 231, 230, .9) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .76), 0 -14px 34px rgba(255, 255, 255, .12) !important;
    backdrop-filter: blur(46px) saturate(1.22) brightness(1.04) contrast(.96) !important;
    -webkit-backdrop-filter: blur(46px) saturate(1.22) brightness(1.04) contrast(.96) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body {
    background:
        linear-gradient(180deg, rgba(226, 234, 236, .96), rgba(229, 232, 232, .9)),
        rgba(228, 231, 230, .9) !important;
    backdrop-filter: blur(34px) saturate(1.2) brightness(1.04) !important;
    -webkit-backdrop-filter: blur(34px) saturate(1.2) brightness(1.04) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
    background:
        linear-gradient(180deg, rgba(229, 232, 232, .9), rgba(229, 229, 227, .92)),
        rgba(228, 231, 230, .9) !important;
    backdrop-filter: blur(34px) saturate(1.2) brightness(1.04) !important;
    -webkit-backdrop-filter: blur(34px) saturate(1.2) brightness(1.04) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-modal-close {
    border: 0 !important;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .34), rgba(255, 255, 255, .12)),
        rgba(120, 120, 120, .46) !important;
    color: #fff !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .36), 0 8px 22px rgba(15, 23, 42, .12) !important;
    backdrop-filter: blur(24px) saturate(1.14) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.14) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close:hover,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-modal-close:hover {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .38), rgba(255, 255, 255, .14)),
        rgba(104, 104, 104, .5) !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content::after {
        background:
            linear-gradient(180deg, rgba(226, 234, 236, .96) 0%, rgba(229, 232, 232, .92) 42%, rgba(229, 229, 227, .88) 100%),
            rgba(228, 231, 230, .92) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body {
        background:
            linear-gradient(180deg, rgba(226, 234, 236, .97), rgba(229, 232, 232, .92)),
            rgba(228, 231, 230, .92) !important;
    }
}

/* Final hard override: solid frosted sheet and ringless glass close button */
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content {
    background: rgba(232, 233, 231, .42) !important;
    border-color: rgba(255, 255, 255, .52) !important;
    overflow: hidden !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-media,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-cover {
    background: rgba(232, 233, 231, .96) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content::after {
    display: none !important;
    content: none !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-glass {
    position: relative !important;
    z-index: 2 !important;
    overflow: hidden !important;
    background: rgba(255, 255, 255, .58) !important;
    border: 1px solid rgba(255, 255, 255, .56) !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .48), 0 20px 60px rgba(0, 0, 0, .12) !important;
    backdrop-filter: blur(24px) saturate(170%) brightness(1.06) !important;
    -webkit-backdrop-filter: blur(24px) saturate(170%) brightness(1.06) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-glass::before {
    content: "" !important;
    position: absolute !important;
    inset: 0 !important;
    z-index: 0 !important;
    pointer-events: none !important;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .42), rgba(255, 255, 255, .08) 38%, rgba(255, 255, 255, 0) 68%),
        radial-gradient(circle at 50% 0%, rgba(255, 255, 255, .42), rgba(255, 255, 255, 0) 58%) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-glass::after {
    content: "" !important;
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 0 !important;
    height: 46% !important;
    pointer-events: none !important;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(245, 247, 246, .26)) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
    position: relative !important;
    z-index: 1 !important;
    outline: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body {
    margin-top: 0 !important;
    padding-top: 44px !important;
    padding-bottom: 6px !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
    padding-top: 18px !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body::before,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body::after,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions::before,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions::after {
    display: none !important;
    content: none !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-modal-close {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    border: 0 !important;
    outline: 0 !important;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .42), rgba(255, 255, 255, .14)),
        rgba(112, 112, 112, .42) !important;
    box-shadow: none !important;
    text-shadow: none !important;
    overflow: hidden !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    backdrop-filter: blur(24px) saturate(1.12) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.12) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close:hover,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close:focus,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close:active,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-modal-close:hover,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-modal-close:focus,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-modal-close:active {
    border: 0 !important;
    outline: 0 !important;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .46), rgba(255, 255, 255, .16)),
        rgba(92, 92, 92, .48) !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close::before,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close::after,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-modal-close::before,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-modal-close::after {
    display: none !important;
    content: none !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close > span,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-modal-close > span,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close .ic-close,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-modal-close .ic-close {
    text-shadow: none !important;
    filter: none !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content::after {
        display: none !important;
        content: none !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body {
        margin-top: 0 !important;
        padding-top: 38px !important;
        padding-bottom: 6px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
        padding-top: 16px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-close,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-modal-close {
        top: 14px !important;
        right: 14px !important;
        width: 46px !important;
        height: 46px !important;
        min-width: 46px !important;
        min-height: 46px !important;
    }
}

/* Template preview: only the modal moves; inner content stays locked */
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-media,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-cover,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-cover img,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body h2,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-prompt,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-upload-hint,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-apply {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
    will-change: auto !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.in .tf-image-template-preview-cover img,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.show .tf-image-template-preview-cover img,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.in .tf-image-template-preview-body,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.show .tf-image-template-preview-body,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.in .tf-image-template-preview-actions,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.show .tf-image-template-preview-actions {
    opacity: 1 !important;
    transform: none !important;
}

/* Let the lower glass sample the page behind the modal, not the modal shell */
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content {
    isolation: auto !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-glass {
    isolation: auto !important;
    background: rgba(255, 255, 255, .46) !important;
    border-color: rgba(255, 255, 255, .48) !important;
    border-top: 0 !important;
    margin-top: -1px !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 20px 60px rgba(0, 0, 0, .14) !important;
    backdrop-filter: blur(22px) saturate(180%) brightness(1.08) !important;
    -webkit-backdrop-filter: blur(22px) saturate(180%) brightness(1.08) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-glass::before {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .32), rgba(255, 255, 255, .08) 42%, rgba(255, 255, 255, 0) 72%),
        radial-gradient(circle at 50% 0%, rgba(255, 255, 255, .38), rgba(255, 255, 255, 0) 60%) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-glass::after {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(245, 247, 246, .18)) !important;
}

/* Template backdrop must be visible on the first open frame */
body.tf-image-template-modal-open .tf-image-template-preview-modal.tf-image-chatgpt-modal::before,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.tf-image-template-opening::before {
    opacity: 1 !important;
    background: rgba(18, 18, 18, .26) !important;
    backdrop-filter: blur(18px) saturate(.88) brightness(.9) !important;
    -webkit-backdrop-filter: blur(18px) saturate(.88) brightness(.9) !important;
    transition: none !important;
}

body.tf-image-template-modal-closing .tf-image-template-preview-modal.tf-image-chatgpt-modal::before,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.tf-image-template-closing::before {
    opacity: 0 !important;
    transition: opacity .18s ease !important;
}

/* Body-level template backdrop: independent of modal repaint timing */
body.tf-image-standalone-page.tf-image-template-modal-open::before,
body.tf-image-standalone-page.tf-image-template-modal-closing::before {
    content: "" !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 1054 !important;
    pointer-events: none !important;
    background: rgba(18, 18, 18, .26) !important;
    opacity: 1 !important;
    backdrop-filter: blur(18px) saturate(.88) brightness(.9) !important;
    -webkit-backdrop-filter: blur(18px) saturate(.88) brightness(.9) !important;
    transition: none !important;
}

body.tf-image-standalone-page.tf-image-template-modal-closing::before {
    opacity: 0 !important;
    transition: opacity .18s ease !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal::before {
    display: none !important;
    content: none !important;
}

/* Remove the bright seam between preview media and lower glass */
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-glass {
    border-top: 0 !important;
    margin-top: -2px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .14) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-glass::before {
    top: 2px !important;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .07) 42%, rgba(255, 255, 255, 0) 72%),
        radial-gradient(circle at 50% 4%, rgba(255, 255, 255, .24), rgba(255, 255, 255, 0) 62%) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-media,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-cover {
    margin-bottom: 0 !important;
    border-bottom: 0 !important;
    box-shadow: none !important;
}

/* Mobile settings sheet: smooth slide from the plus button action */
@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-mobile-settings-modal::before,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.tf-image-mobile-settings-opening::before {
        display: none !important;
        content: none !important;
        opacity: 0 !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        transition: none !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal.tf-image-mobile-settings-opening.in::before,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.tf-image-mobile-settings-opening.show::before,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.in::before,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.show::before {
        display: none !important;
        content: none !important;
        opacity: 0 !important;
        transition: none !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal.tf-image-mobile-settings-opening .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.tf-image-mobile-settings-opening.fade .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.tf-image-mobile-settings-opening.bottom.fade .modal-dialog {
        opacity: 0 !important;
        transform: translate3d(0, 100%, 0) scale(.997) !important;
        transition: transform .18s cubic-bezier(.2, .8, .2, 1), opacity .12s ease !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal.tf-image-mobile-settings-opening.in .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.tf-image-mobile-settings-opening.show .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.in .modal-dialog,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.show .modal-dialog {
        opacity: 1 !important;
        transform: translate3d(0, 0, 0) scale(1) !important;
        transition: transform .18s cubic-bezier(.2, .8, .2, 1), opacity .12s ease !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal.tf-image-mobile-settings-closing .modal-dialog {
        opacity: 0 !important;
        transform: translate3d(0, 108%, 0) scale(.997) !important;
        transition: transform .24s cubic-bezier(.32, .72, .28, 1), opacity .16s ease !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal.tf-image-mobile-settings-closing::before {
        display: none !important;
        content: none !important;
        opacity: 0 !important;
        transition: none !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-content,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal.bottom .modal-content {
        background: rgba(244, 245, 244, .96) !important;
        border: 1px solid rgba(255, 255, 255, .76) !important;
        box-shadow: 0 24px 70px rgba(0, 0, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .72) !important;
        backdrop-filter: blur(40px) saturate(115%) brightness(1.04) contrast(.98) !important;
        -webkit-backdrop-filter: blur(40px) saturate(115%) brightness(1.04) contrast(.98) !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-content::before {
        content: "" !important;
        position: absolute !important;
        inset: 0 !important;
        z-index: 0 !important;
        pointer-events: none !important;
        background:
            linear-gradient(180deg, rgba(255, 255, 255, .58), rgba(255, 255, 255, .26) 42%, rgba(255, 255, 255, .12) 72%),
            radial-gradient(circle at 50% 4%, rgba(255, 255, 255, .46), rgba(255, 255, 255, .08) 62%) !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal .tf-image-modal-header,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .modal-body {
        position: relative !important;
        z-index: 1 !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal .touch-close {
        top: 12px !important;
        width: 42px !important;
        height: 5px !important;
        margin-left: -21px !important;
        background: rgba(17, 18, 20, .22) !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal .touch-close::before,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .touch-close::after {
        display: none !important;
        content: none !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal .tf-image-modal-header {
        padding: 32px 64px 18px 22px !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-setting-row {
        background: rgba(255, 255, 255, .94) !important;
        border-color: rgba(255, 255, 255, .86) !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72), 0 12px 28px rgba(15, 23, 42, .08) !important;
        backdrop-filter: blur(18px) saturate(130%) !important;
        -webkit-backdrop-filter: blur(18px) saturate(130%) !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal .tf-image-modal-close,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .tf-image-mobile-settings-close {
        top: 14px !important;
        right: 14px !important;
        z-index: 4 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        min-height: 32px !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        outline: 0 !important;
        border-radius: 50% !important;
        color: #fff !important;
        background:
            linear-gradient(135deg, rgba(255, 255, 255, .42), rgba(255, 255, 255, .14)),
            rgba(112, 112, 112, .42) !important;
        box-shadow: none !important;
        text-shadow: none !important;
        opacity: 1 !important;
        overflow: hidden !important;
        transform: none !important;
        appearance: none !important;
        -webkit-appearance: none !important;
        backdrop-filter: blur(24px) saturate(1.12) !important;
        -webkit-backdrop-filter: blur(24px) saturate(1.12) !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal .tf-image-modal-close:hover,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .tf-image-modal-close:focus,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .tf-image-modal-close:active,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .tf-image-mobile-settings-close:hover,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .tf-image-mobile-settings-close:focus,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .tf-image-mobile-settings-close:active {
        border: 0 !important;
        outline: 0 !important;
        background:
            linear-gradient(135deg, rgba(255, 255, 255, .46), rgba(255, 255, 255, .16)),
            rgba(92, 92, 92, .48) !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal .tf-image-modal-close::before,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .tf-image-modal-close::after,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .tf-image-mobile-settings-close::before,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .tf-image-mobile-settings-close::after {
        display: none !important;
        content: none !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-modal .tf-image-modal-close .ic-close,
    body.tf-image-standalone-page .tf-image-mobile-settings-modal .tf-image-mobile-settings-close .ic-close {
        display: block !important;
        width: 14px !important;
        height: 14px !important;
        margin: 0 !important;
        color: #fff !important;
        fill: currentColor !important;
        stroke: currentColor !important;
        transform: none !important;
        text-shadow: none !important;
        filter: none !important;
    }
}

/* Mobile composer plus button: match prompt height */
@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-mobile-settings-open {
        bottom: 0 !important;
        width: 60px !important;
        height: 60px !important;
        min-width: 60px !important;
        min-height: 60px !important;
    }

    body.tf-image-standalone-page .tf-image-mobile-settings-open .fa {
        width: 23px !important;
        height: 23px !important;
        font-size: 23px !important;
        line-height: 23px !important;
    }
}

@media (max-width: 380px) {
    body.tf-image-standalone-page .tf-image-mobile-settings-open,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-mobile-settings-open {
        width: 54px !important;
        height: 54px !important;
        min-width: 54px !important;
        min-height: 54px !important;
    }
}

/* Reference thumbnails: fixed rounded square on desktop and mobile */
body.tf-image-standalone-page .tf-image-reference-preview.has-items {
    align-items: flex-start !important;
    max-height: 104px !important;
    transition: max-height .3s cubic-bezier(.22, .61, .36, 1), margin .3s cubic-bezier(.22, .61, .36, 1), padding .3s cubic-bezier(.22, .61, .36, 1), opacity .2s ease, transform .3s cubic-bezier(.22, .61, .36, 1) !important;
}

body.tf-image-standalone-page .tf-image-reference-preview.has-items.is-clearing {
    max-height: 0 !important;
    margin: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    opacity: 0 !important;
    transform: translate3d(0, 10px, 0) !important;
}

body.tf-image-standalone-page .tf-image-reference-item {
    position: relative !important;
    width: 82px !important;
    height: 82px !important;
    min-width: 82px !important;
    max-width: 82px !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 18px !important;
    background: rgba(255, 255, 255, .5) !important;
    overflow: visible !important;
    transition: width .28s cubic-bezier(.22, .61, .36, 1), min-width .28s cubic-bezier(.22, .61, .36, 1), max-width .28s cubic-bezier(.22, .61, .36, 1), margin .28s cubic-bezier(.22, .61, .36, 1), opacity .18s ease, transform .28s cubic-bezier(.22, .61, .36, 1) !important;
}

body.tf-image-standalone-page .tf-image-reference-preview img {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 18px !important;
    background: transparent !important;
    object-fit: contain !important;
    object-position: center !important;
    box-shadow: none !important;
}

body.tf-image-standalone-page .tf-image-reference-remove {
    top: -8px !important;
    right: -8px !important;
    z-index: 3 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    color: #fff !important;
    background: rgba(17, 18, 20, .86) !important;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .18) !important;
    opacity: 1 !important;
}

body.tf-image-standalone-page .tf-image-reference-remove:hover,
body.tf-image-standalone-page .tf-image-reference-remove:focus,
body.tf-image-standalone-page .tf-image-reference-remove:active {
    color: #fff !important;
    background: #050505 !important;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .22) !important;
}

body.tf-image-standalone-page .tf-image-reference-remove .ic-close {
    width: 12px !important;
    height: 12px !important;
    color: #fff !important;
    fill: currentColor !important;
    stroke: currentColor !important;
}

body.tf-image-standalone-page .tf-image-reference-item.is-removing {
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    margin-right: -10px !important;
    opacity: 0 !important;
    transform: translate3d(0, 8px, 0) scale(.9) !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-reference-preview.has-items {
        max-height: 68px !important;
        padding: 4px 0 6px !important;
        transition: max-height .28s cubic-bezier(.22, .61, .36, 1), margin .28s cubic-bezier(.22, .61, .36, 1), padding .28s cubic-bezier(.22, .61, .36, 1), opacity .2s ease, transform .28s cubic-bezier(.22, .61, .36, 1) !important;
    }

    body.tf-image-standalone-page .tf-image-reference-preview.has-items.is-clearing {
        max-height: 0 !important;
        margin: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        opacity: 0 !important;
        transform: translate3d(0, 8px, 0) !important;
    }

    body.tf-image-standalone-page .tf-image-reference-item {
        position: relative !important;
        width: 58px !important;
        height: 58px !important;
        min-width: 58px !important;
        max-width: 58px !important;
        border-radius: 16px !important;
        background: rgba(255, 255, 255, .52) !important;
        overflow: visible !important;
        transition: width .26s cubic-bezier(.22, .61, .36, 1), min-width .26s cubic-bezier(.22, .61, .36, 1), margin .26s cubic-bezier(.22, .61, .36, 1), opacity .18s ease, transform .26s cubic-bezier(.22, .61, .36, 1) !important;
    }

    body.tf-image-standalone-page .tf-image-reference-preview img {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        border-radius: 16px !important;
        object-fit: contain !important;
        object-position: center !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    body.tf-image-standalone-page .tf-image-reference-remove {
        top: 4px !important;
        right: 4px !important;
        width: 20px !important;
        height: 20px !important;
        color: #fff !important;
        background: rgba(17, 18, 20, .86) !important;
        box-shadow: 0 4px 10px rgba(15, 23, 42, .14) !important;
    }

    body.tf-image-standalone-page .tf-image-reference-remove:hover,
    body.tf-image-standalone-page .tf-image-reference-remove:focus,
    body.tf-image-standalone-page .tf-image-reference-remove:active {
        background: #050505 !important;
        color: #fff !important;
    }

    body.tf-image-standalone-page .tf-image-reference-remove .ic-close {
        width: 9px !important;
        height: 9px !important;
    }

    body.tf-image-standalone-page .tf-image-reference-item.is-removing {
        width: 0 !important;
        min-width: 0 !important;
        max-width: 0 !important;
        margin-right: -8px !important;
        opacity: 0 !important;
        transform: translate3d(0, 7px, 0) scale(.86) !important;
    }

    body.tf-image-standalone-page .tf-image-reference-preview:not(.has-items) {
        max-height: 0 !important;
        margin: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        opacity: 0 !important;
        transform: translate3d(0, 8px, 0) !important;
        transition: max-height .28s cubic-bezier(.22, .61, .36, 1), margin .28s cubic-bezier(.22, .61, .36, 1), padding .28s cubic-bezier(.22, .61, .36, 1), opacity .2s ease, transform .28s cubic-bezier(.22, .61, .36, 1) !important;
    }
}

/* Final page bottom spacing: keep room for the fixed composer without a large blank tail */
body.tf-image-standalone-page .tf-image-page {
    padding-bottom: 150px !important;
}

body.tf-image-standalone-page .tf-image-studio,
body.tf-image-standalone-page .tf-image-template-home {
    min-height: calc(100vh - 190px) !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-template-list-view {
    padding-bottom: 14px !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-head-actions {
    gap: 10px;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but {
    min-width: 0 !important;
    min-height: 46px !important;
    height: 46px !important;
    padding: 0 18px !important;
    gap: 9px !important;
    border: 1px solid rgba(255, 255, 255, .86) !important;
    border-radius: 999px !important;
    color: #202124 !important;
    background: rgba(255, 255, 255, .9) !important;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .08), inset 0 1px 0 rgba(255, 255, 255, .96) !important;
    backdrop-filter: blur(14px) saturate(150%);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but > .fa:not(.fa-angle-right) {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 24px !important;
    height: 24px !important;
    margin: 0 !important;
    color: #1f1f1f !important;
    font-size: 24px !important;
    line-height: 1 !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but span {
    color: #202124 !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but:hover,
body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but:focus {
    border-color: rgba(255, 255, 255, .96) !important;
    background: #fff !important;
    box-shadow: 0 18px 42px rgba(15, 23, 42, .12), inset 0 1px 0 rgba(255, 255, 255, 1) !important;
    transform: translateY(-1px);
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-open-loading {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: min(46vh, 420px);
    width: 100%;
    color: rgba(70, 74, 82, .72);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-open-loading .tf-image-gpt-mark {
    width: 46px;
    height: 46px;
    margin: 0;
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-open-loading .tf-image-gpt-mark i {
    left: 14px;
    top: 5px;
    width: 18px;
    height: 36px;
    transform-origin: 9px 18px;
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-expired-loading {
    min-height: min(54vh, 480px);
    color: #4f63ff;
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-expired-loading .tf-image-gpt-mark {
    width: 58px;
    height: 58px;
    color: #4f63ff;
    filter: drop-shadow(0 12px 24px rgba(79, 99, 255, .2));
    animation-duration: 1.35s;
}

body.tf-image-standalone-page .tf-image-page .tf-image-chat-expired-loading .tf-image-gpt-mark i {
    left: 18px;
    top: 5px;
    width: 22px;
    height: 48px;
    transform-origin: 11px 24px;
    border-width: 2.5px;
}

.tf-image-chat-expired-loading .tf-image-expired-title {
    color: rgba(31, 35, 45, .88);
    font-size: 16px;
    font-weight: 800;
}

.tf-image-chat-expired-loading .tf-image-expired-countdown {
    color: #4f63ff;
    font-size: 14px;
    font-weight: 700;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-page {
        padding-bottom: calc(86px + env(safe-area-inset-bottom)) !important;
    }

    body.tf-image-standalone-page .tf-image-studio,
    body.tf-image-standalone-page .tf-image-template-home {
        min-height: calc(100vh - 112px - env(safe-area-inset-bottom)) !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-list-view {
        padding-bottom: 10px !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-head-actions {
        gap: 8px;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but {
        width: 50px !important;
        min-width: 50px !important;
        height: 50px !important;
        min-height: 50px !important;
        padding: 0 !important;
        border-radius: 999px !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but span {
        display: none !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but > .fa:not(.fa-angle-right) {
        width: 26px !important;
        height: 26px !important;
        font-size: 26px !important;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-chat-open-loading {
        min-height: min(42vh, 340px);
        font-size: 13px;
    }
}

/* History modals keep Zibll's colorful header and stay centered on the screen. */
body.tf-image-standalone-page .tf-image-history-modal.in,
body.tf-image-standalone-page .tf-image-history-modal[style*="display: block"],
body.tf-image-standalone-page .tf-image-history-modal.show {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 24px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

body.tf-image-standalone-page .tf-image-history-modal .modal-dialog,
body.tf-image-standalone-page .tf-image-history-modal.fade .modal-dialog {
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    width: min(920px, calc(100vw - 48px)) !important;
    max-width: 920px !important;
    margin: 0 auto !important;
}

body.tf-image-standalone-page .tf-image-usage-modal .modal-dialog,
body.tf-image-standalone-page .tf-image-usage-modal.fade .modal-dialog {
    width: min(720px, calc(100vw - 48px)) !important;
    max-width: 720px !important;
}

body.tf-image-standalone-page .tf-image-history-modal .modal-content {
    width: 100% !important;
    overflow: hidden !important;
}

body.tf-image-standalone-page .tf-image-history-modal .modal-body.tf-image-history-body {
    max-height: none !important;
    padding: 0 !important;
    overflow: visible !important;
}

body.tf-image-standalone-page .tf-image-history-modal .tf-image-history-content {
    max-height: min(58vh, 540px);
    padding: 20px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

body.tf-image-standalone-page .tf-image-history-modal .tf-image-gallery-grid.is-records {
    width: 100% !important;
    max-width: none !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 14px !important;
    min-height: 220px;
    margin: 0 !important;
    padding: 0 !important;
}

body.tf-image-standalone-page .tf-image-history-modal .tf-image-gallery-item {
    contain: content;
}

body.tf-image-standalone-page .tf-image-history-modal .tf-image-gallery-grid.is-records .tf-image-gallery-item {
    aspect-ratio: 1 / 1 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    border-radius: 18px !important;
    background: rgba(255, 255, 255, .62) !important;
}

body.tf-image-standalone-page .tf-image-history-modal .tf-image-gallery-grid.is-records .tf-image-gallery-item img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
    object-fit: cover !important;
    color: transparent !important;
    font-size: 0 !important;
    line-height: 0 !important;
    text-indent: -9999px !important;
}

body.tf-image-standalone-page .tf-image-history-modal .tf-image-gallery-grid.is-records .tf-image-gallery-meta {
    left: 10px !important;
    right: 10px !important;
    bottom: 10px !important;
    display: block !important;
    max-width: calc(100% - 20px) !important;
    min-height: 32px !important;
    max-height: 32px !important;
    padding: 6px 10px !important;
    overflow: hidden !important;
    border-radius: 999px !important;
    font-size: 14px !important;
    line-height: 20px !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* Chat scroll affordance: glass button above the fixed composer */
body.tf-image-standalone-page .tf-image-scroll-bottom[hidden] {
    display: none !important;
}

body.tf-image-standalone-page .tf-image-scroll-bottom {
    position: fixed;
    left: 50%;
    bottom: calc(var(--tf-image-composer-clearance, 150px) - 18px);
    z-index: 997;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
    padding: 0;
    margin: 0;
    border: 1px solid rgba(255, 255, 255, .82);
    border-radius: 999px;
    color: rgba(20, 20, 18, .88);
    background: rgba(255, 255, 255, .78);
    box-shadow: 0 14px 34px rgba(15, 23, 42, .14), inset 0 1px 0 rgba(255, 255, 255, .92);
    opacity: 0;
    pointer-events: none;
    transform: translate3d(-50%, 10px, 0) scale(.94);
    cursor: pointer;
    backdrop-filter: blur(24px) saturate(1.14);
    -webkit-backdrop-filter: blur(24px) saturate(1.14);
    transition: opacity .18s ease, transform .22s cubic-bezier(.22, .61, .36, 1), background-color .18s ease, box-shadow .18s ease;
}

body.tf-image-standalone-page .tf-image-scroll-bottom.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translate3d(-50%, 0, 0) scale(1);
}

body.tf-image-standalone-page .tf-image-scroll-bottom:hover,
body.tf-image-standalone-page .tf-image-scroll-bottom:focus {
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 18px 42px rgba(15, 23, 42, .18), inset 0 1px 0 rgba(255, 255, 255, .96);
}

body.tf-image-standalone-page .tf-image-scroll-bottom .fa {
    width: 20px;
    height: 20px;
    margin: 0;
    font-size: 20px;
    line-height: 20px;
}

/* Full-screen glass drop zone for reference images */
body.tf-image-standalone-page .tf-image-reference-drop-overlay[hidden] {
    display: none !important;
}

body.tf-image-standalone-page .tf-image-reference-drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 12050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 26px;
    background:
        radial-gradient(circle at 50% 44%, rgba(255, 255, 255, .54), rgba(255, 255, 255, 0) 35%),
        rgba(246, 246, 244, .46);
    opacity: 0;
    pointer-events: none;
    transform: translateZ(0);
    backdrop-filter: blur(30px) saturate(1.18);
    -webkit-backdrop-filter: blur(30px) saturate(1.18);
    transition: opacity .18s ease;
}

body.tf-image-standalone-page .tf-image-reference-drop-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

body.tf-image-standalone-page .tf-image-reference-drop-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: min(360px, calc(100vw - 56px));
    min-height: 230px;
    padding: 32px 26px 30px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .82);
    border-radius: 34px;
    color: rgba(20, 20, 18, .88);
    text-align: center;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, .78), rgba(246, 246, 244, .48)),
        rgba(255, 255, 255, .56);
    box-shadow: 0 24px 72px rgba(15, 23, 42, .18), inset 0 1px 0 rgba(255, 255, 255, .9);
    transform: translate3d(0, 14px, 0) scale(.96);
    backdrop-filter: blur(28px) saturate(1.16);
    -webkit-backdrop-filter: blur(28px) saturate(1.16);
    transition: transform .24s cubic-bezier(.22, .61, .36, 1);
}

body.tf-image-standalone-page .tf-image-reference-drop-overlay.is-visible .tf-image-reference-drop-card {
    transform: translate3d(0, 0, 0) scale(1);
}

body.tf-image-standalone-page .tf-image-reference-drop-card::before {
    content: "";
    position: absolute;
    inset: 12px;
    border-radius: 26px;
    border: 1px dashed rgba(20, 20, 18, .16);
    background: rgba(255, 255, 255, .18);
    pointer-events: none;
}

body.tf-image-standalone-page .tf-image-reference-drop-icon {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 78px;
    height: 78px;
    margin-bottom: 18px;
    border: 1px solid rgba(255, 255, 255, .86);
    border-radius: 24px;
    background: rgba(255, 255, 255, .72);
    box-shadow: 0 16px 38px rgba(15, 23, 42, .12), inset 0 1px 0 rgba(255, 255, 255, .92);
    backdrop-filter: blur(18px) saturate(1.12);
    -webkit-backdrop-filter: blur(18px) saturate(1.12);
}

body.tf-image-standalone-page .tf-image-reference-drop-icon > .fa {
    color: rgba(20, 20, 18, .82);
    font-size: 34px;
    line-height: 1;
}

body.tf-image-standalone-page .tf-image-reference-drop-icon em {
    position: absolute;
    right: -7px;
    bottom: -7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid rgba(255, 255, 255, .86);
    border-radius: 50%;
    background: rgba(5, 5, 5, .9);
    color: #fff;
    font-style: normal;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .16);
}

body.tf-image-standalone-page .tf-image-reference-drop-icon em .fa {
    font-size: 13px;
    line-height: 1;
}

body.tf-image-standalone-page .tf-image-reference-drop-card strong,
body.tf-image-standalone-page .tf-image-reference-drop-card small {
    position: relative;
    z-index: 1;
}

body.tf-image-standalone-page .tf-image-reference-drop-card strong {
    color: rgba(20, 20, 18, .9);
    font-size: 22px;
    font-weight: 850;
    line-height: 1.25;
}

body.tf-image-standalone-page .tf-image-reference-drop-card small {
    margin-top: 8px;
    color: rgba(20, 20, 18, .58);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.45;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-history-modal.in,
    body.tf-image-standalone-page .tf-image-history-modal[style*="display: block"],
    body.tf-image-standalone-page .tf-image-history-modal.show {
        align-items: center !important;
        padding: 12px !important;
    }

    body.tf-image-standalone-page .tf-image-history-modal .modal-dialog,
    body.tf-image-standalone-page .tf-image-history-modal.fade .modal-dialog {
        width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        margin: 0 auto !important;
    }

    body.tf-image-standalone-page .tf-image-usage-modal .modal-dialog,
    body.tf-image-standalone-page .tf-image-usage-modal.fade .modal-dialog {
        width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
    }

    body.tf-image-standalone-page .tf-image-history-modal .modal-content {
        max-height: calc(100dvh - 24px) !important;
    }

    body.tf-image-standalone-page .tf-image-history-modal .tf-image-history-content {
        max-height: calc(100dvh - 172px);
        padding: 14px !important;
    }

    body.tf-image-standalone-page .tf-image-history-modal .tf-image-gallery-grid.is-records {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
        min-height: 180px;
    }

    body.tf-image-standalone-page .tf-image-scroll-bottom {
        bottom: calc(var(--tf-image-composer-clearance, 96px) - 10px + env(safe-area-inset-bottom));
        width: 46px;
        height: 46px;
        min-width: 46px;
        min-height: 46px;
        background: rgba(255, 255, 255, .78);
        box-shadow: 0 12px 30px rgba(15, 23, 42, .13), inset 0 1px 0 rgba(255, 255, 255, .9);
    }

    body.tf-image-standalone-page .tf-image-scroll-bottom .fa {
        width: 18px;
        height: 18px;
        font-size: 18px;
        line-height: 18px;
    }

    body.tf-image-standalone-page .tf-image-reference-drop-overlay {
        padding: 18px;
        backdrop-filter: blur(26px) saturate(1.16);
        -webkit-backdrop-filter: blur(26px) saturate(1.16);
    }

    body.tf-image-standalone-page .tf-image-reference-drop-card {
        width: min(300px, calc(100vw - 36px));
        min-height: 204px;
        padding: 28px 22px 26px;
        border-radius: 30px;
    }

    body.tf-image-standalone-page .tf-image-reference-drop-card::before {
        inset: 10px;
        border-radius: 23px;
    }

    body.tf-image-standalone-page .tf-image-reference-drop-icon {
        width: 68px;
        height: 68px;
        border-radius: 22px;
    }

    body.tf-image-standalone-page .tf-image-reference-drop-icon > .fa {
        font-size: 30px;
    }

    body.tf-image-standalone-page .tf-image-reference-drop-card strong {
        font-size: 20px;
    }

    body.tf-image-standalone-page .tf-image-reference-drop-card small {
        font-size: 13px;
    }
}

/* Final template head controls: ChatGPT-style quiet controls */
body.tf-image-standalone-page .tf-image-template-home .tf-image-head-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but,
body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but.hollow {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: auto !important;
    min-width: 0 !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 13px !important;
    border: 1px solid rgba(13, 13, 13, .08) !important;
    border-radius: 12px !important;
    color: #2f2f2f !important;
    background: rgba(255, 255, 255, .72) !important;
    box-shadow: none !important;
    transform: translateZ(0) !important;
    backdrop-filter: blur(12px) saturate(1.05) !important;
    -webkit-backdrop-filter: blur(12px) saturate(1.05) !important;
    transition: transform .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but:hover,
body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but:focus,
body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but.hollow:hover,
body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but.hollow:focus {
    border-color: rgba(13, 13, 13, .1) !important;
    background: rgba(255, 255, 255, .92) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04) !important;
    transform: none !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but > .fa:not(.fa-angle-right) {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    color: #2f2f2f !important;
    font-size: 18px !important;
    line-height: 18px !important;
    text-shadow: none !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but span {
    display: inline-flex !important;
    align-items: center !important;
    color: #2f2f2f !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    letter-spacing: 0 !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-template-home .tf-image-head-actions {
        gap: 8px !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but,
    body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but.hollow {
        width: 44px !important;
        min-width: 44px !important;
        max-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        border-color: rgba(13, 13, 13, .08) !important;
        background: rgba(255, 255, 255, .74) !important;
        box-shadow: none !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but span {
        display: none !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but > .fa:not(.fa-angle-right) {
        width: 20px !important;
        height: 20px !important;
        font-size: 20px !important;
        line-height: 20px !important;
    }
}

/* Final mobile head alignment: title left, controls right */
@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-page .tf-image-head,
    body.tf-image-standalone-page .tf-image-template-home .tf-image-head,
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-head {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
        gap: 12px !important;
        width: 100% !important;
        min-height: 46px !important;
        margin: 0 0 14px !important;
        padding: 0 2px 8px !important;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-title,
    body.tf-image-standalone-page .tf-image-template-home .tf-image-title,
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-title {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        max-width: none !important;
        margin: 0 !important;
        overflow: hidden !important;
        white-space: nowrap !important;
        text-overflow: ellipsis !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-title span,
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-title > span:not(.tf-image-head-gpt) {
        font-size: 30px !important;
        font-weight: 800 !important;
        line-height: 1.08 !important;
        white-space: nowrap !important;
    }

    body.tf-image-standalone-page .tf-image-work-panel .tf-image-title {
        display: inline-flex !important;
        align-items: center !important;
        gap: 8px !important;
    }

    body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-gpt {
        flex: 0 0 auto !important;
        width: 28px !important;
        height: 28px !important;
        margin: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-head-actions,
    body.tf-image-standalone-page .tf-image-template-home .tf-image-head-actions,
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-actions {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        flex: 0 0 auto !important;
        flex-wrap: nowrap !important;
        width: auto !important;
        min-width: 0 !important;
        gap: 7px !important;
        margin: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-work-panel .tf-image-status {
        display: none !important;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-head-button.but,
    body.tf-image-standalone-page .tf-image-page .tf-image-head-button.but.hollow,
    body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but,
    body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but.hollow,
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-button.but,
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-button.but.hollow {
        flex: 0 0 42px !important;
        width: 42px !important;
        min-width: 42px !important;
        max-width: 42px !important;
        height: 42px !important;
        min-height: 42px !important;
        padding: 0 !important;
        border-radius: 50% !important;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-head-button.but span,
    body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but span,
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-button.but span {
        display: none !important;
    }
}

@media (max-width: 380px) {
    body.tf-image-standalone-page .tf-image-template-home .tf-image-title span,
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-title > span:not(.tf-image-head-gpt) {
        font-size: 26px !important;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-head,
    body.tf-image-standalone-page .tf-image-template-home .tf-image-head,
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-head {
        gap: 8px !important;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-head-actions,
    body.tf-image-standalone-page .tf-image-template-home .tf-image-head-actions,
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-actions {
        gap: 6px !important;
    }

    body.tf-image-standalone-page .tf-image-page .tf-image-head-button.but,
    body.tf-image-standalone-page .tf-image-page .tf-image-head-button.but.hollow,
    body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but,
    body.tf-image-standalone-page .tf-image-template-home .tf-image-head-button.but.hollow,
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-button.but,
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-button.but.hollow {
        flex-basis: 38px !important;
        width: 38px !important;
        min-width: 38px !important;
        max-width: 38px !important;
        height: 38px !important;
        min-height: 38px !important;
    }
}

/* Final template library masonry: wider desktop, five compact columns */
body.tf-image-standalone-page .tf-image-template-home {
    width: 100% !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-head,
body.tf-image-standalone-page .tf-image-template-home .tf-image-template-list-view {
    width: min(100%, 1960px) !important;
    max-width: 1960px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-head {
    margin-bottom: 28px !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-template-list-view {
    padding-bottom: 140px !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-template-grid {
    display: block !important;
    column-count: 5 !important;
    column-gap: 28px !important;
    column-fill: balance !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-template-card {
    display: inline-block !important;
    width: 100% !important;
    margin: 0 0 28px !important;
    border: 0 !important;
    border-radius: 28px !important;
    background: #f4f4f2 !important;
    box-shadow: 0 10px 26px rgba(15, 23, 42, .08) !important;
    break-inside: avoid !important;
    -webkit-column-break-inside: avoid !important;
    transform: translateZ(0) !important;
    overflow: hidden !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-template-card:hover {
    transform: translate3d(0, -3px, 0) !important;
    box-shadow: 0 18px 42px rgba(15, 23, 42, .14) !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-template-cover {
    min-height: 0 !important;
    border-radius: inherit !important;
    background: #f4f4f2 !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-template-cover img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    object-fit: contain !important;
    object-position: center !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-template-placeholder {
    min-height: 260px !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-template-mask {
    padding: 70px 22px 20px !important;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, .34) 42%, rgba(0, 0, 0, .72)) !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-template-mask h3 {
    font-size: 20px !important;
    font-weight: 800 !important;
    line-height: 1.16 !important;
    letter-spacing: 0 !important;
    text-shadow: 0 1px 8px rgba(0, 0, 0, .34) !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-template-mask p {
    max-width: 94% !important;
    margin-top: 5px !important;
    color: rgba(255, 255, 255, .86) !important;
    font-size: 13px !important;
    line-height: 1.38 !important;
    -webkit-line-clamp: 2 !important;
    text-shadow: 0 1px 5px rgba(0, 0, 0, .28) !important;
}

@media (min-width: 1900px) {
    body.tf-image-standalone-page .tf-image-template-home .tf-image-head,
    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-list-view {
        width: min(100%, 2040px) !important;
        max-width: 2040px !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-grid {
        column-gap: 34px !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-card {
        margin-bottom: 34px !important;
    }
}

@media (max-width: 1500px) {
    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-grid {
        column-count: 4 !important;
        column-gap: 24px !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-card {
        margin-bottom: 24px !important;
    }
}

@media (max-width: 1120px) {
    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-grid {
        column-count: 3 !important;
        column-gap: 18px !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-card {
        margin-bottom: 18px !important;
        border-radius: 24px !important;
    }
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-template-home .tf-image-head {
        margin-bottom: 16px !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-list-view {
        padding-bottom: 92px !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-grid {
        column-count: 2 !important;
        column-gap: 12px !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-card {
        margin-bottom: 12px !important;
        border-radius: 20px !important;
        box-shadow: 0 8px 20px rgba(15, 23, 42, .08) !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-mask {
        padding: 52px 13px 12px !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-mask h3 {
        font-size: 15px !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-mask p {
        font-size: 11px !important;
        -webkit-line-clamp: 1 !important;
    }
}

/* Final template page canvas width: do not let chat-page width limit the template wall */
body.tf-image-standalone-page .tf-image-page.tf-image-view-studio {
    width: min(100% - 48px, 1960px) !important;
    max-width: 1960px !important;
    padding-top: 34px !important;
    padding-bottom: 126px !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-studio {
    overflow: visible !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-list-view {
    padding-bottom: 126px !important;
}

@media (min-width: 1900px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio {
        width: min(100% - 96px, 2040px) !important;
        max-width: 2040px !important;
    }
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio {
        width: calc(100% - 20px) !important;
        padding-top: 12px !important;
        padding-bottom: 104px !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-list-view {
        padding-bottom: 104px !important;
    }
}

/* Final irregular template wall: fixed visual rhythm, not raw image height */
body.tf-image-standalone-page .tf-image-page.tf-image-view-studio {
    width: min(100% - 144px, 1680px) !important;
    max-width: 1760px !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-head,
body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-list-view {
    width: min(100%, 1760px) !important;
    max-width: 1760px !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-title span {
    color: #111 !important;
    font-size: 34px !important;
    font-weight: 850 !important;
    line-height: 1.1 !important;
    letter-spacing: 0 !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid {
    display: block !important;
    column-count: 5 !important;
    column-gap: 22px !important;
    column-fill: balance !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card {
    display: inline-block !important;
    width: 100% !important;
    margin: 0 0 22px !important;
    overflow: hidden !important;
    border-radius: 24px !important;
    break-inside: avoid !important;
    -webkit-column-break-inside: avoid !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-cover {
    position: relative !important;
    width: 100% !important;
    min-height: 0 !important;
    aspect-ratio: 1 / 1.08 !important;
    overflow: hidden !important;
    border-radius: inherit !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+1) .tf-image-template-cover {
    aspect-ratio: 1 / 1.22 !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+2) .tf-image-template-cover {
    aspect-ratio: 1 / .96 !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+3) .tf-image-template-cover {
    aspect-ratio: 1 / 1.34 !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+4) .tf-image-template-cover {
    aspect-ratio: 1 / 1.03 !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+5) .tf-image-template-cover {
    aspect-ratio: 1 / 1.16 !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+6) .tf-image-template-cover {
    aspect-ratio: 1 / 1.28 !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+7) .tf-image-template-cover {
    aspect-ratio: 1 / .78 !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+8) .tf-image-template-cover {
    aspect-ratio: 1 / 1.08 !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+9) .tf-image-template-cover {
    aspect-ratio: 1 / .88 !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n) .tf-image-template-cover {
    aspect-ratio: 1 / 1.24 !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-cover img {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-placeholder {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
}

@media (max-width: 1280px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid {
        column-count: 4 !important;
    }
}

@media (max-width: 980px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid {
        column-count: 3 !important;
        column-gap: 16px !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card {
        margin-bottom: 16px !important;
    }
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio {
        width: calc(100% - 20px) !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid {
        column-count: 2 !important;
        column-gap: 12px !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card {
        margin-bottom: 12px !important;
        border-radius: 18px !important;
    }
}

/* Final template hover: subtle lift */
body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:hover,
body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:focus,
body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:focus-within {
    transform: translateY(-1px) !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-cover img {
    transform: scale(1) !important;
    transition: transform .38s cubic-bezier(.22, .61, .36, 1) !important;
    will-change: transform;
    user-select: none !important;
    -webkit-user-drag: none !important;
    -webkit-touch-callout: none !important;
    touch-action: manipulation !important;
    pointer-events: none !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:hover .tf-image-template-cover img,
body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:focus .tf-image-template-cover img,
body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:focus-within .tf-image-template-cover img {
    transform: scale(1.025) !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card.tf-image-template-no-desc .tf-image-template-mask {
    padding: 84px 24px 24px !important;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, .28) 38%, rgba(0, 0, 0, .76)) !important;
}

body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card.tf-image-template-no-desc .tf-image-template-mask h3 {
    max-width: 92% !important;
    font-size: 18px !important;
    font-weight: 850 !important;
    line-height: 1.16 !important;
    letter-spacing: 0 !important;
    text-shadow: 0 2px 10px rgba(0, 0, 0, .34) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card.tf-image-template-no-desc .tf-image-template-mask {
        padding: 58px 14px 14px !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card.tf-image-template-no-desc .tf-image-template-mask h3 {
        font-size: 16px !important;
    }
}

/* Mobile template bottom: reduce the scroll tail and keep one canvas color behind composer. */
@media (max-width: 768px) {
    body.tf-image-standalone-page {
        background: var(--body-bg-color, #f5f6f7) !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio {
        min-height: auto !important;
        padding-bottom: calc(18px + env(safe-area-inset-bottom)) !important;
        background: var(--body-bg-color, #f5f6f7) !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-studio,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home {
        min-height: 0 !important;
        background: transparent !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-list-view {
        padding-bottom: 14px !important;
    }

    body.tf-image-standalone-page .tf-image-composer,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-template-insert,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded {
        bottom: calc(24px + env(safe-area-inset-bottom)) !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-mask {
        padding: 52px 13px 12px !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-mask h3 {
        max-width: 100% !important;
        font-size: 15px !important;
        line-height: 1.2 !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        word-break: break-word !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card.tf-image-template-no-desc .tf-image-template-mask {
        padding: 58px 14px 14px !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card.tf-image-template-no-desc .tf-image-template-mask h3 {
        max-width: 100% !important;
        font-size: 16px !important;
        line-height: 1.2 !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        word-break: break-word !important;
    }
}

.tf-image-debug-panel {
    width: min(100%, 760px);
    margin: 16px auto 0;
    padding: 14px;
    border: 1px solid rgba(239, 68, 68, .24);
    border-radius: 12px;
    background: rgba(255, 255, 255, .94);
    color: #111827;
    text-align: left;
    box-shadow: 0 12px 36px rgba(15, 23, 42, .1);
}

.tf-image-debug-panel > b {
    display: block;
    margin-bottom: 10px;
    color: #b91c1c;
    font-size: 14px;
}

.tf-image-debug-panel dl {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 6px 10px;
    margin: 0;
}

.tf-image-debug-panel dt,
.tf-image-debug-panel dd {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
}

.tf-image-debug-panel dt {
    color: rgba(75, 85, 99, .9);
    font-weight: 800;
}

.tf-image-debug-panel dd {
    word-break: break-all;
    white-space: pre-wrap;
}

.tf-image-debug-panel pre {
    max-height: 260px;
    margin: 12px 0 0;
    padding: 10px;
    overflow: auto;
    border-radius: 8px;
    background: #111827;
    color: #f9fafb;
    font: 11px/1.55 Menlo, Consolas, monospace;
    white-space: pre-wrap;
    word-break: break-all;
}

@media (max-width: 768px) {
    .tf-image-debug-panel {
        padding: 12px;
    }

    .tf-image-debug-panel dl {
        grid-template-columns: 78px minmax(0, 1fr);
    }
}

/* Mobile final guard: no horizontal drift, no bottom white slab. */
@media (max-width: 768px) {
    html,
    body.tf-image-standalone-page {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        overscroll-behavior-x: none !important;
        background: var(--body-bg-color, #f5f6f7) !important;
    }

    body.tf-image-standalone-page * {
        box-sizing: border-box;
    }

    body.tf-image-standalone-page .tf-image-page,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio,
    body.tf-image-standalone-page .tf-image-studio,
    body.tf-image-standalone-page .tf-image-template-home,
    body.tf-image-standalone-page .tf-image-template-home .tf-image-head,
    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-list-view,
    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-grid {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio {
        width: calc(100% - 20px) !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-bottom: calc(18px + env(safe-area-inset-bottom)) !important;
    }

    body.tf-image-standalone-page .tf-image-composer,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-template-insert,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded {
        left: 12px !important;
        right: 12px !important;
        bottom: calc(24px + env(safe-area-inset-bottom)) !important;
        width: auto !important;
        max-width: calc(100vw - 24px) !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    body.tf-image-standalone-page .tf-image-composer::before,
    body.tf-image-standalone-page .tf-image-composer::after,
    body.tf-image-standalone-page .tf-image-composer-panel::before,
    body.tf-image-standalone-page .tf-image-composer-panel::after {
        display: none !important;
        content: none !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    body.tf-image-standalone-page .tf-image-composer-panel,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-panel {
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        overflow: visible !important;
    }

    body.tf-image-standalone-page .tf-image-composer-prompt,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded .tf-image-composer-prompt,
    body.tf-image-standalone-page .tf-image-composer:not(.tf-image-composer-expanded) .tf-image-composer-prompt {
        background: rgba(255, 255, 255, .82) !important;
        box-shadow: 0 14px 34px rgba(15, 23, 42, .13), inset 0 1px 0 rgba(255, 255, 255, .92) !important;
        backdrop-filter: blur(24px) saturate(1.12) !important;
        -webkit-backdrop-filter: blur(24px) saturate(1.12) !important;
    }
}

/* Mobile chat final spacing: keep the latest result clear of the fixed composer. */
@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat {
        padding-bottom: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-output-body,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-output-box.is-chat {
        padding-bottom: calc(84px + env(safe-area-inset-bottom)) !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-chat-stream {
        padding-bottom: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-chat-message:last-child {
        margin-bottom: 8px !important;
    }
}

/* Mobile bottom final pass: one bottom clearance only. */
@media (max-width: 768px) {
    html,
    body.tf-image-standalone-page {
        overscroll-behavior: none !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio {
        padding-bottom: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-list-view {
        padding-bottom: calc(84px + env(safe-area-inset-bottom)) !important;
    }
}

/* Mobile final correction: remove template tail, keep chat result about 10px above composer. */
@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-studio,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-list-view {
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat {
        padding-bottom: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-output-body {
        padding-bottom: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-output-box.is-chat {
        padding-bottom: calc(88px + env(safe-area-inset-bottom)) !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-chat-stream {
        padding-bottom: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-chat-message:last-child {
        margin-bottom: 0 !important;
    }
}

/* Mobile view state lock: keep the template composer fixed and remove scroll bounce tail. */
@media (max-width: 768px) {
    html,
    body.tf-image-standalone-page {
        min-width: 0 !important;
        overflow-x: hidden !important;
        overscroll-behavior-x: none !important;
    }

    body.tf-image-standalone-page.tf-image-view-studio-active {
        overscroll-behavior-y: contain !important;
        background: var(--body-bg-color, #f5f6f7) !important;
    }

    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-page,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-page.tf-image-view-studio {
        width: calc(100% - 20px) !important;
        max-width: calc(100vw - 20px) !important;
        min-height: 0 !important;
        margin-right: auto !important;
        margin-left: auto !important;
        padding: 12px 0 calc(86px + env(safe-area-inset-bottom)) !important;
        overflow: visible !important;
        background: transparent !important;
    }

    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-studio,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home {
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: transparent !important;
    }

    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-list-view {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 0 !important;
        padding-bottom: 8px !important;
        overflow: visible !important;
    }

    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-grid {
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
    }

    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-composer,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-composer.tf-image-composer-template-insert,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-composer.tf-image-composer-expanded {
        position: fixed !important;
        z-index: 998 !important;
        left: 16px !important;
        right: 16px !important;
        bottom: 18px !important;
        width: auto !important;
        max-width: calc(100vw - 32px) !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        transform: translate3d(0, 0, 0) !important;
        animation: none !important;
        transition: none !important;
        will-change: auto !important;
        contain: layout style !important;
    }

    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-composer-panel,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-composer.tf-image-composer-expanded .tf-image-composer-panel {
        display: block !important;
        min-height: 60px !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        overflow: visible !important;
        transform: none !important;
        animation: none !important;
        transition: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-composer-prompt,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-composer.tf-image-composer-expanded .tf-image-composer-prompt,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-composer:not(.tf-image-composer-expanded) .tf-image-composer-prompt {
        position: relative !important;
        z-index: 1 !important;
        min-height: 60px !important;
        max-height: 142px !important;
        margin: 0 0 0 64px !important;
        padding: 7px 62px 7px 18px !important;
        border: 1px solid rgba(255, 255, 255, .72) !important;
        border-radius: 30px !important;
        background: rgba(255, 255, 255, .82) !important;
        box-shadow: 0 14px 34px rgba(15, 23, 42, .13), inset 0 1px 0 rgba(255, 255, 255, .92) !important;
        overflow: visible !important;
        transform: none !important;
        animation: none !important;
        transition: none !important;
        backdrop-filter: blur(24px) saturate(1.12) !important;
        -webkit-backdrop-filter: blur(24px) saturate(1.12) !important;
    }

    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-form textarea.form-control,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-composer.tf-image-composer-expanded .tf-image-form textarea.form-control {
        display: block !important;
        min-height: 44px !important;
        max-height: 96px !important;
        padding: 6px 0 !important;
        font-size: 18px !important;
        line-height: 1.55 !important;
        overflow-y: auto !important;
        transform: none !important;
        animation: none !important;
        transition: none !important;
    }

    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-mobile-settings-open,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-composer.tf-image-composer-expanded .tf-image-mobile-settings-open {
        left: 0 !important;
        bottom: 2px !important;
        width: 56px !important;
        height: 56px !important;
        min-width: 56px !important;
        min-height: 56px !important;
        transform: none !important;
        transition: none !important;
    }

    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-run,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-composer.tf-image-composer-expanded .tf-image-run {
        right: 8px !important;
        bottom: 6px !important;
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
        transform: none !important;
        transition: none !important;
    }

    @supports (height: 100svh) and (height: 100dvh) {
        body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-composer,
        body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-composer.tf-image-composer-template-insert,
        body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-composer.tf-image-composer-expanded {
            bottom: calc(18px + (100dvh - 100svh)) !important;
        }
    }

    body.tf-image-standalone-page.tf-image-view-chat-active .tf-image-page.tf-image-view-chat {
        padding-bottom: 0 !important;
    }

    body.tf-image-standalone-page.tf-image-view-chat-active .tf-image-page.tf-image-view-chat .tf-image-output-body {
        padding-bottom: 0 !important;
    }

    body.tf-image-standalone-page.tf-image-view-chat-active .tf-image-page.tf-image-view-chat .tf-image-output-box.is-chat {
        padding-bottom: calc(82px + env(safe-area-inset-bottom)) !important;
    }
}

/* Mobile template wall: replace CSS columns to avoid iOS second-column repaint drift. */
@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-auto-rows: 6px !important;
        grid-auto-flow: dense !important;
        gap: 12px !important;
        width: 100% !important;
        max-width: 100% !important;
        column-count: initial !important;
        column-gap: 12px !important;
        column-fill: initial !important;
        overflow: visible !important;
        transform: none !important;
        contain: layout style !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card {
        display: block !important;
        align-self: stretch !important;
        grid-row-end: span 12;
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
        border-radius: 18px !important;
        break-inside: auto !important;
        -webkit-column-break-inside: auto !important;
        transform: none !important;
        transition: none !important;
        will-change: auto !important;
        -webkit-tap-highlight-color: transparent !important;
        touch-action: manipulation !important;
        user-select: none !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+1),
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:nth-child(10n+1),
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+6),
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:nth-child(10n+6),
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n),
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:nth-child(10n) {
        grid-row-end: span 13;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+3),
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:nth-child(10n+3) {
        grid-row-end: span 14;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+2),
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:nth-child(10n+2),
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+9),
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:nth-child(10n+9) {
        grid-row-end: span 10;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+4),
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:nth-child(10n+4),
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+8),
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:nth-child(10n+8) {
        grid-row-end: span 11;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+7),
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:nth-child(10n+7) {
        grid-row-end: span 9;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-cover,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-cover {
        display: block !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        aspect-ratio: auto !important;
        overflow: hidden !important;
        border-radius: inherit !important;
        transform: none !important;
        transition: none !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-cover img,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-cover img {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        max-height: none !important;
        object-fit: cover !important;
        transform: none !important;
        transition: none !important;
        will-change: auto !important;
        pointer-events: none !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:hover,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:focus,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:focus-within,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:active,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:hover,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:focus,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:focus-within,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:active {
        transform: translateY(-1px) !important;
        box-shadow: 0 8px 20px rgba(15, 23, 42, .08) !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:hover .tf-image-template-cover img,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:focus .tf-image-template-cover img,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:focus-within .tf-image-template-cover img,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:active .tf-image-template-cover img,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:hover .tf-image-template-cover img,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:focus .tf-image-template-cover img,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:focus-within .tf-image-template-cover img,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:active .tf-image-template-cover img {
        transform: none !important;
    }

    body.tf-image-standalone-page.tf-image-template-scroll-unlocking .tf-image-template-home .tf-image-template-card,
    body.tf-image-standalone-page.tf-image-template-scroll-unlocking .tf-image-template-home .tf-image-template-card:hover,
    body.tf-image-standalone-page.tf-image-template-scroll-unlocking .tf-image-template-home .tf-image-template-card:focus,
    body.tf-image-standalone-page.tf-image-template-scroll-unlocking .tf-image-template-home .tf-image-template-card:focus-within,
    body.tf-image-standalone-page.tf-image-template-scroll-unlocking .tf-image-template-home .tf-image-template-card:active {
        transform: none !important;
        transition: none !important;
        will-change: auto !important;
    }

    body.tf-image-standalone-page.tf-image-template-scroll-unlocking .tf-image-template-home .tf-image-template-cover img,
    body.tf-image-standalone-page.tf-image-template-scroll-unlocking .tf-image-template-home .tf-image-template-card:hover .tf-image-template-cover img,
    body.tf-image-standalone-page.tf-image-template-scroll-unlocking .tf-image-template-home .tf-image-template-card:focus .tf-image-template-cover img,
    body.tf-image-standalone-page.tf-image-template-scroll-unlocking .tf-image-template-home .tf-image-template-card:focus-within .tf-image-template-cover img,
    body.tf-image-standalone-page.tf-image-template-scroll-unlocking .tf-image-template-home .tf-image-template-card:active .tf-image-template-cover img {
        transform: none !important;
        transition: none !important;
        will-change: auto !important;
    }
}

/* Final desktop template spacing and title icon */
body.tf-image-standalone-page .tf-image-template-home .tf-image-template-title {
    overflow: visible !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-title-gpt {
    margin: 0 !important;
    color: #10a37f !important;
    overflow: visible !important;
    text-overflow: clip !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-template-card[hidden] {
    display: none !important;
}

body.tf-image-standalone-page .tf-image-template-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 72px;
    margin: 2px auto 0;
    color: rgba(20, 22, 28, .62);
    font-size: 14px;
    font-weight: 700;
}

body.tf-image-standalone-page .tf-image-template-loader[hidden] {
    display: none !important;
}

body.tf-image-standalone-page .tf-image-template-loader .tf-image-gpt-mark {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    margin: 0;
    color: #10a37f;
    animation-duration: 1.8s;
}

body.tf-image-standalone-page .tf-image-template-loader .tf-image-gpt-mark::before {
    inset: -7px;
    background: radial-gradient(circle, rgba(16, 163, 127, .16), rgba(16, 163, 127, 0) 64%);
}

body.tf-image-standalone-page .tf-image-template-loader .tf-image-gpt-mark i {
    left: 8px;
    top: 3px;
    width: 8px;
    height: 18px;
    border-width: 1.2px;
    border-color: currentColor;
    transform-origin: 4px 9px;
}

@media (min-width: 769px) {
    body.tf-image-standalone-page .tf-image-composer {
        bottom: 10px !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio {
        padding-bottom: 12px !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-list-view,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-list-view {
        padding-bottom: 10px !important;
    }

    body.tf-image-standalone-page .tf-image-template-loader {
        min-height: 166px;
        padding-bottom: 96px;
        box-sizing: border-box;
        align-items: flex-start;
        padding-top: 24px;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card {
        transform: translateY(0) !important;
        transition: transform .38s cubic-bezier(.22, .61, .36, 1), box-shadow .38s cubic-bezier(.22, .61, .36, 1) !important;
        will-change: transform;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:hover,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:focus,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:focus-within,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:hover,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:focus,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:focus-within {
        transform: translateY(-1px) !important;
    }
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-title span,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-title span {
        font-size: 27px !important;
        line-height: 1.08 !important;
    }
}

@media (max-width: 380px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-title span,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-title span {
        font-size: 24px !important;
    }
}

/* Desktop template footer clearance and unified loader icon */
body.tf-image-standalone-page .tf-image-template-loader .tf-image-template-loader-gpt {
    flex: 0 0 1em;
    width: 1em;
    height: 1em;
    margin: 0 .08em 0 0 !important;
    color: #111 !important;
}

body.tf-image-standalone-page .tf-image-template-loader .tf-image-template-loader-gpt::before {
    inset: -.24em;
    background: radial-gradient(circle, rgba(17, 17, 17, .12), rgba(17, 17, 17, 0) 64%) !important;
}

body.tf-image-standalone-page .tf-image-template-loader .tf-image-template-loader-gpt i {
    top: .1em !important;
    left: .33em !important;
    width: .34em !important;
    height: .8em !important;
    border-width: .07em !important;
    border-color: currentColor !important;
    transform-origin: .17em .4em !important;
}

/* Chat title GPT icon: same size as the title text and always rotating */
body.tf-image-standalone-page .tf-image-work-panel .tf-image-title {
    gap: .28em !important;
}

body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-gpt {
    position: relative !important;
    display: inline-block !important;
    flex: 0 0 1em !important;
    width: 1em !important;
    height: 1em !important;
    margin: 0 .08em 0 0 !important;
    color: #10a37f !important;
    transform-origin: 50% 50% !important;
    animation: tfImageGptSpin 2.4s linear infinite !important;
    will-change: transform;
}

body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-gpt::before {
    content: "" !important;
    position: absolute !important;
    inset: -.24em !important;
    border-radius: 999px !important;
    background: radial-gradient(circle, rgba(16, 163, 127, .16), rgba(16, 163, 127, 0) 64%) !important;
    animation: tfImageGptHalo 1.9s ease-in-out infinite !important;
    pointer-events: none !important;
}

body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-gpt i {
    position: absolute !important;
    top: .1em !important;
    left: .33em !important;
    width: .34em !important;
    height: .8em !important;
    border: .07em solid currentColor !important;
    border-radius: 999px !important;
    opacity: .88 !important;
    transform-origin: .17em .4em !important;
    animation: tfImageGptPetal 1.6s ease-in-out infinite !important;
}

body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-gpt i:nth-child(1) {
    transform: rotate(0deg) !important;
}

body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-gpt i:nth-child(2) {
    transform: rotate(60deg) !important;
    animation-delay: .08s !important;
}

body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-gpt i:nth-child(3) {
    transform: rotate(120deg) !important;
    animation-delay: .16s !important;
}

body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-gpt i:nth-child(4) {
    transform: rotate(180deg) !important;
    animation-delay: .24s !important;
}

body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-gpt i:nth-child(5) {
    transform: rotate(240deg) !important;
    animation-delay: .32s !important;
}

body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-gpt i:nth-child(6) {
    transform: rotate(300deg) !important;
    animation-delay: .4s !important;
}

@media (prefers-reduced-motion: reduce) {
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-gpt,
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-gpt::before,
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-gpt i {
        animation: none !important;
    }
}

/* Template library: show only the template name and let long names wrap */
body.tf-image-standalone-page .tf-image-template-home .tf-image-template-mask p,
body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-mask p,
body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-mask p {
    display: none !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-template-mask,
body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-mask,
body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-mask,
body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card.tf-image-template-no-desc .tf-image-template-mask,
body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-card.tf-image-template-no-desc .tf-image-template-mask {
    padding: 72px 18px 16px !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-template-mask h3,
body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-mask h3,
body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-mask h3,
body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card.tf-image-template-no-desc .tf-image-template-mask h3,
body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-card.tf-image-template-no-desc .tf-image-template-mask h3 {
    display: block !important;
    max-width: 100% !important;
    margin: 0 !important;
    overflow: visible !important;
    color: #fff !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    line-height: 1.22 !important;
    letter-spacing: 0 !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    text-overflow: clip !important;
}

/* Template preview: smaller desktop dialog, title + prompt only */
body.tf-image-standalone-page .tf-image-template-preview-modal .modal-dialog,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-dialog,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.fade .modal-dialog {
    width: min(90vw, 440px) !important;
    max-width: 440px !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal .modal-content,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content {
    max-height: min(86vh, 660px) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-cover,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-cover {
    max-height: min(38vh, 280px) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-cover img,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-cover img {
    max-height: min(38vh, 280px) !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-body,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body {
    padding: 28px 26px 4px !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-body h2,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body h2 {
    margin: 0 auto 12px !important;
    padding: 0 54px !important;
    font-size: 22px !important;
    line-height: 1.22 !important;
    text-align: center !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-prompt,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-prompt {
    display: block !important;
    max-width: 100% !important;
    max-height: 168px !important;
    margin: 0 !important;
    overflow: auto !important;
    color: rgba(20, 20, 18, .62) !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.65 !important;
    white-space: pre-wrap !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    -webkit-line-clamp: unset !important;
    -webkit-box-orient: unset !important;
}

body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-actions,
body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
    padding: 14px 26px 24px !important;
}

@media (min-width: 769px) {
    body.tf-image-standalone-page .tf-image-template-preview-modal .modal-dialog,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-dialog,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.fade .modal-dialog {
        width: min(88vw, 450px) !important;
        max-width: 450px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .modal-content,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-content {
        max-height: min(86vh, 670px) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-cover,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-cover,
    body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-cover img,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-cover img {
        max-height: min(39vh, 286px) !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-body,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body {
        padding: 28px 28px 5px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-body h2,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body h2 {
        margin-bottom: 12px !important;
        font-size: 22px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-prompt,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-prompt {
        max-height: 170px !important;
        font-size: 14px !important;
        line-height: 1.64 !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-actions,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
        padding: 14px 28px 26px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-apply,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-apply {
        min-height: 58px !important;
        font-size: 17px !important;
    }
}

@media (min-width: 769px) {
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-page,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio {
        padding-bottom: 25px !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-list-view,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-list-view,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-list-view {
        padding-bottom: 25px !important;
    }

    body.tf-image-standalone-page .tf-image-template-loader {
        min-height: 78px !important;
        padding-top: 18px !important;
        padding-bottom: 22px !important;
        color: rgba(17, 17, 17, .7) !important;
    }

    body.tf-image-standalone-page .tf-image-work-panel .tf-image-title > span:not(.tf-image-head-gpt) {
        font-size: 30px !important;
        line-height: 1.08 !important;
    }

    body.tf-image-standalone-page .tf-image-work-panel .tf-image-title {
        font-size: 30px !important;
        line-height: 1.08 !important;
    }

    body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-gpt {
        width: 1em !important;
        height: 1em !important;
        flex-basis: 1em !important;
    }
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card {
        transform: translateY(0) !important;
        transition: transform .24s cubic-bezier(.22, .61, .36, 1), box-shadow .24s cubic-bezier(.22, .61, .36, 1) !important;
        will-change: transform;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:active,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:active {
        transform: translateY(-1px) !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-mask,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-mask,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-mask,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card.tf-image-template-no-desc .tf-image-template-mask,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-card.tf-image-template-no-desc .tf-image-template-mask {
        padding: 48px 12px 12px !important;
    }

    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-mask h3,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-mask h3,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-mask h3,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card.tf-image-template-no-desc .tf-image-template-mask h3,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-card.tf-image-template-no-desc .tf-image-template-mask h3 {
        font-size: 14px !important;
        line-height: 1.2 !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .modal-dialog,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .modal-dialog,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal.fade .modal-dialog {
        width: calc(100vw - 28px) !important;
        max-width: 420px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-body,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body {
        padding: 30px 22px 4px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-body h2,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-body h2 {
        margin-right: auto !important;
        margin-bottom: 10px !important;
        padding: 0 44px !important;
        font-size: 22px !important;
        text-align: center !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-prompt,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-prompt {
        max-height: 168px !important;
        font-size: 14px !important;
    }

    body.tf-image-standalone-page .tf-image-template-preview-modal .tf-image-template-preview-actions,
    body.tf-image-standalone-page .tf-image-template-preview-modal.tf-image-chatgpt-modal .tf-image-template-preview-actions {
        padding: 14px 22px 24px !important;
    }
}

@media (max-width: 380px) {
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-title {
        font-size: 26px !important;
        line-height: 1.08 !important;
    }
}

/* Final layout pass: keep the template wall away from screen edges and preserve mobile scrolling. */
@media (min-width: 769px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-page.tf-image-view-studio {
        width: min(calc(100% - 112px), 1520px) !important;
        max-width: 1520px !important;
        margin-right: auto !important;
        margin-left: auto !important;
        padding-top: 30px !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-head,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-list-view,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-head,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-list-view {
        width: 100% !important;
        max-width: 1520px !important;
        margin-right: auto !important;
        margin-left: auto !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-grid {
        column-gap: 20px !important;
    }
}

@media (min-width: 1800px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-page.tf-image-view-studio {
        width: min(calc(100% - 160px), 1600px) !important;
        max-width: 1600px !important;
    }
}

@media (max-width: 768px) {
    html,
    body.tf-image-standalone-page,
    body.tf-image-standalone-page.tf-image-view-studio-active {
        overflow-y: auto !important;
        overscroll-behavior-y: auto !important;
        touch-action: pan-y !important;
        -webkit-overflow-scrolling: touch;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-page.tf-image-view-studio {
        width: calc(100% - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        margin-right: auto !important;
        margin-left: auto !important;
        padding: 12px 0 calc(96px + env(safe-area-inset-bottom)) !important;
        overflow: visible !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-studio,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-studio,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-list-view,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-list-view {
        overflow: visible !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-list-view,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-list-view {
        padding-bottom: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-grid {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        column-count: 2 !important;
        column-gap: 12px !important;
        column-fill: balance !important;
        overflow: visible !important;
        contain: none !important;
        touch-action: pan-y !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card {
        display: inline-block !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 0 12px !important;
        break-inside: avoid !important;
        -webkit-column-break-inside: avoid !important;
        touch-action: pan-y !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(n),
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:nth-child(n) {
        grid-row-end: auto !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-cover,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-cover {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }
}

/* Mobile fix: keep the chat result title GPT icon aligned and readable. */
@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-work-panel .tf-image-title {
        align-items: center !important;
        gap: 10px !important;
    }

    body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-gpt {
        flex: 0 0 24px !important;
        width: 24px !important;
        height: 24px !important;
        margin: 0 2px 0 0 !important;
        vertical-align: middle !important;
    }

    body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-gpt::before {
        inset: -5px !important;
    }

    body.tf-image-standalone-page .tf-image-work-panel .tf-image-head-gpt i {
        top: 4px !important;
        left: 8px !important;
        width: 8px !important;
        height: 16px !important;
        border-width: 1.4px !important;
        transform-origin: 4px 8px !important;
    }
}

/* Mobile fix: keep failed text comfortably above the fixed composer. */
@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-chat-message:last-child .tf-image-generation-stopped {
        margin-bottom: 15px !important;
    }
}

/* Mobile fix: remove the rectangular white slab under the fixed composer. */
@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-page,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio,
    body.tf-image-standalone-page .tf-image-studio,
    body.tf-image-standalone-page .tf-image-work-panel,
    body.tf-image-standalone-page .tf-image-output-body,
    body.tf-image-standalone-page .tf-image-output-box,
    body.tf-image-standalone-page .tf-image-output-box.is-chat {
        background: transparent !important;
        box-shadow: none !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-output-box.is-chat {
        padding-bottom: calc(96px + env(safe-area-inset-bottom)) !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-page.tf-image-view-studio {
        padding-bottom: calc(78px + env(safe-area-inset-bottom)) !important;
    }
}

/* Mobile fix: keep a small gap between the latest image result and composer. */
@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-output-box.is-chat {
        padding-bottom: calc(104px + env(safe-area-inset-bottom)) !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-chat-message:last-child {
        margin-bottom: 15px !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-chat-message:last-child .tf-image-chat-result-wrap {
        margin-bottom: 0 !important;
    }
}

.tf-image-gallery-item.is-broken-record {
    display: none !important;
}

/* Mobile final result layout: smaller image, full rounded corners, no bottom slab. */
@media (max-width: 768px) {
    body.tf-image-standalone-page,
    body.tf-image-standalone-page .tf-image-page,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat,
    body.tf-image-standalone-page .tf-image-studio,
    body.tf-image-standalone-page .tf-image-work-panel,
    body.tf-image-standalone-page .tf-image-output,
    body.tf-image-standalone-page .tf-image-output-body,
    body.tf-image-standalone-page .tf-image-output-box,
    body.tf-image-standalone-page .tf-image-output-box.is-chat {
        overflow-x: hidden !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat {
        width: min(100% - 28px, 430px) !important;
        max-width: 430px !important;
        padding-right: 0 !important;
        padding-left: 0 !important;
        padding-bottom: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-output-box.is-chat {
        width: 100% !important;
        padding: 18px 14px calc(120px + env(safe-area-inset-bottom)) !important;
        overflow: visible !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-chat-stream {
        width: 100% !important;
        align-items: stretch !important;
        padding-bottom: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-chat-message {
        max-width: 100% !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-chat-ai {
        justify-content: flex-start !important;
        padding-right: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-chat-result-wrap {
        width: min(100%, 335px) !important;
        max-width: min(100%, 335px) !important;
        overflow: visible !important;
        justify-items: start !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-chat-result {
        width: min(100%, 335px) !important;
        max-width: min(100%, 335px) !important;
        overflow: hidden !important;
        border-radius: 18px !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-chat-result img {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: min(52vh, 430px) !important;
        border-radius: 18px !important;
        object-fit: contain !important;
        box-shadow: none !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-chat-result-meta {
        width: min(100%, 335px) !important;
        max-width: min(100%, 335px) !important;
        gap: 8px !important;
        padding-right: 0 !important;
        overflow: visible !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-chat-expire {
        max-width: 54% !important;
        overflow: visible !important;
        text-align: right !important;
        font-size: 12px !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-chat-message:last-child {
        margin-bottom: 35px !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-result-edit,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-result-download {
        bottom: 10px !important;
    }

    body.tf-image-standalone-page .tf-image-composer,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-template-insert,
    body.tf-image-standalone-page .tf-image-composer.tf-image-composer-expanded {
        background: transparent !important;
        box-shadow: none !important;
    }

    body.tf-image-standalone-page .footer-tabbar,
    body.tf-image-standalone-page .footer-tabbar-placeholder,
    body.tf-image-standalone-page .float-right {
        display: none !important;
        height: 0 !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
    }
}

/* Desktop template wall final tuning: wide, centered, with comfortable side gutters. */
@media (min-width: 769px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-page.tf-image-view-studio {
        width: min(calc(100vw - 320px), 1520px) !important;
        max-width: 1520px !important;
        margin-right: auto !important;
        margin-left: auto !important;
        padding-top: 30px !important;
        padding-bottom: 132px !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-head,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-list-view,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-head,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-list-view {
        width: 100% !important;
        max-width: 1520px !important;
        margin-right: auto !important;
        margin-left: auto !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-grid {
        column-count: 5 !important;
        column-gap: 18px !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card {
        margin-bottom: 18px !important;
        border-radius: 30px !important;
    }

    body.tf-image-standalone-page .tf-image-composer,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-composer {
        left: max(160px, calc((100vw - 1180px) / 2)) !important;
        right: max(160px, calc((100vw - 1180px) / 2)) !important;
        bottom: 22px !important;
    }
}

@media (min-width: 769px) and (max-width: 1500px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-page.tf-image-view-studio {
        width: min(calc(100vw - 160px), 1200px) !important;
        max-width: 1200px !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-grid {
        column-count: 5 !important;
        column-gap: 16px !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card {
        margin-bottom: 16px !important;
    }

    body.tf-image-standalone-page .tf-image-composer,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-composer {
        left: max(80px, calc((100vw - 960px) / 2)) !important;
        right: max(80px, calc((100vw - 960px) / 2)) !important;
    }
}

/* Mobile template wall final fix: stable two-column waterfall, no disappearing first card. */
@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-auto-rows: 6px !important;
        grid-auto-flow: row !important;
        gap: 18px 18px !important;
        width: 100% !important;
        max-width: 100% !important;
        column-count: unset !important;
        column-gap: unset !important;
        column-fill: unset !important;
        overflow: visible !important;
        contain: none !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        opacity: 1 !important;
        visibility: visible !important;
        overflow: hidden !important;
        break-inside: auto !important;
        -webkit-column-break-inside: auto !important;
        transform: none !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(n),
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:nth-child(n) {
        grid-row-end: span 12 !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+1),
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:nth-child(10n+1),
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+6),
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:nth-child(10n+6),
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n),
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:nth-child(10n) {
        grid-row-end: span 13 !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+3),
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:nth-child(10n+3) {
        grid-row-end: span 14 !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+2),
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:nth-child(10n+2),
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+9),
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:nth-child(10n+9) {
        grid-row-end: span 10 !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+4),
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:nth-child(10n+4),
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+8),
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:nth-child(10n+8) {
        grid-row-end: span 11 !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card:nth-child(10n+7),
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card:nth-child(10n+7) {
        grid-row-end: span 9 !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-cover,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-cover {
        position: relative !important;
        display: block !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-cover img,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-cover img {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        max-height: none !important;
        object-fit: cover !important;
    }
}

/* Mobile template wall spacing final override. */
@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 18px !important;
        column-gap: 18px !important;
        row-gap: 18px !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }
}

/* Template lazy-load guard: hidden cards must stay hidden until JS reveals the next batch. */
body.tf-image-standalone-page .tf-image-template-home .tf-image-template-card[hidden],
body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-card[hidden],
body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-card[hidden] {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-enabled .tf-image-template-card.tf-image-template-entering,
body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-enabled .tf-image-template-card.tf-image-template-entering,
body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-enabled .tf-image-template-card.tf-image-template-entering {
    opacity: 0 !important;
    visibility: visible !important;
    transition: opacity .72s cubic-bezier(.16, 1, .3, 1), transform .72s cubic-bezier(.16, 1, .3, 1), filter .72s cubic-bezier(.16, 1, .3, 1), box-shadow .38s cubic-bezier(.22, .61, .36, 1) !important;
    transition-delay: var(--tf-image-template-enter-delay, 0ms), var(--tf-image-template-enter-delay, 0ms), var(--tf-image-template-enter-delay, 0ms), 0ms !important;
    will-change: opacity, transform, filter !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-rise .tf-image-template-card.tf-image-template-entering,
body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-rise .tf-image-template-card.tf-image-template-entering,
body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-rise .tf-image-template-card.tf-image-template-entering {
    transform: translate3d(0, 26px, 0) scale(.985) !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-waterfall .tf-image-template-card.tf-image-template-entering,
body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-waterfall .tf-image-template-card.tf-image-template-entering,
body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-waterfall .tf-image-template-card.tf-image-template-entering {
    transform: translate3d(0, 44px, 0) scale(.975) !important;
}

body.tf-image-standalone-page .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-enabled .tf-image-template-card.tf-image-template-entering.tf-image-template-enter-active,
body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-enabled .tf-image-template-card.tf-image-template-entering.tf-image-template-enter-active,
body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-enabled .tf-image-template-card.tf-image-template-entering.tf-image-template-enter-active {
    opacity: 1 !important;
    visibility: visible !important;
    filter: blur(0) !important;
    transform: translate3d(0, 0, 0) scale(1) !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-enabled .tf-image-template-card.tf-image-template-entering,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-enabled .tf-image-template-card.tf-image-template-entering {
        opacity: 0 !important;
        visibility: visible !important;
        transition: opacity .68s cubic-bezier(.16, 1, .3, 1), transform .68s cubic-bezier(.16, 1, .3, 1), filter .68s cubic-bezier(.16, 1, .3, 1), box-shadow .32s cubic-bezier(.22, .61, .36, 1) !important;
        transition-delay: var(--tf-image-template-enter-delay, 0ms), var(--tf-image-template-enter-delay, 0ms), var(--tf-image-template-enter-delay, 0ms), 0ms !important;
        will-change: opacity, transform, filter !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-rise .tf-image-template-card.tf-image-template-entering,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-rise .tf-image-template-card.tf-image-template-entering {
        transform: translate3d(0, 22px, 0) scale(.985) !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-waterfall .tf-image-template-card.tf-image-template-entering,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-waterfall .tf-image-template-card.tf-image-template-entering {
        transform: translate3d(0, 34px, 0) scale(.975) !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-enabled .tf-image-template-card.tf-image-template-entering.tf-image-template-enter-active,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-enabled .tf-image-template-card.tf-image-template-entering.tf-image-template-enter-active {
        opacity: 1 !important;
        filter: blur(0) !important;
        transform: translate3d(0, 0, 0) scale(1) !important;
    }

    body.tf-image-standalone-page.tf-image-template-entrance-mobile-disabled .tf-image-template-home .tf-image-template-grid .tf-image-template-card,
    body.tf-image-standalone-page.tf-image-template-entrance-mobile-disabled .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-enabled .tf-image-template-card.tf-image-template-entering,
    body.tf-image-standalone-page.tf-image-template-entrance-mobile-disabled .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-enabled .tf-image-template-card.tf-image-template-entering.tf-image-template-enter-active {
        opacity: 1 !important;
        visibility: visible !important;
        filter: none !important;
        transform: none !important;
        translate: none !important;
        scale: 1 !important;
        transition: none !important;
        animation: none !important;
        will-change: auto !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-enabled .tf-image-template-card.tf-image-template-entering,
    body.tf-image-standalone-page .tf-image-template-home .tf-image-template-grid.tf-image-template-entrance-enabled .tf-image-template-card.tf-image-template-entering.tf-image-template-enter-active {
        opacity: 1 !important;
        filter: none !important;
        transform: none !important;
        transition: none !important;
    }
}

/* Final mobile chat image alignment: generated images stay left like desktop. */
@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-chat-ai,
    body.tf-image-standalone-page.tf-image-view-chat-active .tf-image-page.tf-image-view-chat .tf-image-chat-ai {
        display: flex !important;
        justify-content: flex-start !important;
        align-items: flex-start !important;
        width: 100% !important;
        padding-right: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-chat-result-wrap,
    body.tf-image-standalone-page.tf-image-view-chat-active .tf-image-page.tf-image-view-chat .tf-image-chat-result-wrap {
        width: fit-content !important;
        max-width: calc(100vw - 44px) !important;
        margin-left: 0 !important;
        margin-right: auto !important;
        justify-items: start !important;
        align-items: start !important;
        overflow: visible !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-chat-result,
    body.tf-image-standalone-page.tf-image-view-chat-active .tf-image-page.tf-image-view-chat .tf-image-chat-result {
        display: inline-block !important;
        width: auto !important;
        max-width: calc(100vw - 44px) !important;
        margin-left: 0 !important;
        margin-right: auto !important;
        overflow: visible !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-chat-result img.tf-image-result-img,
    body.tf-image-standalone-page.tf-image-view-chat-active .tf-image-page.tf-image-view-chat .tf-image-chat-result img.tf-image-result-img,
    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-result-img,
    body.tf-image-standalone-page.tf-image-view-chat-active .tf-image-page.tf-image-view-chat .tf-image-result-img {
        display: block !important;
        width: auto !important;
        max-width: min(78vw, 335px) !important;
        height: auto !important;
        max-height: min(58vh, 500px) !important;
        object-fit: contain !important;
        border-radius: 20px !important;
        overflow: hidden !important;
        background: transparent !important;
        box-shadow: var(--tf-chat-panel-shadow, 0 12px 34px rgba(15, 23, 42, .14)) !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-chat .tf-image-chat-result-meta,
    body.tf-image-standalone-page.tf-image-view-chat-active .tf-image-page.tf-image-view-chat .tf-image-chat-result-meta {
        width: 100% !important;
        max-width: min(78vw, 335px) !important;
        margin-left: 0 !important;
        margin-right: auto !important;
        justify-self: start !important;
    }
}

/* Hard override: mobile generated result image must not be centered/full-width. */
@media (max-width: 768px) {
    body.tf-image-standalone-page.tf-image-view-chat-active .tf-image-chat-message.tf-image-chat-ai .tf-image-chat-result-wrap,
    body.tf-image-standalone-page.tf-image-view-chat-active .tf-image-chat-message.tf-image-chat-ai .tf-image-chat-result,
    body.tf-image-standalone-page.tf-image-view-chat-active .tf-image-chat-message.tf-image-chat-ai .tf-image-result-img {
        margin-left: 0 !important;
        margin-right: auto !important;
    }

    body.tf-image-standalone-page.tf-image-view-chat-active .tf-image-chat-message.tf-image-chat-ai .tf-image-result-img {
        width: auto !important;
        max-width: min(78vw, 335px) !important;
        border-radius: 20px !important;
    }
}

/* Desktop template wall final fix: stop CSS columns from rebalancing on scroll/lazy load. */
@media (min-width: 769px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-grid {
        --tf-image-template-gap: 18px;
        --tf-image-template-columns: 5;
        position: relative !important;
        min-height: 1px !important;
        overflow: visible !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid:not(.tf-image-template-masonry-ready),
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-grid:not(.tf-image-template-masonry-ready) {
        opacity: 0 !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid.tf-image-template-masonry-ready,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-grid.tf-image-template-masonry-ready {
        display: block !important;
        column-count: initial !important;
        column-gap: initial !important;
        column-fill: auto !important;
    }

    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid.tf-image-template-masonry-ready .tf-image-template-card,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-grid.tf-image-template-masonry-ready .tf-image-template-card {
        position: absolute !important;
        width: var(--tf-image-template-card-width) !important;
        margin: 0 !important;
        break-inside: auto !important;
        -webkit-column-break-inside: auto !important;
    }

}

@media (min-width: 769px) and (max-width: 1500px) {
    body.tf-image-standalone-page .tf-image-page.tf-image-view-studio .tf-image-template-home .tf-image-template-grid,
    body.tf-image-standalone-page.tf-image-view-studio-active .tf-image-template-home .tf-image-template-grid {
        --tf-image-template-gap: 16px;
        --tf-image-template-columns: 5;
    }
}

/* Template lazy loader: icon-only, larger, and visually lower in the template wall. */
body.tf-image-standalone-page .tf-image-template-loader {
    min-height: 118px !important;
    margin: 0 auto !important;
    padding: 34px 0 48px !important;
    gap: 0 !important;
    color: #111 !important;
}

body.tf-image-standalone-page .tf-image-template-loader .tf-image-template-loader-gpt {
    flex: 0 0 38px !important;
    width: 38px !important;
    height: 38px !important;
    margin: 0 !important;
    color: #111 !important;
}

body.tf-image-standalone-page .tf-image-template-loader .tf-image-template-loader-gpt::before {
    inset: -9px !important;
    background: radial-gradient(circle, rgba(17, 17, 17, .12), rgba(17, 17, 17, 0) 66%) !important;
}

body.tf-image-standalone-page .tf-image-template-loader .tf-image-template-loader-gpt i {
    top: 4px !important;
    left: 13px !important;
    width: 13px !important;
    height: 30px !important;
    border-width: 1.6px !important;
    transform-origin: 6.5px 15px !important;
}

body.tf-image-standalone-page .tf-image-template-loader .sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 768px) {
    body.tf-image-standalone-page .tf-image-template-loader {
        display: flex !important;
        min-height: 102px !important;
        padding: 28px 0 40px !important;
    }

    body.tf-image-standalone-page .tf-image-template-loader[hidden] {
        display: none !important;
    }

    body.tf-image-standalone-page .tf-image-template-loader .tf-image-template-loader-gpt {
        flex: 0 0 34px !important;
        width: 34px !important;
        height: 34px !important;
    }

    body.tf-image-standalone-page .tf-image-template-loader .tf-image-template-loader-gpt i {
        top: 3px !important;
        left: 11.5px !important;
        width: 11.5px !important;
        height: 27px !important;
        border-width: 1.45px !important;
        transform-origin: 5.75px 13.5px !important;
    }
}

/* Keep the bottom composer from nudging when the aspect/model modals close. */
html {
    scrollbar-gutter: stable;
}

body.tf-image-standalone-page.tf-image-stable-modal-scrollbar {
    padding-right: var(--tf-image-scrollbar-width, 0px) !important;
}

body.tf-image-standalone-page.tf-image-stable-modal-scrollbar .tf-image-composer {
    margin-right: calc(var(--tf-image-scrollbar-width, 0px) * -1) !important;
}
