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

body {
    font-family: var(--font-sans);
    background: linear-gradient(135deg, #f0f4f8 0%, #e0e7ff 100%);
    min-height: 100vh;
    min-height: 100dvh;
    padding: 20px;
    color: var(--light-text);
    letter-spacing: 0.3px;
    position: relative;
    overflow-x: hidden;
}

/* 添加背景装饰 */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
    animation: float 20s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-30px, -30px) rotate(120deg); }
    66% { transform: translate(30px, -30px) rotate(240deg); }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border-radius: var(--border-radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-2xl), 0 0 80px rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.6);
    position: relative;
    animation: containerFadeIn 0.8s ease-out;
}

@keyframes containerFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 容器光晕效果 */
.container::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--primary-light), var(--secondary-color), var(--accent-color));
    border-radius: var(--border-radius-xl);
    opacity: 0;
    z-index: -1;
    transition: opacity var(--transition-normal);
}

.container:hover::after {
    opacity: 0.3;
    animation: glow 3s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.5; }
}

h1 {
    text-align: center;
    color: var(--light-text);
    margin-bottom: var(--spacing-lg);
    font-size: 3.5em;
    font-weight: 900;
    letter-spacing: -1.5px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 50%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleAnimation 1s ease-out;
    position: relative;
    display: inline-block;
    width: 100%;
}

/* 标题装饰 */
h1::before {
    content: '✨';
    position: absolute;
    left: -40px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6em;
    animation: sparkle 2s ease-in-out infinite;
}

h1::after {
    content: '✨';
    position: absolute;
    right: -40px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6em;
    animation: sparkle 2s ease-in-out infinite 0.5s;
}

@keyframes titleAnimation {
    0% {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }
    50% {
        transform: translateY(5px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes sparkle {
    0%, 100% { 
        opacity: 0.5;
        transform: translateY(-50%) rotate(0deg) scale(1);
    }
    50% { 
        opacity: 1;
        transform: translateY(-50%) rotate(180deg) scale(1.2);
    }
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

/* 卡片式布局 - 新拟态风格 */
.card-section {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.9));
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 
        20px 20px 60px rgba(163, 177, 198, 0.3),
        -20px -20px 60px rgba(255, 255, 255, 0.7),
        inset 1px 1px 2px rgba(255, 255, 255, 0.9),
        inset -1px -1px 2px rgba(163, 177, 198, 0.2);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    animation: cardSlideIn 0.6s ease-out backwards;
}

/* 卡片进入动画 */
@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.card-section:nth-child(1) { animation-delay: 0.1s; }
.card-section:nth-child(2) { animation-delay: 0.2s; }

/* 卡片顶部光效 */
.card-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    right: -100%;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent, 
        var(--primary-light), 
        var(--secondary-color), 
        transparent);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.card-section:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 
        25px 25px 75px rgba(163, 177, 198, 0.35),
        -25px -25px 75px rgba(255, 255, 255, 0.8),
        inset 2px 2px 4px rgba(255, 255, 255, 1),
        inset -2px -2px 4px rgba(163, 177, 198, 0.25),
        0 0 30px rgba(99, 102, 241, 0.1);
    transform: translateY(-6px) scale(1.02);
    background: linear-gradient(145deg, rgba(255, 255, 255, 1), rgba(250, 251, 252, 0.95));
}

/* 卡片内部装饰 */
.card-section::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.05) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.card-section:hover::after {
    opacity: 1;
}

.card-section h3 {
    margin-top: 0;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid rgba(106, 130, 251, 0.2);
    background: linear-gradient(135deg, #6a82fb 0%, #fc5c7d 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    font-size: 1.15em;
    letter-spacing: 0.5px;
}

.input-section {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
}

/* 优化左侧菜单行间距 */
.input-section h3 {
    margin-top: 25px;
    margin-bottom: 18px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, #6a82fb, #fc5c7d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.input-section h3:first-child {
    margin-top: 0;
}

.input-group { margin-bottom: 20px; }
.input-group label { 
    display: block; 
    margin-bottom: 12px; 
    font-weight: 700; 
    color: #1a1f36;
    font-size: 0.95em;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    font-size: 0.85em;
    opacity: 0.9;
}

/* 输入框优化 - 添加动画效果 */
.input-group {
    position: relative;
    animation: fadeInUp 0.5s ease-out backwards;
}

.input-group:nth-child(1) { animation-delay: 0.05s; }
.input-group:nth-child(2) { animation-delay: 0.1s; }
.input-group:nth-child(3) { animation-delay: 0.15s; }

.input-group input,
.input-group textarea,
.input-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius-md);
    font-size: 14px;
    transition: all var(--transition-normal);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(249, 250, 251, 0.9));
    color: var(--gray-900);
    backdrop-filter: blur(10px);
    font-family: inherit;
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.05);
}

/* 输入框悬浮效果 */
.input-group input:hover,
.input-group textarea:hover,
.input-group select:hover {
    border-color: var(--gray-300);
    background: rgba(255, 255, 255, 0.98);
}

.input-group input::placeholder,
.input-group textarea::placeholder {
    color: #a0a8c0;
}

/* 输入框聚焦效果 - 增强版 */
.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 
        0 0 0 4px rgba(99, 102, 241, 0.1),
        0 0 20px rgba(99, 102, 241, 0.2),
        inset 0 1px 2px rgba(99, 102, 241, 0.05);
    background: linear-gradient(145deg, rgba(255, 255, 255, 1), rgba(249, 250, 251, 0.95));
    transform: translateY(-2px);
}

/* 输入框标签动画 */
.input-group label {
    display: inline-block;
    transition: all var(--transition-fast);
    transform-origin: left center;
}

.input-group:hover label {
    color: var(--primary-color);
    transform: translateX(2px);
}

/* 输入框错误状态 */
.input-group.error input,
.input-group.error textarea,
.input-group.error select {
    border-color: var(--danger-color);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* 输入框成功状态 */
.input-group.success input,
.input-group.success textarea,
.input-group.success select {
    border-color: var(--success-color);
    background: linear-gradient(145deg, rgba(236, 253, 245, 0.5), rgba(255, 255, 255, 0.95));
}

.input-group textarea { 
    height: 100px; 
    resize: vertical;
    line-height: 1.6;
}

.param-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.buttons { display: flex; gap: 15px; margin-bottom: 20px; }

/* 按钮基础样式 - 增强版 */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: var(--border-radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* 按钮涟漪效果 */
.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    pointer-events: none;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

/* 按钮悬浮光效 */
.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
    pointer-events: none;
}

.btn:hover::after {
    left: 100%;
}

/* 按钮加载状态 */
.btn.loading {
    color: transparent;
    pointer-events: none;
}

.btn.loading::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: btnSpin 0.8s linear infinite;
}

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

/* 主按钮 - 渐变动画效果 */
.btn-primary { 
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%); 
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    color: white; 
    flex: 1;
    box-shadow: 
        0 4px 15px rgba(99, 102, 241, 0.3),
        0 1px 3px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.btn-primary:hover { 
    transform: translateY(-3px) scale(1.02); 
    box-shadow: 
        0 8px 25px rgba(99, 102, 241, 0.4),
        0 3px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation-duration: 1.5s;
}

.btn-primary:active {
    transform: translateY(-1px) scale(1);
    box-shadow: 
        0 2px 10px rgba(99, 102, 241, 0.3),
        0 1px 3px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* 脉冲动画 - 用于重要操作 */
.btn-primary.pulse {
    animation: gradientShift 3s ease infinite, pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { 
        box-shadow: 
            0 4px 15px rgba(99, 102, 241, 0.3),
            0 0 0 0 rgba(99, 102, 241, 0.4);
    }
    50% { 
        box-shadow: 
            0 4px 15px rgba(99, 102, 241, 0.3),
            0 0 0 15px rgba(99, 102, 241, 0);
    }
}

.btn-secondary { background: #6c757d; color: white; border: 1px solid #6c757d; }
.btn-secondary:hover { background: #5a6268; transform: translateY(-2px); }

.btn-light {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
    backdrop-filter: blur(5px);
    box-shadow: var(--shadow-sm);
}
.btn-light:hover {
    background: #e9ecef;
    border-color: #ced4da;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.file-upload { position: relative; display: inline-block; width: 100%; }
.file-upload input[type="file"] { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

#imagePreview { position: relative; display: inline-block; }
.delete-image-btn {
    position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%;
    background: #dc3545; color: white; border: 2px solid white; font-size: 14px; font-weight: bold; cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2); display: flex; align-items: center; justify-content: center; z-index: 10;
    transition: all 0.3s ease;
}
.delete-image-btn:hover { background: #c82333; transform: scale(1.1); }

.result-section {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
    text-align: center;
    min-width: 0;
    color: #333;
}

.generated-image {
    display: block;
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
}

.loading { display: none; padding: 20px; }
.loading.show { display: block; }
.spinner {
    border: 4px solid rgba(255, 255, 255, 0.2); 
    border-top: 4px solid var(--primary-color); 
    border-radius: 50%; 
    width: 40px; 
    height: 40px;
    animation: spin 1s linear infinite; 
    margin: 20px auto;
    box-shadow: 0 0 20px rgba(106, 130, 251, 0.3);
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.loading.show .spinner {
    animation: spin 1s linear infinite, pulse 2s ease-in-out infinite;
}

/* 实时日志面板 */
.log-panel {
    text-align: left; margin-top: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px; border-radius: 12px; padding: 15px;  max-height: 450px; overflow: auto;
    background: rgba(245, 247, 250, 0.8); color: #333; border: 1px solid #ddd;
    transition: all 0.3s ease;
    word-break: break-all;
    overflow-wrap: break-word;
    backdrop-filter: blur(5px);
}
.log-panel.active {
    background: rgba(245, 247, 250, 0.95); color: #333; border: 1px solid rgba(106, 130, 251, 0.3);
}
.log-actions { display: flex; gap: 10px; margin-top: 8px; justify-content: flex-end; }
.log-line { white-space: pre-wrap; margin: 2px 0; }
.log-info { color: #60a5fa; }
.log-warn { color: #fbbf24; }
.log-error { color: #f87171; }

.history-section { 
    margin-top: 30px; 
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
    color: #333;
}
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; margin-top: 20px; }
.history-item {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 16px;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.08);
    transition: all var(--transition-normal);
    will-change: transform, box-shadow;
    min-height: 280px;
    display: flex;
    flex-direction: column;
}
.history-item:hover { 
    transform: translateY(-8px);
    border-color: rgba(106, 130, 251, 0.5);
    box-shadow: 0 12px 40px rgba(106, 130, 251, 0.25);
}
.history-item.selected {
    border-color: #6a82fb;
    box-shadow: 0 8px 30px rgba(106, 130, 251, 0.3);
    background: rgba(30, 41, 59, 0.95);
}
.history-item-checkbox {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    z-index: 10;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.history-actions { display: flex; gap: 10px; }
.history-image { width: 100%; height: 150px; object-fit: cover; border-radius: 8px; margin-bottom: 10px; }
.history-prompt { font-size: 12px; color: #666; word-break: break-word; }
.history-time { font-size: 10px; color: #999; margin-top: 5px; }
.prompt-summary, .prompt-full {
    line-height: 1.5;
}
.prompt-toggle {
    color: #6a82fb;
    text-decoration: none;
    font-weight: 600;
    margin-left: 5px;
    transition: all 0.2s ease;
}
.prompt-toggle:hover {
    text-decoration: underline;
    color: #fc5c7d;
}
/* 历史记录日志按钮样式 */
.history-logs {
    margin-top: 10px;
}

.btn-view-log {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
    color: #6a82fb;
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-view-log:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(236, 72, 153, 0.2));
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

/* 暗色主题下的日志按钮 */
body.dark .btn-view-log {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border-color: rgba(99, 102, 241, 0.3);
}

body.dark .btn-view-log:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.5);
}

.error { color: #dc3545; background: #f8d7da; padding: 10px; border-radius: 5px; margin-top: 10px; display: none; }
.error.show { display: block; }
.success { color: #155724; background: #d4edda; padding: 10px; border-radius: 5px; margin-top: 10px; display: none; }
.success.show { display: block; }

/* 模型选择容器样式 - 优化版 */
.model-selection-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
    padding: 20px;
    background: linear-gradient(145deg, rgba(249, 250, 251, 0.5), rgba(255, 255, 255, 0.8));
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(99, 102, 241, 0.1);
}

.model-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.model-column > label {
    font-weight: 700;
    color: var(--gray-800);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.model-column > label::before {
    content: '';
    width: 4px;
    height: 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

.custom-checkbox span {
    line-height: 1.4;
    color: #333;
}

/* 复选框美化 */
.custom-checkbox input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    margin-right: 8px;
    flex-shrink: 0;
}

.custom-checkbox input[type="checkbox"]:hover {
    border-color: var(--primary-color);
    background: rgba(106, 130, 251, 0.08);
    box-shadow: 0 0 8px rgba(106, 130, 251, 0.2);
}

.custom-checkbox input[type="checkbox"]:checked {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-color: var(--primary-color);
    box-shadow: 0 0 12px rgba(106, 130, 251, 0.4);
}

.custom-checkbox input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    margin-top: 8px;
    font-size: 15px;
    cursor: pointer;
    padding: 5px 0;
    user-select: none;
}

.custom-checkbox:hover {
    color: #6a82fb;
}

.model-column select {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 12px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
    color: #333;
}

/* 模型选择框高度固定，防止被自定义输入框影响 */
#imageModels, #videoModels {
    overflow-y: auto !important;
    height: 180px !important;
    min-height: 180px !important;
    max-height: 180px !important;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius-md);
    background: rgba(255, 255, 255, 0.9);
    padding: 8px;
    transition: all var(--transition-normal);
}

#imageModels:hover, #videoModels:hover {
    border-color: var(--gray-300);
    background: rgba(255, 255, 255, 0.95);
}

#imageModels:focus, #videoModels:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: white;
}

/* 选项样式优化 */
#imageModels option, #videoModels option {
    padding: 8px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
}

#imageModels option:hover, #videoModels option:hover {
    background: var(--gray-50);
}

#imageModels option:checked, #videoModels option:checked {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
    font-weight: 600;
}

/* 自定义模型输入框样式，防止影响选择框高度 */
#customImageModelInput, #customVideoModelInput {
    position: relative;
    z-index: 1;
}

.model-column select:focus {
    border-color: #6a82fb;
    outline: none;
    box-shadow: 0 0 0 3px rgba(106, 130, 251, 0.2);
}

.model-column input[type="text"] {
    margin-top: 8px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.8);
    color: #333;
}

.model-column input[type="text"]::placeholder {
    color: #999;
}

.model-column input[type="text"]:focus {
    outline: none;
    border-color: #6a82fb;
    box-shadow: 0 0 0 3px rgba(106, 130, 251, 0.1);
    background: rgba(255, 255, 255, 0.95);
}

@media (max-width: 1024px) {
    .container { max-width: 90%; }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .main-content { 
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .param-grid { 
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .history-grid { 
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .container { 
        max-width: 100%;
        padding: 20px;
        border-radius: var(--border-radius-md);
        margin-top: 0;
    }
    
    /* 移动端按钮统一样式 - 优化触摸目标 */
    .btn {
        padding: 14px 20px !important;
        min-height: 48px;
        height: 48px;
        font-size: 15px !important;
        text-transform: none !important;
        letter-spacing: 0.3px !important;
        width: 100%;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 12px !important;
        font-weight: 600 !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* 主按钮在移动端的特殊处理 */
    .btn-primary {
        font-size: 16px !important;
        padding: 14px 20px !important;
        min-height: 52px;
        height: 52px;
        box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25) !important;
    }
    
    .btn-secondary, .btn-light {
        font-size: 14px !important;
        padding: 12px 16px !important;
        min-height: 44px;
        height: 44px;
    }
    
    /* 小按钮样式 */
    .btn-small {
        padding: 8px 12px !important;
        min-height: 36px;
        height: 36px;
        font-size: 13px !important;
    }
    
    /* 按钮组移动端布局 */
    .buttons {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .buttons .btn {
        width: 100%;
        flex: none;
    }
    
    /* 头部导航移动端优化 */
    .topbar {
        height: 56px;
        padding: 0 10px;
    }
    
    .topbar-inner {
        padding: 0 10px;
    }
    
    .brand-name {
        display: none;
    }
    
    .brand-logo {
        font-size: 22px;
    }
    
    /* 模型选择容器移动端优化 */
    .model-selection-container {
        grid-template-columns: 1fr !important;
        gap: 16px;
        padding: 12px;
        background: transparent;
        border: none;
    }
    
    .model-column {
        display: flex;
        flex-direction: column;
        gap: 10px;
        background: rgba(255, 255, 255, 0.9);
        padding: 14px;
        border-radius: var(--border-radius-md);
        border: 1px solid var(--gray-200);
        box-shadow: var(--shadow-sm);
    }
    
    .model-column > label {
        font-size: 13px;
        font-weight: 600;
        margin-bottom: 4px;
    }
    
    /* 模型选择框移动端高度调整 */
    #imageModels, #videoModels {
        height: 120px !important;
        min-height: 120px !important;
        max-height: 120px !important;
        font-size: 13px;
        padding: 6px;
        border-radius: var(--border-radius-sm);
    }
    
    #imageModels option, #videoModels option {
        padding: 6px;
        line-height: 1.4;
    }
    
    /* 自定义输入框移动端优化 */
    #customImageModelInput, #customVideoModelInput {
        font-size: 13px;
        padding: 10px;
        margin-top: 6px !important;
        border-radius: var(--border-radius-sm);
    }
    
    /* 复选框移动端优化 */
    .custom-checkbox {
        padding: 8px 0;
        font-size: 13px;
        margin-top: 6px !important;
    }
    
    .custom-checkbox input[type="checkbox"] {
        width: 18px;
        height: 18px;
        margin-right: 6px;
    }
    
    .custom-checkbox span {
        font-size: 13px;
    }
    
    /* 图片上传区域 */
    .image-upload-section {
        grid-template-columns: 1fr;
    }
    
    .file-upload-label {
        padding: 16px !important;
        font-size: 14px;
    }
    
    /* 标题移动端 */
    h1 {
        font-size: 2em;
        margin-bottom: var(--spacing-md);
    }
    
    h1::before, h1::after {
        display: none;
    }
    
    /* 卡片区域移动端 */
    .card-section {
        padding: 20px;
        margin-bottom: 20px;
        border-radius: var(--border-radius-md);
    }
    
    .card-section h3 {
        font-size: 1.1em;
        margin-bottom: 16px;
        padding-bottom: 12px;
    }
    
    .input-section {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .input-section h3 {
        font-size: 1em;
        margin-top: 20px;
        margin-bottom: 12px;
    }
    
    .input-section h3:first-child {
        margin-top: 0;
    }
    
    /* 输入框移动端 */
    .input-group {
        margin-bottom: 16px;
    }
    
    .input-group label {
        font-size: 13px;
        margin-bottom: 8px;
    }
    
    .input-group input,
    .input-group textarea,
    .input-group select {
        font-size: 16px; /* 防止iOS缩放 */
        padding: 12px;
        border-radius: var(--border-radius-sm);
    }
    
    .input-group textarea {
        min-height: 80px;
    }
    
    /* 结果区域移动端 */
    .result-section {
        padding: 20px;
        margin-top: 20px;
    }
    
    .generated-image {
        max-height: 300px;
    }
    
    /* 历史区域移动端 */
    .history-section {
        padding: 20px;
        margin-top: 20px;
    }
    
    .history-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .history-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .history-actions .btn {
        flex: 1;
        font-size: 12px !important;
        padding: 8px 10px !important;
        min-height: 36px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .container { 
        max-width: 100%;
        padding: 15px;
        border-radius: var(--border-radius-sm);
        margin-top: 0;
        box-shadow: var(--shadow-md);
    }
    
    .main-content {
        gap: 16px;
    }
    
    /* 按钮超小屏优化 */
    .btn {
        padding: 10px 12px !important;
        font-size: 13px !important;
        min-height: 40px;
        max-height: 44px;
        width: 100%;
        text-transform: none !important;
        letter-spacing: normal !important;
    }
    
    .buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn-primary {
        font-size: 13px !important;
        padding: 10px 12px !important;
    }
    
    /* 历史操作按钮超小屏 */
    .history-actions .btn {
        font-size: 11px !important;
        padding: 6px 8px !important;
        min-height: 32px;
    }
    
    /* 历史记录网格 */
    .history-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .history-item {
        min-height: auto;
        padding: 12px;
    }
    
    /* 模型选择超小屏优化 */
    .model-selection-container {
        padding: 12px;
        gap: 16px;
    }
    
    .model-column > label {
        font-size: 13px;
    }
    
    #imageModels, #videoModels {
        height: 120px !important;
        min-height: 120px !important;
        max-height: 120px !important;
        font-size: 13px;
        padding: 6px;
    }
    
    /* 参数网格 */
    .param-grid {
        gap: 10px;
    }
    
    /* 输入组 */
    .input-group {
        margin-bottom: 16px;
    }
    
    .input-group label {
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    /* 标题 */
    h1 {
        font-size: 1.5em;
        text-align: center;
        padding: 0 10px;
    }
    
    /* 节省空间的调整 */
    .card-section {
        padding: 15px;
    }
    
    .card-section h3 {
        font-size: 0.95em;
        margin-bottom: 10px;
        padding-bottom: 8px;
    }
    
    .input-section {
        padding: 15px;
    }
    
    .input-section h3 {
        font-size: 0.9em;
        margin-bottom: 10px;
        padding-bottom: 6px;
    }
    
    /* 结果和历史区域超小屏 */
    .result-section,
    .history-section {
        padding: 15px;
        border-radius: var(--border-radius-sm);
    }
    
    /* 图片预览容器 */
    .image-preview-container {
        padding: 10px;
        gap: 8px;
    }
    
    .image-preview-container > div {
        width: 60px !important;
        height: 60px !important;
    }
    
    /* 底部导航 */
    .footer-inner {
        padding: 16px 12px;
    }
    
    .footer-brand {
        font-size: 14px;
    }
    
    .footer-link {
        font-size: 12px;
        padding: 8px 10px;
    }
    
    /* 返回顶部按钮 */
    .back-to-top {
        width: 40px;
        height: 40px;
        right: 16px;
        bottom: 16px;
        font-size: 16px;
    }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .topbar {
        height: 50px;
    }
    
    .container {
        margin-top: 10px;
    }
    
    #imageModels, #videoModels {
        height: 100px !important;
        min-height: 100px !important;
        max-height: 100px !important;
    }
    
    h1 {
        font-size: 1.8em;
        margin-bottom: 16px;
    }
}

/* iOS安全区域适配 */
@supports (padding: env(safe-area-inset-bottom)) {
    .site-footer {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .topbar {
        padding-top: env(safe-area-inset-top);
    }
    
    @media (max-width: 768px) {
        .topbar-actions {
            padding-bottom: env(safe-area-inset-bottom);
        }
    }
}

/* 浮动提示框样式 */
.toast-notification {
    position: fixed;
    top: 13%;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    z-index: 9999;
    display: none; /* 默认隐藏 */
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    text-align: center;
    min-width: 250px;
}
/* 成功提示背景色 */
.toast-notification.success {
    background-color: #28a745;
}
/* 错误提示背景色 */
.toast-notification.error {
    background-color: #dc3545;
}

/* 公告弹窗样式 (最终审美版) */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.6); /* 纯白磨砂玻璃效果 */
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    color: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.3); /* 边框更清晰 */
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
    padding: 20px 25px;
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    border-radius: 16px;
    max-width: 380px;
    font-size: 14px;
    font-family: 'Segoe UI', sans-serif;
    /* 新增：优化动画效果 */
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    visibility: hidden;
}

/* 新增：用于显示弹窗的类 */
.toast.show {
    opacity: 1;
    transform: translateX(0);
    visibility: visible;
}

.toast-content p { margin: 0; }
.toast-content strong { color: #434190; } /* 加深颜色 */
.toast-content a { color: #667eea; text-decoration: none; font-weight: 600;} /* 加粗链接 */
.toast-content a:hover { text-decoration: underline; }

.toast-header { font-size: 1.1em; font-weight: 600; color: #333; margin-bottom: 15px; }
.toast-section { margin-bottom: 12px; }
.toast-section > strong { display: block; margin-bottom: 8px; } /* 确保标题独占一行并有间距，修正左对齐问题 */
.toast-section ul { list-style: none; padding: 5px 0 0 5px; margin: 0; }
.toast-section code {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'Segoe UI', sans-serif;
    font-weight: 500;
    margin: 4px 2px; /* 增加垂直外边距，防止重叠 */
    display: inline-block;
    transition: transform 0.3s ease;
}

.toast-section code:hover {
    transform: scale(1.1) rotate(-2deg);
}

.toast-tips {
    background: rgba(102, 126, 234, 0.1); padding: 8px 12px; border-radius: 8px; font-size: 0.9em; margin-top: 10px;
}
.toast-tips strong { color: #667eea; }


.toast p {
    margin: 0;
}

.toast button {
    background: rgba(0,0,0,0.05);
    border: none;
    cursor: pointer;
    color: #888;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 15px;
    flex-shrink: 0;
    transition: background-color 0.3s, color 0.3s;
}

.toast button:hover {
    background-color: rgba(0,0,0,0.1);
    color: #333;
}

/* 新模型公告的特殊样式 */
.toast-section .new-model {
    background: linear-gradient(135deg, #f97794 0%, #623aa2 100%);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(249, 119, 148, 0.4);
    transform: scale(1.05);
    transform-origin: left center; /* 确保从左侧开始缩放，修正对齐问题 */
    display: inline-block;
    transition: transform 0.3s ease;
}

/* 结果区域的操作按钮优化 */
.btn-result-action {
    padding: 6px 14px;      /* 减小内边距 */
    font-size: 13px;        /* 减小字体大小 */
    font-weight: 500;       /* 调整字重 */
    border-radius: 6px;     /* 更圆润的边角 */
    border: 1px solid #dee2e6; /* 定义默认边框 */
    background: #f8f9fa;    /* 浅灰色背景 */
    color: #495057;         /* 深灰色文字 */
    box-shadow: 0 1px 2px rgba(0,0,0,0.05); /* 添加细微阴影 */
    transition: all 0.2s ease; /* 平滑过渡效果 */
}

.btn-result-action:hover {
    transform: translateY(-1px); /* 悬停时轻微上浮 */
    box-shadow: 0 4px 8px rgba(0,0,0,0.08); /* 悬停时增强阴影 */
    border-color: #ced4da;
    background-color: #f1f3f5;
}

.toast-section .new-model:hover {
    transform: scale(1.2) rotate(-2deg);
}


/* 修正生成结果中的长提示词溢出问题 */
.result-prompt-info {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 12px;
    color: #666;
    text-align: left;
    word-break: break-all;
    overflow-wrap: break-word;
    border-left: 3px solid #6a82fb;
}

/* ========== 图片上传区域 ========== */

/* 简化文件上传标签样式 */
.file-upload-label {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 12px 15px !important;
    background: #f8f9fa !important;
    border: 2px dashed #ddd !important;
    border-radius: 12px !important;
    cursor: pointer;
    transition: all 0.3s ease !important;
    text-align: center !important;
    color: #6c757d;
    font-size: 14px;
}

.file-upload-label:hover {
    border-color: #6a82fb !important;
    background: #f0f2ff !important;
    color: #6a82fb;
}

/* URL输入区域美化 */
.url-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.url-input-wrapper textarea {
    flex: 1;
    padding: 10px !important;
    border: 1px solid #ddd !important;
    border-radius: 12px !important;
    font-size: 14px !important;
    transition: all 0.3s ease !important;
    resize: none !important;
    min-height: 42px;
    overflow-y: hidden;
    line-height: 1.4;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: rgba(255, 255, 255, 0.8) !important;
    color: #333 !important;
}

.url-input-wrapper textarea::placeholder {
    color: #999 !important;
}

.url-input-wrapper textarea:focus {
    outline: none;
    border-color: #6a82fb !important;
    box-shadow: 0 0 0 3px rgba(106, 130, 251, 0.1) !important;
    background: rgba(255, 255, 255, 0.95) !important;
}

.btn-url-load {
    padding: 10px 16px;
    background: #e9ecef;
    color: #6c757d;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: not-allowed;
    transition: all 0.3s ease;
    white-space: nowrap;
    height: 42px;
    opacity: 0.6;
}

/* 加载按钮激活状态 */
.btn-url-load.active {
    background: linear-gradient(135deg, #6a82fb, #fc5c7d);
    color: white;
    opacity: 1;
    cursor: pointer;
    border-color: rgba(106, 130, 251, 0.3);
}

.btn-url-load.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(106, 130, 251, 0.4);
}

/* 图片预览容器美化 */
.image-preview-container {
    display: none;
    flex-wrap: wrap;
    gap: 12px;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    margin-bottom: 20px;
    align-items: center;
    justify-content: flex-start;
    backdrop-filter: blur(5px);
}

/* 限制图片预览尺寸 - 非常重要！ */
.image-preview-container > div {
    position: relative !important;
    flex-shrink: 0 !important;
    width: 70px !important;
    height: 70px !important;
}

.image-preview-container img {
    width: 100% !important;
    height: 100% !important;
    border-radius: 8px !important;
    border: 1px solid #dee2e6 !important;
    object-fit: cover !important;
    background: white !important;
    max-width: 70px !important;
    max-height: 70px !important;
}

/* 重写删除按钮样式 */
.image-preview-container .delete-image-btn {
    position: absolute !important;
    top: -8px !important;
    right: -8px !important;
    width: 20px !important;
    height: 20px !important;
    border-radius: 50% !important;
    background: #dc3545 !important;
    color: white !important;
    border: 2px solid white !important;
    font-size: 12px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10 !important;
    transition: all 0.3s ease !important;
}

.image-preview-container .delete-image-btn:hover {
    background: #c82333 !important;
    transform: scale(1.1) !important;
}

/* ===== Topbar & Layout Upgrades ===== */
:root { 
    --topbar-height: 56px;
    
    /* 优化的色彩系统 */
    --primary-color: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary-color: #ec4899;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    
    /* 中性色阶 */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* 背景色 */
    --light-bg: #ffffff;
    --light-bg-secondary: #f9fafb;
    --light-text: #111827;
    --dark-bg: #0f172a;
    --dark-bg-secondary: #1e293b;
    --dark-text: #f1f5f9;
    
    /* 圆角系统 */
    --border-radius-xs: 4px;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;
    --border-radius-full: 9999px;
    
    /* 阴影系统 - 更细腻的层次 */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
    
    /* 间距系统 */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 4rem;
    
    /* 动画时长 */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* 字体系统 */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Monaco, Consolas, monospace;
}

html { 
    scroll-behavior: smooth;
}

/* 页面加载入场动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(30px);
    }
}

/* 移动端弹窗动画 */
@keyframes slideUpMobile {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDownMobile {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(100%);
    }
}

.container {
    animation: fadeInUp 0.6s ease-out;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 999;
    height: var(--topbar-height);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(249, 250, 251, 0.9) 100%);
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.08),
        0 1px 0 rgba(255, 255, 255, 0.8) inset;
    transition: all var(--transition-normal);
}

.topbar.scrolled {
    height: calc(var(--topbar-height) - 8px);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 1px 0 rgba(255, 255, 255, 0.6) inset;
}

.topbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: relative;
}

/* 移动端汉堡菜单 */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    position: relative;
    z-index: 1001;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--primary-color);
    margin: 5px 0;
    transition: all var(--transition-fast);
    border-radius: 2px;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: #333;
}
.brand-logo { font-size: 20px; }
.brand-name { font-size: 16px; }

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition-normal);
}

/* 移动端导航菜单 */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .topbar-actions {
        position: fixed;
        top: var(--topbar-height);
        right: -100%;
        width: 280px;
        height: calc(100vh - var(--topbar-height));
        height: calc(100dvh - var(--topbar-height));
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        align-items: stretch;
        padding: 20px;
        gap: 10px;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
        z-index: 998;
    }
    
    .topbar-actions.active {
        right: 0;
    }
    
    .topbar-link {
        display: block;
        width: 100%;
        text-align: left;
        padding: 12px 16px;
        border-radius: var(--border-radius-md);
    }
    
    .topbar-btn {
        width: 100%;
        justify-content: center;
        padding: 10px 14px !important;
        display: flex !important;
        align-items: center;
        gap: 6px;
        min-height: 40px;
        max-height: 44px;
        font-size: 13px !important;
        font-weight: 600;
        text-transform: none !important;
        letter-spacing: normal !important;
    }
    
    /* 特殊处理立即生成按钮 */
    #ctaGenerateBtn {
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
        color: white !important;
        border: none;
        margin-top: 10px;
        box-shadow: 0 3px 10px rgba(99, 102, 241, 0.25);
        font-size: 13px !important;
        padding: 10px 14px !important;
    }
    
    #ctaGenerateBtn:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
    }
    
    /* 主题按钮在移动端的样式 */
    #themeToggleBtn {
        background: var(--gray-100) !important;
        color: var(--gray-700) !important;
        border: 1px solid var(--gray-200) !important;
        font-size: 13px !important;
        padding: 10px 14px !important;
    }
    
    .base-url-summary {
        padding: 12px 16px;
        background: var(--gray-50);
        border-radius: var(--border-radius-md);
        margin-bottom: 10px;
    }
    
    /* 移动端遮罩层 */
    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 997;
        opacity: 0;
        transition: opacity var(--transition-normal);
    }
    
    .mobile-overlay.active {
        display: block;
        opacity: 1;
    }
}

.topbar-link {
    color: #6a82fb;
    text-decoration: none;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    position: relative;
    font-size: 0.95em;
}

.topbar-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2.5px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width var(--transition-fast);
    border-radius: 2px;
}

.topbar-link:hover { 
    background: rgba(106, 130, 251, 0.08);
    color: var(--secondary-color);
}

.topbar-link:hover::after {
    width: 100%;
}

.topbar-btn { padding: 6px 10px; }

.base-url-summary {
    font-size: 12px;
    color: #666;
    margin-right: 8px;
}

/* Anchors scroll offset */
#inputSection, #resultSection, #historySection {
    scroll-margin-top: calc(var(--topbar-height) + 12px);
}

/* Sticky result panel on desktop */
@media (min-width: 992px) {
    .result-section {
        position: sticky;
        top: calc(var(--topbar-height) + 20px);
    }
}

/* ===== Dark Theme (opt-in via body.dark) ===== */
body.dark {
    background: linear-gradient(135deg, #0f172a 0%, #1f2937 100%);
    color: #e2e8f0;
}

body.dark .container {
    background: rgba(10, 14, 26, 0.95);
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.4), 0 0 1px rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark h1 {
    color: #e5e7eb;
    background: none;
    -webkit-text-fill-color: initial;
}

body.dark .input-section,
body.dark .result-section,
body.dark .history-section {
    background: rgba(15, 23, 42, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e8ecf5;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

body.dark .input-group label { color: #e5e7eb; }

body.dark .input-group input,
body.dark .input-group textarea,
body.dark .input-group select {
    background: rgba(11, 18, 32, 0.8);
    border-color: rgba(255, 255, 255, 0.15);
    color: #e8ecf5;
}

body.dark .input-group input:focus,
body.dark .input-group textarea:focus,
body.dark .input-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(106, 130, 251, 0.15), 0 0 20px rgba(106, 130, 251, 0.3), inset 0 1px 2px rgba(106, 130, 251, 0.1);
}

body.dark .input-group input::placeholder,
body.dark .input-group textarea::placeholder {
    color: #94a3b8;
}

body.dark .btn-secondary { background: #334155; color: #e2e8f0; }
body.dark .btn-light { background: #0f172a; color: #e2e8f0; border-color: #334155; }
body.dark .btn-light:hover { background: #111827; border-color: #475569; }

body.dark .log-panel { background: #0f172a; color: #e2e8f0; border-color: #1e293b; }

body.dark .history-item { background: #0f172a; }
body.dark .history-prompt { color: #cbd5e1; }
body.dark .history-time { color: #94a3b8; }

body.dark .topbar {
    background: rgba(17, 24, 39, 0.6);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
body.dark .topbar-link { color: #a5b4fc; }
body.dark .topbar-link:hover { background: rgba(99, 102, 241, 0.12); }
body.dark .base-url-summary { color: #cbd5e1; }

body.dark .result-prompt-info {
    background: #0f172a;
    color: #cbd5e1;
}

body.dark .image-preview-container {
    background: #0f172a;
    border-color: #1e293b;
}
body.dark .image-preview-container img {
    border-color: #334155 !important;
    background: #111827 !important;
}

body.dark .file-upload-label {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
body.dark .file-upload-label:hover {
    background: #111827 !important;
    border-color: #475569 !important;
    color: #a5b4fc !important;
}

body.dark .url-input-wrapper textarea {
    background: #0b1220 !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

body.dark .btn-url-load { background: #334155; color: #e2e8f0; }
body.dark .btn-url-load.active { background: linear-gradient(135deg, #667eea, #764ba2); }

body.dark .toast { 
    background: rgba(17, 24, 39, 0.6);
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.1);
}
body.dark .toast-content strong { color: #a5b4fc; }

body.dark .toast-notification.success { background-color: #198754; }
body.dark .toast-notification.error { background-color: #b02a37; }

/* ===== Site Footer - 升级版 ===== */
.site-footer {
    margin-top: 40px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(249, 250, 251, 0.9) 100%);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid rgba(99, 102, 241, 0.1);
    box-shadow: 
        0 -4px 20px rgba(0, 0, 0, 0.05),
        0 -1px 0 rgba(255, 255, 255, 0.8) inset;
    position: relative;
    overflow: hidden;
}

/* 底部装饰动画 */
.site-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    right: -100%;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        var(--primary-light), 
        var(--secondary-color), 
        transparent);
    animation: shimmer 4s ease-in-out infinite;
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.footer-left {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--gray-600);
    font-size: 14px;
}

.footer-brand {
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 16px;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-link {
    color: var(--gray-700);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.footer-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent);
    transition: left 0.5s;
}

.footer-link:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
    color: var(--primary-color);
    transform: translateY(-2px);
}

.footer-link:hover::before {
    left: 100%;
}

/* 底部响应式 */
@media (max-width: 768px) {
    .footer-inner {
        flex-direction: column;
        text-align: center;
        padding: 24px 16px;
    }
    
    .footer-left {
        flex-direction: column;
        gap: 8px;
    }
    
    .footer-right {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .footer-link {
        padding: 10px 14px;
        min-width: 80px;
        text-align: center;
    }
}

/* ===== Back To Top ===== */
.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    border: none;
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(10px) scale(0.8);
    pointer-events: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
    z-index: 1000;
}

.back-to-top:hover {
    box-shadow: 0 16px 35px rgba(102, 126, 234, 0.5);
    transform: translateY(-3px) scale(1.05);
}

.back-to-top:active {
    transform: translateY(-1px) scale(1.02);
}

.back-to-top.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ===== Dark Theme for Footer & BackToTop ===== */
body.dark .site-footer {
    background: rgba(17, 24, 39, 0.6);
    border-top-color: rgba(255, 255, 255, 0.08);
}
body.dark .footer-left { color: #cbd5e1; }
body.dark .footer-brand { color: #a5b4fc; }
body.dark .footer-link { color: #a5b4fc; }
body.dark .footer-link:hover { background: rgba(99, 102, 241, 0.12); }
body.dark .back-to-top { box-shadow: 0 10px 20px rgba(17, 24, 39, 0.45); }
