:root {
    --mode-switcher-offset: 16px;
    --input-area-fixed-height: 0px;
}

/* Image session switcher -------------------------------------------------- */
.image-session-history-status,
.image-session-switcher-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    color: #aebaca;
    font-size: 14px;
    line-height: 1.5;
}

.image-session-history-spinner {
    display: inline-block;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    box-sizing: border-box;
    border: 2px solid rgba(137, 151, 174, 0.25);
    border-top-color: #7eaeef;
    border-radius: 50%;
    vertical-align: middle;
    animation: image-session-history-spin 0.8s linear infinite;
}

@keyframes image-session-history-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .image-session-history-spinner { animation: none; }
}

.image-session-history-status button,
.image-session-switcher-error button {
    flex-shrink: 0;
    padding: 5px 12px;
    border: 1px solid #5b91d7;
    border-radius: 8px;
    background: #142238;
    color: #d8e9ff;
    cursor: pointer;
}

.image-session-switcher {
    position: fixed;
    left: calc(var(--sidebar-width, 80px) + 22px);
    top: 22px;
    bottom: auto;
    z-index: 1180;
    width: min(270px, calc(100vw - 124px));
    font-family: inherit;
}

.image-session-switcher[hidden],
.image-session-switcher-panel[hidden] {
    display: none !important;
}

.image-session-switcher-trigger {
    width: 100%;
    min-height: 58px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 13px;
    color: #e9eef7;
    background: rgba(19, 21, 27, 0.96);
    border: 1px solid rgba(137, 151, 174, 0.32);
    border-radius: 15px;
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.38);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.image-session-switcher-trigger:hover,
.image-session-switcher.is-open .image-session-switcher-trigger {
    background: rgba(26, 29, 37, 0.98);
    border-color: rgba(88, 153, 255, 0.7);
}

.image-session-switcher-trigger:focus-visible,
.image-session-switcher button:focus-visible {
    outline: 2px solid #4c96ff;
    outline-offset: 2px;
}

.image-session-switcher-trigger-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #8eb9ff;
    background: rgba(48, 126, 255, 0.14);
    border-radius: 10px;
}

.image-session-switcher-trigger-copy {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 2px;
}

.image-session-switcher-trigger-title {
    overflow: hidden;
    color: #f5f7fb;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-session-switcher-trigger-meta {
    overflow: hidden;
    color: #8993a5;
    font-size: 11px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-session-switcher-chevron {
    color: #8993a5;
    font-size: 11px;
    transition: transform 0.18s ease;
}

.image-session-switcher.is-open .image-session-switcher-chevron {
    transform: rotate(180deg);
}

.image-session-switcher-panel {
    position: absolute;
    left: 0;
    top: calc(100% + 10px);
    bottom: auto;
    width: min(340px, calc(100vw - 124px));
    overflow: hidden;
    color: #edf2fb;
    background: rgba(14, 16, 22, 0.985);
    border: 1px solid rgba(137, 151, 174, 0.28);
    border-radius: 17px;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.5);
}

.image-session-switcher-heading {
    padding: 16px 16px 9px;
    color: #8f99aa;
    font-size: 12px;
    font-weight: 600;
}

.image-session-switcher-list {
    display: flex;
    max-height: min(440px, calc(100vh - 190px));
    overflow-y: auto;
    padding: 0 8px 8px;
    flex-direction: column;
    gap: 3px;
    overscroll-behavior: contain;
}

.image-session-switcher-item {
    width: 100%;
    min-height: 66px;
    display: flex;
    align-items: center;
    padding: 4px;
    color: inherit;
    background: transparent;
    border-radius: 12px;
}

.image-session-switcher-select {
    min-width: 0;
    min-height: 58px;
    display: grid;
    flex: 1;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 4px;
    color: inherit;
    background: transparent;
    border: 0;
    cursor: pointer;
    text-align: left;
}

.image-session-switcher-select:disabled {
    cursor: default;
}

.image-session-switcher-item:hover,
.image-session-switcher-item.is-current {
    background: rgba(97, 112, 139, 0.16);
}

.image-session-switcher-item.is-current {
    box-shadow: inset 2px 0 0 #4c96ff;
}

.image-session-switcher-thumb {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #7f8b9e;
    background: linear-gradient(135deg, #20242d, #171920);
    border: 1px solid rgba(137, 151, 174, 0.2);
    border-radius: 10px;
}

.image-session-switcher-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.image-session-switcher-item-copy {
    min-width: 0;
}

.image-session-switcher-item-title,
.image-session-switcher-item-meta {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-session-switcher-item-title {
    color: #edf2fb;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
}

.image-session-switcher-title-input {
    width: 100%;
    min-width: 0;
    height: 30px;
    padding: 4px 7px;
    color: #f4f7fc;
    background: rgba(8, 11, 17, 0.9);
    border: 1px solid #4c96ff;
    border-radius: 7px;
    box-shadow: 0 0 0 3px rgba(76, 150, 255, 0.14);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    outline: 0;
}

.image-session-switcher-item.is-editing .image-session-switcher-item-meta,
.image-session-switcher-item.is-editing .image-session-switcher-current,
.image-session-switcher-item.is-editing .image-session-switcher-rename {
    display: none;
}

.image-session-switcher-item-meta {
    margin-top: 3px;
    color: #858fa1;
    font-size: 11px;
}

.image-session-switcher-current {
    color: #64a4ff;
    font-size: 11px;
    font-weight: 600;
}

.image-session-switcher-rename {
    width: 30px;
    height: 30px;
    display: inline-flex;
    flex: 0 0 30px;
    align-items: center;
    justify-content: center;
    color: #7f8b9e;
    background: transparent;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    opacity: 0;
    transition: color 0.16s ease, background 0.16s ease, opacity 0.16s ease;
}

.image-session-switcher-item:hover .image-session-switcher-rename,
.image-session-switcher-rename:focus-visible {
    opacity: 1;
}

.image-session-switcher-rename:hover {
    color: #a9caff;
    background: rgba(76, 150, 255, 0.14);
}

.image-session-switcher-running {
    width: 7px;
    height: 7px;
    display: inline-block;
    margin-right: 5px;
    background: #4c96ff;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(76, 150, 255, 0.12);
}

.image-session-switcher-empty,
.image-session-switcher-loading {
    padding: 22px 14px;
    color: #8791a2;
    font-size: 12px;
    text-align: center;
}

.image-session-switcher-footer {
    padding: 10px;
    border-top: 1px solid rgba(137, 151, 174, 0.18);
}

.image-session-switcher-new {
    width: 100%;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #8eb9ff;
    background: rgba(48, 126, 255, 0.1);
    border: 1px solid rgba(76, 150, 255, 0.28);
    border-radius: 11px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.image-session-switcher-new:hover {
    background: rgba(48, 126, 255, 0.18);
}

.image-session-switcher.is-busy {
    pointer-events: none;
    opacity: 0.68;
}

@media (max-width: 768px) {
    .image-session-switcher {
        left: 76px;
        top: 14px;
        bottom: auto;
        width: min(218px, calc(100vw - 92px));
    }

    .image-session-switcher-trigger {
        min-height: 46px;
        padding: 6px 10px;
        border-radius: 13px;
    }

    .image-session-switcher-trigger-icon {
        width: 32px;
        height: 32px;
        flex-basis: 32px;
    }

    .image-session-switcher-rename {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
        opacity: 1;
    }

    .image-session-switcher-panel {
        position: fixed;
        left: 12px;
        right: 12px;
        top: 70px;
        bottom: auto;
        width: auto;
        max-height: calc(100dvh - 86px);
    }

    .image-session-switcher-list {
        max-height: calc(100dvh - 190px);
    }
}

@media (max-width: 768px) {
    :root {
        --mode-switcher-offset: 14px;
    }
}

/* Nano Banana Pro short-term unlimited pass */
body.image-unlimited-pass-modal-open {
    overflow: hidden;
}

.image-unlimited-pass-overlay.seedance25-pass-overlay { --pass-accent: var(--primary-color, #1890ff); background: rgba(5, 10, 18, 0.76); padding: 16px; align-items: center; }
.seedance25-pass-overlay .image-unlimited-pass-dialog { width: min(480px, 100%); max-height: calc(100dvh - 32px); padding: 22px; border-radius: 20px; background: #14191f; box-sizing: border-box; }
.seedance25-pass-overlay .image-unlimited-pass-dialog * { box-sizing: border-box; }
.seedance25-pass-overlay .image-unlimited-pass-close { width: 30px; height: 30px; top: 12px; right: 12px; font-size: 24px; line-height: 26px; }
.seedance25-pass-overlay .image-unlimited-pass-hero { padding: 4px 26px 16px; }
.seedance25-pass-overlay .image-unlimited-pass-kicker { color: var(--pass-accent); font-size: 12px; font-style: normal; letter-spacing: 2px; margin-bottom: 8px; }
.seedance25-pass-overlay .image-unlimited-pass-hero h2 { font-size: 28px; line-height: 1.2; letter-spacing: -1px; }
.seedance25-pass-overlay .image-unlimited-pass-hero h2 em { display: inline; margin: 0; color: var(--pass-accent); font: inherit; }
.seedance25-pass-overlay .image-unlimited-pass-hero p { margin-top: 8px; font-size: 12px; }
.seedance25-pass-overlay .image-unlimited-pass-resolution { padding: 4px; border-radius: 12px; background: #1c2633; }
.seedance25-pass-overlay .image-unlimited-pass-resolution button { min-height: 48px; padding: 6px; border-radius: 9px; }
.seedance25-pass-overlay .image-unlimited-pass-resolution button strong { font-size: 20px; font-style: normal; }
.seedance25-pass-overlay .image-unlimited-pass-resolution button span { font-size: 11px; }
.seedance25-pass-overlay .image-unlimited-pass-resolution button.is-selected { background: rgba(24, 144, 255, 0.12); color: #80c4ff; box-shadow: none; }
.seedance25-pass-overlay .image-unlimited-pass-concurrency { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 10px auto 16px; padding: 0; background: transparent; font-size: 12px; }
.seedance25-pass-overlay .image-unlimited-pass-concurrency span { background: #202a36; padding: 5px 9px; border-radius: 6px; }
.seedance25-pass-overlay .image-unlimited-pass-options { gap: 10px; }
.seedance25-pass-overlay .image-unlimited-pass-option { min-height: 80px; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 10px; padding: 12px; border-radius: 12px; background: #1d242d; border-color: #303a46; }
.seedance25-pass-overlay .image-unlimited-pass-option.is-selected { background: rgba(24, 144, 255, 0.12); border-color: var(--pass-accent); }
.seedance25-pass-overlay .image-unlimited-pass-option:hover { border-color: var(--pass-accent); }
.seedance25-pass-overlay .image-unlimited-pass-option:focus-visible,
.seedance25-pass-overlay .image-unlimited-pass-checkout:focus-visible { outline: 2px solid #80c4ff; outline-offset: 3px; }
.seedance25-pass-overlay .image-unlimited-pass-radio { width: 20px; height: 20px; }
.seedance25-pass-overlay .image-unlimited-pass-option.is-selected .image-unlimited-pass-radio { position: relative; border: 0; background: var(--pass-accent); }
.seedance25-pass-overlay .image-unlimited-pass-option.is-selected .image-unlimited-pass-radio::after { content: '✓'; position: absolute; inset: 0; display: grid; place-items: center; color: white; font-size: 15px; font-weight: 800; }
.seedance25-pass-overlay .image-unlimited-pass-option-copy { gap: 5px; }
.seedance25-pass-overlay .image-unlimited-pass-option-copy strong { font-size: 15px; }
.seedance25-pass-overlay .image-unlimited-pass-option-copy small { font-size: 11px; white-space: normal; }
.seedance25-pass-overlay .image-unlimited-pass-price { position: relative; min-width: 70px; padding: 6px 8px; border: 0; background: transparent; }
.seedance25-pass-overlay .image-unlimited-pass-price strong { font-size: 22px; }
.seedance25-pass-overlay .image-unlimited-pass-price small { font-size: 10px; }
.seedance25-pass-discount { position: absolute; top: -16px; right: -8px; background: #203e5b; color: #8ecbff; padding: 3px 6px; border-radius: 5px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.seedance25-pass-overlay .image-unlimited-pass-checkout { min-height: 46px; margin-top: 16px; padding: 10px 14px; border-radius: 10px; background: var(--pass-accent); color: white; font-size: 16px; box-shadow: none; }
.seedance25-pass-overlay .image-unlimited-pass-checkout:hover { background: #087ce6; outline: none; }
.seedance25-pass-overlay .image-unlimited-pass-terms { margin: 12px 0 0; font-size: 11px; line-height: 1.5; }

.image-unlimited-pass-overlay {
    position: fixed;
    inset: 0;
    z-index: 10080;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 24% 18%, rgba(139, 92, 246, 0.22), transparent 38%),
        radial-gradient(circle at 78% 72%, rgba(197, 255, 0, 0.12), transparent 34%),
        rgba(3, 4, 7, 0.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.image-unlimited-pass-dialog {
    position: relative;
    width: min(640px, 100%);
    max-height: min(900px, calc(100vh - 48px));
    overflow: auto;
    padding: 34px;
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 30px;
    background: linear-gradient(180deg, #202226 0%, #15171a 56%, #101113 100%);
    box-shadow: 0 34px 100px rgba(0, 0, 0, 0.58);
}

.image-unlimited-pass-close {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 1;
    width: 42px;
    height: 42px;
    padding: 0;
    color: #fff;
    font: 300 32px/38px system-ui, sans-serif;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
}

.image-unlimited-pass-close:hover,
.image-unlimited-pass-close:focus-visible {
    background: rgba(255, 255, 255, 0.16);
    outline: none;
}

.image-unlimited-pass-hero {
    padding: 16px 50px 28px;
    text-align: center;
}

.image-unlimited-pass-kicker {
    display: block;
    margin-bottom: 2px;
    color: #c7ff00;
    font-size: 28px;
    font-style: italic;
    font-weight: 900;
    letter-spacing: -1px;
}

.image-unlimited-pass-hero h2 {
    margin: 0;
    color: #fff;
    font-size: clamp(32px, 7vw, 52px);
    font-weight: 950;
    line-height: 0.92;
    letter-spacing: -3px;
}

.image-unlimited-pass-hero h2 em {
    display: block;
    margin-top: 7px;
    color: #c7ff00;
    font-family: Georgia, serif;
    font-size: 1.15em;
    font-weight: 700;
}

.image-unlimited-pass-hero p {
    margin: 16px 0 0;
    color: #9ca3af;
    font-size: 14px;
}

.image-unlimited-pass-resolution {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 7px;
    border-radius: 20px;
    background: #292b2e;
}

.image-unlimited-pass-resolution button {
    display: grid;
    place-items: center;
    min-height: 86px;
    padding: 12px;
    color: #777b81;
    border: 0;
    border-radius: 15px;
    background: transparent;
    cursor: pointer;
}

.image-unlimited-pass-resolution button span {
    font-size: 14px;
}

.image-unlimited-pass-resolution button strong {
    font-size: 28px;
    font-style: italic;
}

.image-unlimited-pass-resolution button.is-selected {
    color: #0d0e10;
    background: #f8fafc;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.28);
}

.image-unlimited-pass-concurrency {
    width: fit-content;
    margin: 16px auto 24px;
    padding: 7px 12px;
    color: #9ca3af;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 14px;
}

.image-unlimited-pass-options {
    display: grid;
    gap: 12px;
}

.image-unlimited-pass-option {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 104px;
    padding: 16px 18px;
    color: #f8fafc;
    text-align: left;
    border: 1px solid transparent;
    border-radius: 19px;
    background: #27292c;
    cursor: pointer;
}

.image-unlimited-pass-option[hidden] {
    display: none;
}

.image-unlimited-pass-option:hover,
.image-unlimited-pass-option:focus-visible {
    border-color: rgba(199, 255, 0, 0.48);
    outline: none;
}

.image-unlimited-pass-option.is-selected {
    border-color: #c7ff00;
    background: linear-gradient(110deg, #303337, #282b2e);
}

.image-unlimited-pass-radio {
    width: 24px;
    height: 24px;
    border: 2px solid #5d6167;
    border-radius: 50%;
}

.image-unlimited-pass-option.is-selected .image-unlimited-pass-radio {
    border: 7px solid #c7ff00;
    background: #101113;
}

.image-unlimited-pass-option-copy {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.image-unlimited-pass-option-copy strong {
    font-size: 19px;
}

.image-unlimited-pass-option-copy small {
    overflow: hidden;
    color: #94979c;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-unlimited-pass-price {
    display: grid;
    place-items: center;
    min-width: 92px;
    padding: 10px 13px;
    border: 1px solid rgba(255, 255, 255, 0.17);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.035);
}

.image-unlimited-pass-price del {
    color: #8a8e94;
    font-size: 12px;
}

.image-unlimited-pass-price strong {
    font-size: 25px;
    line-height: 1.05;
}

.image-unlimited-pass-price small {
    margin-top: 5px;
    color: #9ca3af;
    font-size: 11px;
}

.image-unlimited-pass-checkout {
    width: 100%;
    min-height: 64px;
    margin-top: 22px;
    padding: 14px 22px;
    color: #080a05;
    border: 0;
    border-radius: 17px;
    background: #c7ff00;
    box-shadow: 0 7px 0 #87ad00;
    font-size: 19px;
    font-weight: 850;
    cursor: pointer;
}

.image-unlimited-pass-checkout:hover,
.image-unlimited-pass-checkout:focus-visible {
    background: #d5ff3f;
    outline: 3px solid rgba(199, 255, 0, 0.22);
}

.image-unlimited-pass-checkout:disabled {
    cursor: wait;
    opacity: 0.68;
}

.image-unlimited-pass-terms {
    margin: 22px 8px 0;
    color: #7f8389;
    font-size: 12px;
    line-height: 1.55;
    text-align: center;
}

@media (max-width: 640px) {
    .image-unlimited-pass-overlay {
        align-items: end;
        padding: 0;
    }

    .image-unlimited-pass-dialog {
        width: 100%;
        max-height: 94vh;
        padding: 24px 16px calc(22px + env(safe-area-inset-bottom));
        border-radius: 26px 26px 0 0;
    }

    .image-unlimited-pass-hero {
        padding: 12px 46px 22px;
    }

    .image-unlimited-pass-hero h2 {
        letter-spacing: -2px;
    }

    .image-unlimited-pass-resolution button {
        min-height: 72px;
    }

    .image-unlimited-pass-option {
        grid-template-columns: 24px minmax(0, 1fr) auto;
        min-height: 94px;
        padding: 13px;
    }

    .image-unlimited-pass-option-copy strong {
        font-size: 16px;
    }

    .image-unlimited-pass-price {
        min-width: 78px;
        padding-inline: 9px;
    }
}

/* 占位符相关样式 */
.placeholder-header {
    margin-bottom: 16px;
    padding: 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.placeholder-header h5 {
    margin: 0 0 8px 0;
    color: #495057;
    font-size: 16px;
    font-weight: 600;
}

.placeholder-info {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.placeholder-info span {
    color: #6c757d;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.7);
    padding: 4px 8px;
    border-radius: 4px;
}

/* 图片占位符网格 */
.image-placeholder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
    margin: 12px 0 12px;
    width: 100%;
    align-items: stretch;
}

/* 占位符网格在不同数量下的布局优化，确保并排显示 */
.image-placeholder-grid.single-image {
    grid-template-columns: repeat(auto-fit, minmax(140px, min(230px, 100%)));
    justify-content: center;
    max-width: 260px;
    margin: 12px auto 0;
}

/* 🎬 视频容器使用更大的最大宽度（不影响图片） */
.image-placeholder-grid.single-image.has-landscape-video {
    max-width: 720px;
    grid-template-columns: 1fr;
}

.image-placeholder-grid.two-images {
    grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
}

.image-placeholder-grid.multiple-images {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.image-placeholder-grid.wide-two-col {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    max-width: 920px;
}

/* 单个图片占位符 */
.image-placeholder {
    position: relative;
    background: #f7f8fb;
    border: none;
    border-radius: 20px;
    overflow: hidden;
    min-height: 120px;
    transition: all 0.25s ease;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.06);
}

.image-placeholder:hover {
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
}

/* 占位符内容 */
.placeholder-content {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 🎬 视频占位符移除最小高度限制，避免横屏视频下方空白过大 */
.image-placeholder:has(.generated-video),
.image-placeholder:has(video) {
    min-height: unset;
}

.image-placeholder:has(.generated-video) .placeholder-content,
.image-placeholder:has(video) .placeholder-content {
    min-height: unset;
}

.skeleton-thumbnail {
    width: 48px;
    height: 48px;
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 6px;
    flex-shrink: 0;
}

.skeleton-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
}

.skeleton-line {
    height: 12px;
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 6px;
}

.skeleton-line.skeleton-title {
    width: 70%;
    height: 14px;
}

.skeleton-line.skeleton-text {
    width: 90%;
    height: 12px;
}

.skeleton-line.skeleton-meta {
    width: 50%;
    height: 10px;
    margin-top: 4px;
}

/* 骨架屏动画关键帧 */
@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 占位符覆盖层 */
.placeholder-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f7f8fb;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    gap: 22px;
    z-index: 1;
    backdrop-filter: blur(1px);
    border-radius: inherit;
    box-shadow: none;
}

.placeholder-skeleton {
    background: transparent;
    box-shadow: none;
    width: 100%;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3d4656;
    font-weight: 600;
    font-size: 46px;
    letter-spacing: 0.4px;
}

.image-placeholder.task-started-pending .placeholder-skeleton,
.placeholder-overlay.task-started-pending .placeholder-skeleton {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    position: relative;
    color: transparent;
}

.image-placeholder.task-started-pending .placeholder-skeleton::before,
.placeholder-overlay.task-started-pending .placeholder-skeleton::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 4px solid rgba(148, 163, 184, 0.26);
    border-top-color: #60a5fa;
    animation: taskStartedSpin 0.9s linear infinite;
}

.image-placeholder.task-started-pending .placeholder-skeleton::after,
.placeholder-overlay.task-started-pending .placeholder-skeleton::after {
    content: none;
}

.placeholder-text {
    color: #9ca3af;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 0;
    position: absolute;
    top: 16px;
    right: 18px;
}

.progress-percentage .percent-sign {
    font-size: 18px;
    color: #a3acb9;
    margin-left: 4px;
}

.placeholder-progress {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.placeholder-progress .progress-bar {
    width: 100%;
    height: 4px;
    background: transparent;
    border-radius: 999px;
    overflow: hidden;
}

.placeholder-progress .progress-fill {
    height: 100%;
    background: #4f5b6b;
    border-radius: 999px;
    transition: width 0.3s ease;
    min-width: 0;
}

.image-placeholder.task-started-pending .placeholder-progress .progress-bar,
.placeholder-overlay.task-started-pending .placeholder-progress .progress-bar {
    display: none;
}

.placeholder-progress .progress-text {
    font-size: 13px;
    color: #a3acb9;
    font-weight: 600;
}

.unlimited-video-task-hints {
    display: grid;
    max-width: 100%;
    margin: 0;
    color: #64748b;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.55;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
}

.unlimited-video-task-hints[hidden] {
    display: none;
}

.placeholder-progress .unlimited-video-task-hints,
html[data-theme="dark"] .unlimited-video-task-hints {
    color: #94a3b8;
}

.unlimited-video-task-hints > span {
    grid-area: 1 / 1;
    visibility: hidden;
    animation: unlimited-video-two-hints 12s step-end infinite;
}

.unlimited-video-task-hints > span:first-child {
    visibility: visible;
}

.unlimited-video-task-hints > span:nth-child(2) {
    animation-delay: 6s;
}

.unlimited-video-task-hints > span:nth-child(3) {
    animation-delay: 12s;
}

.unlimited-video-task-hints:has(> span:nth-child(3)) > span {
    animation-name: unlimited-video-three-hints;
    animation-duration: 18s;
}

@keyframes unlimited-video-two-hints {
    from { visibility: visible; }
    50%, to { visibility: hidden; }
}

@keyframes unlimited-video-three-hints {
    from { visibility: visible; }
    33.333333%, to { visibility: hidden; }
}

.queued-video-cancel-btn {
    position: absolute;
    top: 16px;
    right: 18px;
    z-index: 3;
    width: 32px;
    height: 32px;
    border: 1px solid transparent;
    background: transparent;
    color: rgba(226, 232, 240, 0.72);
    border-radius: 50%;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}

.queued-video-cancel-btn:hover,
.queued-video-cancel-btn:focus-visible {
    background: rgba(15, 23, 42, 0.58);
    border-color: rgba(148, 163, 184, 0.38);
    color: #f8fafc;
    outline: none;
}

.queued-video-cancel-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.placeholder-overlay:has(.queued-video-cancel-btn:not([hidden])) .placeholder-text {
    right: 62px;
}

.image-placeholder.task-started-pending .placeholder-progress .progress-text,
.placeholder-overlay.task-started-pending .placeholder-progress .progress-text {
    color: #cbd5e1;
    font-size: 15px;
    letter-spacing: 0.01em;
}

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

html[data-theme="dark"] .placeholder-overlay {
    background: #0f141b;
}

html[data-theme="dark"] .placeholder-skeleton {
    color: #e2e8f0;
}

html[data-theme="dark"] .placeholder-text {
    color: #94a3b8;
}

html[data-theme="dark"] .progress-percentage,
html[data-theme="dark"] .progress-percentage .percent-sign {
    color: #cbd5e1;
}

html[data-theme="dark"] .placeholder-progress .progress-text {
    color: #94a3b8;
}

html[data-theme="dark"] .placeholder-progress .progress-bar {
    background: rgba(148, 163, 184, 0.2);
}

html[data-theme="dark"] .placeholder-progress .progress-fill {
    background: #8ab4ff;
}

.placeholder-no-result {
    width: 100%;
    height: 100%;
    background: #f7f8fb;
}

/* 完成动画 */
.image-placeholder.completing {
    border-color: #e9ecef; /* 去掉绿色边框，保持中性边框 */
    animation: completing-pulse 1s ease-in-out;
}

.image-placeholder.completed {
    border-color: #e9ecef; /* 去掉绿色边框，保持中性边框 */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); /* 与默认一致 */
}

.image-placeholder.completed .placeholder-overlay {
    display: none;
}

@keyframes completing-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1); /* 去掉绿色高亮 */
    }
}

/* 错误状态 */
.image-placeholder.error,
.image-placeholder.timeout {
    border: 0;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0;
    min-height: 0 !important;
    height: auto !important;
    width: fit-content;
    max-width: 100%;
    aspect-ratio: auto !important;
    overflow: visible;
    justify-self: center;
    margin: 0 auto;
}

.image-placeholder.error:hover,
.image-placeholder.timeout:hover {
    box-shadow: none !important;
}

.placeholder-error,
.placeholder-timeout {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    height: 100%;
    color: #991b1b;
    font-size: 12px;
    text-align: left;
    padding: 8px;
}

.image-placeholder.error .placeholder-error,
.image-placeholder.timeout .placeholder-timeout {
    height: auto;
}

.placeholder-error-card {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: fit-content;
    max-width: min(280px, 100%);
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.1);
    border: 0;
    box-shadow: none;
}

.placeholder-timeout .placeholder-error-card {
    background: rgba(245, 158, 11, 0.1);
    border-color: transparent;
    box-shadow: none;
}

.placeholder-error-icon {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 22px;
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    font-size: 11px;
}

.placeholder-timeout .placeholder-error-icon {
    background: rgba(245, 158, 11, 0.14);
    color: #d97706;
}

.placeholder-error-copy {
    min-width: 0;
    flex: 1 1 auto;
}

.placeholder-error-title {
    color: #7f1d1d;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
}

.placeholder-timeout .placeholder-error-title {
    color: #92400e;
}

.placeholder-error-message {
    margin-top: 2px;
    color: #991b1b;
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.placeholder-timeout .placeholder-error-message {
    color: #92400e;
}

.placeholder-error-details {
    margin-top: 6px;
    color: #7f1d1d;
    font-size: 11px;
}

.placeholder-timeout .placeholder-error-details {
    color: #92400e;
}

.placeholder-error-details summary {
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    opacity: 0.8;
}

.placeholder-error-details pre {
    max-height: 110px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 8px 0 0;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(127, 29, 29, 0.06);
    color: inherit;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 11px;
    line-height: 1.45;
}

.placeholder-error-with-actions {
    position: relative;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

.placeholder-error-actions {
    position: static;
    order: 3;
    width: 100%;
    display: flex;
    justify-content: flex-start;
    margin-top: 12px;
    z-index: 2;
}

.placeholder-error-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    padding: 0;
    line-height: 1;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transition: background 0.2s ease;
}

.placeholder-error-action-btn i {
    font-size: 14px;
}

.placeholder-error-action-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

.placeholder-error-action-btn:active {
    transform: none;
}

.placeholder-error > .placeholder-error-card,
.placeholder-timeout > .placeholder-error-card {
    max-width: 100%;
}

html[data-theme="dark"] .placeholder-error-action-btn {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
}

html[data-theme="dark"] .placeholder-error-action-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

html[data-theme="dark"] .placeholder-error-card {
    background: rgba(248, 113, 113, 0.1);
}

html[data-theme="dark"] .placeholder-timeout .placeholder-error-card {
    background: rgba(245, 158, 11, 0.1);
}

/* 生成完成状态 */
.generation-completed {
    opacity: 1;
}

.generation-completed .placeholder-header {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: #c3e6cb;
}

.generation-completed .placeholder-header h5 {
    color: #155724;
}

/* 用户消息样式扩展 - 支持多图 */

/* 图片网格布局 - 复用单图样式 */
.user-images-grid {
    display: grid;
    gap: 8px;
    margin-bottom: 8px;
}

.user-images-grid.count-1 {
    grid-template-columns: 1fr;
}

.user-images-grid.count-2 {
    grid-template-columns: 1fr 1fr;
}

.user-images-grid.count-3,
.user-images-grid.count-4 {
    grid-template-columns: repeat(2, 1fr);
}

.user-images-grid.count-5,
.user-images-grid.count-6 {
    grid-template-columns: repeat(3, 1fr);
}

.user-image-item {
    overflow: hidden;
    border-radius: 8px;
}

.user-image-item img {
    width: 100%;
    max-width: 200px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
    cursor: pointer;
}

.user-image-item:hover img {
    transform: scale(1.02);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .user-images-grid.count-5,
    .user-images-grid.count-6 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .user-images-grid {
        grid-template-columns: 1fr;
    }
    
    .user-images-grid.count-2 {
        grid-template-columns: 1fr;
    }
}

/* 原有样式保留（向下兼容） */
.image-placeholder-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.image-placeholder {
    min-height: 220px;
}

/* 🎬 视频占位符移除固定高度（避免横屏视频空白） */
.image-placeholder:has(.generated-video),
.image-placeholder:has(video) {
    min-height: unset;
}

.placeholder-content {
    min-height: 220px;
}

.placeholder-content:has(.generated-video),
.placeholder-content:has(video) {
    min-height: unset;
}

.skeleton-image {
    min-height: 80px;
}

@media (max-width: 480px) {
    .image-placeholder-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .image-placeholder {
        min-height: 120px;
    }

    /* 🎬 移动端视频占位符也移除固定高度 */
    .image-placeholder:has(.generated-video),
    .image-placeholder:has(video) {
        min-height: unset;
    }

    .placeholder-content {
        min-height: 120px;
    }

    .placeholder-content:has(.generated-video),
    .placeholder-content:has(video) {
        min-height: unset;
    }

    .placeholder-overlay {
        padding: 12px;
        gap: 8px;
    }
    
    .placeholder-text {
        font-size: 11px;
    }

    .overlay-progress {
        top: 12px;
        left: 12px;
    }

    .progress-badge {
        min-width: 42px;
        padding: 3px 8px;
        border-radius: 8px;
        font-size: 12px;
    }

    .progress-badge .progress-percentage {
        font-size: 12px;
    }
}

/* 🔥 进度徽章基础样式 */
.progress-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #3d4656;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4px);
}

.progress-badge .progress-percentage {
    font-size: 13px;
    font-weight: 600;
    color: #3d4656;
}

.loading-message.skeleton-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f7f9fc;
    border: 1px solid #e6ecf5;
    border-radius: 12px;
    padding: 16px;
    gap: 14px;
    min-height: 120px;
    box-shadow: none;
    position: relative;
    overflow: hidden;
}

.loading-message.skeleton-loading .skeleton-preview-wrapper {
    position: relative;
    width: 100%;
    max-width: 420px;
}

.loading-message.skeleton-loading .skeleton-preview-grid {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
    gap: 12px;
}

.loading-message.skeleton-loading[data-preview-count="1"] .skeleton-preview-grid {
    grid-template-columns: repeat(1, minmax(140px, 1fr));
}

.loading-message.skeleton-loading[data-preview-count="2"] .skeleton-preview-grid {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
}

.loading-message.skeleton-loading[data-preview-count="3"] .skeleton-preview-grid {
    grid-template-columns: repeat(3, minmax(88px, 1fr));
}

.loading-message.skeleton-loading .skeleton-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    background: linear-gradient(90deg, #f0f2f5 25%, #e3e7ef 50%, #f0f2f5 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

.loading-message.skeleton-loading.skeleton-complete .skeleton-thumb,
.loading-message.skeleton-loading.skeleton-complete .skeleton-line {
    animation-duration: 2.4s;
    opacity: 0.7;
}

.loading-message.skeleton-loading .skeleton-overlay-progress {
    position: absolute;
    top: 18px;
    left: 18px;
    z-index: 1;
    pointer-events: none;
}

@media (max-width: 768px) {
    .image-ratio-popup {
        min-width: min(520px, calc(100vw - 20px));
    }

    .image-ratio-popup-options {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 7px;
    }

    .image-ratio-popup-option {
        min-height: 78px;
        padding: 7px 6px;
    }

    .image-ratio-popup-option .ratio-value {
        font-size: 14px;
    }

    .loading-message.skeleton-loading {
        padding: 14px;
        gap: 12px;
    }

    .loading-message.skeleton-loading .skeleton-preview-wrapper {
        max-width: 100%;
    }

    .loading-message.skeleton-loading .skeleton-preview-grid {
        width: 100%;
        grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
    }

    .loading-message.skeleton-loading .skeleton-overlay-progress {
        top: 14px;
        left: 14px;
    }
}

@media (max-width: 520px) {
    .image-ratio-popup {
        min-width: min(340px, calc(100vw - 16px));
    }

    .image-ratio-popup-options {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 7px;
    }

    .image-ratio-popup-option {
        min-height: 74px;
        padding: 6px;
    }
}

@media (max-width: 360px) {
    .image-ratio-popup-options {
        grid-template-columns: 1fr !important;
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 响应式调整 */
@media (max-width: 480px) {
    .loading-message {
        padding: 12px;
        gap: 8px;
    }

    .loading-spinner {
        width: 16px;
        height: 16px;
    }

    .loading-text {
        font-size: 13px;
    }

    .progress-text {
        font-size: 11px;
        min-width: 30px;
    }
}

.image-edit-chat-container {
    height: 100vh;
    /* 使用全视口高度 */
    max-height: 100vh;
    /* 确保不超过视口高度 */
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    /* 防止容器本身产生滚动条 */
    position: fixed;
    /* 固定定位，避免受body padding影响 */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    padding-top: var(--mode-switcher-offset);
    /* 为导航栏留出空间 */
    box-sizing: border-box;
    /* 确保padding包含在总高度内 */
}

/* 移动端需要更高的z-index以显示在侧边栏之上 */
@media (max-width: 768px) {
    .image-edit-chat-container {
        z-index: 100;
        /* 移动端提高z-index使内容可见，但低于侧边栏(1100)，允许侧边栏滑出覆盖 */
    }
}

/* 主内容区域 */
.main-content-wrapper {
    flex: 1;
    display: flex;
    align-items: stretch;
    overflow: hidden;
    min-height: 0;
    /* 确保在flex容器中正确收缩 */
    max-height: 100%;
    /* 限制最大高度 */
    width: 100%;
    padding-top: var(--mode-switcher-offset);
    box-sizing: border-box;
}

/* 页面标题 */
.page-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: white;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.header-icon {
    width: 40px;
    height: 40px;
    background: #6c757d;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: white;
    font-size: 18px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

/* 聊天内容区域 */
.chat-content-area {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 20px 20px;
    padding-top: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    min-height: 0;
    /* 确保flex子项可以收缩 */
}

.chat-content-area.with-fixed-input {
    padding-bottom: 160px;
    /* 为固定底部的输入框留出更多空间，确保内容不被遮挡 */
    margin-bottom: 0;
    /* 输入框固定在底部时移除底部空间 */
}

.messages-container {
    flex: 1;
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
    transition: max-width 0.2s ease;
    padding-top: 64px; /* 为 tab 留出空间，滚动时内容可穿过玻璃 tab */
}

.messages-container.media-grid-mode {
    max-width: 1000px;
    padding-left: 88px;
    padding-right: 16px;
}

.chat-content-area.grid-mode {
    overflow-y: auto;
    overflow-x: hidden;
}

.chat-content-area.grid-mode .messages-container {
    display: none;
}

.session-media-panel {
    flex: 1;
    width: 100%;
    max-width: none;
    margin: 0;
    display: none;
    min-height: 0;
    padding-top: 64px;
    padding-left: clamp(4px, 1vw, 20px);
    padding-right: clamp(4px, 1vw, 20px);
    box-sizing: border-box;
}

.chat-content-area.grid-mode .session-media-panel {
    display: flex;
    flex-direction: column;
}

/* The image workspace shell is fixed to the viewport while its minimal
   navigation rail is rendered above it. Keep the full-width grid inside the
   visible content area instead of letting the rail cover the first column. */
@media (min-width: 769px) {
    .workspace-body .chat-content-area.grid-mode .session-media-panel {
        padding-left: calc(var(--sidebar-width, 80px) + clamp(4px, 1vw, 20px));
    }

    /* The density control and layout switcher form one fixed desktop tool row.
       Reserve their combined footprint so the scrolling filters stay clear. */
    .chat-content-area.grid-mode .session-media-toolbar {
        box-sizing: border-box;
        flex-wrap: nowrap;
        padding-right: clamp(310px, 23vw, 350px);
    }

    .chat-content-area.grid-mode .session-media-filters {
        min-width: 0;
        flex-wrap: nowrap;
    }

    .chat-content-area.grid-mode .session-media-density-control {
        flex: 0 0 auto;
        position: fixed !important;
        top: 70px;
        right: max(128px, calc(env(safe-area-inset-right, 0px) + 128px));
        z-index: 110;
        box-sizing: border-box;
        height: 50px;
        min-height: 50px;
        padding: 0 16px;
        border: 1px solid rgba(255, 255, 255, 0.06);
        border-radius: 999px;
        background: rgba(22, 22, 24, 0.96);
        color: #a1a1aa;
        box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    .chat-content-area.grid-mode .session-media-density-input {
        width: clamp(110px, 9vw, 170px);
        height: 4px;
        background: #25272a;
    }

    .chat-content-area.grid-mode .session-media-density-input::-webkit-slider-thumb {
        width: 20px;
        height: 20px;
        border: 0;
        background: #f4f4f5;
        box-shadow: none;
    }

    .chat-content-area.grid-mode .session-media-density-input::-moz-range-thumb {
        width: 20px;
        height: 20px;
        border: 0;
        background: #f4f4f5;
        box-shadow: none;
    }

    .image-edit-chat-container:has(.chat-content-area.grid-mode) .session-layout-switcher {
        background: rgba(22, 22, 24, 0.96);
        border-color: rgba(255, 255, 255, 0.06);
        box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    .image-edit-chat-container:has(.chat-content-area.grid-mode) .layout-toggle-btn {
        color: #a1a1aa;
    }

    .image-edit-chat-container:has(.chat-content-area.grid-mode) .layout-toggle-btn:hover {
        background: #222225;
        color: #f4f4f5;
    }

    .image-edit-chat-container:has(.chat-content-area.grid-mode) .layout-toggle-btn.is-active {
        border: 1px solid rgba(255, 255, 255, 0.05);
        background: #29292c;
        color: #ffffff;
        box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.24);
    }
}

.session-media-panel .session-media-gallery {
    flex: 1;
    min-height: 0;
}

.session-media-panel .session-media-grid {
    min-height: 0;
}

/* 欢迎消息 */
.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.welcome-message .message-content p {
    font-size: 16px;
    margin: 0;
    line-height: 1.5;
}

/* 消息项 */
.message-item {
    margin-bottom: 24px;
    animation: fadeInUp 0.3s ease-out;
}

.user-message {
    display: flex;
    justify-content: flex-end;
}

.ai-message {
    display: flex;
    justify-content: flex-start;
}

.system-message {
    display: flex;
    justify-content: center;
}

.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
}

.user-message .message-bubble {
    background: #2b3142;
    color: #e2e8f0;
    border-bottom-right-radius: 4px;
}

.ai-message .message-bubble {
    background: white;
    color: #2c3e50;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ai-message.history-plain .message-bubble {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
}

.ai-message.history-plain .generated-text {
    background: transparent;
    border-left: 0;
    padding: 0;
    margin: 0;
}

.ai-message.history-plain .text-content {
    gap: 0;
}

.system-message .message-bubble {
    display: inline-flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 80%;
    background: #f8f9fc;
    border: 1px solid rgba(15, 23, 42, 0.08);
    color: #334155;
    border-radius: 14px;
    padding: 14px 18px;
}

.system-message .system-message-icon {
    font-size: 18px;
    line-height: 1.2;
    color: inherit;
}

.system-message .system-message-text {
    font-size: 14px;
    line-height: 1.6;
}

.system-message.error .message-bubble {
    background: #fff5f5;
    border-color: rgba(220, 53, 69, 0.3);
    color: #b02a37;
}

.system-message.warning .message-bubble {
    background: #fffdf2;
    border-color: rgba(255, 193, 7, 0.3);
    color: #b78103;
}

.system-message.success .message-bubble {
    background: #f4fbf7;
    border-color: rgba(25, 135, 84, 0.3);
    color: #1e7b4d;
}

.system-message.info .message-bubble {
    background: #f8f9fc;
    border-color: rgba(15, 23, 42, 0.08);
    color: #334155;
}

/* 失败提示与重试入口 */
.retry-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 12px auto;
    padding: 14px 16px;
    max-width: 80%;
    width: 100%;
    background: #fff5f5;
    border: 1px solid rgba(220, 53, 69, 0.22);
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(220, 53, 69, 0.08);
    color: #7f1d1d;
}

.retry-notice .retry-icon {
    font-size: 18px;
    line-height: 1.2;
    color: #d6336c;
}

.retry-notice .retry-body {
    flex: 1;
}

.retry-notice .retry-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #b02a37;
}

.retry-notice .retry-text {
    font-size: 13px;
    line-height: 1.6;
    color: #7f1d1d;
}

.retry-notice .retry-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.retry-notice .retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #b02a37;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(176, 42, 55, 0.18);
    transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.retry-notice .retry-btn:hover {
    background: #a12530;
    box-shadow: 0 10px 22px rgba(176, 42, 55, 0.2);
}

.retry-notice .retry-btn:active {
    transform: translateY(1px);
    box-shadow: 0 6px 14px rgba(176, 42, 55, 0.18);
}

.retry-notice .retry-btn:focus-visible {
    outline: 2px solid rgba(176, 42, 55, 0.4);
    outline-offset: 2px;
}

@media (max-width: 768px) {
    .retry-notice {
        max-width: 100%;
    }
}

/* 当包含占位符网格时，气泡采用更宽布局，避免占位符竖排 */
.ai-message .message-bubble.wide-bubble,
.message-item.has-media-grid .message-bubble {
    flex: 1 1 100%;
    max-width: 100%;
    width: 100%;
    padding: 24px 28px 22px;
    border-radius: 18px;
    border: 0;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08), 0 6px 18px rgba(15, 23, 42, 0.05);
}

.media-row {
    display: flex;
    gap: clamp(32px, 4vw, 72px);
    align-items: flex-start;
    width: 100%;
    flex-wrap: nowrap;
    padding-left: 0;
}

.prompt-panel {
    flex: 0 0 200px;
    max-width: 220px;
    min-width: 160px;
    width: clamp(170px, 18vw, 220px);
    background: rgba(15, 23, 42, 0.035);
    border: 0;
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: none;
    position: sticky;
    top: calc(var(--mode-switcher-offset) + 12px);
}

.prompt-panel .prompt-title {
    font-size: 12px;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.prompt-title-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
}

.prompt-action-btn {
    border: 0;
    background: transparent;
    color: #334155;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 8px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.prompt-action-btn:hover {
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
}

.prompt-action-btn:active {
    transform: translateY(1px);
}

.prompt-panel .prompt-title i {
    color: #2563eb;
}

.message-item.user-message.hidden-prompt {
    display: none;
}

.prompt-text {
    font-size: 14px;
    line-height: 1.6;
    color: #1e293b;
    word-break: break-word;
    text-align: left;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 4px;
}

.prompt-panel .prompt-text.has-inline-references {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    align-content: flex-start;
    width: 100%;
    line-height: 1.9;
    white-space: pre-wrap;
    text-indent: 0 !important;
    text-align: left !important;
    margin-inline: 0;
}

.prompt-panel .prompt-text.has-inline-references > .prompt-rich-overlay-text {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    text-align: left;
}

.prompt-panel .prompt-text.has-inline-references > :first-child {
    margin-left: 0;
}

.prompt-text .prompt-rich-chip {
    width: 34px;
    height: 34px;
    margin: 1px 4px;
    vertical-align: middle;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: none;
}

.prompt-text .prompt-inline-ref {
    cursor: zoom-in;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.prompt-text .prompt-inline-ref:hover,
.prompt-text .prompt-inline-ref:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(37, 99, 235, 0.75);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
    outline: none;
}

.prompt-text .prompt-rich-chip-audio,
.prompt-text .prompt-rich-chip-video {
    width: auto;
    max-width: 120px;
    padding: 0 9px;
}
.prompt-text::-webkit-scrollbar {
    width: 6px;
}
.prompt-text::-webkit-scrollbar-track {
    background: transparent;
}
.prompt-text::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 6px;
}

.prompt-model {
    margin-top: 6px;
    font-size: 12px;
    color: #475569;
    font-weight: 600;
}

.prompt-ref-list {
    margin-top: 8px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 6px;
}

.prompt-ref-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: #0f172a;
    min-height: 64px;
    aspect-ratio: 1 / 1;
    cursor: pointer;
}

.prompt-ref-item img,
.prompt-ref-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.prompt-ref-item video {
    background: #000;
}

.prompt-ref-item.ref-more {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111827;
    color: #e2e8f0;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.media-grid {
    flex: 1 1 auto;
    min-width: 300px;
}

/* 图片消息 */
.image-message {
    margin: 16px 0;
}

.generated-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    margin-top: 12px;
    justify-content: stretch;
    align-items: stretch;
    width: 100%;
}

/* 单张图片时居中显示 */
.generated-images.single-image {
    grid-template-columns: repeat(auto-fit, minmax(140px, min(230px, 100%)));
    justify-content: center;
    width: 100%;
    max-width: 260px;
    margin: 12px auto 0;
}

/* 🎬 单个横屏视频：放大展示（竖屏保持原尺寸） */
.generated-images.single-image.has-landscape-video {
    grid-template-columns: 1fr;
    max-width: 720px;
}

/* 两张图片时并排显示 */
.generated-images.two-images {
    grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
}

/* 三张或更多图片时自适应显示 */
.generated-images.multiple-images {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.generated-images.wide-two-col {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    max-width: 920px;
}

.generated-image,
.generated-video {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    width: 100%;
    height: auto;
    margin: 0;
    background: transparent;
    display: block;
}

.generated-image:hover,
.generated-video:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.generated-image img {
    width: 100%;
    height: auto;
    display: block;
    max-width: 100%;
    object-fit: contain;
}

.generated-video video {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

.image-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.generated-image:hover .image-actions {
    opacity: 1;
}

.generated-video:hover .image-actions,
.generated-image:focus-within .image-actions,
.generated-video:focus-within .image-actions {
    opacity: 1;
}

@media (hover: none) {
    .generated-image .image-actions,
    .generated-video .image-actions {
        opacity: 1;
    }
}

.image-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s ease;
}

.image-action-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* 加载状态 */
.loading-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-width: 70%;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
    margin-top: 2px;
}

.loading-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.loading-text {
    color: #495057;
    font-size: 14px;
    line-height: 1.4;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    border-radius: 3px;
    transition: width 0.3s ease;
    min-width: 2px;
}

.progress-text {
    font-size: 12px;
    color: #6c757d;
    min-width: 35px;
    text-align: right;
}

/* Image generation already communicates progress with the percentage and bar. */
.image-generation-pending .placeholder-progress .progress-text {
    display: none;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 带动画效果的输入框 - 保留用于平滑过渡 */
.input-area.with-transition {
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 点击生成按钮后固定在底部 */
.input-area.fixed-bottom {
    position: fixed !important;
    bottom: 15px !important;
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    transform: translateY(0) !important;
    width: 100% !important;
    max-width: 800px !important;
    border-radius: 20px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.chat-input-form {
    max-width: 800px;
    margin: 0 auto;
}

/* 图片上传区域 */
.image-upload-section {
    padding: 1rem;
    background: white;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: none;
}

.image-upload-section.audio-only-preview {
    width: fit-content;
    max-width: 100%;
    padding: 10px;
}

.image-upload-section.audio-only-preview .uploaded-image-preview {
    display: none !important;
}

.uploaded-image-preview {
    position: relative;
    display: inline-block;
    max-width: 100%;
    font-size: 0;
    line-height: 0;
    width: 80px;
    height: 80px;
}

.upload-progress-overlay {
    position: absolute;
    inset: 0;
    display: block;
    background: rgba(0, 0, 0, 0.35);
    color: #ffffff;
    font-size: 13px;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 2;
}

.upload-progress-overlay .loading-spinner {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    margin: 0;
    transform: translate(-50%, -50%);
    animation: none;
    box-sizing: border-box;
}

.upload-progress-overlay .loading-spinner::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 2px solid #e9ecef;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    box-sizing: border-box;
}

.uploaded-image-preview.uploading .upload-progress-overlay {
    opacity: 1;
    pointer-events: auto;
}

.upload-progress-text {
    display: none;
}

#previewImage,
#previewVideo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Reference videos use the same clean media-card treatment as the asset picker. */
.uploaded-image-preview.video-reference-preview {
    box-sizing: border-box;
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: 10px;
    background: #0b1018;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.uploaded-image-preview.video-reference-preview:hover {
    border-color: #2f80ed;
    box-shadow: 0 8px 22px rgba(47, 128, 237, 0.22);
    transform: translateY(-1px);
}

.uploaded-image-preview.video-reference-preview #previewVideo {
    object-fit: contain;
    border-radius: 9px;
    background: #080d15;
    box-shadow: none;
}

.upload-progress-overlay .loading-spinner {
    margin: 0;
}

.remove-image-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    z-index: 3;
}

.remove-image-btn:hover {
    background: #ff2e43;
    transform: scale(1.1);
}

/* 主输入容器 */
.main-input-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 底部输入区域 */
.input-area {
    background: white;
    border-top: 1px solid #e9ecef;
    padding: 20px;
    box-shadow: none;
    /* 默认在中间位置，提供更好的视觉焦点 */
    position: fixed;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    border-radius: 20px;
    z-index: 100;
    box-sizing: border-box;
    overflow: visible;
}

.prompt-welcome-message {
    position: absolute;
    top: -72px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 800px;
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    text-align: center;
    line-height: 1.2;
    pointer-events: none;
}

.workspace-prompt-presets {
    width: min(820px, 94vw);
    margin: 14px auto 0;
    padding-top: 0;
    display: grid;
    gap: 10px;
    box-sizing: border-box;
}

.workspace-prompt-presets__tabs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.workspace-prompt-presets__tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #475569;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.workspace-prompt-presets__tab i {
    font-size: 13px;
    color: inherit;
}

.workspace-prompt-presets__tab:hover,
.workspace-prompt-presets__tab.is-active {
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
}

.workspace-prompt-presets__body {
    display: grid;
    gap: 8px;
    min-height: 0;
}

.workspace-prompt-presets__body.is-animating {
    overflow: hidden;
}

.workspace-prompt-presets__prompt {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 4px 2px;
    border: 0;
    background: transparent;
    color: #475569;
    font-size: 14px;
    line-height: 1.45;
    text-align: left;
    cursor: pointer;
}

.workspace-prompt-presets__body.is-animating .workspace-prompt-presets__prompt {
    animation: workspacePresetSlideIn 380ms cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(var(--workspace-preset-index, 0) * 55ms);
    transform-origin: top;
}

.workspace-prompt-presets__prompt i {
    width: 16px;
    margin-top: 3px;
    color: #94a3b8;
    flex: 0 0 auto;
}

.workspace-prompt-presets__prompt:hover {
    color: #0f172a;
}

.workspace-prompt-presets__prompt:hover i {
    color: #2563eb;
}

@keyframes workspacePresetSlideIn {
    from {
        opacity: 0;
        transform: translateY(-14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-content-area .welcome-message {
    display: none !important;
}

.input-area.fixed-bottom .prompt-welcome-message {
    display: none !important;
}

.referral-invite-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin: 24px 0 16px;
    border: 1px solid #d6e4ff;
    border-radius: 12px;
    background: #f0f5ff;
    color: #1d39c4;
    font-size: 15px;
}

.referral-invite-banner .referral-invite-link {
    font-weight: 600;
    color: #0958d9;
    text-decoration: none;
}

.referral-invite-banner .referral-invite-link:hover {
    text-decoration: underline;
}

/* 文本输入区域 */
.text-input-wrapper {
    display: flex;
    align-items: flex-end;
    position: relative;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    transition: box-shadow 0.2s ease;
    gap: 8px;
}

.image-prompt-size-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 8px;
}

.image-prompt-size-controls[hidden] {
    display: none;
}

.image-prompt-expand-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    box-shadow: none;
    border-radius: 9px;
    color: inherit;
    background: transparent;
    font-size: 12px;
    cursor: pointer;
    opacity: 0.75;
}

.image-prompt-expand-btn:hover,
.image-prompt-expand-btn:focus-visible {
    opacity: 1;
}

.image-edit-chat-container > .input-area.is-prompt-expanded {
    max-height: 80dvh !important;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Keep the visible rich editor tall even when typing reapplies its inline cap. */
.input-area.is-prompt-expanded .prompt-lexical-editor,
.input-area.is-prompt-expanded .prompt-rich-input:not(.has-lexical-editor) textarea {
    height: clamp(180px, 40dvh, 480px) !important;
    min-height: clamp(180px, 40dvh, 480px) !important;
    max-height: clamp(180px, 40dvh, 480px) !important;
    overflow-y: auto;
    line-height: 1.6;
}

.text-input-wrapper:focus-within {
    box-shadow: none;
}

.prompt-rich-input {
    position: relative;
    flex: 1;
    min-width: 0;
    display: block;
}

.prompt-rich-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    white-space: pre-wrap;
    word-break: break-word;
    overflow: hidden;
    font-size: 16px;
    line-height: 1.4;
    font-family: inherit;
    color: #2c3e50;
    padding: 0;
    box-sizing: border-box;
}

.prompt-rich-input:not(.is-preview) .prompt-rich-overlay {
    display: none;
}

.prompt-rich-overlay.is-hidden {
    display: none;
}

.prompt-rich-overlay-text {
    color: inherit;
    vertical-align: middle;
}

.prompt-rich-chip {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    width: var(--prompt-rich-chip-width, 30px);
    height: 30px;
    margin: 0 3px;
    vertical-align: text-bottom;
    border-radius: 10px;
    overflow: hidden;
    background: #e2e8f0;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.16);
}

.prompt-rich-chip img {
    width: 30px;
    height: 100%;
    flex: 0 0 30px;
    object-fit: cover;
    display: block;
}

.prompt-rich-token-anchor {
    display: inline;
    color: transparent;
}

.prompt-rich-floating-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.prompt-rich-floating-layer .prompt-rich-chip-floating {
    position: absolute;
    left: 0;
    top: 0;
    width: 30px;
    height: 30px;
    margin: 0;
    pointer-events: none;
}

.prompt-rich-chip-audio {
    width: auto;
    min-width: 30px;
    max-width: 140px;
    padding: 0 10px;
    gap: 6px;
    color: #0f172a;
    font-size: 12px;
    font-weight: 600;
}

.prompt-rich-chip-video {
    width: auto;
    min-width: 30px;
    max-width: 140px;
    padding: 0 10px;
    gap: 6px;
    color: #0f172a;
    font-size: 12px;
    font-weight: 600;
}

.prompt-rich-chip-audio i {
    color: #2563eb;
    font-size: 13px;
}

.prompt-rich-chip-video i {
    color: #7c3aed;
    font-size: 13px;
}

.prompt-rich-chip-audio span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.prompt-rich-chip-video span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-input-wrapper textarea {
    width: 100%;
    display: block;
    border: none;
    background: transparent;
    resize: none;
    outline: none;
    font-size: 16px;
    line-height: 1.4;
    min-height: 24px;
    max-height: 120px;
    font-family: inherit;
    color: #2c3e50;
    caret-color: #2c3e50;
    -webkit-text-fill-color: #2c3e50;
    position: relative;
    z-index: 2;
    padding: 0;
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.prompt-rich-input.is-preview textarea {
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.prompt-rich-input.is-preview:not(.is-editing) textarea {
    caret-color: transparent;
}

.text-input-wrapper textarea::placeholder {
    color: #adb5bd;
    -webkit-text-fill-color: #adb5bd;
}

.prompt-rich-input.has-lexical-editor .prompt-rich-overlay {
    display: none !important;
}

.prompt-rich-input.has-lexical-editor {
    cursor: text;
}

.prompt-rich-input.has-lexical-editor textarea {
    position: absolute;
    width: 1px;
    height: 1px;
    min-height: 0;
    max-height: none;
    padding: 0;
    margin: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.prompt-lexical-editor {
    position: relative;
    width: 100%;
    min-height: 24px;
    max-height: 120px;
    padding: 0;
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
    outline: none;
    border: none;
    background: transparent;
    color: #2c3e50;
    caret-color: #2c3e50;
    font-family: inherit;
    font-size: 16px;
    font-weight: inherit;
    line-height: 1.4;
    letter-spacing: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    scrollbar-width: thin;
    cursor: text;
}

.prompt-lexical-editor p {
    margin: 0;
}

.prompt-lexical-editor.is-empty::before {
    content: attr(data-placeholder);
    position: absolute;
    inset: 0 auto auto 0;
    color: #adb5bd;
    pointer-events: none;
    user-select: none;
}

.prompt-lexical-mention {
    display: inline-flex;
    align-items: center;
    max-width: 128px;
    min-height: 24px;
    margin: 0 2px;
    padding: 2px 7px 2px 3px;
    gap: 5px;
    border-radius: 8px;
    vertical-align: middle;
    background: rgba(14, 165, 233, 0.14);
    color: #0369a1;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    user-select: none;
}

.prompt-lexical-mention-thumb,
.prompt-lexical-mention-icon {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    border-radius: 6px;
    overflow: hidden;
}

.prompt-lexical-mention-thumb {
    display: block;
    object-fit: cover;
}

.prompt-lexical-mention-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.1);
    color: #0f172a;
    font-size: 12px;
}

.prompt-lexical-mention-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prompt-mention-menu {
    position: absolute;
    left: 0;
    bottom: calc(100% + 12px);
    width: min(360px, calc(100vw - 48px));
    max-height: 320px;
    overflow: hidden;
    border-radius: 22px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(20px);
    z-index: 30;
}

.prompt-mention-menu-hint {
    padding: 16px 18px 8px;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
}

.prompt-mention-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 10px 10px;
    max-height: 266px;
    overflow-y: auto;
}

.prompt-mention-item,
.prompt-mention-empty {
    border-radius: 18px;
}

.prompt-mention-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    border: none;
    background: transparent;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease;
}

.prompt-mention-item:hover,
.prompt-mention-item.is-active {
    background: rgba(24, 144, 255, 0.09);
    transform: translateX(1px);
}

.prompt-mention-thumb {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    object-fit: cover;
    flex: 0 0 auto;
    background: #e2e8f0;
}

.prompt-mention-thumb-audio {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #2563eb;
    font-size: 18px;
}

.prompt-mention-thumb-video {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #7c3aed;
    font-size: 18px;
}

.prompt-mention-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.prompt-mention-token {
    color: #0f172a;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
}

.prompt-mention-name {
    color: #64748b;
    font-size: 12px;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prompt-mention-empty {
    padding: 14px 16px;
    color: #94a3b8;
    font-size: 13px;
    background: rgba(148, 163, 184, 0.08);
}

/* 输入框内的按钮组 */
.input-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.prompt-submit-shortcut-hint {
    display: none !important;
}

/* 输入框内的按钮基础样式 */
.input-action-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 上传按钮样式 */
.input-action-btn.upload-btn {
    color: #6c757d;
    padding: 6px;
    font-size: 16px;
}

.input-action-btn.upload-btn:hover {
    color: #007bff;
    background: rgba(0, 123, 255, 0.1);
}


/* 生成按钮样式 */
.input-action-btn.generate-btn {
    background: #1890FF;
    color: white;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 500;
    justify-content: center;
    position: relative;
    overflow: visible;
}

.input-action-btn.generate-btn[data-shortcut-tooltip]::before,
.input-action-btn.generate-btn[data-shortcut-tooltip]::after {
    position: absolute;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
    z-index: 30;
}

.input-action-btn.generate-btn[data-shortcut-tooltip]::before {
    content: '';
    right: 13px;
    bottom: calc(100% + 5px);
    width: 8px;
    height: 8px;
    background: #0f172a;
    transform: translateY(4px) rotate(45deg);
}

.input-action-btn.generate-btn[data-shortcut-tooltip]::after {
    content: attr(data-shortcut-tooltip);
    right: -4px;
    bottom: calc(100% + 9px);
    padding: 7px 10px;
    border-radius: 8px;
    background: #0f172a;
    color: #f8fafc;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    transform: translateY(4px);
}

.input-action-btn.generate-btn[data-shortcut-tooltip]:hover::before,
.input-action-btn.generate-btn[data-shortcut-tooltip]:hover::after,
.input-action-btn.generate-btn[data-shortcut-tooltip]:focus-visible::before,
.input-action-btn.generate-btn[data-shortcut-tooltip]:focus-visible::after {
    opacity: 1;
    visibility: visible;
}

.input-action-btn.generate-btn[data-shortcut-tooltip]:hover::before,
.input-action-btn.generate-btn[data-shortcut-tooltip]:focus-visible::before {
    transform: translateY(0) rotate(45deg);
}

.input-action-btn.generate-btn[data-shortcut-tooltip]:hover::after,
.input-action-btn.generate-btn[data-shortcut-tooltip]:focus-visible::after {
    transform: translateY(0);
}

.input-action-btn.generate-btn:hover {
    background: #1477d8;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.35);
}

.input-action-btn.generate-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.input-action-btn.generate-btn i {
    font-size: 12px;
    transition: all 0.3s ease;
    animation: boltFlash 2s infinite;
    position: relative;
    z-index: 1;
}

@keyframes boltFlash {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.1);
        filter: brightness(1.3);
    }
}

.input-action-btn.generate-btn span {
    display: none;
}

/* 不限量免费态（蓝色） */
.input-action-btn.generate-btn.unlimited-free {
    background: #1890FF;
    box-shadow: none;
}

/* 付费态：保持克制，只用轻微色差和角标提示 */
.input-action-btn.generate-btn.premium {
    background: #1890FF;
    color: #ffffff;
    box-shadow: none;
}

.input-action-btn.generate-btn.premium:hover {
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.35);
    transform: translateY(-1px);
}

.input-action-btn.generate-btn.premium i {
    animation: none;
    filter: none;
}

.input-action-btn.generate-btn:disabled,
.input-action-btn.generate-btn.uploading-disabled,
.input-action-btn.generate-btn.premium:disabled,
.input-action-btn.generate-btn.premium.uploading-disabled,
.input-action-btn.generate-btn.unlimited-free:disabled,
.input-action-btn.generate-btn.unlimited-free.uploading-disabled {
    background: #6c757d;
    color: #ffffff;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.input-action-btn.generate-btn:disabled:hover,
.input-action-btn.generate-btn.uploading-disabled:hover,
.input-action-btn.generate-btn.premium:disabled:hover,
.input-action-btn.generate-btn.premium.uploading-disabled:hover,
.input-action-btn.generate-btn.unlimited-free:disabled:hover,
.input-action-btn.generate-btn.unlimited-free.uploading-disabled:hover {
    background: #6c757d;
    transform: none;
    box-shadow: none;
}

/* 右上角扣费气泡：只保留数值提示 */
.input-action-btn.generate-btn .generate-cost-badge {
    position: absolute;
    top: -3px;
    right: -5px;
    background: rgba(15, 23, 42, 0.88);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    font-size: 10px;
    line-height: 1;
    padding: 2px 5px;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

html[data-theme="dark"] .input-action-btn.generate-btn.premium {
    color: #ffffff;
}

/* Agent 流式占位：转圈（替代“我先理解一下你的需求…”） */
.agent-streaming-spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(148, 163, 184, 0.35);
    border-top-color: rgba(37, 99, 235, 0.95);
    animation: agentSpinner 0.9s linear infinite;
    margin: 2px 0;
    flex: 0 0 auto;
}

.agent-tool-status {
    margin-top: 6px;
    font-size: 12px;
    color: #94a3b8;
    letter-spacing: 0.1px;
}

.agent-thinking-text {
    margin-top: 6px;
    font-size: 12px;
    color: #94a3b8;
    letter-spacing: 0.1px;
    background: linear-gradient(110deg, #94a3b8 10%, #e2e8f0 35%, #94a3b8 60%);
    background-size: 200% 100%;
    animation: agentThinkingSweep 2.4s linear infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.agent-streaming .message-bubble {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
}

.agent-streaming .generated-text {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    margin: 6px 0;
}

.agent-streaming .text-content {
    gap: 8px;
}

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

@keyframes agentThinkingSweep {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

/* Agent 开关按钮：更像“可见的开关”而不是透明图标 */
.input-action-btn.agent-mode-btn {
    padding: 6px 10px;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    border-radius: 999px;
    height: 32px;
    gap: 6px;
    line-height: 1;
}

.input-action-btn.agent-mode-btn i {
    font-size: 13px;
}

.input-action-btn.agent-mode-btn:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #3730a3;
}

.input-action-btn.agent-mode-btn[aria-pressed="true"],
.input-action-btn.agent-mode-btn.active {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.25);
}

.input-action-btn.agent-mode-btn[aria-pressed="true"]:hover,
.input-action-btn.agent-mode-btn.active:hover {
    filter: brightness(1.02);
    transform: translateY(-1px);
}

/* 平板端优化 */
@media (max-width: 1024px) and (min-width: 769px) {
    .messages-container.media-grid-mode {
        max-width: 900px;
    }

    .media-row {
        gap: 24px;
        flex-wrap: wrap;
    }

    .prompt-panel {
        flex-basis: 200px;
        min-width: 170px;
        max-width: 230px;
        position: static;
    }

    .generated-images.wide-two-col,
    .image-placeholder-grid.wide-two-col {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
        max-width: 720px;
    }

    .generated-images.single-image {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        max-width: 520px;
    }

    /* 🎬 平板端视频容器也使用更大宽度 */
    .generated-images.single-image.has-landscape-video,
    .image-placeholder-grid.single-image.has-landscape-video {
        max-width: 720px;
        grid-template-columns: 1fr;
    }

    .generated-images.two-images {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 12px;
    }
    
    .generated-images.multiple-images {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 12px;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .text-input-wrapper {
        padding: 10px 12px;
    }

    .input-actions {
        gap: 6px;
    }

    .input-action-btn.generate-btn {
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 50%;
        font-size: 16px; /* 再次增加字体大小 */
        align-self: auto !important; /* 移除拉伸，保持按钮原始大小 */
        flex-shrink: 0; /* 防止按钮收缩 */
        min-width: 44px; /* 保持圆形按钮宽度 */
        min-height: 44px; /* 保持圆形按钮高度 */
        line-height: 1.2; /* 调整行高 */
    }

    .input-action-btn.generate-btn i {
        display: inline-flex !important;
    }

    .input-action-btn.generate-btn span {
        display: none !important;
    }

    .input-action-btn.upload-btn {
        padding: 4px;
        font-size: 14px;
    }
}

@media (hover: none) {
    .input-action-btn.generate-btn[data-shortcut-tooltip]::before,
    .input-action-btn.generate-btn[data-shortcut-tooltip]::after {
        display: none;
    }
}

@media (max-width: 480px) {
    .input-action-btn.generate-btn span {
        display: none !important;
    }

    .input-action-btn.generate-btn {
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 50%;
        min-height: 44px;
        min-width: 44px;
    }
    
    .input-action-btn.generate-btn i {
        display: inline-flex !important;
    }
}

/* 保留原上传按钮样式作为备用 */
.upload-btn:not(.input-action-btn) {
    border: none;
    background: transparent;
    color: #6c757d;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.2s ease;
    margin-left: 8px;
}

.upload-btn:not(.input-action-btn):hover {
    color: #007bff;
}


/* 参数按钮组 */
.params-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.param-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid #e9ecef;
    background: transparent;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    color: #6c757d;
    transition: all 0.2s ease;
}

.param-btn:hover {
    border-color: #007bff;
    color: #007bff;
    background: transparent;
}

.param-btn.active {
    border-color: #007bff;
    background: transparent;
    color: #007bff;
}

.param-btn i {
    font-size: 12px;
}

.param-btn .model-select-icon {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    color: inherit;
}

.param-btn .model-select-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

.param-btn .model-select-icon i {
    font-size: 12px;
}

.param-btn .param-dropdown-icon {
    font-size: 12px;
    margin-left: 2px;
    color: inherit;
}

/* 图片上传按钮特殊样式 - 只显示+号，更大更突出 */
.param-btn.image-upload-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    min-width: 40px;
    min-height: 40px;
    justify-content: center;
    border-radius: 50%;
}

.param-btn.image-upload-btn i {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.param-btn.workspace-agent-toggle-btn {
    height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    font-weight: 700;
    color: #64748b;
    background: transparent;
    outline: none;
}

.param-btn.workspace-agent-toggle-btn i {
    font-size: 13px;
}

.param-btn.workspace-agent-toggle-btn:hover {
    border-color: #cbd5e1;
    color: #475569;
    background: transparent;
}

.param-btn.workspace-agent-toggle-btn:focus {
    border-color: #cbd5e1;
    color: #475569;
    background: transparent;
    box-shadow: none;
}

.param-btn.workspace-agent-toggle-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.param-btn.workspace-agent-toggle-btn.active,
.param-btn.workspace-agent-toggle-btn[aria-pressed="true"] {
    border-color: #3b82f6;
    color: #3b82f6;
    background: transparent;
    box-shadow: none;
}

.param-btn.workspace-agent-toggle-btn.active:focus-visible,
.param-btn.workspace-agent-toggle-btn[aria-pressed="true"]:focus-visible {
    border-color: #3b82f6;
    color: #3b82f6;
    background: transparent;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.param-btn.disabled,
.param-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.param-btn.disabled:hover,
.param-btn:disabled:hover {
    border-color: #e9ecef;
    color: inherit;
}

.frame-param-btn i {
    font-size: 13px;
}

/* 原生成按钮样式（已移到输入框内，保留作为备用） */
.generate-btn:not(.input-action-btn) {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background 0.2s ease;
    align-self: flex-end;
}

.generate-btn:not(.input-action-btn):hover {
    background: #0056b3;
}

.generate-btn:not(.input-action-btn):disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* 参数面板 */
.params-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e9ecef;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 60vh;
    overflow-y: auto;
    pointer-events: auto !important;
    /* 确保面板可交互 */
    display: block;
    /* 确保面板可见 */
}

/* 当输入框固定在底部时，参数面板需要更高的z-index */
.input-area.fixed-bottom~.params-panel {
    z-index: 1001;
}

.params-panel.show {
    transform: translateY(0);
    pointer-events: auto !important;
    /* 确保显示时可交互 */
    display: block;
    /* 确保显示时可见 */
}

/* 确保参数面板内容可见 */
.params-content {
    position: relative;
    z-index: 1001;
    pointer-events: auto !important;
    /* 确保内容可交互 */
}

.params-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.param-section {
    margin-bottom: 20px;
}

.param-section h6 {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 12px;
}

.custom-prompt-box {
    border: 1px solid #edf1f5;
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
}

.custom-prompt-header {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.custom-prompt-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.custom-prompt-input {
    flex: 1;
    min-width: 180px;
    border: 1px solid #e1e6eb;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 13px;
    color: #1f2937;
    background: #ffffff;
}

.custom-prompt-name-input {
    flex: 0 0 112px;
    min-width: 96px;
}

.custom-prompt-input:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.12);
}

.custom-prompt-add-btn {
    border: 1px solid #1890ff;
    background: #1890ff;
    color: #ffffff;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
}

.custom-prompt-add-btn:hover {
    background: #0f7ae5;
    border-color: #0f7ae5;
}

.custom-prompt-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.custom-prompt-item {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.custom-prompt-item .template-option {
    margin: 0;
}

.custom-template-option[data-shortcut-name] {
    font-weight: 600;
}

.custom-prompt-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    border: 1px solid #e9ecef;
    background: #ffffff;
    color: #94a3b8;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1005;
}

.custom-prompt-remove:hover {
    border-color: #ef4444;
    color: #ef4444;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.custom-prompt-remove i {
    font-size: 10px;
}

.custom-prompt-empty {
    font-size: 12px;
    color: #94a3b8;
}

/* 选项按钮样式 */
.style-options,
.template-options,
.image-style-options,
.ratio-options,
.quality-options,
.num-images-options,
.duration-options,
.resolution-options,
.video-resolution-options,
.fps-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.template-options {
    max-height: 400px;
    /* 模板选项更多，需要更大的高度 */
}

.style-option,
.template-option,
.image-style-option,
.ratio-option,
.quality-option,
.num-images-option,
.param-option,
.duration-option,
.resolution-option,
.video-resolution-option {
    padding: 8px 16px;
    border: 1px solid #e9ecef;
    background: white;
    border-radius: 16px;
    cursor: pointer;
    font-size: 14px;
    color: #6c757d;
    transition: all 0.2s ease;
    white-space: nowrap;
    user-select: none;
}

.quality-option .quality-desc {
    font-size: 12px;
    color: #475569;
}

.quality-option.active .quality-desc {
    color: #ffffff;
}

.template-option {
    font-size: 13px;
    /* 模板选项字体稍小 */
    padding: 8px 12px;
    /* 增加内边距提高点击区域 */
    pointer-events: auto !important;
    /* 确保可点击 */
    z-index: 999 !important;
    /* 确保在最上层 */
    position: relative !important;
    /* 确保定位正确 */
    min-height: 32px;
    /* 确保最小点击区域 */
    display: inline-flex;
    /* 使用flex布局 */
    align-items: center;
    /* 垂直居中 */
    justify-content: center;
    /* 水平居中 */
}

.style-option:hover,
.template-option:hover,
.image-style-option:hover,
.ratio-option:hover,
.quality-option:hover,
.num-images-option:hover,
.param-option:hover,
.duration-option:hover,
.resolution-option:hover,
.video-resolution-option:hover {
    border-color: #1890FF;
    color: #1890FF;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(24, 144, 255, 0.2);
}

.style-option.active,
.template-option.active,
.image-style-option.active,
.ratio-option.active,
.quality-option.active,
.num-images-option.active,
.param-option.active,
.duration-option.active,
.resolution-option.active,
.video-resolution-option.active {
    background: #1890FF;
    border-color: #1890FF;
    color: white;
}

.unlimited-toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.unlimited-toggle-btn {
    border: 1px solid #e9ecef;
    background: #ffffff;
    color: #6c757d;
    border-radius: 999px;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.unlimited-toggle-btn i {
    font-size: 12px;
}

.unlimited-toggle-btn:hover {
    border-color: #1890FF;
    color: #1890FF;
    box-shadow: 0 2px 4px rgba(24, 144, 255, 0.2);
}

.unlimited-toggle-btn.active {
    background: #1890FF;
    border-color: #1890FF;
    color: #ffffff;
}

.unlimited-toggle-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.unlimited-toggle-hint {
    font-size: 12px;
    color: #94a3b8;
}

/* 视频宽高比选项 */
.video-ratio-popup h6 {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 12px;
}

.video-ratio-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(78px, 1fr)) !important;
    gap: 8px;
    width: 100%;
}

.video-ratio-option {
    flex: none !important;
    min-width: 0;
    border-radius: 11px;
    border: 2px solid #e6e6e6;
    background: #ffffff;
    color: #333333;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

@media (min-width: 640px) {
    .video-ratio-popup .video-ratio-grid {
        grid-template-columns: repeat(6, minmax(78px, 1fr)) !important;
    }
}

.video-ratio-option .ratio-icon {
    width: 28px;
    height: 38px;
    border: 2px solid #d9d9d9;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    position: relative;
    transition: all 0.2s ease;
}

.video-ratio-option .ratio-icon-inner {
    display: none;
}

.video-ratio-option .ratio-icon.landscape {
    width: 38px;
    height: 20px;
}

.video-ratio-option .ratio-icon.portrait {
    width: 20px;
    height: 38px;
}

.video-ratio-option .ratio-icon.square {
    width: 30px;
    height: 30px;
}

.video-ratio-option .ratio-icon.ultra-wide {
    width: 42px;
    height: 18px;
}

.video-ratio-option .ratio-icon.ultra-portrait {
    width: 18px;
    height: 42px;
}

.video-ratio-option .ratio-value {
    font-size: 14px;
    font-weight: 600;
    color: #333333;
}

.video-ratio-option:hover {
    border-color: #1890FF;
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.15);
}

.video-ratio-option:hover .ratio-icon {
    border-color: #1890FF;
}

.video-ratio-option.active {
    border-color: #1890FF;
    background: #f0f8ff;
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.2);
}

.video-ratio-option.active .ratio-icon {
    border-color: #1890FF;
    background: transparent;
}

.video-ratio-option.active .ratio-value {
    color: #1890FF;
}

.image-ratio-popup h6 {
    font-size: 14px;
    font-weight: 700;
    color: #e5eefc;
    margin-bottom: 12px;
}

.image-ratio-popup-options {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 7px;
}

.image-ratio-popup-option {
    border-radius: 10px;
    border: 1px solid rgba(102, 123, 161, 0.48);
    background: rgba(24, 32, 49, 0.92);
    color: #e5eefc;
    min-height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 6px;
    transition: all 0.2s ease;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
}

.image-ratio-popup-option .ratio-icon {
    width: 28px;
    height: 38px;
    border: 2px solid rgba(148, 163, 184, 0.35);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    position: relative;
    transition: all 0.2s ease;
}

.image-ratio-popup-option .ratio-icon-inner {
    display: none;
}

.image-ratio-popup-option .ratio-icon.landscape {
    width: 38px;
    height: 20px;
}

.image-ratio-popup-option .ratio-icon.portrait {
    width: 20px;
    height: 38px;
}

.image-ratio-popup-option .ratio-icon.square {
    width: 30px;
    height: 30px;
}

.image-ratio-popup-option .ratio-icon.ultra-wide {
    width: 42px;
    height: 18px;
}

.image-ratio-popup-option .ratio-icon.ultra-portrait {
    width: 18px;
    height: 42px;
}

.image-ratio-popup-option .ratio-value {
    font-size: 13px;
    font-weight: 600;
    color: #e5eefc;
    line-height: 1.25;
}

.image-ratio-popup-option:hover {
    border-color: rgba(151, 168, 202, 0.72);
    background: rgba(30, 41, 59, 0.98);
    transform: translateY(-1px);
}

.image-ratio-popup-option:hover .ratio-icon {
    border-color: rgba(151, 168, 202, 0.72);
}

.image-ratio-popup-option.active {
    border-color: rgba(226, 232, 240, 0.95);
    background: rgba(61, 78, 110, 0.96);
    box-shadow: none;
}

.image-ratio-popup-option.active .ratio-icon {
    border-color: rgba(226, 232, 240, 0.95);
}

.image-ratio-popup-option.active .ratio-value {
    color: #ffffff;
}

/* 模板选项的滚动条样式 */
.template-options::-webkit-scrollbar {
    width: 4px;
}

.template-options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.template-options::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.template-options::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 高级选项 */
.advanced-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.option-item label {
    font-size: 14px;
    color: #2c3e50;
    min-width: 80px;
}

.option-item input[type="range"] {
    flex: 1;
    max-width: 200px;
}

.option-item select {
    padding: 4px 8px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
}

.option-item input[type="checkbox"] {
    margin-right: 8px;
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* 响应式设计 */
@media (max-width: 768px) {
    .image-edit-chat-container {
        /* 移动端使用固定高度布局确保滚动正常工作 */
        height: 100vh;
        max-height: 100vh;
        padding-top: var(--mode-switcher-offset);
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        overflow: hidden; /* 防止整体页面滚动 */
    }

    .page-header {
        padding: 16px;
        flex-shrink: 0; /* 防止头部被压缩 */
    }

    .page-header h1 {
        font-size: 24px;
    }

    .media-row {
        flex-direction: column;
        gap: 12px;
        flex-wrap: wrap;
    }

    .prompt-panel {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        position: static;
        flex-basis: auto;
    }

    .generated-images.wide-two-col,
    .image-placeholder-grid.wide-two-col {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        max-width: 100%;
    }

    .chat-content-area {
        padding: 16px;
        flex: 1;
        height: calc(100vh - 64px - 180px); /* 精确计算：视口高度 - 头部高度 - 输入框高度 */
        max-height: calc(100vh - 64px - 180px);
        overflow-y: auto; /* 确保垂直滚动可用 */
        overflow-x: hidden; /* 防止水平滚动 */
        padding-bottom: 20px; /* 适度的底部间距 */
    }

    .input-area {
        padding: 16px;
    }

    .params-buttons {
        justify-content: center;
    }

    .param-btn {
        font-size: 12px;
        padding: 6px 10px;
    }

    /* 移动端生成按钮布局调整 */
    .generate-btn:not(.input-action-btn) {
        align-self: stretch;
        justify-content: center;
    }
    
    /* 输入框内的生成按钮不拉伸 */
    .input-action-btn.generate-btn {
        align-self: auto !important;
        justify-content: center;
        flex-shrink: 0;
        width: 36px;
        height: 36px;
        padding: 0;
        min-width: 36px;
        min-height: 36px;
        line-height: 1;
    }
    
    /* 移动端生成按钮显示箭头 */
    .input-action-btn.generate-btn i {
        display: inline-flex !important;
        font-size: 12px;
    }

    .input-action-btn.generate-btn span {
        display: none !important;
    }

    .message-bubble {
        max-width: 85%;
    }

    .generated-images.single-image {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        max-width: 100%;
        margin: 12px auto 0;
    }
    
    .generated-images.two-images {
        grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
        justify-content: center;
        gap: 10px;
    }
    
    .generated-images.multiple-images {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        justify-content: center;
        gap: 10px;
    }

    .image-placeholder-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }

    .image-placeholder-grid.single-image {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        max-width: 100%;
        margin: 12px auto 0;
    }

    /* 🎬 移动端横屏视频占满可用宽度（竖屏保持原尺寸） */
    .generated-images.single-image.has-landscape-video,
    .image-placeholder-grid.single-image.has-landscape-video {
        max-width: 100%;
        grid-template-columns: 1fr;
    }

    .image-placeholder-grid.two-images {
        grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
        justify-content: center;
        gap: 10px;
    }
    
    .image-placeholder-grid.multiple-images {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        justify-content: center;
        gap: 10px;
    }
    
    .generated-image img,
    .generated-video video {
        max-width: 100%; /* 移动端最大宽度为容器宽度 */
        height: auto;
        object-fit: contain;
    }
}

/* 滚动条样式 */
.chat-content-area::-webkit-scrollbar {
    width: 6px;
}

.chat-content-area::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-content-area::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-content-area::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 拖拽效果 */
.chat-input-form.drag-over,
.main-input-container.drag-over,
.image-upload-section.drag-over,
.text-input-wrapper.drag-over {
    background: rgba(0, 123, 255, 0.06);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.18);
}

html[data-theme="dark"] .chat-input-form.drag-over,
html[data-theme="dark"] .main-input-container.drag-over,
html[data-theme="dark"] .image-upload-section.drag-over,
html[data-theme="dark"] .text-input-wrapper.drag-over {
    background: rgba(59, 130, 246, 0.14);
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.32);
}

/* 用户消息中的图片样式 */
.user-image img,
.user-video video {
    max-width: 120px;
    border-radius: 8px;
    margin-bottom: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-video video {
    display: block;
    background: #000;
}

.user-prompt {
    font-size: 14px;
    line-height: 1.4;
}

/* 改进的按钮悬停效果 */
.param-btn:hover i,
.generate-btn:hover i {
    transform: scale(1.1);
}

/* 改进的消息动画 */
.message-item {
    animation: slideInUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

/* 改进的加载动画 */
.loading-spinner {
    animation: spin 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

/* 改进的图片悬停效果 */
.generated-image,
.generated-video {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.generated-image:hover,
.generated-video:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* 参数面板动画优化 */
.params-panel {
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 输入区域聚焦效果 */
.input-area:focus-within {
    box-shadow: none;
}

/* 按钮点击效果 */
.generate-btn:active {
    transform: scale(0.98);
}

.param-btn:active,
.style-option:active,
.template-option:active,
.image-style-option:active,
.ratio-option:active,
.quality-option:active,
.num-images-option:active {
    transform: scale(0.95);
}

/* 复制链接对话框样式 */
.copy-url-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.copy-dialog-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.copy-dialog-content {
    background: white;
    border-radius: 12px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideInUp 0.3s ease;
}

.copy-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.copy-dialog-header h4 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
}

.copy-dialog-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.copy-dialog-close:hover {
    background: #e9ecef;
    color: #495057;
}

.copy-dialog-body {
    padding: 1.5rem;
}

.copy-dialog-body p {
    margin: 0 0 1rem 0;
    color: #6c757d;
    font-size: 0.9rem;
}

.copy-url-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    background: #f8f9fa;
    color: #495057;
    margin-bottom: 1rem;
    word-break: break-all;
    resize: none;
    min-height: 80px;
}

.copy-url-input:focus {
    outline: none;
    border-color: #007bff;
    background: white;
}

.copy-dialog-actions {
    display: flex;
    gap: 0.75rem;
}

.copy-dialog-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid transparent;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.copy-dialog-btn.primary {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.copy-dialog-btn.primary:hover {
    background: #0056b3;
    border-color: #0056b3;
    transform: translateY(-1px);
}

.copy-dialog-btn.secondary {
    background: white;
    color: #6c757d;
    border-color: #e9ecef;
}

.copy-dialog-btn.secondary:hover {
    background: #f8f9fa;
    border-color: #ced4da;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== 多图上传预览样式 ========== */

/* 多图预览网格容器 */
.multi-image-preview-grid {
    /* Fixed-size thumbnail grid to keep previews consistent */
    --thumb-size: 140px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--thumb-size), var(--thumb-size)));
    grid-auto-rows: auto;
    gap: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
    height: auto;
    max-height: none;
    overflow: visible;
}

/* 响应式布局：2张图片时并排显示 */
/* Keep the same fixed-size layout even for two images */
.multi-image-preview-grid.two-images {
    grid-template-columns: repeat(auto-fill, minmax(var(--thumb-size), var(--thumb-size)));
}

/* 响应式布局：3张及以上图片时使用网格 */
/* And for 3+ images, keep fixed-size thumbnails as well */
.multi-image-preview-grid.multiple-images {
    grid-template-columns: repeat(auto-fill, minmax(var(--thumb-size), var(--thumb-size)));
}

/* 单个多图预览项 */
.multi-image-preview-item {
    position: relative;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
    aspect-ratio: 1;
    width: 100%;
    height: 100%;
     max-width: 80px;
    max-height: 80px;
}

.multi-image-preview-item:hover {
    border-color: #1890FF;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.15);
}

/* 多图预览中的图片 */
.multi-image-preview-item img,
.multi-image-preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
      max-width: 80px;
    max-height: 80px;
}

.multi-image-preview-item.video-reference-preview-item {
    border-color: rgba(96, 165, 250, 0.3);
    border-radius: 10px;
    background: #0b1018;
}

.multi-image-preview-item.video-reference-preview-item video {
    object-fit: contain;
    border-radius: 9px;
    background: #080d15;
    opacity: 1;
}

.multi-image-preview-item .video-reference-name {
    position: absolute;
    left: 4px;
    right: 4px;
    bottom: 18px;
    padding: 2px 4px;
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.multi-image-preview-item .image-role-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    backdrop-filter: blur(2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
    z-index: 2;
}

.image-role-badge.badge-primary {
    background: linear-gradient(135deg, #1890ff, #40a9ff);
}

.image-role-badge.badge-warning {
    background: linear-gradient(135deg, #fa8c16, #ffc069);
}

.image-role-badge.badge-info {
    background: linear-gradient(135deg, #13c2c2, #36cfc9);
}

.image-role-badge.badge-muted {
    background: rgba(0, 0, 0, 0.45);
}

.multi-image-preview-item .image-role-selector {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.multi-image-preview-item .image-role-selector label {
    font-size: 12px;
    color: #697a8d;
    white-space: nowrap;
}

.multi-image-preview-item .image-role-selector select {
    flex: 1;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #d9d9d9;
    background: #ffffff;
    font-size: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.multi-image-preview-item .image-role-selector select:focus {
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
    outline: none;
}

.multi-image-preview-item.uploading {
    opacity: 0.78;
}

.video-remix-preview {
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 12px;
    margin-top: 12px;
    background: #f9fafb;
}

.video-remix-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 600;
    color: #334155;
}

.video-remix-remove-btn {
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    font-size: 14px;
}

.video-remix-remove-btn:hover {
    color: #ef4444;
}

.video-remix-player video {
    width: 100%;
    height: 240px;
    object-fit: contain;
    border-radius: 8px;
    background: #000;
}

.video-remix-meta {
    margin-top: 6px;
    font-size: 12px;
    color: #6b7280;
    word-break: break-all;
}

.generated-video-block {
    position: relative;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
}

.generated-video-block.video-preview-card {
    cursor: pointer;
}

.generated-video-block video {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    border: 0;
    outline: none;
    background: #000;
}

.generated-video-block.video-preview-card video {
    cursor: pointer;
}

.generated-video-block .video-preview-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.36), rgba(0, 0, 0, 0.08));
}

.generated-video-block .video-preview-play {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.7);
    color: #ffffff;
    font-size: 18px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease, background 0.2s ease;
}

.generated-video-block:hover .video-preview-play {
    transform: scale(1.06);
    background: rgba(30, 64, 175, 0.78);
}

.generated-video-block .video-actions {
    position: absolute;
    right: 8px;
    top: 8px;
    display: flex;
    gap: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 3;
}

.generated-video-block:hover .video-actions,
.generated-video-block:focus-within .video-actions {
    opacity: 1;
    pointer-events: auto;
}

@media (hover: none) {
    .generated-video-block .video-actions {
        opacity: 1;
        pointer-events: auto;
    }
}

.generated-video-block .video-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.generated-video-block .video-action-btn:hover {
    background: rgba(0, 0, 0, 0.75);
}

.multi-image-uploading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(2px);
    color: #1f2937;
    font-size: 13px;
    font-weight: 600;
    z-index: 3;
}

.multi-image-uploading-overlay .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: #1890ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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


.user-multi-image-item {
    position: relative;
    display: inline-block;
}

.user-multi-image-item .image-role-tag {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    background: rgba(24, 144, 255, 0.9);
    box-shadow: 0 2px 6px rgba(24, 144, 255, 0.25);
}

/* 多图移除按钮 */
.multi-image-remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    font-size: 10px;
    z-index: 2;
}

.multi-image-preview-item:hover .multi-image-remove-btn {
    opacity: 1;
}

.multi-image-remove-btn:hover {
    background: rgba(220, 53, 69, 0.9);
    transform: scale(1.1);
}

/* 多图序号标识 */
.multi-image-index {
    position: absolute;
    bottom: 2px;
    left: 2px;
    background: rgba(24, 144, 255, 0.9);
    color: white;
    font-size: 10px;
    padding: 1px 4px;
    border-radius: 2px;
    font-weight: 500;
    line-height: 1;
}

/* 多图上传信息区域 */
.multi-upload-info {
    display: none !important;
    background: #f0f8ff;
    border: 1px solid #d4edda;
    border-radius: 6px;
    padding: 8px 12px;
    margin-top: 8px;
}

/* 内联编辑模式切换，展示在“最多支持X张”附近 */
.inline-edit-mode {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 0;
}

.inline-edit-mode .inline-options {
    display: flex;
    gap: 8px;
}

.inline-edit-mode .edit-mode-option.inline.small {
    border: 1px solid #e9ecef;
    background: #ffffff;
    color: #2c3e50;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
    transition: all 0.2s ease;
}

.inline-edit-mode .edit-mode-option.inline.small:hover {
    border-color: #1890FF;
}

.inline-edit-mode .edit-mode-option.inline.small.active {
    background: #1890FF;
    color: #fff;
    border-color: #1890FF;
}

.inline-edit-mode .edit-mode-option[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 上传统计信息 */
.upload-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    gap: 12px;
}

.upload-stats-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.current-count, .max-limit {
    font-size: 12px;
    color: #495057;
}

.current-count strong, .max-limit strong {
    color: #1890FF;
    font-weight: 600;
}

/* 上传提示 */
.upload-tip {
    display: flex;
    align-items: center;
    font-size: 11px;
    color: #6c757d;
    gap: 4px;
}

.upload-tip i {
    color: #1890FF;
    font-size: 12px;
}

/* 单图和多图模式切换 */
.single-image-preview {
    display: block;
}

.image-upload-section.multi-mode .single-image-preview {
    display: none;
}

.image-upload-section.multi-mode .multi-image-preview-grid {
    display: grid !important;
}

.image-upload-section.multi-mode .multi-upload-info {
    display: block !important;
}

/* 强制隐藏多图统计/编辑模式区域（即使进入 multi-mode） */
.image-upload-section.multi-mode #multiUploadInfo {
    display: none !important;
}

/* 兼容原有单图样式 */
.single-image-preview {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

/* 优化移动端显示 */
@media (max-width: 768px) {
    .multi-image-preview-grid {
        /* Slightly smaller thumbnails on small screens */
        --thumb-size: 110px;
        gap: 6px;
    }
    
    .multi-image-preview-grid.two-images {
        grid-template-columns: repeat(auto-fill, minmax(var(--thumb-size), var(--thumb-size)));
    }
    
    .upload-stats {
        flex-direction: column;
        gap: 4px;
        align-items: flex-start;
    }
    
    .upload-tip {
        font-size: 10px;
    }

    .inline-edit-mode {
        flex-wrap: wrap;
        gap: 6px;
    }
    .inline-edit-mode .inline-label {
        width: 100%;
        font-size: 11px;
    }
}

/* 多图编辑模式选择样式 */
.edit-mode-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.edit-mode-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.edit-mode-option:hover {
    border-color: #1890FF;
    box-shadow: 0 4px 12px rgba(24, 144, 255, 0.15);
    transform: translateY(-2px);
}

.edit-mode-option.active {
    border-color: #1890FF;
    background: linear-gradient(135deg, rgba(24, 144, 255, 0.08) 0%, rgba(24, 144, 255, 0.04) 100%);
    box-shadow: 0 4px 12px rgba(24, 144, 255, 0.2);
}

.edit-mode-option.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #1890FF 0%, #40a9ff 100%);
}

.edit-mode-option i {
    font-size: 20px;
    color: #6c757d;
    transition: color 0.3s ease;
}

.edit-mode-option.active i,
.edit-mode-option:hover i {
    color: #1890FF;
}

.option-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.option-title {
    font-weight: 600;
    color: #495057;
    font-size: 15px;
    line-height: 1.2;
}

.option-desc {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
    background: rgba(108, 117, 125, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
    width: fit-content;
}

.edit-mode-option.active .option-title {
    color: #1890FF;
}

.edit-mode-option.active .option-desc {
    color: #1890FF;
    background: rgba(24, 144, 255, 0.15);
}

/* 模式说明文字 */
.mode-explanation {
    padding: 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, rgba(24, 144, 255, 0.02) 100%);
    border-radius: 12px;
    border: 1px solid rgba(24, 144, 255, 0.1);
}

.explanation-text {
    font-size: 13px;
    line-height: 1.5;
    color: #495057;
}

.explanation-text strong {
    color: #1890FF;
    font-weight: 600;
}

/* 编辑模式按钮样式 */
#editModeBtn {
    background: linear-gradient(135deg, rgba(24, 144, 255, 0.08) 0%, rgba(24, 144, 255, 0.04) 100%);
    border: 2px solid rgba(24, 144, 255, 0.3);
}

#editModeBtn:hover {
    background: linear-gradient(135deg, rgba(24, 144, 255, 0.15) 0%, rgba(24, 144, 255, 0.08) 100%);
    border-color: #1890FF;
}

#editModeBtn i {
    color: #1890FF;
}

#editModeText {
    color: #1890FF;
    font-weight: 600;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .edit-mode-options {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .edit-mode-option {
        padding: 12px;
        gap: 8px;
    }
    
    .edit-mode-option i {
        font-size: 18px;
    }
    
    .option-title {
        font-size: 14px;
    }
    
    .option-desc {
        font-size: 11px;
    }
    
    .mode-explanation {
        padding: 12px;
    }
    
    .explanation-text {
        font-size: 12px;
    }
}

/* 图片选择弹窗中的模型支持信息样式 */
.model-support-info-panel {
    margin: 12px 0 16px 0;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.support-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6c757d;
    font-size: 13px;
}

.support-info-item i {
    color: #007bff;
    font-size: 14px;
    flex-shrink: 0;
}

#modelSupportInfoText {
    font-weight: 500;
}



/* TEXT:: 文本结果样式 */
.generated-text {
    background: #fafafa;
    border: 0;
    border-left: 3px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 14px;
    margin: 8px 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.generated-text.error-result {
    background: transparent;
    border: 0;
    padding: 0;
    margin: 8px 0 0;
    overflow: visible;
}

.generated-text.error-result .placeholder-error,
.generated-text.error-result .placeholder-timeout {
    padding: 0;
}

.text-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.text-icon {
    color: #6c757d;
    margin-top: 2px;
    font-size: 16px;
}

.text-content p {
    margin: 0;
    color: #495057;
    line-height: 1.6;
    flex: 1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    word-wrap: break-word;
    line-break: anywhere;
}

.text-actions {
    margin-top: 12px;
    text-align: right;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* MIXED:: 混合结果样式（文本+图片） */
.mixed-result {
    background: transparent;
    border: 0;
    border-radius: 12px;
    padding: 0;
    margin: 12px 0;
    box-shadow: none;
}

.mixed-result .generated-text {
    background: #fafafa;
    border: 0;
    border-left: 3px solid #e5e7eb;
    margin: 12px 0 0;
    border-radius: 8px;
}

.mixed-result .generated-image {
    margin-bottom: 8px;
    border-radius: 10px;
    overflow: hidden;
    background: transparent;
    box-shadow: none;
}

.mixed-result .generated-image img {
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@media (max-width: 768px) {
    /* 主内容区域占满宽度 */
    .main-content-wrapper {
        padding-left: 0 !important;
        /* 移动端保持flex布局，只是调整padding */
    }

    .chat-content-area {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* 给消息容器添加底部内边距，避免被输入框遮挡 */
    .messages-container {
        padding-left: 12px !important;
        padding-right: 12px !important;
        padding-bottom: 150px !important;  /* 给底部输入框留出空间 */
    }

    /* 移动端避免整体右偏：重置媒体模式左右内边距 */
    .messages-container.media-grid-mode {
        padding-left: 12px !important;
        padding-right: 12px !important;
        max-width: 100%;
    }

    /* 移动端输入框高度调整 */
    .text-input-wrapper textarea {
        min-height: 50px !important;  /* 移动端设置合适高度 */
    }

    /* 移动端参数按钮优化 */
    .params-buttons {
        flex-wrap: wrap !important;
        gap: 4px !important;
    }

    .param-btn {
        font-size: 12px !important;
        padding: 5px 8px !important;
        min-width: auto !important;
    }

    .param-btn span {
        font-size: 11px !important;
    }

    .param-btn i {
        font-size: 12px !important;
    }
}

/* 移动端生成区：单图和 loading 占位符不再沿用桌面缩略图宽度 */
@media (max-width: 768px) {
    .message-item.has-media-grid .media-row {
        width: 100%;
        padding-left: 0;
    }

    .message-item.has-media-grid .media-grid {
        width: 100%;
        min-width: 0;
    }

    .message-item.has-media-grid .image-placeholder-grid.single-image,
    .message-item.has-media-grid .generated-images.single-image {
        width: 100%;
        max-width: 100%;
        grid-template-columns: minmax(0, 1fr);
        justify-content: stretch;
        margin-left: 0;
        margin-right: 0;
    }

    .message-item.has-media-grid .image-placeholder-grid.single-image .image-placeholder,
    .message-item.has-media-grid .generated-images.single-image .generated-image,
    .message-item.has-media-grid .generated-images.single-image .generated-video {
        width: 100%;
    }

    .message-item.has-media-grid .image-placeholder-grid.single-image .image-placeholder {
        min-height: clamp(180px, 52vw, 360px);
    }

    .message-item.has-media-grid .image-placeholder-grid.single-image .image-placeholder[style*="aspect-ratio"] {
        min-height: 0;
    }

    .message-item.has-media-grid .image-placeholder-grid.single-image .placeholder-content {
        min-height: inherit;
    }
}

/* 🔥 模式切换器样式 */
.mode-switcher-container {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 30px;
    padding: 4px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.mode-switcher {
    display: flex;
    gap: 4px;
}

/* English layout: show AI Video first, then Agent, then AI Image */
html[lang="en"] .mode-switcher #videoModeBtn {
    order: 1;
}

html[lang="en"] .mode-switcher #agentModeBtn {
    order: 2;
}

html[lang="en"] .mode-switcher #imageModeBtn {
    order: 3;
}

.session-layout-switcher {
    position: fixed;
    top: 70px;
    right: max(20px, calc(env(safe-area-inset-right, 0px) + 20px));
    z-index: 110;
    display: inline-flex;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}

.layout-toggle-btn {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.layout-toggle-btn:hover {
    background: rgba(59, 130, 246, 0.12);
    color: #1f2933;
}

.layout-toggle-btn.is-active {
    background: rgba(15, 23, 42, 0.08);
    color: #1f2933;
    border: 1px solid rgba(148, 163, 184, 0.45);
    box-shadow: none;
}

.image-editor-embedded-chat .session-layout-switcher {
    right: max(20px, calc(env(safe-area-inset-right, 0px) + 20px));
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border: none;
    background: transparent;
    color: #666;
    border-radius: 26px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    outline: none;
}

.mode-btn:hover {
    background: rgba(0, 123, 255, 0.05);
    color: #333;
}

.mode-btn.active {
    background: #1890FF;
    color: white;
    box-shadow: 0 4px 15px rgba(24, 144, 255, 0.3);
}

.mode-btn i {
    font-size: 16px;
}

/* 视频模式专用按钮样式 */
.param-btn.video-only {
    transition: all 0.3s ease;
}

/* 移动端响应式 - 模式切换器 */
@media (max-width: 768px) {
    .mode-switcher-container {
        top: 60px;
        left: 50%;
        transform: translateX(-50%) scale(0.9);
    }

    .session-layout-switcher {
        top: 60px;
        right: max(12px, calc(env(safe-area-inset-right, 0px) + 12px));
        padding: 4px 6px;
    }

    .layout-toggle-btn {
        width: 34px;
        height: 34px;
    }

    .mode-btn {
        padding: 6px 16px;
        font-size: 13px;
    }

    .mode-btn span {
        display: none;
    }

    .mode-btn i {
        font-size: 18px;
    }
}

html[data-theme="dark"] .session-layout-switcher {
    background: rgba(15, 15, 16, 0.95);
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .layout-toggle-btn {
    color: #a1a1aa;
}

html[data-theme="dark"] .layout-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #f4f4f5;
}

html[data-theme="dark"] .layout-toggle-btn.is-active {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border: none;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

/* ===== Veo Video Role Enhancements ===== */
.video-role-hint {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(24, 144, 255, 0.08);
    border: 1px solid rgba(24, 144, 255, 0.25);
    color: #1d39c4;
    font-size: 12px;
    line-height: 1.4;
    display: none;
    align-items: center;
    gap: 8px;
}

.video-role-hint i {
    color: #1890FF;
    font-size: 14px;
}

.video-role-hint span {
    flex: 1;
}

@media (max-width: 768px) {
    .referral-invite-banner {
        margin: 16px 0;
        font-size: 14px;
    }

    .multi-image-preview-item .image-role-selector {
        flex-direction: column;
        align-items: flex-start;
    }

    .multi-image-preview-item .image-role-selector select {
        width: 100%;
    }

    .video-role-hint {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ==================== 滚动提示样式 ==================== */

/* 滚动提示 - 简洁版（无按钮，用于placeholder模式） */
.scrolling-tips-simple {
    padding: 8px 12px;
    background: linear-gradient(135deg, #f0f9ff, #e6f7ff);
    border-radius: 8px;
    margin-top: 8px;
    border: 1px solid #91d5ff;
    font-size: 13px;
    color: #096dd9;
    line-height: 1.4;
    text-align: center;
}

.scrolling-tips-simple span {
    display: block;
    animation: fadeIn 0.5s ease;
}

/* 滚动提示 - 完整版（带按钮） */
.scrolling-tips {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f0f9ff, #e6f7ff);
    border-radius: 8px;
    margin-top: 8px;
    border: 1px solid #91d5ff;
    transition: all 0.3s ease;
}

.scrolling-tips:hover {
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.15);
}

.tip-nav-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid #91d5ff;
    background: white;
    color: #1890FF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.tip-nav-btn:hover:not(:disabled) {
    background: #1890FF;
    color: white;
    transform: scale(1.1);
}

.tip-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.tip-nav-btn i {
    font-size: 12px;
}

.tip-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #096dd9;
    min-height: 24px;
}

.tip-content i {
    color: #faad14;
    font-size: 14px;
    flex-shrink: 0;
}

.tip-content span {
    line-height: 1.4;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-3px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

html[data-theme="dark"] .image-edit-chat-container {
    background: var(--bg-color);
    color: var(--text-color);
}

html[data-theme="dark"] .main-content-wrapper {
    background: var(--bg-color);
}

html[data-theme="dark"] .chat-content-area {
    color: var(--text-color);
}

html[data-theme="dark"] .welcome-message {
    color: var(--secondary-text);
}

html[data-theme="dark"] .ai-message .message-bubble {
    background: #0D0D0D;
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.22);
    box-shadow: 0 8px 20px rgba(8, 12, 20, 0.55);
}

html[data-theme="dark"] .ai-message .message-bubble.wide-bubble,
html[data-theme="dark"] .message-item.has-media-grid .message-bubble {
    background: rgba(13, 13, 13, 0.98);
    border: 0;
    box-shadow: 0 22px 56px rgba(0, 0, 0, 0.5), 0 8px 22px rgba(2, 6, 23, 0.32);
}

html[data-theme="dark"] .system-message .message-bubble {
    background: var(--surface-muted);
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-theme="dark"] .generated-text {
    background: #111926;
    border-left: 3px solid rgba(148, 163, 184, 0.4);
    color: #e2e8f0;
}

html[data-theme="dark"] .generated-text.error-result {
    background: transparent;
    border: 0;
}

html[data-theme="dark"] .text-icon {
    color: #9aa3b2;
}

html[data-theme="dark"] .text-content p {
    color: #e2e8f0;
}

html[data-theme="dark"] .agent-streaming .message-bubble {
    background: #0D0D0D;
    border: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: 0 8px 20px rgba(8, 12, 20, 0.55);
    padding: 12px 16px;
}

html[data-theme="dark"] .agent-streaming .generated-text,
html[data-theme="dark"] .agent-streaming .text-content {
    background: transparent;
    border: 0;
    color: #e2e8f0;
}

html[data-theme="dark"] .style-option,
html[data-theme="dark"] .template-option,
html[data-theme="dark"] .image-style-option,
html[data-theme="dark"] .ratio-option,
html[data-theme="dark"] .quality-option,
html[data-theme="dark"] .num-images-option,
html[data-theme="dark"] .param-option,
html[data-theme="dark"] .duration-option,
html[data-theme="dark"] .resolution-option,
html[data-theme="dark"] .video-resolution-option,
html[data-theme="dark"] .video-ratio-option {
    background: transparent;
    border-color: rgba(148, 163, 184, 0.35);
    color: #e2e8f0;
    box-shadow: none;
}

html[data-theme="dark"] .video-ratio-option .ratio-value {
    color: #e2e8f0;
}

html[data-theme="dark"] .style-option:hover,
html[data-theme="dark"] .template-option:hover,
html[data-theme="dark"] .image-style-option:hover,
html[data-theme="dark"] .ratio-option:hover,
html[data-theme="dark"] .quality-option:hover,
html[data-theme="dark"] .num-images-option:hover,
html[data-theme="dark"] .param-option:hover,
html[data-theme="dark"] .duration-option:hover,
html[data-theme="dark"] .resolution-option:hover,
html[data-theme="dark"] .video-resolution-option:hover,
html[data-theme="dark"] .video-ratio-option:hover {
    border-color: rgba(148, 163, 184, 0.6);
    background: transparent;
    color: #f1f5f9;
    box-shadow: 0 4px 12px rgba(8, 12, 20, 0.4);
}

html[data-theme="dark"] .video-ratio-option:hover .ratio-value {
    color: #f1f5f9;
}

html[data-theme="dark"] .style-option.active,
html[data-theme="dark"] .template-option.active,
html[data-theme="dark"] .image-style-option.active,
html[data-theme="dark"] .ratio-option.active,
html[data-theme="dark"] .quality-option.active,
html[data-theme="dark"] .num-images-option.active,
html[data-theme="dark"] .param-option.active,
html[data-theme="dark"] .duration-option.active,
html[data-theme="dark"] .resolution-option.active,
html[data-theme="dark"] .video-resolution-option.active,
html[data-theme="dark"] .video-ratio-option.active {
    background: transparent;
    border-color: rgba(226, 232, 240, 0.9);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(8, 12, 20, 0.45);
}

html[data-theme="dark"] .unlimited-toggle-btn {
    background: #111926;
    border-color: rgba(148, 163, 184, 0.22);
    color: #cbd5e1;
    box-shadow: none;
}

html[data-theme="dark"] .unlimited-toggle-btn:hover {
    border-color: rgba(148, 163, 184, 0.45);
    background: #1a2433;
    color: #e2e8f0;
}

html[data-theme="dark"] .unlimited-toggle-btn.active {
    background: #1890FF;
    border-color: #1890FF;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(24, 144, 255, 0.35);
}

html[data-theme="dark"] .unlimited-toggle-hint {
    color: #94a3b8;
}

html[data-theme="dark"] .quality-option .quality-desc {
    color: #9aa3b2;
}

html[data-theme="dark"] .quality-option.active .quality-desc {
    color: #f8fafc;
}

html[data-theme="dark"] .video-ratio-option .ratio-icon {
    background: transparent;
    border-color: rgba(148, 163, 184, 0.25);
}

html[data-theme="dark"] .video-ratio-option .ratio-icon-inner {
    background: rgba(148, 163, 184, 0.35);
}

html[data-theme="dark"] .video-ratio-option.active .ratio-icon {
    background: transparent;
    border-color: rgba(148, 163, 184, 0.6);
}

html[data-theme="dark"] .video-ratio-option.active .ratio-icon-inner {
    background: #e2e8f0;
}

html[data-theme="dark"] .image-ratio-popup h6 {
    color: #f8fafc;
}

html[data-theme="dark"] .image-ratio-popup-option {
    background: rgba(24, 32, 49, 0.92);
    border-color: rgba(102, 123, 161, 0.48);
    color: #e2e8f0;
    box-shadow: none;
}

html[data-theme="dark"] .image-ratio-popup-option .ratio-icon {
    background: transparent;
    border-color: rgba(148, 163, 184, 0.35);
}

html[data-theme="dark"] .image-ratio-popup-option .ratio-icon-inner {
    display: none;
}

html[data-theme="dark"] .image-ratio-popup-option .ratio-value {
    color: #e2e8f0;
}

html[data-theme="dark"] .image-ratio-popup-option:hover {
    border-color: rgba(151, 168, 202, 0.72);
    background: rgba(30, 41, 59, 0.98);
}

html[data-theme="dark"] .image-ratio-popup-option:hover .ratio-icon {
    border-color: rgba(151, 168, 202, 0.72);
}

html[data-theme="dark"] .image-ratio-popup-option.active {
    border-color: rgba(226, 232, 240, 0.95);
    background: rgba(61, 78, 110, 0.96);
}

html[data-theme="dark"] .image-ratio-popup-option.active .ratio-icon {
    border-color: rgba(226, 232, 240, 0.95);
}

html[data-theme="dark"] .image-ratio-popup-option.active .ratio-value {
    color: #ffffff;
}

html[data-theme="dark"] .param-section h6,
html[data-theme="dark"] .custom-prompt-header {
    color: #e2e8f0;
}

html[data-theme="dark"] .custom-prompt-box {
    background: #111926;
    border-color: rgba(148, 163, 184, 0.22);
}

html[data-theme="dark"] .custom-prompt-input {
    background: #0f1622;
    border-color: rgba(148, 163, 184, 0.25);
    color: #e2e8f0;
}

html[data-theme="dark"] .custom-prompt-input::placeholder {
    color: #8c9ab0;
}

html[data-theme="dark"] .custom-prompt-input:focus {
    border-color: rgba(59, 130, 246, 0.8);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

html[data-theme="dark"] .custom-prompt-empty {
    color: #8c9ab0;
}

html[data-theme="dark"] .custom-prompt-remove {
    background: #0f1622;
    border-color: rgba(148, 163, 184, 0.25);
    color: #9aa3b2;
}

html[data-theme="dark"] .retry-notice {
    background: rgba(165, 27, 45, 0.15);
    border-color: rgba(220, 53, 69, 0.4);
    color: #f2b8be;
}

html[data-theme="dark"] .input-area {
    background: linear-gradient(180deg, rgba(16, 18, 20, 0.96), rgba(13, 16, 20, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

html[data-theme="dark"] .text-input-wrapper {
    background: transparent;
    border: none;
    box-shadow: none;
}

html[data-theme="dark"] .prompt-rich-overlay {
    color: #e2e8f0;
}

html[data-theme="dark"] .prompt-rich-chip {
    background: #1e293b;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.32);
}

html[data-theme="dark"] .text-input-wrapper textarea {
    color: #e2e8f0;
    caret-color: #e2e8f0;
    -webkit-text-fill-color: #e2e8f0;
}

html[data-theme="dark"] .prompt-rich-input.is-preview textarea {
    color: transparent;
    -webkit-text-fill-color: transparent;
}

html[data-theme="dark"] .prompt-rich-input.is-preview:not(.is-editing) textarea {
    caret-color: transparent;
}

html[data-theme="dark"] .prompt-lexical-editor {
    color: #e2e8f0;
    caret-color: #e2e8f0;
}

html[data-theme="dark"] .prompt-lexical-editor.is-empty::before {
    color: #94a3b8;
}

html[data-theme="dark"] .prompt-lexical-mention {
    background: rgba(56, 189, 248, 0.16);
    color: #d7ff31;
}

html[data-theme="dark"] .prompt-lexical-mention-icon {
    background: rgba(148, 163, 184, 0.16);
    color: #e2e8f0;
}

html[data-theme="dark"] .prompt-mention-menu {
    border-color: rgba(71, 85, 105, 0.55);
    background: rgba(15, 23, 42, 0.94);
    box-shadow: 0 24px 60px rgba(2, 8, 23, 0.52);
}

html[data-theme="dark"] .prompt-mention-menu-hint {
    color: #94a3b8;
}

html[data-theme="dark"] .prompt-mention-item:hover,
html[data-theme="dark"] .prompt-mention-item.is-active {
    background: rgba(56, 189, 248, 0.12);
}

html[data-theme="dark"] .prompt-mention-token {
    color: #e2e8f0;
}

html[data-theme="dark"] .prompt-mention-name {
    color: #94a3b8;
}

html[data-theme="dark"] .prompt-mention-empty {
    color: #94a3b8;
    background: rgba(51, 65, 85, 0.5);
}

html[data-theme="dark"] .text-input-wrapper textarea {
    color: var(--input-text);
}

html[data-theme="dark"] .text-input-wrapper textarea::placeholder {
    color: var(--secondary-text);
}

html[data-theme="dark"] .prompt-welcome-message {
    color: var(--text-color);
}

html[data-theme="dark"] .workspace-prompt-presets {
    border-top-color: rgba(148, 163, 184, 0.2);
}

html[data-theme="dark"] .workspace-prompt-presets__tab {
    background: transparent;
    border: none;
    color: #cbd5e1;
}

html[data-theme="dark"] .workspace-prompt-presets__tab:hover,
html[data-theme="dark"] .workspace-prompt-presets__tab.is-active {
    background: rgba(37, 99, 235, 0.18);
    color: #f8fafc;
}

html[data-theme="dark"] .workspace-prompt-presets__prompt {
    color: #cbd5e1;
}

html[data-theme="dark"] .workspace-prompt-presets__prompt i {
    color: #64748b;
}

html[data-theme="dark"] .workspace-prompt-presets__prompt:hover {
    color: #f8fafc;
}

html[data-theme="dark"] .workspace-prompt-presets__prompt:hover i {
    color: #93c5fd;
}

html[data-theme="dark"] .workspace-prompt-presets__body.is-animating .workspace-prompt-presets__prompt {
    animation-name: workspacePresetSlideIn;
}

html[data-theme="dark"] .prompt-panel {
    background: rgba(148, 163, 184, 0.045);
    border: 0;
    box-shadow: none;
}

html[data-theme="dark"] .prompt-panel .prompt-title {
    color: #e2e8f0;
}

html[data-theme="dark"] .prompt-panel .prompt-title i,
html[data-theme="dark"] .prompt-action-btn {
    color: #94a3b8;
}

html[data-theme="dark"] .prompt-action-btn:hover {
    background: rgba(148, 163, 184, 0.2);
    color: #e2e8f0;
}

html[data-theme="dark"] .prompt-text {
    color: #cbd5f5;
}

html[data-theme="dark"] .prompt-text::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
}

html[data-theme="dark"] .prompt-model {
    color: #94a3b8;
}

html[data-theme="dark"] .image-upload-section {
    background: var(--surface-muted);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .multi-image-preview-grid {
    background: #131517;
    border: 1px solid #2b3142;
}

html[data-theme="dark"] .multi-image-preview-item {
    background: #0f141b;
    border-color: #2b3142;
}

html[data-theme="dark"] .multi-image-preview-item:hover {
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 6px 14px rgba(8, 12, 20, 0.45);
}

html[data-theme="dark"] .multi-image-uploading-overlay {
    background: rgba(15, 20, 27, 0.8);
    color: #e2e8f0;
}

html[data-theme="dark"] .multi-image-uploading-overlay .spinner {
    border-color: rgba(226, 232, 240, 0.25);
    border-top-color: #60a5fa;
}

html[data-theme="dark"] .multi-upload-info {
    background: #131517;
    border-color: #2b3142;
}

html[data-theme="dark"] .inline-edit-mode .inline-label,
html[data-theme="dark"] .upload-stats,
html[data-theme="dark"] .upload-tip {
    color: #9aa3b2;
}

html[data-theme="dark"] .inline-edit-mode .edit-mode-option.inline.small {
    background: #0f141b;
    border-color: #2b3142;
    color: #cbd5e1;
}

html[data-theme="dark"] .inline-edit-mode .edit-mode-option.inline.small.active {
    background: #2b3240;
    border-color: rgba(148, 163, 184, 0.6);
    color: #f8fafc;
}

html[data-theme="dark"] .image-placeholder {
    background: var(--surface-muted);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .image-placeholder.error,
html[data-theme="dark"] .image-placeholder.timeout {
    background: transparent !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .generated-video-block {
    border-color: rgba(148, 163, 184, 0.22);
    background: #000;
}

html[data-theme="dark"] .generated-video video,
html[data-theme="dark"] .generated-video-block video {
    border: 0;
    outline: none;
    background: #000;
}

html[data-theme="dark"] .skeleton-thumbnail,
html[data-theme="dark"] .skeleton-line {
    background: linear-gradient(90deg, #1f2635 25%, #2a3245 50%, #1f2635 75%);
}

html[data-theme="dark"] .mode-switcher-container {
    background: rgba(15, 15, 16, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .mode-btn {
    color: #a1a1aa;
}

html[data-theme="dark"] .mode-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #f4f4f5;
}

html[data-theme="dark"] .mode-btn.active {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

/* Only desktop Image adopts Workspace's composer mode controls. */
.image-edit-chat-container [data-image-mode-slot] {
    display: none;
}

@media (min-width: 769px) {
    .image-edit-chat-container .workspace-input-mode-switcher {
        display: flex;
        justify-content: flex-start;
        margin: 0 0 12px;
    }

    .image-edit-chat-container .workspace-input-mode-switcher .mode-switcher-container {
        position: static;
        inset: auto;
        transform: none;
        width: fit-content;
        max-width: 100%;
        margin: 0;
        padding: 4px;
        border: none;
        border-radius: 12px;
        background: rgba(148, 163, 184, 0.09);
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        z-index: auto;
    }

    .image-edit-chat-container .workspace-input-mode-switcher .mode-btn {
        min-width: 72px;
        justify-content: center;
        padding: 8px 18px;
        border-radius: 9px;
        font-size: 14px;
        font-weight: 500;
        box-shadow: none;
    }

    .image-edit-chat-container .workspace-input-mode-switcher .mode-btn.active {
        background: rgba(148, 163, 184, 0.18);
        color: var(--text-color);
        box-shadow: none;
    }

    .image-edit-chat-container .workspace-input-mode-switcher .mode-btn i {
        display: none;
    }

    .image-edit-chat-container .workspace-input-mode-switcher .mode-btn span {
        display: inline;
    }

    .image-edit-chat-container .workspace-input-mode-switcher .mode-btn:focus-visible {
        outline: 2px solid var(--primary-color, #3b82f6);
        outline-offset: 2px;
    }
}

html[data-theme="dark"] .param-btn {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.08);
    color: #c4ccd8;
}

html[data-theme="dark"] .param-btn:hover {
    border-color: rgba(67, 132, 255, 0.6);
    color: #e8eef8;
    background: transparent;
}

html[data-theme="dark"] .param-btn.active {
    border-color: #2b6dff;
    background: transparent;
    color: #9fbfff;
}

html[data-theme="dark"] .param-btn.workspace-agent-toggle-btn:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: #e8eef8;
    background: transparent;
}

html[data-theme="dark"] .param-btn.workspace-agent-toggle-btn:focus {
    border-color: rgba(255, 255, 255, 0.2);
    color: #e8eef8;
    background: transparent;
    box-shadow: none;
}

html[data-theme="dark"] .param-btn.workspace-agent-toggle-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}

html[data-theme="dark"] .param-btn.workspace-agent-toggle-btn.active,
html[data-theme="dark"] .param-btn.workspace-agent-toggle-btn[aria-pressed="true"] {
    border-color: #60a5fa;
    color: #bfdbfe;
    background: transparent;
    box-shadow: none;
}

html[data-theme="dark"] .param-btn.workspace-agent-toggle-btn.active:focus-visible,
html[data-theme="dark"] .param-btn.workspace-agent-toggle-btn[aria-pressed="true"]:focus-visible {
    border-color: #60a5fa;
    color: #bfdbfe;
    background: transparent;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

.reference-audio-preview {
    margin-top: 8px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--surface-muted);
    padding: 10px;
}

.reference-audio-preview.compact-audio-preview {
    margin-top: 0;
    border: 0;
    background: transparent;
    padding: 0;
    width: fit-content;
    max-width: 100%;
}

.reference-audio-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--secondary-text);
    font-size: 13px;
    font-weight: 600;
}

.reference-audio-preview.compact-audio-preview .reference-audio-header {
    margin-bottom: 10px;
    padding: 0;
}

.reference-audio-clear-btn,
.reference-audio-remove-btn {
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--secondary-text);
    background: transparent;
}

.reference-audio-clear-btn:hover,
.reference-audio-remove-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
}

.reference-audio-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.reference-audio-item {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 5px;
    padding: 8px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

.reference-audio-icon {
    width: 26px;
    height: 26px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 99, 235, 0.12);
    color: #2563eb;
    font-size: 13px;
}

.reference-audio-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 10px;
    color: var(--secondary-text);
}

.reference-audio-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-color);
}

.reference-audio-token {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    font-size: 10px;
    font-weight: 700;
}

.reference-audio-detail {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reference-audio-item .reference-audio-remove-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    background: rgba(15, 23, 42, 0.06);
}

/* /image: generated content and progress must never sit behind the composer.
 * The main Image page starts with fixed-bottom; turn it into a real flex dock
 * so the main content owns only the remaining height. */
.image-edit-chat-container > .input-area.fixed-bottom {
    position: relative !important;
    inset: auto !important;
    flex: 0 0 auto;
    transform: none !important;
    width: min(1040px, calc(100% - 40px)) !important;
    max-width: 1040px !important;
    margin: 0 auto 15px !important;
}

.image-edit-chat-container > .input-area.fixed-bottom .chat-input-form {
    width: 100%;
    max-width: none;
}

.image-edit-chat-container .chat-content-area.with-fixed-input {
    padding-bottom: 20px;
    scroll-padding-bottom: 20px;
}

/* Grid uses the whole viewport as a media canvas. Keep the composer as a
 * bottom overlay here so its in-flow height does not leave an empty band
 * across the gallery. Chat mode keeps the docked flex layout above. */
.image-edit-chat-container:has(.chat-content-area.grid-mode) > .input-area.fixed-bottom {
    position: fixed !important;
    top: auto !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    transform: none !important;
    margin: 0 auto !important;
}

.image-edit-chat-container .chat-content-area.grid-mode.with-fixed-input {
    padding-bottom: 20px;
    scroll-padding-bottom: var(--input-area-fixed-height, 20px);
}

/* Keep references usable without allowing them to consume the whole viewport. */
.image-edit-chat-container > .input-area.fixed-bottom .image-upload-section {
    max-height: min(180px, 24vh);
    overflow: auto;
    overscroll-behavior: contain;
}

.image-edit-chat-container > .input-area.fixed-bottom .multi-image-preview-grid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 80px;
    grid-auto-rows: 80px;
    justify-content: start;
    max-height: 96px;
    overflow-x: auto;
    overflow-y: hidden;
}

.image-edit-chat-container > .input-area.fixed-bottom .reference-audio-list {
    flex-wrap: nowrap;
    overflow-x: auto;
}

/* Primary creation controls: make the billing mode and submit action readable
 * without relying on a tiny icon or detached cost badge. */
#unlimitedToggleBtn {
    position: relative;
    min-height: 40px;
    padding: 8px 48px 8px 14px;
    border-color: rgba(24, 144, 255, 0.28);
    background: rgba(24, 144, 255, 0.06);
    color: #60a5fa;
    font-weight: 700;
}

#unlimitedToggleBtn i {
    display: none;
}

#unlimitedToggleBtn::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 8px;
    width: 36px;
    height: 22px;
    border-radius: 999px;
    background: #596273;
    transform: translateY(-50%);
    transition: background 0.2s ease;
}

#unlimitedToggleBtn::before {
    content: '';
    position: absolute;
    z-index: 1;
    top: 50%;
    right: 26px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
    transform: translateY(-50%);
    transition: transform 0.2s ease;
}

#unlimitedToggleBtn:hover {
    border-color: rgba(24, 144, 255, 0.62);
    color: #80bfff;
    background: rgba(24, 144, 255, 0.1);
}

#unlimitedToggleBtn.active {
    border-color: rgba(24, 144, 255, 0.48);
    background: rgba(24, 144, 255, 0.1);
    color: #80bfff;
}

#unlimitedToggleBtn.active::after {
    background: #1890ff;
}

#unlimitedToggleBtn.active::before {
    transform: translate(16px, -50%);
}

#unlimitedToggleBtn.disabled {
    opacity: 0.48;
}

@media (min-width: 769px) {
    .image-edit-chat-container > .input-area.fixed-bottom .main-input-container,
    .input-area .main-input-container {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 132px;
        grid-template-rows: minmax(84px, auto) auto;
        grid-template-areas:
            "prompt prompt"
            "params action";
        column-gap: 16px;
        row-gap: 12px;
    }

    .input-area .text-input-wrapper {
        grid-area: prompt;
        min-width: 0;
        min-height: 84px;
        align-items: flex-start;
        padding: 4px 0 2px;
    }

    .input-area .text-input-wrapper textarea {
        max-height: 96px;
    }

    .input-area .text-input-wrapper .input-actions {
        align-self: center;
    }

    .input-area .params-buttons {
        grid-area: params;
        min-width: 0;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        overscroll-behavior-x: contain;
        padding: 1px 1px 3px;
    }

    .input-area .params-buttons::-webkit-scrollbar {
        display: none;
    }

    .input-area .params-buttons > * {
        flex: 0 0 auto;
    }

    /* Keep the control row quiet: filled surfaces carry hierarchy without a
       ring around every option. */
    .input-area .params-buttons .param-btn {
        min-height: 40px;
        border-color: transparent;
        border-radius: 12px;
        background: rgba(148, 163, 184, 0.12);
        box-shadow: none;
    }

    html[data-theme="dark"] .input-area .params-buttons .param-btn {
        border-color: transparent;
        background: rgba(255, 255, 255, 0.07);
    }

    .input-area .params-buttons .param-btn:hover {
        border-color: transparent;
        background: rgba(148, 163, 184, 0.2);
    }

    html[data-theme="dark"] .input-area .params-buttons .param-btn:hover {
        border-color: transparent;
        background: rgba(255, 255, 255, 0.11);
    }

    .input-area .params-buttons .param-btn.active,
    .input-area .params-buttons .param-btn[aria-pressed="true"] {
        border-color: transparent;
        background: rgba(37, 99, 235, 0.14);
    }

    .input-area .params-buttons #unlimitedToggleBtn,
    .input-area .params-buttons #unlimitedToggleBtn:hover,
    .input-area .params-buttons #unlimitedToggleBtn.active {
        border-color: transparent;
        background: rgba(24, 144, 255, 0.12);
    }

    .input-area .params-buttons .image-upload-btn {
        border-radius: 12px;
    }

    /* Image output settings use one compact visual control:
       9:16 · 1K · 1 image. Each segment stays independently clickable. */
    .input-area .params-buttons:has(#imageSizeBtn:not([style*="display: none"])) #ratioBtn {
        border-radius: 12px 0 0 12px;
        padding-right: 10px;
    }

    .input-area .params-buttons:has(#imageSizeBtn:not([style*="display: none"])) #imageSizeBtn,
    .input-area .params-buttons:has(#imageSizeBtn:not([style*="display: none"])) #numImagesBtn {
        margin-left: -8px;
        padding-left: 0;
        border-radius: 0;
    }

    .input-area .params-buttons:has(#imageSizeBtn:not([style*="display: none"])) #numImagesBtn {
        border-radius: 0 12px 12px 0;
        padding-right: 14px;
    }

    .input-area .params-buttons:has(#imageSizeBtn:not([style*="display: none"])) #ratioBtn i,
    .input-area .params-buttons:has(#imageSizeBtn:not([style*="display: none"])) #imageSizeBtn i,
    .input-area .params-buttons:has(#imageSizeBtn:not([style*="display: none"])) #numImagesBtn i {
        display: none;
    }

    .input-area .params-buttons:has(#imageSizeBtn:not([style*="display: none"])) #imageSizeBtn::before,
    .input-area .params-buttons:has(#imageSizeBtn:not([style*="display: none"])) #numImagesBtn::before {
        content: '·';
        margin: 0 10px 0 2px;
        color: currentColor;
        font-size: 15px;
        font-weight: 800;
    }

    /* Nano Banana exposes 1K/2K/4K through the quality control instead of
       imageSizeBtn. Keep the same 9:16 · 1K · 1 image visual group. */
    .input-area .params-buttons.is-image-output-quality-group #ratioBtn {
        border-radius: 12px 0 0 12px;
        padding-right: 10px;
    }

    .input-area .params-buttons.is-image-output-quality-group #imageQualityBtn,
    .input-area .params-buttons.is-image-output-quality-group #numImagesBtn {
        margin-left: -8px;
        padding-left: 0;
        border-radius: 0;
    }

    .input-area .params-buttons.is-image-output-quality-group #numImagesBtn {
        border-radius: 0 12px 12px 0;
        padding-right: 14px;
    }

    .input-area .params-buttons.is-image-output-quality-group #ratioBtn i,
    .input-area .params-buttons.is-image-output-quality-group #imageQualityBtn i,
    .input-area .params-buttons.is-image-output-quality-group #numImagesBtn i {
        display: none;
    }

    .input-area .params-buttons.is-image-output-quality-group #imageQualityBtn::before,
    .input-area .params-buttons.is-image-output-quality-group #numImagesBtn::before {
        content: '·';
        margin: 0 10px 0 2px;
        color: currentColor;
        font-size: 15px;
        font-weight: 800;
    }

    /* In video mode, ratio, resolution and duration read as one compact
       control: 16:9 · 720p · 4s. The buttons remain individually clickable. */
    .input-area .params-buttons:has(#videoResolutionBtn:not([style*="display: none"])) #ratioBtn {
        border-radius: 12px 0 0 12px;
        padding-right: 10px;
    }

    .input-area .params-buttons:has(#videoResolutionBtn:not([style*="display: none"])) #videoResolutionBtn,
    .input-area .params-buttons:has(#videoResolutionBtn:not([style*="display: none"])) #durationBtn {
        margin-left: -8px;
        padding-left: 0;
        border-radius: 0;
    }

    .input-area .params-buttons:has(#videoResolutionBtn:not([style*="display: none"])) #durationBtn {
        border-radius: 0 12px 12px 0;
        padding-right: 14px;
    }

    .input-area .params-buttons:has(#videoResolutionBtn:not([style*="display: none"])) #ratioBtn i,
    .input-area .params-buttons:has(#videoResolutionBtn:not([style*="display: none"])) #videoResolutionBtn i,
    .input-area .params-buttons:has(#videoResolutionBtn:not([style*="display: none"])) #durationBtn i {
        display: none;
    }

    .input-area .params-buttons:has(#videoResolutionBtn:not([style*="display: none"])) #videoResolutionBtn::before,
    .input-area .params-buttons:has(#videoResolutionBtn:not([style*="display: none"])) #durationBtn::before {
        content: '·';
        margin: 0 10px 0 2px;
        color: currentColor;
        font-size: 15px;
        font-weight: 800;
    }

    .input-area .composer-primary-action {
        grid-area: action;
        display: flex;
        min-width: 0;
        height: 44px;
        align-self: center;
    }

    .input-area .composer-primary-action .input-action-btn.generate-btn {
        display: flex;
        width: 100%;
        min-width: 132px;
        height: 44px;
        min-height: 44px;
        padding: 10px 14px;
        border-radius: 14px;
        background: linear-gradient(135deg, #2588ff 0%, #5267f5 100%);
        color: #ffffff;
        box-shadow: 0 10px 28px rgba(24, 144, 255, 0.2);
        align-items: center;
        justify-content: center;
        flex-wrap: nowrap;
        gap: 6px;
        font-size: 16px;
        font-weight: 800;
        line-height: 1.15;
        letter-spacing: -0.01em;
    }

    .input-area .composer-primary-action .input-action-btn.generate-btn:hover {
        background: linear-gradient(135deg, #3b97ff 0%, #6778ff 100%);
        color: #ffffff;
        box-shadow: 0 14px 34px rgba(24, 144, 255, 0.3);
        transform: translateY(-1px);
    }

    .input-area .composer-primary-action .input-action-btn.generate-btn i {
        display: none;
    }

    .input-area .composer-primary-action .input-action-btn.generate-btn span {
        display: inline-flex;
        position: static;
        inset: auto;
    }

    .input-area .composer-primary-action .input-action-btn.generate-btn .generate-cost-badge {
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        color: inherit;
        box-shadow: none;
        font-size: 14px;
        font-weight: 800;
        line-height: inherit;
    }

    .input-area .composer-primary-action .input-action-btn.generate-btn.premium,
    .input-area .composer-primary-action .input-action-btn.generate-btn.unlimited-free {
        background: linear-gradient(135deg, #2588ff 0%, #5267f5 100%);
        color: #ffffff;
    }

    .input-area .composer-primary-action .input-action-btn.generate-btn:disabled,
    .input-area .composer-primary-action .input-action-btn.generate-btn.uploading-disabled {
        background: #4b5563;
        color: rgba(255, 255, 255, 0.72);
        box-shadow: none;
        transform: none;
    }
}

@media (max-width: 768px) {
    /* Mobile Image is a focused creation surface: keep optional controls from
       covering model, billing and submit actions. Support is launched from the
       navigation footer and becomes visible only while the chat is open. */
    body.image-edit-page-active #agentModeBtn,
    body.image-edit-page-active #crisp-chatbox,
    body.image-edit-page-active .crisp-client,
    body.image-edit-page-active #chatwoot_live_chat_widget,
    body.image-edit-page-active .woot--bubble-holder,
    body.image-edit-page-active .woot-widget-bubble,
    body.image-edit-page-active .woot-widget-holder {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    body.image-edit-page-active.support-chat-open #crisp-chatbox,
    body.image-edit-page-active.support-chat-open .crisp-client,
    body.image-edit-page-active.support-chat-open #chatwoot_live_chat_widget,
    body.image-edit-page-active.support-chat-open .woot--bubble-holder,
    body.image-edit-page-active.support-chat-open .woot-widget-bubble,
    body.image-edit-page-active.support-chat-open .woot-widget-holder {
        display: block !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    .image-edit-chat-container > .input-area.fixed-bottom {
        width: calc(100% - 24px) !important;
        margin-bottom: 12px !important;
    }

    .input-area .main-input-container {
        position: relative;
    }

    .input-area .text-input-wrapper {
        padding-right: 52px;
    }

    /* Give the mobile prompt a real two-line editing surface. The visible
       Lexical editor owns the height after initialization, not the hidden
       textarea, so size both the host and the editor explicitly. */
    .input-area .prompt-rich-input,
    .input-area .prompt-lexical-editor {
        min-height: 52px;
    }

    /* The switch is absolutely positioned and does not contribute to the
       button's intrinsic width. Reserve its space explicitly so longer
       translations such as "Unlimited" cannot sit underneath it. */
    .input-area .params-buttons #unlimitedToggleBtn {
        flex: 0 0 auto;
        min-width: max-content !important;
        padding: 8px 52px 8px 14px !important;
        white-space: nowrap;
    }

    .input-area .params-buttons #unlimitedToggleBtn span {
        overflow: visible;
        text-overflow: clip;
        white-space: nowrap;
    }

    .input-area .composer-primary-action {
        position: absolute;
        top: 4px;
        right: 0;
        display: flex;
    }

    .input-area .composer-primary-action .input-action-btn.generate-btn {
        width: 44px;
        min-width: 44px;
        height: 44px;
        min-height: 44px;
        padding: 0;
        border-radius: 50%;
    }

    .input-area .composer-primary-action .input-action-btn.generate-btn span {
        display: none !important;
    }

    .image-edit-chat-container .messages-container {
        padding-bottom: 20px !important;
    }
}
