/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 主题色 - 深色系 */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #000000;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;

    /* 中性色 - 加深 */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* 渐变背景 */
    --gradient-bg: radial-gradient(ellipse at top, #e0f2fe 0%, #f8fafc 50%, #f1f5f9 100%);
    --gradient-hero: radial-gradient(ellipse at top, #dbeafe 0%, #f8fafc 100%);
    --gradient-primary: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);

    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.06);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.15);

    /* 字体 */
    --font-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

body {
    font-family: var(--font-base);
    background: var(--gradient-bg);
    background-attachment: fixed;
    color: var(--gray-900);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    overflow-x: hidden;
}

/* 全屏欢迎页 */
.welcome-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: radial-gradient(ellipse at center, #dbeafe 0%, #f8fafc 50%, #f1f5f9 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.6s ease;
}

.welcome-screen.hidden {
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

.welcome-content {
    text-align: center;
    max-width: 1000px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.welcome-brand {
    font-size: 88px;
    font-weight: 800;
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 50%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 40px 0;
    letter-spacing: 2px;
    animation: fadeInUp 0.8s ease-out;
}

.welcome-subtitle {
    font-size: 28px;
    color: var(--gray-700);
    margin-bottom: 60px;
    font-weight: 500;
    min-height: 40px;
    animation: fadeInUp 1s ease-out 0.3s both;
}

/* 打字机效果 */
.typewriter {
    display: inline-block;
    border-right: 3px solid #667eea;
    animation: blink 0.7s step-end infinite;
}

@keyframes blink {
    50% { border-color: transparent; }
}

.welcome-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 80px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.feature-item {
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1.5px solid rgba(102, 126, 234, 0.2);
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    animation: fadeInUp 1.2s ease-out backwards;
    text-align: center;
}

.feature-item:nth-child(1) { animation-delay: 0.5s; }
.feature-item:nth-child(2) { animation-delay: 0.6s; }
.feature-item:nth-child(3) { animation-delay: 0.7s; }
.feature-item:nth-child(4) { animation-delay: 0.8s; }

.feature-item:hover {
    border-color: #667eea;
    color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12), rgba(118, 75, 162, 0.12));
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.18);
}

.start-button {
    display: inline-block;
    padding: 20px 72px;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(249, 115, 22, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 1.4s ease-out 1s both;
}

.start-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.start-button:hover::before {
    left: 100%;
}

/* 浮动形状动画 */
.floating-shapes {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    overflow: hidden;
}

.shape {
    position: absolute;
    opacity: 0.15;
}

.shape-1 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    top: 10%;
    left: 5%;
    animation: float 20s ease-in-out infinite;
}

.shape-2 {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, #f093fb, #f5576c);
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    bottom: 15%;
    right: 10%;
    animation: float 15s ease-in-out infinite reverse;
}

.shape-3 {
    width: 150px;
    height: 150px;
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    border-radius: 50%;
    top: 60%;
    left: 80%;
    animation: float 18s ease-in-out infinite;
}

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

/* 淡入上浮动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.start-button:hover {
    background: linear-gradient(135deg, #ea580c 0%, #dc2626 100%);
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 12px 32px rgba(249, 115, 22, 0.6);
}

.start-button:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

/* 隐藏主内容直到欢迎页消失 */
.header,
.container {
    opacity: 0;
    transition: opacity 0.8s ease 0.3s;
}

.welcome-screen.hidden ~ .header,
.welcome-screen.hidden ~ .container {
    opacity: 1;
}

/* 顶部导航 */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.logo-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: white;
    box-shadow: var(--shadow-md);
}

.logo-image {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 12px;
}

.logo-text h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
    line-height: 1.2;
}

.tagline {
    font-size: 12px;
    color: var(--gray-500);
    font-weight: 500;
}

/* 紧急公告条 */
.urgent-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    animation: urgentBarSlideIn 0.4s ease-out;
    max-width: 400px;
    white-space: nowrap;
    overflow: hidden;
}

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

.urgent-bar.info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #93c5fd;
    color: #1d4ed8;
}

.urgent-bar.warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fcd34d;
    color: #b45309;
}

.urgent-bar.urgent {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fca5a5;
    color: #dc2626;
    animation: urgentBarSlideIn 0.4s ease-out, urgentPulse 2s ease-in-out infinite;
}

@keyframes urgentPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.urgent-bar-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.urgent-bar-text {
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.urgent-bar-text:hover,
.urgent-bar-icon:hover {
    opacity: 0.8;
}

.urgent-bar-icon {
    cursor: pointer;
}

.urgent-bar-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    color: inherit;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0.7;
}

.urgent-bar-close:hover {
    background: rgba(0, 0, 0, 0.2);
    opacity: 1;
}

.nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 24px;
    color: var(--gray-700);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    background: white;
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* Hero 区域 */
.hero {
    text-align: center;
    padding: 80px 32px 60px;
}

.hero-title {
    font-size: 56px;
    font-weight: 800;
    margin-bottom: 20px;
    color: var(--gray-900);
    letter-spacing: -2px;
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 20px;
    color: var(--gray-600);
    font-weight: 500;
}

/* 主容器 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 32px 60px;
}

.main-content {
    display: grid;
    grid-template-columns: 480px 1fr;
    gap: 32px;
    margin-top: 40px;
}

/* 左侧输入面板 */
.input-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.prompt-card {
    background: white;
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-xl);
}

.prompt-card textarea {
    width: 100%;
    border-radius: 14px;
    border: 1.5px solid var(--gray-100);
    background: #fdfefe;
    padding: 14px 18px;
    font-size: 15px;
    resize: vertical;
    min-height: 90px;
    line-height: 1.6;
    box-shadow: inset 0 4px 12px rgba(148, 163, 184, 0.15), 0 1px 4px rgba(15, 23, 42, 0.08);
    transition: all 0.2s ease;
}

.prompt-card textarea:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.5);
    background: #ffffff;
    box-shadow: inset 0 10px 24px rgba(37, 99, 235, 0.08), 0 0 0 3px rgba(37, 99, 235, 0.12);
}

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

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
}

.badge {
    padding: 4px 12px;
    background: var(--gray-100);
    color: var(--gray-600);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
}

/* 上传按钮 */
.upload-button-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.upload-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.upload-button:hover {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow-md);
}

.upload-button svg {
    flex-shrink: 0;
}

.image-preview-mini {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.image-preview-mini img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.remove-img-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    background: var(--error);
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: var(--shadow-md);
}

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

/* 提示词输入 */
#promptInput {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    font-size: 15px;
    font-family: var(--font-base);
    line-height: 1.6;
    resize: vertical;
    transition: all 0.2s;
    background: var(--gray-50);
}

#promptInput:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.examples {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.example-chip {
    padding: 9px 18px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 24px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s;
}

.example-chip:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.image-examples .example-chip {
    background: rgba(37, 99, 235, 0.08);
    border-style: dashed;
    border-color: rgba(37, 99, 235, 0.4);
    color: var(--primary-dark);
    font-weight: 600;
}

.image-examples .example-chip:hover {
    border-style: solid;
}

.image-example-note {
    margin-top: 10px;
    font-size: 12px;
    color: var(--gray-500);
}

/* 生成按钮 */
.generate-button {
    width: 100%;
    padding: 18px 32px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}

.generate-button:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
}

.generate-button:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-content,
.btn-loading {
    display: flex;
    align-items: center;
    gap: 10px;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* 右侧预览面板 */
.preview-panel {
    background: white;
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--shadow-2xl);
    min-height: 600px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* 旧的虚线占位框样式已移除，使用 .image-wrapper 替代 */

/* 空状态 */
.preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 40px;
    min-height: 400px;
}

.empty-icon svg {
    color: var(--gray-300);
    margin-bottom: 24px;
}

.empty-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.empty-desc {
    font-size: 15px;
    color: var(--gray-500);
}

/* 加载状态 */
.preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 40px;
}

.loading-animation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.loading-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--gradient-primary);
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-circle:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-circle:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.loading-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 12px;
}

.loading-desc {
    font-size: 15px;
    color: var(--gray-500);
}

/* 图片生成进度条 */
.image-progress-container {
    width: 100%;
    max-width: 320px;
    margin-top: 24px;
}

.image-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: 10px;
    overflow: hidden;
}

.image-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #818cf8);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.image-progress-text {
    text-align: center;
    margin-top: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

/* 结果展示 */
.video-wrapper {
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    margin-bottom: 24px;
    box-shadow: var(--shadow-lg);
}

.video-wrapper video {
    width: 100%;
    max-height: 500px;
    display: block;
    object-fit: contain;
}

/* 图片结果容器 */
.image-wrapper {
    border-radius: 16px;
    overflow: hidden;
    background: var(--gray-100);
    margin-bottom: 24px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.image-wrapper img {
    width: 100%;
    max-height: 600px;
    display: block;
    object-fit: contain;
}

.result-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.preview-result {
    margin-top: 20px;
}

/* Image result container - 由 JS 控制显示/隐藏，不要用 !important */

.preview-result:not(.has-result) .result-actions,
.preview-result:not(.has-result) .result-meta {
    opacity: 0.4;
    pointer-events: none;
}

.action-button {
    padding: 14px 20px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.action-button:hover {
    background: white;
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.action-button.primary {
    background: var(--primary);
    color: white;
    border: none;
}

.action-button.primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px) scale(1.02);
}

.result-meta {
    background: var(--gray-50);
    border-radius: 12px;
    padding: 20px;
}

.meta-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-200);
}

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

.meta-item span {
    font-size: 14px;
    color: var(--gray-600);
    font-weight: 500;
}

.meta-item code {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--gray-900);
    background: white;
    padding: 4px 8px;
    border-radius: 6px;
}

/* 错误状态 */
.preview-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 32px;
    background: linear-gradient(135deg, #fef2f2 0%, #fff5f5 100%);
    border-radius: 20px;
    border: 1px solid rgba(239, 68, 68, 0.15);
    margin: 20px 0;
}

.error-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.15);
}

.error-icon svg {
    width: 32px;
    height: 32px;
    color: #dc2626;
}

.error-title {
    font-size: 18px;
    font-weight: 600;
    color: #991b1b;
    margin-bottom: 12px;
    line-height: 1.3;
}

.error-message {
    font-size: 14px;
    color: #7f1d1d;
    line-height: 1.7;
    margin-bottom: 24px;
    max-width: 320px;
    background: rgba(255, 255, 255, 0.7);
    padding: 16px 20px;
    border-radius: 12px;
    border: 1px solid rgba(239, 68, 68, 0.1);
}

.retry-button {
    padding: 12px 32px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

.retry-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

/* Toast */
.toast {
    position: fixed;
    top: 80px;
    right: 32px;
    background: var(--gray-900);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-2xl);
    font-size: 14px;
    font-weight: 500;
    transform: translateX(400px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--error);
}

.toast.info {
    background: var(--primary);
}

/* 模态框 */
.modal {
    display: none !important;  /* 强制隐藏，防止CSS加载问题 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9998;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    box-sizing: border-box;
    overflow-y: auto;
}

.modal.active {
    display: flex !important;  /* 激活时显示 */
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    max-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-2xl);
    animation: modalIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding-right: 6px;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.6);
    border-radius: 999px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

@media (max-height: 720px) {
    .modal {
        align-items: flex-start;
    }
}

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

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: var(--gray-100);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--gray-200);
}

.modal-content h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--gray-900);
}

.qr-placeholder {
    background: var(--gray-50);
    border: 2px dashed var(--gray-300);
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
}

.qr-placeholder p {
    color: var(--gray-600);
    margin-bottom: 8px;
}

.qr-hint {
    font-size: 14px !important;
    color: var(--gray-500) !important;
}

.qr-hint strong {
    color: var(--primary);
}

/* 二维码图片容器 */
.qr-code-container {
    text-align: center;
    padding: 20px;
}

.qr-code-image {
    max-width: 300px;
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 16px;
}

.qr-wechat-id {
    font-size: 15px;
    color: var(--gray-700);
    margin-top: 12px;
}

.qr-wechat-id strong {
    color: var(--primary);
    font-weight: 600;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 40px 32px;
    color: white;
    opacity: 0.9;
}

.footer p {
    margin: 8px 0;
    font-size: 14px;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.footer-links a {
    color: white;
    text-decoration: none;
    transition: opacity 0.2s;
}

.footer-links a:hover {
    opacity: 0.8;
}

/* 响应式 */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .result-actions {
        grid-template-columns: 1fr;
    }

    .welcome-title {
        font-size: 48px;
    }

    .welcome-features {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 12px 16px;
        flex-direction: column;
        gap: 12px;
    }

    .logo {
        justify-content: center;
    }

    .logo-text h1 {
        font-size: 16px;
    }

    .container {
        padding: 0 16px 40px;
    }

    /* 移动端紧急公告条 */
    .urgent-bar {
        max-width: 100%;
        font-size: 12px;
        padding: 6px 12px;
        order: 3; /* 放在最后一行 */
        width: 100%;
        justify-content: center;
    }

    .nav {
        gap: 4px;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }

    .nav-link {
        padding: 8px 10px;
        font-size: 12px;
        flex-direction: column;
        gap: 4px;
        min-width: auto;
        flex: 0 0 auto;
    }

    .nav-link svg {
        width: 18px;
        height: 18px;
        margin: 0;
    }

    /* 隐藏部分文字，只显示图标 */
    .nav-link {
        white-space: nowrap;
    }

    .welcome-content {
        padding: 20px;
    }

    .welcome-brand {
        font-size: 42px;
        margin-bottom: 32px;
        letter-spacing: 1px;
    }

    .welcome-title {
        font-size: 32px;
        margin-bottom: 16px;
    }

    .welcome-subtitle {
        font-size: 16px;
        margin-bottom: 50px;
    }

    .start-button {
        padding: 16px 48px;
        font-size: 16px;
    }

    .feature-item {
        padding: 16px 24px;
        font-size: 14px;
    }

    /* 输入面板优化 */
    .input-panel {
        padding: 20px 16px;
    }

    .preview-panel {
        padding: 20px 16px;
    }

    /* 按钮优化 */
    .generate-button {
        font-size: 15px;
        padding: 14px 24px;
    }

    /* 模态框优化 */
    .modal-content {
        max-width: 95vw;
        max-height: 90vh;
        margin: 20px;
        padding: 24px 20px;
        overflow-y: auto;
    }

    .modal-content h3 {
        font-size: 18px;
        margin-bottom: 20px;
    }

    .modal-body {
        padding: 0;
    }

    /* 紧急公告弹窗平板优化 */
    #urgentAnnouncementModal .modal-content {
        max-width: 90vw;
        padding: 24px 20px;
    }
}

/* 超小屏幕（手机竖屏） */
@media (max-width: 480px) {
    .header-content {
        padding: 10px 12px;
    }

    .logo-image {
        width: 28px;
        height: 28px;
    }

    .logo-text h1 {
        font-size: 14px;
    }

    .nav {
        gap: 2px;
    }

    .nav-link {
        padding: 6px 8px;
        font-size: 11px;
    }

    .nav-link svg {
        width: 16px;
        height: 16px;
    }

    .welcome-title {
        font-size: 24px;
    }

    .welcome-subtitle {
        font-size: 14px;
    }

    .feature-item {
        padding: 12px 16px;
        font-size: 12px;
    }

    .prompt-card textarea {
        font-size: 14px;
    }

    .generate-button {
        font-size: 14px;
        padding: 12px 20px;
    }

    /* 紧急公告弹窗移动端优化 */
    #urgentAnnouncementModal .modal-content {
        padding: 20px 16px;
    }

    #urgentAnnouncementModal h3 {
        font-size: 16px !important;
    }

    #urgentAnnouncementModal .modal-content > div:first-child {
        padding: 16px !important;
    }

    #urgentAnnouncementModal button {
        padding: 12px !important;
        font-size: 14px !important;
    }
}

/* ==========================================
   设置和历史记录模态框样式
   ========================================== */

/* 历史记录模态框 */
.history-modal {
    max-width: 900px;
    width: 90%;
}

.history-list {
    max-height: 600px;
    overflow-y: auto;
    padding: 10px;
}

.history-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    padding: 12px 0;
}

.history-page-btn {
    padding: 8px 18px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
    min-width: 80px;
}

.history-page-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
}

.history-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.history-page-info {
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    min-width: 60px;
    text-align: center;
}

.history-loading {
    text-align: center;
    padding: 20px 0;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

.history-item {
    display: grid;
    grid-template-columns: 40px 160px 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.history-number {
    font-size: 16px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
}

.history-thumbnail {
    width: 160px;
    height: 90px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
    cursor: pointer;
}

.history-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-thumbnail .no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0.8;
    z-index: 2;
    pointer-events: none;
}

.play-overlay svg {
    margin-left: 3px;
}

.history-thumbnail:hover .play-overlay {
    background: rgba(0, 0, 0, 0.8);
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.history-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-prompt {
    color: white;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-time {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    margin: 0;
}

.history-mode-badge {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
}

.history-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.history-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.history-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateX(-2px);
}

.history-btn.play:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.history-btn.download:hover {
    background: var(--success);
    border-color: var(--success);
}

.history-btn.copy:hover {
    background: rgba(255, 165, 0, 0.8);
    border-color: rgba(255, 165, 0, 1);
}

.history-empty {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

/* 客服/交流群模态框 */
.contact-modal {
    max-width: 900px;
    width: 90%;
}

.contact-modal .modal-body {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.contact-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.contact-section h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0 0 20px 0;
    text-align: center;
}

/* 邀请码购买模态框 - 左右布局 */
.invite-code-modal {
    max-width: 750px;
}

.invite-code-content {
    display: flex;
    gap: 40px;
    align-items: center;
}

.invite-code-image {
    flex: 0 0 240px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.invite-code-image .sora-logo {
    width: 220px;
    height: 220px;
    object-fit: contain;
    border-radius: 28px;
}

.invite-code-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.title-with-help {
    display: flex;
    align-items: center;
    gap: 10px;
}

.title-with-help h4 {
    margin: 0;
    font-size: 22px;
    color: #1a202c;
}

.help-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.help-btn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.1);
}

.invite-price-row {
    display: flex;
    align-items: baseline;
    gap: 16px;
}

.invite-price {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.price-symbol {
    font-size: 22px;
    color: #667eea;
    font-weight: 600;
}

.price-amount {
    font-size: 32px;
    color: #667eea;
    font-weight: 700;
}

.invite-stock {
    color: #718096;
    font-size: 13px;
}

.invite-stock strong {
    color: #667eea;
    font-size: 16px;
    font-weight: 700;
}

.invite-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.invite-features li {
    color: #4a5568;
    font-size: 13px;
}

.invite-code-info .payment-btn {
    margin-top: 4px;
}

.invite-code-info .payment-note {
    margin: 0;
    font-size: 12px;
    color: #718096;
}

/* 响应式：小屏幕垂直布局 */
@media (max-width: 640px) {
    .invite-code-content {
        flex-direction: column;
        gap: 24px;
    }

    .invite-code-image {
        flex: 0 0 auto;
    }

    .invite-code-image .sora-logo {
        width: 160px;
        height: 160px;
    }
}

/* 会员开通模态框 */
.member-modal {
    max-width: 800px;
}

/* 会员购买容器（不再需要左右布局） */
.member-purchase-container {
    margin-bottom: 24px;
}

/* 移除邀请码区域样式（已移到独立弹窗） */
.invite-code-section {
    display: none;
}

.invite-code-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 28px 24px;
    color: white;
    text-align: center;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.invite-code-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.card-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
}

.invite-code-card h4 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 20px 0;
    position: relative;
    z-index: 1;
}

.invite-code-price {
    margin: 20px 0;
    position: relative;
    z-index: 1;
}

.invite-code-price .currency {
    font-size: 20px;
    font-weight: 600;
    vertical-align: top;
    opacity: 0.9;
}

.invite-code-price .amount {
    font-size: 48px;
    font-weight: 800;
    line-height: 1;
}

.invite-code-stock {
    background: rgba(255, 255, 255, 0.15);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin: 20px 0;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
}

.stock-num {
    font-size: 20px;
    font-weight: 700;
    color: #ffd700;
    margin: 0 4px;
}

.btn-buy-invite {
    width: 100%;
    padding: 14px 24px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.btn-buy-invite:hover {
    background: #f8f9ff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.btn-buy-invite:disabled {
    background: rgba(255, 255, 255, 0.5);
    cursor: not-allowed;
    transform: none;
}

.invite-code-note {
    margin-top: 12px;
    font-size: 12px;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

/* 会员套餐区域 */
.member-packages-section {
    display: flex;
    flex-direction: column;
}

.member-packages {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
    justify-content: center;
}

.package-item {
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: 16px;
    padding: 28px 24px;
    text-align: center;
    transition: all 0.3s;
    position: relative;
}

.package-item:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    background: white;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.15);
}

.package-item.recommended {
    border-color: var(--primary);
    background: #eff6ff;
    border-width: 3px;
}

.recommend-badge {
    position: absolute;
    top: -12px;
    right: 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.package-item h4 {
    color: var(--gray-900);
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 20px 0;
}

.package-price {
    color: var(--primary);
    font-size: 42px;
    font-weight: 800;
    margin: 20px 0;
    line-height: 1;
}

.package-price span {
    font-size: 24px;
    font-weight: 600;
}

.package-desc {
    color: var(--gray-600);
    font-size: 15px;
    margin: 0 0 24px 0;
    font-weight: 500;
}

.package-item .btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.package-item .btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

.package-item.recommended .btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
}

.payment-note {
    text-align: center;
    color: var(--gray-500);
    font-size: 14px;
    margin: 0;
}

/* 兑换码区域 */
.redeem-section {
    margin-top: 32px;
    padding-top: 24px;
}

.redeem-divider {
    text-align: center;
    position: relative;
    margin-bottom: 20px;
}

.redeem-divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: var(--gray-200);
}

.redeem-divider span {
    position: relative;
    background: white;
    padding: 0 16px;
    color: var(--gray-500);
    font-size: 14px;
    font-weight: 500;
}

.redeem-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.redeem-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s;
}

.redeem-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-redeem {
    padding: 12px 32px;
    background: var(--gray-800);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-redeem:hover {
    background: var(--gray-900);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-redeem:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
    transform: none;
}

.redeem-hint {
    text-align: center;
    color: var(--gray-400);
    font-size: 12px;
    margin: 0;
}

/* 设置模态框 */
.settings-modal {
    max-width: 500px;
}

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

.modal-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}

.modal-close-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--gray-100);
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    background: var(--gray-200);
    color: var(--gray-900);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-hint {
    margin-top: 8px;
    font-size: 13px;
    color: var(--gray-500);
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.form-hint svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.sk-input {
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-200);
}

.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

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

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

/* 历史记录模态框 */
.history-modal {
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.history-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-text {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-text.danger {
    color: var(--error);
    border-color: var(--error);
}

.btn-text.danger:hover {
    background: #fef2f2;
}

.history-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 12px;
    font-size: 14px;
    color: #92400e;
    margin-bottom: 20px;
}

.history-notice svg {
    flex-shrink: 0;
    color: #f59e0b;
}

.history-list {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 8px;
}

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

.empty-history {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.empty-history p:first-child {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-hint {
    font-size: 14px;
    color: var(--gray-400);
}

.history-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.history-item:hover {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.history-thumbnail {
    width: 120px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: var(--gray-200);
    position: relative;
    cursor: pointer;
}

.history-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-thumbnail .no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--gray-500);
    font-weight: 500;
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0.8;
    z-index: 2;
    pointer-events: none;
}

.play-overlay svg {
    margin-left: 3px;
}

.history-thumbnail:hover .play-overlay {
    background: rgba(0, 0, 0, 0.8);
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-prompt-title {
    display: none;
}

.history-prompt {
    font-size: 15px;
    font-weight: 500;
    color: var(--gray-900);
    margin-bottom: 8px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 复制提示词按钮样式 */
.history-btn.copy-prompt {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    border-color: transparent;
}

.history-btn.copy-prompt:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
}

.history-meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: var(--gray-500);
}

.history-time {
    font-size: 13px;
    color: var(--gray-500);
}

.history-mode-badge {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    border: 2px solid transparent;
    transition: all 0.2s;
}

/* 免费额度徽章 - 蓝色边框，深色文字 */
.history-item .history-mode-badge {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #0ea5e9;
}

/* 会员徽章 - 金色渐变，更尊贵 */
.history-item .history-mode-badge.premium {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #78350f;
    border-color: #f59e0b;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* 类型标签（视频/绘图） */
.history-type-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    z-index: 2;
}

.history-type-badge.video {
    background: rgba(37, 99, 235, 0.9);
    color: white;
}

.history-type-badge.image {
    background: rgba(139, 92, 246, 0.9);
    color: white;
}

.history-thumbnail.is-image .play-overlay {
    background: rgba(139, 92, 246, 0.6);
}

/* 绘图查看按钮 */
.history-btn.view {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    border-color: transparent;
}

.history-btn.view:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
}

/* 图片预览弹窗 */
.image-preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.image-preview-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.image-preview-container img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

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

.image-preview-actions button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.image-preview-actions button:hover {
    background: rgba(255, 255, 255, 0.25);
}

.image-preview-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.image-preview-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.history-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.history-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.history-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateX(-2px);
}

.history-btn.delete:hover {
    background: var(--error);
    border-color: var(--error);
}

/* 响应式 */
@media (max-width: 768px) {
    .settings-modal,
    .history-modal {
        max-width: 95vw;
        padding: 24px;
    }

    .history-item {
        flex-direction: column;
    }

    .history-thumbnail {
        width: 100%;
        height: 180px;
    }

    .history-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .history-btn {
        flex: 1;
    }

    /* 客服弹窗移动端竖版 */
    .contact-modal .modal-body {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    /* 会员弹窗移动端竖版 */
    .member-purchase-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .member-packages {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 0;
    }

    /* 登录注册表单适配 */
    .auth-tab {
        padding: 8px 12px;
        font-size: 13px;
    }

    .form-group input {
        padding: 10px 14px;
        font-size: 14px;
    }

    .btn-full {
        padding: 12px 20px;
        font-size: 14px;
    }

    /* 会员套餐卡片适配 */
    .package-item {
        padding: 20px;
        margin: 0;
    }

    .package-item h4 {
        font-size: 18px;
        margin-bottom: 12px;
    }

    .package-price {
        font-size: 32px;
        margin: 12px 0;
    }

    .package-price span {
        font-size: 20px;
    }

    .package-desc {
        font-size: 14px;
        margin-bottom: 16px;
    }

    .package-item .btn-primary {
        padding: 12px 20px;
        font-size: 14px;
    }

    /* 客服/交流群适配 */
    .contact-modal .modal-body {
        padding: 20px 12px;
    }

    .qr-code-image {
        max-width: 200px;
    }

    .contact-section h4 {
        font-size: 16px;
    }

    .qr-wechat-id {
        font-size: 13px;
    }

    .qr-hint {
        font-size: 12px;
    }

    /* 账户信息适配 */
    .info-item {
        padding: 12px 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .info-item label {
        min-width: auto;
        font-size: 13px;
    }

    .info-item span {
        text-align: left;
        font-size: 14px;
    }

    /* 兑换码区域适配 */
    .redeem-section {
        margin-top: 24px;
        padding-top: 20px;
    }

    .redeem-input-group {
        flex-direction: column;
        gap: 10px;
    }

    .redeem-input {
        font-size: 14px;
        padding: 10px 14px;
    }

    .redeem-input-group button {
        width: 100%;
        padding: 12px;
    }

    /* 邀请码弹窗适配 */
    .invite-card {
        padding: 20px 16px;
    }

    .invite-price {
        font-size: 32px;
    }

    .invite-features li {
        font-size: 13px;
    }

    /* 支付提示适配 */
    .payment-note {
        font-size: 12px;
        padding: 0 8px;
    }

    /* 推荐徽章适配 */
    .recommend-badge {
        font-size: 11px;
        padding: 4px 12px;
        top: -10px;
        right: 16px;
    }

    /* 弹窗内容超长滚动 */
    .member-modal .modal-body,
    .contact-modal .modal-body {
        max-height: calc(90vh - 120px);
        overflow-y: auto;
    }
}

/* 兑换码弹窗样式 */
.member-status {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.status-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.status-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-label {
    font-size: 13px;
    color: var(--gray-600);
    font-weight: 500;
}

.status-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-free {
    background: #e3f2fd;
    color: #1976d2;
}

.badge-premium {
    background: #fff3e0;
    color: #f57c00;
}

/* 登录/注册弹窗样式 */
.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--gray-100);
    padding: 4px;
    border-radius: 12px;
}

.auth-tab {
    flex: 1;
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-full {
    width: 100%;
    margin-top: 8px;
}

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

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--gray-50);
    border-radius: 12px;
    transition: all 0.2s;
}

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

.info-item label {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-600);
    min-width: 100px;
}

.info-item span {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-900);
    text-align: right;
    flex: 1;
}

/* ==========================================
   分步骤注册样式
   ========================================== */

/* 步骤指示器 */
.register-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 28px;
}

.progress-step {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    transition: all 0.3s;
}

.progress-step.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.progress-line {
    width: 60px;
    height: 2px;
    background: var(--gray-200);
}

/* 注册步骤容器 */
.register-step {
    animation: fadeSlideIn 0.3s ease;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 信息确认卡片 */
.info-confirm-card {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #bae6fd;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.info-confirm-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    color: var(--gray-800);
    font-size: 14px;
}

.info-confirm-item:not(:last-child) {
    border-bottom: 1px solid rgba(14, 165, 233, 0.15);
}

.info-confirm-item svg {
    color: var(--primary);
    flex-shrink: 0;
}

.info-confirm-item strong {
    color: var(--primary);
    font-weight: 600;
}

/* 服务条款复选框 */
.terms-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    background: var(--gray-50);
    border-radius: 10px;
    margin-bottom: 16px;
}

.terms-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
}

.terms-checkbox label {
    font-size: 13px;
    color: var(--gray-700);
    line-height: 1.6;
    cursor: pointer;
    flex: 1;
}

.terms-checkbox a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.terms-checkbox a:hover {
    text-decoration: underline;
}

/* 按钮组 */
.button-group {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

/* 响应式适配 */
@media (max-width: 480px) {
    .progress-step {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .progress-line {
        width: 40px;
    }
    
    .info-confirm-card {
        padding: 16px;
    }
    
    .info-confirm-item {
        font-size: 13px;
    }
}

/* ==========================================
   标签页和积分充值样式
   ========================================== */

/* 标签页导航 */
.modal-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--gray-100);
    padding: 4px;
    border-radius: 12px;
}

.tab-btn {
    flex: 1;
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

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

.tab-btn:hover:not(.active) {
    color: var(--gray-800);
}

/* 标签页内容 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* 积分充值套餐 */
.credits-packages {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.package-credits {
    color: #f59e0b;
    font-size: 28px;
    font-weight: 800;
    margin: 16px 0;
    line-height: 1;
}

/* 积分充值按钮 */
.credits-btn {
    /* 使用 package-item 内已有的 btn-primary 样式 */
}

/* 响应式：移动端积分套餐垂直布局 */
@media (max-width: 768px) {
    .credits-packages {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .tab-btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .package-credits {
        font-size: 24px;
        margin: 12px 0;
    }
}

/* ==================== 已选角色标签 ==================== */

.selected-character-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    padding: 0;
}

.character-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 6px 8px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
    animation: tagSlideIn 0.2s ease;
}

@keyframes tagSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.character-tag-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.character-tag-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.character-tag-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
    padding: 0;
    margin-left: 2px;
}

.character-tag-remove:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* ==================== 角色参考图卡片（类似参考图样式）==================== */

.character-ref-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    animation: tagSlideIn 0.2s ease;
    position: relative;
}

.character-ref-img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid var(--primary);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.character-ref-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.character-ref-label {
    font-size: 11px;
    color: var(--gray-500);
}

.character-ref-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-800);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.character-ref-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--gray-100);
    border: none;
    border-radius: 50%;
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.2s;
    margin-left: auto;
}

.character-ref-remove:hover {
    background: var(--error);
    color: white;
}

.character-ref-remove svg {
    width: 12px;
    height: 12px;
}

/* ==================== 角色选择器 ==================== */

.character-selector {
    position: fixed;
    z-index: 9999;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    max-height: 400px;
    overflow: hidden;
    display: none;
    animation: selectorSlideIn 0.2s ease;
}

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

.character-selector-header {
    padding: 12px;
    border-bottom: 1px solid var(--gray-100);
    background: var(--gray-50);
}

.character-search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.character-search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.character-selector-content {
    max-height: 280px;
    overflow-y: auto;
    padding: 8px 0;
}

.character-section {
    padding: 0 8px;
}

.character-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    padding: 8px 12px 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.character-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin: 2px 4px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.character-item:hover,
.character-item.active {
    background: var(--gray-100);
}

.character-item.active {
    background: rgba(37, 99, 235, 0.08);
}

.character-item.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.character-item.create-new {
    border: 2px dashed var(--gray-300);
    background: var(--gray-50);
}

.character-item.create-new:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.character-avatar {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.character-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.character-avatar.create-avatar {
    font-size: 20px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: white;
}

.character-info {
    flex: 1;
    min-width: 0;
}

.character-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 6px;
}

.character-desc {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.visibility-badge {
    font-size: 10px;
}

.visibility-badge.public {
    color: var(--primary);
}

.visibility-badge.private {
    color: var(--gray-400);
}

.character-tags {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.char-tag {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--gray-100);
    color: var(--gray-600);
    border-radius: 4px;
}

.char-edit-btn {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 14px;
}

.character-item:hover .char-edit-btn {
    opacity: 1;
}

.character-selector-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--gray-100);
    background: #fffbeb;
    font-size: 11px;
    color: #92400e;
    text-align: center;
}

/* 创建角色弹窗 */
.create-character-form {
    padding: 20px 0;
}

.create-character-form .form-group {
    margin-bottom: 20px;
}

.create-character-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
}

.create-character-form input,
.create-character-form textarea,
.create-character-form select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 10px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.create-character-form input:focus,
.create-character-form textarea:focus,
.create-character-form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.create-character-form textarea {
    resize: vertical;
    min-height: 80px;
}

.character-image-upload {
    width: 100%;
    height: 180px;
    border: 2px dashed var(--gray-300);
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: border-color 0.2s, background 0.2s;
}

.character-image-upload:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.02);
}

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

#characterImagePreview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#characterImagePreview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--gray-500);
}

.upload-placeholder .upload-icon {
    font-size: 36px;
}

.upload-placeholder .upload-hint {
    font-size: 12px;
    color: var(--gray-400);
}

.preview-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
    color: white;
    font-size: 12px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.character-image-upload:hover .preview-overlay {
    opacity: 1;
}

.character-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 20px;
}

.character-warning p {
    font-size: 13px;
    color: #92400e;
    margin: 0;
    line-height: 1.6;
}

.character-warning strong {
    color: #b45309;
}

.character-form-actions {
    display: flex;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-100);
}

.character-form-actions .btn-primary,
.character-form-actions .btn-secondary {
    flex: 1;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
}

.btn-danger {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: #fecaca;
    border-color: #fca5a5;
}

/* 移动端角色选择器适配 */
@media (max-width: 768px) {
    .character-selector {
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        max-height: 50vh;
    }
    
    .character-selector-content {
        max-height: 35vh;
    }
    
    .character-avatar {
        width: 40px;
        height: 40px;
    }
    
    .character-name {
        font-size: 13px;
    }
    
    .character-desc {
        font-size: 11px;
    }
}

/* ========== 角色库弹窗样式 ========== */
.char-lib-tab {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--gray-500);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.char-lib-tab:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

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

.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    max-height: 400px;
    overflow-y: auto;
    padding: 4px;
}

.character-card {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
}

.character-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.15);
}

.character-card-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 12px;
    border: 3px solid var(--gray-200);
}

.character-card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.character-card-desc {
    font-size: 12px;
    color: var(--gray-500);
    line-height: 1.4;
    max-height: 2.8em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.character-card-visibility {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--gray-100);
    color: var(--gray-600);
}

.character-card-visibility.public {
    background: #dcfce7;
    color: #16a34a;
}

.character-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    justify-content: center;
}

.character-card-actions button {
    padding: 6px 12px;
    border: 1px solid var(--gray-300);
    background: white;
    color: var(--gray-600);
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.character-card-actions button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.character-card-actions button.delete:hover {
    border-color: var(--error);
    color: var(--error);
    background: #fef2f2;
}

.create-character-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* 移动端角色库适配 */
@media (max-width: 768px) {
    .character-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .character-card {
        padding: 12px;
    }
    
    .character-card-avatar {
        width: 60px;
        height: 60px;
    }
    
    .character-card-name {
        font-size: 13px;
    }
    
    .char-lib-tab {
        padding: 8px 14px;
        font-size: 13px;
    }
}

/* 美化下拉框样式 */
.styled-select {
    width: 100%;
    padding: 12px 40px 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: all 0.2s ease;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.styled-select:hover {
    border-color: var(--primary-light);
    background-color: #fafbff;
}

.styled-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* 下拉选项样式 */
.styled-select option {
    padding: 10px 12px;
    font-size: 14px;
    background: #fff;
    color: var(--gray-700);
}

.styled-select option:checked {
    background: #6366f1;
    color: #fff;
}

/* 自定义下拉框组件 */
.custom-select {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    transition: all 0.2s ease;
}

.custom-select-trigger:hover {
    border-color: var(--primary-light);
    background: #fafbff;
}

.custom-select.open .custom-select-trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.custom-select-trigger svg {
    color: var(--primary);
    transition: transform 0.2s ease;
}

.custom-select.open .custom-select-trigger svg {
    transform: rotate(180deg);
}

.custom-select-options {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    overflow: hidden;
}

.custom-select.open .custom-select-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-select-option {
    padding: 11px 16px;
    font-size: 14px;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.15s ease;
}

.custom-select-option:hover {
    background: #f0f4ff;
    color: var(--primary);
}

.custom-select-option.selected {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    font-weight: 500;
}

.custom-select-option.selected:hover {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    color: #fff;
}

/* ==================== 参考图片上传区域 ==================== */
.reference-images-section {
    margin-top: 10px;
    margin-bottom: 8px;
}


.reference-images-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.reference-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--gray-500);
    font-size: 13px;
}

.reference-upload-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(37, 99, 235, 0.04);
}

.reference-upload-btn svg {
    width: 16px;
    height: 16px;
}

.reference-image-item {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

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

.reference-image-item .remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

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

.reference-image-item .remove-btn:hover {
    background: #ef4444;
}

.reference-image-item .uploading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.reference-image-item .uploading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #e5e7eb;
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

