/* Modern AI Image Generator Styles - ChatGPT Inspired */

:root {
    /* Color Palette - Banana Theme */
    --primary: #f59e0b;
    --primary-hover: #d97706;
    --secondary: #fbbf24;
    --secondary-hover: #f59e0b;
    --accent: #fed7aa;
    --danger: #ef4444;
    
    /* Neutral Colors */
    --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;
    
    /* Background - Banana themed */
    --bg-primary: #ffffff;
    --bg-secondary: #fef7cd;
    --bg-tertiary: #fef3c7;
    --bg-dark: #0f1419;
    
    /* Text Colors */
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-600);
    --text-tertiary: var(--gray-500);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    
    /* Borders */
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;
    
    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 全局防溢出处理 */
html {
    width: 100%;
    overflow-x: hidden;
    /* Smooth scrolling for mobile */
    scroll-behavior: smooth;
    /* Prevent text size adjustments on mobile */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

/* Touch improvements */
button, a, input, textarea, select {
    /* Remove tap highlight on iOS */
    -webkit-tap-highlight-color: transparent;
    /* Improve touch responsiveness */
    touch-action: manipulation;
}

/* Form elements mobile optimization */
input, textarea, select, button {
    /* Prevent zoom on focus in iOS Safari */
    font-size: 16px;
}

@media (max-width: 768px) {
    input, textarea, select {
        font-size: 16px; /* Prevent iOS zoom */
    }
}

/* Font Awesome Icon Support */
.fa, .fas, .far, .fal, .fad, .fab {
    font-family: "Font Awesome 5 Free", "Font Awesome 5 Pro", "FontAwesome" !important;
    font-style: normal;
    font-display: auto;
    line-height: 1;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: inline-block;
    text-decoration: none;
}

.fas, .fa {
    font-weight: 900 !important;
}

.far {
    font-weight: 400 !important;
}

.fab {
    font-weight: 400 !important;
}

/* Button icon specific fixes */
button .fas, button .far, button .fab, button .fa {
    pointer-events: none;
    vertical-align: middle;
    line-height: inherit;
}

/* Fallback SVG icons - if Font Awesome fails to load */
.icon-fallback {
    width: 14px;
    height: 14px;
    display: inline-block;
    vertical-align: middle;
}

/* Button fallback icons */
.upload-btn .icon-fallback {
    fill: currentColor;
}

.send-btn .icon-fallback {
    fill: currentColor;
}

.action-btn .icon-fallback {
    fill: currentColor;
}

/* Spinner animation for fallback icons */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: linear-gradient(135deg, #fef7cd 0%, #fef3c7 25%, #fed7aa 65%, #fdba74 100%);
    background-attachment: fixed; /* 固定背景，防止滚动时背景移动 */
    background-size: 100% 100%; /* 确保背景覆盖整个视窗 */
    background-repeat: no-repeat;
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    /* Mobile-specific optimizations */
    overscroll-behavior-y: none; /* Prevent bounce scroll on iOS */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    /* 确保没有水平滚动 */
    overflow-x: hidden;
    width: 100%;
}

/* Mobile scroll improvements */
@supports (-webkit-touch-callout: none) {
    body {
        /* iOS-specific smooth scrolling */
        -webkit-overflow-scrolling: touch;
    }
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100vw; /* 防止超出视窗宽度 */
    overflow-x: hidden; /* 防止水平滚动 */
}

/* Dark Mode Support */
[data-theme="dark"] {
    --bg-primary: #1a202c;
    --bg-secondary: #2d3748;
    --bg-tertiary: #4a5568;
    --text-primary: #f7fafc;
    --text-secondary: #cbd5e0;
    --text-tertiary: #a0aec0;
    --gray-100: #2d3748;
    --gray-200: #4a5568;
    --gray-300: #718096;
    --gray-400: #a0aec0;
    --gray-500: #cbd5e0;
}

/* Header and Navigation - Enhanced with responsive fixes - FORCED */
.app-header {
    background: var(--bg-primary) !important;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
    box-sizing: border-box;
    transition: var(--transition);
    width: 100% !important;
    max-width: 100vw !important; /* 防止超出视窗宽度 */
    overflow: visible !important; /* 改为可见，允许内容显示 */
    /* 移除固定高度，允许高度自适应 */
    height: auto !important;
    min-height: 60px !important; /* 只设置最小高度 */
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px !important;
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    min-height: 48px !important;
    height: auto !important;
    width: 100%;
    box-sizing: border-box;
    flex-wrap: nowrap !important;
    gap: 12px;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
    flex-shrink: 0;
    min-width: max-content;
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.logo-img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: contain;
    /* Prevent image flex */
    flex-shrink: 0;
}

.logo-icon {
    font-size: 20px;
    color: var(--primary);
    /* Prevent icon flex */
    flex-shrink: 0;
}

.logo i {
    font-size: 20px;
    color: var(--primary);
    flex-shrink: 0;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
    overflow: visible;
    flex-wrap: nowrap;
    white-space: nowrap;
    margin: 0 16px;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: max-content;
}

.nav-tab:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.nav-tab.active {
    background: var(--primary);
    color: white;
}

.nav-tab i {
    font-size: 14px;
    width: 14px;
    text-align: center;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    /* Remove conflicting styles since it inherits from .nav-item */
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    overflow: hidden;
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
    border-bottom: 1px solid var(--gray-100);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: var(--gray-100);
}

.dropdown-item i {
    font-size: 14px;
    width: 16px;
    flex-shrink: 0;
}

.dropdown-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 4px 0;
}

/* Header Right Side - Simplified Layout */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Theme Toggle Button - 强化样式确保可见性 */
.theme-btn {
    width: 40px !important;
    height: 40px !important;
    border: 2px solid var(--gray-300) !important;
    border-radius: var(--border-radius) !important;
    background: var(--bg-primary) !important;
    color: var(--text-secondary) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: var(--transition) !important;
    position: relative !important;
    font-size: 18px !important;
    flex-shrink: 0 !important;
    z-index: 10 !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.theme-btn:hover {
    background: var(--gray-100) !important;
    color: var(--text-primary) !important;
    border-color: var(--primary) !important;
    transform: scale(1.05) !important;
}

.theme-btn i {
    position: absolute !important;
    transition: all 0.3s ease !important;
    font-size: 16px !important;
}

/* 默认显示月亮图标 */
.theme-btn .dark-icon {
    display: block !important;
    opacity: 1 !important;
}

.theme-btn .light-icon {
    display: none !important;
    opacity: 0 !important;
}

/* 暗色模式下显示太阳图标 */
[data-theme="dark"] .theme-btn .dark-icon {
    display: none !important;
    opacity: 0 !important;
}

[data-theme="dark"] .theme-btn .light-icon {
    display: block !important;
    opacity: 1 !important;
}

.credits-info {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--primary);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    flex-shrink: 0;
    z-index: 1;
}

.user-menu-wrapper {
    position: relative;
    flex-shrink: 0;
    z-index: 2;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.user-menu-btn:hover {
    background: var(--gray-100);
    color: var(--text-primary);
    border-color: var(--primary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.default-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.username {
    font-size: 14px;
    font-weight: 500;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    overflow: hidden;
    margin-top: 4px;
    display: none; /* 默认完全隐藏 */
}

.user-menu-wrapper.active .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    display: block; /* 激活时显示 */
}

.user-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s ease;
    border-bottom: 1px solid var(--gray-100);
}

.user-dropdown .dropdown-item:last-child {
    border-bottom: none;
}

.user-dropdown .dropdown-item:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.user-dropdown .dropdown-item i {
    font-size: 14px;
    width: 16px;
    flex-shrink: 0;
}

.user-dropdown .dropdown-item span {
    font-size: 14px;
    font-weight: 500;
}

.mobile-menu-toggle {
    display: none !important; /* 在桌面版完全隐藏 */
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
    color: var(--text-secondary);
}

.mobile-menu-toggle:focus {
    outline: none;
}

/* Show mobile menu toggle on small screens */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex !important;
    }
    
    .nav-tabs {
        display: none; /* 隐藏主导航 */
    }
    
    .header-right {
        gap: 8px; /* 减少间距 */
    }
    
    .credits-info,
    .user-menu-btn .username {
        display: none; /* 隐藏一些元素节省空间 */
    }
}

/* Auth buttons styling */
.auth-btn {
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.auth-btn.login-btn {
    background: var(--gray-100);
    color: var(--text-primary);
}

.auth-btn.login-btn:hover {
    background: var(--gray-200);
}

.auth-btn.register-btn {
    background: var(--primary);
    color: white;
}

.auth-btn.register-btn:hover {
    background: var(--primary-hover);
}

/* User Menu Styles - Enhanced for responsive */
.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    /* 允许内容换行 */
    flex-wrap: wrap;
    justify-content: flex-end;
    /* 在响应式模式下可能变为垂直 */
    transition: all 0.3s ease;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    /* 确保在垂直布局中保持水平 */
    flex-direction: row;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    /* 允许按钮换行 */
    flex-wrap: wrap;
    justify-content: flex-end;
    /* 为响应式布局预留空间 */
    min-width: fit-content;
}

/* Profile dropdown and action buttons - responsive ready */
.profile-dropdown {
    position: relative;
    flex-shrink: 0;
    white-space: nowrap;
}

.profile-dropdown .dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    overflow: hidden;
    margin-top: 4px;
    display: none;
}

.profile-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    display: block;
}

.recharge-history-btn, 
.admin-btn, 
.logout-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.profile-btn,
.recharge-history-btn,
.admin-btn,
.logout-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.profile-btn:hover,
.recharge-history-btn:hover,
.admin-btn:hover,
.logout-btn:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.credits-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--primary);
    color: white;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    flex-shrink: 0;
}

.credits-display i.fa-coins {
    font-size: 16px;
    color: #fbbf24;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.recharge-btn {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 12px;
    padding: 2px;
    border-radius: 50%;
    transition: color 0.2s;
}

.recharge-btn:hover {
    color: white;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: none;
    border: none;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    white-space: nowrap;
}

.user-btn:hover {
    background: var(--gray-100);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.default-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.username {
    font-size: 14px;
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu .dropdown-item.admin-item {
    color: var(--primary);
}

.user-menu .dropdown-item.logout-item {
    color: #ef4444;
}

/* Auth Section */
.auth-section {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.auth-btn {
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.auth-btn.login-btn {
    background: var(--gray-100);
    color: var(--text-primary);
}

.auth-btn.login-btn:hover {
    background: var(--gray-200);
}

.auth-btn.register-btn {
    background: var(--primary);
    color: white;
}

.auth-btn.register-btn:hover {
    background: var(--primary-hover);
}


/* Language Selector */
.language-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--gray-100);
    border: none;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.language-selector:hover {
    background: var(--gray-200);
    color: var(--text-primary);
}

.language-menu .dropdown-item {
    padding: 10px 16px;
}

.language-menu .lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
}

.language-menu .flag {
    font-size: 16px;
}

.language-menu .lang-option.active {
    background: rgba(245, 158, 11, 0.1);
    color: var(--primary);
}

/* User Section */
.user-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.credits-display {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--primary);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.recharge-btn {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 12px;
    padding: 2px;
    border-radius: 50%;
    transition: color 0.2s;
}

.recharge-btn:hover {
    color: white;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: none;
    border: none;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.user-btn:hover {
    background: var(--gray-100);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.default-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.username {
    font-size: 14px;
    font-weight: 500;
}

.user-menu .dropdown-item.admin-item {
    color: var(--primary);
}

.user-menu .dropdown-item.logout-item {
    color: #ef4444;
}

/* Auth Section */
.auth-section {
    display: flex;
    gap: 8px;
}

/* Mobile Menu */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
}

.mobile-menu-toggle:focus {
    outline: none;
}

.mobile-menu-toggle span {
    width: 30px;
    height: 3px;
    background: var(--text-secondary);
    border-radius: 10px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

.mobile-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-top: 1px solid var(--gray-200);
    box-shadow: var(--shadow-lg);
    padding: 16px 20px;
    z-index: 999;
}

.mobile-nav.active {
    display: block;
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--gray-100);
    transition: var(--transition);
}

.mobile-nav-item:last-child {
    border-bottom: none;
}

.mobile-nav-item:hover {
    color: var(--primary);
}

.mobile-nav-item.active {
    color: var(--primary);
    font-weight: 600;
}

.mobile-nav-item i {
    font-size: 16px;
    width: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-nav {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .header-controls {
        gap: 4px;
    }
    
    .control-btn {
        width: 32px;
        height: 32px;
    }
    
    .language-selector {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .user-section {
        gap: 8px;
    }
    
    .credits-display {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .dropdown-menu {
        right: -10px;
        min-width: 160px;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: 0 12px;
    }
    
    .logo span {
        display: none;
    }
    
    .username {
        display: none;
    }
    
    .language-selector .current-lang {
        display: none;
    }
    
    .dropdown-menu {
        right: -20px;
        min-width: 140px;
    }
    
    .dropdown-item {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* User Menu Styles - Legacy cleanup */

.auth-btn {
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.auth-btn.login-btn {
    background: var(--gray-100);
    color: var(--text-primary);
}

.auth-btn.login-btn:hover {
    background: var(--gray-200);
}

.auth-btn.register-btn {
    background: var(--primary);
    color: white;
}

.auth-btn.register-btn:hover {
    background: var(--primary-hover);
}

/* Main Container */
.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
    /* 防止内容溢出 */
    overflow-x: hidden;
    min-width: 0;
}

/* Generate Container */
.generate-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px 0;
    min-height: calc(100vh - 60px);
}

/* Template Section */
.template-section {
    background: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.section-header {
    text-align: center;
    margin-bottom: 32px;
}

.section-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.section-header p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Template Categories */
.template-categories {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.category-btn {
    background: var(--gray-100);
    border: none;
    padding: 8px 16px;
    border-radius: var(--border-radius-lg);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.category-btn:hover {
    background: var(--gray-200);
    color: var(--text-primary);
}

.category-btn.active {
    background: var(--primary);
    color: white;
}

/* Template Grid */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.template-card {
    background: var(--bg-primary);
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.template-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.template-card.selected {
    border-color: var(--primary);
    background: rgba(16, 163, 127, 0.05);
}

/* Template Thumbnail Styles */
.template-thumbnail {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid var(--gray-200);
    background: var(--gray-100);
}

.template-thumbnail:hover {
    transform: scale(1.05);
    border-color: var(--primary);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.template-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.template-card {
    position: relative;
    padding-right: 100px; /* Make room for thumbnail */
    min-height: 120px;
}

.template-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.template-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.template-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.template-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
    line-height: 1.4;
}

.template-example {
    background: var(--gray-50);
    padding: 12px;
    border-radius: var(--border-radius);
    font-size: 13px;
    color: var(--text-tertiary);
    font-family: 'Monaco', 'Menlo', monospace;
    line-height: 1.3;
    word-break: break-word;
    border-left: 3px solid var(--primary);
}

.template-variables {
    margin-top: 8px;
    font-size: 12px;
    color: var(--accent);
    font-weight: 500;
}

/* Free Form Message */
.free-form-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 40px;
    background: var(--bg-primary);
    border: 2px dashed var(--gray-300);
    border-radius: var(--border-radius-xl);
    margin: 20px 0;
}

.free-form-icon {
    font-size: 48px;
    margin-bottom: 24px;
}

.free-form-message h3 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.free-form-message > p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.free-form-tips {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    text-align: left;
    max-width: 600px;
    margin: 0 auto;
}

.free-form-tips h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.free-form-tips ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.free-form-tips li {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.free-form-tips li:before {
    content: "•";
    color: var(--primary);
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Chat Container - Legacy compatibility */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 60px);
}

/* Input Container */
.input-container {
    background: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.message-form {
    max-width: 100%;
    margin: 0;
}

/* Auth Required Styles */
.auth-required {
    max-width: 800px;
    margin: 0 auto;
}

.auth-required-content {
    background: var(--bg-primary);
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius-xl);
    padding: 40px;
    text-align: center;
}

.auth-required-content i {
    font-size: 48px;
    color: var(--gray-400);
    margin-bottom: 16px;
}

.auth-required-content h3 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.auth-required-content p {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 24px;
}

.auth-required-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.auth-required-buttons .auth-btn {
    padding: 12px 24px;
    font-size: 16px;
}

/* Credit Warning Styles */
.credit-warning {
    margin-bottom: 16px;
    background: #fffbeb;
    border: 1px solid #fbbf24;
    border-radius: var(--border-radius-lg);
    padding: 16px;
}

.credit-warning-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #92400e;
}

.credit-warning-content i {
    font-size: 24px;
    color: #f59e0b;
}

.credit-warning-content h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
}

.credit-warning-content p {
    margin: 0;
    font-size: 14px;
}

/* Disabled state for inputs and buttons */
.input-box textarea:disabled {
    background: var(--gray-100);
    color: var(--gray-500);
    cursor: not-allowed;
}

.upload-btn:disabled,
.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.upload-btn:disabled:hover,
.send-btn:disabled:hover {
    background: var(--gray-100);
    color: var(--text-secondary);
}

.send-btn:disabled:hover {
    background: var(--gray-300);
}

/* 宽高比选择按钮和容器 */
/* 模型选择器样式 */
.model-selector-wrapper {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    margin-right: 8px;
}

.model-selector-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 12px;
    transition: all 0.2s;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 400;
    height: 32px;
    flex-shrink: 0;
    line-height: 1;
    position: relative;
    min-width: 100px;
}

.model-selector-btn:hover {
    background-color: var(--gray-100);
}

.model-selector-btn i {
    font-size: 13px;
}

.model-selector-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 模型选择下拉菜单 */
.model-selector-dropdown {
    position: fixed;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(32, 33, 36, 0.28);
    padding: 8px;
    display: none;
    z-index: 1000;
    min-width: 250px;
    max-width: 350px;
    white-space: nowrap;
}

.model-selector-dropdown.show {
    display: block;
}

.model-selector-loading {
    padding: 12px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.model-selector-loading i {
    margin-right: 8px;
}

.model-option {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
    font-size: 14px;
}

.model-option:hover {
    background-color: var(--gray-100);
}

.model-option.selected {
    background-color: var(--primary-light);
    color: var(--primary);
}

.model-info {
    flex: 1;
}

.model-label {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 2px;
}

.model-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

/* 宽高比选择器样式 */
.aspect-ratio-wrapper {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}

.aspect-ratio-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 12px;
    transition: all 0.2s;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 400;
    height: 32px;
    flex-shrink: 0;
    line-height: 1;
    position: relative;
    min-width: 48px;
}

.aspect-ratio-btn:hover {
    background-color: var(--gray-100);
}

.aspect-ratio-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1;
}

.dropdown-icon {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 400;
}

/* 宽高比下拉菜单 */
.aspect-ratio-dropdown {
    position: fixed;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(32, 33, 36, 0.28);
    padding: 8px;
    display: none;
    z-index: 1000;
    min-width: 200px;
    white-space: nowrap;
}

.aspect-ratio-dropdown.show {
    display: block;
}

.aspect-ratio-option {
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
    font-size: 14px;
}

.aspect-ratio-option:hover {
    background-color: var(--gray-100);
}

.aspect-ratio-option.selected {
    background-color: var(--primary-light);
    color: var(--primary);
}

.aspect-ratio-info {
    flex: 1;
}

.aspect-ratio-label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
}

.aspect-ratio-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.aspect-ratio-option.selected .aspect-ratio-desc {
    color: var(--primary);
}

.check-icon {
    color: var(--primary);
    font-size: 16px;
}

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

.aspect-ratio-btn:disabled:hover {
    background: transparent;
}

/* Image Size Selector Styles (for gemini-3-pro) */
.image-size-wrapper {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}

.image-size-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 12px;
    transition: all 0.2s;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    height: 32px;
    flex-shrink: 0;
    line-height: 1;
    position: relative;
    min-width: 60px;
}

.image-size-btn:hover {
    background-color: var(--gray-100);
}

.image-size-btn i {
    font-size: 12px;
    color: var(--text-secondary);
}

.image-size-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1;
    font-weight: 600;
}

.image-size-dropdown {
    position: fixed;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(32, 33, 36, 0.28);
    padding: 8px;
    display: none;
    z-index: 1000;
    min-width: 160px;
    white-space: nowrap;
}

.image-size-dropdown.show {
    display: block;
}

.image-size-option {
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
    font-size: 14px;
}

.image-size-option:hover {
    background-color: var(--gray-100);
}

.image-size-option.selected {
    background-color: var(--primary-light);
    color: var(--primary);
}

.image-size-info {
    flex: 1;
}

.image-size-label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.image-size-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.image-size-option.selected .image-size-desc {
    color: var(--primary);
}

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

.image-size-btn:disabled:hover {
    background: transparent;
}

/* Image Preview Container */
.image-preview-container {
    margin-bottom: 16px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    padding: 16px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.preview-count {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.preview-count.at-limit {
    color: var(--accent);
    font-weight: 600;
}

.clear-all-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--danger);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.clear-all-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

.image-previews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.image-preview {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--gray-100);
}

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

.image-preview .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    opacity: 0;
    transition: var(--transition);
}

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

/* Preview Overlay for View Button */
.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
}

.image-preview:hover .preview-overlay {
    opacity: 1;
    pointer-events: auto;
}

.preview-view-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--gray-800);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.preview-view-btn:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.preview-view-btn i {
    pointer-events: none;
}

/* Add More Preview Button */
.add-more-preview {
    aspect-ratio: 1;
    border-radius: var(--border-radius);
    background: var(--gray-50);
    border: 2px dashed var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    min-width: 120px;
}

.add-more-preview:hover {
    border-color: var(--primary);
    background: rgba(16, 163, 127, 0.05);
}

.add-more-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    width: 100%;
    height: 100%;
    color: var(--text-secondary);
    transition: var(--transition);
    border-radius: var(--border-radius);
}

.add-more-btn:hover {
    color: var(--primary);
    background: rgba(16, 163, 127, 0.05);
}

.add-more-btn i {
    font-size: 24px;
    margin-bottom: 4px;
}

.add-more-btn span {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
}

/* Input Box */
.input-box {
    background: var(--bg-primary);
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius-xl);
    transition: var(--transition);
}

.input-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

.input-box.drag-over {
    border-color: var(--primary);
    background: rgba(16, 163, 127, 0.05);
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    padding: 16px;
    gap: 12px;
}

/* Syntax Highlight Container */
.syntax-highlight-container {
    flex: 1;
    position: relative;
    display: flex;
}

/* Input wrapper with consistent font settings */
.input-wrapper textarea {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 14px;
    line-height: 1.5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: transparent;
    color: var(--text-primary);
    min-height: 24px;
    max-height: 200px;
    width: 100%;
    position: relative;
    z-index: 2;
    padding: 0;
    margin: 0;
    /* Make text transparent when highlighting is active */
    caret-color: var(--text-primary);
    /* Ensure consistent text rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    /* Match overlay letter spacing */
    letter-spacing: normal;
    word-spacing: normal;
    /* Ensure no text decorations */
    text-decoration: none;
    text-shadow: none;
}

/* Hide original text when syntax highlighting is active */
.syntax-highlight-container.has-variables textarea {
    color: transparent;
    text-shadow: none;
    -webkit-text-fill-color: transparent;
}

/* Keep placeholder visible */
.syntax-highlight-container.has-variables textarea::placeholder {
    color: var(--text-tertiary);
    -webkit-text-fill-color: var(--text-tertiary);
}

.input-wrapper textarea::placeholder {
    color: var(--text-tertiary);
}

.input-wrapper textarea.drag-over {
    background: rgba(16, 163, 127, 0.05);
    border-radius: var(--border-radius);
}

/* Syntax Highlight Overlay */
.syntax-highlight-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    font-size: 14px;
    line-height: 1.5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    min-height: 24px;
    max-height: 200px;
    color: var(--text-primary);
    /* Ensure exact alignment with textarea */
    box-sizing: border-box;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* Match textarea font rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    /* Ensure exact letter spacing match */
    letter-spacing: normal;
    word-spacing: normal;
}

/* Allow pointer events on syntax elements */
.syntax-variable {
    pointer-events: auto;
}

/* Syntax Highlighting Styles */
.syntax-bracket {
    color: var(--gray-300);
    font-weight: 400;
    opacity: 0.7;
}

.syntax-variable {
    color: var(--primary);
    background: rgba(16, 163, 127, 0.08);
    font-weight: 600;
    /* Remove padding and margin to prevent offset */
    padding: 0;
    margin: 0;
    border-radius: 0;
    cursor: pointer;
    transition: var(--transition);
    /* Use box-shadow instead of border to avoid layout shift */
    box-shadow: inset 0 -2px 0 rgba(16, 163, 127, 0.3);
    pointer-events: auto;
    display: inline;
    /* Ensure no layout changes */
    vertical-align: baseline;
    text-decoration: none;
}

.syntax-variable:hover {
    background: rgba(16, 163, 127, 0.15);
    color: var(--primary-hover);
    box-shadow: inset 0 -2px 0 rgba(16, 163, 127, 0.5);
    /* Remove transform to prevent position shifts */
    transform: none;
}

.syntax-variable.selected {
    background: var(--primary);
    color: white;
    box-shadow: inset 0 -2px 0 var(--primary);
}

/* Mobile-friendly touch targets for syntax highlighting */
@media (max-width: 768px) {
    .syntax-variable {
        padding: 2px 4px;
        min-height: 24px;
        display: inline-flex;
        align-items: center;
    }
    
    .syntax-variable:hover {
        transform: none; /* Disable transform on mobile */
    }
}

/* Ensure textarea is transparent for highlighting to show through */
.syntax-highlight-container textarea {
    background: transparent !important;
}

/* Syntax help tip */
.syntax-help-tip {
    position: absolute;
    bottom: -28px;
    left: 0;
    font-size: 12px;
    color: var(--text-tertiary);
    background: rgba(16, 163, 127, 0.05);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(16, 163, 127, 0.2);
    white-space: nowrap;
    z-index: 3;
    animation: fadeInUp 0.3s ease-out;
}

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

.upload-btn, .send-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 14px;
}

.upload-btn {
    background: var(--gray-100);
    color: var(--text-secondary);
    transition: var(--transition);
}

.upload-btn:hover:not(:disabled) {
    background: var(--gray-200);
    color: var(--text-primary);
}

.upload-btn.has-images {
    background: var(--primary);
    color: white;
}

.upload-btn.has-images:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.upload-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--gray-100);
    color: var(--gray-400);
}

.send-btn {
    background: var(--primary);
    color: white;
}

.send-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Results Container */
.results-container {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* Loading Animation */
.loading-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.03) 0%, rgba(251, 191, 36, 0.03) 100%);
    border-radius: 24px;
    position: relative;
    overflow: hidden;
}

/* 装饰性背景粒子 */
.loading-message::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
    animation: particleFloat 20s linear infinite;
    pointer-events: none;
}

@keyframes particleFloat {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(30px, 30px);
    }
}

.loading-animation {
    margin-bottom: 40px;
    position: relative;
}

.loading-icon {
    margin-bottom: 40px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.loading-icon i {
    background: linear-gradient(135deg, #dc2626 0%, #ea580c 50%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 4px 12px rgba(234, 88, 12, 0.4));
    animation: magicPulse 2s ease-in-out infinite;
}

/* 光环效果 */
.loading-icon::before {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(234, 88, 12, 0.25) 0%, transparent 70%);
    border-radius: 50%;
    animation: haloExpand 2s ease-in-out infinite;
}

.loading-icon::after {
    content: '';
    position: absolute;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(220, 38, 38, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    animation: haloExpand 2s ease-in-out infinite 0.5s;
}

@keyframes magicPulse {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.1) rotate(-5deg);
    }
    50% {
        transform: scale(1.05) rotate(0deg);
    }
    75% {
        transform: scale(1.1) rotate(5deg);
    }
}

@keyframes haloExpand {
    0%, 100% {
        transform: scale(0.8);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.2;
    }
}

.loading-progress {
    width: 500px;
    max-width: 90vw;
    position: relative;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: linear-gradient(to bottom, #e5e7eb, #d1d5db);
    border: 1px solid #9ca3af;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
    position: relative;
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.1),
        0 1px 2px rgba(0, 0, 0, 0.05);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg,
        #ea580c 0%,
        #f59e0b 25%,
        #fbbf24 50%,
        #f59e0b 75%,
        #ea580c 100%
    );
    background-size: 200% 100%;
    border-radius: 12px;
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    animation: gradientFlow 3s ease infinite;
    box-shadow:
        0 0 25px rgba(234, 88, 12, 0.5),
        0 0 45px rgba(251, 191, 36, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

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

/* 进度条上的光泽效果 */
.progress-fill::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    border-radius: 12px 12px 0 0;
}

/* 流动光效 */
.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: shimmer 2s infinite;
}

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

.progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 8px;
}

#progressPercent {
    font-weight: 700;
    background: linear-gradient(135deg, #dc2626 0%, #ea580c 50%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 16px;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#progressStatus {
    font-weight: 600;
    color: #dc2626;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    animation: statusFade 1s ease-in-out infinite;
}

@keyframes statusFade {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.loading-tip {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, #dc2626 0%, #ea580c 50%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 30px 0 12px;
    letter-spacing: 0.3px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.loading-estimate {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    padding: 8px 20px;
    background: rgba(245, 158, 11, 0.05);
    border-radius: 20px;
    display: inline-block;
    font-weight: 500;
}

/* Generated Results */
.generated-results {
    flex: 1;
}

.results-header {
    margin-bottom: 20px;
}

.results-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.result-item {
    background: var(--bg-primary);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    transition: var(--transition);
}

.result-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.result-item img {
    width: 100%;
    height: 280px;
    object-fit: cover;
}

.result-actions {
    padding: 16px;
    display: flex;
    gap: 8px;
}

.action-btn {
    flex: 1;
    background: var(--gray-100);
    border: none;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--transition);
}

.action-btn:hover {
    background: var(--primary);
    color: white;
}

.action-btn.primary {
    background: var(--primary);
    color: white;
}

.action-btn.primary:hover {
    background: var(--primary-hover);
}

/* Error Message */
.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 16px;
    border-radius: var(--border-radius-lg);
    margin: 20px 0;
    font-size: 14px;
}

.error-message strong {
    display: block;
    margin-bottom: 8px;
}

.error-message button {
    background: var(--danger);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 12px;
    margin-top: 8px;
}

/* Debug Panel */
.debug-panel {
    background: var(--bg-primary);
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    margin: 20px 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.debug-panel h4 {
    margin-bottom: 12px;
    color: var(--text-primary);
    font-size: 16px;
}

.debug-panel h5 {
    margin: 16px 0 8px 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.debug-panel pre {
    background: var(--gray-900);
    color: #f1f5f9;
    padding: 16px;
    border-radius: var(--border-radius);
    overflow-x: auto;
    font-size: 12px;
    line-height: 1.5;
}

.debug-panel button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    margin-top: 12px;
    transition: var(--transition);
}

.debug-panel button:hover {
    background: var(--primary-hover);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.modal-content {
    position: relative;
    margin: auto;
    padding: 20px;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    pointer-events: none;
}

.modal-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--border-radius-lg);
    cursor: default;
    pointer-events: auto;
}

.close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 32px;
    cursor: pointer;
    z-index: 1001;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    transition: var(--transition);
}

.close:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* Medium screens optimization - 修复用户菜单显示问题 */
@media (max-width: 1200px) {
    .app-header {
        min-height: 70px; /* 增加最小高度为多行内容留出空间 */
    }
    
    .header-content {
        padding: 12px 16px;
        min-height: 46px;
    }
    
    /* 用户菜单区域改为更紧凑的布局 */
    .user-menu {
        gap: 6px;
    }
    
    .user-actions {
        gap: 6px;
        flex-wrap: wrap;
    }
    
    .profile-dropdown .dropdown-menu {
        right: 0;
        min-width: 180px;
    }
    
    .recharge-history-btn,
    .admin-btn,
    .logout-btn {
        font-size: 13px;
        padding: 6px 12px;
        white-space: nowrap;
    }
}

@media (max-width: 1024px) {
    .app-header {
        min-height: 60px !important;
        height: auto;
    }
    
    .header-content {
        padding: 10px 16px;
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
        min-height: 50px;
        height: auto;
    }
    
    .main-container {
        padding: 0 16px;
    }
    
    /* Logo保持原始位置 */
    .logo {
        order: 1;
        flex-shrink: 0;
    }
    
    /* 导航菜单保持水平排列 */
    .nav-tabs {
        order: 2;
        display: flex !important;
        flex-wrap: wrap;
        gap: 6px;
        justify-content: center;
        flex: 1;
        margin: 0 16px;
    }
    
    /* 用户菜单区域 */
    .user-menu {
        order: 3;
        display: flex !important;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
    }
    
    .user-menu .user-info {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .user-menu .user-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        align-items: center;
    }
    
    .user-actions .profile-dropdown,
    .user-actions .recharge-history-btn,
    .user-actions .admin-btn,
    .user-actions .logout-btn {
        font-size: 12px;
        padding: 6px 10px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .nav-tab {
        font-size: 13px;
        padding: 6px 12px;
        white-space: nowrap;
        flex-shrink: 0;
    }
}

@media (max-width: 900px) {
    .app-header {
        min-height: 60px !important;
        height: auto;
    }
    
    .header-content {
        padding: 8px 12px;
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 6px;
        min-height: 50px;
        height: auto;
    }
    
    /* Logo */
    .logo {
        order: 1;
        flex-shrink: 0;
    }
    
    /* 导航菜单 - 继承768px的grid布局 */
    /* 不需要重写，继承768px的样式 */
    
    /* 用户菜单 */
    .user-menu {
        order: 3;
        display: flex !important;
        align-items: center;
        gap: 6px;
        flex-shrink: 0;
    }
    
    .user-menu .user-info {
        display: flex;
        align-items: center;
        gap: 6px;
    }
    
    .user-menu .user-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 3px;
        align-items: center;
    }
    
    .user-actions .profile-btn,
    .user-actions .recharge-history-btn,
    .user-actions .admin-btn,
    .user-actions .logout-btn {
        font-size: 11px;
        padding: 4px 8px;
        border-radius: 12px;
        flex-shrink: 0;
        white-space: nowrap;
    }
    
    /* 隐藏用户名节省空间 */
    .username-display,
    .user-menu .username {
        display: none;
    }
    
    .nav-tab {
        font-size: 12px;
        padding: 6px 10px;
        white-space: nowrap;
        flex-shrink: 0;
        border-radius: 16px;
    }
}

/* Responsive Design - Enhanced Mobile Optimization */
@media (max-width: 768px) {
    .app-header {
        min-height: 100px !important;
        height: auto !important;
        padding: 8px 0 !important;
    }
    
    /* Core Layout */
    .main-container {
        padding: 0 12px;
    }
    
    .generate-container {
        padding: 12px 0;
        gap: 12px;
    }
    
    /* Header - 使用Grid布局（来自充值页面） */
    .header-content {
        display: grid !important;
        grid-template-columns: 1fr auto !important;
        grid-template-rows: auto auto auto !important;
        gap: 12px !important;
        align-items: start !important;
        min-height: 80px !important;
        height: auto !important;
        padding: 12px 16px !important;
    }
    
    /* Logo - 左上角 */
    .logo {
        grid-column: 1 !important;
        grid-row: 1 !important;
        justify-self: start !important;
        align-self: center !important;
        font-size: 14px;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
    }
    
    .logo-img {
        width: 32px !important;
        height: 32px !important;
    }
    
    .logo-icon {
        font-size: 18px !important;
    }
    
    .logo span {
        font-size: 16px !important;  /* 与充值页面保持一致 */
        font-weight: 600 !important;
        display: block !important; /* 确保标题显示 */
    }
    
    /* 用户菜单 - 使用contents让子元素直接参与grid */
    .user-menu {
        display: contents !important;
    }
    
    /* 用户信息 - 右上角 */
    .user-menu .user-info {
        grid-column: 2 !important;
        grid-row: 1 !important;
        justify-self: end !important;
        align-self: center !important;
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        flex-direction: row !important; /* 确保横向排列 */
    }
    
    /* 用户操作按钮 - 第二行居中 */
    .user-menu .user-actions {
        grid-column: 1 / -1 !important;
        grid-row: 2 !important;
        justify-self: center !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        row-gap: 8px !important;
        margin-top: 4px !important;
        justify-content: center !important;
        padding: 8px 0 !important;
    }
    
    /* 美化用户操作按钮 */
    .user-actions .profile-dropdown,
    .user-actions .profile-btn,
    .user-actions .recharge-history-btn,
    .user-actions .admin-btn,
    .user-actions .logout-btn {
        background: rgba(255, 255, 255, 0.9) !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        border-radius: 20px !important;
        padding: 6px 14px !important;
        font-size: 12px !important;
        transition: all 0.3s ease !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
        color: var(--text-primary) !important;
        text-decoration: none !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        min-height: 32px !important;
        white-space: nowrap !important;
    }
    
    .user-actions .profile-dropdown:hover,
    .user-actions .profile-btn:hover,
    .user-actions .recharge-history-btn:hover,
    .user-actions .admin-btn:hover,
    .user-actions .logout-btn:hover {
        background: rgba(255, 255, 255, 1) !important;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
        transform: translateY(-1px) !important;
    }
    
    /* 未登录时的认证按钮 - 右上角 */
    .auth-buttons {
        grid-column: 2 !important;
        grid-row: 1 !important;
        justify-self: end !important;
        align-self: center !important;
        display: flex !important;
        gap: 8px !important;
    }
    
    /* 导航菜单 - 第三行居中，允许换行 */
    .nav-tabs {
        grid-column: 1 / -1 !important;
        grid-row: 3 !important;
        justify-self: center !important;
        display: flex !important;
        flex-wrap: wrap !important; /* 允许换行 */
        gap: 8px !important;
        row-gap: 8px !important;
        margin-top: 4px !important;
        padding: 8px 0 4px 0 !important;
        width: 100% !important;
        justify-content: center !important;
    }
    
    /* Navigation - Mobile-first approach */
    .nav-tab {
        font-size: 11px !important;
        padding: 8px 12px !important;
        min-width: auto;
        white-space: nowrap;
        border-radius: 16px !important;
        /* 确保足够的点击区域 */
        min-height: 32px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0; /* 防止按钮被压缩 */
        background: rgba(255, 255, 255, 0.8) !important;
        border: 1px solid rgba(0, 0, 0, 0.08) !important;
        transition: all 0.3s ease !important;
        color: var(--text-primary) !important;
        text-decoration: none !important;
    }
    
    .nav-tab:hover {
        background: rgba(255, 255, 255, 1) !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
    }
    
    .nav-tab.active {
        background: var(--primary) !important;
        color: white !important;
        border-color: var(--primary) !important;
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3) !important;
    }
    
    .nav-tab.active:hover {
        background: var(--primary-hover) !important;
        color: white !important;
    }
    
    /* 用户头像 */
    .user-avatar, .default-user-avatar {
        width: 28px !important;
        height: 28px !important;
        border-radius: 50% !important;
    }
    
    .avatar-display {
        display: block !important;
    }
    
    /* 用户名显示 */
    .username-display {
        font-size: 12px;
        display: none !important; /* 移动端隐藏用户名 */
    }
    
    /* 积分显示 - 从充值页面复制 */
    .credits-display {
        background: var(--primary) !important;
        color: white !important;
        padding: 6px 12px !important;
        border-radius: 20px !important;
        font-size: 12px !important;
        font-weight: 500 !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 6px !important;
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3) !important;
        transition: transform 0.2s ease, box-shadow 0.2s ease !important;
        cursor: pointer !important;
        text-decoration: none !important;
    }
    
    .credits-display:hover {
        transform: translateY(-1px) !important;
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3) !important;
    }
    
    .credits-display i.fa-coins {
        font-size: 14px !important;
        color: #fbbf24 !important;
        text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
    }
    
    .credits-display .recharge-btn {
        color: rgba(255, 255, 255, 0.8) !important;
        text-decoration: none !important;
        font-size: 10px !important;
        padding: 2px !important;
        border-radius: 50% !important;
        transition: color 0.2s !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 16px !important;
        height: 16px !important;
    }
    
    .credits-display .recharge-btn:hover {
        color: white !important;
    }
    
    /* Template Section */
    .template-section {
        padding: 16px;
        border-radius: 12px;
    }
    
    .section-header {
        margin-bottom: 20px;
        text-align: center;  /* 修复移动端文字居中 */
    }
    
    .section-header h1 {
        font-size: 20px;
        line-height: 1.3;
        margin-bottom: 6px;
    }
    
    .section-header .hero-subtitle {
        font-size: 14px;
        margin-bottom: 4px;
    }
    
    .section-header .section-subtitle {
        font-size: 13px;
    }
    
    /* Category buttons - horizontal scroll */
    .template-categories {
        gap: 6px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 8px 0;
        margin: 0 -16px 16px -16px;
        padding-left: 16px;
        padding-right: 16px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .template-categories::-webkit-scrollbar {
        display: none;
    }
    
    .category-btn {
        padding: 8px 14px;
        font-size: 12px;
        flex-shrink: 0;
        border-radius: 20px;
    }
    
    /* Template Grid */
    .template-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .template-card {
        padding: 16px;
        border-radius: 12px;
    }
    
    .template-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .template-title {
        font-size: 14px;
    }
    
    .template-description {
        font-size: 13px;
        line-height: 1.4;
    }
    
    .template-example {
        font-size: 12px;
        padding: 10px;
    }
    
    /* Input Container */
    .input-container {
        padding: 16px;
        border-radius: 16px;
    }
    
    .input-wrapper {
        padding: 12px;
        gap: 10px;
        flex-wrap: wrap;
        justify-content: flex-end; /* 右对齐 */
    }

    /* textarea 容器占满整行 */
    .syntax-highlight-container {
        flex: 1 1 100% !important;
        min-width: 100% !important;
        margin-bottom: 8px;
        order: 0;
    }

    /* 第二行：模型和尺寸选择器 */
    .model-selector-wrapper {
        flex: 0 0 auto;
        order: 1;
    }

    .aspect-ratio-wrapper {
        flex: 0 0 auto;
        order: 2;
    }

    /* 在尺寸选择器后强制换行 */
    .aspect-ratio-wrapper::after {
        content: '';
        flex: 1 0 100%;
        order: 2;
        height: 0;
    }

    /* 第三行：清晰度、上传、发送 */
    .image-size-wrapper {
        flex: 0 0 auto;
        order: 3;
    }

    .upload-btn {
        flex: 0 0 auto;
        order: 4;
    }

    .send-btn {
        flex: 0 0 auto;
        order: 5;
    }

    .input-wrapper textarea {
        font-size: 16px; /* 防止iOS自动缩放 */
        line-height: 1.5;
        min-height: 60px; /* 更友好的触摸高度 */
    }
    
    .upload-btn, .send-btn {
        width: 32px;
        height: 32px;
        font-size: 13px;
        border-radius: 8px;
    }

    /* 选择器按钮也改小 */
    .model-selector-btn,
    .aspect-ratio-btn,
    .image-size-btn {
        padding: 6px 10px;
        font-size: 13px;
        min-height: 32px;
    }

    .model-selector-btn i,
    .aspect-ratio-btn i,
    .image-size-btn i {
        font-size: 12px;
    }

    .model-selector-text,
    .aspect-ratio-text,
    .image-size-text {
        font-size: 13px;
    }

    .dropdown-icon {
        font-size: 14px;
    }
    
    /* Results Grid */
    .results-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .result-item {
        border-radius: 12px;
    }
    
    .result-item img {
        height: 240px;
    }
    
    .result-actions {
        padding: 12px;
        gap: 8px;
    }
    
    .action-btn {
        font-size: 12px;
        padding: 10px 12px;
        border-radius: 8px;
    }
    
    /* Gallery Grid */
    .modern-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    
    .gallery-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        margin-bottom: 20px;
    }
    
    /* Auth required styling */
    .auth-required-content {
        padding: 24px;
    }
    
    .auth-required-content h3 {
        font-size: 20px;
    }
    
    .auth-required-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .auth-required-buttons .auth-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Loading and error states */
    .loading-message {
        padding: 40px 20px;
    }
    
    .error-message {
        font-size: 13px;
        padding: 14px;
    }
    
    /* Profile dropdown adjustments */
    .dropdown-menu {
        right: -10px;
        min-width: 160px;
        font-size: 13px;
    }
    
    .dropdown-item {
        padding: 10px 12px;
    }
}

@media (max-width: 480px) {
    /* Very small screens - ultra-compact layout */
    body {
        font-size: 13px;
    }
    
    /* Header ultra-compact */
    .header-content {
        padding: 0 8px;
        height: 52px;
    }
    
    .logo {
        gap: 6px;
    }
    
    .logo span {
        font-size: 16px;  /* 统一字体大小 */
        display: block !important; /* Always show logo text to display site title */
    }
    
    .logo-img {
        width: 28px;
        height: 28px;
    }
    
    .logo-icon {
        font-size: 18px;
    }
    
    /* Navigation - 继承768px的grid布局，只调整间距和尺寸 */
    .nav-tabs {
        gap: 6px !important;
        row-gap: 6px !important;
        padding: 6px 0 2px 0 !important;
    }
    
    .nav-tab {
        font-size: 10px;
        padding: 4px 6px;
        border-radius: 6px;
        min-width: 50px;
        text-align: center;
    }
    
    /* User area - minimal */
    .user-menu {
        gap: 4px;
    }
    
    .credits-display {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    .user-avatar, .default-user-avatar {
        width: 24px;
        height: 24px;
    }
    
    /* Content area */
    .main-container {
        padding: 0 8px;
    }
    
    .generate-container {
        gap: 10px;
        padding: 8px 0;
    }
    
    /* Template section - very compact */
    .template-section {
        padding: 12px;
        border-radius: 10px;
    }
    
    .section-header {
        margin-bottom: 16px;
    }
    
    .section-header h1 {
        font-size: 18px;
        line-height: 1.2;
    }
    
    .section-header .hero-subtitle {
        font-size: 13px;
    }
    
    .section-header .section-subtitle {
        font-size: 12px;
    }
    
    /* Categories - 2 rows if needed */
    .template-categories {
        flex-wrap: wrap;
        gap: 4px;
        margin: 0 -12px 12px -12px;
        padding-left: 12px;
        padding-right: 12px;
    }
    
    .category-btn {
        flex: 1;
        min-width: 70px;
        max-width: 100px;
        padding: 6px 8px;
        font-size: 11px;
        justify-content: center;
        border-radius: 16px;
    }
    
    /* Template cards - single column, compact */
    .template-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .template-card {
        padding: 12px;
        border-radius: 10px;
    }
    
    .template-header {
        gap: 8px;
        margin-bottom: 8px;
    }
    
    .template-icon {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .template-title {
        font-size: 13px;
    }
    
    .template-description {
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    .template-example {
        font-size: 11px;
        padding: 8px;
        border-radius: 6px;
    }
    
    /* Input area */
    .input-container {
        padding: 12px;
        border-radius: 12px;
    }

    .input-wrapper {
        padding: 10px;
        gap: 8px;
        flex-wrap: wrap;
        justify-content: flex-end; /* 右对齐 */
    }

    /* textarea 容器占满整行 */
    .syntax-highlight-container {
        flex: 1 1 100% !important;
        min-width: 100% !important;
        margin-bottom: 8px;
        order: 0;
    }

    /* 第二行：模型和尺寸选择器 */
    .model-selector-wrapper {
        flex: 0 0 auto;
        order: 1;
    }

    .aspect-ratio-wrapper {
        flex: 0 0 auto;
        order: 2;
    }

    /* 在尺寸选择器后强制换行 */
    .aspect-ratio-wrapper::after {
        content: '';
        flex: 1 0 100%;
        order: 2;
        height: 0;
    }

    /* 第三行：清晰度、上传、发送 */
    .image-size-wrapper {
        flex: 0 0 auto;
        order: 3;
    }

    .upload-btn {
        flex: 0 0 auto;
        order: 4;
    }

    .send-btn {
        flex: 0 0 auto;
        order: 5;
    }

    .input-wrapper textarea {
        font-size: 16px; /* 防止iOS自动缩放 */
        min-height: 56px;
    }
    
    .upload-btn, .send-btn {
        width: 30px;
        height: 30px;
        font-size: 12px;
        border-radius: 7px;
    }

    /* 选择器按钮也改小 */
    .model-selector-btn,
    .aspect-ratio-btn,
    .image-size-btn {
        padding: 5px 8px;
        font-size: 12px;
        min-height: 30px;
    }

    .model-selector-btn i,
    .aspect-ratio-btn i,
    .image-size-btn i {
        font-size: 11px;
    }

    .model-selector-text,
    .aspect-ratio-text,
    .image-size-text {
        font-size: 12px;
    }

    .dropdown-icon {
        font-size: 13px;
    }
    
    /* Results - single column */
    .results-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .result-item img {
        height: 200px;
    }
    
    .result-actions {
        padding: 10px;
        gap: 6px;
        flex-wrap: wrap;
    }
    
    .action-btn {
        font-size: 11px;
        padding: 8px 10px;
        flex: 1;
        min-width: calc(50% - 3px);
    }
    
    /* Gallery - very compact grid */
    .modern-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }
    
    .gallery-header h1 {
        font-size: 18px;
    }
    
    .gallery-container {
        padding: 12px;
    }
    
    /* Auth states */
    .auth-required-content {
        padding: 20px;
    }
    
    .auth-required-content h3 {
        font-size: 18px;
    }
    
    .auth-required-content p {
        font-size: 14px;
    }
    
    /* Dropdowns and modals */
    .dropdown-menu {
        right: -15px;
        min-width: 140px;
        font-size: 12px;
    }
    
    .dropdown-item {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    /* Welcome section */
    .welcome-section {
        padding: 40px 16px;
    }
    
    .welcome-section h2 {
        font-size: 22px;
    }
    
    .welcome-icon {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
    
    /* Footer */
    .site-footer {
        padding: 16px 0;
    }
    
    .footer-content {
        padding: 0 8px;
    }
    
    .footer-content p {
        font-size: 12px;
    }
}

/* Gallery Specific Styles */
.gallery-container {
    padding: 40px 20px;
    max-width: none;
    width: 100%;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-200);
}

.header-info h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.header-info p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 16px;
}

.gallery-stats {
    display: flex;
    gap: 24px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Modern Gallery Grid */
.modern-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 20px;
}

.gallery-card {
    background: var(--bg-primary);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--gray-300);
}

.card-image {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--gray-100);
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.gallery-card:hover .card-image img {
    transform: scale(1.05);
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    backdrop-filter: blur(4px);
}

.gallery-card:hover .card-overlay {
    opacity: 1;
}

.overlay-actions {
    display: flex;
    gap: 12px;
}

.overlay-actions .action-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: var(--transition);
    backdrop-filter: blur(8px);
}

.overlay-actions .action-btn:hover {
    background: white;
    transform: scale(1.1);
}

.overlay-actions .action-btn.primary {
    background: var(--primary);
    color: white;
}

.overlay-actions .action-btn.primary:hover {
    background: var(--primary-hover);
}

.card-info {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.image-name {
    font-size: 13px;
    color: var(--text-secondary);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    margin-right: 12px;
}

.image-actions {
    display: flex;
    gap: 4px;
}

.mini-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--gray-100);
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: var(--transition);
}

.mini-btn:hover {
    background: var(--primary);
    color: white;
}

/* Empty Gallery State */
.empty-gallery {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
    min-height: 400px;
}

.empty-icon {
    width: 80px;
    height: 80px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.empty-icon i {
    font-size: 32px;
    color: var(--gray-400);
}

.empty-gallery h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-gallery p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    max-width: 400px;
    line-height: 1.5;
}

.start-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: var(--border-radius-lg);
    font-weight: 500;
    font-size: 14px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.start-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ================ Template Parameters Customization ================ */
.template-params-container {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
    overflow: visible; /* 改为visible，允许弹窗显示在容器外 */
    animation: slideDown 0.3s ease-out;
    transition: all 0.3s ease-out;
    /* 确保弹窗不受容器限制 */
    position: relative;
}

.template-params-container.collapsed .params-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden; /* 内容区域折叠时隐藏 */
    transition: all 0.3s ease-out;
}

.template-params-container:not(.collapsed) .params-content {
    max-height: 600px;
    opacity: 1;
    transition: all 0.3s ease-out;
}

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

.params-header {
    background: var(--bg-tertiary);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

.params-header:hover {
    background: var(--bg-secondary);
}

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

.expand-collapse-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.expand-collapse-btn:hover {
    background: rgba(245, 158, 11, 0.1);
    transform: scale(1.1);
}

.template-params-container:not(.collapsed) .expand-collapse-btn i {
    transform: rotate(90deg);
    transition: transform 0.3s ease-out;
}

.template-params-container.collapsed .expand-collapse-btn i {
    transform: rotate(0deg);
    transition: transform 0.3s ease-out;
}

.params-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.params-header h3 i {
    color: var(--primary);
}

.close-params-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-params-btn:hover {
    background: var(--gray-200);
    color: var(--text-primary);
}

.params-content {
    overflow: visible; /* 改为visible，允许弹窗显示 */
    transition: all 0.3s ease-out;
}

.params-grid {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    max-height: 400px;
    overflow-y: auto;
    /* 确保弹窗可以显示在网格外 */
    overflow-x: visible;
    /* 允许子元素超出网格边界 */
    position: relative;
}

.param-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.param-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.param-label i {
    font-size: 12px;
    color: var(--primary);
}

.param-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
    background: white;
    resize: none;
    min-height: 38px;
    line-height: 1.4;
}

.param-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.param-input.textarea {
    min-height: 60px;
    resize: vertical;
}

.params-actions {
    padding: 16px 20px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.apply-params-btn,
.reset-params-btn {
    padding: 10px 16px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.apply-params-btn {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.apply-params-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.reset-params-btn {
    background: white;
    color: var(--text-secondary);
    border: 1px solid var(--gray-300);
}

.reset-params-btn:hover {
    background: var(--gray-50);
    color: var(--text-primary);
    border-color: var(--gray-400);
}

/* Responsive design for parameters */
@media (max-width: 768px) {
    .params-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 16px;
    }
    
    .params-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .apply-params-btn,
    .reset-params-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ================ Parameter Color Customization ================ */
.param-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 12px;
    background: var(--gray-50);
    transition: var(--transition);
}

.param-field:hover {
    border-color: var(--gray-300);
    background: white;
}

.param-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.param-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
}

.param-label i {
    font-size: 12px;
    color: var(--primary);
}

/* Color Selection Panel - 简洁单色块设计 */
.param-color-selection {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative; /* 重要：为弹窗定位提供参考点 */
}

.color-display {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid var(--gray-300);
    transition: var(--transition);
    position: relative;
}

.color-display:hover {
    transform: scale(1.1);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.color-display.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

/* 颜色选择弹窗 - 使用fixed定位完全脱离文档流 */
.color-picker-popup {
    position: fixed; /* 改为fixed，相对于视窗定位 */
    z-index: 10000; /* 进一步提高层级 */
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 12px;
    min-width: 200px;
    display: none;
    animation: popupSlideIn 0.2s ease-out;
    /* 确保弹窗不被裁剪 */
    overflow: visible;
    /* 确保完全脱离父容器约束 */
    max-width: none;
    max-height: none;
}

.color-picker-popup.show {
    display: block;
}

/* 移除所有定位变体的CSS，因为我们将用JavaScript动态计算位置 */

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.popup-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.popup-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
    transition: var(--transition);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-close:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.color-presets {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.color-preset {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
    position: relative;
}

.color-preset:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.color-preset.selected {
    border-color: var(--text-primary);
    transform: scale(1.1);
}

.color-preset.selected::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 10px;
    font-weight: bold;
    text-shadow: 0 0 3px rgba(0,0,0,0.8);
}

.custom-color-section {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--gray-200);
}

.custom-color-label {
    font-size: 12px;
    color: var(--text-secondary);
    flex: 1;
}

.param-color-picker {
    width: 40px;
    height: 24px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    cursor: pointer;
    background: white;
    padding: 0;
    outline: none;
    transition: var(--transition);
}

.param-color-picker:hover {
    border-color: var(--primary);
}

/* 弹窗遮罩层 */
.color-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    display: none;
}

.color-popup-overlay.show {
    display: block;
}

.param-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
    background: white;
    resize: none;
    min-height: 38px;
    line-height: 1.4;
    font-family: inherit;
}

.param-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.param-input.textarea {
    min-height: 60px;
    resize: vertical;
}

/* Welcome Section - Simplified */
.welcome-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    min-height: 300px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(254, 247, 205, 0.6));
    border-radius: var(--border-radius-xl);
    margin: 20px 0;
}

.welcome-content {
    max-width: 600px;
    margin: 0 auto;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    color: white;
    font-size: 32px;
    box-shadow: var(--shadow-md);
}

.welcome-section h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.welcome-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Site Footer */
.site-footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--gray-200);
    padding: 20px 0;
    margin-top: auto;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-content p {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Redemption Code Section */
.redemption-section {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.redemption-section:hover {
    box-shadow: var(--shadow-md);
}

.redemption-section .section-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.redemption-section .section-header h2 i {
    color: var(--primary);
}

.redemption-form {
    margin-top: 16px;
}

.redemption-input-group {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.redemption-input-group input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
    background: var(--bg-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Courier New', monospace;
}

.redemption-input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.redemption-input-group input::placeholder {
    font-family: 'Inter', sans-serif;
    letter-spacing: normal;
    text-transform: none;
}

.redeem-btn {
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
    justify-content: center;
}

.redeem-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.redemption-message {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.redemption-message.success {
    background: rgba(34, 197, 94, 0.1);
    color: #059669;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.redemption-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.redemption-message.success i {
    color: #059669;
}

.redemption-message.error i {
    color: #dc2626;
}
/* Redemption Page Styles */
.redeem-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px;
}

.page-header {
    text-align: center;
    margin-bottom: 48px;
}

.page-header .header-content {
    max-width: 600px;
    margin: 0 auto;
}

.page-title {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.page-title i {
    color: var(--primary);
}

.page-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.redeem-form-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 32px;
    margin-bottom: 48px;
}

.redeem-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.redeem-card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    margin-bottom: 24px;
}

.card-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h2 i {
    color: var(--primary);
}

.card-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.redeem-form {
    margin-bottom: 32px;
}

.credits-info-card {
    background: linear-gradient(135deg, var(--primary) 0%, #fbbf24 100%);
    border-radius: var(--border-radius-lg);
    padding: 32px;
    text-align: center;
    color: white;
    box-shadow: var(--shadow-md);
}

.credits-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0.9;
}

.credits-display-large {
    margin-bottom: 24px;
}

.credits-number {
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
    display: block;
    transition: var(--transition);
}

.credits-label {
    font-size: 16px;
    opacity: 0.9;
    margin-top: 4px;
    display: block;
}

.credits-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.credits-actions .btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.credits-actions .btn-primary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(10px);
}

.credits-actions .btn-primary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.credits-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary);
}

.credits-actions .btn-secondary:hover {
    background: white;
    transform: translateY(-1px);
}

.auth-required-section {
    text-align: center;
    padding: 64px 32px;
}

.auth-card {
    max-width: 400px;
    margin: 0 auto;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    padding: 48px 32px;
    box-shadow: var(--shadow-sm);
}

.auth-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 32px;
    color: var(--gray-500);
}

.auth-card h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.auth-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 32px;
}

.auth-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.auth-actions .btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-actions .btn-primary {
    background: var(--primary);
    color: white;
}

.auth-actions .btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.auth-actions .btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.auth-actions .btn-secondary:hover {
    background: var(--gray-200);
    transform: translateY(-1px);
}

/* Responsive adjustments for redeem page */
@media (max-width: 768px) {
    .redeem-form-section {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .page-title {
        font-size: 28px;
    }
    
    .redeem-card {
        padding: 24px;
    }
    
    .credits-info-card {
        padding: 24px;
    }
    
    .credits-actions {
        flex-direction: column;
    }
    
    .auth-actions {
        flex-direction: column;
    }
}

/* CSS文件结束 */
