* { margin: 0; padding: 0; box-sizing: border-box; }

:root, [data-theme="light"] {
    --primary: #667eea;
    --primary-dark: #5a6fd6;
    --primary-light: #eef0ff;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg: #f5f7fa;
    --bg-white: #ffffff;
    --bg-hover: #f0f2f5;
    --text: #1a1a2e;
    --text-secondary: #666;
    --text-light: #999;
    --border: #e8eaed;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-w: 72px;
    --transition: 0.2s ease;
    --danger: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
    --code-bg: #f8f9fa;
    --msg-user-bg: var(--primary);
    --msg-ai-bg: var(--bg-white);
}

[data-theme="dark"] {
    --primary: #7c8cf5;
    --primary-dark: #6b7ef0;
    --primary-light: #2a2d4e;
    --primary-gradient: linear-gradient(135deg, #7c8cf5 0%, #9b59b6 100%);
    --bg: #0f0f1a;
    --bg-white: #1a1a2e;
    --bg-hover: #252540;
    --text: #e8e8f0;
    --text-secondary: #a0a0b8;
    --text-light: #6b6b80;
    --border: #2a2a40;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.4);
    --danger: #ff6b6b;
    --success: #51cf66;
    --warning: #ffc107;
    --code-bg: #12121f;
    --msg-user-bg: #5a6fd6;
    --msg-ai-bg: #1a1a2e;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* ========== Toast 通知 ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--bg-white);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    font-size: 14px;
    min-width: 280px;
    max-width: 400px;
    transform: translateX(120%);
    transition: all 0.3s ease;
}

.toast-show { transform: translateX(0); }
.toast-hide { transform: translateX(120%); opacity: 0; }

.toast-icon { flex-shrink: 0; display: flex; }
.toast-msg { flex: 1; }
.toast-close { background: none; border: none; color: var(--text-light); cursor: pointer; font-size: 18px; padding: 0 4px; }

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--primary); }

/* ========== 登录页 ========== */
.auth-page {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-gradient);
}

.auth-card {
    background: var(--bg-white);
    border-radius: 20px;
    padding: 48px 40px;
    width: 400px;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo h1 {
    font-size: 24px;
    margin-top: 12px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    background: var(--bg);
    border-radius: 10px;
    padding: 4px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.auth-tab.active {
    background: var(--bg-white);
    color: var(--primary);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.form-group {
    margin-bottom: 16px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    background: var(--bg-white);
    color: var(--text);
    transition: var(--transition);
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.auth-error {
    margin-top: 16px;
    color: var(--danger);
    font-size: 13px;
    text-align: center;
    min-height: 20px;
}

/* ========== 主布局 ========== */
.app-container {
    display: flex;
    height: 100vh;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

/* ========== 侧边栏（窄图标式） ========== */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    z-index: 100;
    padding: 12px 0;
}

.sidebar-logo {
    padding: 8px 0 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding: 0 8px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    color: var(--text-light);
    text-decoration: none;
    font-size: 10px;
    transition: var(--transition);
}

.nav-item svg { flex-shrink: 0; }

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 0 4px;
    border-top: 1px solid var(--border);
    width: 100%;
}

.sidebar-credits-mini {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    border-radius: 12px;
}

.sidebar-bottom-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-bottom-btn:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-bottom-btn.signed { color: var(--success); }
.sidebar-logout-btn:hover { color: var(--danger); }

.sidebar-user { padding: 2px 0; }

.user-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}

/* ========== 公告横幅 ========== */
.announcement-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--primary-light);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--primary);
}

.announcement-bar svg { flex-shrink: 0; }
.announcement-bar span { flex: 1; }

.announcement-close {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.6;
    transition: var(--transition);
}

.announcement-close:hover { opacity: 1; }

/* ========== 积分明细页 ========== */
.credits-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.credits-header {
    padding: 16px 24px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.credits-header h2 { font-size: 16px; font-weight: 600; }

.credits-summary {
    display: flex;
    gap: 16px;
    padding: 20px 24px;
}

.credit-stat-card {
    flex: 1;
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
    text-align: center;
}

.credit-stat-card .stat-num {
    font-size: 28px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.credit-stat-card .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.credits-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px 24px;
}

.credits-table {
    width: 100%;
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border-collapse: collapse;
}

.credits-table th {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.credits-table td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

.credits-table tr:last-child td { border-bottom: none; }

.credit-amount {
    font-weight: 600;
}

.credit-amount.plus { color: var(--success); }
.credit-amount.minus { color: var(--danger); }

.credits-empty {
    text-align: center;
    padding: 60px 0;
    color: var(--text-light);
    font-size: 14px;
}

/* 生成按钮积分标签 */
.btn-cost-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 6px;
    padding: 2px 8px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 400;
}

/* (旧侧边栏样式已移除，使用新版窄侧边栏) */

/* ========== 主内容 ========== */
.main-content {
    flex: 1;
    overflow: hidden;
    background: var(--bg);
    display: flex;
    flex-direction: column;
}

.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
}

.mobile-title { font-weight: 600; font-size: 16px; }

.hamburger {
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 4px;
}

.page {
    display: none;
    height: 100%;
    overflow-y: auto;
}

.page.active { display: flex; flex-direction: column; overflow-y: auto; }

/* ========== 对话页布局 ========== */
.chat-layout {
    display: flex;
    height: 100%;
}

.chat-sessions {
    width: 260px;
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sessions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.btn-new-chat {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.btn-new-chat:hover { background: var(--primary); color: white; border-color: var(--primary); }

.sessions-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.sessions-empty {
    text-align: center;
    color: var(--text-light);
    padding: 24px;
    font-size: 13px;
}

.session-item {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    margin-bottom: 4px;
}

.session-item:hover { background: var(--bg-hover); }
.session-item.active { background: var(--primary-light); }

.session-title {
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 24px;
}

.session-meta {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
}

.session-delete {
    position: absolute;
    top: 12px;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 2px;
    opacity: 0;
    transition: var(--transition);
}

.session-item:hover .session-delete { opacity: 1; }
.session-delete:hover { color: var(--danger); }

/* 对话主区域 */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-header {
    padding: 12px 20px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-title {
    flex: 1;
    font-weight: 600;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-header-actions { display: flex; gap: 8px; }

.btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover { background: var(--bg-hover); color: var(--text); }

.btn-toggle-sessions {
    width: 32px;
    height: 32px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* 欢迎页 */
.chat-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px;
}

.welcome-icon { color: var(--primary); opacity: 0.7; }
.chat-welcome h3 { font-size: 18px; color: var(--text); font-weight: 600; }
.chat-welcome p, .chat-welcome .welcome-sub { color: var(--text-light); font-size: 13px; }

.prompt-templates {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    max-width: 500px;
    justify-content: center;
}

.prompt-tpl {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--bg-white);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.prompt-tpl:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* 消息样式 */
.message {
    display: flex;
    gap: 10px;
    max-width: 72%;
}

.message.animate { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.message.user { align-self: flex-end; flex-direction: row-reverse; }
.message.assistant { align-self: flex-start; }

.message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.message-avatar.user { background: var(--primary); color: white; }
.message-avatar.assistant { background: var(--primary-gradient); color: white; }

.message-body {
    max-width: 100%;
    min-width: 0;
}

.message-text {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.6;
    word-break: break-word;
}

.message.user .message-text {
    background: var(--msg-user-bg);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-text {
    background: var(--msg-ai-bg);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.message-actions {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    opacity: 0;
    transition: var(--transition);
}

.message:hover .message-actions { opacity: 1; }

.msg-action-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
}

.msg-action-btn:hover { color: var(--primary); background: var(--primary-light); }

/* 输入区域 */
.chat-input-area {
    padding: 12px 20px;
    background: var(--bg-white);
    border-top: 1px solid var(--border);
}

.chat-input-hint {
    text-align: center;
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 6px;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    max-width: 800px;
    margin: 0 auto;
}

.chat-input-wrapper textarea {
    flex: 1;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 120px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    transition: var(--transition);
}

.chat-input-wrapper textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.btn-send {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
}

.btn-send:hover { opacity: 0.9; transform: scale(1.05); }
.btn-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ========== Markdown 样式 ========== */
.message-text h2, .message-text h3, .message-text h4 {
    margin: 12px 0 8px;
    font-weight: 600;
}

.message-text h2 { font-size: 18px; }
.message-text h3 { font-size: 16px; }
.message-text h4 { font-size: 15px; }

.message-text ul, .message-text ol {
    padding-left: 20px;
    margin: 8px 0;
}

.message-text li { margin: 4px 0; }

.message-text blockquote {
    border-left: 3px solid var(--primary);
    padding: 8px 16px;
    margin: 8px 0;
    background: var(--bg);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
}

.message-text hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 12px 0;
}

.message-text a {
    color: var(--primary);
    text-decoration: none;
}

.message-text a:hover { text-decoration: underline; }

.inline-code {
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
    color: var(--danger);
}

.code-block {
    position: relative;
    margin: 12px 0;
    border-radius: 10px;
    overflow: hidden;
    background: var(--code-bg);
    border: 1px solid var(--border);
}

.code-block pre {
    padding: 16px;
    overflow-x: auto;
    margin: 0;
}

.code-block code {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
}

.code-lang {
    position: absolute;
    top: 8px;
    left: 12px;
    font-size: 11px;
    color: var(--text-light);
    text-transform: uppercase;
}

.code-copy {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    font-size: 11px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-white);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.code-copy:hover { background: var(--primary); color: white; border-color: var(--primary); }

.md-table {
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 13px;
    width: 100%;
}

.md-table th, .md-table td {
    padding: 8px 12px;
    border: 1px solid var(--border);
    text-align: left;
}

.md-table th { background: var(--bg); font-weight: 600; }

/* ========== 生成页通用 ========== */
.gen-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.gen-header {
    padding: 16px 24px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gen-header-actions { display: flex; gap: 8px; }

.gen-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    gap: 24px;
}

.gen-form {
    width: 380px;
    flex-shrink: 0;
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    height: fit-content;
}

.gen-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    margin-top: 16px;
}

.gen-form label:first-child { margin-top: 0; }

.gen-form textarea,
.gen-form input[type="number"],
.gen-form input[type="text"],
.gen-form select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: var(--bg);
    color: var(--text);
    transition: var(--transition);
}

.gen-form textarea:focus,
.gen-form input:focus,
.gen-form select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.gen-form textarea { resize: vertical; min-height: 80px; }

/* 风格选择 */
.style-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.style-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.style-icon { font-size: 20px; }

.style-btn:hover { border-color: var(--primary); color: var(--primary); }
.style-btn.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

/* 比例选择 */
.ratio-row {
    display: flex;
    gap: 8px;
}

.ratio-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 6px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text-secondary);
    font-size: 11px;
    cursor: pointer;
    transition: var(--transition);
}

.ratio-btn:hover { border-color: var(--primary); }
.ratio-btn.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.ratio-preview {
    width: 24px;
    max-height: 30px;
    border: 2px solid currentColor;
    border-radius: 3px;
}

/* 步数滑块 */
.slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.slider-row input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.slider-row span {
    min-width: 30px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

/* 灵感建议 */
.prompt-suggest {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 16px;
    align-items: center;
}

.suggest-label {
    font-size: 12px;
    color: var(--text-light);
}

.suggest-btn {
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.suggest-btn:hover { border-color: var(--primary); color: var(--primary); }

.size-row {
    display: flex;
    gap: 12px;
}

.size-row > div { flex: 1; }

.btn-generate {
    width: 100%;
    margin-top: 20px;
    padding: 12px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-generate:hover { opacity: 0.9; }
.btn-generate:disabled { opacity: 0.5; cursor: not-allowed; }

.gen-result {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.gen-placeholder {
    text-align: center;
    color: var(--text-light);
}

.gen-placeholder svg { opacity: 0.2; margin-bottom: 12px; }

.gen-loading {
    text-align: center;
    color: var(--text-secondary);
}

.gen-loading p { margin-top: 16px; font-size: 14px; }

.gen-image-wrap, .gen-video-wrap {
    text-align: center;
}

.gen-image-wrap img {
    max-width: 100%;
    max-height: 60vh;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: var(--transition);
}

.gen-image-wrap img:hover { transform: scale(1.02); }

.gen-video-wrap video {
    max-width: 100%;
    max-height: 60vh;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.gen-image-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 16px;
}

.btn-action {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-white);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-action:hover { border-color: var(--primary); color: var(--primary); }

/* ========== 作品广场 ========== */
.gallery-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.gallery-header {
    padding: 16px 24px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gallery-header h2 { font-size: 16px; font-weight: 600; }

.gallery-tabs {
    display: flex;
    gap: 8px;
}

.gallery-tab {
    padding: 6px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: transparent;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.gallery-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.gallery-grid {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    align-content: start;
}

.gallery-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.gallery-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.gallery-card-media {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--bg);
    cursor: pointer;
}

.gallery-card-info {
    padding: 12px 16px;
}

.gallery-card-prompt {
    font-size: 13px;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallery-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-light);
}

.gallery-card-meta > div { display: flex; gap: 8px; align-items: center; }

.gallery-card-action {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 2px;
    transition: var(--transition);
}

.gallery-card-action:hover { color: var(--danger); }

.gallery-card-delete {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    transition: var(--transition);
}

.gallery-card-delete:hover { background: rgba(231,76,60,0.08); color: var(--danger); }

.gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 0;
    color: var(--text-light);
}

/* ========== 设置页 ========== */
.settings-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.settings-header {
    padding: 16px 24px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
}

.settings-header h2 { font-size: 16px; font-weight: 600; }

.settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    max-width: 640px;
}

.settings-section {
    margin-bottom: 32px;
}

.settings-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.settings-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.settings-field {
    margin-bottom: 16px;
}

.settings-field:last-child { margin-bottom: 0; }

.settings-field label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.settings-field input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    background: var(--bg);
    color: var(--text);
    transition: var(--transition);
}

.settings-field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.settings-input-row {
    display: flex;
    gap: 10px;
}

.settings-input-row input { flex: 1; }

.btn-sm {
    padding: 8px 18px;
    border: 1px solid var(--primary);
    border-radius: 8px;
    background: transparent;
    color: var(--primary);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.btn-sm:hover { background: var(--primary); color: white; }

.btn-danger {
    border-color: var(--danger);
    color: var(--danger);
}

.btn-danger:hover { background: var(--danger); color: white; }

.btn-settings-save {
    margin-top: 16px;
    padding: 10px 24px;
    width: auto;
}

/* 主题选择 */
.theme-options {
    display: flex;
    gap: 10px;
}

.theme-opt {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 10px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.theme-opt:hover { border-color: var(--primary); }
.theme-opt.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

/* ========== Lightbox ========== */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.lightbox.active { display: flex; }

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.85);
    cursor: pointer;
}

.lightbox-content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-content img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.3);
}

.lightbox-content video {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.3);
    background: #000;
}

.lightbox-toolbar {
    position: absolute;
    top: -44px;
    right: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lightbox-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.lightbox-btn:hover { background: rgba(255,255,255,0.3); }

.lightbox-close {
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

/* ========== Loading ========== */
.loading-dots::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

.spinner-sm {
    display: inline-block;
    width: 16px;
    height: 16px;
    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); } }

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
    .chat-sessions { width: 220px; }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -80px;
        top: 0;
        bottom: 0;
        width: 72px;
        transition: left 0.3s ease;
        z-index: 100;
    }

    .sidebar.open { left: 0; }
    .sidebar-overlay.active { display: block; }
    .mobile-header { display: flex; }

    .main-content { width: 100%; margin-left: 0; }

    .chat-layout { flex-direction: column; }

    .chat-sessions {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 98;
        transition: left 0.3s ease;
    }

    .chat-sessions.show { left: 0; }

    .btn-toggle-sessions { display: flex; }

    .gen-body { flex-direction: column; }
    .gen-form { width: 100%; }

    .prompt-templates { gap: 6px; }
    .prompt-tpl { font-size: 12px; padding: 8px 14px; }

    .settings-body { padding: 16px; }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        padding: 16px;
        gap: 12px;
    }

    .auth-card { width: 90%; padding: 32px 24px; }
}

@media (max-width: 480px) {
    .style-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .ratio-row { flex-wrap: wrap; }
    .theme-options { flex-direction: column; }
}

/* ========== 提示词输入增强 ========== */
.prompt-input-wrap {
    position: relative;
}

.prompt-input-wrap textarea {
    width: 100%;
    padding: 10px 14px;
    padding-bottom: 36px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: var(--bg);
    color: var(--text);
    transition: var(--transition);
    resize: vertical;
    min-height: 80px;
}

.prompt-input-wrap textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.btn-enhance {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border: 1px solid var(--primary);
    border-radius: 14px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-enhance:hover {
    background: var(--primary);
    color: white;
}

.btn-enhance:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========== 生成结果区域布局 ========== */
.gen-result-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 16px;
}

.gen-result-area .gen-result {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

/* ========== 历史记录面板 ========== */
.gen-history {
    display: flex;
    flex-direction: column;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-height: 260px;
    overflow: hidden;
}

.gen-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.gen-history-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0 4px;
    transition: var(--transition);
}

.gen-history-close:hover { color: var(--text); }

.gen-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

.history-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
}

.history-thumb:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

.history-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-thumb .history-time {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2px 4px;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 9px;
    text-align: center;
}

.history-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: var(--text-light);
    font-size: 13px;
}

/* ========== 视频历史列表样式 ========== */
.gen-history-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.history-video-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border);
}

.history-video-item:last-child { border-bottom: none; }

.history-video-item:hover {
    background: var(--bg-hover);
}

.history-video-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.history-video-info {
    flex: 1;
    min-width: 0;
}

.history-video-prompt {
    font-size: 12px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-video-time {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
}

/* ========== 生成计时器 ========== */
.gen-timer {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 8px;
}

/* ========== 风格网格4列 ========== */
@media (min-width: 769px) {
    .style-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========== 响应式补充 ========== */
@media (max-width: 768px) {
    .gen-result-area {
        min-height: auto;
    }
    .gen-history {
        max-height: 200px;
    }
    .gen-history-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
    .prompt-input-wrap textarea {
        min-height: 60px;
    }
}

/* ========== 角色选择器（文生图/视频） ========== */
.char-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.char-selector select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-white);
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.char-selector select:focus { border-color: var(--primary); }

.char-refresh-btn {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

/* ========== 人物建模页面 ========== */
.char-page {
    padding: 24px;
    max-width: 900px;
    margin: 0 auto;
}

.char-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.char-header h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}

.char-header-desc {
    font-size: 13px;
    color: var(--text-light);
    margin: 4px 0 0 0;
}

.char-add-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    padding: 8px 16px;
}

/* 角色列表 */
.char-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.char-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.char-empty svg { opacity: 0.3; margin-bottom: 16px; }

.char-empty p {
    margin: 4px 0;
    font-size: 15px;
}

.char-empty-hint {
    font-size: 13px;
    opacity: 0.7;
}

/* 角色卡片 */
.char-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.char-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.char-card-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.char-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.char-card-avatar-text {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

.char-card-info {
    flex: 1;
    min-width: 0;
}

.char-card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.char-card-gender {
    font-size: 13px;
    color: var(--primary);
}

.char-card-age {
    font-size: 11px;
    color: var(--text-light);
    background: var(--bg-gray);
    padding: 1px 6px;
    border-radius: 4px;
}

.char-card-desc {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
    line-height: 1.4;
}

.char-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.char-card-tag {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary);
}

.char-card-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.char-card-actions .btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: var(--text-light);
}

.char-card-actions .btn-icon:hover { color: var(--primary); background: var(--primary-light); }

/* 角色模态框 */
.char-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.char-modal {
    background: var(--bg-white);
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.char-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.char-modal-header h3 {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}

.char-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.char-modal-close:hover { color: var(--text); }

.char-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.char-form-group {
    margin-bottom: 16px;
}

.char-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.char-form-group input[type="text"],
.char-form-group textarea,
.char-form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
    resize: vertical;
    box-sizing: border-box;
}

.char-form-group input:focus,
.char-form-group textarea:focus,
.char-form-group select:focus {
    border-color: var(--primary);
}

.char-form-group textarea[readonly] {
    background: var(--bg-gray);
    opacity: 0.8;
}

/* 性别按钮行 */
.char-gender-row {
    display: flex;
    gap: 8px;
}

.char-gender-btn {
    flex: 1;
    padding: 8px 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.char-gender-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* 风格标签 */
.char-tags-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.char-tag-btn {
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg);
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.char-tag-btn.active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.char-tag-btn:hover { border-color: var(--primary); }

/* AI增强描述按钮 */
.char-enhance-btn {
    margin-bottom: 8px;
}

/* 上传区域 */
.char-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    min-height: 100px;
}

.char-upload-area:hover,
.char-upload-area.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
}

.char-upload-placeholder {
    color: var(--text-light);
}

.char-upload-placeholder p {
    margin: 8px 0 4px;
    font-size: 13px;
}

.char-upload-placeholder span {
    font-size: 11px;
    opacity: 0.7;
}

.char-upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.char-preview-img {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
}

.char-preview-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.char-remove-img {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.char-preview-add {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    border: 2px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--text-light);
    cursor: pointer;
}

.char-preview-add:hover { border-color: var(--primary); color: var(--primary); }

/* 模态框底部 */
.char-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.btn-secondary {
    padding: 8px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover { background: var(--bg-gray); }

/* ========== 人物建模响应式 ========== */
@media (max-width: 768px) {
    .char-page { padding: 16px; }
    .char-header h2 { font-size: 17px; }
    .char-card { padding: 12px; gap: 10px; }
    .char-card-avatar { width: 44px; height: 44px; }
    .char-modal { max-width: 100%; border-radius: 12px; }
    .char-modal-body { padding: 16px; }
}

/* ========== 统一创作工作区（AI助手风格） ========== */
.ws {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg);
    position: relative;
}

/* 顶部筛选栏 */
.ws-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 12px;
}

.ws-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ws-topbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ws-project-dropdown {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.ws-project-dropdown:hover {
    background: var(--bg-hover);
}

.ws-filter-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.ws-filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.ws-filter-btn.ws-filter-active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* 下拉菜单 */
.ws-dropdown-wrap {
    position: relative;
}

.ws-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 160px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    padding: 6px 0;
    animation: wsDropdownIn 0.15s ease;
}

.ws-dropdown.ws-dropdown-up {
    top: auto;
    bottom: calc(100% + 6px);
}

.ws-dropdown.open {
    display: block;
}

@keyframes wsDropdownIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.ws-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 16px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
    gap: 12px;
}

.ws-dropdown-item:hover {
    background: var(--bg-hover);
}

.ws-dropdown-item.active {
    color: var(--primary);
    font-weight: 500;
}

.ws-dropdown-item .ws-check-icon {
    flex-shrink: 0;
    color: var(--primary);
}

/* 主内容区 */
.ws-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

/* 空状态 */
.ws-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 20px;
}

.ws-empty-illustration {
    opacity: 0.7;
}

.ws-empty-text {
    font-size: 16px;
    color: var(--text-light);
    margin: 0;
}

/* 作品网格 */
.ws-works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    width: 100%;
    align-content: start;
    align-self: start;
}

.ws-work-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
}

.ws-work-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.ws-work-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg);
    overflow: hidden;
}

.ws-work-thumb img,
.ws-work-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ws-work-video {
    position: relative;
}

.ws-work-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.25);
    opacity: 0;
    transition: var(--transition);
}

.ws-work-card:hover .ws-work-play {
    opacity: 1;
}

.ws-work-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
}

.ws-work-type {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.ws-work-prompt {
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

/* 底部输入栏 */
.ws-input-bar {
    flex-shrink: 0;
    padding: 12px 20px 16px;
    background: var(--bg-white);
    border-top: 1px solid var(--border);
}

.ws-input-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 6px 8px 6px 6px;
    transition: var(--transition);
    max-width: 800px;
    margin: 0 auto;
}

.ws-input-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

.ws-upload-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
}

.ws-upload-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.ws-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    color: var(--text);
    outline: none;
    font-family: inherit;
    min-width: 0;
    padding: 8px 4px;
}

.ws-input::placeholder {
    color: var(--text-light);
}

.ws-input-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.ws-voice-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
}

.ws-voice-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.ws-send-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 10px;
    background: var(--primary-gradient);
    color: white;
    cursor: pointer;
    transition: var(--transition);
}

.ws-send-btn:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

/* 底部工具栏 */
.ws-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 800px;
    margin: 10px auto 0;
    gap: 12px;
}

.ws-mode-selector {
    display: flex;
    align-items: center;
}

.ws-mode-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.ws-mode-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.ws-mode-btn.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.ws-quick-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ws-quick-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.ws-quick-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* ========== 工作区响应式 ========== */
@media (max-width: 768px) {
    .ws-topbar {
        padding: 10px 12px;
        flex-wrap: wrap;
    }
    .ws-topbar-right {
        flex-wrap: wrap;
    }
    .ws-works-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    .ws-input-bar {
        padding: 10px 12px 14px;
    }
    .ws-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .ws-quick-actions {
        flex-wrap: wrap;
    }
    .ws-body {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .ws-works-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .ws-quick-btn {
        padding: 5px 10px;
        font-size: 11px;
    }
}
