:root {
    --primary: #FF6B35;
    --primary-dark: #E85A2A;
    --secondary: #004E89;
    --accent: #F77F00;
    --bg-main: #0A0E27;
    --bg-card: #1A1F3A;
    --bg-hover: #252B4A;
    --text-primary: #FFFFFF;
    --text-secondary: #B8C5D6;
    --border: #2A3150;
    --success: #06D6A0;
    --error: #EF476F;
}

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

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg-main) 0%, #0F1535 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-y: auto;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 导航栏 */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 60px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}
@media (min-width: 769px) {
    .sidebar-toggle {
        display: none !important;
    }

    .chat-history-btn {
        display: none !important;
    }
}

.top-bell-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.top-bell-btn:hover {
    color: #fff;
    border-color: rgba(255, 107, 53, 0.35);
    background: rgba(255, 107, 53, 0.12);
}

.top-bell-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff9f43 100%);
    box-shadow: 0 0 0 2px rgba(26, 31, 58, 0.95);
}

.nav-brand h1 {
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-toggle {
    width: 40px;
    height: 40px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.nav-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-left: 1rem;
    border-left: 1px solid var(--border);
}

.user-credits {
    font-weight: 600;
    color: var(--accent);
}

.user-name {
    color: var(--text-primary);
}

.btn-recharge {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-recharge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

.btn-logout {
    padding: 0.5rem 1rem;
    background: var(--bg-hover);
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-login, .btn-register {
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-username-toggle {
    padding: 0.45rem 0.85rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-username-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--primary);
}

.btn-login {
    color: var(--text-secondary);
    background: var(--bg-hover);
}

.btn-login:hover {
    color: var(--text-primary);
}

.btn-register {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
}

.btn-register:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

.vip-expire-inline {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.65rem;
    border-radius: 999px;
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.2);
    color: #FFD166;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.normal-user-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.65rem;
    border-radius: 999px;
    background: rgba(184, 197, 214, 0.12);
    border: 1px solid rgba(184, 197, 214, 0.2);
    color: #B8C5D6;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.vip-expire-inline-expiring {
    background: rgba(247, 127, 0, 0.16);
    border-color: rgba(247, 127, 0, 0.34);
    color: #FFB347;
}

.vip-expire-inline-expired {
    background: rgba(239, 71, 111, 0.16);
    border-color: rgba(239, 71, 111, 0.34);
    color: #FF8FAB;
}

.nav-link {
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
}

/* 主内容 */
.main-content {
    flex: 1;
    display: flex;
    overflow: visible;
    margin-top: 60px;
    min-height: calc(100vh - 60px);
}

/* 侧边栏 */
.sidebar {
    width: 320px;
    min-width: 320px;
    max-width: 320px;
    background: var(--bg-card);
    border-right: 1px solid rgba(42, 49, 80, 0.5);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    padding: 1rem;
    flex-shrink: 0;
    position: fixed;
    left: 0;
    top: 60px;
    bottom: 0;
    z-index: 100;
    transform: translateX(0);
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(-320px);
}

.sidebar-header {
    margin-bottom: 0.75rem;
}

.sidebar-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.model-list {
    flex: 1;
    overflow-y: auto;
}

/* 自定义滚动条 - 模型列表 */
.model-list::-webkit-scrollbar {
    width: 6px;
}

.stateless-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0.2rem 0 0.75rem;
    padding: 0.6rem 0.8rem;
    border: 1px solid rgba(247, 127, 0, 0.28);
    border-radius: 10px;
    background: rgba(247, 127, 0, 0.08);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
}

.stateless-toggle input {
    accent-color: var(--accent);
    cursor: pointer;
}

.stateless-toggle:hover {
    border-color: rgba(247, 127, 0, 0.45);
    background: rgba(247, 127, 0, 0.12);
    color: var(--text-primary);
}

.model-list::-webkit-scrollbar-track {
    background: transparent;
}

.model-list::-webkit-scrollbar-thumb {
    background: rgba(184, 197, 214, 0.3);
    border-radius: 3px;
}

.model-list::-webkit-scrollbar-thumb:hover {
    background: rgba(184, 197, 214, 0.5);
}

.model-group {
    margin-bottom: 1rem;
}

.model-group-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #00D9FF;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    padding: 0 0.5rem;
}

.model-item {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--bg-main);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.model-item:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}

.model-item.active {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.1) 0%, rgba(247, 127, 0, 0.1) 100%);
}

.model-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.model-credits {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
}

.model-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.model-price {
    display: none;
}

/* 对话容器 */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    min-width: 0;
    overflow: hidden;
    margin-left: 320px;
    margin-right: 300px;
    transition: margin 0.3s ease;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem 0;
    flex-shrink: 0;
}

.chat-header-utilities {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-right: auto;
}

.chat-header-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 40px;
    padding: 0 0.95rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(37, 43, 74, 0.88);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.chat-header-btn:hover {
    color: white;
    border-color: var(--primary);
    background: rgba(255, 107, 53, 0.14);
    transform: translateY(-1px);
}

/* 当侧边栏折叠时 */
.sidebar.collapsed ~ .chat-container {
    margin-left: 0;
}

/* 当历史面板隐藏时 */
.history-panel.hidden ~ .main-content .chat-container {
    margin-right: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 2rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* 自定义滚动条 - 对话消息 */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(184, 197, 214, 0.3);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(184, 197, 214, 0.5);
}

.welcome-message {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.welcome-message svg {
    color: var(--accent);
    margin-bottom: 1rem;
}

.welcome-message h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* 消息气泡 */
.message {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    animation: slideIn 0.3s ease;
    position: relative;
}

.message-wrapper {
    display: flex;
    gap: 1rem;
}

.message.user .message-wrapper {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
}

.message.assistant .message-avatar {
    background: var(--secondary);
}

.message-content {
    width: 80%;
    padding: 1rem 1.5rem;
    border-radius: 16px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}

/* 移除链接的深蓝色样式 */
.message-content a {
    color: inherit;
    text-decoration: none;
}

.message-content a:hover {
    text-decoration: underline;
}

.message.user .message-content {
    background: #1C2333;
    color: #E6EDF3;
    border: 1px solid #30363D;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: #C9D1D9;
    border-bottom-left-radius: 4px;
}

/* 消息中的文件 */
.message-files {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.chat-input.input-restore-highlight {
    border-color: rgba(255, 107, 53, 0.95) !important;
    box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.12), 0 0 22px rgba(255, 107, 53, 0.18);
    animation: restoredInputPulse 1.2s ease;
}

.file-preview-container.file-restore-highlight {
    animation: restoredFilesPulse 1.2s ease;
    box-shadow: 0 0 0 3px rgba(247, 127, 0, 0.12), inset 0 0 0 1px rgba(255, 107, 53, 0.22);
    border-radius: 14px;
}

@keyframes restoredInputPulse {
    0% {
        transform: translateY(0);
        box-shadow: 0 0 0 0 rgba(255, 107, 53, 0);
    }
    35% {
        transform: translateY(-1px);
        box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.16), 0 0 24px rgba(255, 107, 53, 0.24);
    }
    100% {
        transform: translateY(0);
        box-shadow: 0 0 0 0 rgba(255, 107, 53, 0);
    }
}

@keyframes restoredFilesPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(247, 127, 0, 0);
    }
    40% {
        box-shadow: 0 0 0 4px rgba(247, 127, 0, 0.12), inset 0 0 0 1px rgba(255, 107, 53, 0.22);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(247, 127, 0, 0);
    }
}

.message-file-item {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    gap: 0.25rem;
}

.message-file-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.message-file-item svg {
    flex-shrink: 0;
}

.message-file-item span {
    font-size: 0.7rem;
    text-align: center;
    word-break: break-all;
}

/* 消息内容中的图片（AI生成的图片） */
.message-content img {
    width: 100%;
    max-height: 600px;
    border-radius: 8px;
    margin: 0.5rem 0;
    display: block;
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.message-content img:hover {
    transform: scale(1.02);
}

/* 图片放大查看弹窗 */
.image-viewer-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: fadeIn 0.2s ease;
}

.image-viewer-content {
    max-width: 95vw;
    max-height: 95vh;
    position: relative;
}

.image-viewer-content img {
    max-width: 100%;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.image-viewer-close {
    position: absolute;
    top: -3rem;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    padding: 0.75rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-viewer-close:hover {
    background: var(--error);
    border-color: var(--error);
}

.image-viewer-download {
    position: absolute;
    top: -3rem;
    right: 4rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    padding: 0.75rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-viewer-download:hover {
    background: var(--primary);
    border-color: var(--primary);
}

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

/* 消息操作按钮 */
.message-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    padding-left: 56px;
}

.message.user .message-actions {
    padding-left: 0;
    padding-right: 56px;
    justify-content: flex-end;
}

.message:hover .message-actions {
    opacity: 1;
}

.message-action-btn {
    padding: 0.5rem;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.message-action-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.message-action-delete:hover {
    background: var(--error);
    border-color: var(--error);
}

.message-action-favorite.favorited {
    color: var(--accent);
}

.message-action-favorite.favorited:hover {
    background: var(--accent);
    color: white;
}

/* 历史记录删除按钮与删除动画 */
.history-item-delete {
    top: auto;
    right: auto;
    color: rgba(239, 71, 111, 0.88);
    border-color: rgba(239, 71, 111, 0.24);
    background: rgba(239, 71, 111, 0.1);
}

.history-item-delete:hover {
    background: var(--error);
    border-color: var(--error);
    color: #fff;
    box-shadow: 0 10px 24px rgba(239, 71, 111, 0.22);
    transform: translateY(-1px);
}

.history-item-removing {
    pointer-events: none;
    animation: historyItemRemove 0.22s ease forwards;
}

@keyframes historyItemRemove {
    from {
        opacity: 1;
        transform: scale(1) translateX(0);
        max-height: 120px;
        margin-bottom: inherit;
    }
    to {
        opacity: 0;
        transform: scale(0.96) translateX(10px);
        max-height: 0;
        margin-bottom: 0;
    }
}

/* 确认弹窗 */
.confirm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 8, 20, 0.72);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.18s ease;
}

.confirm-modal-overlay.show {
    opacity: 1;
}

.confirm-modal {
    width: min(100%, 420px);
    background: linear-gradient(180deg, rgba(26, 31, 58, 0.98) 0%, rgba(17, 23, 46, 0.98) 100%);
    border: 1px solid rgba(239, 71, 111, 0.22);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
    padding: 1.25rem;
    transform: translateY(16px) scale(0.97);
    transition: transform 0.18s ease;
}

.confirm-modal-overlay.show .confirm-modal {
    transform: translateY(0) scale(1);
}

.confirm-modal-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFD6DE;
    background: linear-gradient(135deg, rgba(239, 71, 111, 0.22) 0%, rgba(255, 107, 53, 0.18) 100%);
    border: 1px solid rgba(239, 71, 111, 0.28);
    margin-bottom: 1rem;
}

.confirm-modal-content h3 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.confirm-modal-content p {
    margin: 0.65rem 0 0;
    color: var(--text-secondary);
    line-height: 1.7;
}

.confirm-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.4rem;
}

.confirm-modal-btn {
    min-width: 92px;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-hover);
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.confirm-modal-btn:hover {
    transform: translateY(-1px);
}

.confirm-modal-btn.secondary {
    color: var(--text-secondary);
}

.confirm-modal-btn.secondary:hover {
    border-color: rgba(184, 197, 214, 0.35);
    color: var(--text-primary);
}

.confirm-modal-btn.primary {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.95) 0%, rgba(247, 127, 0, 0.92) 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 12px 28px rgba(255, 107, 53, 0.22);
}

.confirm-modal-btn.primary:hover {
    box-shadow: 0 16px 32px rgba(255, 107, 53, 0.3);
}

.confirm-modal-btn.danger {
    background: linear-gradient(135deg, rgba(239, 71, 111, 0.95) 0%, rgba(255, 107, 53, 0.92) 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 12px 28px rgba(239, 71, 111, 0.24);
}

.confirm-modal-btn.danger:hover {
    box-shadow: 0 16px 32px rgba(239, 71, 111, 0.32);
}

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 代码块样式 */
.message-content pre {
    margin: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
}

.message-content code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

.message-content p code {
    background: rgba(255, 107, 53, 0.15);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    color: var(--accent);
    font-size: 0.9em;
}

.code-block-wrapper {
    margin: 1rem 0;
    border-radius: 8px;
    overflow: hidden;
    background: #282c34;
    border: 1px solid var(--border);
    max-height: 600px;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #21252b;
    border-bottom: 1px solid #181a1f;
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
    min-width: 0;
}

.code-language {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.code-copy-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid rgba(255, 107, 53, 0.3);
    border-radius: 6px;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.code-copy-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.code-block-wrapper pre {
    margin: 0;
    padding: 1rem;
    background: #282c34;
    overflow: auto;
    flex: 1;
    max-height: 550px;
    max-width: 100%;
}

.code-block-wrapper pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    color: #abb2bf;
    display: block;
    line-height: 1.5;
    word-break: break-all;
    white-space: pre-wrap;
}

.mobile-upload-toggle {
    display: none;
}

.mobile-upload-actions {
    display: none;
}

.mobile-camera-btn {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-radius: 12px;
}

.image-crop-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(4, 8, 20, 0.82);
    backdrop-filter: blur(10px);
    z-index: 10020;
}

.image-crop-modal.is-open {
    display: flex;
}

.image-crop-dialog {
    width: min(100%, 760px);
    max-height: 92vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(26, 31, 58, 0.98) 0%, rgba(17, 23, 46, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

.image-crop-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem 0.75rem;
}

.image-crop-header h3 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.image-crop-header p {
    margin: 0.35rem 0 0;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.image-crop-close {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 1.35rem;
    cursor: pointer;
}

.image-crop-body {
    padding: 0 1.1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.image-crop-ratios {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.image-crop-ratio-btn {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 0.55rem 0.9rem;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
}

.image-crop-ratio-btn.active {
    color: #fff;
    border-color: rgba(255, 107, 53, 0.55);
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.9) 0%, rgba(247, 127, 0, 0.86) 100%);
}

.image-crop-stage {
    min-height: 360px;
    background: rgba(10, 14, 39, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    overflow: hidden;
}

.image-crop-stage img {
    display: block;
    max-width: 100%;
}

.image-crop-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 0 1.1rem 1.1rem;
}

.image-crop-btn {
    min-width: 120px;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
}

.image-crop-btn.secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.image-crop-btn.primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-color: transparent;
    color: #fff;
}

/* 自定义滚动条 */
.code-block-wrapper pre::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.code-block-wrapper pre::-webkit-scrollbar-track {
    background: #21252b;
}

.code-block-wrapper pre::-webkit-scrollbar-thumb {
    background: #4b5263;
    border-radius: 4px;
}

.code-block-wrapper pre::-webkit-scrollbar-thumb:hover {
    background: #5c6370;
}

/* 进度条样式 */
.progress-container {
    padding: 1rem;
    background: rgba(247, 127, 0, 0.1);
    border: 1px solid rgba(247, 127, 0, 0.3);
    border-radius: 8px;
    margin: 0.5rem 0;
}

.progress-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.progress-bar-wrapper {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 1.5s infinite;
}

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

/* 积分信息 */
.credit-info {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(247, 127, 0, 0.1);
    border: 1px solid rgba(247, 127, 0, 0.3);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0.5rem 0;
    animation: slideIn 0.3s ease;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.credit-info svg {
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 0.2rem;
}

.credit-info strong {
    color: var(--accent);
    font-weight: 700;
}

.credit-info span {
    flex: 1;
}

.message-loading {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
}

.message-loading span {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

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

/* 输入区域 */
.chat-input-container {
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
}

.current-model-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(247, 127, 0, 0.1);
    border: 1px solid rgba(247, 127, 0, 0.3);
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.current-model-indicator svg {
    color: var(--accent);
    flex-shrink: 0;
}

.current-model-indicator strong {
    color: var(--accent);
    font-weight: 600;
}

.chat-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: min(100%, 1120px);
    margin: 0 auto;
}

.file-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.file-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
}

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

.file-preview-item .file-icon {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 0.5rem;
    text-align: center;
    word-break: break-all;
}

.file-preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: var(--error);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
}

.file-preview-remove:hover {
    background: #d32f2f;
}

.input-actions {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    justify-content: space-between;
}

.input-actions-left {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    width: 100%;
    min-height: 48px;
    padding: 1rem;
    background: var(--bg-main);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.5;
    resize: none;
    overflow-y: hidden;
    max-height: 200px;
    transition: all 0.2s ease;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-upload {
    width: 48px;
    height: 48px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

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

.btn-send {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-send.is-processing {
    background: linear-gradient(135deg, #ef476f 0%, #ff6b6b 100%);
    box-shadow: 0 8px 24px rgba(239, 71, 111, 0.28);
}

.btn-send.is-processing:hover {
    box-shadow: 0 10px 28px rgba(239, 71, 111, 0.38);
}

.btn-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 107, 53, 0.4);
}

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

.btn-new-chat {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1rem;
    height: 42px;
    background: rgba(37, 43, 74, 0.9);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    white-space: nowrap;
}

.btn-new-chat:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 107, 53, 0.2);
}

.btn-new-chat svg {
    flex-shrink: 0;
}

/* 动画 */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

.cursor-blink {
    animation: blink 1s infinite;
    color: var(--accent);
    font-weight: bold;
}

.message-thinking {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 28px;
    padding: 2px 0;
}

.message-thinking-inline {
    min-height: 52px;
}

.message-thinking-dots {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.14), rgba(247, 127, 0, 0.08));
    border: 1px solid rgba(255, 107, 53, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.message-thinking-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    animation: messageThinkingBounce 1.1s infinite ease-in-out;
}

.message-thinking-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.message-thinking-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

.message-thinking-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.message-thinking-text strong {
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 700;
}

.message-thinking-text span {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.chat-error-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 0;
}

.chat-error-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.chat-error-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(239, 71, 111, 0.12);
    color: #ff8fab;
    border: 1px solid rgba(239, 71, 111, 0.22);
}

.chat-error-card.credits .chat-error-icon {
    background: rgba(247, 127, 0, 0.12);
    color: #ffd166;
    border-color: rgba(247, 127, 0, 0.24);
}

.chat-error-card.auth .chat-error-icon {
    background: rgba(0, 78, 137, 0.16);
    color: #8ecae6;
    border-color: rgba(0, 78, 137, 0.24);
}

.chat-error-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-error-text strong {
    color: var(--text-primary);
    font-size: 0.96rem;
}

.chat-error-text span {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.6;
}

.chat-error-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chat-error-action-btn {
    border: 1px solid var(--border);
    background: var(--bg-hover);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 0.6rem 0.95rem;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.chat-error-action-btn:hover {
    transform: translateY(-1px);
}

.chat-error-action-btn.primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-color: transparent;
    color: white;
}

.chat-error-action-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.08);
}

.chat-error-action-btn svg {
    flex-shrink: 0;
}

.chat-stop-notice {
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: rgba(239, 71, 111, 0.12);
    border: 1px solid rgba(239, 71, 111, 0.24);
    color: #ff9ab1;
    font-size: 0.82rem;
    line-height: 1;
}

.chat-stop-notice svg {
    flex-shrink: 0;
}

.chat-error-detail-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-error-detail-toggle {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px dashed rgba(255, 255, 255, 0.14);
    color: var(--text-secondary);
    border-radius: 10px;
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-error-detail-toggle:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.04);
}

.chat-error-detail-toggle svg {
    transition: transform 0.2s ease;
}

.chat-error-detail-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.chat-error-detail {
    font-size: 0.8rem;
    line-height: 1.5;
    color: #ffb4c7;
    background: rgba(239, 71, 111, 0.08);
    border: 1px dashed rgba(239, 71, 111, 0.18);
    border-radius: 10px;
    padding: 10px 12px;
    word-break: break-word;
}

@keyframes messageThinkingBounce {
    0%, 80%, 100% {
        transform: translateY(0) scale(0.8);
        opacity: 0.45;
    }
    40% {
        transform: translateY(-3px) scale(1);
        opacity: 1;
    }
}

/* 响应式 */
@media (max-width: 768px) {
    .vip-expire-inline {
        display: inline-flex;
        align-items: center;
        padding: 0.18rem 0.55rem;
        border-radius: 999px;
        background: rgba(255, 215, 0, 0.12);
        border: 1px solid rgba(255, 215, 0, 0.22);
        color: #FFD166;
        font-size: 0.72rem;
        line-height: 1;
        white-space: nowrap;
    }

    .mobile-upload-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 48px;
        height: 48px;
        background: var(--bg-hover);
        border: 1px solid var(--border);
        border-radius: 12px;
        color: var(--text-secondary);
        cursor: pointer;
        flex-shrink: 0;
    }

    .mobile-upload-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.65rem;
        width: 100%;
    }

    .mobile-camera-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
        min-height: 44px;
        padding: 0.8rem 0.85rem;
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 14px;
        background: linear-gradient(135deg, rgba(255, 140, 66, 0.18) 0%, rgba(255, 107, 53, 0.1) 100%);
        color: #f8fafc;
        font-size: 0.88rem;
        font-weight: 700;
        cursor: pointer;
    }

    .mobile-camera-btn.secondary {
        background: rgba(255, 255, 255, 0.06);
    }

    .input-actions {
        flex-wrap: wrap;
        align-items: stretch;
        gap: 0.75rem;
    }

    .input-actions-left {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.75rem;
        align-items: stretch;
    }

    .input-actions-left .btn-upload {
        display: none;
    }

    .btn-send {
        margin-left: auto;
    }

    .image-crop-modal {
        padding: 0.7rem;
    }

    .image-crop-dialog {
        width: 100%;
        max-height: 94vh;
        border-radius: 20px;
    }

    .image-crop-body {
        padding: 0.85rem 0.85rem 0.7rem;
    }

    .image-crop-stage {
        min-height: 240px;
    }

    .image-crop-footer {
        flex-direction: column-reverse;
    }

    .image-crop-footer button {
        width: 100%;
    }

    .sidebar {
        width: 100%;
        max-width: 250px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .history-panel {
        width: 100%;
    }

    .history-item {
        gap: 0.75rem;
        padding: 0.9rem;
    }

    .history-item-side {
        width: 68px;
        min-width: 68px;
    }

    .history-item-actions {
        gap: 0.3rem;
    }

    .chat-header-actions {
        padding: 0.75rem 1rem 0;
    }

    .btn-new-chat {
        height: 40px;
        padding: 0 0.875rem;
        font-size: 0.85rem;
    }

    .chat-messages {
        padding: 0.75rem 1rem 1.25rem;
    }

    .chat-input-container {
        padding: 0.875rem 1rem;
    }
}

/* 历史对话面板 */
.history-panel {
    position: fixed;
    right: 0;
    top: 60px;
    bottom: 0;
    width: 300px;
    min-width: 300px;
    max-width: 300px;
    background: var(--bg-card);
    border-left: 1px solid rgba(42, 49, 80, 0.5);
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.2);
    z-index: 999;
    display: flex;
    flex-direction: column;
    transform: translateX(0);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.history-panel.hidden {
    transform: translateX(100%);
}

/* 当历史面板隐藏时，对话区域占满 */
.history-panel.hidden ~ .chat-container {
    margin-right: 0;
}

.history-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.history-panel-header h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
}

.history-panel-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-clear-history {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-clear-history:hover {
    background: var(--error);
    color: white;
}

.history-panel-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.history-panel-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* 历史标签切换 */
.history-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.history-tab {
    flex: 1;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

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

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.history-list.hidden {
    display: none;
}

/* 自定义滚动条 - 历史列表 */
.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: transparent;
}

.history-list::-webkit-scrollbar-thumb {
    background: rgba(184, 197, 214, 0.3);
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: rgba(184, 197, 214, 0.5);
}

.history-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 3rem 1rem;
    font-size: 0.95rem;
}

.history-item {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 0.9rem;
    background: linear-gradient(180deg, rgba(10, 14, 39, 0.96) 0%, rgba(16, 22, 48, 0.98) 100%);
    border: 1px solid rgba(42, 49, 80, 0.9);
    border-radius: 16px;
    padding: 0.95rem 1rem;
    margin-bottom: 0.9rem;
    cursor: pointer;
    transition: all 0.22s ease;
    animation: slideInRight 0.3s ease;
    position: relative;
    overflow: hidden;
}

.history-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.08), transparent 45%, rgba(0, 217, 255, 0.05));
    opacity: 0;
    transition: opacity 0.22s ease;
    pointer-events: none;
}

.history-item:hover {
    border-color: rgba(255, 107, 53, 0.42);
    transform: translateX(-4px) translateY(-1px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}

.history-item:hover::before {
    opacity: 1;
}

.history-item-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.55rem;
    position: relative;
    z-index: 1;
}

.history-item-header {
    display: block;
    min-width: 0;
    margin: 0;
}

.history-item-title {
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.history-item-side {
    width: 72px;
    min-width: 72px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem;
    position: relative;
    z-index: 1;
}

.history-item-time {
    font-size: 0.72rem;
    color: rgba(184, 197, 214, 0.78);
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.history-item-count {
    font-size: 0.79rem;
    color: var(--text-secondary);
}

.history-item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.history-item-footer.simple {
    justify-content: flex-start;
}

.history-item-expires {
    font-size: 0.72rem;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
    white-space: nowrap;
}

.history-item-expires.favorited {
    color: #FFD700;
    background: rgba(255, 215, 0, 0.12);
}

.history-item-expires.urgent {
    color: #ff4d4d;
    background: rgba(255, 77, 77, 0.12);
    font-weight: 600;
}

.history-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
}

.history-search svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.history-search input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    padding: 0;
}

.history-search input::placeholder {
    color: var(--text-secondary);
}

.history-tip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid var(--border);
    line-height: 1.4;
}

.history-item-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.history-item-favorite {
    position: static;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: rgba(184, 197, 214, 0.82);
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
    backdrop-filter: blur(6px);
}

.history-item-favorite:hover {
    color: var(--accent);
    border-color: rgba(247, 127, 0, 0.28);
    background: rgba(247, 127, 0, 0.12);
    transform: translateY(-1px);
}

.history-item-favorite.favorited {
    color: var(--accent);
    background: rgba(247, 127, 0, 0.14);
    border-color: rgba(247, 127, 0, 0.24);
}

/* 支付方式选择 */
.payment-methods {
    margin: 1.5rem 0;
}

.payment-methods h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.payment-method-list {
    display: flex;
    gap: 1rem;
}

.payment-method-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-main);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.payment-method-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.payment-method-btn.active {
    border-color: var(--primary);
    background: rgba(255, 107, 53, 0.1);
    color: var(--primary);
}

.payment-method-btn svg {
    width: 32px;
    height: 32px;
}

.payment-method-btn span {
    font-size: 0.85rem;
    font-weight: 500;
}

.recommend-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--success);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
}

.payment-tip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(247, 127, 0, 0.1);
    border: 1px solid rgba(247, 127, 0, 0.3);
    border-radius: 8px;
    color: var(--accent);
    font-size: 0.85rem;
    margin-top: 1rem;
}

.payment-tip svg {
    flex-shrink: 0;
}

/* 二维码容器 */
.qr-code-container {
    display: none;
    text-align: center;
    padding: 2rem 0;
}

.qr-code-header h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.qr-code-amount {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    margin: 0.5rem 0;
}

.qr-code-credits {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.qr-code-image {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem 0;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    display: inline-block;
}

.qr-code-image #qrcode {
    display: inline-block;
}

.qr-code-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 1.5rem 0;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.qr-code-actions {
    margin-top: 2rem;
}

.btn-cancel-payment {
    padding: 0.75rem 2rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

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

/* 支付成功 */
.payment-success {
    padding: 2rem;
    text-align: center;
}

.success-icon {
    margin-bottom: 1.5rem;
    animation: scaleIn 0.5s ease;
}

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

.payment-success h3 {
    font-size: 1.5rem;
    color: var(--success);
    margin-bottom: 1rem;
}

.payment-success p {
    color: var(--text-secondary);
}

/* 人工审核信息 */
.manual-recharge-info {
    display: none;
    padding: 1rem 0;
}

.manual-recharge-header {
    text-align: center;
    margin-bottom: 2rem;
}

.success-icon-small {
    margin-bottom: 1rem;
    animation: scaleIn 0.5s ease;
}

.manual-recharge-header h3 {
    font-size: 1.5rem;
    color: var(--success);
    margin-bottom: 0.5rem;
}

.manual-recharge-header .order-no {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.manual-recharge-header code {
    background: var(--bg-main);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    color: var(--accent);
    font-size: 0.95rem;
}

.manual-recharge-details {
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
}

.detail-row:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.detail-row .label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.detail-row .value {
    font-weight: 600;
    font-size: 1.1rem;
}

.detail-row .amount {
    color: var(--primary);
}

.detail-row .credits {
    color: var(--success);
}

.manual-recharge-steps {
    background: rgba(6, 214, 160, 0.05);
    border: 1px solid rgba(6, 214, 160, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.manual-recharge-steps h4 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.manual-recharge-steps ol {
    margin-left: 1.5rem;
    color: var(--text-secondary);
}

.manual-recharge-steps li {
    padding: 0.5rem 0;
    line-height: 1.6;
}

.manual-recharge-steps code {
    background: var(--bg-card);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    color: var(--accent);
    font-size: 0.9rem;
}

.manual-recharge-steps strong {
    color: var(--primary);
}

.manual-recharge-payment {
    margin-bottom: 1.5rem;
}

.manual-recharge-payment h4 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.payment-info {
    display: flex;
    gap: 1.5rem;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.payment-qr-placeholder {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 160px;
    height: 160px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed var(--border);
    border-radius: 12px;
}

.payment-qr-placeholder svg {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.payment-qr-placeholder p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    padding: 0 0.5rem;
}

.payment-instructions {
    flex: 1;
}

.payment-instructions p {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.payment-instructions ul {
    list-style: none;
    padding: 0;
}

.payment-instructions li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-secondary);
    line-height: 1.6;
}

.payment-instructions li:before {
    content: "•";
    position: absolute;
    left: 0.5rem;
    color: var(--primary);
    font-weight: bold;
}

.manual-recharge-actions {
    display: flex;
    gap: 1rem;
}

.btn-copy-order,
.btn-close-modal {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-copy-order {
    background: var(--primary);
    border: none;
    color: white;
}

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

.btn-close-modal {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-close-modal:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Toast 提示 */
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    transition: all 0.2s ease;
    z-index: 10;
}

.history-item-favorite:hover {
    color: var(--accent);
    transform: scale(1.2);
}

.history-item-favorite.favorited {
    color: var(--accent);
}

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

/* 充值弹窗 */
.recharge-modal {
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(8px);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.recharge-modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: scaleIn 0.3s ease;
}

.recharge-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
}

.recharge-modal-header h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.recharge-modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

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

.recharge-modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

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

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

.recharge-modal-body::-webkit-scrollbar-thumb {
    background: rgba(184, 197, 214, 0.3);
    border-radius: 3px;
}

.recharge-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(184, 197, 214, 0.5);
}

.recharge-info {
    background: var(--bg-main);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.recharge-info p {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.recharge-info strong {
    color: var(--accent);
}

.recharge-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.recharge-option {
    position: relative;
    padding: 1.5rem;
    background: var(--bg-main);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.recharge-option:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
}

.recharge-option.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.1) 0%, rgba(247, 127, 0, 0.1) 100%);
}

.recharge-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.recharge-credits {
    font-size: 1rem;
    color: var(--accent);
}

.recharge-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--accent);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.recharge-custom {
    margin-bottom: 1.5rem;
}

.recharge-custom label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.recharge-custom input {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
}

.recharge-custom input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-confirm-recharge {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-confirm-recharge:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 107, 53, 0.4);
}

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



/* 图片生成中动画 */
.image-generating {
    margin: 12px 0;
}

.image-generating-inner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.14), rgba(0, 78, 137, 0.12));
    border: 1px solid rgba(255, 107, 53, 0.28);
    border-radius: 16px;
    padding: 16px 18px;
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.image-generating-badge {
    grid-column: 1 / -1;
    display: inline-flex;
    align-items: center;
    justify-self: start;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 107, 53, 0.14);
    border: 1px solid rgba(255, 107, 53, 0.24);
    color: #ffd7c8;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.image-gen-spinner {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    padding: 12px 14px;
    border-radius: 999px;
    background: rgba(10, 14, 39, 0.32);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.image-gen-spinner div {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    animation: imageGenBounce 1.2s infinite ease-in-out;
}

.image-gen-spinner div:nth-child(1) { animation-delay: 0s; }
.image-gen-spinner div:nth-child(2) { animation-delay: 0.2s; }
.image-gen-spinner div:nth-child(3) { animation-delay: 0.4s; }
.image-gen-spinner div:nth-child(4) { animation-delay: 0.6s; }

.image-gen-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.image-gen-copy strong {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 700;
}

.image-gen-copy span {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.image-gen-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.image-gen-timer {
    min-width: 64px;
    text-align: center;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(10, 14, 39, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #ffd166;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    font-variant-numeric: tabular-nums;
}

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

.image-gen-text {
    font-size: 14px;
    color: var(--primary);
    font-weight: 500;
    letter-spacing: 0.3px;
    animation: imageGenPulse 2s infinite;
}

@media (max-width: 768px) {
    .image-generating-inner {
        grid-template-columns: 1fr;
        justify-items: start;
    }

    .image-gen-meta {
        justify-content: flex-start;
    }
}

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

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


/* 图片生成中动画 */
.image-generating {
    margin: 12px 0;
}

.image-generating-inner {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.12), rgba(0, 78, 137, 0.12));
    border: 1px solid rgba(255, 107, 53, 0.3);
    border-radius: 12px;
    padding: 14px 20px;
    backdrop-filter: blur(8px);
}

.image-gen-spinner {
    display: inline-flex;
    gap: 5px;
    align-items: center;
}

.image-gen-spinner div {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    animation: imageGenBounce 1.2s infinite ease-in-out;
}

.image-gen-spinner div:nth-child(1) { animation-delay: 0s; }
.image-gen-spinner div:nth-child(2) { animation-delay: 0.2s; }
.image-gen-spinner div:nth-child(3) { animation-delay: 0.4s; }
.image-gen-spinner div:nth-child(4) { animation-delay: 0.6s; }

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

.image-gen-text {
    font-size: 14px;
    color: var(--primary);
    font-weight: 500;
    letter-spacing: 0.3px;
    animation: imageGenPulse 2s infinite;
}

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