:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a24;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #2a2a3a;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --shadow: rgba(0, 0, 0, 0.5);
    --sidebar-width: 280px;
}

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

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden; /* 防止侧边栏滑出时出现横向滚动条 */
}

/* 遮罩层 (手机端侧边栏打开时显示) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 900;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100vh;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.new-chat-btn {
    width: 100%;
    padding: 14px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.new-chat-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.sessions-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.session-item {
    padding: 14px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.session-item:hover {
    background: var(--bg-tertiary);
}

.session-item.active {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent);
}

.session-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* 主区域 */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    position: relative;
}

/* 头部 */
.header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
    height: 64px;
    flex-shrink: 0;
}

/* 菜单按钮 (默认隐藏，手机端显示) */
.menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    margin-right: 12px;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-title {
    font-weight: 500;
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
}

/* 聊天区域 */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    scroll-behavior: smooth;
}

.message {
    max-width: 85%;
    animation: fadeIn 0.3s ease;
    /* margin-bottom 移除，由 wrapper 控制 */
}

.message-wrapper {
    display: flex;
    flex-direction: column;
    margin-bottom: 24px;
    width: 100%;
    animation: fadeIn 0.3s ease;
}

.message-wrapper.user {
    align-items: flex-end;
}

.message-wrapper.assistant {
    align-items: flex-start;
}

/* 附件样式 */
.message-attachment {
    margin-top: 16px;
    margin-bottom: 16px;
    width: 100%;
    max-width: 800px;
}

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

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

.message-content {
    padding: 16px 20px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.6;
    word-break: break-word;
}

.message.user .message-content {
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: right;
}

.message.assistant .message-time {
    text-align: left;
}

/* 预览区域 */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.preview-item {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.preview-item img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}

.preview-item-info {
    padding: 12px;
}

.preview-item-title {
    font-size: 13px;
    font-weight: 500;
}

.preview-item-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* 剧本预览 */
.script-preview {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 800px;
}

.script-scene-card {
    background: var(--bg-tertiary);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.script-scene-header {
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.script-scene-number {
    font-weight: 600;
    color: var(--accent);
    font-size: 16px;
}

.script-scene-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.script-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.script-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
}

.script-value {
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* 场景预览（首尾帧） */
.scenes-preview {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 700px;
    /* margin: 16px 0; 移除，由 message-attachment 控制 */
}

.scene-card {
    background: var(--bg-tertiary);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.scene-header {
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.scene-number {
    font-weight: 600;
    color: var(--accent);
    font-size: 14px;
    flex-shrink: 0;
}

.scene-desc {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scene-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px;
}

.scene-image-wrapper {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.scene-image-wrapper:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.scene-image-wrapper img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
}

.image-label {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.image-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 13px;
}

/* 图片放大模态框 */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000; /* 必须比侧边栏高 */
    display: none;
}

.image-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
}

.image-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.image-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.image-modal-title {
    font-weight: 500;
    color: var(--text-primary);
}

.image-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.image-modal-close:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.image-modal-img {
    max-width: 100%;
    max-height: calc(90vh - 50px);
    display: block;
    object-fit: contain;
}

/* 视频播放器 */
.video-player-container {
    max-width: 640px;
    margin: 16px 0;
    background: var(--bg-tertiary);
    border-radius: 16px;
    box-shadow: 0 4px 24px var(--shadow);
    width: 100%;
    display: block !important;
    min-height: 400px !important;
    position: relative;
    z-index: 10;
    clear: both;
}

.video-player {
    width: 100%;
    aspect-ratio: 9/16; /* 竖屏视频 */
    max-height: 640px;
    min-height: 400px;
    display: block;
    background: black;
    object-fit: contain;
}

.video-actions {
    padding: 16px;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.video-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--accent);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.video-download-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

/* 视频播放模态框 */
.modal-video-player {
    width: 100%;
    max-height: 80vh;
    background: black;
}

/* 播放按钮遮罩 */
.scene-image-wrapper {
    position: relative; /* 确保遮罩层定位正确 */
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.scene-image-wrapper:hover .play-overlay {
    opacity: 1;
}

/* 移动端默认显示播放按钮 */
@media (hover: none) {
    .play-overlay {
        opacity: 1;
        background: rgba(0, 0, 0, 0.1);
    }
}

.play-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 24px;
    padding-left: 4px; /* 视觉修正 */
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: transform 0.2s;
}

.play-overlay:hover .play-icon {
    transform: scale(1.1);
    background: white;
}

/* 预览视频播放器 */
.preview-player-container {
    max-width: 360px;
    margin: 16px 0;
    background: var(--bg-tertiary);
    border-radius: 16px;
    /* 移除 overflow: hidden 以防止播放控件被裁剪 */
    /* overflow: hidden; */
    box-shadow: 0 4px 24px var(--shadow);
    border: 1px solid var(--border);
    width: 100%;
    /* 强制布局，移除 min-height 限制，改为 height: auto */
    display: block !important;
    height: auto !important; 
    position: relative;
    z-index: 1;
}

/* ... existing styles ... */

.preview-player-container .video-player {
    width: 100%;
    /* 改为自适应高度，但保持宽高比 */
    aspect-ratio: 9/16;
    height: auto !important;
    min-height: 400px !important;
    display: block !important;
    background: #000;
    object-fit: contain;
}

.preview-hint {
    padding: 12px 16px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-secondary);
    font-size: 13px;
    text-align: center;
    border-top: 1px solid var(--border);
}

/* 输入区域 */
.input-container {
    padding: 20px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    gap: 12px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.input-field {
    flex: 1;
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    resize: none;
    min-height: 56px;
    max-height: 200px;
    transition: border-color 0.2s;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent);
}

.input-field::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 56px;
    height: 56px;
    background: var(--accent);
    border: none;
    border-radius: 14px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

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

.send-btn:disabled {
    background: var(--bg-tertiary);
    cursor: not-allowed;
    transform: none;
}

.send-btn svg {
    width: 24px;
    height: 24px;
}

/* 欢迎界面 */
.welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.welcome-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-desc {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 500px;
    line-height: 1.6;
}

.example-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
    justify-content: center;
}

.example-prompt {
    padding: 12px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 24px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.example-prompt:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

/* 加载动画 */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

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

/* 滚动条 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* 用户区域 */
.user-section {
    padding: 16px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.login-prompt {
    text-align: center;
}

.login-btn {
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.login-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--accent);
}

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

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.user-details {
    flex: 1;
}

.user-phone {
    font-size: 14px;
    color: var(--text-primary);
}

.user-balance {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    flex-wrap: wrap;
}

.balance-amount {
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
    white-space: nowrap;
}

.balance-amount:hover {
    background: var(--bg-tertiary);
    color: var(--accent);
}

/* 流水弹窗 - 居中模态框 */
.balance-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000; /* 提高层级 */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.balance-modal.active {
    opacity: 1;
    visibility: visible;
}

.balance-modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    max-height: 80vh;
    transform: translateY(20px);
    transition: transform 0.3s;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.balance-modal.active .balance-modal-content {
    transform: translateY(0);
}

.balance-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.balance-modal-title {
    font-size: 18px;
    font-weight: 600;
}

.balance-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
}

.balance-modal-close:hover {
    color: var(--text-primary);
}

.balance-summary {
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    text-align: center;
    flex-shrink: 0;
}

.balance-summary-label {
    font-size: 14px;
    color: rgba(255,255,255,0.8);
    margin-bottom: 8px;
}

.balance-summary-value {
    font-size: 36px;
    font-weight: 700;
    color: white;
}

.balance-records-list {
    overflow-y: auto;
    flex: 1;
    min-height: 200px;
}

.balance-record {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.balance-record:hover {
    background: var(--bg-tertiary);
}

.balance-record:last-child {
    border-bottom: none;
}

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

.record-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.record-icon.income {
    background: rgba(34, 197, 94, 0.15);
}

.record-icon.expense {
    background: rgba(239, 68, 68, 0.15);
}

.record-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.record-type {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.record-time {
    font-size: 12px;
    color: var(--text-muted);
}

.record-amount {
    font-weight: 600;
    font-size: 16px;
}

.record-amount.positive {
    color: var(--success);
}

.record-amount.negative {
    color: var(--error);
}

.balance-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
}

.balance-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.recharge-btn {
    padding: 2px 8px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
}

.recharge-btn:hover {
    background: var(--accent-hover);
}

.logout-btn {
    padding: 6px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.logout-btn:hover {
    color: var(--error);
    border-color: var(--error);
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 32px;
    width: 100%;
    max-width: 400px;
    transform: translateY(20px);
    transition: transform 0.3s;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    text-align: center;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

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

.form-label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 15px;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-submit {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 8px;
}

.form-submit:hover {
    background: var(--accent-hover);
}

/* 登录方式切换 */
.login-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: rgba(0,0,0,0.2);
    padding: 4px;
    border-radius: 8px;
}

.login-tab {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.login-tab.active {
    background: var(--accent);
    color: white;
}

.login-tab:hover:not(.active) {
    background: rgba(255,255,255,0.1);
}

/* 验证码输入组 */
.code-input-group {
    display: flex;
    gap: 10px;
}

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

.send-code-btn {
    padding: 0 16px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    transition: all 0.2s;
}

.send-code-btn:hover:not(:disabled) {
    background: var(--accent-hover);
}

.send-code-btn:disabled {
    background: #444;
    color: #888;
    cursor: not-allowed;
}

.form-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.form-switch a {
    color: var(--accent);
    cursor: pointer;
}

.form-error {
    color: var(--error);
    font-size: 13px;
    margin-top: 8px;
}

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

.package-item {
    padding: 16px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.package-item:hover {
    border-color: var(--accent);
}

.package-item.selected {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

.package-amount {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.package-bonus {
    font-size: 12px;
    color: var(--success);
    margin-top: 4px;
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        /* 移动端侧边栏样式：抽屉式 */
        display: flex;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        box-shadow: 2px 0 8px rgba(0,0,0,0.5);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .menu-btn {
        display: block;
    }
    
    .header {
        padding: 12px 16px;
    }
    
    .chat-container {
        padding: 16px;
    }
    
    .input-container {
        padding: 12px 16px;
    }
    
    .message {
        max-width: 95%;
    }

    /* 移动端隐藏侧边栏底部的用户区域 */
    .sidebar .user-section {
        display: none;
    }
}

/* Header 右侧用户按钮 */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-user-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    transition: all 0.2s;
}

.header-user-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.header-user-btn.logged-in {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* 用户菜单模态框 */
.user-menu-modal {
    text-align: center;
}

.user-menu-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

.user-avatar-large {
    width: 64px;
    height: 64px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 12px;
}

.user-menu-phone {
    font-size: 18px;
    font-weight: 500;
}

.user-menu-balance {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.balance-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.balance-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
}

.user-menu-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.menu-action-btn {
    width: 100%;
    padding: 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 15px;
    cursor: pointer;
}

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

.menu-action-btn.danger {
    color: var(--error);
    border-color: var(--error);
    background: transparent;
}
