/* ==================== 全局重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --bg-main: #f8f9fc;
    --bg-sidebar: #ffffff;
    --bg-message-user: linear-gradient(135deg, #6366f1, #8b5cf6);
    --bg-message-ai: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --border-hover: #d1d5db;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --sidebar-width: 280px;
    --transition: 0.2s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

/* ==================== 登录页（长滚动落地页） ==================== */
.login-page {
    position: fixed;
    inset: 0;
    overflow-y: auto;
    overflow-x: hidden;
    background: #07070d;
    color: #e2e8f0;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    /* 关闭滚动锚定：防止键盘弹出/收起等视口变化时页面被自动重定位到其他区块 */
    overflow-anchor: none;
}

/* 顶部导航：完全透明 */
.lp-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
    padding: 0 40px;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 1px solid transparent;
}

.lp-nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 600;
    color: #f1f5f9;
    letter-spacing: 0.2px;
}

.lp-nav-logo-img {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.lp-nav-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.lp-nav-link {
    background: none;
    border: none;
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    padding: 8px 14px;
    border-radius: 8px;
    transition: color 0.2s ease, background 0.2s ease;
}

.lp-nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
}

.lp-nav-cta {
    padding: 9px 20px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lp-nav-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.45);
}

/* Hero 主视觉 */
.lp-hero {
    position: relative;
    min-height: 100vh;
    margin-top: -68px;          /* 让动态背景覆盖到顶部透明导航区域 */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 188px 24px 140px;  /* 顶部额外补回导航高度 */
    overflow: hidden;
}

.lp-hero-bg {
    position: absolute;
    inset: -12%;
    background-image: url('assets/material/web/hero-starry.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0.5;
    will-change: transform;
}

.lp-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(7, 7, 13, 0.55) 0%, rgba(7, 7, 13, 0.25) 45%, rgba(7, 7, 13, 0.98) 100%);
    pointer-events: none;
}

.lp-hero-inner {
    position: relative;
    z-index: 2;
    max-width: 860px;
}

.lp-hero-title {
    font-size: clamp(3rem, 8vw, 5.5rem);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.03em;
    color: #ffffff;
    margin-bottom: 24px;
    text-shadow: 0 2px 40px rgba(0, 0, 0, 0.35);
}

.lp-hero-sub {
    font-size: clamp(1.1rem, 2.2vw, 1.4rem);
    color: #a5b4cf;
    line-height: 1.7;
    max-width: 560px;
    margin: 0 auto 40px;
}

.lp-hero-cta {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.lp-btn-primary {
    padding: 15px 34px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.3px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lp-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.5);
}

.lp-btn-ghost {
    padding: 15px 34px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.3px;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.lp-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.lp-scroll-hint {
    position: absolute;
    left: 50%;
    bottom: 36px;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #64748b;
    font-size: 13px;
}

.lp-scroll-hint svg {
    animation: lpBounce 2s ease-in-out infinite;
}

@keyframes lpBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

/* 通用 section */
.lp-section {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 120px 40px;
}

.lp-section-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    text-align: center;
    color: #f1f5f9;
    margin-bottom: 14px;
}

.lp-section-desc {
    text-align: center;
    color: #94a3b8;
    font-size: 1.05rem;
    margin-bottom: 64px;
}

/* 核心能力卡片 */
.lp-feature-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.lp-feature-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 34px 28px;
    transition: transform 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}

.lp-feature-card:hover {
    transform: translateY(-6px);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(139, 92, 246, 0.4);
}

.lp-feature-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a5b4fc;
    margin-bottom: 22px;
}

.lp-feature-card h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 10px;
}

.lp-feature-card p {
    font-size: 0.92rem;
    color: #94a3b8;
    line-height: 1.7;
}

/* 滚动叙事：随滚动逐字点亮（CSS sticky 固定 + GSAP scrub） */
.lp-story {
    position: relative;
    height: 300vh; /* 预留滚动距离，供 sticky 固定 */
}

.lp-story-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
    overflow: hidden;
}

.lp-story-text {
    font-size: clamp(2.6rem, 7vw, 5.2rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.18;
    text-align: center;
    color: #f1f5f9;
}

/* 逐字 span：由 GSAP 从暗到亮点亮 */
.lp-story-text .wp {
    display: inline-block;
    opacity: 0.12;
    will-change: opacity;
}

/* 分镜展示：全屏大图 + 文案（Apple 式左右分栏） */
.lp-showcase--media {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    padding: 90px 40px;
    min-height: 88vh;
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    align-items: center;
    gap: 64px;
}

.lp-showcase-media {
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    box-shadow: 0 40px 90px rgba(0, 0, 0, 0.55);
    background: rgba(255, 255, 255, 0.04);
}

.lp-showcase-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 4 / 3;
    transform: scale(1.15);
    will-change: transform;
}

.lp-showcase-copy {
    max-width: 520px;
}

.lp-showcase-eyebrow {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #a5b4fc;
    margin-bottom: 18px;
}

.lp-showcase-title {
    font-size: clamp(1.9rem, 4vw, 3.1rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.22;
    color: #ffffff;
    margin-bottom: 22px;
}

.lp-showcase-desc {
    font-size: 1.02rem;
    line-height: 1.85;
    color: #94a3b8;
}

/* 反向分镜：图片在右，文字在左 */
.lp-showcase--reverse .lp-showcase-media {
    order: 2;
}

.lp-showcase--reverse .lp-showcase-copy {
    order: 1;
    justify-self: end;
    text-align: right;
}

/* 登录 / 注册区 */
.lp-auth-section {
    display: flex;
    justify-content: center;
    padding-top: 40px;
    padding-bottom: 120px;
}

.lp-auth-card {
    width: 100%;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 22px;
    padding: 40px 36px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.4);
}

.lp-auth-tabs {
    display: flex;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 5px;
    margin-bottom: 30px;
}

.lp-auth-tab {
    flex: 1;
    padding: 11px 0;
    border: none;
    border-radius: 9px;
    background: none;
    color: #94a3b8;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s ease, color 0.2s ease;
}

.lp-auth-tab.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-weight: 600;
}

/* 通用表单（弹窗共用浅色；登录页深色覆盖） */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 登录 / 注册表单切换动画：出场下沉淡出 → 入场浮起淡入 */
.auth-form--out {
    animation: authFormOut 0.24s ease forwards;
}
.auth-form--in {
    animation: authFormIn 0.28s cubic-bezier(0.22, 0.85, 0.35, 1) forwards;
}
@keyframes authFormOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-14px); }
}
@keyframes authFormIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .auth-form--out,
    .auth-form--in {
        animation: none;
    }
}

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

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
    outline: none;
    font-family: inherit;
    background: #fff;
    color: var(--text-primary);
}

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

.password-wrapper {
    position: relative;
}

.password-wrapper input {
    width: 100%;
    padding-right: 44px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.toggle-password:hover {
    color: var(--primary);
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.link-text {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

.link-text:hover {
    text-decoration: underline;
}

.btn-primary {
    padding: 13px 24px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    letter-spacing: 2px;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

/* 登录页深色表单覆盖 */
.lp-auth-card .form-group label {
    color: #cbd5e1;
}

.lp-auth-card .form-group input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f1f5f9;
}

.lp-auth-card .form-group input::placeholder {
    color: #64748b;
}

.lp-auth-card .form-group input:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.lp-auth-card .toggle-password {
    color: #94a3b8;
}

.lp-auth-card .toggle-password:hover {
    color: #a5b4fc;
}

.lp-auth-card .checkbox-label {
    color: #94a3b8;
}

.lp-auth-card .link-text {
    color: #a5b4fc;
}

.lp-auth-card .btn-primary {
    letter-spacing: 2px;
    padding: 14px 24px;
}

/* 页脚 */
.lp-footer {
    text-align: center;
    padding: 48px 24px 56px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    color: #94a3b8;
    font-size: 14px;
    line-height: 1.8;
}

.lp-footer-meta {
    color: #64748b;
    font-size: 12.5px;
    margin-top: 6px;
}

/* 响应式 */
@media (max-width: 900px) {
    .lp-feature-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .lp-showcase--media {
        grid-template-columns: 1fr;
        gap: 32px;
        padding: 64px 24px;
        min-height: 0;
    }
    .lp-showcase--reverse .lp-showcase-media,
    .lp-showcase--reverse .lp-showcase-copy {
        order: initial;
        justify-self: start;
        text-align: left;
    }
}

@media (max-width: 560px) {
    .lp-nav {
        padding: 0 20px;
    }
    .lp-section {
        padding: 80px 20px;
    }
    .lp-feature-grid {
        grid-template-columns: 1fr;
    }
    .lp-hero-cta {
        flex-direction: column;
        align-items: stretch;
    }
    .lp-auth-card {
        padding: 30px 22px;
    }
}

/* ==================== 聊天应用布局 ==================== */
.chat-app {
    display: flex;
    height: 100vh;
}

/* ==================== 侧边栏 ==================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
    flex-shrink: 0;
}

.sidebar.collapsed {
    margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

/* 侧边栏顶部品牌区（logo + 名称） */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.sidebar-brand-logo {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    object-fit: cover;
}
.sidebar-brand-name {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--text-primary);
    flex: 1;
}
.sidebar-brand-close {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: var(--transition);
}
.sidebar-brand-close:hover {
    background: var(--bg-main);
    color: var(--text-primary);
}

.btn-new-chat {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    font-family: inherit;
}

.btn-new-chat:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.sidebar-search {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box svg {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--bg-main);
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}

.search-box input:focus {
    border-color: var(--primary);
    background: white;
}

.chat-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

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

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

.chat-history-item {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    position: relative;
    will-change: transform;
}

.chat-history-item:hover {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.14), rgba(139, 92, 246, 0.04) 70%, transparent);
}

.chat-history-item.active {
    background: rgba(99, 102, 241, 0.1);
}

.chat-history-item .chat-icon {
    flex-shrink: 0;
    color: var(--text-muted);
}

.chat-history-item.active .chat-icon {
    color: var(--primary);
}

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

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

.chat-history-item .chat-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.chat-history-item .chat-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.chat-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: var(--text-muted);
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.chat-action-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.chat-action-btn.delete,
.kb-action-btn.delete,
.kb-doc-delete {
    will-change: transform;
}

.chat-action-btn.delete:hover {
    color: #ef4444;
}

.chat-action-btn.rename:hover {
    color: #3b82f6;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.user-info:hover {
    background: var(--bg-main);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

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

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

.btn-logout {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.btn-logout:hover {
    background: #fef2f2;
    color: #ef4444;
}

/* ==================== 主聊天区 ==================== */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-main);
    position: relative;
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    min-height: 56px;
}

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

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

/* 消息操作栏 */
.message-actions {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}

.msg-action-btn {
    background: white;
    border: 1px solid var(--border-color);
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    color: var(--text-secondary);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    box-shadow: var(--shadow-sm);
}

.msg-action-btn .copy-label {
    line-height: 1;
}

.msg-action-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.msg-action-btn.copied {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

/* 用户消息的复制按钮 — 实心白色背景，在渐变气泡上清晰可见 */
.message.user .msg-action-btn {
    background: white;
    border-color: rgba(0, 0, 0, 0.08);
    color: var(--text-secondary);
}

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

.chat-title {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.btn-icon {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.btn-icon:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* ==================== 消息列表 ==================== */
.message-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
    scroll-behavior: smooth;
}

.message-list.drag-over {
    background: rgba(99, 102, 241, 0.05);
    outline: 2px dashed var(--primary);
    outline-offset: -8px;
}

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

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

/* 欢迎界面 */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
    text-align: center;
}

.welcome-logo {
    margin-bottom: 24px;
}

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

.welcome-screen > p {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.suggestion-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 600px;
    width: 100%;
}

.suggestion-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
    text-align: left;
    will-change: transform, opacity;
}

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

.suggestion-icon {
    font-size: 24px;
    flex-shrink: 0;
}

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

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

.suggestion-text span {
    font-size: 13px;
    color: var(--text-secondary);
}

/* 消息气泡 */
.message {
    display: flex;
    gap: 12px;
    padding: 8px 24px;
    margin-bottom: 8px;
    will-change: transform, opacity;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
}

.message-avatar .avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

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

.message.ai .message-avatar {
    background: #f3f4f6;
    color: var(--text-primary);
}

.message-content {
    max-width: 70%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    will-change: transform;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}

.message.user .message-bubble {
    background: var(--bg-message-user);
    color: white;
    border-radius: var(--radius-md) var(--radius-md) 4px var(--radius-md);
}

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

.message.ai .message-bubble {
    background: var(--bg-message-ai);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 4px;
}

.message-bubble p {
    margin: 0;
}

.message-bubble p + p {
    margin-top: 8px;
}

.message-bubble code {
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Consolas', 'Monaco', monospace;
}

.message.user .message-bubble code {
    background: rgba(255, 255, 255, 0.2);
}

.message-bubble pre {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 8px 0;
    font-size: 13px;
    line-height: 1.5;
}

.message-bubble pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* ===== Markdown 元素样式 ===== */

.message-bubble strong {
    font-weight: 700;
}

.message-bubble em {
    font-style: italic;
}

/* 标题 */
.message-bubble .md-h1,
.message-bubble .md-h2,
.message-bubble .md-h3,
.message-bubble .md-h4 {
    font-weight: 700;
    margin: 12px 0 6px;
    line-height: 1.3;
}

.message-bubble .md-h1 { font-size: 18px; }
.message-bubble .md-h2 { font-size: 16px; }
.message-bubble .md-h3 { font-size: 15px; }
.message-bubble .md-h4 { font-size: 14px; color: var(--text-secondary); }

/* 表格 */
.message-bubble .md-table-wrap {
    overflow-x: auto;
    margin: 8px 0;
}

.message-bubble .md-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 13px;
}

.message-bubble .md-table th {
    background: rgba(99, 102, 241, 0.1);
    font-weight: 600;
    text-align: left;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    white-space: nowrap;
}

.message-bubble .md-table td {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
}

.message-bubble .md-table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

/* 列表 */
.message-bubble .md-ul,
.message-bubble .md-ol {
    margin: 6px 0;
    padding-left: 22px;
}

.message-bubble .md-ul { list-style: disc; }
.message-bubble .md-ol { list-style: decimal; }

.message-bubble .md-li {
    margin: 3px 0;
    line-height: 1.6;
}

/* 引用 */
.message-bubble .md-quote {
    border-left: 3px solid var(--primary);
    padding: 4px 12px;
    margin: 8px 0;
    color: var(--text-secondary);
    background: rgba(99, 102, 241, 0.05);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* 链接 */
.message-bubble .md-link {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px dashed var(--primary);
}

.message-bubble .md-link:hover {
    opacity: 0.8;
}

/* 分隔线 */
.message-bubble .md-hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 12px 0;
}

/* 消息中的图片 */
.message-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.message-image {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.message-image:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

/* 消息中的文件 */
.message-files {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.message-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.message.user .message-file {
    background: rgba(255, 255, 255, 0.15);
}

.message-file:hover {
    background: rgba(0, 0, 0, 0.08);
}

.message.user .message-file:hover {
    background: rgba(255, 255, 255, 0.25);
}

.message-file-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

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

.message-file-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-file-size {
    font-size: 12px;
    opacity: 0.7;
}

/* 打字指示器 */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.typing-label {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    will-change: transform, opacity;
}

/* 思考中状态（SSE 已连接，等待首个 chunk） */
.thinking-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
}

.thinking-status .thinking-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    flex-shrink: 0;
    will-change: transform;
}

/* ==================== 输入区 ==================== */
.chat-input-area {
    padding: 12px 24px 16px;
    background: white;
    border-top: 1px solid var(--border-color);
}

.file-preview-area {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
    padding: 8px 0;
}

.file-preview {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    max-width: 240px;
    will-change: transform;
}

.file-preview.image-preview {
    padding: 4px;
}

.file-preview img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.file-preview-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.file-preview-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.file-preview-size {
    font-size: 11px;
    color: var(--text-muted);
}

.file-preview-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    border: 2px solid white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    will-change: transform;
}

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

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 8px 12px;
    transition: var(--transition);
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn-attach {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    position: relative;
}

.btn-attach:hover {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

/* 上传按钮角标：显示已选文件数量 */
.btn-attach-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 2px var(--bg-main);
}

.input-box {
    flex: 1;
    min-width: 0;
}

.input-box textarea {
    width: 100%;
    border: none;
    background: none;
    outline: none;
    resize: none;
    font-size: 14px;
    line-height: 1.5;
    max-height: 200px;
    font-family: inherit;
    color: var(--text-primary);
}

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

.btn-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
    will-change: transform;
}

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

.input-hint {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ==================== 拖拽上传遮罩 ==================== */
.drag-drop-overlay {
    display: flex;
    visibility: hidden;
    opacity: 0;
    position: absolute;
    inset: 0;
    z-index: 100;
    background: rgba(99, 102, 241, 0.08);
    border: 2px dashed var(--primary);
    border-radius: var(--radius-lg);
    pointer-events: none;
    align-items: center;
    justify-content: center;
}

.drag-drop-overlay.active {
    visibility: visible;
}

.drag-drop-content {
    text-align: center;
    color: var(--primary);
    will-change: transform, opacity;
}

.drag-drop-content p {
    margin-top: 12px;
    font-size: 16px;
    font-weight: 600;
}

/* ==================== 图片预览弹窗 ==================== */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.image-modal.active {
    display: flex;
}

.image-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    will-change: transform, opacity;
}

.image-modal-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-md);
    object-fit: contain;
}

.btn-close-modal {
    position: absolute;
    top: -48px;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    cursor: pointer;
    color: white;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.btn-close-modal:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==================== Toast 提示 ==================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: white;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
}

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

.toast.success {
    background: #10b981;
}

.toast.error {
    background: #ef4444;
}

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

.toast.warning {
    background: #f59e0b;
}

/* ==================== 侧边栏 Tab ==================== */
.sidebar-tabs {
    display: flex;
    padding: 0 16px;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition);
    font-family: inherit;
}

.sidebar-tab:hover {
    color: var(--text-primary);
}

.sidebar-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    flex: 1;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.tab-content.active {
    display: flex;
}

/* ==================== 知识库管理 ==================== */
.kb-section {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
}

.kb-section::-webkit-scrollbar {
    width: 6px;
}

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

.btn-new-kb {
    width: 100%;
    padding: 10px 16px;
    background: var(--bg-main);
    color: var(--primary);
    border: 1px dashed var(--primary);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    font-family: inherit;
    margin-bottom: 12px;
}

.btn-new-kb:hover {
    background: rgba(99, 102, 241, 0.08);
}

.kb-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kb-item {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    position: relative;
}

.kb-item:hover {
    background: var(--bg-main);
}

.kb-item .kb-icon {
    flex-shrink: 0;
    color: var(--primary);
}

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

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

.kb-item .kb-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.kb-item .kb-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.kb-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: var(--text-muted);
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.kb-action-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.kb-action-btn.delete:hover {
    color: #ef4444;
}

.kb-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ==================== 知识库选择器 ==================== */
.kb-selector-area {
    margin-bottom: 8px;
}

.kb-selector-dropdown {
    position: relative;
}

.kb-selector-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    width: fit-content;
}

.kb-selector-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.kb-selector-btn.active {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

.kb-selector-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 4px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 240px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 100;
}

.kb-selector-menu::-webkit-scrollbar {
    width: 6px;
}

.kb-selector-menu::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.kb-selector-item {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.kb-selector-item:hover {
    background: var(--bg-main);
}

.kb-selector-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-weight: 500;
}

.kb-selector-item .check-icon {
    margin-left: auto;
    color: var(--primary);
    display: none;
}

.kb-selector-item.active .check-icon {
    display: flex;
}

/* ==================== 弹窗通用样式 ==================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1500;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    will-change: transform, opacity;
}

.modal-card.modal-lg {
    max-width: 640px;
}

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

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

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: var(--transition);
    display: flex;
    align-items: center;
}

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

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

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

.btn-secondary {
    padding: 10px 20px;
    background: var(--bg-main);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* ==================== 知识库文档管理 ==================== */
.kb-upload-area {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-main);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.btn-upload-doc {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    flex-shrink: 0;
}

.btn-upload-doc:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.kb-upload-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.kb-doc-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kb-doc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.kb-doc-item:hover {
    border-color: var(--border-hover);
}

.kb-doc-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

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

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

.kb-doc-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.kb-doc-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.kb-doc-status.ready {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.kb-doc-status.processing {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.kb-doc-status.failed {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.kb-doc-delete {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: var(--transition);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.kb-doc-delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.kb-doc-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ==================== 已发送文件弹窗 ==================== */
.sent-files-empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-muted);
    font-size: 14px;
}

.sent-files-group-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 20px 0 12px;
    padding-left: 10px;
    border-left: 3px solid var(--primary);
}

.sent-files-group-title:first-child {
    margin-top: 0;
}

.sent-files-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.sent-image-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sent-image-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.sent-image-item img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.sent-files-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sent-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.sent-file-item:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.04);
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        z-index: 100;
        height: 100%;
        box-shadow: var(--shadow-xl);
    }

    .sidebar.collapsed {
        margin-left: calc(-1 * var(--sidebar-width));
    }

    .message-content {
        max-width: 85%;
    }

    .suggestion-cards {
        grid-template-columns: 1fr;
    }

    .chat-input-area {
        padding: 12px 16px;
    }

    .message {
        padding: 8px 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chat-history-item,
    .suggestion-card,
    .message,
    .file-preview,
    .btn-send,
    .drag-drop-content,
    .modal-card,
    .image-modal-content,
    .typing-dots span,
    .thinking-status .thinking-spinner,
    .file-preview-remove,
    .message-content {
        will-change: auto;
    }

    .suggestion-card:hover {
        transform: none;
    }
}

/* ==================== 聊天页暗色主题（与登录页风格统一） ==================== */
:root {
    --bg-main: #0b0c14;
    --bg-sidebar: #0e0f18;
    --bg-message-ai: #151722;
    --text-primary: #e2e8f0;
    --text-secondary: #9aa4b8;
    --text-muted: #64748b;
    --border-color: rgba(255, 255, 255, 0.09);
    --border-hover: rgba(255, 255, 255, 0.18);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 24px -3px rgba(0, 0, 0, 0.55), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 24px 40px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

/* 主聊天区顶部淡光，呼应登录页 Hero */
.chat-main {
    background:
        radial-gradient(1200px 500px at 50% -10%, rgba(99, 102, 241, 0.08), transparent 60%),
        var(--bg-main);
}

.chat-header {
    background: var(--bg-sidebar);
}

.chat-input-area {
    background: var(--bg-sidebar);
}

.form-group input {
    background: #14151f;
}

.search-box input:focus {
    background: #14151f;
}

.input-wrapper {
    background: #14151f;
}

.suggestion-card,
.msg-action-btn,
.modal-card,
.kb-selector-menu {
    background: #151722;
}

/* 用户消息上的操作按钮保持白底深字，保证在渐变气泡上可读 */
.message.user .msg-action-btn {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
    color: #475569;
}

.message.ai .message-avatar {
    background: #252840;
    color: #a5b4fc;
}

.message-bubble code {
    background: rgba(255, 255, 255, 0.1);
}

.message-file {
    background: rgba(255, 255, 255, 0.06);
}

.message-file:hover {
    background: rgba(255, 255, 255, 0.1);
}

.md-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.14);
    color: #f87171;
}

.kb-selector-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.chat-history-item.active {
    background: rgba(99, 102, 241, 0.16);
}

/* ==================== 图片素材升级：能力卡片 + 聊天欢迎区 ==================== */

/* 能力卡片：顶部大图 + 正文（以图片代替纯图标，提升视觉丰富度） */
.lp-feature-card {
    padding: 0;
    overflow: hidden;
}

.lp-feature-media {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
}

.lp-feature-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.lp-feature-card:hover .lp-feature-media img {
    transform: scale(1.07);
}

.lp-feature-body {
    padding: 22px 24px 26px;
}

/* 聊天页欢迎区：发光插图 */
.welcome-visual {
    width: 200px;
    height: 200px;
    margin: 0 auto 24px;
    border-radius: 32px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 24px 70px rgba(99, 102, 241, 0.35);
}

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

/* 标语使用更具辨识度的展示字体 */
.lp-story-text {
    font-family: 'Sora', 'Inter', sans-serif;
}

/* ==================== 灵感画廊（仿 haowallpaper 瀑布流透明卡片） ==================== */

.lp-gallery {
    padding: 110px 40px 130px;
    max-width: 1460px;
    margin: 0 auto;
}

.lp-gallery-filters {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 34px 0 46px;
}

.g-filter {
    padding: 9px 22px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: #9aa4b8;
    font-size: 14px;
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: color 0.25s, border-color 0.25s, background 0.25s;
}

.g-filter:hover {
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.25);
}

.g-filter.active {
    color: #ffffff;
    background: rgba(99, 102, 241, 0.22);
    border-color: rgba(129, 140, 248, 0.55);
}

/* 瀑布流：columns 自适应列数 */
.lp-gallery-grid {
    columns: 4 230px;
    column-gap: 18px;
}

.g-card {
    position: relative;
    margin: 0 0 18px;
    border-radius: 18px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    break-inside: avoid;
    cursor: zoom-in;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    transition: transform 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

.g-card:hover,
.g-card:focus-visible {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.5);
    outline: none;
}

.g-card-media img {
    width: 100%;
    display: block;
    transition: transform 0.55s ease;
}

.g-card:hover .g-card-media img {
    transform: scale(1.06);
}

/* 右上角分辨率角标（常显，半透明） */
.g-res {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    border-radius: 8px;
    background: rgba(10, 12, 20, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #cbd5e1;
    font-size: 11px;
    letter-spacing: 0.04em;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* 悬浮时底部渐显信息层 */
.g-info {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 44px 16px 14px;
    background: linear-gradient(to top, rgba(8, 9, 16, 0.9), rgba(8, 9, 16, 0));
    display: flex;
    flex-direction: column;
    gap: 3px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.g-card:hover .g-info,
.g-card:focus-visible .g-info {
    opacity: 1;
    transform: translateY(0);
}

.g-title {
    color: #f1f5f9;
    font-size: 14px;
    font-weight: 600;
}

.g-tags {
    color: #94a3b8;
    font-size: 12px;
}

/* ---------- 灯箱 ---------- */

.g-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 5vh 4vw;
}

.g-lightbox.open {
    display: flex;
}

.g-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 6, 12, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.g-lightbox-body {
    position: relative;
    max-width: min(1200px, 92vw);
    margin: 0;
}

.g-lightbox-body img {
    width: 100%;
    max-height: 82vh;
    object-fit: contain;
    border-radius: 16px;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
    display: block;
}

.g-lightbox-body figcaption {
    margin-top: 14px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
    color: #e2e8f0;
    font-size: 14px;
}

.g-lightbox-meta {
    color: #94a3b8;
    font-size: 13px;
}

.g-lightbox-close {
    position: absolute;
    top: 22px;
    right: 26px;
    z-index: 2;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #e2e8f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.25s, transform 0.25s;
}

.g-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: rotate(90deg);
}

@media (max-width: 900px) {
    .lp-gallery {
        padding: 70px 20px 80px;
    }

    .lp-gallery-grid {
        columns: 2 150px;
        column-gap: 12px;
    }

    .g-card {
        margin-bottom: 12px;
        border-radius: 14px;
    }
}

/* ==================== Hero 动态视频背景 ==================== */
.lp-hero-bg {
    opacity: 0.75;
}

.lp-hero-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    will-change: transform;
}

/* ==================== 画廊：动态角标 + 分辨率 + 灯箱视频 ==================== */
.g-live-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.88);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.35);
}

.g-size {
    color: #64748b;
    font-size: 12px;
}

.g-lightbox-body video {
    display: block;
    width: 100%;
    max-height: 82vh;
    border-radius: 16px;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
    background: #000;
}

/* ==================== 头像按钮 + 选择弹层 ==================== */
.avatar-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    background: none;
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.avatar-btn:hover {
    border-color: #818cf8;
    transform: scale(1.06);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25);
}

.avatar-btn .avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.avatar-picker {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.avatar-picker.open {
    display: flex;
}

.avatar-picker-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 6, 12, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.avatar-picker-panel {
    position: relative;
    width: min(430px, 100%);
    background: rgba(18, 20, 32, 0.88);
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 22px;
    padding: 24px;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
}

.avatar-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.avatar-picker-head h3 {
    color: #f1f5f9;
    font-size: 17px;
    font-weight: 600;
}

.avatar-picker-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.avatar-picker-close:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.avatar-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    padding: 14px 6px;
    background: none;
    border: 2px solid transparent;
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.avatar-option:hover {
    background: rgba(255, 255, 255, 0.06);
}

.avatar-option.active {
    border-color: #818cf8;
    background: rgba(99, 102, 241, 0.16);
}

.avatar-option img {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.avatar-option-name {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
}

.avatar-option.active .avatar-option-name {
    color: #e2e8f0;
    font-weight: 600;
}

/* ==================== 聊天主界面：壁纸背景 + 毛玻璃透明组件 ==================== */
.chat-app {
    position: relative;
    background:
        linear-gradient(180deg, rgba(7, 8, 15, 0.6) 0%, rgba(7, 8, 15, 0.74) 100%),
        url('assets/material/web/hero-starry.jpg') center / cover no-repeat;
}

.sidebar {
    background: rgba(13, 14, 24, 0.55);
    backdrop-filter: blur(26px) saturate(140%);
    -webkit-backdrop-filter: blur(26px) saturate(140%);
    border-right: 1px solid rgba(255, 255, 255, 0.09);
}

.chat-main {
    background: transparent;
}

.chat-header {
    background: rgba(13, 14, 24, 0.42);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.chat-input-area {
    background: rgba(13, 14, 24, 0.42);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.message.ai .message-bubble {
    background: rgba(21, 23, 34, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.suggestion-card {
    background: rgba(21, 23, 34, 0.56);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.suggestion-card:hover {
    border-color: #6366f1;
}

.input-wrapper {
    background: rgba(20, 21, 31, 0.58);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-color: rgba(255, 255, 255, 0.12);
}

.msg-action-btn {
    background: rgba(21, 23, 34, 0.66);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
}

.search-box input {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

.welcome-visual {
    border-color: rgba(139, 92, 246, 0.45);
    box-shadow: 0 24px 70px rgba(99, 102, 241, 0.45);
}

/* ==================== 登录页滚动背景（哲风壁纸交叉淡入） ==================== */
.lp-bg-stack {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.lp-bg-stack::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(180deg, rgba(7, 7, 13, 0.5) 0%, rgba(7, 7, 13, 0.62) 55%, rgba(7, 7, 13, 0.8) 100%);
}

.lp-bg-layer {
    position: absolute;
    inset: -6%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    will-change: opacity, transform;
    animation: lpBgZoom 46s ease-in-out infinite alternate;
}

@keyframes lpBgZoom {
    from { transform: scale(1); }
    to { transform: scale(1.09); }
}

/* 内容层置于背景之上（导航 sticky 自身已有更高 z-index，保持不动） */
.lp-hero,
.lp-story,
.lp-showcase--media,
.lp-section,
.lp-footer {
    position: relative;
    z-index: 1;
}

/* 能力卡片：玻璃透明 + 透出滚动壁纸 */
.lp-feature-card {
    position: relative;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.10);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.35);
}

/* ==================== 滚动叙事标语：超大字号 + 渐变 + 逐词点亮 ==================== */
.lp-story-text {
    font-size: clamp(3.2rem, 9vw, 7.6rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.06;
}

.lp-story-text .wp {
    display: inline-block;
    opacity: 0.14;
    will-change: opacity, transform, filter;
    background: linear-gradient(120deg, #b6c2f5 0%, #ffffff 48%, #a78bfa 92%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #f1f5f9;
}

/* ==================== 卡片聚光灯（灯光跟随鼠标/手指） ==================== */
.lp-feature-card::before,
.g-card::before,
.suggestion-card::before,
.lp-auth-card::before,
.lp-showcase-media::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: radial-gradient(300px circle at var(--mx, 50%) var(--my, 50%), rgba(139, 92, 246, 0.26), transparent 66%);
}

.lp-feature-card:hover::before,
.g-card:hover::before,
.suggestion-card:hover::before,
.lp-auth-card:hover::before,
.lp-showcase-media:hover::before {
    opacity: 1;
}

.suggestion-card,
.lp-auth-card {
    position: relative;
    overflow: hidden;
}

/* ==================== 按钮高光扫过 ==================== */
.lp-btn-primary,
.lp-nav-cta,
.btn-send {
    position: relative;
    overflow: hidden;
}

.lp-btn-primary::after,
.lp-nav-cta::after,
.btn-send::after {
    content: '';
    position: absolute;
    top: 0;
    left: -80%;
    width: 46%;
    height: 100%;
    background: linear-gradient(115deg, transparent, rgba(255, 255, 255, 0.32), transparent);
    transform: skewX(-20deg);
    transition: left 0.55s ease;
    pointer-events: none;
}

.lp-btn-primary:hover::after,
.lp-nav-cta:hover::after,
.btn-send:hover::after {
    left: 132%;
}

/* ==================== 聊天主界面：各模块独立壁纸 + 更高透明 ==================== */
.chat-app {
    background: #07070d;
}

.sidebar {
    background:
        linear-gradient(180deg, rgba(10, 11, 20, 0.74) 0%, rgba(10, 11, 20, 0.88) 100%),
        url('assets/material/web/bg-cloud-night.jpg') center / cover no-repeat;
    border-right: 1px solid rgba(255, 255, 255, 0.09);
}

.chat-main {
    background:
        linear-gradient(180deg, rgba(10, 11, 20, 0.66) 0%, rgba(10, 11, 20, 0.84) 100%),
        url('assets/material/web/bg-reflection.jpg') center / cover no-repeat;
}

.chat-header {
    background: rgba(11, 12, 22, 0.34);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.chat-input-area {
    background: rgba(11, 12, 22, 0.34);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.message.ai .message-bubble {
    background: rgba(21, 23, 34, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.suggestion-card {
    background: rgba(21, 23, 34, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.input-wrapper {
    background: rgba(20, 21, 31, 0.44);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-color: rgba(255, 255, 255, 0.12);
}

.msg-action-btn {
    background: rgba(21, 23, 34, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
}

.modal-card {
    background: rgba(19, 21, 33, 0.78);
    backdrop-filter: blur(26px) saturate(140%);
    -webkit-backdrop-filter: blur(26px) saturate(140%);
}

.kb-selector-menu {
    background: rgba(19, 21, 33, 0.72);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

@media (prefers-reduced-motion: reduce) {
    .lp-bg-layer {
        animation: none;
    }
}

/* ==================== 灵感画廊 · 滚动翻书（右侧入场 → 扇形翻页 → 左侧离场） ==================== */
.lp-gallery {
    position: relative;
    z-index: 1;
    padding: 0;
    max-width: none;
}

.lp-gallery-head {
    text-align: center;
    padding: 120px 24px 12px;
}

.lp-book {
    position: relative;
    height: 340vh;
}

.lp-book-viewport {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 2000px;
    overflow: hidden;
}

.book-scene {
    position: relative;
    width: 300px;
    height: 196px;
    transform-style: preserve-3d;
    will-change: transform;
}

/* 精装书硬壳背衬 */
.book-cover--back {
    position: absolute;
    inset: -30px -34px -30px -34px;
    border-radius: 20px;
    background:
        linear-gradient(150deg, rgba(66, 52, 88, 0.95), rgba(20, 16, 28, 0.98)),
        radial-gradient(120% 80% at 20% 0%, rgba(139, 92, 246, 0.25), transparent 60%);
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 0 44px 100px rgba(0, 0, 0, 0.62);
}

.book-pages {
    position: absolute;
    inset: 0;
}

/* 书脊 */
.book-spine {
    position: absolute;
    left: 50%;
    bottom: -40px;
    transform: translateX(-50%);
    width: 46%;
    height: 14px;
    border-radius: 8px;
    background: linear-gradient(180deg, #4b4166, #17131f);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.65);
}

.book-page {
    position: absolute;
    inset: 0;
    margin: 0;
    border-radius: 12px;
    overflow: hidden;
    background: #0b0d18;
    border: 1px solid rgba(0, 0, 0, 0.35);
    outline: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    cursor: zoom-in;
    transform-origin: 0% 50%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: transform, opacity;
}

.book-page-media,
.book-page-media img {
    width: 100%;
    height: 100%;
}

.book-page-media img {
    object-fit: cover;
    display: block;
    filter: saturate(1.05) contrast(1.02);
}

/* 聚光灯跟随（配合 interactions.js 设置的 --mx/--my） */
.book-page::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), rgba(167, 139, 250, 0.3), transparent 65%);
}

.book-page:hover::before,
.book-page:focus-visible::before {
    opacity: 1;
}

.book-page:hover,
.book-page:focus-visible {
    outline: 1px solid rgba(196, 181, 253, 0.55);
}

.book-page:hover .g-info,
.book-page:focus-visible .g-info {
    opacity: 1;
    transform: translateY(0);
}

.book-page .g-info {
    padding: 26px 12px 10px;
    z-index: 3;
}

.book-page .g-res,
.book-page .g-live-badge {
    z-index: 3;
}

/* 标题 + 进度 + 滚动提示 */
.book-caption {
    position: absolute;
    left: 50%;
    bottom: 158px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 220px;
    padding: 12px 28px;
    border-radius: 16px;
    background: rgba(15, 17, 28, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    pointer-events: none;
    text-align: center;
}

.book-caption-title {
    color: #f1f5f9;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.book-caption-tags {
    color: #94a3b8;
    font-size: 12px;
    letter-spacing: 0.06em;
}

.book-progress {
    position: absolute;
    left: 50%;
    bottom: 114px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: none;
}

.book-num {
    color: rgba(226, 232, 240, 0.85);
    font-size: 12px;
    letter-spacing: 0.14em;
    font-variant-numeric: tabular-nums;
}

.book-progress-track {
    display: block;
    width: min(220px, 40vw);
    height: 2px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.14);
    overflow: hidden;
}

.book-progress-bar {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 2px;
    background: linear-gradient(90deg, #818cf8, #a78bfa);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.8);
}

.book-hint {
    position: absolute;
    left: 50%;
    bottom: 48px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(148, 163, 184, 0.8);
    font-size: 12.5px;
    letter-spacing: 0.08em;
    pointer-events: none;
    white-space: nowrap;
}

.book-hint svg {
    animation: bookHintArrow 2.4s ease-in-out infinite;
}

@keyframes bookHintArrow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

@media (max-width: 720px) {
    .lp-book {
        height: 300vh;
    }
    .lp-gallery-head {
        padding: 64px 20px 12px;
    }
    .book-scene {
        width: 196px;
        height: 128px;
    }
    .book-cover--back {
        inset: -22px -26px -22px -26px;
        border-radius: 15px;
    }
    .book-spine {
        bottom: -28px;
        height: 10px;
    }
    .book-caption {
        bottom: 132px;
        min-width: 0;
        max-width: 84vw;
        padding: 10px 20px;
    }
    .book-progress {
        bottom: 90px;
    }
    .book-hint {
        bottom: 40px;
    }
}

/* ==================== 登录卡流光标题 ==================== */
.lp-auth-heading {
    text-align: center;
    margin: -6px 0 26px;
}

.lp-auth-title {
    margin: 0 0 10px;
    font-family: 'Sora', 'Inter', sans-serif;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.2;
    background: linear-gradient(110deg,
        #7c86ad 0%, #c7d2fe 20%, #ffffff 36%,
        #e0d3ff 52%, #a78bfa 66%, #7c86ad 84%);
    background-size: 240% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: authFlow 5s linear infinite;
    filter: drop-shadow(0 2px 18px rgba(139, 92, 246, 0.35));
}

@keyframes authFlow {
    0% { background-position: 220% 0; }
    100% { background-position: -220% 0; }
}

.lp-auth-sub {
    margin: 0;
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.46em;
    text-indent: 0.46em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.9);
}

/* ==================== 弹窗高透明磨砂（含头像选择 / 已发送文件） ==================== */
.modal-overlay {
    background: rgba(5, 7, 14, 0.36);
    backdrop-filter: blur(12px) saturate(125%);
    -webkit-backdrop-filter: blur(12px) saturate(125%);
}

.modal-card {
    background: linear-gradient(165deg, rgba(52, 58, 88, 0.32) 0%, rgba(10, 12, 24, 0.44) 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(34px) saturate(165%);
    -webkit-backdrop-filter: blur(34px) saturate(165%);
    box-shadow: 0 40px 90px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

/* 磨砂底上的文字与输入保持浅色可读 */
.modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
    color: #f1f5f9;
}

.modal-body {
    color: #cbd5e1;
}

.modal-body .form-group label {
    color: #9fb0cc;
}

.modal-body .form-group input {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.16);
    color: #eef2ff;
}

.modal-body .form-group input::placeholder {
    color: rgba(148, 163, 184, 0.75);
}

.modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.avatar-picker-panel {
    background: linear-gradient(170deg, rgba(52, 58, 88, 0.3) 0%, rgba(10, 12, 24, 0.44) 100%);
    backdrop-filter: blur(36px) saturate(165%);
    -webkit-backdrop-filter: blur(36px) saturate(165%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.image-modal {
    background: rgba(5, 7, 14, 0.42);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* 弹窗内部元素：白色实底改为半透明磨砂 */
.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    border-color: rgba(255, 255, 255, 0.18);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #f1f5f9;
}

.kb-upload-area {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.16);
}

.sent-file-item,
.kb-doc-item {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
}

.sent-file-item:hover,
.kb-doc-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sent-file-item *,
.kb-doc-info,
.kb-doc-name {
    color: #dbe3f0;
}

.kb-upload-hint {
    color: rgba(148, 163, 184, 0.9);
}

/* ==================== 侧边栏面板滑动切换 ==================== */
.tab-contents {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.tab-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.tab-content.active {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.sidebar-tabs {
    position: relative;
}

.tab-slider {
    position: absolute;
    bottom: -1px;
    left: 24px;
    width: calc(50% - 32px);
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, #6366f1, #a78bfa);
    box-shadow: 0 0 14px rgba(139, 92, 246, 0.9);
    transition: transform 0.5s cubic-bezier(0.22, 0.9, 0.28, 1);
    pointer-events: none;
}

.sidebar-tabs[data-active="knowledge"] .tab-slider {
    transform: translateX(calc(100% + 32px));
}

.sidebar-tab.active {
    border-bottom-color: transparent;
}

/* 知识库下拉菜单弹出动画 */
.kb-selector-menu {
    animation: menuPop 0.24s cubic-bezier(0.2, 0.85, 0.3, 1.15);
    transform-origin: top left;
}

@keyframes menuPop {
    from { opacity: 0; transform: translateY(-8px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .lp-auth-title,
    .book-hint svg,
    .kb-selector-menu {
        animation: none;
    }
    .tab-slider {
        transition: none;
    }
}

/* ==================== 登录页大字段：流光扫光（统一「从这里开始」样式，稍快） ==================== */
.lp-hero-title,
.lp-section-title,
.lp-showcase-title,
.lp-story-text .wp {
    background-image: linear-gradient(110deg,
        #7c86ad 0%, #c7d2fe 20%, #ffffff 36%,
        #e0d3ff 52%, #a78bfa 66%, #7c86ad 84%);
    background-size: 240% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    text-shadow: none;
    animation: authFlow 5s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .lp-hero-title,
    .lp-section-title,
    .lp-showcase-title,
    .lp-story-text .wp,
    .lp-auth-title {
        animation: none;
    }
}

/* ==================== 个人设置：主题选择面板 ==================== */
.picker-section-label {
    margin: 4px 0 12px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.85);
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 6px;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
    position: relative;
}

.theme-option:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.theme-option.active {
    border-color: rgba(167, 139, 250, 0.7);
    background: rgba(139, 92, 246, 0.14);
    box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.3) inset;
}

.theme-swatch {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.theme-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.theme-name {
    font-size: 14px;
    font-weight: 600;
    color: #f1f5f9;
}

.theme-desc {
    font-size: 12px;
    color: rgba(148, 163, 184, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.theme-check {
    position: absolute;
    top: 8px;
    right: 10px;
    color: #c4b5fd;
    font-size: 14px;
    font-weight: 700;
}

/* ==================== 主题配色（暗夜 dark 为默认 = 现状，不再覆盖） ==================== */
html[data-theme='light'] {
    --t-bg: #f3efe7;
    --t-panel: rgba(255, 252, 246, 0.62);
    --t-panel-soft: rgba(255, 252, 246, 0.42);
    --t-glass: rgba(255, 252, 246, 0.55);
    --t-text: #2a2f3a;
    --t-dim: #6f7686;
    --t-border: rgba(40, 46, 60, 0.14);
    --t-border-strong: rgba(40, 46, 60, 0.22);
    --t-input: rgba(255, 255, 255, 0.62);
    --t-modal-text: #2a2f3a;
    --bg-main: #f3efe7;
    --text-primary: #2a2f3a;
    --text-secondary: #6f7686;
    --text-muted: #98a0ad;
    --border-color: rgba(40, 46, 60, 0.14);
    --border-hover: rgba(40, 46, 60, 0.26);
    --bg-message-ai: #ffffff;
}

html[data-theme='twilight'] {
    --t-bg: #241c3d;
    --t-panel: rgba(72, 52, 112, 0.5);
    --t-panel-soft: rgba(72, 52, 112, 0.36);
    --t-glass: rgba(58, 42, 92, 0.5);
    --t-text: #ede7f7;
    --t-dim: #a89cc2;
    --t-border: rgba(210, 190, 255, 0.16);
    --t-border-strong: rgba(210, 190, 255, 0.28);
    --t-input: rgba(255, 255, 255, 0.06);
    --t-modal-text: #ede7f7;
    --bg-main: #241c3d;
    --text-primary: #ede7f7;
    --text-secondary: #a89cc2;
    --text-muted: #c8bfdd;
    --border-color: rgba(210, 190, 255, 0.16);
    --border-hover: rgba(210, 190, 255, 0.3);
    --bg-message-ai: rgba(60, 44, 94, 0.6);
}

html[data-theme='sage'] {
    --t-bg: #17221c;
    --t-panel: rgba(45, 66, 52, 0.5);
    --t-panel-soft: rgba(45, 66, 52, 0.36);
    --t-glass: rgba(38, 56, 45, 0.5);
    --t-text: #e6eee8;
    --t-dim: #9db3a4;
    --t-border: rgba(190, 220, 200, 0.15);
    --t-border-strong: rgba(190, 220, 200, 0.28);
    --t-input: rgba(255, 255, 255, 0.06);
    --t-modal-text: #e6eee8;
    --bg-main: #17221c;
    --text-primary: #e6eee8;
    --text-secondary: #9db3a4;
    --text-muted: #c2d2c7;
    --border-color: rgba(190, 220, 200, 0.15);
    --border-hover: rgba(190, 220, 200, 0.3);
    --bg-message-ai: rgba(40, 58, 46, 0.6);
}

/* ---------- 登录页 ---------- */
html[data-theme='light'] .login-page,
html[data-theme='twilight'] .login-page,
html[data-theme='sage'] .login-page {
    background: var(--t-bg);
    color: var(--t-text);
}

html[data-theme='light'] .lp-hero::after,
html[data-theme='twilight'] .lp-hero::after,
html[data-theme='sage'] .lp-hero::after {
    background: linear-gradient(180deg, transparent 0%, transparent 42%, var(--t-bg) 100%);
}

html[data-theme='light'] .lp-nav-logo,
html[data-theme='twilight'] .lp-nav-logo,
html[data-theme='sage'] .lp-nav-logo {
    color: var(--t-text);
}

html[data-theme='light'] .lp-nav-link { color: #4a5162; }
html[data-theme='light'] .lp-nav-link:hover { color: #2a2f3a; background: rgba(0, 0, 0, 0.04); }

html[data-theme='light'] .lp-hero-sub { color: #5b6270; }
html[data-theme='light'] .lp-section-desc,
html[data-theme='light'] .lp-showcase-desc { color: #6b7280; }

html[data-theme='light'] .lp-feature-card,
html[data-theme='twilight'] .lp-feature-card,
html[data-theme='sage'] .lp-feature-card {
    background: var(--t-panel);
    border-color: var(--t-border);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
}

html[data-theme='light'] .lp-feature-card h3,
html[data-theme='twilight'] .lp-feature-card h3,
html[data-theme='sage'] .lp-feature-card h3 {
    color: var(--t-text);
}

html[data-theme='light'] .lp-feature-card p,
html[data-theme='twilight'] .lp-feature-card p,
html[data-theme='sage'] .lp-feature-card p {
    color: var(--t-dim);
}

html[data-theme='light'] .lp-auth-card,
html[data-theme='twilight'] .lp-auth-card,
html[data-theme='sage'] .lp-auth-card {
    background: var(--t-panel);
    border-color: var(--t-border);
}

html[data-theme='light'] .lp-auth-tabs { background: rgba(0, 0, 0, 0.045); }
html[data-theme='light'] .lp-auth-tab { color: #6b7280; }
html[data-theme='light'] .lp-auth-sub { color: #8a90a0; }

html[data-theme='light'] .lp-auth-card .form-group input {
    background: var(--t-input);
    border-color: var(--t-border);
    color: var(--t-text);
}
html[data-theme='light'] .lp-auth-card .form-group input::placeholder { color: #9aa0ad; }
html[data-theme='light'] .lp-auth-card .toggle-password { color: #6b7280; }

/* 亮色下流光标题改用深色渐变 */
html[data-theme='light'] .lp-hero-title,
html[data-theme='light'] .lp-section-title,
html[data-theme='light'] .lp-showcase-title,
html[data-theme='light'] .lp-story-text .wp {
    background-image: linear-gradient(120deg, #6c7a9c 0%, #3a4152 22%, #6557c8 40%, #2a2f3a 60%, #6c7a9c 80%, #3a4152 100%);
}
html[data-theme='light'] .lp-auth-title {
    background-image: linear-gradient(120deg, #6c7a9c 0%, #3a4152 20%, #6557c8 40%, #2a2f3a 60%, #6c7a9c 84%);
}

/* ---------- 聊天页 ---------- */
html[data-theme='light'] .chat-app,
html[data-theme='twilight'] .chat-app,
html[data-theme='sage'] .chat-app {
    background: var(--t-bg);
}

html[data-theme='light'] .sidebar,
html[data-theme='twilight'] .sidebar,
html[data-theme='sage'] .sidebar {
    background:
        linear-gradient(180deg, var(--t-glass) 0%, var(--t-glass) 100%),
        url('assets/material/web/bg-cloud-night.jpg') center / cover no-repeat;
    border-right: 1px solid var(--t-border);
}

html[data-theme='light'] .chat-main,
html[data-theme='twilight'] .chat-main,
html[data-theme='sage'] .chat-main {
    background:
        linear-gradient(180deg, var(--t-glass) 0%, var(--t-glass) 100%),
        url('assets/material/web/bg-reflection.jpg') center / cover no-repeat;
}

html[data-theme='light'] .chat-header,
html[data-theme='light'] .chat-input-area,
html[data-theme='twilight'] .chat-header,
html[data-theme='twilight'] .chat-input-area,
html[data-theme='sage'] .chat-header,
html[data-theme='sage'] .chat-input-area {
    background: var(--t-panel);
    border-color: var(--t-border);
}

html[data-theme='light'] .message.ai .message-bubble,
html[data-theme='twilight'] .message.ai .message-bubble,
html[data-theme='sage'] .message.ai .message-bubble {
    background: var(--t-panel-soft);
    border-color: var(--t-border);
    color: var(--t-text);
}

html[data-theme='light'] .suggestion-card,
html[data-theme='twilight'] .suggestion-card,
html[data-theme='sage'] .suggestion-card {
    background: var(--t-panel-soft);
    border-color: var(--t-border);
}

html[data-theme='light'] .input-wrapper,
html[data-theme='twilight'] .input-wrapper,
html[data-theme='sage'] .input-wrapper {
    background: var(--t-panel);
    border-color: var(--t-border);
}

html[data-theme='light'] .msg-action-btn { background: var(--t-panel); border-color: var(--t-border); color: #5b6270; }
html[data-theme='light'] .btn-icon { background: var(--t-panel); border-color: var(--t-border); color: #5b6270; }

html[data-theme='light'] .modal-card,
html[data-theme='light'] .avatar-picker-panel,
html[data-theme='light'] .kb-selector-menu,
html[data-theme='twilight'] .modal-card,
html[data-theme='twilight'] .avatar-picker-panel,
html[data-theme='twilight'] .kb-selector-menu,
html[data-theme='sage'] .modal-card,
html[data-theme='sage'] .avatar-picker-panel,
html[data-theme='sage'] .kb-selector-menu {
    background: linear-gradient(165deg, var(--t-panel) 0%, var(--t-panel-soft) 100%);
    border-color: var(--t-border-strong);
}

/* 亮色下弹窗文字改深色 */
html[data-theme='light'] .modal-header h3 { color: #2a2f3a; }
html[data-theme='light'] .modal-body { color: #4a5162; }
html[data-theme='light'] .modal-body .form-group label { color: #6b7280; }
html[data-theme='light'] .modal-body .form-group input {
    background: rgba(255, 255, 255, 0.7);
    border-color: var(--t-border);
    color: #2a2f3a;
}
html[data-theme='light'] .modal-body .form-group input::placeholder { color: #9aa0ad; }
html[data-theme='light'] .kb-upload-area { background: rgba(0, 0, 0, 0.03); border-color: var(--t-border); }
html[data-theme='light'] .sent-file-item,
html[data-theme='light'] .kb-doc-item { background: rgba(0, 0, 0, 0.03); border-color: var(--t-border); }
html[data-theme='light'] .sent-file-item:hover,
html[data-theme='light'] .kb-doc-item:hover { background: rgba(0, 0, 0, 0.06); }
html[data-theme='light'] .sent-file-item *,
html[data-theme='light'] .kb-doc-info,
html[data-theme='light'] .kb-doc-name { color: #3a4152; }
html[data-theme='light'] .btn-secondary { background: rgba(0, 0, 0, 0.05); border-color: var(--t-border); color: #4a5162; }
html[data-theme='light'] .btn-secondary:hover { background: rgba(0, 0, 0, 0.09); color: #2a2f3a; }
html[data-theme='light'] .theme-name { color: #2a2f3a; }
html[data-theme='light'] .theme-desc { color: #6f7686; }
html[data-theme='light'] .theme-option { border-color: rgba(40, 46, 60, 0.16); background: rgba(255, 255, 255, 0.5); }
html[data-theme='light'] .theme-option:hover { background: rgba(255, 255, 255, 0.7); }
html[data-theme='light'] .picker-section-label { color: #6f7686; }
html[data-theme='light'] .avatar-option-name { color: #5b6270; }
html[data-theme='light'] .avatar-option.active .avatar-option-name { color: #4f46e5; }
html[data-theme='light'] .avatar-option:hover { background: rgba(0, 0, 0, 0.05); }

/* ==================== 灵感画廊 · 3D 圆柱轮播（滚动循环展示） ==================== */
.lp-gallery {
    position: relative;
    z-index: 1;
    height: 100vh;           /* 与圆筒同高，避免底部留下大片空白滚动区；圆筒尺寸由 JS 变量控制，不受此影响 */
    padding: 0;
    max-width: none;
    margin: 0;
    /* 扩大旋转触发区到整个画廊区块：纵向滑动仍交还给页面滚动，横向才接管旋转 */
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

.gallery-stage {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1500px;
    perspective-origin: 50% 44%;
    overflow: hidden;
}

/* 圆柱体背后的柔光氛围 */
.gallery-stage::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(1000px, 80vw);
    height: min(1000px, 80vw);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(120, 128, 226, 0.16), rgba(90, 80, 180, 0.06) 46%, transparent 72%);
    pointer-events: none;
}

/* 圆柱容器：所有卡片围绕竖直轴排列 */
.carousel {
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--cw, 600px);
    height: var(--ch, 400px);
    transform: translate(-50%, -50%);
    transform-style: preserve-3d;
}

/* 画廊交互：水平拖拽旋转滚筒，垂直滑动留给页面滚动（不被锁定） */
.gallery-stage {
    touch-action: pan-y;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}
.gallery-stage.dragging {
    cursor: grabbing;
}
.gallery-stage .g-card {
    cursor: grab;
}
.gallery-stage.dragging .g-card {
    cursor: grabbing;
}

/* 单张壁纸卡片（transform 由 gallery.js 内联 rotateY + translateZ 指定） */
.lp-gallery .g-card,
.carousel .g-card {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--cw, 250px);
    height: var(--ch, 168px);
    margin: 0;
    padding: 0;
    border-radius: 14px;
    overflow: hidden;
    background-color: rgba(10, 12, 18, 0.55);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 1px solid rgba(255, 255, 255, 0.12);
    outline: none;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    cursor: zoom-in;
    list-style: none;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transition: filter 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    will-change: transform, filter;
}

/* 内嵌细框，营造“装裱画框”质感 */
.lp-gallery .g-card::after,
.carousel .g-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    pointer-events: none;
    z-index: 1;
}

.lp-gallery .g-card:hover,
.lp-gallery .g-card:focus-visible,
.carousel .g-card:hover,
.carousel .g-card:focus-visible {
    filter: brightness(1.12) saturate(1.08);
    border-color: rgba(196, 181, 253, 0.55);
    box-shadow: 0 28px 72px rgba(0, 0, 0, 0.62), 0 0 44px rgba(139, 92, 246, 0.32);
}

/* 圆柱上下椭圆轮廓（底面环） */
.carousel-ellipse {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(calc(var(--r, 500px) * 2), 94vw);
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

.carousel-ellipse--top {
    margin-top: calc(var(--ch, 168px) * -0.5 - 30px);
    border-bottom: none;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.carousel-ellipse--bottom {
    margin-top: calc(var(--ch, 168px) * 0.5 + 30px);
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

@media (max-width: 720px) {
    /* 手机端：画廊改为紧凑区块、放在页脚文案下方，不再占整屏；圆筒尺寸由 JS 变量控制，保持不变 */
    .lp-gallery {
        height: auto;
        padding: 24px 0 40px;
    }
    .gallery-stage {
        position: relative;
        top: auto;
        height: 42vh;
        min-height: 220px;
        perspective: 900px;
        perspective-origin: 50% 46%;
    }
    .carousel-ellipse { width: min(calc(var(--r, 360px) * 1.8), 92vw); height: 30px; }
}

@media (prefers-reduced-motion: reduce) {
    .lp-gallery { height: auto; padding: 90px 0 110px; }
    .gallery-stage { position: relative; top: auto; height: auto; min-height: 64vh; }
}

/* ============ 思考过程区块 ============ */
.message-thinking {
    border: 1px solid var(--t-border, var(--border-color));
    border-radius: var(--radius-md);
    background: var(--t-panel, var(--bg-message-ai));
    overflow: hidden;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    max-width: 100%;
}
.message-thinking .thinking-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-muted);
    user-select: none;
    transition: background .15s ease;
}
.message-thinking .thinking-header:hover { background: var(--t-hover, rgba(0, 0, 0, 0.04)); }
.message-thinking .thinking-chevron {
    display: inline-flex;
    transition: transform .2s ease;
}
.message-thinking .thinking-title { font-weight: 600; letter-spacing: .2px; }
.message-thinking .thinking-body {
    padding: 2px 12px 12px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 60vh;
    overflow-y: auto;
}

/* ==================== 移动端适配增强 ==================== */

/* 侧边栏移动端遮罩层 */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99;               /* 侧边栏 z-index 为 100，遮罩在其下 */
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    transition: opacity 0.25s ease;
}

@media (max-width: 900px) {
    /* 收窄侧边栏宽度，避免在手机上占据过大屏幕 */
    :root {
        --sidebar-width: 248px;
    }

    /* 侧边栏内顶部收起按钮：侧边栏展开时会覆盖顶栏汉堡按钮，用它来收起 */
    .sidebar-brand-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* 登录卡片在手机上缩放内边距与圆角 */
@media (max-width: 560px) {
    .lp-auth-card {
        padding: 28px 20px;
        border-radius: 18px;
    }
    .lp-auth-tabs { margin-bottom: 22px; }
    .lp-auth-section { padding-top: 24px; padding-bottom: 56px; }
    .form-group { gap: 6px; }
}

/* 头像选择器：小屏缩小头像、改为 3 列，避免横向截断 */
@media (max-width: 560px) {
    .avatar-picker-panel {
        width: min(430px, 94vw);
        padding: 20px 16px;
    }
    .avatar-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    .avatar-option img {
        width: 56px;
        height: 56px;
    }
    .avatar-option { padding: 10px 4px; }
}

/* 安全区适配：底部输入栏、设置面板等避开全面屏手势条 */
@media (max-width: 900px) {
    body {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .chat-input-area,
    .settings-panel,
    .avatar-picker-panel {
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
}

/* ==================== 移动端：登录页滚动/溢出修复 ==================== */
/* 根治「下拉旋转图片后无法上拉」：横向溢出会锁定触屏滚动链 */
html, body {
    max-width: 100%;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
}

@media (max-width: 720px) {
    /* 翻书容器收紧到屏宽内，禁止横向溢出，保证纵向滚动链不被破坏 */
    .lp-book-viewport {
        overflow-x: hidden;
        overflow-y: visible;
    }
    .book-scene {
        max-width: 100%;
    }
    .book-cover--back {
        inset: -18px -20px -18px -20px;
    }
    .gallery-stage,
    #carousel,
    .carousel-ellipse {
        max-width: 100%;
        overflow: visible;
    }
    /* 消除任何会造成横向滚动的元素 */
    .login-page .lp-gallery,
    .login-page .lp-showcase,
    .lp-auth-section {
        overflow-x: hidden;
    }
}

/* 触屏：允许纵向原生滚动（绝不锁死页面），横向手势交给 JS 驱动旋转；
   上下滑通过监听页面滚动带动旋转（见 gallery.js） */
@media (pointer: coarse) {
    .lp-gallery,
    .gallery-stage {
        touch-action: pan-y;
    }

    /* 手机端稳定性适配：键盘弹出/收起、键入时的闪烁与误跳修复 */
    /* 背景不再持续缩放，避免在磨砂卡片后频繁 repaint 造成闪烁 */
    .lp-bg-layer {
        animation: none;
    }
    /* 登录卡去掉 backdrop-filter（改用更通透的半透明底色），消除键入时的高频闪烁 */
    .lp-auth-card {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        background: rgba(10, 12, 20, 0.42);
    }
    /* 标题流光动画静止为静态渐变，减少键入过程中的合成刷新 */
    .lp-auth-title {
        animation: none;
    }
    /* iOS 会对字号 <16px 的输入框自动放大导致页面跳动；登录/注册框改为 16px 规避 */
    .lp-auth-card .form-group input[type="text"],
    .lp-auth-card .form-group input[type="email"],
    .lp-auth-card .form-group input[type="password"] {
        font-size: 16px;
    }
    /* 触屏下平滑滚动可能与键盘自动滚动冲突导致跳动，改回即时定位 */
    .login-page {
        scroll-behavior: auto;
    }
}
.message-thinking.collapsed .thinking-body { display: none; }
.message-thinking.collapsed .thinking-chevron { transform: rotate(-90deg); }

/* ============ 页脚 GitHub 链接 ============ */
.lp-footer-github {
    margin: 0 0 6px;
}
.lp-footer-github a {
    color: #a78bfa;
    text-decoration: none;
    font-size: 0.92rem;
    transition: color .2s;
}
.lp-footer-github a:hover {
    color: #c4b5fd;
    text-decoration: underline;
}

/* ============ 关于「知源 AI」弹窗 ============ */
.about-body {
    padding: 20px 22px;
}
.about-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 4px 0 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.about-logo {
    border-radius: 12px;
    border: 1px solid rgba(167,139,250,0.35);
    flex-shrink: 0;
}
.about-brand-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.about-name {
    font-weight: 600;
    font-size: 1.02rem;
}
.about-slogan {
    font-size: 0.85rem;
    color: #94a3b8;
}
.about-section-title {
    margin: 18px 0 8px;
    font-size: 0.8rem;
    letter-spacing: .06em;
    color: #a78bfa;
    font-weight: 600;
}
.about-item {
    display: flex;
    gap: 12px;
    margin-bottom: 9px;
    font-size: 0.9rem;
    line-height: 1.5;
}
.about-label {
    color: #94a3b8;
    flex-shrink: 0;
    width: 74px;
}
.about-value {
    color: #e2e8f0;
    word-break: break-word;
}
.about-value a {
    color: #a78bfa;
    text-decoration: none;
}
.about-value a:hover {
    text-decoration: underline;
}
.about-note {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(167,139,250,0.08);
    border: 1px solid rgba(167,139,250,0.15);
    font-size: 0.82rem;
    color: #cbd5e1;
    line-height: 1.6;
}
.about-note-title {
    display: block;
    font-weight: 600;
    color: #a78bfa;
    margin-bottom: 4px;
}
