/* CSS Variables */
:root {
    --color-primary: #000000;
    --color-text: #1E293B;
    --color-text-muted: #64748B;
    --color-background: #FFFFFF;
    --color-border: #E2E8F0;
    --color-border-hover: #94A3B8;

    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    --font-heading: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
    --font-body: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    color: var(--color-text);
    background-color: var(--color-background);
    padding: var(--spacing-xl);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Wide container for report & posters to use more screen width on desktop */
.container-wide {
    max-width: 1480px;
    margin: 0 auto;
    width: 100%;
}

@media (min-width: 1600px) {
    .container-wide {
        max-width: 1600px;
    }
}

/* Navigation */
.back-home-link {
    display: inline-block;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
    transition: color 0.2s;
}

.back-home-link:hover {
    color: var(--color-primary);
}

/* Typography */
.app-title {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: var(--spacing-lg);
    color: #000;
}

/* Input Section */
.input-section {
    margin-bottom: var(--spacing-lg);
}

.input-container {
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    padding-bottom: 4rem;
    /* Space for bottom controls */
    background: white;
    transition: box-shadow 0.2s;
    min-height: 160px;
    /* 限制宽度并居中 */
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.input-container:focus-within {
    border-color: var(--color-border-hover);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* Controls positioned at bottom */
.input-controls {
    position: absolute;
    bottom: 1rem;
    left: 1.5rem;
    right: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Thumbnail Preview */
.upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.preview-item {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: #F8FAFC;
    padding: 2px;
}

.preview-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.preview-delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: #E2E8F0;
    color: #64748B;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid white;
    font-size: 14px;
    line-height: 1;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.preview-delete-btn:hover {
    background: #EF4444;
    color: white;
}

/* Filename tooltip */
.preview-filename {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 1;
    transition: opacity 0.2s;
    pointer-events: none;
    z-index: 20;
}

.preview-item:hover .preview-filename {
    opacity: 1;
}

.main-textarea {
    width: 100%;
    border: none;
    resize: none;
    font-size: 1rem;
    font-family: var(--font-body);
    margin-bottom: 0;
    color: var(--color-text);
    outline: none;
    background: transparent;
    flex: 1;
}

.main-textarea::placeholder {
    color: #94A3B8;
}

.controls-left {
    display: flex;
    gap: var(--spacing-xl);
    align-items: center;
    flex-wrap: wrap;
}

.icon-text-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    color: #000;
    font-weight: 500;
    transition: opacity 0.2s;
}

.icon-text-btn:hover {
    opacity: 0.7;
}

.model-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #000;
    font-size: 0.95rem;
    font-weight: 500;
}

.model-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.model-label {
    color: #666;
    font-size: 0.9rem;
}

.model-name {
    color: #000;
    font-weight: 600;
    font-size: 0.95rem;
}


.start-analysis-btn {
    background: #000;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.start-analysis-btn:hover {
    opacity: 0.9;
}

.start-analysis-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Status Message */
.status-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: var(--spacing-lg);
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

/* Cards Section Header */
.cards-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 0 0.5rem;
}

.cards-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.title-indicator {
    width: 4px;
    height: 22px;
    background: #000;
    border-radius: 2px;
}

.cards-section-title h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: #111827;
}

.generate-video-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #000;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.generate-video-btn:hover {
    opacity: 0.85;
}

/* Prompt Cards Wrapper & Slider */
.prompt-cards-wrapper {
    position: relative;
    width: 100%;
}

.pagination-dots,
.mobile-edit-hint {
    display: none;
    /* Desktop hidden */
}

.slider-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    color: #475569;
    transition: all 0.2s;
    opacity: 0;
    pointer-events: none;
}

.prompt-cards-wrapper:hover .slider-nav-btn {
    opacity: 1;
    pointer-events: auto;
}

.slider-nav-btn:hover {
    background: #fff;
    color: #0f172a;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.slider-prev {
    left: -22px;
}

.slider-next {
    right: -22px;
}

/* Group Grid (horizontal scroll wrapper inside card group section) */
.prompt-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.group-grid {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    gap: 1.5rem;
    padding: 0.5rem 0 1.5rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.group-grid::-webkit-scrollbar {
    display: none;
}

.prompt-card {
    flex: 0 0 auto;
    height: clamp(380px, 50vh, 520px);
    /* 默认460px高度，随视口调整 */
    width: auto;
    /* 依靠aspect-ratio计算宽度 */
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    aspect-ratio: var(--card-aspect-ratio, 9/16);
    position: relative;
    background: white;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}



/* Card Default State */
.card-default-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
}

.card-icon {
    width: 48px;
    height: 48px;
    color: #000;
}

.card-sketch-img {
    width: 140px;
    height: auto;
    max-height: 200px;
    object-fit: contain;
    opacity: 0.95;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.prompt-card:hover .card-sketch-img {
    transform: scale(1.08) translateY(-10px);
}

.card-title-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    text-align: center;
    padding: 0 1rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #000;
}

.card-subtitle {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-weight: normal;
    line-height: 1.4;
}

.card-footer {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    color: #000;
}

.edit-btn:hover {
    background-color: #F1F5F9;
}

.generate-btn {
    background: #000;
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 9999px;
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 500;
}

.generate-btn:hover {
    opacity: 0.9;
}

/* Generated Image Styling */
.generated-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.generated-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

/* Overlay Buttons - Vertical Layout on Right Bottom */
.card-hover-overlay {
    position: absolute;
    bottom: 0;
    right: 0;
    padding: 1rem;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    z-index: 30;
}

/* Click to Edit Hint */
.edit-poster-hint {
    position: absolute;
    bottom: 12px;
    left: 12px;
    padding: 5px 14px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1.5px solid #ff9500;
    /* 醒目的橘色边框 */
    border-radius: 999px;
    color: #000;
    font-size: 0.7rem;
    font-weight: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 35;
    box-shadow: 0 2px 8px rgba(255, 149, 0, 0.2);
    /* 淡淡的橘色阴影 */
}

.generated-view:hover .edit-poster-hint,
.prompt-card.selected .edit-poster-hint {
    opacity: 1;
}

.prompt-card:hover .card-hover-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* Aspect Ratio Selector Hover Logic */
.card-aspect-ratio-selector {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.prompt-card:hover .card-aspect-ratio-selector {
    opacity: 1;
    pointer-events: auto;
}

.overlay-buttons-vertical {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.overlay-icon-btn {
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: none;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.overlay-icon-btn:not(.disabled):hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.05);
}

.overlay-icon-btn img {
    width: 16px;
    height: 16px;
    filter: brightness(0) invert(1);
}

.overlay-icon-btn.disabled {
    opacity: 0.25;
    cursor: not-allowed;
    pointer-events: auto;
    /* Block the click from reaching the card */
}

.overlay-icon-btn.disabled img {
    opacity: 0.5;
}


/* Utility */
.hidden {
    display: none !important;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 600px;
    height: 80vh;
    /* 固定高度为视口高度的80% */
    max-height: 700px;
    /* 最大高度限制 */
    display: flex;
    /* Flex布局 */
    flex-direction: column;
    border-radius: var(--radius-xl);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    position: relative;
    padding: 0;
    /* 移除容器Padding */
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    /* 防止Header被压缩 */
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    /* 允许内容区域滚动 */
    flex: 1;
    /* 占据剩余空间 */
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
    /* 重要：允许flex item缩小到内容以下 */
}

/* 智能擦除弹窗特定样式 - 覆盖通用modal-body样式 */
.modal-body.eraser-body {
    padding: 0;
    overflow: hidden;
    flex-direction: row;
    gap: 0;
}


.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
    /* 防止Footer被压缩 */
    background: white;
    /* 确保背景不透明 */
}

/* 优化后的输入框 */
.modal-textarea {
    width: 100%;
    flex: 1;
    /* 占据剩余空间 */
    min-height: 250px;
    /* 增加最小高度以更好地填充弹窗空间 */
    padding: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    resize: none;
    /* 禁止手动调整大小 */
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    outline: none;
    background-color: #f9fafb;
    color: #1f2937;
    white-space: pre-wrap;
}

/* 紧凑型参考图上传组件 */
.reference-upload-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 0.5rem;
    gap: 1rem;
}

.ref-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.ref-label {
    font-weight: 500;
    font-size: 0.95rem;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ref-desc {
    font-size: 0.8rem;
    color: #64748B;
}

.ref-uploader {
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

.ref-upload-btn {
    width: 100%;
    height: 100%;
    border: 2px dashed #CBD5E1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: white;
    transition: all 0.2s;
    color: #94A3B8;
}

.ref-upload-btn:hover {
    border-color: #000;
    color: #000;
    background: #FAFAFA;
}

.ref-preview-container {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #E2E8F0;
    display: none;
    /* 默认隐藏 */
}

.ref-preview-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ref-remove-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: #EF4444;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    z-index: 10;
}



.save-btn {
    background: #000;
    color: white;
    padding: 0.75rem 1.5rem;
    /* Slightly adjusted padding */
    border-radius: 9999px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
}

.save-btn:hover {
    background-color: #333;
}

/* Header Text Styles */
.modal-header-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.modal-subtitle {
    font-size: 0.85rem;
    color: #64748B;
    margin: 0;
    font-weight: normal;
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: #94A3B8;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #000;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

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

/* Ensure Main Loader is Centered Column */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.loading-text {
    color: #475569;
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
}

/* Card Specific Loader */
.card-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: var(--radius-xl);
    overflow: hidden;
}

/* 科技光晕旋转光束 */
.card-loading-overlay::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent 0%, transparent 70%, #00f2fe 82%, #4facfe 88%, #8e2de2 96%, #4a00e0 100%);
    animation: rotateGlow 2.5s linear infinite;
    z-index: -2;
}

/* 内部遮罩，掩盖中间部分留出光辉边缘 */
.card-loading-overlay::after {
    content: '';
    position: absolute;
    inset: 3px;
    background: #ffffff;
    border-radius: calc(var(--radius-xl) - 2px);
    z-index: -1;
}

@keyframes rotateGlow {
    from {
        transform: rotate(0deg);
    }

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

/* 加载时隐藏原文案或原图片，防止光斑缝隙透光 */
.prompt-card.is-loading .generated-view,
.prompt-card.is-loading .card-default-content {
    opacity: 0;
    pointer-events: none;
}

.card-loading-overlay lottie-player {
    flex-shrink: 0;
}

.card-loading-text {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #64748B;
    font-weight: 500;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.loading-tip {
    margin-top: 12px;
    font-size: 0.85rem;
    color: #94a3b8;
    text-align: center;
    padding: 0 1.25rem;
    max-width: 100%;
    width: 100%;
    min-height: 4.5rem;
    /* 约 3 行的高度预留 */
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}

.loading-tip-key {
    text-align: center;
    font-weight: bold;
    color: #64748b;
    margin-bottom: 4px;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.loading-tip-value {
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

/* Identification Report Styles */
#identification-report {
    position: relative;
    z-index: 1000;
}

#prompt-cards-section {
    position: relative;
    z-index: 1;
}

.identification-report {
    margin-bottom: 1rem;
    padding: 1rem 1.5rem;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
}

@media (max-width: 640px) {
    .identification-report {
        padding: 1rem;
    }
}

.report-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--spacing-lg);
    color: #000;
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
}

.report-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.report-field-full {
    grid-column: 1 / -1;
}

.report-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #000;
}

.report-input,
.report-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-family: var(--font-body);
    color: var(--color-text);
    transition: border-color 0.2s;
}

.report-input:focus,
.report-textarea:focus {
    outline: none;
    border-color: var(--color-border-hover);
}

.report-input-group {
    display: flex;
    gap: 0.5rem;
}

.report-input-group .report-input {
    flex: 1;
}

@media (max-width: 640px) {
    .report-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .report-input-group {
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* Selling Points List */
.selling-points-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

@media (max-width: 640px) {
    .selling-points-list {
        grid-template-columns: 1fr;
    }
}

.selling-point-item {
    display: flex;
    gap: 0.5rem;
}

.selling-point-cn,
.selling-point-en {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-family: var(--font-body);
    color: var(--color-text);
    transition: border-color 0.2s;
}

.selling-point-cn:focus,
.selling-point-en:focus {
    outline: none;
    border-color: var(--color-border-hover);
}

/* Color Picker Group */
.color-picker-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.color-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-picker {
    width: 50px;
    height: 40px;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    cursor: pointer;
}

.color-hex {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
    color: var(--color-text);
    min-width: 90px;
    text-transform: uppercase;
}

.color-hex:focus {
    outline: none;
    border-color: var(--color-border-hover);
}

/* Design Button (icon-only for "设计") */
.design-btn {
    background: #000;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.design-btn:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

.design-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.design-btn img {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
}

/* Text Content Editor Modal Styles */
.modal-content-wide {
    max-width: 700px;
}

.text-content-editor {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.text-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.text-field-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #000;
}

.optional-label {
    font-size: 0.85rem;
    font-weight: 400;
    color: #64748B;
}

.bilingual-input {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.text-field-input,
.text-field-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-family: var(--font-body);
    color: var(--color-text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.text-field-input:focus,
.text-field-textarea:focus {
    outline: none;
    border-color: #000;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.text-field-textarea {
    resize: vertical;
    min-height: 80px;
}


/* Modal Dynamic Fields */
.modal-fields-container {
    flex: 1;
    /* 占据tab-content的所有空间 */
    overflow-y: auto;
    /* 允许滚动 */
    padding-right: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.modal-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.modal-field-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
}

.modal-field-input,
.modal-field-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-family: var(--font-body);
    transition: all 0.2s;
    background: #F9FAFB;
}

.modal-field-input:focus,
.modal-field-textarea:focus {
    outline: none;
    border-color: #000;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

.modal-field-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Modal Tab Styles */
.modal-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
    /* 防止Tab导航被压缩 */
}

.modal.single-mode .modal-tabs {
    display: none !important;
}

.modal-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: #64748b;
    transition: all 0.2s;
    position: relative;
    bottom: -1px;
}

.modal-tab svg {
    width: 16px;
    height: 16px;
}

.modal-tab:hover {
    color: #334155;
}

.modal-tab.active {
    color: #000;
    border-bottom-color: #000;
}

.tab-content {
    display: none;
    flex: 1;
    /* 占据剩余空间 */
    overflow-y: auto;
    /* 允许独立滚动 */
    min-height: 0;
    /* 允许缩小 */
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    /* 子元素之间的间距 */
}

/* Restored .selling-points-editor */
.selling-points-editor {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.selling-point-edit-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #F8FAFC;
    border-radius: 0.5rem;
    border: 1px solid var(--color-border);
}

.selling-point-edit-item input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 0.375rem;
    font-size: 0.9rem;
    font-family: var(--font-body);
    background: white;
}

.selling-point-edit-item input:focus {
    outline: none;
    border-color: #000;
}

/* Layout and Ratio Selector Enhancements */

/* Main Controls Bar Layout - Ensures Start Button is on the far right */
.controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.controls-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Ratio Selector Styles */
.ratio-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #000;
}

.ratio-selector-wrapper svg {
    color: #000;
}

.ratio-info {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.ratio-label {
    color: #666;
    font-size: 0.9rem;
}

.ratio-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: #000;
    cursor: pointer;
    outline: none;
    padding: 0;
    text-align: left;
}

.ratio-select:hover {
    opacity: 0.8;
}

/* Ensure controls-right doesn't shrink */
.controls-right {
    flex-shrink: 0;
}

/* Ensure card footer is always visible and at bottom */
.prompt-card .card-footer {
    margin-top: auto;
    /* Push to bottom */
    flex-shrink: 0;
    /* Don't shrink */
    background: white;
    /* Ensure visibility */
    position: relative;
    z-index: 1;
}

/* Responsive adjustments for controls bar */
@media (max-width: 768px) {
    .controls-bar {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .controls-actions {
        gap: 1rem;
        flex-wrap: wrap;
    }

    .controls-right {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }
}

/* Ensure proper spacing for different aspect ratios */
@media (min-width: 1200px) {
    .prompt-cards-grid {
        max-width: 100%;
    }
}

/* --- Landing Page Styles --- */

.landing-body {
    background-color: #FFFFFF;
    color: #111827;
    font-family: 'Poppins', sans-serif;
    padding: 0;
    margin: 0;
}

/* Nav */
.landing-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #000;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: #4B5563;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover {
    color: #000;
}

.nav-cta {
    background: #000;
    color: #fff;
    padding: 0.6rem 1.25rem;
    border-radius: 9999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: opacity 0.2s;
}

.nav-cta:hover {
    opacity: 0.9;
}

/* Hero */
.landing-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    padding: 6rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.hero-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.hero-title {
    font-size: 3.5rem;
    line-height: 1.1;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.5rem;
}

.gradient-text {
    background: linear-gradient(135deg, #4F46E5 0%, #06B6D4 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.125rem;
    line-height: 1.6;
    color: #4B5563;
    max-width: 90%;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.hero-btn-primary {
    background: #000;
    color: #fff;
    padding: 1rem 2rem;
    border-radius: 9999px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s;
}

.hero-btn-primary:hover {
    transform: translateY(-2px);
}

.hero-btn-secondary {
    background: transparent;
    color: #111827;
    padding: 1rem 2rem;
    border: 1px solid #E5E7EB;
    border-radius: 9999px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.2s;
}

.hero-btn-secondary:hover {
    background-color: #F9FAFB;
}

/* Hero Visual Grid */
.hero-image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1rem;
    height: 400px;
}

.grid-item {
    background: #F3F4F6;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.demo-card {
    font-weight: 700;
    color: #9CA3AF;
    font-size: 1.5rem;
}

.item-1 {
    grid-column: 1;
    grid-row: 1 / 3;
    background: #EEF2FF;
}

/* Tall item */
.item-2 {
    background: #ECFEFF;
}

.item-3 {
    background: #FDF4FF;
}

.item-4 {
    background: #FFFBEB;
}

/* Badges Overlay */
.card-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    gap: 6px;
    z-index: 5;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.published-badge,
.hd-badge,
.remix-badge {
    backdrop-filter: blur(4px);
    color: white;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.5);
    /* 降低透明度 */
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.hd-badge {
    font-weight: 800;
    border-color: rgba(255, 255, 255, 0.8);
    letter-spacing: 0.5px;
}

/* Hide badges on card hover */
.prompt-card:hover .card-badges {
    opacity: 0;
    visibility: hidden;
}

/* Features */
.landing-features {
    padding: 6rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.section-title {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 4rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    padding: 2rem;
    border-radius: 1.5rem;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    text-align: left;
    transition: box-shadow 0.2s;
}

.feature-card:hover {
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
}

.feature-icon {
    width: 48px;
    height: 48px;
    background: #F3F4F6;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    color: #111827;
}

.feature-icon svg {
    width: 24px;
    height: 24px;
}

.feature-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.feature-card p {
    color: #6B7280;
    line-height: 1.6;
}

/* Workflow */
.landing-workflow {
    padding: 6rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    background: #F9FAFB;
    border-radius: 2rem;
    margin-bottom: 4rem;
}

.workflow-steps {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    max-width: 900px;
    margin: 0 auto;
    position: relative;
}

.step-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
}

.step-number {
    width: 64px;
    height: 64px;
    background: #000;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    border: 4px solid #fff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.step-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #111827;
}

.step-card p {
    color: #6B7280;
    line-height: 1.6;
    max-width: 200px;
    font-size: 0.95rem;
}

.step-connector {
    flex: 1;
    height: 2px;
    background: #E5E7EB;
    margin-top: 32px;
    /* (64px height / 2) */
    z-index: 1;
}

@media (max-width: 768px) {
    .workflow-steps {
        flex-direction: column;
        gap: 2rem;
        align-items: center;
    }

    .step-connector {
        width: 2px;
        height: 40px;
        margin-top: 0;
        margin-left: 0;
    }
}

/* Footer */
.landing-footer {
    padding: 3rem 2rem;
    text-align: center;
    border-top: 1px solid #E5E7EB;
    color: #6B7280;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .landing-hero {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 4rem 1.5rem;
        gap: 3rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-actions {
        justify-content: center;
    }

    .nav-links {
        display: none;
        /* Hide nav links on mobile for simplicity */
    }

    .hero-image-grid {
        height: 300px;
    }
}

/* Card Groups */
.card-group-section {
    margin-bottom: 1.5rem;
}

.group-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1.5rem;
    padding-left: 0.75rem;
    border-left: 4px solid #1e293b;
}

/* App Product Grid Layouts */
.app-grid-phone .prompt-card {
    aspect-ratio: 886 / 1920 !important;
}

.app-grid-tablet .prompt-card {
    aspect-ratio: 1548 / 2064 !important;
}

/* Logo Card Special Sizing */
.logo-card-item {
    width: var(--logo-card-width, 100%) !important;
    aspect-ratio: 1/1 !important;
}

/* Session Restoration Banner */
.session-restore-banner {
    background: #f8fafc;
    /* Very light gray/white */
    border: 1px solid #e2e8f0;
    /* Light gray border */
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: fadeIn 0.3s ease-out;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    /* 限制宽度并居中 */
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.session-restore-banner.hidden {
    display: none !important;
}

.session-restore-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #334155;
    /* Slate 700 - Dark gray/blackish */
    font-size: 0.9rem;
    font-weight: 500;
    flex: 1;
}

.session-selector {
    padding: 0.4rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.375rem;
    font-size: 0.85rem;
    background: white;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 200px;
    max-width: 300px;
}

.session-selector:hover {
    border-color: #94a3b8;
}

.session-selector:focus {
    outline: none;
    border-color: #0f172a;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.1);
}


.restore-text {
    font-size: 0.9rem;
    color: #0f172a;
    font-weight: 600;
}

.session-restore-actions {
    display: flex;
    gap: 0.5rem;
}

.restore-btn {
    background: #f97316;
    /* Orange 500 */
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.restore-btn:hover {
    background: #ea580c;
    /* Orange 600 */
}

.discard-btn {
    background: transparent;
    color: #64748b;
    /* Slate 500 */
    border: 1px solid #cbd5e1;
    padding: 0.4rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: auto;
    /* Push to far right */
}

.discard-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
}

.new-design-btn {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    padding: 0 1.5rem;
    /* Horizontal only, height controlled by min-height */
    min-height: 42px;
    /* Match identify button */
    border-radius: 9999px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    /* Space between icon and text */
}

.new-design-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* History Navigation Buttons */
.history-navigation {
    display: none !important;
}

.generated-view:hover .history-navigation {
    opacity: 1;
    pointer-events: auto;
}

/* 空白卡片（有历史记录）hover时也显示历史导航 */
.prompt-card:hover .history-navigation {
    opacity: 1;
    pointer-events: auto;
}

.history-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.7);
    /* 黑色半透明背景 */
    backdrop-filter: blur(8px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.history-btn:hover:not(.disabled) {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.history-btn:active:not(.disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.history-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(0, 0, 0, 0.5);
}

.history-btn img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    /* 强制纯白色图标 */
}

/* Delete Version Button (Bottom Left) */
.delete-version-btn-wrapper {
    display: none !important;
}

.delete-version-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.9);
    /* 红色半透明背景 */
    backdrop-filter: blur(8px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.delete-version-btn:hover {
    background: rgba(220, 38, 38, 0.95);
    transform: translateY(-1px);
}

.publish-version-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: #003CD3;
    /* Brand Blue */
    backdrop-filter: blur(8px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.publish-version-btn:hover {
    background: #0035B8;
    transform: translateY(-1px);
}

.publish-version-btn img,
.delete-version-btn img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    /* White icons */
}

/* Published State - Keep colors consistent */
.publish-version-btn.published {
    background: #003CD3;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.publish-version-btn.published img {
    filter: brightness(0) invert(1);
    opacity: 1;
}

.delete-version-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

/* Image Preview Modal */
.image-preview-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    cursor: zoom-out;
}

.image-preview-modal.active {
    display: flex;
}

.image-preview-content {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    cursor: default;
}

/* --- Mobile Responsive Optimizations --- */

/* 1. Base Structure Defaults (Desktop) */
.poster-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.poster-controls {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.app-product-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #475569;
    cursor: pointer;
    user-select: none;
}

.info-icon {
    cursor: help;
    opacity: 0.6;
}

.design-style-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.style-label {
    font-size: 0.9rem;
    color: #475569;
    font-weight: 500;
}

/* User Idea Section on Poster Cards */
.user-idea-section {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 1. 非应用程序产品: 悬停时隐藏默认内容并居中想法框 */
.prompt-card.is-normal-product:not(.is-generated):hover .card-default-content {
    opacity: 0;
    pointer-events: none;
}

.prompt-card.is-normal-product:hover .user-idea-section {
    top: 35%;
    transform: translate(-50%, -50%);
    pointer-events: auto;
}

.prompt-card.is-app-product:hover .user-idea-section {
    /* 应用程序产品保持原有位置（虽然目前模板中不渲染，但保留规范） */
    top: 80px;
}

/* User Idea Button */
.user-idea-btn {
    width: 44px;
    height: 44px;
    background: #ffffff;
    border: 1.5px solid #000000;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(-10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.prompt-card:hover .user-idea-btn {
    opacity: 1;
    transform: translateY(0);
}

.user-idea-btn img {
    width: 24px;
    height: 24px;
}

/* User Idea Display */
.user-idea-display {
    width: fit-content;
    max-width: 75%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    font-size: 0.85rem;
    color: #1e293b;
    line-height: 1.4;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    opacity: 0;
    transform: translateY(5px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 120px;
    overflow-y: auto;
    text-align: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: pointer;
}

.user-idea-display:hover {
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.prompt-card:hover .user-idea-display:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
}

/* User Idea Textarea */
.user-idea-textarea {
    width: 75%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.6);
    border: 1.5px solid rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    font-size: 0.85rem;
    color: #1e293b;
    line-height: 1.4;
    outline: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    resize: none;
    height: 100px;
    font-family: inherit;
    z-index: 31;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.user-idea-textarea:focus {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
}

.prompt-card:hover .user-idea-textarea:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
}


.user-idea-textarea.hidden {
    display: none;
}

.user-idea-display.hidden {
    display: none;
}




.user-idea-input {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    font-size: 0.85rem;
    color: #ffffff;
    outline: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
    resize: none;
    /* Disable resizing */
    height: 70px;
    /* Fixed height for textarea */
    line-height: 1.4;
    display: flex;
    align-items: center;
}

.user-idea-input::placeholder {
    color: #9ca3af;
    font-size: 0.8rem;
    line-height: 1.4;
}

.user-idea-input:focus {
    background: rgba(0, 0, 0, 0.9);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}



.style-select {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
}


/* 2. Mobile Specific Overrides */
@media (max-width: 768px) {

    /* Reduce body padding to maximize width */
    body {
        padding: 0.75rem;
    }

    /* Input Section */
    .input-container {
        padding: 1rem;
        padding-bottom: 4rem;
        /* Keep space for controls */
        margin-bottom: 1.5rem;
    }

    .input-controls {
        left: 1rem;
        right: 1rem;
    }

    /* Session Restore Banner - Optimized for mobile */
    .session-restore-banner {
        padding: 1rem;
    }

    .session-restore-content {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        width: 100%;
        gap: 0.5rem;
    }

    .restore-text {
        width: 100%;
        font-weight: 600;
        margin-bottom: 2px;
    }

    .session-selector {
        flex: 1;
        min-width: 0;
        /* Allow shrinking to share space */
        width: auto;
        /* Overwrite width: 100% */
        margin-left: 0 !important;
        padding: 0.6rem;
    }

    .discard-btn {
        margin-left: 0 !important;
        flex-shrink: 0;
        padding: 0.6rem 1rem;
    }

    .session-restore-actions {
        width: 100%;
        display: flex;
        gap: 0.75rem;
        justify-content: flex-end;
        /* Align buttons to right */
        margin-top: 0.25rem;
    }

    .session-restore-actions button {
        flex: 1;
        /* Make buttons equal width */
        justify-content: center;
    }

    /* Poster Section Header - Stacked Layout */
    .poster-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.25rem;
        margin-bottom: 1.25rem;
    }

    .group-title {
        font-size: 1.1rem;
        align-self: flex-start;
    }

    .poster-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        width: 100%;
    }

    /* "This is an app" Checkbox Row */
    .app-product-checkbox {
        width: 100%;
        /* justify-content: space-between; Optional: push info icon to right? No, keep left */
    }

    /* Design Style Row */
    .design-style-selector {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .style-select {
        width: 100%;
        padding: 0.6rem 1rem;
    }

    /* Ensure content area matches input width */
    .container {
        width: 100%;
        padding: 0;
        max-width: none;
    }

    /* Hide Design Style Label on Mobile */
    .style-label {
        display: none;
    }

    /* Show Mobile Hint */
    .mobile-hint {
        display: block !important;
        width: 100%;
    }

    /* --- Poster Carousel Optimization --- */
    /* --- Poster Carousel Optimization --- */
    .card-group-section {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .prompt-cards-wrapper {
        position: relative;
        padding-bottom: 3.5rem;
        margin: 0 -0.75rem !important;
        width: calc(100% + 1.5rem) !important;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .group-grid-container {
        width: 100%;
        overflow: visible;
        /* 改为 visible 以解决“蒙版”感 */
    }

    .group-grid {
        gap: 12px;
        padding: 0 24px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        display: flex;
        overflow-x: auto;
        overflow-y: hidden !important;
        /* 强制消除纵向独立的滚动行为 */
        touch-action: pan-x;
        /* 明确只允许水平手势，将纵向滚动归还给页面 */
        width: 100%;
        align-items: flex-start !important;
        transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        will-change: height;
        scroll-padding: 0 24px;
    }

    .group-grid::-webkit-scrollbar {
        display: none;
    }

    .prompt-card {
        width: calc(100vw - 48px) !important;
        /* 进一步缩减宽度，确保不被截断 */
        flex: 0 0 calc(100vw - 48px) !important;
        height: auto !important;
        min-height: 250px;
        scroll-snap-align: center;
        aspect-ratio: var(--card-aspect-ratio, 1/1) !important;
        border: none;
        background: transparent;
        position: relative;
        align-self: flex-start !important;
        border-radius: 12px;
        overflow: hidden;
    }

    /* 当海报生成后，根据海报比例自然撑开高度 */
    .prompt-card.is-generated {
        aspect-ratio: auto !important;
        display: block !important;
        background: white;
    }

    .prompt-card.is-generated .generated-view {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        display: block !important;
    }

    .prompt-card.is-generated .generated-image {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        display: block !important;
        object-fit: contain !important;
    }

    /* Pagination Dots Style */
    .pagination-dots {
        display: flex;
        justify-content: center;
        gap: 0.8rem;
        padding: 0.5rem 0;
        position: absolute;
        bottom: 1.25rem;
        left: 0;
        right: 0;
        pointer-events: none;
        z-index: 40;
        width: 100%;
    }

    .pagination-dots .dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: rgba(0, 0, 0, 0.1);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border: 1px solid rgba(0, 0, 0, 0.05);
    }

    .pagination-dots .dot.active {
        width: 24px;
        border-radius: 4px;
        background: #000000;
    }

    .mobile-edit-hint {
        display: block;
        text-align: center;
        width: 100%;
        font-size: 0.75rem;
        color: #94a3b8;
        margin-top: 0.25rem;
        position: absolute;
        bottom: 0.2rem;
        left: 0;
        pointer-events: none;
        letter-spacing: 0.02em;
    }

    /* Hide edit/interaction elements when card is selected on mobile */
    .prompt-card.selected .card-hover-overlay,
    .prompt-card.selected .card-aspect-ratio-selector,
    .prompt-card.selected .history-navigation,
    .prompt-card.selected .user-idea-btn,
    .prompt-card.selected .user-idea-display,
    .prompt-card.selected .user-idea-textarea,
    .prompt-card.selected .full-width-design-btn {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        display: none !important;
    }

    /* Ensure badges (like published) remain visible even if the hover state tries to hide them */
    .prompt-card.selected .card-badges {
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* Hide nav buttons on mobile */
    .slider-nav-btn {
        display: none !important;
    }
}

/* Closing @media (max-width: 768px) */

/* Share Modal Styles */
.share-modal-container {
    background: transparent;
    width: 95%;
    max-width: 500px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    gap: 1.25rem;
    padding: 1rem;
    overflow: hidden;
}

.share-content-body {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 100%;
    flex: 0 1 auto;
    min-height: 0;
}

.share-modal-container::-webkit-scrollbar {
    display: none;
}

.close-share-btn {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1e293b;
    color: white;
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.close-share-btn:hover {
    background: #0f172a;
    transform: scale(1.1) rotate(90deg);
}

.share-card {
    background: white;
    width: fit-content;
    max-width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    flex: 0 1 auto;
    min-height: 0;
}

.share-poster-wrapper {
    width: 100%;
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 0;
    position: relative;
}

.share-poster-wrapper img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
}

.share-product-src-wrapper {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 56px;
    /* Obviously smaller for 16:9 */
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    /* Opaque white background */
}

/* Enlarged for 9:16 posters */
.share-card.is-tall .share-product-src-wrapper {
    width: 88px;
    /* Obviously larger for 9:16 */
    height: 88px;
    bottom: 15px;
    right: 15px;
}

#share-product-src-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}



.share-info-section {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
    /* Keep info section visible */
}

.share-qr-container {
    flex-shrink: 0;
}

#share-qrcode {
    width: 80px;
    height: 80px;
    padding: 4px;
    background: white;
    border: 1px solid #e2e8f0;
}

#share-qrcode img {
    width: 100% !important;
    height: 100% !important;
}

.share-text-content {
    flex: 1;
}

.share-quote {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.share-invite-desc {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.share-invite-code {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.share-actions {
    width: 100%;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.download-share-btn {
    background: #003CD3;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 99px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0, 60, 211, 0.3);
}

.download-share-btn:hover {
    background: #0035B8;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 60, 211, 0.4);
}

@media (max-width: 480px) {
    .share-modal-container {
        width: 100%;
    }

    .share-info-section {
        flex-direction: row;
        padding: 1rem;
        gap: 0.75rem;
    }

    #share-qrcode {
        width: 64px;
        height: 64px;
    }

    .share-quote {
        font-size: 0.85rem;
    }

    .share-invite-desc {
        font-size: 0.75rem;
    }
}

/* Poster Selection & Toolbar Styles */
.prompt-card.selected {
    border: 2px solid #ff6b00 !important;
    box-shadow: 0 0 15px rgba(255, 107, 0, 0.2);
}

.poster-toolbar {
    position: fixed;
    bottom: 3.5rem;
    /* Increased distance from bottom */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    /* Slightly more opaque */
    backdrop-filter: blur(16px);
    border: 1.5px solid #000;
    border-radius: 999px;
    padding: 0.6rem 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 10000;
    /* Extremely high to stay on top of everything */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
}

.poster-toolbar.hidden {
    opacity: 0;
    transform: translate(-50%, 2rem) scale(0.95);
    pointer-events: none;
}

.toolbar-content {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.toolbar-divider {
    width: 1px;
    height: 32px;
    background-color: #e2e8f0;
    margin: 0 0.5rem;
    flex-shrink: 0;
}

.toolbar-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 8px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 60px;
}

.toolbar-btn:hover {
    background: rgba(255, 107, 0, 0.05);
}

.toolbar-btn img {
    width: 22px;
    height: 22px;
    opacity: 0.8;
    transition: transform 0.2s;
}

.toolbar-btn:hover img {
    transform: scale(1.1);
    opacity: 1;
}

.toolbar-btn-text {
    font-size: 0.7rem;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}

/* Mobile App-like Toolbar UX */
@media (max-width: 768px) {
    .poster-toolbar {
        bottom: 0;
        width: 100%;
        border-radius: 0;
        border: none;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        padding: 0;
        /* Blur background stays, but let's ensure it covers full width */
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.05);
    }

    .poster-toolbar.hidden {
        transform: translate(-50%, 100%);
    }

    .toolbar-content {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Firefox */
        justify-content: flex-start;
        padding: 0.5rem 1rem;
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 12px));
        /* iOS Home Indicator support */
        gap: 0.5rem;
    }

    .toolbar-content::-webkit-scrollbar {
        display: none;
        /* Chrome/Safari/Edge */
    }

    .toolbar-btn {
        flex: 0 0 auto;
        /* Prevent buttons from squishing */
        min-width: 64px;
    }

    .toolbar-divider {
        height: 40px;
    }
}

/* Relocated Design Button in Card */
.full-width-design-btn {
    width: 140px;
    height: 40px;
    margin-top: 10px;
    background: #000;
    color: white;
    border-radius: 999px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    position: relative;
    overflow: hidden;
}

.prompt-card:hover .full-width-design-btn {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.full-width-design-btn:hover {
    background: #222;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.full-width-design-btn .btn-content-default,
.full-width-design-btn .btn-content-hover {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.full-width-design-btn .btn-content-hover {
    transform: translateY(100%);
    opacity: 0;
}

.full-width-design-btn:hover .btn-content-default {
    transform: translateY(-100%);
    opacity: 0;
}

.full-width-design-btn:hover .btn-content-hover {
    transform: translateY(0);
    opacity: 1;
}

.full-width-design-btn .btn-content-hover img {
    filter: none !important;
}